diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f8ec2df..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: CI - -on: - push: - branches: [main] - tags: ['v*'] - pull_request: - branches: [main] - workflow_dispatch: - -permissions: - contents: write - -jobs: - test: - name: Unit Tests & Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - name: Run unit tests - run: make test - - - name: Verify no capi imports in cmd/ and examples/ - run: make check-no-capi - - - name: Lint - run: make lint - - check-examples: - name: Cross-compile Examples - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - name: Install Android NDK - run: | - make install-ndk - echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/28.0.13004108" >> "$GITHUB_ENV" - - - name: Cross-compile examples and ndkcli - run: make check-examples - - e2e-examples: - name: E2E Examples (Emulator) - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - name: Enable KVM - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - - name: Install Android NDK - run: | - make install-ndk - echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/28.0.13004108" >> "$GITHUB_ENV" - - - name: Run examples on emulator - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: 35 - target: google_apis - arch: x86_64 - script: | - make e2e-examples - make e2e-examples-test - - release: - name: Release ndkcli - runs-on: ubuntu-latest - needs: [test, check-examples] - if: startsWith(github.ref, 'refs/tags/v') - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - name: Install Android NDK - run: | - make install-ndk - echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/28.0.13004108" >> "$GITHUB_ENV" - - - name: Build release binaries - run: make ndkcli-release - - - name: Create release - env: - GH_TOKEN: ${{ github.token }} - TAG_NAME: ${{ github.ref_name }} - run: | - gh release create "$TAG_NAME" \ - --title "ndkcli $TAG_NAME" \ - --generate-notes \ - build/ndkcli-android-arm64 \ - build/ndkcli-android-x86_64 diff --git a/.github/workflows/lean_action_ci.yml b/.github/workflows/lean_action_ci.yml deleted file mode 100644 index f378b07..0000000 --- a/.github/workflows/lean_action_ci.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Lean Proofs & Differential Tests - -on: - push: - pull_request: - workflow_dispatch: - -jobs: - proofs: - name: Lean 4 Proofs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: leanprover/lean-action@v1 - with: - build-args: "" - lake-package-directory: proofs - - differential: - name: Differential Tests (Lean <-> Go) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - uses: leanprover/lean-action@v1 - with: - build-args: "" - lake-package-directory: proofs - - - name: Run differential tests - run: make test-differential diff --git a/.gitignore b/.gitignore index e3781cb..1585215 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,15 @@ -/discussion +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib -# Compiled E2E test binary -tests/e2e/e2e_test +# Test binary, build with `go test -c` +*.test -*.apk -_build/ -capi/manifests/.gen_*.yaml +# Output of the go coverage tool, specifically when used with LiteIDE +*.out -# Built binaries (go build outputs in repo root) -/basic-loop -/capigen -/capture-session -/check-permissions -/event-loop -/headerspec -/idiomgen -/manager -/null -/obb-manager -/offscreen-render -/overview -/specgen -/sync-fences -/timeout-poll -/vsync -/display - -cligen -ndkcli -build/ -/.lake +# Private data +priv \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index cf8e19c..0000000 --- a/.golangci.yml +++ /dev/null @@ -1,20 +0,0 @@ -version: "2" - -run: - timeout: 5m - -linters: - enable: - - errcheck - - govet - - ineffassign - - staticcheck - - unused - -formatters: - enable: - - gofmt - -issues: - max-issues-per-linter: 0 - max-same-issues: 0 diff --git a/.vscode/ltex.dictionary.en-US.txt b/.vscode/ltex.dictionary.en-US.txt new file mode 100644 index 0000000..d9aaec8 --- /dev/null +++ b/.vscode/ltex.dictionary.en-US.txt @@ -0,0 +1,2 @@ +NONINFRINGEMENT +FyneCameraDemo diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d1ab367 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "go.buildTags": "linux,android", + "go.toolsEnvVars": { + "CC": "${env:ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android35-clang --sysroot=${env:ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot", + "GOOS": "android", + "GOARCH": "arm64", + "CGO_ENABLED": "1", + }, + "C_Cpp.default.includePath": [ + "${env:ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/" + ], + "files.associations": { + "ndkimagereader.h": "c" + }, +} \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index b783951..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,30 +0,0 @@ -# Project Instructions - -## Code Generation Pipeline - -This project uses a three-stage code generation pipeline (see README.md for details): - -1. **Stage 1 (`make specs`)**: `tools/cmd/specgen` + `c2ffi` extracts structured YAML specs from C headers into `spec/generated/`. -2. **Stage 2 (`make capi`)**: `tools/cmd/capigen` generates raw CGo bindings in `capi/{module}/` from specs + manifests. -3. **Stage 3 (`make idiomatic`)**: `tools/cmd/idiomgen` generates idiomatic Go packages from specs + overlays + templates. - -## Rules - -### Never edit generated bindings directly - -All files under `capi/{module}/` and `{module}/` (top-level idiomatic packages like `looper/`, `camera/`, `sensor/`, etc.) are generated. They contain `// Code generated by ... DO NOT EDIT.` headers. - -**Never edit these files.** Instead, modify the appropriate source: - -- To change **raw CGo bindings** (`capi/`): edit `capi/manifests/{module}.yaml` or `tools/pkg/capigen/`. Nobody else writes to - `capi/` but `capigen`! -- To change **idiomatic Go API shape** (type names, method receivers, error handling): edit `spec/overlays/{module}.yaml`. -- To change **generated code patterns** (struct layout, constructor/destructor shape, bridge code): edit `templates/*.tmpl`. -- To change **spec extraction logic**: edit `tools/pkg/specgen/`. -- To change **idiomatic generation logic**: edit `tools/pkg/idiomgen/` or `tools/pkg/overlaymodel/`. - -After modifying sources, regenerate with `make idiomatic` (or `make regen` for a full rebuild). - -### Examples must use only idiomatic bindings - -Code in `examples/` must import only the idiomatic top-level packages (e.g., `github.com/AndroidGoLab/ndk/looper`, `github.com/AndroidGoLab/ndk/camera`). Never import `capi/` packages or use `import "C"` / CGo directly in examples. If the idiomatic package is missing a needed function or type, add it via the overlay and regenerate rather than falling back to capi. diff --git a/LICENSE b/LICENSE index 4fad9ae..b42973f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,22 @@ -MIT License - -Copyright (c) 2026 github.com/xaionaro-go/ndk contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2017 gooid +Copyleft (c) 2024 Dmitrii Okunev (xaionaro, void) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Main.lean b/Main.lean deleted file mode 100644 index fd7784b..0000000 --- a/Main.lean +++ /dev/null @@ -1,4 +0,0 @@ -import ProofsTmp - -def main : IO Unit := - IO.println s!"Hello, {hello}!" diff --git a/Makefile b/Makefile index f08929e..1e8a210 100644 --- a/Makefile +++ b/Makefile @@ -1,247 +1,18 @@ -export PATH := $(HOME)/go/bin:$(PATH) -GODEBUG ?= cgocheck=1 -export GODEBUG +all: signer-sign-FyneCameraDemo-arm64-apk -ANDROID_HOME ?= $(HOME)/Android/Sdk -NDK_PATH ?= $(or $(ANDROID_NDK_HOME),$(shell ls -d $(ANDROID_HOME)/ndk/* 2>/dev/null | sort -V | tail -1)) +priv/android-apk.keystore: + mkdir -p priv + keytool -genkey -v -keystore priv/android-apk.keystore -alias FyneCameraDemo -keyalg RSA -keysize 2048 -validity 36500 -# Full module list for NDK production builds. -MODULES := aaudio camera sensor gles2 gles3 egl vulkan media \ - input nativewindow hardwarebuffer binder thermal \ - performancehint neuralnetworks trace logging font \ - imagedecoder midi multinetwork sync choreographer \ - configuration asset looper nativeactivity surfacecontrol \ - sharedmem permission bitmap storage surfacetexture \ - persistablebundle +signer-sign-FyneCameraDemo-arm64-apk: priv/android-apk.keystore + zipalign -p 4 ./examples/FyneCameraDemo/FyneCameraDemo.apk ./examples/FyneCameraDemo/FyneCameraDemo-aligned.apk + rm -f ./examples/FyneCameraDemo/FyneCameraDemo.apk + mv ./examples/FyneCameraDemo/FyneCameraDemo-aligned.apk ./examples/FyneCameraDemo/FyneCameraDemo.apk + zipalign -c 4 ./examples/FyneCameraDemo/FyneCameraDemo.apk + apksigner sign --ks-key-alias FyneCameraDemo --ks priv/android-apk.keystore ./examples/FyneCameraDemo/FyneCameraDemo.apk || \ + apksigner sign --ks-key-alias FyneCameraDemo --ks priv/android-apk.keystore ./examples/FyneCameraDemo/FyneCameraDemo.apk || \ + apksigner sign --ks-key-alias FyneCameraDemo --ks priv/android-apk.keystore ./examples/FyneCameraDemo/FyneCameraDemo.apk || \ + apksigner sign --ks-key-alias FyneCameraDemo --ks priv/android-apk.keystore ./examples/FyneCameraDemo/FyneCameraDemo.apk -# Modules with testdata fixtures (no NDK required). -FIXTURE_MODULES := $(notdir $(wildcard tools/pkg/specgen/testdata/*/)) - -NDK_SYSROOT := $(NDK_PATH)/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -NDK_CGO_SYSROOT := $(NDK_PATH)/toolchains/llvm/prebuilt/linux-x86_64/sysroot -C2FFI_BIN ?= c2ffi - -API_LEVEL ?= 35 -NDK_CC_ARM64 := $(NDK_PATH)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android$(API_LEVEL)-clang -NDK_CC_X86_64 := $(NDK_PATH)/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android$(API_LEVEL)-clang -BUILD_DIR := build - -.PHONY: all capi specs idiomatic clean regen fixtures test lint check-examples check-no-capi \ - e2e e2e-build e2e-examples e2e-examples-test e2e-audio \ - ndkcli ndkcli-commands ndkcli-release install-ndk \ - proofs test-differential - -all: specs capi idiomatic - -# Stage 1+2: Generate specs from C headers via c2ffi (requires NDK + c2ffi) -specs: - @for m in $(MODULES); do \ - manifest="capi/manifests/$$m.yaml"; \ - [ -f "$$manifest" ] || continue; \ - echo "specgen $$m (c2ffi)"; \ - go run ./tools/cmd/specgen \ - -manifest "$$manifest" \ - -ndk-include "$(NDK_SYSROOT)" \ - -c2ffi-bin "$(C2FFI_BIN)" \ - -out "spec/generated/$$m.yaml"; \ - done - -# Stage 2: Generate raw CGo binding packages from specs + manifests -capi: - @for m in $(MODULES); do \ - manifest="capi/manifests/$$m.yaml"; \ - spec="spec/generated/$$m.yaml"; \ - [ -f "$$manifest" ] || continue; \ - [ -f "$$spec" ] || continue; \ - overlay="spec/overlays/$$m.yaml"; \ - overlay_flag=""; \ - [ -f "$$overlay" ] && overlay_flag="-overlay $$overlay"; \ - echo "capigen $$m"; \ - go run ./tools/cmd/capigen \ - -spec "$$spec" \ - -manifest "$$manifest" \ - $$overlay_flag \ - -out "capi/$$m/"; \ - done - -# Stage 2 (fixture mode): Extract specs from testdata fixtures -specs-fixtures: - @for m in $(FIXTURE_MODULES); do \ - case $$m in simple|edgecases) continue;; esac; \ - echo "specgen $$m (fixture)"; \ - go run ./tools/cmd/specgen \ - -module $$m \ - -pkg tools/pkg/specgen/testdata/$$m \ - -out spec/generated/$$m.yaml; \ - done - -# Stage 3: Generate idiomatic Go from specs + overlays -idiomatic: - @for overlay in spec/overlays/*.yaml; do \ - m=$$(basename "$$overlay" .yaml); \ - spec="spec/generated/$$m.yaml"; \ - [ -f "$$spec" ] || continue; \ - goname=$$(grep 'go_name:' "$$overlay" | head -1 | awk '{print $$2}'); \ - [ -z "$$goname" ] && goname="$$m"; \ - echo "idiomgen $$m -> $$goname/"; \ - go run ./tools/cmd/idiomgen \ - -spec "$$spec" \ - -overlay "$$overlay" \ - -templates templates/ \ - -capi-dir "capi/$$m/" \ - -out "$$goname/"; \ - done - -# Generate everything from fixtures (no NDK required) -fixtures: specs-fixtures idiomatic - -# Regenerate everything from scratch (requires NDK + c2ffi) -regen: clean specs capi idiomatic - -test: - go test $$(go list ./... | grep -v -E '/(capi|cmd|tests|examples)/|/ndk/[a-z][a-z0-9]*$$') -count=1 - -# Build Lean 4 proofs (requires elan/lake toolchain). -proofs: - cd proofs && lake build - -# Run differential tests comparing Go implementations against Lean oracle. -# Requires: elan/lake toolchain. Builds the oracle automatically. -test-differential: proofs - go test ./tools/pkg/capigen/ ./tools/pkg/idiomgen/ -run TestDifferential -v - -# Verify cmd/ and examples/ do not import capi packages. -check-no-capi: - @if grep -rl '"github.com/xaionaro-go/ndk/capi' cmd/ examples/ 2>/dev/null; then \ - echo "ERROR: cmd/ and examples/ must not import capi packages"; \ - exit 1; \ - fi - @echo "OK: no capi imports in cmd/ or examples/" - -lint: - @which golangci-lint >/dev/null 2>&1 || { echo "Installing golangci-lint..."; go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest; } - golangci-lint run ./tools/... - -# Cross-compile all examples and ndkcli for Android arm64 to catch compile errors (requires NDK) -check-examples: - CGO_ENABLED=1 GOOS=android GOARCH=arm64 CC=$(NDK_CC_ARM64) \ - CGO_CFLAGS="$(CGO_CFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_CPPFLAGS="$(CGO_CPPFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_LDFLAGS="$(CGO_LDFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" \ - go build ./examples/... ./cmd/ndkcli/ - -# Cross-compile E2E test binary for Android x86_64 (requires NDK) -e2e-build: - @mkdir -p $(BUILD_DIR) - CGO_ENABLED=1 GOOS=android GOARCH=amd64 CC=$(NDK_CC_X86_64) \ - CGO_CFLAGS="$(CGO_CFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_CPPFLAGS="$(CGO_CPPFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_LDFLAGS="$(CGO_LDFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" \ - go build -o $(BUILD_DIR)/e2e_test ./tests/e2e - -# Run full E2E test on Android emulator (requires SDK + NDK + KVM) -e2e: e2e-build - ANDROID_HOME=$(dir $(NDK_PATH)) ./tests/e2e/run.sh - -# Run all examples on Android emulator (requires running emulator + NDK) -e2e-examples: - ./tests/e2e/run-examples.sh - -# Run examples E2E Go test on Android emulator (requires running emulator + NDK) -e2e-examples-test: - ./tests/e2e/run-examples-test.sh - -# Run audio recording E2E test (requires running emulator with audio + NDK) -e2e-audio: - ./tests/e2e/run-audio-e2e.sh - -# Install Android NDK r28 (for CI; no-op if the correct version is present) -ANDROID_NDK_VERSION ?= r28 -ANDROID_NDK_DIR_NAME ?= 28.0.13004108 -NDK_INSTALL_PATH := $(ANDROID_HOME)/ndk/$(ANDROID_NDK_DIR_NAME) -install-ndk: - @if [ -d "$(NDK_INSTALL_PATH)" ]; then echo "NDK $(ANDROID_NDK_VERSION) already at $(NDK_INSTALL_PATH)"; exit 0; fi; \ - echo "Installing Android NDK $(ANDROID_NDK_VERSION)..."; \ - wget -q "https://dl.google.com/android/repository/android-ndk-$(ANDROID_NDK_VERSION)-linux.zip" -O /tmp/ndk.zip; \ - unzip -q /tmp/ndk.zip -d /tmp/ndk-extract/; \ - mkdir -p "$(ANDROID_HOME)/ndk"; \ - mv /tmp/ndk-extract/android-ndk-* "$(NDK_INSTALL_PATH)"; \ - rm -f /tmp/ndk.zip; \ - echo "NDK installed to $(NDK_INSTALL_PATH)" - -# Build ndkcli for Android arm64 (requires NDK) -ndkcli: - @mkdir -p $(BUILD_DIR) - CGO_ENABLED=1 GOOS=android GOARCH=arm64 CC=$(NDK_CC_ARM64) \ - CGO_CFLAGS="$(CGO_CFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_CPPFLAGS="$(CGO_CPPFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_LDFLAGS="$(CGO_LDFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" \ - go build -o $(BUILD_DIR)/ndkcli ./cmd/ndkcli/ - -# Build release binaries for both architectures (stripped) -ndkcli-release: - @mkdir -p $(BUILD_DIR) - CGO_ENABLED=1 GOOS=android GOARCH=arm64 CC=$(NDK_CC_ARM64) \ - CGO_CFLAGS="$(CGO_CFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_CPPFLAGS="$(CGO_CPPFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_LDFLAGS="$(CGO_LDFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" \ - go build -trimpath -ldflags="-s -w" -o $(BUILD_DIR)/ndkcli-android-arm64 ./cmd/ndkcli/ - CGO_ENABLED=1 GOOS=android GOARCH=amd64 CC=$(NDK_CC_X86_64) \ - CGO_CFLAGS="$(CGO_CFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_CPPFLAGS="$(CGO_CPPFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_LDFLAGS="$(CGO_LDFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" \ - go build -trimpath -ldflags="-s -w" -o $(BUILD_DIR)/ndkcli-android-x86_64 ./cmd/ndkcli/ - -# Print all ndkcli subcommands (extracted from source, no binary needed) -ndkcli-commands: - @go run ./tools/cmd/ndkcli-commands - -clean: - @for m in $(MODULES); do rm -rf "capi/$$m/"; done - rm -rf spec/generated/ - -# --- APK Build (examples) --- - -APK_API ?= 35 -APK_ARCH ?= arm64 - -ifeq ($(APK_ARCH),arm64) - APK_ABI := arm64-v8a - APK_GOARCH := arm64 - APK_CC_PREFIX := aarch64-linux-android$(APK_API) -else ifeq ($(APK_ARCH),x86_64) - APK_ABI := x86_64 - APK_GOARCH := amd64 - APK_CC_PREFIX := x86_64-linux-android$(APK_API) -endif - -APK_CC := $(NDK_PATH)/toolchains/llvm/prebuilt/linux-x86_64/bin/$(APK_CC_PREFIX)-clang -APK_BUILD_TOOLS := $(shell ls -d $(ANDROID_HOME)/build-tools/* 2>/dev/null | sort -V | tail -1) -APK_PLATFORM := $(ANDROID_HOME)/platforms/android-$(APK_API)/android.jar -APK_KEYSTORE := $(HOME)/.android/debug.keystore - -$(APK_KEYSTORE): - mkdir -p $(dir $@) - keytool -genkeypair -v -keystore $@ -storepass android \ - -alias androiddebugkey -keypass android -keyalg RSA \ - -keysize 2048 -validity 10000 \ - -dname "CN=Debug,O=Debug,C=US" - -.PHONY: apk-displaycamera - -apk-displaycamera: $(APK_KEYSTORE) - $(eval DIR := examples/camera/display) - $(eval BUILD := $(DIR)/_build) - @rm -rf $(BUILD) - @mkdir -p $(BUILD)/lib/$(APK_ABI) - CGO_ENABLED=1 GOOS=android GOARCH=$(APK_GOARCH) CC=$(APK_CC) \ - CGO_CFLAGS="$(CGO_CFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_CPPFLAGS="$(CGO_CPPFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" CGO_LDFLAGS="$(CGO_LDFLAGS) --sysroot=$(NDK_CGO_SYSROOT)" \ - go build -buildmode=c-shared \ - -o $(BUILD)/lib/$(APK_ABI)/libdisplaycamera.so \ - ./$(DIR) - @rm -f $(BUILD)/lib/$(APK_ABI)/libdisplaycamera.h - $(APK_BUILD_TOOLS)/aapt package -f \ - -M $(DIR)/AndroidManifest.xml \ - -I $(APK_PLATFORM) \ - -F $(BUILD)/base.apk - cd $(BUILD) && zip -r base.apk lib/ - $(APK_BUILD_TOOLS)/zipalign -f -p 4 \ - $(BUILD)/base.apk $(BUILD)/aligned.apk - $(APK_BUILD_TOOLS)/apksigner sign \ - --ks $(APK_KEYSTORE) --ks-pass pass:android \ - --key-pass pass:android \ - $(BUILD)/aligned.apk - mv $(BUILD)/aligned.apk $(DIR)/displaycamera.apk - @rm -rf $(BUILD) - @echo "APK: $(DIR)/displaycamera.apk" + apksigner verify ./examples/FyneCameraDemo/FyneCameraDemo.apk diff --git a/ProofsTmp.lean b/ProofsTmp.lean deleted file mode 100644 index 7b94e23..0000000 --- a/ProofsTmp.lean +++ /dev/null @@ -1,3 +0,0 @@ --- This module serves as the root of the `ProofsTmp` library. --- Import modules here that should be built as part of the library. -import ProofsTmp.Basic diff --git a/ProofsTmp/Basic.lean b/ProofsTmp/Basic.lean deleted file mode 100644 index 99415d9..0000000 --- a/ProofsTmp/Basic.lean +++ /dev/null @@ -1 +0,0 @@ -def hello := "world" diff --git a/README.md b/README.md index 2c260af..181ae7f 100644 --- a/README.md +++ b/README.md @@ -1,1752 +1,48 @@ -# ndk +# NDK -[![Go Reference](https://pkg.go.dev/badge/github.com/AndroidGoLab/ndk.svg)](https://pkg.go.dev/github.com/AndroidGoLab/ndk) -[![Go Report Card](https://goreportcard.com/badge/github.com/AndroidGoLab/ndk)](https://goreportcard.com/report/github.com/AndroidGoLab/ndk) -[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) -[![Go Version](https://img.shields.io/github/go-mod/go-version/AndroidGoLab/ndk)](go.mod) -[![Ask AI](https://img.shields.io/badge/Ask_AI-Context7-059669)](https://context7.com/androidgolab/ndk) +This is an attempt to make to work the NDK Go-bindings left in old repository github.com/gooid/gooid. -Idiomatic Go bindings for the Android NDK, auto-generated from C headers to ensure full coverage and easy maintenance. +I haven't tried the provided examples, but I copied camera-related files from `Camera2Demo` into `FyneCameraDemo` and made it work using [`fyne`](https://github.com/fyne-io/fyne) to package it for Android: -## Android Interfaces for Go +[FyneCameraDemo](https://github.com/xaionaro-go/ndk/tree/master/examples/FyneCameraDemo) -This project is part of a family of three Go libraries that cover the major Android interface surfaces. Each wraps a different layer of the Android platform: +To try it: +```sh +go install fyne.io/fyne/v2/cmd/fyne@latest -```mermaid -graph TD - subgraph "Go application" - GO["Go code"] - end - - subgraph "Interface libraries" - NDK["ndk
C API bindings via cgo"] - JNI["jni
Java API bindings via JNI+cgo"] - AIDL["binder
Binder IPC, pure Go"] - end - - subgraph "Android platform" - CAPI["NDK C libraries
(libcamera2ndk, libaaudio,
libEGL, libvulkan, ...)"] - JAVA["Java SDK
(android.bluetooth,
android.location, ...)"] - BINDER["/dev/binder
kernel driver"] - SYSSVCS["System services
(ActivityManager,
PowerManager, ...)"] - end - - GO --> NDK - GO --> JNI - GO --> AIDL - - NDK -- "cgo / #include" --> CAPI - JNI -- "cgo / JNIEnv*" --> JAVA - AIDL -- "ioctl syscalls" --> BINDER - BINDER --> SYSSVCS - JAVA -. "internally uses" .-> BINDER - CAPI -. "some use" .-> BINDER -``` - -| Library | Interface | Requires | Best for | -| ------------------------------------------------------------- | ---------------------------- | ------------------- | --------------------------------------------------------------------------------------------------- | -| **[ndk](https://github.com/AndroidGoLab/ndk)** (this project) | Android NDK C APIs | cgo + NDK toolchain | High-performance hardware access: camera, audio, sensors, OpenGL/Vulkan, media codecs | -| **[jni](https://github.com/AndroidGoLab/jni)** | Java Android SDK via JNI | cgo + JNI + JVM/ART | Java-only APIs with no NDK equivalent: Bluetooth, WiFi, NFC, location, telephony, content providers | -| **[binder](https://github.com/AndroidGoLab/binder)** | Binder IPC (system services) | pure Go (no cgo) | Direct system service calls without Java: works on non-Android Linux with binder, minimal footprint | - -### When to use which - -- **Start with ndk** when the NDK provides a C API for what you need (camera, audio, sensors, EGL/Vulkan, media codecs). These are the lowest-latency, lowest-overhead bindings since they go straight from Go to the C library via cgo. - -- **Use jni** when you need a Java Android SDK API that the NDK does not expose. Examples: Bluetooth discovery, WiFi P2P, NFC tag reading, location services, telephony, content providers, notifications. JNI is also the right choice when you need to interact with Java components (Activities, Services, BroadcastReceivers) or when you need the gRPC remote-access layer. - -- **Use binder** when you want pure-Go access to Android system services without any cgo dependency. This is ideal for lightweight tools, CLI programs, or scenarios where you want to talk to the binder driver from a non-Android Linux system. AIDL covers the same system services that Java SDK wraps (ActivityManager, PowerManager, etc.) but at the wire-protocol level. - -- **Combine them** when your application needs multiple layers. For example, a streaming app might use **ndk** for camera capture and audio encoding, **jni** for Bluetooth controller discovery, and **binder** for querying battery status from a companion daemon. - -### How they relate to each other - -All three libraries talk to the same Android system services, but through different paths: - -- The **NDK C APIs** are provided by Google as stable C interfaces to Android platform features. Some (camera, sensors, audio) internally use binder IPC to talk to system services; others (EGL, Vulkan, OpenGL) talk directly to kernel drivers. The `ndk` library wraps these C APIs via cgo. -- The **Java SDK** uses binder IPC internally for system service access (BluetoothManager, LocationManager, etc.), routing calls through the Android Runtime (ART/Dalvik). The `jni` library calls into these Java APIs via the JNI C interface and cgo. -- The **AIDL binder protocol** is the underlying IPC mechanism that system-facing NDK and Java SDK APIs use. The `binder` library implements this protocol directly in pure Go, bypassing both C and Java layers entirely. - -## Requirements - -- **Android NDK r28** (28.0.13004108) or later -- **API level 35** (Android 15) target - -## Idiomatic vs `capi/` Packages - -Always import the **idiomatic top-level packages** (`github.com/AndroidGoLab/ndk/{module}`) in your application code. These provide Go-friendly types with proper lifecycle management (`Close()`, `defer`), typed error handling, and method receivers. - -The `capi/` packages (`github.com/AndroidGoLab/ndk/capi/{module}`) are the raw CGo bindings generated in Stage 2 of the pipeline. They mirror the C API directly — C-style function names, `unsafe.Pointer` parameters, raw integer return codes. **They are intended for power users** who need access to NDK functions not yet wrapped by the idiomatic layer. All commonly used functions — including `hwbuf.Allocate`, `buf.Lock`, `codec.DequeueInputBuffer`, and `codec.DequeueOutputBuffer` — are available in the idiomatic layer. - -```go -import "github.com/AndroidGoLab/ndk/hwbuf" - -// Allocate a hardware buffer using the idiomatic API -desc := hwbuf.Desc{ - Width: 1920, Height: 1080, Layers: 1, - Format: uint32(hwbuf.R8g8b8a8Unorm), - Usage: uint64(hwbuf.CpuWriteOften | hwbuf.GpuSampledImage), -} -buf, err := hwbuf.Allocate(&desc) -if err != nil { - log.Fatal(err) -} -defer buf.Close() -``` - -## Examples - -All types implement idempotent, nil-safe `Close() error`. Error types wrap NDK status codes and work with `errors.Is`. - -
-Audio playback (AAudio) - -```go -package main - -import ( - "log" - "unsafe" - - "github.com/AndroidGoLab/ndk/audio" -) - -func main() { - builder, err := audio.NewStreamBuilder() - if err != nil { - log.Fatal(err) - } - defer builder.Close() - - builder. - SetDirection(audio.Output). - SetSampleRate(44100). - SetChannelCount(2). - SetFormat(audio.PcmFloat). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - - stream, err := builder.Open() - if err != nil { - log.Fatal(err) - } - defer stream.Close() - - log.Printf("opened: %d Hz, %d ch, burst=%d", - stream.SampleRate(), stream.ChannelCount(), stream.FramesPerBurst()) - - if err := stream.Start(); err != nil { - log.Fatal(err) - } - defer stream.Stop() - - buf := make([]float32, int(stream.FramesPerBurst())*2) - stream.Write(unsafe.Pointer(&buf[0]), stream.FramesPerBurst(), 1_000_000_000) -} -``` - -
- -
-Camera discovery - -```go -package main - -import ( - "log" - - "github.com/AndroidGoLab/ndk/camera" -) - -func main() { - mgr := camera.NewManager() - defer mgr.Close() - - ids, err := mgr.CameraIdList() - if err != nil { - log.Fatal(err) // camera.ErrPermissionDenied if CAMERA not granted - } - - for _, id := range ids { - meta, _ := mgr.GetCameraCharacteristics(id) - orientation := meta.I32At(uint32(camera.SensorOrientation), 0) - log.Printf("camera %s: orientation=%d°", id, orientation) - } -} -``` - -
- -
-Sensor querying - -```go -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/sensor" -) - -func main() { - mgr := sensor.GetInstance() - accel := mgr.DefaultSensor(sensor.Accelerometer) - - fmt.Printf("Sensor: %s (%s)\n", accel.Name(), accel.Vendor()) - fmt.Printf("Resolution: %g, min delay: %d µs\n", - accel.Resolution(), accel.MinDelay()) -} -``` - -
- -
-Event loop (ALooper) - -```go -package main - -import ( - "log" - "runtime" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/looper" -) - -func main() { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - lp := looper.Prepare(int32(looper.ALOOPER_PREPARE_ALLOW_NON_CALLBACKS)) - defer func() { _ = lp.Close() }() - - lp.Acquire() - go func() { - time.Sleep(100 * time.Millisecond) - lp.Wake() - }() - - var fd, events int32 - var data unsafe.Pointer - result := looper.LOOPER_POLL(looper.PollOnce(-1, &fd, &events, &data)) - - switch result { - case looper.ALOOPER_POLL_WAKE: - log.Println("woke up") - case looper.ALOOPER_POLL_TIMEOUT: - log.Println("timed out") - } -} -``` - -
- -
-Camera preview (full pipeline) - -A complete camera-to-screen example using NativeActivity, EGL, and OpenGL ES. See [`examples/camera/display/`](examples/camera/display/) for the full working application. Build it with `make apk-displaycamera`. - -```go -// Sketch of the camera pipeline (requires NativeActivity context) - -mgr := camera.NewManager() -defer mgr.Close() - -device, err := mgr.OpenCamera(cameraID, camera.DeviceStateCallbacks{ - OnDisconnected: func() { log.Println("disconnected") }, - OnError: func(code int) { log.Printf("error: %d", code) }, -}) -defer device.Close() - -request, _ := device.CreateCaptureRequest(camera.Preview) -defer request.Close() - -target, _ := camera.NewOutputTarget(nativeWindow) -request.AddTarget(target) - -container, _ := camera.NewSessionOutputContainer() -output, _ := camera.NewSessionOutput(nativeWindow) -container.Add(output) - -session, _ := device.CreateCaptureSession(container, - camera.SessionStateCallbacks{ - OnReady: func() { log.Println("ready") }, - OnActive: func() { log.Println("active") }, - }) -session.SetRepeatingRequest(request) -``` - -
- -
-Asset loading - -```go -package main - -import ( - "fmt" - "io" - "unsafe" - - "github.com/AndroidGoLab/ndk/asset" -) - -func main() { - // mgr obtained from activity.AssetManager in a real NativeActivity app. - // This example documents the API pattern. - var mgr *asset.Manager // = activity.AssetManager(nativeActivity) - - a := mgr.Open("textures/wood.png", asset.Streaming) - defer a.Close() - - size := a.Length() - buf := make([]byte, size) - _, _ = io.ReadFull(unsafe.NewReader(a), buf) - fmt.Printf("read %d bytes\n", len(buf)) -} -``` - -
- -
-How to record from the microphone - -```go -package main - -import ( - "log" - "math" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/audio" -) - -func main() { - builder, err := audio.NewStreamBuilder() - if err != nil { - log.Fatalf("create stream builder: %v", err) - } - defer builder.Close() - - builder. - SetDirection(audio.Input). - SetSampleRate(48000). - SetChannelCount(1). - SetFormat(audio.PcmI16). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - - stream, err := builder.Open() - if err != nil { - log.Fatalf("open stream: %v", err) - } - defer func() { - if err := stream.Close(); err != nil { - log.Printf("close stream: %v", err) - } - }() - - rate := stream.SampleRate() - log.Printf("capture stream opened (rate=%d Hz, ch=%d)", rate, stream.ChannelCount()) - - if err := stream.Start(); err != nil { - log.Fatalf("start stream: %v", err) - } - - // Read approximately 1 second of audio. - totalFrames := rate - buf := make([]int16, 1024) - bufBytes := unsafe.Slice((*byte)(unsafe.Pointer(&buf[0])), len(buf)*int(unsafe.Sizeof(buf[0]))) - var captured []int16 - - for int32(len(captured)) < totalFrames { - framesToRead := int32(len(buf)) - if remaining := totalFrames - int32(len(captured)); remaining < framesToRead { - framesToRead = remaining - } - n, err := stream.Read(bufBytes, framesToRead, time.Second) - if err != nil { - log.Fatalf("read: %v", err) - } - captured = append(captured, buf[:n]...) - } - - if err := stream.Stop(); err != nil { - log.Fatalf("stop stream: %v", err) - } - - // Compute peak amplitude. - var peak int16 - for _, s := range captured { - if s < 0 { - s = -s - } - if s > peak { - peak = s - } - } - - log.Printf("captured %d frames", len(captured)) - log.Printf("peak amplitude: %d (%.1f dBFS)", peak, 20*math.Log10(float64(peak)/32767.0)) - log.Println("recording example finished") -} -``` - -
- -
-How to take a picture from the camera - -```go -package main - -import ( - "log" - "os" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/camera" - capimedia "github.com/AndroidGoLab/ndk/capi/media" - "github.com/AndroidGoLab/ndk/media" -) - -func main() { - // 1. Create an ImageReader (640x480 JPEG, up to 2 images). - // The idiomatic media.NewImageReader uses an output parameter. - var reader *media.ImageReader - if status := media.NewImageReader(640, 480, capimedia.AIMAGE_FORMAT_JPEG, 2, &reader); status != 0 { - log.Fatalf("create image reader: status %d", status) - } - defer reader.Close() - - // 2. Get the ANativeWindow from the ImageReader. - // The idiomatic Window() method has a broken signature (no output), - // so we call the capi function directly. - readerPtr := (*capimedia.AImageReader)(reader.Pointer()) - var capiWindow *capimedia.ANativeWindow - if status := capimedia.AImageReader_getWindow(readerPtr, &capiWindow); status != 0 { - log.Fatalf("get window: status %d", status) - } - // Convert capi/media.ANativeWindow to capi/camera.ANativeWindow via unsafe. - camWindow := (*camera.ANativeWindow)(unsafe.Pointer(capiWindow)) - - // 3. Create camera Manager and list cameras. - mgr := camera.NewManager() - defer mgr.Close() - - ids, err := mgr.CameraIDList() - if err != nil { - log.Fatalf("list cameras: %v", err) - } - if len(ids) == 0 { - log.Fatal("no cameras available") - } - log.Printf("cameras: %v (using %s)", ids, ids[0]) - - // 4. Open the first camera. - dev, err := mgr.OpenCamera(ids[0], camera.DeviceStateCallbacks{ - OnDisconnected: func() { log.Println("camera disconnected") }, - OnError: func(code int) { log.Printf("camera error: %d", code) }, - }) - if err != nil { - log.Fatalf("open camera: %v", err) - } - defer dev.Close() - - // 5. Create OutputTarget and SessionOutput from the window. - target, err := camera.NewOutputTarget(camWindow) - if err != nil { - log.Fatalf("create output target: %v", err) - } - defer target.Close() - - sessOutput, err := camera.NewSessionOutput(camWindow) - if err != nil { - log.Fatalf("create session output: %v", err) - } - defer sessOutput.Close() - - container, err := camera.NewSessionOutputContainer() - if err != nil { - log.Fatalf("create session output container: %v", err) - } - defer container.Close() - - if err := container.Add(sessOutput); err != nil { - log.Fatalf("add session output: %v", err) - } - - // 6. Create a CaptureRequest (StillCapture template) and add the target. - req, err := dev.CreateCaptureRequest(camera.StillCapture) - if err != nil { - log.Fatalf("create capture request: %v", err) - } - defer req.Close() - req.AddTarget(target) - - // 7. Create a CaptureSession and set a repeating request. - ready := make(chan struct{}, 1) - session, err := dev.CreateCaptureSession(container, camera.SessionStateCallbacks{ - OnReady: func() { select { case ready <- struct{}{}: default: } }, - OnActive: func() { log.Println("session active") }, - OnClosed: func() { log.Println("session closed") }, - }) - if err != nil { - log.Fatalf("create capture session: %v", err) - } - defer session.Close() - - if err := session.SetRepeatingRequest(req); err != nil { - log.Fatalf("set repeating request: %v", err) - } - - // Wait for at least one frame to arrive. - select { - case <-ready: - case <-time.After(5 * time.Second): - log.Println("warning: timed out waiting for session ready") - } - time.Sleep(500 * time.Millisecond) - - // 8. Acquire an image from the ImageReader and save it. - var capiImage *capimedia.AImage - if status := capimedia.AImageReader_acquireLatestImage(readerPtr, &capiImage); status != 0 { - log.Fatalf("acquire image: status %d", status) - } - img := media.NewImageFromPointer(unsafe.Pointer(capiImage)) - defer img.Close() - - var numPlanes int32 - if err := img.NumberOfPlanes(&numPlanes); err != nil { - log.Fatalf("get number of planes: %v", err) - } - - // For JPEG there is exactly one plane; get its data. - var dataPtr *uint8 - var dataLen int32 - if status := capimedia.AImage_getPlaneData( - (*capimedia.AImage)(img.Pointer()), 0, &dataPtr, &dataLen, - ); status != 0 { - log.Fatalf("get plane data: status %d", status) - } - - data := unsafe.Slice(dataPtr, dataLen) - if err := os.WriteFile("/sdcard/capture.jpg", data, 0644); err != nil { - log.Fatalf("write file: %v", err) - } - - if err := session.StopRepeating(); err != nil { - log.Printf("stop repeating: %v", err) - } - - log.Printf("saved %d bytes to /sdcard/capture.jpg", dataLen) -} -``` - -
- -
-How to list available sensors - -```go -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/sensor" -) - -// printSensor queries and prints sensor properties. It returns false -// if the sensor's underlying C pointer is NULL (the device lacks this -// sensor type), recovering from the resulting panic. -func printSensor(mgr *sensor.Manager, label string, sensorType sensor.Type) (ok bool) { - defer func() { - if r := recover(); r != nil { - ok = false - } - }() - - s := mgr.DefaultSensor(sensorType) - - // Trigger a method call; if the internal pointer is NULL the NDK - // dereferences a null pointer and Go's signal handler turns it - // into a panic that we recover above. - name := s.Name() - vendor := s.Vendor() - if name == "" || vendor == "" { - return false - } - - fmt.Printf(" %s:\n", label) - fmt.Printf(" Name: %s\n", name) - fmt.Printf(" Vendor: %s\n", vendor) - fmt.Printf(" Type: %s (%d)\n", sensorType, int32(sensorType)) - fmt.Printf(" Resolution: %g\n", s.Resolution()) - fmt.Printf(" Min delay: %d us\n", s.MinDelay()) - fmt.Println() - return true -} - -func main() { - mgr := sensor.GetInstance() - - type sensorInfo struct { - label string - sensorType sensor.Type - } - - sensors := []sensorInfo{ - {"Accelerometer", sensor.Accelerometer}, - {"Gyroscope", sensor.Gyroscope}, - {"Light", sensor.Light}, - {"Proximity", sensor.Proximity}, - {"Magnetic Field", sensor.MagneticField}, - } - - fmt.Println("Default sensors on this device:") - fmt.Println() - - found := 0 - for _, info := range sensors { - if printSensor(mgr, info.label, info.sensorType) { - found++ - } else { - fmt.Printf(" %-16s not available\n", info.label+":") - } - } - - if found == 0 { - fmt.Println(" No default sensors found on this device.") - } -} -``` - -
- -
-How to check device thermal status - -```go -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/thermal" -) - -func main() { - mgr := thermal.NewManager() - defer mgr.Close() - - status := mgr.CurrentStatus() - fmt.Printf("Thermal status: %s (%d)\n", status, int32(status)) - - switch status { - case thermal.StatusNone: - fmt.Println("Device is cool.") - case thermal.StatusLight, thermal.StatusModerate: - fmt.Println("Device is warm; consider reducing workload.") - case thermal.StatusSevere, thermal.StatusCritical: - fmt.Println("Device is hot; throttling likely.") - case thermal.StatusEmergency, thermal.StatusShutdown: - fmt.Println("Device is critically hot; shutdown imminent.") - default: - fmt.Println("Unable to determine thermal status.") - } -} -``` - -
- -
-How to query GPU capabilities - -```go -package main - -import ( - "fmt" - "log" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" -) - -// goString converts a *gles2.GLubyte (C string) to a Go string. -func goString(p *gles2.GLubyte) string { - if p == nil { - return "" - } - // Walk the null-terminated byte sequence. - var buf []byte - for ptr := (*byte)(unsafe.Pointer(p)); *ptr != 0; ptr = (*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(ptr)) + 1)) { - buf = append(buf, *ptr) - } - return string(buf) -} - -func main() { - // 1. Get the default EGL display and initialize it. - dpy := egl.GetDisplay(egl.EGLNativeDisplayType(0)) - if dpy == nil { - log.Fatal("eglGetDisplay failed") - } - - var major, minor egl.Int - if egl.Initialize(dpy, &major, &minor) == egl.False { - log.Fatalf("eglInitialize failed: 0x%x", egl.GetError()) - } - defer egl.Terminate(dpy) - - fmt.Printf("EGL %d.%d\n", major, minor) - fmt.Printf(" Vendor: %s\n", egl.QueryString(dpy, egl.EGL_VENDOR)) - fmt.Printf(" Version: %s\n", egl.QueryString(dpy, egl.EGL_VERSION)) - fmt.Printf(" Client APIs: %s\n", egl.QueryString(dpy, egl.EGL_CLIENT_APIS)) - fmt.Printf(" Extensions: %s\n", egl.QueryString(dpy, egl.EGL_EXTENSIONS)) - - // 2. Choose a config with ES2 support and pbuffer surface type. - attribs := []egl.Int{ - egl.RenderableType, egl.OpenglEs2Bit, - egl.SurfaceType, egl.PbufferBit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.None, - } - var cfg egl.EGLConfig - var numCfg egl.Int - if egl.ChooseConfig(dpy, &attribs[0], &cfg, 1, &numCfg) == egl.False || numCfg == 0 { - log.Fatal("eglChooseConfig failed") - } - - // 3. Create a 1x1 pbuffer surface and an ES2 context. - pbufAttribs := []egl.Int{egl.Width, 1, egl.Height, 1, egl.None} - surface := egl.CreatePbufferSurface(dpy, cfg, &pbufAttribs[0]) - - ctxAttribs := []egl.Int{egl.ContextClientVersion, 2, egl.None} - ctx := egl.CreateContext(dpy, cfg, nil, &ctxAttribs[0]) - if ctx == nil { - log.Fatal("eglCreateContext failed") - } - defer egl.DestroyContext(dpy, ctx) - defer egl.DestroySurface(dpy, surface) - - egl.MakeCurrent(dpy, surface, surface, ctx) - - // 4. Query OpenGL ES strings. - fmt.Println() - fmt.Printf("GL Vendor: %s\n", goString(gles2.GetString(gles2.GL_VENDOR))) - fmt.Printf("GL Renderer: %s\n", goString(gles2.GetString(gles2.GL_RENDERER))) - fmt.Printf("GL Version: %s\n", goString(gles2.GetString(gles2.GL_VERSION))) - fmt.Printf("GL Extensions: %s\n", goString(gles2.GetString(gles2.GL_EXTENSIONS))) - - egl.MakeCurrent(dpy, nil, nil, nil) -} -``` - -
- -
-How to probe available media codecs - -```go -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/media" -) - -func main() { - codecs := []struct { - mime string - desc string - }{ - {"video/avc", "H.264 / AVC"}, - {"video/hevc", "H.265 / HEVC"}, - {"video/x-vnd.on2.vp8", "VP8"}, - {"video/x-vnd.on2.vp9", "VP9"}, - {"video/av01", "AV1"}, - {"audio/mp4a-latm", "AAC"}, - {"audio/opus", "Opus"}, - {"audio/flac", "FLAC"}, - } - - fmt.Printf("%-28s %-10s %-10s\n", "MIME Type", "Encoder", "Decoder") - fmt.Printf("%-28s %-10s %-10s\n", "---", "---", "---") - - for _, c := range codecs { - encOK := "no" - enc := media.NewEncoder(c.mime) - if enc != nil && enc.Pointer() != nil { - encOK = "yes" - enc.Close() - } - - decOK := "no" - dec := media.NewDecoder(c.mime) - if dec != nil && dec.Pointer() != nil { - decOK = "yes" - dec.Close() - } - - fmt.Printf("%-28s %-10s %-10s (%s)\n", c.mime, encOK, decOK, c.desc) - } -} -``` - -
- -
-How to read device configuration - -```go -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/config" -) - -func main() { - cfg := config.NewConfig() - defer cfg.Close() - - fmt.Println("Device configuration:") - fmt.Printf(" Density: %d dpi\n", cfg.Density()) - fmt.Printf(" Orientation: %d\n", cfg.Orientation()) - fmt.Printf(" Screen size: %d\n", cfg.ScreenSize()) - fmt.Printf(" Screen width: %d dp\n", cfg.ScreenWidthDp()) - fmt.Printf(" Screen height: %d dp\n", cfg.ScreenHeightDp()) - fmt.Printf(" SDK version: %d\n", cfg.SdkVersion()) - - switch config.Orientation(cfg.Orientation()) { - case config.OrientationPort: - fmt.Println(" (portrait)") - case config.OrientationLand: - fmt.Println(" (landscape)") - case config.OrientationSquare: - fmt.Println(" (square)") - default: - fmt.Println(" (any/unknown)") - } -} -``` - -
- -
-How to decode an image file - -```go -package main - -import ( - "fmt" - "log" - "syscall" - "unsafe" - - capidec "github.com/AndroidGoLab/ndk/capi/imagedecoder" - "github.com/AndroidGoLab/ndk/image" -) - -func main() { - // 1. Open the image file via POSIX fd. - fd, err := syscall.Open("/sdcard/photo.jpg", syscall.O_RDONLY, 0) - if err != nil { - log.Fatalf("open file: %v", err) - } - defer syscall.Close(fd) - - // 2. Create a Decoder from the fd. - // The factory function is not yet in the high-level image package, - // so we call the capi function and wrap the result. - var decPtr *capidec.AImageDecoder - if rc := capidec.AImageDecoder_createFromFd(int32(fd), &decPtr); rc != 0 { - log.Fatalf("create decoder: error %d", rc) - } - decoder := image.NewDecoderFromPointer(unsafe.Pointer(decPtr)) - defer decoder.Close() - - // 3. Query image dimensions from the header. - headerPtr := capidec.AImageDecoder_getHeaderInfo(decPtr) - width := capidec.AImageDecoderHeaderInfo_getWidth(headerPtr) - height := capidec.AImageDecoderHeaderInfo_getHeight(headerPtr) - fmt.Printf("Image: %d x %d\n", width, height) - - // 4. Query the stride and allocate the pixel buffer. - stride := decoder.MinimumStride() - bufSize := stride * uint64(height) - pixels := make([]byte, bufSize) - fmt.Printf("Stride: %d bytes, buffer: %d bytes\n", stride, bufSize) - - // 5. Decode the image into the buffer. - if err := decoder.Decode(unsafe.Pointer(&pixels[0]), stride, bufSize); err != nil { - log.Fatalf("decode: %v", err) - } - - fmt.Printf("Decoded %d bytes of RGBA pixel data.\n", bufSize) -} -``` - -
- -For more examples, see [`examples/`](examples/). - -## ndkcli - -`ndkcli` is a CLI tool that exposes the full Android NDK surface from the command line. Supports 273 commands across 33 modules — query cameras, record audio, probe GPU capabilities, check sensors, and more. - -### Install - -**Option A: Download pre-built binary** from [GitHub Releases](https://github.com/AndroidGoLab/ndk/releases): - -```bash -# Download for your device architecture -wget https://github.com/AndroidGoLab/ndk/releases/latest/download/ndkcli-android-arm64 -adb push ndkcli-android-arm64 /data/local/tmp/ndkcli -adb shell chmod 755 /data/local/tmp/ndkcli -``` - -**Option B: Build from source** (requires Android NDK): - -```bash -make ndkcli # → build/ndkcli (arm64) -adb push build/ndkcli /data/local/tmp/ -adb shell chmod 755 /data/local/tmp/ndkcli -``` - -### Quick start - -```bash -# List cameras -adb shell /data/local/tmp/ndkcli camera list-details - -# Record 5 seconds of audio -adb shell /data/local/tmp/ndkcli audio record --output /data/local/tmp/rec.pcm --duration 5s - -# Check thermal status -adb shell /data/local/tmp/ndkcli thermal manager current-status - -# Query GPU -adb shell /data/local/tmp/ndkcli gles2 info - -# List sensors -adb shell /data/local/tmp/ndkcli sensor read --type 1 -``` - -### List all commands - -```bash -# From source (no Android needed): -make ndkcli-commands - -# On device: -adb shell /data/local/tmp/ndkcli --help -adb shell /data/local/tmp/ndkcli camera --help -``` - -### Examples - -
-List available cameras and their characteristics - -```bash -# List camera IDs -adb shell /data/local/tmp/ndkcli camera manager camera-id-list - -# Show full details (lens facing, orientation, hardware level) for all cameras -adb shell /data/local/tmp/ndkcli camera list-details - -# Query characteristics for a specific camera -adb shell /data/local/tmp/ndkcli camera manager get-camera-characteristics --camera-id 0 -``` - -
- -
-Capture raw frames from the camera - -```bash -# Capture 10 frames from camera 0 at 640x480 in RGBA format, save to file -adb shell /data/local/tmp/ndkcli camera capture \ - --id 0 --width 640 --height 480 --format 1 --count 10 \ - --output /data/local/tmp/frames.raw -``` - -
- -
-Record audio from the microphone - -```bash -# Record 5 seconds of mono 44.1kHz PCM16 audio -adb shell /data/local/tmp/ndkcli audio record \ - --output /data/local/tmp/recording.pcm \ - --duration 5s --sample-rate 44100 --channels 1 - -# Record 10 seconds of stereo 48kHz audio -adb shell /data/local/tmp/ndkcli audio record \ - --output /data/local/tmp/stereo.pcm \ - --duration 10s --sample-rate 48000 --channels 2 -``` - -
- -
-Play back recorded audio - -```bash -# Play a previously recorded PCM file -adb shell /data/local/tmp/ndkcli audio play \ - --input /data/local/tmp/recording.pcm \ - --sample-rate 44100 --channels 1 -``` - -
- -
-Query audio system capabilities - -```bash -# Open a probe stream and print audio properties -adb shell /data/local/tmp/ndkcli audio stream-builder new -adb shell /data/local/tmp/ndkcli audio stream channel-count -adb shell /data/local/tmp/ndkcli audio stream sample-rate -adb shell /data/local/tmp/ndkcli audio stream frames-per-burst -``` - -
- -
-List sensors and read sensor data - -```bash -# List all available sensors (probes known types) -adb shell /data/local/tmp/ndkcli sensor read --type 1 # Accelerometer -adb shell /data/local/tmp/ndkcli sensor read --type 4 # Gyroscope -adb shell /data/local/tmp/ndkcli sensor read --type 5 # Light - -# Query a specific sensor by type number -adb shell /data/local/tmp/ndkcli sensor manager default-sensor --value 1 -adb shell /data/local/tmp/ndkcli sensor sensor name -adb shell /data/local/tmp/ndkcli sensor sensor vendor -adb shell /data/local/tmp/ndkcli sensor sensor resolution -``` - -
- -
-Check thermal status - -```bash -# One-shot thermal status -adb shell /data/local/tmp/ndkcli thermal manager current-status - -# Monitor thermal status every 2 seconds for 30 seconds -adb shell /data/local/tmp/ndkcli thermal monitor --interval 2s --duration 30s -``` - -
- -
-Query EGL and GPU capabilities - -```bash -# EGL display information (vendor, version, extensions) -adb shell /data/local/tmp/ndkcli egl info - -# List EGL configurations -adb shell /data/local/tmp/ndkcli egl configs - -# OpenGL ES 2.0 info (creates pbuffer context, queries GL strings) -adb shell /data/local/tmp/ndkcli gles2 info - -# OpenGL ES 3.0 info -adb shell /data/local/tmp/ndkcli gles3 info -``` - -
- -
-Probe available media codecs - -```bash -# Check which codecs are available (H.264, H.265, VP8/9, AV1, AAC, etc.) -adb shell /data/local/tmp/ndkcli media codecs - -# Create specific encoder/decoder -adb shell /data/local/tmp/ndkcli media new-encoder --mime_type video/avc -adb shell /data/local/tmp/ndkcli media new-decoder --mime_type audio/mp4a-latm - -# Probe a media file -adb shell /data/local/tmp/ndkcli media probe --file /sdcard/video.mp4 -``` - -
- -
-Read device configuration - -```bash -# Show all configuration values (density, orientation, screen, SDK version) -adb shell /data/local/tmp/ndkcli config show - -# Individual queries -adb shell /data/local/tmp/ndkcli config config density -adb shell /data/local/tmp/ndkcli config config sdk-version -adb shell /data/local/tmp/ndkcli config config screen-width-dp -adb shell /data/local/tmp/ndkcli config config orientation -``` - -
- -
-Decode an image file - -```bash -# Decode a JPEG/PNG and print dimensions, stride, format -adb shell /data/local/tmp/ndkcli image decode --file /sdcard/photo.jpg - -# Decode with target size (downscale) -adb shell /data/local/tmp/ndkcli image decode --file /sdcard/photo.jpg --width 320 --height 240 -``` - -
- -
-Match system fonts - -```bash -# Find a matching font by family name and weight -adb shell /data/local/tmp/ndkcli font match --family sans-serif --weight 400 -adb shell /data/local/tmp/ndkcli font match --family serif --weight 700 --italic -``` - -
- -
-Check permissions - -```bash -# Check if a permission is granted for a PID/UID -adb shell /data/local/tmp/ndkcli permission check \ - --name android.permission.CAMERA --pid 1000 --uid 1000 -``` - -
- -
-Trace and logging - -```bash -# Check if tracing is enabled -adb shell /data/local/tmp/ndkcli trace is-enabled - -# Add a trace marker -adb shell /data/local/tmp/ndkcli trace begin-section --section-name "my_operation" -adb shell /data/local/tmp/ndkcli trace end-section - -# Set a trace counter -adb shell /data/local/tmp/ndkcli trace set-counter --counter-name "frames" --counter-value 42 - -# Write to Android log -adb shell /data/local/tmp/ndkcli log write --tag myapp --text "hello from ndkcli" --prio 4 -``` - -
- -
-NNAPI (Neural Networks) probe - -```bash -# Check if NNAPI is available -adb shell /data/local/tmp/ndkcli nnapi probe - -# Create and inspect a model -adb shell /data/local/tmp/ndkcli nnapi model new -``` - -
- -
-Storage and OBB - -```bash -# Check OBB mount status -adb shell /data/local/tmp/ndkcli storage obb --file /sdcard/main.obb -adb shell /data/local/tmp/ndkcli storage manager is-obb-mounted --filename /sdcard/main.obb -``` - -
- -
-Looper and window utilities - -```bash -# Test looper functionality (prepare, wake, poll) -adb shell /data/local/tmp/ndkcli looper test - -# Query window properties via ImageReader-backed window -adb shell /data/local/tmp/ndkcli window query -``` - -
- -## Supported Modules - -| NDK Module | Go Package | Import Path | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----------------------------------------------- | -| **Graphics & Rendering** | | | -| [![egl](https://img.shields.io/badge/egl-EGL-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/egl) | `egl` | `github.com/AndroidGoLab/ndk/egl` | -| [![gles2](https://img.shields.io/badge/gles2-OpenGL_ES_2.0-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/gles2) | `gles2` | `github.com/AndroidGoLab/ndk/gles2` | -| [![gles3](https://img.shields.io/badge/gles3-OpenGL_ES_3.0-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/gles3) | `gles3` | `github.com/AndroidGoLab/ndk/gles3` | -| [![vulkan](https://img.shields.io/badge/vulkan-Vulkan-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/vulkan) | `vulkan` | `github.com/AndroidGoLab/ndk/vulkan` | -| [![surfacecontrol](https://img.shields.io/badge/surfacecontrol-SurfaceControl-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/surfacecontrol) | `surfacecontrol` | `github.com/AndroidGoLab/ndk/surfacecontrol` | -| [![surfacetexture](https://img.shields.io/badge/surfacetexture-SurfaceTexture-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/surfacetexture) | `surfacetexture` | `github.com/AndroidGoLab/ndk/surfacetexture` | -| [![hwbuf](https://img.shields.io/badge/hwbuf-HardwareBuffer-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/hwbuf) | `hwbuf` | `github.com/AndroidGoLab/ndk/hwbuf` | -| [![window](https://img.shields.io/badge/window-NativeWindow-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/window) | `window` | `github.com/AndroidGoLab/ndk/window` | -| [![bitmap](https://img.shields.io/badge/bitmap-Bitmap-2962FF)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/bitmap) | `bitmap` | `github.com/AndroidGoLab/ndk/bitmap` | -| **Camera & Imaging** | | | -| [![camera](https://img.shields.io/badge/camera-Camera2-2E7D32)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/camera) | `camera` | `github.com/AndroidGoLab/ndk/camera` | -| [![image](https://img.shields.io/badge/image-ImageDecoder-2E7D32)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/image) | `image` | `github.com/AndroidGoLab/ndk/image` | -| **Audio & Media** | | | -| [![audio](https://img.shields.io/badge/audio-AAudio-7B1FA2)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/audio) | `audio` | `github.com/AndroidGoLab/ndk/audio` | -| [![media](https://img.shields.io/badge/media-MediaCodec-7B1FA2)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/media) | `media` | `github.com/AndroidGoLab/ndk/media` | -| [![midi](https://img.shields.io/badge/midi-MIDI-7B1FA2)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/midi) | `midi` | `github.com/AndroidGoLab/ndk/midi` | -| **Sensors & Input** | | | -| [![sensor](https://img.shields.io/badge/sensor-Sensors-E65100)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/sensor) | `sensor` | `github.com/AndroidGoLab/ndk/sensor` | -| [![input](https://img.shields.io/badge/input-Input-E65100)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/input) | `input` | `github.com/AndroidGoLab/ndk/input` | -| [![choreographer](https://img.shields.io/badge/choreographer-Choreographer-E65100)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/choreographer) | `choreographer` | `github.com/AndroidGoLab/ndk/choreographer` | -| **Activity & Lifecycle** | | | -| [![activity](https://img.shields.io/badge/activity-NativeActivity-00838F)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/activity) | `activity` | `github.com/AndroidGoLab/ndk/activity` | -| [![config](https://img.shields.io/badge/config-Configuration-00838F)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/config) | `config` | `github.com/AndroidGoLab/ndk/config` | -| [![thermal](https://img.shields.io/badge/thermal-ThermalManager-00838F)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/thermal) | `thermal` | `github.com/AndroidGoLab/ndk/thermal` | -| [![hint](https://img.shields.io/badge/hint-PerformanceHint-00838F)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/hint) | `hint` | `github.com/AndroidGoLab/ndk/hint` | -| [![permission](https://img.shields.io/badge/permission-Permission-00838F)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/permission) | `permission` | `github.com/AndroidGoLab/ndk/permission` | -| **Storage & Assets** | | | -| [![asset](https://img.shields.io/badge/asset-AssetManager-6D4C41)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/asset) | `asset` | `github.com/AndroidGoLab/ndk/asset` | -| [![storage](https://img.shields.io/badge/storage-StorageManager-6D4C41)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/storage) | `storage` | `github.com/AndroidGoLab/ndk/storage` | -| **System & IPC** | | | -| [![binder](https://img.shields.io/badge/binder-Binder-546E7A)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/binder) | `binder` | `github.com/AndroidGoLab/ndk/binder` | -| [![persistablebundle](https://img.shields.io/badge/persistablebundle-PersistableBundle-546E7A)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/persistablebundle) | `persistablebundle` | `github.com/AndroidGoLab/ndk/persistablebundle` | -| [![looper](https://img.shields.io/badge/looper-ALooper-546E7A)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/looper) | `looper` | `github.com/AndroidGoLab/ndk/looper` | -| [![log](https://img.shields.io/badge/log-Logging-546E7A)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/log) | `log` | `github.com/AndroidGoLab/ndk/log` | -| [![sharedmem](https://img.shields.io/badge/sharedmem-SharedMemory-546E7A)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/sharedmem) | `sharedmem` | `github.com/AndroidGoLab/ndk/sharedmem` | -| [![sync](https://img.shields.io/badge/sync-SyncFence-546E7A)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/sync) | `sync` | `github.com/AndroidGoLab/ndk/sync` | -| [![net](https://img.shields.io/badge/net-Multinetwork-546E7A)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/net) | `net` | `github.com/AndroidGoLab/ndk/net` | -| **Machine Learning** | | | -| [![nnapi](https://img.shields.io/badge/nnapi-NNAPI-C62828)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/nnapi) | `nnapi` | `github.com/AndroidGoLab/ndk/nnapi` | -| **Debugging & Fonts** | | | -| [![trace](https://img.shields.io/badge/trace-Trace-455A64)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/trace) | `trace` | `github.com/AndroidGoLab/ndk/trace` | -| [![font](https://img.shields.io/badge/font-FontManager-455A64)](https://pkg.go.dev/github.com/AndroidGoLab/ndk/font) | `font` | `github.com/AndroidGoLab/ndk/font` | - -## Architecture - -The project converts Android NDK C headers into safe, idiomatic Go packages through three code generation stages. Each stage has a dedicated tool and its own set of input/output artifacts: - -```mermaid -flowchart TD - NDK["Android NDK C Headers"] - MAN["capi/manifests/*.yaml"] - SPEC["spec/generated/{module}.yaml"] - CAPI["capi/{module}/*.go"] - OVER["spec/overlays/{module}.yaml"] - TMPL["templates/*.tmpl"] - IDOM["{module}/*.go"] - - NDK -->|parsed by| S1 - MAN -->|configures| S1 - - subgraph S1["Stage 1: specgen + c2ffi"] - direction LR - S1D["Extracts structured API spec"] - end - - S1 --> SPEC - - SPEC -->|read by| S2 - MAN -->|configures| S2 - - subgraph S2["Stage 2: capigen"] - direction LR - S2D["Generates raw CGo bindings"] - end - - S2 --> CAPI - - SPEC --> S3 - OVER -->|semantic annotations| S3 - TMPL -->|code templates| S3 - - subgraph S3["Stage 3: idiomgen"] - direction LR - S3D["Generates idiomatic Go packages"] - end - - S3 --> IDOM - - style NDK fill:#e0e0e0,color:#000 - style MAN fill:#fff3cd,color:#000 - style OVER fill:#fff3cd,color:#000 - style TMPL fill:#fff3cd,color:#000 - style SPEC fill:#d4edda,color:#000 - style CAPI fill:#d4edda,color:#000 - style IDOM fill:#cce5ff,color:#000 -``` - -**Legend**: Yellow = hand-written inputs, Green = generated intermediates, Blue = final output. - -### Stage 1: Spec Extraction (`make specs`) - -**Tool**: `tools/cmd/specgen` + `c2ffi` (external) - -Parses NDK C headers via c2ffi and extracts a structured YAML specification containing types, enums, functions, callbacks, and structs. - -**Input**: `capi/manifests/{module}.yaml` + NDK sysroot headers - -**Output**: `spec/generated/{module}.yaml` - -The spec captures: - -- **Types**: opaque pointers, typedefs, pointer handles -- **Enums**: constant groups with resolved values -- **Functions**: signatures with parameter names and types -- **Callbacks**: function pointer type signatures -- **Structs**: field definitions - -Example manifest (`capi/manifests/looper.yaml`): - -```yaml -GENERATOR: - PackageName: looper - Includes: ["android/looper.h"] - FlagGroups: - - { name: LDFLAGS, flags: [-landroid] } -``` - -Example output (`spec/generated/looper.yaml`, abridged): - -```yaml -module: looper -source_package: github.com/AndroidGoLab/ndk/capi/looper -types: - ALooper: - kind: opaque_ptr - c_type: ALooper - go_type: "*C.ALooper" -enums: - Looper_event_t: - - { name: ALOOPER_EVENT_INPUT, value: 1 } - - { name: ALOOPER_EVENT_OUTPUT, value: 2 } -functions: - ALooper_prepare: - c_name: ALooper_prepare - params: [{ name: opts, type: int32 }] - returns: "*ALooper" -``` - -### Stage 2: Raw CGo Bindings (`make capi`) - -**Tool**: `tools/cmd/capigen` (in-repo) - -Reads the generated spec YAML and manifest YAML, then produces raw CGo wrapper packages with type aliases, function wrappers, callback proxies, and enum constants. - -**Input**: `spec/generated/{module}.yaml` + `capi/manifests/{module}.yaml` - -**Output**: `capi/{module}/` -- a package with: - -- `doc.go` -- package declaration and doc comment -- `types.go` -- Go type aliases (`type ALooper C.ALooper`) -- `const.go` -- Enum constants -- `{module}.go` -- Go functions that call through CGo -- `cgo_helpers.h` / `cgo_helpers.go` -- Callback proxy declarations and implementations - -### Stage 3: Idiomatic Go Generation (`make idiomatic`) - -**Tool**: `tools/cmd/idiomgen` (in-repo) - -Merges the generated spec with a hand-written overlay and renders Go templates to produce the final user-facing packages. - -**Input**: - -- `spec/generated/{module}.yaml` -- structured API spec -- `spec/overlays/{module}.yaml` -- hand-written semantic annotations -- `templates/*.tmpl` -- Go text templates - -**Output**: `{module}/*.go` (e.g., `looper/looper.go`, `looper/enums.go`, ...) - -```mermaid -flowchart LR - SPEC["spec/generated/{module}.yaml"] - OVER["spec/overlays/{module}.yaml"] - - subgraph MERGE["Merge"] - direction TB - M1["Resolve type names"] - M2["Assign methods to receivers"] - M3["Classify enums (error vs value)"] - M4["Configure constructors/destructors"] - end - - SPEC --> MERGE - OVER --> MERGE - - MERGE --> MERGED["MergedSpec"] - - TMPL["templates/*.tmpl"] - - MERGED --> RENDER["Template Rendering"] - TMPL --> RENDER - - RENDER --> PKG["package.go"] - RENDER --> TYPES["types.go"] - RENDER --> ENUMS["enums.go"] - RENDER --> ERRS["errors.go"] - RENDER --> FUNCS["functions.go"] - RENDER --> TF[".go (per opaque type)"] - RENDER --> BRIDGE["capi/{module}/bridge_*.go"] -``` - -#### Overlay Files - -Overlays provide semantic annotations that transform raw C APIs into idiomatic Go. They are the primary mechanism for customization and are entirely hand-written. - -Example overlay (`spec/overlays/looper.yaml`): - -```yaml -module: looper -package: - go_name: looper - go_import: github.com/AndroidGoLab/ndk/looper - doc: "Package looper provides Go bindings for Android ALooper." -types: - ALooper: - go_name: Looper # ALooper -> Looper - destructor: ALooper_release # generates Close() method - pattern: ref_counted - Looper_event_t: - go_name: Event - strip_prefix: ALOOPER_ # ALOOPER_EVENT_INPUT -> EventInput -functions: - ALooper_prepare: - go_name: Prepare - returns_new: Looper # returns *Looper, acts as constructor - ALooper_wake: - receiver: Looper # becomes method: (*Looper).Wake() - go_name: Wake - ALooper_release: - skip: true # handled by destructor, don't expose -``` - -Key overlay capabilities: - -| Feature | Effect | -| ---------------------------- | -------------------------------------------------------- | -| `go_name` | Rename C symbol to idiomatic Go | -| `go_error: true` | Enum type implements `error` interface | -| `constructor` / `destructor` | Generate `New*()` and `Close()` | -| `receiver` | Turn free function into method | -| `returns_new` | Mark function as factory returning new handle | -| `strip_prefix` | Remove C naming prefix from enum constants | -| `pattern` | Lifecycle pattern: `builder`, `ref_counted`, `singleton` | -| `callback_structs` | Generate CGo callback bridges with registry | -| `struct_accessors` | Wrap C struct arrays as Go accessors | -| `skip: true` | Exclude function from generation | -| `chain: true` | Method returns receiver for chaining | - -#### Templates - -13 Go text templates in `templates/` control the shape of generated code: - -| Template | Generates | -| --------------------------------- | -------------------------------------------------------- | -| `package.go.tmpl` | Package declaration and doc comment | -| `type_alias_file.go.tmpl` | Type aliases for basic typedefs | -| `value_enum_file.go.tmpl` | Type-safe enum definitions with `String()` | -| `errors.go.tmpl` | Error type implementing `error` interface | -| `functions.go.tmpl` | Package-level free functions | -| `callback_file.go.tmpl` | Callback type placeholders | -| `type_file.go.tmpl` | Per-opaque-type struct, constructor, destructor, methods | -| `bridge_registry.go.tmpl` | Callback registration via `sync.Map` | -| `bridge_c.go.tmpl` | C inline functions for callback dispatch | -| `bridge_export.go.tmpl` | `//export` Go functions callable from C | -| `lifecycle.go.tmpl` | NativeActivity lifecycle API | -| `bridge_lifecycle.go.tmpl` | Lifecycle callback C bridges | -| `bridge_lifecycle_export.go.tmpl` | Lifecycle callback exports | - -## End-to-End Example: `looper` - -The transformation from C header to Go package: - -```mermaid -flowchart TD - subgraph C["C Header (android/looper.h)"] - C1["ALooper* ALooper_prepare(int opts)"] - C2["void ALooper_wake(ALooper* looper)"] - C3["void ALooper_release(ALooper* looper)"] - end - - subgraph SPEC["spec/generated/looper.yaml (specgen + c2ffi)"] - S1["types: ALooper: {kind: opaque_ptr}"] - S2["functions: ALooper_prepare: ..."] - end - - subgraph CAPI["capi/looper/looper.go (capigen)"] - R1["type ALooper C.ALooper"] - R2["func ALooper_prepare(opts int32) *ALooper"] - R3["func ALooper_wake(looper *ALooper)"] - R4["func ALooper_release(looper *ALooper)"] - end - - subgraph GO["looper/looper.go (idiomgen)"] - G1["type Looper struct { ptr *capi.ALooper }"] - G2["func Prepare(opts int32) *Looper"] - G3["func (h *Looper) Wake()"] - G4["func (h *Looper) Close() error"] - end - - C --> SPEC - SPEC --> CAPI - SPEC --> GO -``` - -## E2E Verification - -Run `make e2e-examples-test` to test ndkcli commands on a connected device or emulator. - -
-Verified platforms (click to expand) - -| Type | Device | Android | API | ABI | Build | Date | Passed | Total | -| -------- | ------------------- | ------- | --- | --------- | --------------- | ---------- | ------ | ----- | -| Phone | Pixel 8a | 16 | 36 | arm64-v8a | BP4A.260205.001 | 2026-03-15 | 17 | 17 | -| Emulator | sdk_gphone64_x86_64 | 15 | 35 | x86_64 | Pixel_7_API_35 | 2026-03-15 | 17 | 17 | - -
- -## Project Layout - -``` -. -├── Makefile # Build orchestration -├── tools/ -│ ├── cmd/ -│ │ ├── specgen/ # Stage 1: spec extraction via c2ffi -│ │ ├── capigen/ # Stage 2: CGo wrapper generator -│ │ ├── idiomgen/ # Stage 3: idiomatic Go generator -│ │ ├── headerspec/ # Standalone header spec extraction tool -│ │ └── ndk-build/ # APK packaging tool -│ └── pkg/ -│ ├── c2ffi/ # c2ffi invocation and JSON→spec conversion -│ ├── capigen/ # CGo code generation from spec + manifest -│ ├── headerspec/ # Header spec extraction logic -│ ├── specgen/ # Spec writing and legacy Go AST parsing -│ ├── specmodel/ # Spec data model (types, enums, functions) -│ ├── idiomgen/ # Merge, resolve, template rendering -│ └── overlaymodel/ # Overlay data model (annotations) -├── capi/ -│ ├── manifests/ # capigen config per module (hand-written) -│ └── {module}/ # Generated raw CGo packages -├── spec/ -│ ├── generated/ # Generated YAML specs (intermediate) -│ └── overlays/ # Hand-written semantic overlays -├── templates/ # Go text templates for code generation -├── {module}/ # Generated idiomatic Go packages (final output) -├── jni/ # Hand-written JNI helpers (activity, permissions, etc.) -├── e2e/ # End-to-end tests (Android emulator) -└── examples/ # Usage examples per module -``` - -## Make Targets - -| Target | Description | Requires | -| ------------------------ | -------------------------------------- | ----------------- | -| `make all` | Run all three stages | NDK + c2ffi | -| `make specs` | Stage 1: extract specs from C headers | NDK + c2ffi | -| `make capi` | Stage 2: generate raw CGo bindings | specs + manifests | -| `make idiomatic` | Stage 3: generate idiomatic packages | specs + overlays | -| `make regen` | Clean and regenerate everything | NDK + c2ffi | -| `make fixtures` | Generate from testdata (no NDK needed) | -- | -| `make test` | Run unit tests | -- | -| `make e2e` | Run E2E tests on Android emulator | NDK + SDK + KVM | -| `make apk-displaycamera` | Build camera example APK | NDK + SDK | -| `make clean` | Remove `capi/*/` and `spec/generated/` | -- | - -## Adding a New Module - -1. Create `capi/manifests/{module}.yaml` -- configure which NDK headers to parse and which symbols to accept. -2. Run `make specs` to extract the structured spec from C headers via c2ffi. -3. Run `make capi` to generate the raw CGo binding package. -4. Create `spec/overlays/{module}.yaml` -- annotate types with Go names, assign functions as methods, configure constructors/destructors, error types, etc. -5. Run `make idiomatic` to generate the final Go package. - -## Comparison with Similar Projects - -Several other projects provide Go (or Rust) bindings for the Android NDK. The table below highlights how they differ in scope, API style, and maintenance status. - -| | **ndk** (this project) | [gomobile](https://github.com/golang/mobile) | [android-go](https://github.com/xlab/android-go) | [gooid](https://github.com/gooid/gooid) | [rust-mobile/ndk](https://github.com/rust-mobile/ndk) | -| --------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| **Language** | Go | Go | Go | Go | Rust | -| **NDK modules** | 34 (graphics, camera, audio, media, sensors, ML, binder, …) | ~6 (app, gl, asset, sensor, audio, font — mostly in `exp/`) | ~7 (android core, EGL, GLES 1/2/3/3.1, NativeActivity) | Core NDK + camera, sensor, audio via hand-written wrappers | ~18 (asset, audio, bitmap, config, font, hardware buffer, looper, media, native window, surface texture, trace, …) | -| **API style** | Idiomatic Go: methods on types, builders, `Close()`, `error` interface, chaining | Cross-platform abstraction; hides NDK behind portable APIs | Thin wrappers over C; raw NDK types with some hand-written helpers | Hand-written Go wrappers; Chinese documentation | Safe Rust abstractions over raw FFI (`ndk-sys`) | -| **Code generation** | 3-stage pipeline (c2ffi → spec YAML → CGo → idiomatic Go) | Hand-written | [c-for-go](https://github.com/xlab/c-for-go) auto-generation from NDK headers | Manual | `bindgen` for `ndk-sys`; hand-written safe layer | -| **Target NDK** | Current (configurable via sysroot) | Tied to gomobile toolchain | android-23 | Unspecified (older) | Current (configurable) | -| **Camera2 NDK** | Yes | No | No | Yes (partial, hand-written) | No | -| **AAudio** | Yes | No (exp/audio uses OpenSL ES) | No | Yes (partial) | Yes | -| **MediaCodec** | Yes | No | No | No | Yes (partial) | -| **Vulkan** | Yes | No | No | No | No | -| **NNAPI** | Yes | No | No | No | No | -| **Binder IPC** | Yes | No | No | No | No | -| **Callback bridging** | Auto-generated C↔Go bridges with registry | N/A (event loop abstraction) | Manual via CGo | Manual | Rust closures / trait objects | -| **Lifecycle mgmt** | Idempotent nil-safe `Close() error` on all types | Managed by framework | Manual | Manual | `Drop` trait | -| **Cross-platform** | Android only | Android + iOS | Android only | Android only | Android only | -| **Maintenance** | Active (2025) | Active (official Go project) | Inactive (last commit 2022) | Inactive (last commit 2019) | Active (2025) | -| **Stars** | — | ~6 100 | ~1 100 | ~60 | ~1 300 | - -### Key Differences - -- **gomobile** is the official Go mobile toolkit. It prioritizes cross-platform portability (Android + iOS) over NDK coverage and exposes a small set of portable APIs (OpenGL ES, sensors, audio). It does not provide direct access to NDK-specific modules like Camera2, AAudio, MediaCodec, Vulkan, or Binder. If you need to call Android-specific NDK APIs, gomobile alone is not sufficient. - -- **android-go** (xlab) was a pioneering project that used [c-for-go](https://github.com/xlab/c-for-go) to auto-generate bindings from NDK headers. It covers EGL and OpenGL ES well but does not wrap higher-level NDK modules (camera, audio, media, sensors). The generated API exposes raw C types without idiomatic Go transformations. The project has not been updated since 2022. - -- **gooid** provides hand-written Go wrappers for a few NDK modules including camera and sensors, with example apps. Documentation is primarily in Chinese. The project has been inactive since 2019. - -- **rust-mobile/ndk** is the closest analog in the Rust ecosystem. It follows a similar two-layer approach (raw FFI in `ndk-sys`, safe abstractions in `ndk`) and covers ~18 NDK modules. It does not yet wrap Camera2, Vulkan, or NNAPI. If you are writing Rust rather than Go, this is the standard choice. - -- **This project** (`AndroidGoLab/ndk`) combines auto-generation with hand-written semantic overlays to produce idiomatic Go APIs across 34 NDK modules — the broadest coverage of any Go NDK binding library. The pipeline ensures that new NDK headers can be incorporated by updating manifests and overlays rather than rewriting bindings by hand. - - - -## Interoperability with related projects - -All handle types expose `UintPtr() uintptr` and `NewXFromUintPtr(uintptr)` methods alongside the existing `Pointer()`/`NewXFromPointer()` pair. This enables interop with Go packages that represent native Android handles as `uintptr` — including `golang.org/x/mobile`, `gioui.org`, and `github.com/xlab/android-go`. - -For generic code, all handles satisfy the `handle.NativeHandle` interface: - -```go -import "github.com/AndroidGoLab/ndk/handle" - -func logHandle(h handle.NativeHandle) { - log.Printf("native handle: 0x%x", h.UintPtr()) -} -``` - -EGL types (`EGLDisplay`, `EGLContext`, etc.) are `unsafe.Pointer` aliases and use free functions instead: `egl.EGLDisplayToUintPtr(d)` / `egl.EGLDisplayFromUintPtr(p)`. - -
-gomobile bind - -`gomobile bind` does not support `unsafe.Pointer` or `uintptr` in exported APIs. Transport native handles as `int64` (Java `long`) and convert inside Go: - -```go -package sensorbridge - -import "github.com/AndroidGoLab/ndk/sensor" - -// Bridge wraps an ASensorManager for cross-language use. -// Unexported fields are invisible to Java/Kotlin. -type Bridge struct { - mgr *sensor.Manager -} - -// NewBridge creates a Bridge from a raw ASensorManager* passed as int64 -// (Java long). gomobile bind does not support unsafe.Pointer or uintptr, -// so native handles must be transported as int64. -func NewBridge(managerHandle int64) *Bridge { - return &Bridge{ - mgr: sensor.NewManagerFromUintPtr(uintptr(managerHandle)), - } -} - -// Handle returns the underlying ASensorManager* as int64 for passing -// back to Java/JNI code. -func (b *Bridge) Handle() int64 { - return int64(b.mgr.UintPtr()) -} - -// AccelerometerName returns the name of the default accelerometer, -// or empty string if unavailable. -func (b *Bridge) AccelerometerName() string { - s := b.mgr.DefaultSensor(sensor.Accelerometer) - if s.UintPtr() == 0 { - return "" - } - return s.Name() -} - -// SensorName returns the name of a sensor by its Android type code, -// or empty string if the sensor is not available. -func (b *Bridge) SensorName(sensorType int32) string { - s := b.mgr.DefaultSensor(sensor.Type(sensorType)) - if s.UintPtr() == 0 { - return "" - } - return s.Name() -} -``` - -Build AAR: `gomobile bind -target=android -androidapi=35 ./examples/gomobile/sensorbridge` - -Java usage: - -```java -long ptr = nativeGetSensorManager(); // from JNI -Bridge bridge = Sensorbridge.newBridge(ptr); -String name = bridge.accelerometerName(); +cd ./examples/FyneCameraDemo +~/go/bin/fyne package -tags fyne -os android/arm64 ``` -See [`examples/gomobile/sensorbridge/`](examples/gomobile/sensorbridge/) for the complete buildable example. +And when I've launched the app, I got this: +![FyneCameraDemo_screenshot.png](doc/FyneCameraDemo_screenshot.png "FyneCameraDemo_screenshot.png") -
+--- -## FAQ +# OLD `README.md (originally from github.com/gooid/gooid) -**Q: Why NativeActivity instead of GameActivity?** +## Go bindings for Android NDK +用 Go 开发 APK -This project wraps NDK C headers via a three-stage generation pipeline. GameActivity is a Jetpack Java library (AAR in the AGDK), not an NDK C API. NativeActivity is the only activity model exposed by NDK headers themselves. GameActivity requires bundling a Java AAR + JNI bridging — fundamentally different from the C→Go pipeline. rust-mobile/ndk faces the identical constraint and also centers NativeActivity. A companion `gameactivity/` package is planned for wrapping the AGDK GameActivity C library. +### [基本编译环境](https://github.com/gooid/gooid/wiki/%E5%9F%BA%E6%9C%AC%E7%BC%96%E8%AF%91%E7%8E%AF%E5%A2%83) -**Q: What about permissions, text input, and other Java-only APIs?** +### 示例应用 +#### [Storage demo](https://github.com/gooid/gooid/tree/master/examples/AssetDemo) -Android runtime permissions are Activity-driven Java APIs; the NDK `APermissionManager_checkPermission` only checks, it cannot request. The `jni/` package provides `HasPermission()` and `RequestPermission()` via JNI as the escape hatch. `examples/camera/display/` demonstrates the full permission request flow. This is inherent to Android's platform design — all native-first frameworks (Rust ndk, C++ NativeActivity) hit the same boundary. See [Platform Integration Guide](docs/platform-integration.md) for details. +![Storage demo](https://img-blog.csdnimg.cn/2018121111145749.gif) -**Q: Why do examples use `unsafe.Pointer` and `runtime.LockOSThread()`?** +#### [Sensor demo](https://github.com/gooid/gooid/tree/master/examples/SensorDemo) -`unsafe.Pointer` in audio I/O provides zero-copy buffer access — adding a copying wrapper would be a performance regression for the primary use case. `runtime.LockOSThread()` is the standard Go pattern for thread-affine APIs (EGL contexts, ALooper, AInputQueue) — it is not a leaky abstraction, it is how Go correctly interoperates with thread-local native APIs. The idiomatic layer hides `unsafe.Pointer` for all handle types behind typed Go structs with constructors and `Close()` methods. See [Thread Safety Guide](docs/thread-safety.md). +![Sensor demo](https://img-blog.csdnimg.cn/20181214202804155.gif) -**Q: Why `make` targets instead of Android Studio / Gradle?** +#### [Record demo](https://github.com/gooid/gooid/tree/master/examples/Record) -There is no Go↔Gradle integration in the wider Go ecosystem; gomobile also uses a custom build tool. The provided Makefile produces complete, signed APKs ready for deployment. A standalone `go-ndk-build` CLI tool is planned to streamline APK packaging. +![Record demo](https://img-blog.csdnimg.cn/20181224171403212.gif) -**Q: Is the API stable?** +#### [Camera demo](https://github.com/gooid/gooid/tree/master/examples/CameraDemo) -The project is pre-release (v0.x). APIs may change as the overlay system evolves. Generated APIs track NDK header changes — running the pipeline with a new NDK version may change signatures. Semantic versioning will be adopted once the overlay format stabilizes. +![Camera demo](https://img-blog.csdnimg.cn/20181225151226349.gif) -## Guides +#### [FaceDetect](https://github.com/gooid/gooid/tree/master/examples/FaceDetect) -- [Thread Safety](docs/thread-safety.md) — when and why to use `runtime.LockOSThread()` -- [Platform Integration](docs/platform-integration.md) — bridging to Java APIs via JNI +![FaceDetect](https://img-blog.csdnimg.cn/20181226215246966.png) diff --git a/activity/activity.go b/activity/activity.go deleted file mode 100644 index c6826fe..0000000 --- a/activity/activity.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package activity - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/nativeactivity" -) - -// Activity wraps the NDK ANativeActivity handle. -type Activity struct { - ptr *capi.ANativeActivity -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Activity) cptr() *capi.ANativeActivity { - if h == nil { - return nil - } - return h.ptr -} - -// NewActivityFromPointer wraps a raw ANativeActivity pointer. -func NewActivityFromPointer(ptr unsafe.Pointer) *Activity { - return &Activity{ptr: (*capi.ANativeActivity)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Activity) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Activity) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewActivityFromUintPtr wraps a uintptr as a Activity. -// The caller must ensure ptr points to a valid ANativeActivity. -func NewActivityFromUintPtr(ptr uintptr) *Activity { - return &Activity{ptr: (*capi.ANativeActivity)(unsafe.Pointer(ptr))} -} - -// Finish calls the underlying NDK function. -func (h *Activity) Finish() { - capi.ANativeActivity_finish(h.ptr) -} - -// HideSoftInput calls the underlying NDK function. -func (h *Activity) HideSoftInput(flags uint32) { - capi.ANativeActivity_hideSoftInput(h.ptr, flags) -} - -// SetWindowFlags calls the underlying NDK function. -func (h *Activity) SetWindowFlags(addFlags uint32, removeFlags uint32) { - capi.ANativeActivity_setWindowFlags(h.ptr, addFlags, removeFlags) -} - -// SetWindowFormat calls the underlying NDK function. -func (h *Activity) SetWindowFormat(format int32) { - capi.ANativeActivity_setWindowFormat(h.ptr, format) -} - -// ShowSoftInput calls the underlying NDK function. -func (h *Activity) ShowSoftInput(flags uint32) { - capi.ANativeActivity_showSoftInput(h.ptr, flags) -} diff --git a/activity/errors.go b/activity/errors.go deleted file mode 100644 index b176636..0000000 --- a/activity/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package activity - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/activity/functions.go b/activity/functions.go deleted file mode 100644 index 941b07d..0000000 --- a/activity/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package activity diff --git a/activity/hide_soft_input_flags.go b/activity/hide_soft_input_flags.go deleted file mode 100644 index 5773861..0000000 --- a/activity/hide_soft_input_flags.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package activity - -type HideSoftInputFlags int32 - -const ( - ImplicitOnly HideSoftInputFlags = 1 - NotAlways HideSoftInputFlags = 2 -) diff --git a/activity/lifecycle.go b/activity/lifecycle.go deleted file mode 100644 index 22bcea9..0000000 --- a/activity/lifecycle.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package activity - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/nativeactivity" -) - -// LifecycleCallbacks holds Go callbacks for ANativeActivity lifecycle events. -type LifecycleCallbacks struct { - OnCreate func(*Activity) - OnStart func(*Activity) - OnResume func(*Activity) - OnSaveInstanceState func(*Activity, unsafe.Pointer) - OnPause func(*Activity) - OnStop func(*Activity) - OnDestroy func(*Activity) - OnWindowFocusChanged func(*Activity, int32) - OnNativeWindowCreated func(*Activity, unsafe.Pointer) - OnNativeWindowResized func(*Activity, unsafe.Pointer) - OnNativeWindowRedrawNeeded func(*Activity, unsafe.Pointer) - OnNativeWindowDestroyed func(*Activity, unsafe.Pointer) - OnInputQueueCreated func(*Activity, unsafe.Pointer) - OnInputQueueDestroyed func(*Activity, unsafe.Pointer) - OnContentRectChanged func(*Activity, unsafe.Pointer) - OnConfigurationChanged func(*Activity) - OnLowMemory func(*Activity) -} - -// SetLifecycleCallbacks registers callbacks for the lifecycle events. -func SetLifecycleCallbacks(cb LifecycleCallbacks) { - bridgeCB := capi.LifecycleCallbacks{} - if cb.OnCreate != nil { - fn := cb.OnCreate - bridgeCB.OnCreate = func(p0 unsafe.Pointer) { fn(NewActivityFromPointer(p0)) } - } - if cb.OnStart != nil { - fn := cb.OnStart - bridgeCB.OnStart = func(p0 unsafe.Pointer) { - fn(NewActivityFromPointer(p0)) - } - } - if cb.OnResume != nil { - fn := cb.OnResume - bridgeCB.OnResume = func(p0 unsafe.Pointer) { - fn(NewActivityFromPointer(p0)) - } - } - if cb.OnSaveInstanceState != nil { - fn := cb.OnSaveInstanceState - bridgeCB.OnSaveInstanceState = func(p0 unsafe.Pointer, p1 unsafe.Pointer) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnPause != nil { - fn := cb.OnPause - bridgeCB.OnPause = func(p0 unsafe.Pointer) { - fn(NewActivityFromPointer(p0)) - } - } - if cb.OnStop != nil { - fn := cb.OnStop - bridgeCB.OnStop = func(p0 unsafe.Pointer) { - fn(NewActivityFromPointer(p0)) - } - } - if cb.OnDestroy != nil { - fn := cb.OnDestroy - bridgeCB.OnDestroy = func(p0 unsafe.Pointer) { - fn(NewActivityFromPointer(p0)) - } - } - if cb.OnWindowFocusChanged != nil { - fn := cb.OnWindowFocusChanged - bridgeCB.OnWindowFocusChanged = func(p0 unsafe.Pointer, p1 int32) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnNativeWindowCreated != nil { - fn := cb.OnNativeWindowCreated - bridgeCB.OnNativeWindowCreated = func(p0 unsafe.Pointer, p1 unsafe.Pointer) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnNativeWindowResized != nil { - fn := cb.OnNativeWindowResized - bridgeCB.OnNativeWindowResized = func(p0 unsafe.Pointer, p1 unsafe.Pointer) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnNativeWindowRedrawNeeded != nil { - fn := cb.OnNativeWindowRedrawNeeded - bridgeCB.OnNativeWindowRedrawNeeded = func(p0 unsafe.Pointer, p1 unsafe.Pointer) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnNativeWindowDestroyed != nil { - fn := cb.OnNativeWindowDestroyed - bridgeCB.OnNativeWindowDestroyed = func(p0 unsafe.Pointer, p1 unsafe.Pointer) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnInputQueueCreated != nil { - fn := cb.OnInputQueueCreated - bridgeCB.OnInputQueueCreated = func(p0 unsafe.Pointer, p1 unsafe.Pointer) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnInputQueueDestroyed != nil { - fn := cb.OnInputQueueDestroyed - bridgeCB.OnInputQueueDestroyed = func(p0 unsafe.Pointer, p1 unsafe.Pointer) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnContentRectChanged != nil { - fn := cb.OnContentRectChanged - bridgeCB.OnContentRectChanged = func(p0 unsafe.Pointer, p1 unsafe.Pointer) { - fn(NewActivityFromPointer(p0), p1) - } - } - if cb.OnConfigurationChanged != nil { - fn := cb.OnConfigurationChanged - bridgeCB.OnConfigurationChanged = func(p0 unsafe.Pointer) { - fn(NewActivityFromPointer(p0)) - } - } - if cb.OnLowMemory != nil { - fn := cb.OnLowMemory - bridgeCB.OnLowMemory = func(p0 unsafe.Pointer) { - fn(NewActivityFromPointer(p0)) - } - } - capi.BridgeSetLifecycleCallbacks(bridgeCB) -} diff --git a/activity/native_activity_callbacks.go b/activity/native_activity_callbacks.go deleted file mode 100644 index 754d12c..0000000 --- a/activity/native_activity_callbacks.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package activity - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/nativeactivity" -) - -// NativeActivityCallbacks wraps the NDK ANativeActivityCallbacks handle. -type NativeActivityCallbacks struct { - ptr *capi.ANativeActivityCallbacks -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *NativeActivityCallbacks) cptr() *capi.ANativeActivityCallbacks { - if h == nil { - return nil - } - return h.ptr -} - -// NewNativeActivityCallbacksFromPointer wraps a raw ANativeActivityCallbacks pointer. -func NewNativeActivityCallbacksFromPointer(ptr unsafe.Pointer) *NativeActivityCallbacks { - return &NativeActivityCallbacks{ptr: (*capi.ANativeActivityCallbacks)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *NativeActivityCallbacks) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *NativeActivityCallbacks) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewNativeActivityCallbacksFromUintPtr wraps a uintptr as a NativeActivityCallbacks. -// The caller must ensure ptr points to a valid ANativeActivityCallbacks. -func NewNativeActivityCallbacksFromUintPtr(ptr uintptr) *NativeActivityCallbacks { - return &NativeActivityCallbacks{ptr: (*capi.ANativeActivityCallbacks)(unsafe.Pointer(ptr))} -} diff --git a/activity/package.go b/activity/package.go deleted file mode 100644 index 0f86c09..0000000 --- a/activity/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package activity provides Go bindings for Android NativeActivity. -package activity diff --git a/activity/show_soft_input_flags.go b/activity/show_soft_input_flags.go deleted file mode 100644 index 2abbad5..0000000 --- a/activity/show_soft_input_flags.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package activity - -type ShowSoftInputFlags int32 - -const ( - Implicit ShowSoftInputFlags = 1 - Forced ShowSoftInputFlags = 2 -) diff --git a/android.go b/android.go new file mode 100644 index 0000000..79b52a0 --- /dev/null +++ b/android.go @@ -0,0 +1,40 @@ +// Copyright 2017-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package ndk + +import ( + "github.com/xaionaro-go/ndk/ndk" +) + +type Callbacks = ndk.Callbacks +type Activity = ndk.Activity +type Window = ndk.Window +type InputEvent = ndk.InputEvent +type Context = ndk.Context + +func SetMainCB(fn func(*Context)) { + ndk.SetMainCB(fn) +} + +func Loop() bool { + return ndk.Loop() +} + +// getprop +func PropGet(k string) string { + return ndk.PropGet(k) +} + +// visitor all properties +func PropVisit(cb func(k, v string)) { + ndk.PropVisit(cb) +} + +// FindMatchLibrary find library path +// +// see filepath.Glob(pattern string) +func FindMatchLibrary(pattern string) []string { + return ndk.FindMatchLibrary(pattern) +} diff --git a/android/app.go b/android/app.go deleted file mode 100644 index 2c033ae..0000000 --- a/android/app.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build android - -package android - -import ( - "sync" - "unsafe" - - "github.com/AndroidGoLab/ndk/activity" - "github.com/AndroidGoLab/ndk/window" -) - -// App provides a high-level interface to an Android NativeActivity. -type App struct { - mu sync.Mutex - activity *activity.Activity - window *window.Window - windowPtr unsafe.Pointer -} - -// Activity returns the underlying Activity. -func (app *App) Activity() *activity.Activity { - app.mu.Lock() - defer app.mu.Unlock() - return app.activity -} - -// Window returns the current native window, or nil if no window is available. -func (app *App) Window() *window.Window { - app.mu.Lock() - defer app.mu.Unlock() - return app.window -} - -// WindowSize returns the current window dimensions. -// Returns (0, 0) if no window is available. -func (app *App) WindowSize() (width, height int32) { - app.mu.Lock() - w := app.window - app.mu.Unlock() - - if w == nil { - return 0, 0 - } - return w.Width(), w.Height() -} - -func (app *App) setActivity(act *activity.Activity) { - app.mu.Lock() - defer app.mu.Unlock() - app.activity = act -} - -func (app *App) setWindow(ptr unsafe.Pointer) { - app.mu.Lock() - defer app.mu.Unlock() - if ptr == nil { - app.window = nil - app.windowPtr = nil - } else { - app.windowPtr = ptr - app.window = window.NewWindowFromPointer(ptr) - } -} diff --git a/android/doc.go b/android/doc.go deleted file mode 100644 index d63304a..0000000 --- a/android/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build android - -// Package android provides a high-level API for Android NativeActivity apps. -// -// It combines the lower-level NDK packages (activity, window, input) with -// JNI helpers (jni) into an ergonomic interface for common platform tasks -// like permission management, lifecycle handling, and UI operations. -package android diff --git a/android/lifecycle.go b/android/lifecycle.go deleted file mode 100644 index 5b04843..0000000 --- a/android/lifecycle.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build android - -package android - -import ( - "unsafe" - - "github.com/AndroidGoLab/ndk/activity" - "github.com/AndroidGoLab/ndk/input" -) - -// Handlers defines callbacks for Android lifecycle events and input. -// All callbacks receive the App instance for accessing platform APIs. -type Handlers struct { - OnCreate func(app *App) - OnResume func(app *App) - OnPause func(app *App) - OnDestroy func(app *App) - OnWindowCreated func(app *App) - OnWindowDestroyed func(app *App) - OnWindowFocusChanged func(app *App, hasFocus bool) - OnInputEvent func(app *App, event *input.Event) bool -} - -// Run sets up NativeActivity lifecycle callbacks and manages the App instance. -// Call this from an init() function in your main package. -func Run(handlers Handlers) { - app := &App{} - - activity.SetLifecycleCallbacks(activity.LifecycleCallbacks{ - OnCreate: func(act *activity.Activity) { - app.setActivity(act) - if handlers.OnCreate != nil { - handlers.OnCreate(app) - } - }, - OnNativeWindowCreated: func(act *activity.Activity, win unsafe.Pointer) { - app.setActivity(act) - app.setWindow(win) - if handlers.OnWindowCreated != nil { - handlers.OnWindowCreated(app) - } - }, - OnResume: func(act *activity.Activity) { - app.setActivity(act) - if handlers.OnResume != nil { - handlers.OnResume(app) - } - }, - OnPause: func(act *activity.Activity) { - if handlers.OnPause != nil { - handlers.OnPause(app) - } - }, - OnWindowFocusChanged: func(_ *activity.Activity, hasFocus int32) { - if handlers.OnWindowFocusChanged != nil { - handlers.OnWindowFocusChanged(app, hasFocus != 0) - } - }, - OnNativeWindowDestroyed: func(_ *activity.Activity, _ unsafe.Pointer) { - if handlers.OnWindowDestroyed != nil { - handlers.OnWindowDestroyed(app) - } - app.setWindow(nil) - }, - OnInputQueueCreated: func(_ *activity.Activity, queuePtr unsafe.Pointer) { - if handlers.OnInputEvent != nil { - q := input.NewQueueFromPointer(queuePtr) - go drainInput(app, q, handlers.OnInputEvent) - } - }, - OnDestroy: func(_ *activity.Activity) { - if handlers.OnDestroy != nil { - handlers.OnDestroy(app) - } - app.setActivity(nil) - app.setWindow(nil) - }, - }) -} - -func drainInput( - app *App, - q *input.Queue, - handler func(app *App, event *input.Event) bool, -) { - for { - ev := q.GetEvent() - if ev == nil { - return - } - - if q.PreDispatchEvent(ev) { - continue - } - - handled := handler(app, ev) - var result int32 - if handled { - result = 1 - } - q.FinishEvent(ev, result) - } -} diff --git a/android/permissions.go b/android/permissions.go deleted file mode 100644 index bcbeb4a..0000000 --- a/android/permissions.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build android - -package android - -import ( - "github.com/AndroidGoLab/ndk/jni" -) - -// HasPermission checks if a runtime permission is currently granted. -func (app *App) HasPermission(permission string) bool { - app.mu.Lock() - act := app.activity - app.mu.Unlock() - - if act == nil { - return false - } - return jni.HasPermission(act.Pointer(), permission) -} - -// RequestPermission shows the system permission dialog for the given permission. -// This is asynchronous; use HasPermission to check the result after the user responds. -func (app *App) RequestPermission(permission string) { - app.mu.Lock() - act := app.activity - app.mu.Unlock() - - if act == nil { - return - } - jni.RequestPermission(act.Pointer(), permission) -} diff --git a/android/ui.go b/android/ui.go deleted file mode 100644 index 0441a93..0000000 --- a/android/ui.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build android - -package android - -import ( - "github.com/AndroidGoLab/ndk/jni" -) - -// ShowToast displays an Android Toast message. -func (app *App) ShowToast(message string) { - app.mu.Lock() - act := app.activity - app.mu.Unlock() - - if act == nil { - return - } - jni.ShowToast(act.Pointer(), message) -} - -// FillWindowColor fills the current window with a solid RGBA color. -// Does nothing if no window is available. -func (app *App) FillWindowColor(color uint32) { - app.mu.Lock() - wPtr := app.windowPtr - app.mu.Unlock() - - if wPtr == nil { - return - } - jni.FillWindowColor(wPtr, color) -} diff --git a/asset/asset.go b/asset/asset.go deleted file mode 100644 index f027ce1..0000000 --- a/asset/asset.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package asset - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/asset" -) - -// Asset wraps the NDK AAsset handle. -type Asset struct { - ptr *capi.AAsset -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Asset) cptr() *capi.AAsset { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Asset) Close() error { - if h.ptr == nil { - return nil - } - capi.AAsset_close(h.ptr) - h.ptr = nil - return nil -} - -// NewAssetFromPointer wraps a raw AAsset pointer. -func NewAssetFromPointer(ptr unsafe.Pointer) *Asset { - return &Asset{ptr: (*capi.AAsset)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Asset) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Asset) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewAssetFromUintPtr wraps a uintptr as a Asset. -// The caller must ensure ptr points to a valid AAsset. -func NewAssetFromUintPtr(ptr uintptr) *Asset { - return &Asset{ptr: (*capi.AAsset)(unsafe.Pointer(ptr))} -} - -// Buffer returns the value directly. -func (h *Asset) Buffer() unsafe.Pointer { - return (unsafe.Pointer)(capi.AAsset_getBuffer(h.ptr)) -} - -// Length returns the value directly. -func (h *Asset) Length() Off_t { - return (Off_t)(capi.AAsset_getLength(h.ptr)) -} - -// Length64 returns the value directly. -func (h *Asset) Length64() Off64_t { - return (Off64_t)(capi.AAsset_getLength64(h.ptr)) -} - -// RemainingLength returns the value directly. -func (h *Asset) RemainingLength() Off_t { - return (Off_t)(capi.AAsset_getRemainingLength(h.ptr)) -} - -// RemainingLength64 returns the value directly. -func (h *Asset) RemainingLength64() Off64_t { - return (Off64_t)(capi.AAsset_getRemainingLength64(h.ptr)) -} - -// IsAllocated returns the value directly. -func (h *Asset) IsAllocated() int32 { - return (int32)(capi.AAsset_isAllocated(h.ptr)) -} - -// OpenFileDescriptor calls the underlying NDK function. -func (h *Asset) OpenFileDescriptor(outStart *Off_t, outLength *Off_t) error { - return result(capi.AAsset_openFileDescriptor(h.ptr, (*capi.Off_t)(outStart), (*capi.Off_t)(outLength))) -} - -// OpenFileDescriptor64 calls the underlying NDK function. -func (h *Asset) OpenFileDescriptor64(outStart *Off64_t, outLength *Off64_t) error { - return result(capi.AAsset_openFileDescriptor64(h.ptr, (*capi.Off64_t)(outStart), (*capi.Off64_t)(outLength))) -} - -// Read calls the underlying NDK function. -func (h *Asset) Read(buf unsafe.Pointer, count uint64) error { - return result(capi.AAsset_read(h.ptr, buf, count)) -} - -// Seek returns the value directly. -func (h *Asset) Seek(offset Off_t, whence int32) Off_t { - return (Off_t)(capi.AAsset_seek(h.ptr, capi.Off_t(offset), whence)) -} diff --git a/asset/dir.go b/asset/dir.go deleted file mode 100644 index 8a60668..0000000 --- a/asset/dir.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package asset - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/asset" -) - -// Dir wraps the NDK AAssetDir handle. -type Dir struct { - ptr *capi.AAssetDir -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Dir) cptr() *capi.AAssetDir { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Dir) Close() error { - if h.ptr == nil { - return nil - } - capi.AAssetDir_close(h.ptr) - h.ptr = nil - return nil -} - -// NewDirFromPointer wraps a raw AAssetDir pointer. -func NewDirFromPointer(ptr unsafe.Pointer) *Dir { - return &Dir{ptr: (*capi.AAssetDir)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Dir) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Dir) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewDirFromUintPtr wraps a uintptr as a Dir. -// The caller must ensure ptr points to a valid AAssetDir. -func NewDirFromUintPtr(ptr uintptr) *Dir { - return &Dir{ptr: (*capi.AAssetDir)(unsafe.Pointer(ptr))} -} - -// NextFileName returns the value directly. -func (h *Dir) NextFileName() string { - return (string)(capi.AAssetDir_getNextFileName(h.ptr)) -} - -// Rewind calls the underlying NDK function. -func (h *Dir) Rewind() { - capi.AAssetDir_rewind(h.ptr) -} diff --git a/asset/errors.go b/asset/errors.go deleted file mode 100644 index 7ff6c0d..0000000 --- a/asset/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package asset - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/asset/functions.go b/asset/functions.go deleted file mode 100644 index 3a8ce93..0000000 --- a/asset/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package asset diff --git a/asset/manager.go b/asset/manager.go deleted file mode 100644 index 82cec67..0000000 --- a/asset/manager.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package asset - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/asset" -) - -// Manager wraps the NDK AAssetManager handle. -type Manager struct { - ptr *capi.AAssetManager -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Manager) cptr() *capi.AAssetManager { - if h == nil { - return nil - } - return h.ptr -} - -// NewManagerFromPointer wraps a raw AAssetManager pointer. -func NewManagerFromPointer(ptr unsafe.Pointer) *Manager { - return &Manager{ptr: (*capi.AAssetManager)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Manager) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Manager) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewManagerFromUintPtr wraps a uintptr as a Manager. -// The caller must ensure ptr points to a valid AAssetManager. -func NewManagerFromUintPtr(ptr uintptr) *Manager { - return &Manager{ptr: (*capi.AAssetManager)(unsafe.Pointer(ptr))} -} - -// Open creates a new Asset from this Manager. -func (h *Manager) Open(filename string, mode Mode) *Asset { - return &Asset{ptr: capi.AAssetManager_open(h.ptr, filename, int32(mode))} -} - -// OpenDir creates a new Dir from this Manager. -func (h *Manager) OpenDir(dirName string) *Dir { - return &Dir{ptr: capi.AAssetManager_openDir(h.ptr, dirName)} -} diff --git a/asset/mode.go b/asset/mode.go deleted file mode 100644 index 2e522aa..0000000 --- a/asset/mode.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package asset - -type Mode int32 - -const ( - Unknown Mode = 0 - Random Mode = 1 - Streaming Mode = 2 - Buffer Mode = 3 -) diff --git a/asset/off64_t.go b/asset/off64_t.go deleted file mode 100644 index c5b5a84..0000000 --- a/asset/off64_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package asset - -import ( - capi "github.com/AndroidGoLab/ndk/capi/asset" -) - -type Off64_t = capi.Off64_t diff --git a/asset/off_t.go b/asset/off_t.go deleted file mode 100644 index d344311..0000000 --- a/asset/off_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package asset - -import ( - capi "github.com/AndroidGoLab/ndk/capi/asset" -) - -type Off_t = capi.Off_t diff --git a/asset/package.go b/asset/package.go deleted file mode 100644 index 594c2c0..0000000 --- a/asset/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package asset provides Go bindings for Android Asset Manager. -package asset diff --git a/audio/aaudio_allowed_capture_policy_t.go b/audio/aaudio_allowed_capture_policy_t.go deleted file mode 100644 index f6ef303..0000000 --- a/audio/aaudio_allowed_capture_policy_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type aaudio_allowed_capture_policy_t = capi.Aaudio_allowed_capture_policy_t diff --git a/audio/aaudio_channel_mask_t.go b/audio/aaudio_channel_mask_t.go deleted file mode 100644 index 41ab12f..0000000 --- a/audio/aaudio_channel_mask_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type aaudio_channel_mask_t = capi.Aaudio_channel_mask_t diff --git a/audio/aaudio_content_type_t.go b/audio/aaudio_content_type_t.go deleted file mode 100644 index 79d6aec..0000000 --- a/audio/aaudio_content_type_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type aaudio_content_type_t = capi.Aaudio_content_type_t diff --git a/audio/aaudio_input_preset_t.go b/audio/aaudio_input_preset_t.go deleted file mode 100644 index 45d37d8..0000000 --- a/audio/aaudio_input_preset_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type aaudio_input_preset_t = capi.Aaudio_input_preset_t diff --git a/audio/aaudio_session_id_t.go b/audio/aaudio_session_id_t.go deleted file mode 100644 index 9a48a01..0000000 --- a/audio/aaudio_session_id_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type aaudio_session_id_t = capi.Aaudio_session_id_t diff --git a/audio/aaudio_spatialization_behavior_t.go b/audio/aaudio_spatialization_behavior_t.go deleted file mode 100644 index c554064..0000000 --- a/audio/aaudio_spatialization_behavior_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type aaudio_spatialization_behavior_t = capi.Aaudio_spatialization_behavior_t diff --git a/audio/aaudio_stream_error_callback.go b/audio/aaudio_stream_error_callback.go deleted file mode 100644 index 017f888..0000000 --- a/audio/aaudio_stream_error_callback.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type AAudioStream_errorCallback = capi.AAudioStream_errorCallback diff --git a/audio/aaudio_usage_t.go b/audio/aaudio_usage_t.go deleted file mode 100644 index 8a873c8..0000000 --- a/audio/aaudio_usage_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type aaudio_usage_t = capi.Aaudio_usage_t diff --git a/audio/al/al.go b/audio/al/al.go new file mode 100644 index 0000000..351fa53 --- /dev/null +++ b/audio/al/al.go @@ -0,0 +1,1192 @@ +// Copyright © 2013-2016 Galvanized Logic Inc. +// Use is governed by a BSD-style license found in the LICENSE file. + +// Package al provides golang audio library bindings for OpenAL. +// Official OpenAL documentation can be found online. Prepend "AL_" +// to the function or constant names found in this package. +// Refer to the official OpenAL documentation for more information. +// +// Package al is provided as part of the vu (virtual universe) 3D engine. +package al + +// Design Notes: +// These bindings were based on the OpenAL header files found at: +// http://repo.or.cz/w/openal-soft.git/blob/6dab9d54d1719105e0183f941a2b3dd36e9ba902:/include/AL/al.h +// http://repo.or.cz/w/openal-soft.git/blob/6dab9d54d1719105e0183f941a2b3dd36e9ba902:/include/AL/alc.h +// Check information available at openal.org. + +// //#cgo darwin LDFLAGS: -framework OpenAL +// //#cgo linux LDFLAGS: -lopenal -ldl +// //#cgo windows LDFLAGS: -lOpenAL32 +// +// #include +// #if defined(__APPLE__) +// #include +// #elif defined(_WIN32) +// #define WIN32_LEAN_AND_MEAN 1 +// #include +// #else +// #include +// #endif +// +// #ifdef _WIN32 +// static HMODULE hmod = NULL; +// #elif !defined __APPLE__ +// static void* plib = NULL; +// #endif +// const char* libpath = "libopenal.so"; +// static void setLibPath(const char* path) { libpath = path; } +// +// // Helps bind function pointers to c functions. +// static void* bindMethod(const char* name) { +// #ifdef __APPLE__ +// return dlsym(RTLD_DEFAULT, name); +// #elif _WIN32 +// if(hmod == NULL) { +// hmod = LoadLibraryA("OpenAL32.dll"); +// } +// return GetProcAddress(hmod, (LPCSTR)name); +// #else +// if(plib == NULL) { +// plib = dlopen(libpath, RTLD_LAZY); +// } +// return dlsym(plib, name); +// #endif +// } +// +// #if defined(_WIN32) +// #define AL_APIENTRY __cdecl +// #define ALC_APIENTRY __cdecl +// #else +// #define AL_APIENTRY +// #define ALC_APIENTRY +// #endif +// +// // AL/al.h typedefs +// typedef char ALboolean; +// typedef char ALchar; +// typedef signed char ALbyte; +// typedef unsigned char ALubyte; +// typedef unsigned short ALushort; +// typedef int ALint; +// typedef unsigned int ALuint; +// typedef int ALsizei; +// typedef int ALenum; +// typedef float ALfloat; +// typedef double ALdouble; +// typedef void ALvoid; +// +// #ifndef AL_API +// #define AL_API extern +// #endif +// +// // AL/alc.h typedefs +// typedef struct ALCdevice_struct ALCdevice; +// typedef struct ALCcontext_struct ALCcontext; +// typedef char ALCboolean; +// typedef char ALCchar; +// typedef signed char ALCbyte; +// typedef unsigned char ALCubyte; +// typedef unsigned short ALCushort; +// typedef int ALCint; +// typedef unsigned int ALCuint; +// typedef int ALCsizei; +// typedef int ALCenum; +// typedef void ALCvoid; +// +// #ifndef ALC_API +// #define ALC_API extern +// #endif +// +// // AL/al.h pointers to functions bound to the OS specific library. +// void (AL_APIENTRY *pfn_alEnable)( ALenum capability ); +// void (AL_APIENTRY *pfn_alDisable)( ALenum capability ); +// ALboolean (AL_APIENTRY *pfn_alIsEnabled)( ALenum capability ); +// const ALchar* (AL_APIENTRY *pfn_alGetString)( ALenum param ); +// void (AL_APIENTRY *pfn_alGetBooleanv)( ALenum param, ALboolean* data ); +// void (AL_APIENTRY *pfn_alGetIntegerv)( ALenum param, ALint* data ); +// void (AL_APIENTRY *pfn_alGetFloatv)( ALenum param, ALfloat* data ); +// void (AL_APIENTRY *pfn_alGetDoublev)( ALenum param, ALdouble* data ); +// ALboolean (AL_APIENTRY *pfn_alGetBoolean)( ALenum param ); +// ALint (AL_APIENTRY *pfn_alGetInteger)( ALenum param ); +// ALfloat (AL_APIENTRY *pfn_alGetFloat)( ALenum param ); +// ALdouble (AL_APIENTRY *pfn_alGetDouble)( ALenum param ); +// ALenum (AL_APIENTRY *pfn_alGetError)( void ); +// ALboolean (AL_APIENTRY *pfn_alIsExtensionPresent)(const ALchar* extname ); +// void* (AL_APIENTRY *pfn_alGetProcAddress)( const ALchar* fname ); +// ALenum (AL_APIENTRY *pfn_alGetEnumValue)( const ALchar* ename ); +// void (AL_APIENTRY *pfn_alListenerf)( ALenum param, ALfloat value ); +// void (AL_APIENTRY *pfn_alListener3f)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +// void (AL_APIENTRY *pfn_alListenerfv)( ALenum param, const ALfloat* values ); +// void (AL_APIENTRY *pfn_alListeneri)( ALenum param, ALint value ); +// void (AL_APIENTRY *pfn_alListener3i)( ALenum param, ALint value1, ALint value2, ALint value3 ); +// void (AL_APIENTRY *pfn_alListeneriv)( ALenum param, const ALint* values ); +// void (AL_APIENTRY *pfn_alGetListenerf)( ALenum param, ALfloat* value ); +// void (AL_APIENTRY *pfn_alGetListener3f)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 ); +// void (AL_APIENTRY *pfn_alGetListenerfv)( ALenum param, ALfloat* values ); +// void (AL_APIENTRY *pfn_alGetListeneri)( ALenum param, ALint* value ); +// void (AL_APIENTRY *pfn_alGetListener3i)( ALenum param, ALint *value1, ALint *value2, ALint *value3 ); +// void (AL_APIENTRY *pfn_alGetListeneriv)( ALenum param, ALint* values ); +// void (AL_APIENTRY *pfn_alGenSources)( ALsizei n, ALuint* sources ); +// void (AL_APIENTRY *pfn_alDeleteSources)( ALsizei n, const ALuint* sources ); +// ALboolean (AL_APIENTRY *pfn_alIsSource)( ALuint sid ); +// void (AL_APIENTRY *pfn_alSourcef)( ALuint sid, ALenum param, ALfloat value); +// void (AL_APIENTRY *pfn_alSource3f)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +// void (AL_APIENTRY *pfn_alSourcefv)( ALuint sid, ALenum param, const ALfloat* values ); +// void (AL_APIENTRY *pfn_alSourcei)( ALuint sid, ALenum param, ALint value); +// void (AL_APIENTRY *pfn_alSource3i)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ); +// void (AL_APIENTRY *pfn_alSourceiv)( ALuint sid, ALenum param, const ALint* values ); +// void (AL_APIENTRY *pfn_alGetSourcef)( ALuint sid, ALenum param, ALfloat* value ); +// void (AL_APIENTRY *pfn_alGetSource3f)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +// void (AL_APIENTRY *pfn_alGetSourcefv)( ALuint sid, ALenum param, ALfloat* values ); +// void (AL_APIENTRY *pfn_alGetSourcei)( ALuint sid, ALenum param, ALint* value ); +// void (AL_APIENTRY *pfn_alGetSource3i)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +// void (AL_APIENTRY *pfn_alGetSourceiv)( ALuint sid, ALenum param, ALint* values ); +// void (AL_APIENTRY *pfn_alSourcePlayv)( ALsizei ns, const ALuint *sids ); +// void (AL_APIENTRY *pfn_alSourceStopv)( ALsizei ns, const ALuint *sids ); +// void (AL_APIENTRY *pfn_alSourceRewindv)( ALsizei ns, const ALuint *sids ); +// void (AL_APIENTRY *pfn_alSourcePausev)( ALsizei ns, const ALuint *sids ); +// void (AL_APIENTRY *pfn_alSourcePlay)( ALuint sid ); +// void (AL_APIENTRY *pfn_alSourceStop)( ALuint sid ); +// void (AL_APIENTRY *pfn_alSourceRewind)( ALuint sid ); +// void (AL_APIENTRY *pfn_alSourcePause)( ALuint sid ); +// void (AL_APIENTRY *pfn_alSourceQueueBuffers)(ALuint sid, ALsizei numEntries, const ALuint *bids ); +// void (AL_APIENTRY *pfn_alSourceUnqueueBuffers)(ALuint sid, ALsizei numEntries, ALuint *bids ); +// void (AL_APIENTRY *pfn_alGenBuffers)( ALsizei n, ALuint* buffers ); +// void (AL_APIENTRY *pfn_alDeleteBuffers)( ALsizei n, const ALuint* buffers ); +// ALboolean (AL_APIENTRY *pfn_alIsBuffer)( ALuint bid ); +// void (AL_APIENTRY *pfn_alBufferData)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq ); +// void (AL_APIENTRY *pfn_alBufferf)( ALuint bid, ALenum param, ALfloat value); +// void (AL_APIENTRY *pfn_alBuffer3f)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +// void (AL_APIENTRY *pfn_alBufferfv)( ALuint bid, ALenum param, const ALfloat* values ); +// void (AL_APIENTRY *pfn_alBufferi)( ALuint bid, ALenum param, ALint value); +// void (AL_APIENTRY *pfn_alBuffer3i)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ); +// void (AL_APIENTRY *pfn_alBufferiv)( ALuint bid, ALenum param, const ALint* values ); +// void (AL_APIENTRY *pfn_alGetBufferf)( ALuint bid, ALenum param, ALfloat* value ); +// void (AL_APIENTRY *pfn_alGetBuffer3f)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +// void (AL_APIENTRY *pfn_alGetBufferfv)( ALuint bid, ALenum param, ALfloat* values ); +// void (AL_APIENTRY *pfn_alGetBufferi)( ALuint bid, ALenum param, ALint* value ); +// void (AL_APIENTRY *pfn_alGetBuffer3i)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +// void (AL_APIENTRY *pfn_alGetBufferiv)( ALuint bid, ALenum param, ALint* values ); +// void (AL_APIENTRY *pfn_alDopplerFactor)( ALfloat value ); +// void (AL_APIENTRY *pfn_alDopplerVelocity)( ALfloat value ); +// void (AL_APIENTRY *pfn_alSpeedOfSound)( ALfloat value ); +// void (AL_APIENTRY *pfn_alDistanceModel)( ALenum distanceModel ); +// +// // AL/al.h wrappers for the go bindings. +// AL_API void AL_APIENTRY wrap_alEnable( int capability ) { (*pfn_alEnable)( capability ); } +// AL_API void AL_APIENTRY wrap_alDisable( int capability ) { (*pfn_alDisable)( capability ); } +// AL_API unsigned int AL_APIENTRY wrap_alIsEnabled( int capability ) { return (*pfn_alIsEnabled)( capability ); } +// AL_API const char* AL_APIENTRY wrap_alGetString( int param ) { return (*pfn_alGetString)( param ); } +// AL_API void AL_APIENTRY wrap_alGetBooleanv( int param, char* data ) { (*pfn_alGetBooleanv)( param, data ); } +// AL_API void AL_APIENTRY wrap_alGetIntegerv( int param, int* data ) { (*pfn_alGetIntegerv)( param, data ); } +// AL_API void AL_APIENTRY wrap_alGetFloatv( int param, float* data ) { (*pfn_alGetFloatv)( param, data ); } +// AL_API void AL_APIENTRY wrap_alGetDoublev( int param, double* data ) { (*pfn_alGetDoublev)( param, data );} +// AL_API ALboolean AL_APIENTRY wrap_alGetBoolean( int param ) { return (*pfn_alGetBoolean)( param ); } +// AL_API ALint AL_APIENTRY wrap_alGetInteger( int param ) { return (*pfn_alGetInteger)( param ); } +// AL_API ALfloat AL_APIENTRY wrap_alGetFloat( int param ) { return (*pfn_alGetFloat)( param ); } +// AL_API ALdouble AL_APIENTRY wrap_alGetDouble( int param ) { return (*pfn_alGetDouble)( param ); } +// AL_API ALenum AL_APIENTRY wrap_alGetError( void ) { return (*pfn_alGetError)(); } +// AL_API ALboolean AL_APIENTRY wrap_alIsExtensionPresent( const char* extname ) { return (*pfn_alIsExtensionPresent)( extname ); } +// AL_API void* AL_APIENTRY wrap_alGetProcAddress( const char* fname ) { return (*pfn_alGetProcAddress)( fname ); } +// AL_API ALenum AL_APIENTRY wrap_alGetEnumValue( const char* ename ) { return (*pfn_alGetEnumValue)( ename ); } +// AL_API void AL_APIENTRY wrap_alListenerf( int param, float value ) { (*pfn_alListenerf)( param, value ); } +// AL_API void AL_APIENTRY wrap_alListener3f( int param, float value1, float value2, float value3 ) { (*pfn_alListener3f)( param, value1, value2, value3 ); } +// AL_API void AL_APIENTRY wrap_alListenerfv( int param, const float* values ) { (*pfn_alListenerfv)( param, values ); } +// AL_API void AL_APIENTRY wrap_alListeneri( int param, int value ) { (*pfn_alListeneri)( param, value ); } +// AL_API void AL_APIENTRY wrap_alListener3i( int param, int value1, int value2, int value3 ) { (*pfn_alListener3i)( param, value1, value2, value3 ); } +// AL_API void AL_APIENTRY wrap_alListeneriv( int param, const int* values ) { (*pfn_alListeneriv)( param, values ); } +// AL_API void AL_APIENTRY wrap_alGetListenerf( int param, float* value ) { (*pfn_alGetListenerf)( param, value ); } +// AL_API void AL_APIENTRY wrap_alGetListener3f( int param, float *value1, float *value2, float *value3 ) { (*pfn_alGetListener3f)( param, value1, value2, value3 ); } +// AL_API void AL_APIENTRY wrap_alGetListenerfv( int param, float* values ) { (*pfn_alGetListenerfv)( param, values ); } +// AL_API void AL_APIENTRY wrap_alGetListeneri( int param, int* value ) { (*pfn_alGetListeneri)( param, value ); } +// AL_API void AL_APIENTRY wrap_alGetListener3i( int param, int *value1, int *value2, int *value3 ) { (*pfn_alGetListener3i)( param, value1, value2, value3 ); } +// AL_API void AL_APIENTRY wrap_alGetListeneriv( int param, int* values ) { (*pfn_alGetListeneriv)( param, values ); } +// AL_API void AL_APIENTRY wrap_alGenSources( int n, unsigned int* sources ) { (*pfn_alGenSources)( n, sources ); } +// AL_API void AL_APIENTRY wrap_alDeleteSources( int n, const unsigned int* sources ) { (*pfn_alDeleteSources)( n, sources ); } +// AL_API ALboolean AL_APIENTRY wrap_alIsSource( unsigned int sid ) { return (*pfn_alIsSource)( sid ); } +// AL_API void AL_APIENTRY wrap_alSourcef( unsigned int sid, int param, float value ) { (*pfn_alSourcef)( sid, param, value ); } +// AL_API void AL_APIENTRY wrap_alSource3f( unsigned int sid, int param, float value1, float value2, float value3 ) { (*pfn_alSource3f)( sid, param, value1, value2, value3 ); } +// AL_API void AL_APIENTRY wrap_alSourcefv( unsigned int sid, int param, const float* values ) { (*pfn_alSourcefv)( sid, param, values ); } +// AL_API void AL_APIENTRY wrap_alSourcei( unsigned int sid, int param, int value ) { (*pfn_alSourcei)( sid, param, value ); } +// AL_API void AL_APIENTRY wrap_alSource3i( unsigned int sid, int param, int value1, int value2, int value3 ) { (*pfn_alSource3i)( sid, param, value1, value2, value3 ); } +// AL_API void AL_APIENTRY wrap_alSourceiv( unsigned int sid, int param, const int* values ) { (*pfn_alSourceiv)( sid, param, values ); } +// AL_API void AL_APIENTRY wrap_alGetSourcef( unsigned int sid, int param, float* value ) { (*pfn_alGetSourcef)( sid, param, value ); } +// AL_API void AL_APIENTRY wrap_alGetSource3f( unsigned int sid, int param, float* value1, float* value2, float* value3) { (*pfn_alGetSource3f)( sid, param, value1, value2, value3); } +// AL_API void AL_APIENTRY wrap_alGetSourcefv( unsigned int sid, int param, float* values ) { (*pfn_alGetSourcefv)( sid, param, values ); } +// AL_API void AL_APIENTRY wrap_alGetSourcei( unsigned int sid, int param, int* value ) { (*pfn_alGetSourcei)( sid, param, value ); } +// AL_API void AL_APIENTRY wrap_alGetSource3i( unsigned int sid, int param, int* value1, int* value2, int* value3) { (*pfn_alGetSource3i)( sid, param, value1, value2, value3); } +// AL_API void AL_APIENTRY wrap_alGetSourceiv( unsigned int sid, int param, int* values ) { (*pfn_alGetSourceiv)( sid, param, values ); } +// AL_API void AL_APIENTRY wrap_alSourcePlayv( int ns, const unsigned int *sids ) { (*pfn_alSourcePlayv)( ns, sids ); } +// AL_API void AL_APIENTRY wrap_alSourceStopv( int ns, const unsigned int *sids ) { (*pfn_alSourceStopv)( ns, sids ); } +// AL_API void AL_APIENTRY wrap_alSourceRewindv( int ns, const unsigned int *sids ) { (*pfn_alSourceRewindv)( ns, sids ); } +// AL_API void AL_APIENTRY wrap_alSourcePausev( int ns, const unsigned int *sids ) { (*pfn_alSourcePausev)( ns, sids ); } +// AL_API void AL_APIENTRY wrap_alSourcePlay( unsigned int sid ) { (*pfn_alSourcePlay)( sid ); } +// AL_API void AL_APIENTRY wrap_alSourceStop( unsigned int sid ) { (*pfn_alSourceStop)( sid ); } +// AL_API void AL_APIENTRY wrap_alSourceRewind( unsigned int sid ) { (*pfn_alSourceRewind)( sid ); } +// AL_API void AL_APIENTRY wrap_alSourcePause( unsigned int sid ) { (*pfn_alSourcePause)( sid ); } +// AL_API void AL_APIENTRY wrap_alSourceQueueBuffers( unsigned int sid, int numEntries, const unsigned int *bids ) { (*pfn_alSourceQueueBuffers)( sid, numEntries, bids ); } +// AL_API void AL_APIENTRY wrap_alSourceUnqueueBuffers( unsigned int sid, int numEntries, unsigned int *bids ) {(*pfn_alSourceUnqueueBuffers)( sid, numEntries, bids ); } +// AL_API void AL_APIENTRY wrap_alGenBuffers( int n, unsigned int* buffers ) { (*pfn_alGenBuffers)( n, buffers ); } +// AL_API void AL_APIENTRY wrap_alDeleteBuffers( int n, const unsigned int* buffers ) { (*pfn_alDeleteBuffers)( n, buffers ); } +// AL_API ALboolean AL_APIENTRY wrap_alIsBuffer( unsigned int bid ) { return (*pfn_alIsBuffer)( bid ); } +// AL_API void AL_APIENTRY wrap_alBufferData( unsigned int bid, int format, const ALvoid* data, int size, int freq ) { (*pfn_alBufferData)( bid, format, data, size, freq ); } +// AL_API void AL_APIENTRY wrap_alBufferf( unsigned int bid, int param, float value ) { (*pfn_alBufferf)( bid, param, value ); } +// AL_API void AL_APIENTRY wrap_alBuffer3f( unsigned int bid, int param, float value1, float value2, float value3 ) { (*pfn_alBuffer3f)( bid, param, value1, value2, value3 ); } +// AL_API void AL_APIENTRY wrap_alBufferfv( unsigned int bid, int param, const float* values ) { (*pfn_alBufferfv)( bid, param, values ); } +// AL_API void AL_APIENTRY wrap_alBufferi( unsigned int bid, int param, int value ) { (*pfn_alBufferi)( bid, param, value ); } +// AL_API void AL_APIENTRY wrap_alBuffer3i( unsigned int bid, int param, int value1, int value2, int value3 ) { (*pfn_alBuffer3i)( bid, param, value1, value2, value3 ); } +// AL_API void AL_APIENTRY wrap_alBufferiv( unsigned int bid, int param, const int* values ) { (*pfn_alBufferiv)( bid, param, values ); } +// AL_API void AL_APIENTRY wrap_alGetBufferf( unsigned int bid, int param, float* value ) { (*pfn_alGetBufferf)( bid, param, value ); } +// AL_API void AL_APIENTRY wrap_alGetBuffer3f( unsigned int bid, int param, float* value1, float* value2, float* value3) { (*pfn_alGetBuffer3f)( bid, param, value1, value2, value3); } +// AL_API void AL_APIENTRY wrap_alGetBufferfv( unsigned int bid, int param, float* values ) { (*pfn_alGetBufferfv)( bid, param, values ); } +// AL_API void AL_APIENTRY wrap_alGetBufferi( unsigned int bid, int param, int* value ) { (*pfn_alGetBufferi)( bid, param, value ); } +// AL_API void AL_APIENTRY wrap_alGetBuffer3i( unsigned int bid, int param, int* value1, int* value2, int* value3) { (*pfn_alGetBuffer3i)( bid, param, value1, value2, value3); } +// AL_API void AL_APIENTRY wrap_alGetBufferiv( unsigned int bid, int param, int* values ) { (*pfn_alGetBufferiv)( bid, param, values ); } +// AL_API void AL_APIENTRY wrap_alDopplerFactor( float value ) { (*pfn_alDopplerFactor)( value ); } +// AL_API void AL_APIENTRY wrap_alDopplerVelocity( float value ) { (*pfn_alDopplerVelocity)( value ); } +// AL_API void AL_APIENTRY wrap_alSpeedOfSound( float value ) { (*pfn_alSpeedOfSound)( value ); } +// AL_API void AL_APIENTRY wrap_alDistanceModel( int distanceModel ) { (*pfn_alDistanceModel)( distanceModel ); } +// +// // AL/alc.h pointers to functions bound to the OS specific library. +// ALCcontext * (ALC_APIENTRY *pfn_alcCreateContext) (ALCdevice *device, const ALCint *attrlist); +// ALCboolean (ALC_APIENTRY *pfn_alcMakeContextCurrent)( ALCcontext *context ); +// void (ALC_APIENTRY *pfn_alcProcessContext)( ALCcontext *context ); +// void (ALC_APIENTRY *pfn_alcSuspendContext)( ALCcontext *context ); +// void (ALC_APIENTRY *pfn_alcDestroyContext)( ALCcontext *context ); +// ALCcontext * (ALC_APIENTRY *pfn_alcGetCurrentContext)( void ); +// ALCdevice * (ALC_APIENTRY *pfn_alcGetContextsDevice)( ALCcontext *context ); +// ALCdevice * (ALC_APIENTRY *pfn_alcOpenDevice)( const ALCchar *devicename ); +// ALCboolean (ALC_APIENTRY *pfn_alcCloseDevice)( ALCdevice *device ); +// ALCenum (ALC_APIENTRY *pfn_alcGetError)( ALCdevice *device ); +// ALCboolean (ALC_APIENTRY *pfn_alcIsExtensionPresent)( ALCdevice *device, const ALCchar *extname ); +// void * (ALC_APIENTRY *pfn_alcGetProcAddress)(ALCdevice *device, const ALCchar *funcname ); +// ALCenum (ALC_APIENTRY *pfn_alcGetEnumValue)(ALCdevice *device, const ALCchar *enumname ); +// const ALCchar* (ALC_APIENTRY *pfn_alcGetString)( ALCdevice *device, ALCenum param ); +// void (ALC_APIENTRY *pfn_alcGetIntegerv)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data ); +// ALCdevice * (ALC_APIENTRY *pfn_alcCaptureOpenDevice)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); +// ALCboolean (ALC_APIENTRY *pfn_alcCaptureCloseDevice)( ALCdevice *device ); +// void (ALC_APIENTRY *pfn_alcCaptureStart)( ALCdevice *device ); +// void (ALC_APIENTRY *pfn_alcCaptureStop)( ALCdevice *device ); +// void (ALC_APIENTRY *pfn_alcCaptureSamples)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); +// +// // AL/alc.h wrappers for the go bindings. +// ALC_API uintptr_t ALC_APIENTRY wrap_alcCreateContext( uintptr_t device, const int* attrlist ) { return (uintptr_t)(*pfn_alcCreateContext)((ALCdevice *)device, attrlist); } +// ALC_API ALCboolean ALC_APIENTRY wrap_alcMakeContextCurrent( uintptr_t context ) { return (*pfn_alcMakeContextCurrent)( (ALCcontext *)context ); } +// ALC_API void ALC_APIENTRY wrap_alcProcessContext( uintptr_t context ) { (*pfn_alcProcessContext)( (ALCcontext *)context ); } +// ALC_API void ALC_APIENTRY wrap_alcSuspendContext( uintptr_t context ) { (*pfn_alcSuspendContext)( (ALCcontext *)context ); } +// ALC_API void ALC_APIENTRY wrap_alcDestroyContext( uintptr_t context ) { (*pfn_alcDestroyContext)( (ALCcontext *)context ); } +// ALC_API uintptr_t ALC_APIENTRY wrap_alcGetCurrentContext( void ) { return (uintptr_t)(*pfn_alcGetCurrentContext)(); } +// ALC_API uintptr_t ALC_APIENTRY wrap_alcGetContextsDevice( uintptr_t context ) { return (uintptr_t)(*pfn_alcGetContextsDevice)( (ALCcontext *)context ); } +// ALC_API uintptr_t ALC_APIENTRY wrap_alcOpenDevice( const char *devicename ) { return (uintptr_t)(*pfn_alcOpenDevice)( devicename ); } +// ALC_API ALCboolean ALC_APIENTRY wrap_alcCloseDevice( uintptr_t device ) { return (*pfn_alcCloseDevice)( (ALCdevice *)device ); } +// ALC_API ALCenum ALC_APIENTRY wrap_alcGetError( uintptr_t device ) { return (*pfn_alcGetError)( (ALCdevice *)device ); } +// ALC_API ALCboolean ALC_APIENTRY wrap_alcIsExtensionPresent( uintptr_t device, const char *extname ) { return (*pfn_alcIsExtensionPresent)( (ALCdevice *)device, extname ); } +// ALC_API void * ALC_APIENTRY wrap_alcGetProcAddress( uintptr_t device, const char *funcname ) { return (*pfn_alcGetProcAddress)( (ALCdevice *)device, funcname ); } +// ALC_API ALCenum ALC_APIENTRY wrap_alcGetEnumValue( uintptr_t device, const char *enumname ) { return (*pfn_alcGetEnumValue)( (ALCdevice *)device, enumname ); } +// ALC_API const char * ALC_APIENTRY wrap_alcGetString( uintptr_t device, int param ) { return (*pfn_alcGetString)( (ALCdevice *)device, param ); } +// ALC_API void ALC_APIENTRY wrap_alcGetIntegerv( uintptr_t device, int param, int size, int *data ) { (*pfn_alcGetIntegerv)( (ALCdevice *)device, param, size, data ); } +// ALC_API uintptr_t ALC_APIENTRY wrap_alcCaptureOpenDevice( const char *devicename, unsigned int frequency, int format, int buffersize ) { return (uintptr_t)(*pfn_alcCaptureOpenDevice)( devicename, frequency, format, buffersize ); } +// ALC_API ALCboolean ALC_APIENTRY wrap_alcCaptureCloseDevice( uintptr_t device ) { return (*pfn_alcCaptureCloseDevice)( (ALCdevice *)device ); } +// ALC_API void ALC_APIENTRY wrap_alcCaptureStart( uintptr_t device ) { (*pfn_alcCaptureStart)( (ALCdevice *)device ); } +// ALC_API void ALC_APIENTRY wrap_alcCaptureStop( uintptr_t device ) { (*pfn_alcCaptureStop)( (ALCdevice *)device ); } +// ALC_API void ALC_APIENTRY wrap_alcCaptureSamples( uintptr_t device, ALCvoid *buffer, int samples ) { (*pfn_alcCaptureSamples)( (ALCdevice *)device, buffer, samples ); } +// +// void al_init() { +// // AL/al.h +// pfn_alEnable = bindMethod("alEnable"); +// pfn_alDisable = bindMethod("alDisable"); +// pfn_alIsEnabled = bindMethod("alIsEnabled"); +// pfn_alGetString = bindMethod("alGetString"); +// pfn_alGetBooleanv = bindMethod("alGetBooleanv"); +// pfn_alGetIntegerv = bindMethod("alGetIntegerv"); +// pfn_alGetFloatv = bindMethod("alGetFloatv"); +// pfn_alGetDoublev = bindMethod("alGetDoublev"); +// pfn_alGetBoolean = bindMethod("alGetBoolean"); +// pfn_alGetInteger = bindMethod("alGetInteger"); +// pfn_alGetFloat = bindMethod("alGetFloat"); +// pfn_alGetDouble = bindMethod("alGetDouble"); +// pfn_alGetError = bindMethod("alGetError"); +// pfn_alIsExtensionPresent = bindMethod("alIsExtensionPresent"); +// pfn_alGetProcAddress = bindMethod("alGetProcAddress"); +// pfn_alGetEnumValue = bindMethod("alGetEnumValue"); +// pfn_alListenerf = bindMethod("alListenerf"); +// pfn_alListener3f = bindMethod("alListener3f"); +// pfn_alListenerfv = bindMethod("alListenerfv"); +// pfn_alListeneri = bindMethod("alListeneri"); +// pfn_alListener3i = bindMethod("alListener3i"); +// pfn_alListeneriv = bindMethod("alListeneriv"); +// pfn_alGetListenerf = bindMethod("alGetListenerf"); +// pfn_alGetListener3f = bindMethod("alGetListener3f"); +// pfn_alGetListenerfv = bindMethod("alGetListenerfv"); +// pfn_alGetListeneri = bindMethod("alGetListeneri"); +// pfn_alGetListener3i = bindMethod("alGetListener3i"); +// pfn_alGetListeneriv = bindMethod("alGetListeneriv"); +// pfn_alGenSources = bindMethod("alGenSources"); +// pfn_alDeleteSources = bindMethod("alDeleteSources"); +// pfn_alIsSource = bindMethod("alIsSource"); +// pfn_alSourcef = bindMethod("alSourcef"); +// pfn_alSource3f = bindMethod("alSource3f"); +// pfn_alSourcefv = bindMethod("alSourcefv"); +// pfn_alSourcei = bindMethod("alSourcei"); +// pfn_alSource3i = bindMethod("alSource3i"); +// pfn_alSourceiv = bindMethod("alSourceiv"); +// pfn_alGetSourcef = bindMethod("alGetSourcef"); +// pfn_alGetSource3f = bindMethod("alGetSource3f"); +// pfn_alGetSourcefv = bindMethod("alGetSourcefv"); +// pfn_alGetSourcei = bindMethod("alGetSourcei"); +// pfn_alGetSource3i = bindMethod("alGetSource3i"); +// pfn_alGetSourceiv = bindMethod("alGetSourceiv"); +// pfn_alSourcePlayv = bindMethod("alSourcePlayv"); +// pfn_alSourceStopv = bindMethod("alSourceStopv"); +// pfn_alSourceRewindv = bindMethod("alSourceRewindv"); +// pfn_alSourcePausev = bindMethod("alSourcePausev"); +// pfn_alSourcePlay = bindMethod("alSourcePlay"); +// pfn_alSourceStop = bindMethod("alSourceStop"); +// pfn_alSourceRewind = bindMethod("alSourceRewind"); +// pfn_alSourcePause = bindMethod("alSourcePause"); +// pfn_alSourceQueueBuffers = bindMethod("alSourceQueueBuffers"); +// pfn_alSourceUnqueueBuffers = bindMethod("alSourceUnqueueBuffers"); +// pfn_alGenBuffers = bindMethod("alGenBuffers"); +// pfn_alDeleteBuffers = bindMethod("alDeleteBuffers"); +// pfn_alIsBuffer = bindMethod("alIsBuffer"); +// pfn_alBufferData = bindMethod("alBufferData"); +// pfn_alBufferf = bindMethod("alBufferf"); +// pfn_alBuffer3f = bindMethod("alBuffer3f"); +// pfn_alBufferfv = bindMethod("alBufferfv"); +// pfn_alBufferi = bindMethod("alBufferi"); +// pfn_alBuffer3i = bindMethod("alBuffer3i"); +// pfn_alBufferiv = bindMethod("alBufferiv"); +// pfn_alGetBufferf = bindMethod("alGetBufferf"); +// pfn_alGetBuffer3f = bindMethod("alGetBuffer3f"); +// pfn_alGetBufferfv = bindMethod("alGetBufferfv"); +// pfn_alGetBufferi = bindMethod("alGetBufferi"); +// pfn_alGetBuffer3i = bindMethod("alGetBuffer3i"); +// pfn_alGetBufferiv = bindMethod("alGetBufferiv"); +// pfn_alDopplerFactor = bindMethod("alDopplerFactor"); +// pfn_alDopplerVelocity = bindMethod("alDopplerVelocity"); +// pfn_alSpeedOfSound = bindMethod("alSpeedOfSound"); +// pfn_alDistanceModel = bindMethod("alDistanceModel"); +// +// // AL/alc.h +// pfn_alcCreateContext = bindMethod("alcCreateContext"); +// pfn_alcMakeContextCurrent = bindMethod("alcMakeContextCurrent"); +// pfn_alcProcessContext = bindMethod("alcProcessContext"); +// pfn_alcSuspendContext = bindMethod("alcSuspendContext"); +// pfn_alcDestroyContext = bindMethod("alcDestroyContext"); +// pfn_alcGetCurrentContext = bindMethod("alcGetCurrentContext"); +// pfn_alcGetContextsDevice = bindMethod("alcGetContextsDevice"); +// pfn_alcOpenDevice = bindMethod("alcOpenDevice"); +// pfn_alcCloseDevice = bindMethod("alcCloseDevice"); +// pfn_alcGetError = bindMethod("alcGetError"); +// pfn_alcIsExtensionPresent = bindMethod("alcIsExtensionPresent"); +// pfn_alcGetProcAddress = bindMethod("alcGetProcAddress"); +// pfn_alcGetEnumValue = bindMethod("alcGetEnumValue"); +// pfn_alcGetString = bindMethod("alcGetString"); +// pfn_alcGetIntegerv = bindMethod("alcGetIntegerv"); +// pfn_alcCaptureOpenDevice = bindMethod("alcCaptureOpenDevice"); +// pfn_alcCaptureCloseDevice = bindMethod("alcCaptureCloseDevice"); +// pfn_alcCaptureStart = bindMethod("alcCaptureStart"); +// pfn_alcCaptureStop = bindMethod("alcCaptureStop"); +// pfn_alcCaptureSamples = bindMethod("alcCaptureSamples"); +// } +// +import "C" +import ( + "errors" + "strings" + "unsafe" +) +import "fmt" + +// AL/al.h constants (with AL_ removed). Refer to the original header for constant documentation. +const ( + FALSE = 0 + TRUE = 1 + NONE = 0 + NO_ERROR = 0 + SOURCE_RELATIVE = 0x202 + CONE_INNER_ANGLE = 0x1001 + CONE_OUTER_ANGLE = 0x1002 + PITCH = 0x1003 + POSITION = 0x1004 + DIRECTION = 0x1005 + VELOCITY = 0x1006 + LOOPING = 0x1007 + BUFFER = 0x1009 + GAIN = 0x100A + MIN_GAIN = 0x100D + MAX_GAIN = 0x100E + ORIENTATION = 0x100F + SOURCE_STATE = 0x1010 + INITIAL = 0x1011 + PLAYING = 0x1012 + PAUSED = 0x1013 + STOPPED = 0x1014 + BUFFERS_QUEUED = 0x1015 + BUFFERS_PROCESSED = 0x1016 + SEC_OFFSET = 0x1024 + SAMPLE_OFFSET = 0x1025 + BYTE_OFFSET = 0x1026 + SOURCE_TYPE = 0x1027 + STATIC = 0x1028 + STREAMING = 0x1029 + UNDETERMINED = 0x1030 + FORMAT_MONO8 = 0x1100 + FORMAT_MONO16 = 0x1101 + FORMAT_STEREO8 = 0x1102 + FORMAT_STEREO16 = 0x1103 + REFERENCE_DISTANCE = 0x1020 + ROLLOFF_FACTOR = 0x1021 + CONE_OUTER_GAIN = 0x1022 + MAX_DISTANCE = 0x1023 + FREQUENCY = 0x2001 + BITS = 0x2002 + CHANNELS = 0x2003 + SIZE = 0x2004 + UNUSED = 0x2010 + PENDING = 0x2011 + PROCESSED = 0x2012 + INVALID_NAME = 0xA001 + INVALID_ENUM = 0xA002 + INVALID_VALUE = 0xA003 + INVALID_OPERATION = 0xA004 + OUT_OF_MEMORY = 0xA005 + VENDOR = 0xB001 + VERSION = 0xB002 + RENDERER = 0xB003 + EXTENSIONS = 0xB004 + DOPPLER_FACTOR = 0xC000 + DOPPLER_VELOCITY = 0xC001 + SPEED_OF_SOUND = 0xC003 + DISTANCE_MODEL = 0xD000 + INVERSE_DISTANCE = 0xD001 + INVERSE_DISTANCE_CLAMPED = 0xD002 + LINEAR_DISTANCE = 0xD003 + LINEAR_DISTANCE_CLAMPED = 0xD004 + EXPONENT_DISTANCE = 0xD005 + EXPONENT_DISTANCE_CLAMPED = 0xD006 +) + +// AL/alc.h constants (with AL removed). Refer to the original header for constant documentation. +const ( + C_FALSE = 0 + C_TRUE = 1 + C_NO_ERROR = 0 + C_FREQUENCY = 0x1007 + C_REFRESH = 0x1008 + C_SYNC = 0x1009 + C_MONO_SOURCES = 0x1010 + C_STEREO_SOURCES = 0x1011 + C_INVALID_DEVICE = 0xA001 + C_INVALID_CONTEXT = 0xA002 + C_INVALID_ENUM = 0xA003 + C_INVALID_VALUE = 0xA004 + C_OUT_OF_MEMORY = 0xA005 + C_DEFAULT_DEVICE_SPECIFIER = 0x1004 + C_DEVICE_SPECIFIER = 0x1005 + C_EXTENSIONS = 0x1006 + C_MAJOR_VERSION = 0x1000 + C_MINOR_VERSION = 0x1001 + C_ATTRIBUTES_SIZE = 0x1002 + C_ALL_ATTRIBUTES = 0x1003 + C_CAPTURE_DEVICE_SPECIFIER = 0x310 + C_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311 + C_CAPTURE_SAMPLES = 0x312 +) + +var bInit = false +var bindError error + +// bind the methods to the function pointers +func Init() error { + if !bInit { + C.al_init() + bInit = true + ss := BindingReport() + estr := "" + for _, s := range ss { + if strings.Index(s, "[ ]") >= 0 { + estr += s + ";" + } + } + if estr != "" { + bindError = errors.New(estr) + } + } + return bindError +} + +func InitPath(path string) error { + if !bInit { + if path != "" { + cstr := C.CString(path) + defer C.free(unsafe.Pointer(cstr)) + C.setLibPath(cstr) + } + Init() + } + return bindError +} + +// Show which function pointers are bound [+] or not bound [-]. +// Expected to be used as a sanity check to see if the OpenAL libraries exist. +func BindingReport() (report []string) { + report = []string{} + + // AL/al.h + report = append(report, "AL") + report = append(report, isBound(unsafe.Pointer(C.pfn_alEnable), "alEnable")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alDisable), "alDisable")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alIsEnabled), "alIsEnabled")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetString), "alGetString")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetBooleanv), "alGetBooleanv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetIntegerv), "alGetIntegerv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetFloatv), "alGetFloatv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetDoublev), "alGetDoublev")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetBoolean), "alGetBoolean")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetInteger), "alGetInteger")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetFloat), "alGetFloat")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetDouble), "alGetDouble")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetError), "alGetError")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alIsExtensionPresent), "alIsExtensionPresent")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetProcAddress), "alGetProcAddress")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetEnumValue), "alGetEnumValue")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alListenerf), "alListenerf")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alListener3f), "alListener3f")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alListenerfv), "alListenerfv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alListeneri), "alListeneri")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alListener3i), "alListener3i")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alListeneriv), "alListeneriv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetListenerf), "alGetListenerf")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetListener3f), "alGetListener3f")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetListenerfv), "alGetListenerfv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetListeneri), "alGetListeneri")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetListener3i), "alGetListener3i")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetListeneriv), "alGetListeneriv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGenSources), "alGenSources")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alDeleteSources), "alDeleteSources")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alIsSource), "alIsSource")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourcef), "alSourcef")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSource3f), "alSource3f")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourcefv), "alSourcefv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourcei), "alSourcei")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSource3i), "alSource3i")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourceiv), "alSourceiv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetSourcef), "alGetSourcef")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetSource3f), "alGetSource3f")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetSourcefv), "alGetSourcefv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetSourcei), "alGetSourcei")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetSource3i), "alGetSource3i")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetSourceiv), "alGetSourceiv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourcePlayv), "alSourcePlayv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourceStopv), "alSourceStopv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourceRewindv), "alSourceRewindv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourcePausev), "alSourcePausev")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourcePlay), "alSourcePlay")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourceStop), "alSourceStop")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourceRewind), "alSourceRewind")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourcePause), "alSourcePause")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourceQueueBuffers), "alSourceQueueBuffers")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSourceUnqueueBuffers), "alSourceUnqueueBuffers")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGenBuffers), "alGenBuffers")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alDeleteBuffers), "alDeleteBuffers")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alIsBuffer), "alIsBuffer")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alBufferData), "alBufferData")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alBufferf), "alBufferf")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alBuffer3f), "alBuffer3f")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alBufferfv), "alBufferfv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alBufferi), "alBufferi")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alBuffer3i), "alBuffer3i")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alBufferiv), "alBufferiv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetBufferf), "alGetBufferf")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetBuffer3f), "alGetBuffer3f")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetBufferfv), "alGetBufferfv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetBufferi), "alGetBufferi")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetBuffer3i), "alGetBuffer3i")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alGetBufferiv), "alGetBufferiv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alDopplerFactor), "alDopplerFactor")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alDopplerVelocity), "alDopplerVelocity")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alSpeedOfSound), "alSpeedOfSound")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alDistanceModel), "alDistanceModel")) + + // AL/alc.h + report = append(report, "ALC") + report = append(report, isBound(unsafe.Pointer(C.pfn_alcCreateContext), "alcCreateContext")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcMakeContextCurrent), "alcMakeContextCurrent")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcProcessContext), "alcProcessContext")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcSuspendContext), "alcSuspendContext")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcDestroyContext), "alcDestroyContext")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcGetCurrentContext), "alcGetCurrentContext")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcGetContextsDevice), "alcGetContextsDevice")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcOpenDevice), "alcOpenDevice")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcCloseDevice), "alcCloseDevice")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcGetError), "alcGetError")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcIsExtensionPresent), "alcIsExtensionPresent")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcGetProcAddress), "alcGetProcAddress")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcGetEnumValue), "alcGetEnumValue")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcGetString), "alcGetString")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcGetIntegerv), "alcGetIntegerv")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcCaptureOpenDevice), "alcCaptureOpenDevice")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcCaptureCloseDevice), "alcCaptureCloseDevice")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcCaptureStart), "alcCaptureStart")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcCaptureStop), "alcCaptureStop")) + report = append(report, isBound(unsafe.Pointer(C.pfn_alcCaptureSamples), "alcCaptureSamples")) + return +} + +// isBound returns a string that indicates if the given function +// pointer is bound. +func isBound(pfn unsafe.Pointer, fn string) string { + inc := " " + if pfn != nil { + inc = "+" + } + return fmt.Sprintf(" [%s] %s", inc, fn) +} + +// al.h +// Enable enables a capability. +func Enable(capability int32) { + C.wrap_alEnable(C.ALenum(capability)) +} + +// Disable disables a capability. +func Disable(capability int32) { + C.wrap_alDisable(C.ALenum(capability)) +} + +// Enabled returns true if the specified capability is enabled. +func Enabled(capability int32) bool { + return C.wrap_alIsEnabled(C.ALenum(capability)) == 1 +} + +// Vector represents an vector in a Cartesian coordinate system. +type Vector [3]float32 + +// Orientation represents the angular position of an object in a +// right-handed Cartesian coordinate system. +// A cross product between the forward and up vector returns a vector +// that points to the right. +type Orientation struct { + // Forward vector is the direction that the object is looking at. + Forward Vector + // Up vector represents the rotation of the object. + Up Vector +} + +func orientationFromSlice(v []float32) Orientation { + return Orientation{ + Forward: Vector{v[0], v[1], v[2]}, + Up: Vector{v[3], v[4], v[5]}, + } +} + +func (v Orientation) slice() []float32 { + return []float32{v.Forward[0], v.Forward[1], v.Forward[2], v.Up[0], v.Up[1], v.Up[2]} +} + +func geti(param int) int32 { + return int32(C.wrap_alGetInteger(C.ALenum(param))) +} + +func getf(param int) float32 { + return float32(C.wrap_alGetFloat(C.ALenum(param))) +} + +func getString(param int) string { + v := C.wrap_alGetString(C.ALenum(param)) + return C.GoString((*C.char)(v)) +} + +// DistanceModel returns the distance model. +func DistanceModel() int32 { + return geti(paramDistanceModel) +} + +// SetDistanceModel sets the distance model. +func SetDistanceModel(v int32) { + C.wrap_alDistanceModel(C.ALenum(v)) +} + +// DopplerFactor returns the doppler factor. +func DopplerFactor() float32 { + return getf(paramDopplerFactor) +} + +// SetDopplerFactor sets the doppler factor. +func SetDopplerFactor(v float32) { + C.wrap_alDopplerFactor(C.ALfloat(v)) +} + +// DopplerVelocity returns the doppler velocity. +func DopplerVelocity() float32 { + return getf(paramDopplerVelocity) +} + +// SetDopplerVelocity sets the doppler velocity. +func SetDopplerVelocity(v float32) { + C.wrap_alDopplerVelocity(C.ALfloat(v)) +} + +// SpeedOfSound is the speed of sound in meters per second (m/s). +func SpeedOfSound() float32 { + return getf(paramSpeedOfSound) +} + +// SetSpeedOfSound sets the speed of sound, its unit should be meters per second (m/s). +func SetSpeedOfSound(v float32) { + C.wrap_alSpeedOfSound(C.ALfloat(v)) +} + +// Vendor returns the vendor. +func Vendor() string { + return getString(paramVendor) +} + +// Version returns the version string. +func Version() string { + return getString(paramVersion) +} + +// Renderer returns the renderer information. +func Renderer() string { + return getString(paramRenderer) +} + +// Extensions returns the enabled extensions. +func Extensions() string { + return getString(paramExtensions) +} + +// Error returns the most recently generated error. +func Error() int32 { + return int32(C.wrap_alGetError()) +} + +// Source represents an individual sound source in 3D-space. +// They take PCM data, apply modifications and then submit them to +// be mixed according to their spatial location. +type Source uint32 + +// GenSources generates n new sources. These sources should be deleted +// once they are not in use. +func GenSources(n int) []Source { + s := make([]Source, n) + C.wrap_alGenSources(C.ALsizei(n), (*C.ALuint)(unsafe.Pointer(&s[0]))) + return s +} + +// PlaySources plays the sources. +func PlaySources(source ...Source) { + C.wrap_alSourcePlayv(C.ALsizei(len(source)), (*C.ALuint)(unsafe.Pointer(&source[0]))) +} + +// PauseSources pauses the sources. +func PauseSources(source ...Source) { + C.wrap_alSourcePausev(C.ALsizei(len(source)), (*C.ALuint)(unsafe.Pointer(&source[0]))) +} + +// StopSources stops the sources. +func StopSources(source ...Source) { + C.wrap_alSourceStopv(C.ALsizei(len(source)), (*C.ALuint)(unsafe.Pointer(&source[0]))) +} + +// RewindSources rewinds the sources to their beginning positions. +func RewindSources(source ...Source) { + C.wrap_alSourceRewindv(C.ALsizei(len(source)), (*C.ALuint)(unsafe.Pointer(&source[0]))) +} + +// DeleteSources deletes the sources. +func DeleteSources(source ...Source) { + C.wrap_alDeleteSources(C.ALsizei(len(source)), (*C.ALuint)(unsafe.Pointer(&source[0]))) +} + +// Gain returns the source gain. +func (s Source) Gain() float32 { + return getSourcef(s, paramGain) +} + +// SetGain sets the source gain. +func (s Source) SetGain(v float32) { + setSourcef(s, paramGain, v) +} + +// MinGain returns the source's minimum gain setting. +func (s Source) MinGain() float32 { + return getSourcef(s, paramMinGain) +} + +// SetMinGain sets the source's minimum gain setting. +func (s Source) SetMinGain(v float32) { + setSourcef(s, paramMinGain, v) +} + +// MaxGain returns the source's maximum gain setting. +func (s Source) MaxGain() float32 { + return getSourcef(s, paramMaxGain) +} + +// SetMaxGain sets the source's maximum gain setting. +func (s Source) SetMaxGain(v float32) { + setSourcef(s, paramMaxGain, v) +} + +// Position returns the position of the source. +func (s Source) Position() Vector { + v := Vector{} + getSourcefv(s, paramPosition, v[:]) + return v +} + +// SetPosition sets the position of the source. +func (s Source) SetPosition(v Vector) { + setSourcefv(s, paramPosition, v[:]) +} + +// Velocity returns the source's velocity. +func (s Source) Velocity() Vector { + v := Vector{} + getSourcefv(s, paramVelocity, v[:]) + return v +} + +// SetVelocity sets the source's velocity. +func (s Source) SetVelocity(v Vector) { + setSourcefv(s, paramVelocity, v[:]) +} + +// Orientation returns the orientation of the source. +func (s Source) Orientation() Orientation { + v := make([]float32, 6) + getSourcefv(s, paramOrientation, v) + return orientationFromSlice(v) +} + +// SetOrientation sets the orientation of the source. +func (s Source) SetOrientation(o Orientation) { + setSourcefv(s, paramOrientation, o.slice()) +} + +// State returns the playing state of the source. +func (s Source) State() int32 { + return getSourcei(s, paramSourceState) +} + +// BuffersQueued returns the number of the queued buffers. +func (s Source) BuffersQueued() int32 { + return getSourcei(s, paramBuffersQueued) +} + +// BuffersProcessed returns the number of the processed buffers. +func (s Source) BuffersProcessed() int32 { + return getSourcei(s, paramBuffersProcessed) +} + +// OffsetSeconds returns the current playback position of the source in seconds. +func (s Source) OffsetSeconds() int32 { + return getSourcei(s, paramSecOffset) +} + +// OffsetSample returns the sample offset of the current playback position. +func (s Source) OffsetSample() int32 { + return getSourcei(s, paramSampleOffset) +} + +// OffsetByte returns the byte offset of the current playback position. +func (s Source) OffsetByte() int32 { + return getSourcei(s, paramByteOffset) +} + +func getSourcei(s Source, param int) int32 { + var v C.ALint + C.wrap_alGetSourcei(C.ALuint(s), C.ALenum(param), &v) + return int32(v) +} + +func getSourcef(s Source, param int) float32 { + var v C.ALfloat + C.wrap_alGetSourcef(C.ALuint(s), C.ALenum(param), &v) + return float32(v) +} + +func getSourcefv(s Source, param int, v []float32) { + C.wrap_alGetSourcefv(C.ALuint(s), C.ALenum(param), (*C.ALfloat)(unsafe.Pointer(&v[0]))) +} + +func setSourcei(s Source, param int, v int32) { + C.wrap_alSourcei(C.ALuint(s), C.ALenum(param), C.ALint(v)) +} + +func setSourcef(s Source, param int, v float32) { + C.wrap_alSourcef(C.ALuint(s), C.ALenum(param), C.ALfloat(v)) +} + +func setSourcefv(s Source, param int, v []float32) { + C.wrap_alSourcefv(C.ALuint(s), C.ALenum(param), (*C.ALfloat)(unsafe.Pointer(&v[0]))) +} + +// QueueBuffers adds the buffers to the buffer queue. +func (s Source) QueueBuffers(buffers []Buffer) { + C.wrap_alSourceQueueBuffers(C.ALuint(s), C.ALsizei(len(buffers)), (*C.ALuint)(unsafe.Pointer(&buffers[0]))) +} + +// UnqueueBuffers removes the specified buffers from the buffer queue. +func (s Source) UnqueueBuffers(buffers []Buffer) { + C.wrap_alSourceUnqueueBuffers(C.ALuint(s), C.ALsizei(len(buffers)), (*C.ALuint)(unsafe.Pointer(&buffers[0]))) +} + +// ListenerGain returns the total gain applied to the final mix. +func ListenerGain() float32 { + return getListenerf(paramGain) +} + +// ListenerPosition returns the position of the listener. +func ListenerPosition() Vector { + v := Vector{} + getListenerfv(paramPosition, v[:]) + return v +} + +// ListenerVelocity returns the velocity of the listener. +func ListenerVelocity() Vector { + v := Vector{} + getListenerfv(paramVelocity, v[:]) + return v +} + +// ListenerOrientation returns the orientation of the listener. +func ListenerOrientation() Orientation { + v := make([]float32, 6) + getListenerfv(paramOrientation, v) + return orientationFromSlice(v) +} + +// SetListenerGain sets the total gain that will be applied to the final mix. +func SetListenerGain(v float32) { + setListenerf(paramGain, v) +} + +// SetListenerPosition sets the position of the listener. +func SetListenerPosition(v Vector) { + setListenerfv(paramPosition, v[:]) +} + +// SetListenerVelocity sets the velocity of the listener. +func SetListenerVelocity(v Vector) { + setListenerfv(paramVelocity, v[:]) +} + +// SetListenerOrientation sets the orientation of the listener. +func SetListenerOrientation(v Orientation) { + setListenerfv(paramOrientation, v.slice()) +} + +func getListenerf(param int) float32 { + var v C.ALfloat + C.wrap_alGetListenerf(C.ALenum(param), &v) + return float32(v) +} + +func getListenerfv(param int, v []float32) { + C.wrap_alGetListenerfv(C.ALenum(param), (*C.ALfloat)(unsafe.Pointer(&v[0]))) +} + +func setListenerf(param int, v float32) { + C.wrap_alListenerf(C.ALenum(param), C.ALfloat(v)) +} + +func setListenerfv(param int, v []float32) { + C.wrap_alListenerfv(C.ALenum(param), (*C.ALfloat)(unsafe.Pointer(&v[0]))) +} + +// A buffer represents a chunk of PCM audio data that could be buffered to an audio +// source. A single buffer could be shared between multiple sources. +type Buffer uint32 + +// GenBuffers generates n new buffers. The generated buffers should be deleted +// once they are no longer in use. +func GenBuffers(n int) []Buffer { + s := make([]Buffer, n) + C.wrap_alGenBuffers(C.ALsizei(n), (*C.ALuint)(unsafe.Pointer(&s[0]))) + return s +} + +// DeleteBuffers deletes the buffers. +func DeleteBuffers(buffers []Buffer) { + C.wrap_alDeleteBuffers(C.ALsizei(len(buffers)), (*C.ALuint)(unsafe.Pointer(&buffers[0]))) +} + +func getBufferi(b Buffer, param int) int32 { + var v C.ALint + C.wrap_alGetBufferi(C.ALuint(b), C.ALenum(param), &v) + return int32(v) +} + +// Frequency returns the frequency of the buffer data in Hertz (Hz). +func (b Buffer) Frequency() int32 { + return getBufferi(b, paramFreq) +} + +// Bits return the number of bits used to represent a sample. +func (b Buffer) Bits() int32 { + return getBufferi(b, paramBits) +} + +// Channels return the number of the audio channels. +func (b Buffer) Channels() int32 { + return getBufferi(b, paramChannels) +} + +// Size returns the size of the data. +func (b Buffer) Size() int32 { + return getBufferi(b, paramSize) +} + +// BufferData buffers PCM data to the current buffer. +func (b Buffer) BufferData(format uint32, data []byte, freq int32) { + C.wrap_alBufferData(C.ALuint(b), C.ALenum(format), unsafe.Pointer(&data[0]), C.ALsizei(len(data)), C.ALsizei(freq)) +} + +// Valid returns true if the buffer exists and is valid. +func (b Buffer) Valid() bool { + return C.wrap_alIsBuffer(C.ALuint(b)) == 1 +} + +// alc.h +// Device represents an audio device. +type Device struct { + d C.uintptr_t +} + +// Error returns the last known error from the current device. +func (d *Device) Error() int32 { + return int32(C.wrap_alcGetError(d.d)) +} + +// Context represents a context created in the OpenAL layer. A valid current +// context is required to run OpenAL functions. +// The returned context will be available process-wide if it's made the +// current by calling MakeContextCurrent. +type Context struct { + c C.uintptr_t +} + +// Open opens a new device in the OpenAL layer. +func Open(name string) *Device { + if Init() != nil { + return nil + } + var n *C.char + if name != "" { + n = C.CString(name) + defer C.free(unsafe.Pointer(n)) + } + d := C.wrap_alcOpenDevice((*C.ALCchar)(unsafe.Pointer(n))) + if d == 0 { + return nil + } + return &Device{d: d} +} + +// Close closes the device. +func (d *Device) Close() bool { + return C.wrap_alcCloseDevice(d.d) != 0 +} + +// CreateContext creates a new context. +func (d *Device) CreateContext(attrs []int32) *Context { + // TODO(jbd): Handle attributes. + c := C.wrap_alcCreateContext(d.d, nil) + if c == 0 { + return nil + } + return &Context{c: c} +} + +// MakeContextCurrent makes a context current process-wide. +func (c *Context) MakeCurrent() bool { + return C.wrap_alcMakeContextCurrent(c.c) != 0 +} + +func (context Context) Process() { + C.wrap_alcProcessContext(context.c) +} + +func (context Context) Suspend() { + C.wrap_alcSuspendContext(context.c) +} + +func (context Context) Destroy() { + C.wrap_alcDestroyContext(context.c) +} + +func GetCurrentContext() *Context { + c := C.wrap_alcGetCurrentContext() + if c == 0 { + return nil + } + return &Context{c: c} +} + +func (context Context) GetDevice() *Device { + d := C.wrap_alcGetContextsDevice(context.c) + if d == 0 { + return nil + } + return &Device{d: d} +} + +func (d *Device) GetEnumValue(enumname string) int { + cenumname := C.CString(enumname) + defer C.free(unsafe.Pointer(cenumname)) + return int(C.wrap_alcGetEnumValue(d.d, cenumname)) +} + +func (d *Device) GetString(param int) string { + return C.GoString(C.wrap_alcGetString(d.d, C.ALCenum(param))) +} + +func (d *Device) GetIntegerv(param int, size int64, values *int32) { + C.wrap_alcGetIntegerv(d.d, C.ALCenum(param), C.ALCsizei(size), (*C.ALCint)(unsafe.Pointer(values))) +} + +// Capture device +type CaptureDevice struct { + Device +} + +// Open opens a new capture device in the OpenAL layer. +func CaptureOpen(name string, frequency uint, format int, buffersize int64) *CaptureDevice { + if Init() != nil { + return nil + } + var n *C.char + if name != "" { + n = C.CString(name) + defer C.free(unsafe.Pointer(n)) + } + d := C.wrap_alcCaptureOpenDevice((*C.ALCchar)(unsafe.Pointer(n)), + C.ALCuint(frequency), C.ALCenum(format), C.ALCsizei(buffersize)) + if d == 0 { + return nil + } + return &CaptureDevice{Device: Device{d: d}} +} + +// Close closes the capture device. +func (d *CaptureDevice) Close() bool { + return C.wrap_alcCaptureCloseDevice(d.d) != 0 +} + +func (dev *CaptureDevice) Start() { + C.wrap_alcCaptureStart(dev.d) +} + +func (dev *CaptureDevice) Stop() { + C.wrap_alcCaptureStop(dev.d) +} + +func (dev *CaptureDevice) Samples(bs []byte, samples int64) { + C.wrap_alcCaptureSamples(dev.d, unsafe.Pointer(&bs[0]), C.ALCsizei(samples)) +} diff --git a/audio/al/const.go b/audio/al/const.go new file mode 100644 index 0000000..6de4691 --- /dev/null +++ b/audio/al/const.go @@ -0,0 +1,76 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package al + +// Error returns one of these error codes. +const ( + InvalidName = 0xA001 + InvalidEnum = 0xA002 + InvalidValue = 0xA003 + InvalidOperation = 0xA004 + OutOfMemory = 0xA005 +) + +// Distance models. +const ( + InverseDistance = 0xD001 + InverseDistanceClamped = 0xD002 + LinearDistance = 0xD003 + LinearDistanceClamped = 0xD004 + ExponentDistance = 0xD005 + ExponentDistanceClamped = 0xD006 +) + +// Global parameters. +const ( + paramDistanceModel = 0xD000 + paramDopplerFactor = 0xC000 + paramDopplerVelocity = 0xC001 + paramSpeedOfSound = 0xC003 + paramVendor = 0xB001 + paramVersion = 0xB002 + paramRenderer = 0xB003 + paramExtensions = 0xB004 +) + +// Source and listener parameters. +const ( + paramGain = 0x100A + paramPosition = 0x1004 + paramVelocity = 0x1006 + paramOrientation = 0x100F + paramMinGain = 0x100D + paramMaxGain = 0x100E + paramSourceState = 0x1010 + paramBuffersQueued = 0x1015 + paramBuffersProcessed = 0x1016 + paramSecOffset = 0x1024 + paramSampleOffset = 0x1025 + paramByteOffset = 0x1026 +) + +// A source could be in the state of initial, playing, paused or stopped. +const ( + Initial = 0x1011 + Playing = 0x1012 + Paused = 0x1013 + Stopped = 0x1014 +) + +// Buffer parameters. +const ( + paramFreq = 0x2001 + paramBits = 0x2002 + paramChannels = 0x2003 + paramSize = 0x2004 +) + +// Audio formats. Buffer.BufferData accepts one of these formats as the data format. +const ( + FormatMono8 = 0x1100 + FormatMono16 = 0x1101 + FormatStereo8 = 0x1102 + FormatStereo16 = 0x1103 +) diff --git a/audio/alc/alc.go b/audio/alc/alc.go new file mode 100644 index 0000000..9efb909 --- /dev/null +++ b/audio/alc/alc.go @@ -0,0 +1,66 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package alc provides OpenAL's ALC (Audio Library Context) bindings for Go. +package alc + +import ( + "fmt" + + "github.com/xaionaro-go/ndk/audio/al" +) + +// Error returns one of these values. +const ( + InvalidDevice = 0xA001 + InvalidContext = 0xA002 + InvalidEnum = 0xA003 + InvalidValue = 0xA004 + OutOfMemory = 0xA005 + + CaptureSamples = 0x312 +) + +// Device represents an audio device. +type Device = al.Device + +// Context represents a context created in the OpenAL layer. A valid current +// context is required to run OpenAL functions. +// The returned context will be available process-wide if it's made the +// current by calling MakeContextCurrent. +type Context = al.Context + +// Open opens a new device in the OpenAL layer. +func Open(name string) *Device { + return al.Open(name) +} + +// GetCurrentContext get current context. +func GetCurrentContext() *Context { + return al.GetCurrentContext() +} + +type CaptureDevice = al.CaptureDevice + +func CaptureOpen(name string, frequency uint, format int, buffersize int64) *CaptureDevice { + return al.CaptureOpen(name, frequency, format, buffersize) +} + +func Error(e int32) string { + switch e { + case 0: + return "" + case InvalidDevice: + return "Invalid device" + case InvalidContext: + return "Invalid context" + case InvalidEnum: + return "Invalid enum" + case InvalidValue: + return "Invalid value" + case OutOfMemory: + return "Out of memory" + } + return fmt.Sprintf("unknow error(%d)", e) +} diff --git a/audio/audio.go b/audio/audio.go index c64d2bd..e0b1d6b 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -1,24 +1,297 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Package audio provides a basic audio player. package audio -type AUDIO int32 +import ( + "fmt" + "io" + "sync" + "time" + + "github.com/xaionaro-go/ndk/audio/al" + "github.com/xaionaro-go/ndk/audio/alc" +) + +// Format represents an audio file format. +type Format int + +const ( + Mono8 = al.FormatMono8 + Mono16 = al.FormatMono16 + Stereo8 = al.FormatStereo8 + Stereo16 = al.FormatStereo16 +) + +// State indicates the current playing state of the player. +type State string const ( - AAUDIO_USAGE_MEDIA AUDIO = 1 - AAUDIO_USAGE_VOICE_COMMUNICATION AUDIO = 2 - AAUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING AUDIO = 3 - AAUDIO_USAGE_ALARM AUDIO = 4 - AAUDIO_USAGE_NOTIFICATION AUDIO = 5 - AAUDIO_USAGE_NOTIFICATION_RINGTONE AUDIO = 6 - AAUDIO_USAGE_NOTIFICATION_EVENT AUDIO = 10 - AAUDIO_USAGE_ASSISTANCE_ACCESSIBILITY AUDIO = 11 - AAUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE AUDIO = 12 - AAUDIO_USAGE_ASSISTANCE_SONIFICATION AUDIO = 13 - AAUDIO_USAGE_GAME AUDIO = 14 - AAUDIO_USAGE_ASSISTANT AUDIO = 16 - AAUDIO_SYSTEM_USAGE_EMERGENCY AUDIO = 1000 - AAUDIO_SYSTEM_USAGE_SAFETY AUDIO = 1001 - AAUDIO_SYSTEM_USAGE_VEHICLE_STATUS AUDIO = 1002 - AAUDIO_SYSTEM_USAGE_ANNOUNCEMENT AUDIO = 1003 + Unknown = State("unknown") + Initial = State("initial") + Playing = State("playing") + Paused = State("paused") + Stopped = State("stopped") ) + +var codeToState = map[int32]State{ + 0: Unknown, + 0x1011: Initial, + 0x1012: Playing, + 0x1013: Paused, + 0x1014: Stopped, +} + +var device struct { + sync.Mutex + d *alc.Device + ref uint +} + +type track struct { + format Format + rate int64 // sample rate + src io.ReadSeeker +} + +// Player is a basic audio player that plays PCM data. +// Operations on a nil *Player are no-op, a nil *Player can +// be used for testing purposes. +type Player struct { + t *track + source al.Source + + muPrep sync.Mutex // guards prep and bufs + prep bool + bufs []al.Buffer + size int64 // size of the audio source +} + +// NewPlayer returns a new Player. +// It initializes the underlying audio devices and the related resources. +func NewPlayer(src io.ReadSeeker, format Format, sampleRate int64) (*Player, error) { + device.Lock() + defer device.Unlock() + + if device.d == nil { + device.d = alc.Open("") + if device.d != nil { + c := device.d.CreateContext(nil) + if !c.MakeCurrent() { + err := alc.Error(device.d.Error()) + device.d.Close() + return nil, fmt.Errorf("player: cannot initiate a new player: %s", err) + } + } else { + return nil, fmt.Errorf("player: cannot initiate a new player") + } + } + device.ref++ + + s := al.GenSources(1) + if code := al.Error(); code != 0 { + return nil, fmt.Errorf("player: cannot generate an audio source [err=%x]", code) + } + return &Player{ + t: &track{format: format, src: src, rate: sampleRate}, + source: s[0], + }, nil +} + +func (p *Player) prepare(offset int64, force bool) error { + p.muPrep.Lock() + defer p.muPrep.Unlock() + if !force && p.prep { + return nil + } + if len(p.bufs) > 0 { + p.source.UnqueueBuffers(p.bufs) + al.DeleteBuffers(p.bufs) + p.bufs = []al.Buffer{} + } + if _, err := p.t.src.Seek(offset, 0); err != nil { + return err + } + // TODO(jbd): Limit the number of buffers in use, unqueue and reuse + // the existing buffers as buffers are processed. + buf := make([]byte, 128*1024) + size := offset + for { + n, err := p.t.src.Read(buf) + if n > 0 { + size += int64(n) + b := al.GenBuffers(1) + b[0].BufferData(uint32(p.t.format), buf[:n], int32(p.t.rate)) + p.bufs = append(p.bufs, b[0]) + } + if err == io.EOF { + break + } + if err != nil { + return err + } + } + p.size = size + if len(p.bufs) > 0 { + p.source.QueueBuffers(p.bufs) + } + p.prep = true + return nil +} + +// Play buffers the source audio to the audio device and starts +// to play the source. +// If the player paused or stopped, it reuses the previously buffered +// resources to keep playing from the time it has paused or stopped. +func (p *Player) Play() error { + if p == nil { + return nil + } + // Prepares if the track hasn't been buffered before. + if err := p.prepare(0, false); err != nil { + return err + } + al.PlaySources(p.source) + return lastErr() +} + +// Pause pauses the player. +func (p *Player) Pause() error { + if p == nil { + return nil + } + al.PauseSources(p.source) + return lastErr() +} + +// Stop stops the player. +func (p *Player) Stop() error { + if p == nil { + return nil + } + al.StopSources(p.source) + return lastErr() +} + +// Seek moves the play head to the given offset relative to the start of the source. +func (p *Player) Seek(offset time.Duration) error { + if p == nil { + return nil + } + if err := p.Stop(); err != nil { + return err + } + size := durToByteOffset(p.t, offset) + if err := p.prepare(size, true); err != nil { + return err + } + al.PlaySources(p.source) + return lastErr() +} + +// Current returns the current playback position of the audio that is being played. +func (p *Player) Current() time.Duration { + if p == nil { + return time.Duration(0) + } + // TODO(jbd): Current never returns the Total when the playing is finished. + // OpenAL may be returning the last buffer's start point as an OffsetByte. + return byteOffsetToDur(p.t, int64(p.source.OffsetByte())) +} + +// Total returns the total duration of the audio source. +func (p *Player) Total() time.Duration { + if p == nil { + return 0 + } + // Prepare is required to determine the length of the source. + // We need to read the entire source to calculate the length. + p.prepare(0, false) + return byteOffsetToDur(p.t, p.size) +} + +// Volume returns the current player volume. The range of the volume is [0, 1]. +func (p *Player) Volume() float64 { + if p == nil { + return 0 + } + return float64(p.source.Gain()) +} + +// SetVolume sets the volume of the player. The range of the volume is [0, 1]. +func (p *Player) SetVolume(vol float64) { + if p == nil { + return + } + p.source.SetGain(float32(vol)) +} + +// State returns the player's current state. +func (p *Player) State() State { + if p == nil { + return Unknown + } + return codeToState[p.source.State()] +} + +// Destroy frees the underlying resources used by the player. +// It should be called as soon as the player is not in-use anymore. +func (p *Player) Destroy() { + if p == nil { + return + } + p.muPrep.Lock() + if len(p.bufs) > 0 { + p.source.UnqueueBuffers(p.bufs) + al.DeleteBuffers(p.bufs) + p.bufs = nil + } + if p.source != 0 { + al.DeleteSources(p.source) + p.source = 0 + } + device.ref-- + if device.ref == 0 { + device.d.Close() + device.d = nil + } + p.muPrep.Unlock() + lastErr() +} + +func byteOffsetToDur(t *track, offset int64) time.Duration { + size := float64(offset) + if t.format == Mono16 || t.format == Stereo16 { + size /= 2 + } + if t.format == Stereo8 || t.format == Stereo16 { + size /= 2 + } + size /= float64(t.rate) + // Casting size back to int64. Work in milliseconds, + // so that size doesn't get rounded excessively. + return time.Duration(size*1000) * time.Duration(time.Millisecond) +} + +func durToByteOffset(t *track, dur time.Duration) int64 { + size := int64(dur/time.Second) * t.rate + // Each sample is represented by 16-bits. Move twice further. + if t.format == Mono16 || t.format == Stereo16 { + size *= 2 + } + if t.format == Stereo8 || t.format == Stereo16 { + size *= 2 + } + return size +} + +// lastErr returns the last error or nil if the last operation +// has been succesful. +func lastErr() error { + if code := al.Error(); code != 0 { + return fmt.Errorf("audio: openal failed with %x", code) + } + return nil +} diff --git a/audio/audio_allow_capture_by.go b/audio/audio_allow_capture_by.go deleted file mode 100644 index 0919851..0000000 --- a/audio/audio_allow_capture_by.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_ALLOW_CAPTURE_BY int32 - -const ( - AAUDIO_ALLOW_CAPTURE_BY_ALL AUDIO_ALLOW_CAPTURE_BY = 1 - AAUDIO_ALLOW_CAPTURE_BY_SYSTEM AUDIO_ALLOW_CAPTURE_BY = 2 - AAUDIO_ALLOW_CAPTURE_BY_NONE AUDIO_ALLOW_CAPTURE_BY = 3 -) diff --git a/audio/audio_callback_result.go b/audio/audio_callback_result.go deleted file mode 100644 index a8262c3..0000000 --- a/audio/audio_callback_result.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_CALLBACK_RESULT int32 - -const ( - AAUDIO_CALLBACK_RESULT_CONTINUE AUDIO_CALLBACK_RESULT = 0 - AAUDIO_CALLBACK_RESULT_STOP AUDIO_CALLBACK_RESULT = 1 -) diff --git a/audio/audio_channel.go b/audio/audio_channel.go deleted file mode 100644 index 6bad859..0000000 --- a/audio/audio_channel.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_CHANNEL int32 - -const ( - AAUDIO_CHANNEL_INVALID AUDIO_CHANNEL = -1 - AAUDIO_CHANNEL_FRONT_LEFT AUDIO_CHANNEL = 1 - AAUDIO_CHANNEL_FRONT_RIGHT AUDIO_CHANNEL = 2 - AAUDIO_CHANNEL_FRONT_CENTER AUDIO_CHANNEL = 4 - AAUDIO_CHANNEL_LOW_FREQUENCY AUDIO_CHANNEL = 8 - AAUDIO_CHANNEL_BACK_LEFT AUDIO_CHANNEL = 16 - AAUDIO_CHANNEL_BACK_RIGHT AUDIO_CHANNEL = 32 - AAUDIO_CHANNEL_FRONT_LEFT_OF_CENTER AUDIO_CHANNEL = 64 - AAUDIO_CHANNEL_FRONT_RIGHT_OF_CENTER AUDIO_CHANNEL = 128 - AAUDIO_CHANNEL_BACK_CENTER AUDIO_CHANNEL = 256 - AAUDIO_CHANNEL_SIDE_LEFT AUDIO_CHANNEL = 512 - AAUDIO_CHANNEL_SIDE_RIGHT AUDIO_CHANNEL = 1024 - AAUDIO_CHANNEL_TOP_CENTER AUDIO_CHANNEL = 2048 - AAUDIO_CHANNEL_TOP_FRONT_LEFT AUDIO_CHANNEL = 4096 - AAUDIO_CHANNEL_TOP_FRONT_CENTER AUDIO_CHANNEL = 8192 - AAUDIO_CHANNEL_TOP_FRONT_RIGHT AUDIO_CHANNEL = 16384 - AAUDIO_CHANNEL_TOP_BACK_LEFT AUDIO_CHANNEL = 32768 - AAUDIO_CHANNEL_TOP_BACK_CENTER AUDIO_CHANNEL = 65536 - AAUDIO_CHANNEL_TOP_BACK_RIGHT AUDIO_CHANNEL = 131072 - AAUDIO_CHANNEL_TOP_SIDE_LEFT AUDIO_CHANNEL = 262144 - AAUDIO_CHANNEL_TOP_SIDE_RIGHT AUDIO_CHANNEL = 524288 - AAUDIO_CHANNEL_BOTTOM_FRONT_LEFT AUDIO_CHANNEL = 1048576 - AAUDIO_CHANNEL_BOTTOM_FRONT_CENTER AUDIO_CHANNEL = 2097152 - AAUDIO_CHANNEL_BOTTOM_FRONT_RIGHT AUDIO_CHANNEL = 4194304 - AAUDIO_CHANNEL_LOW_FREQUENCY_2 AUDIO_CHANNEL = 8388608 - AAUDIO_CHANNEL_FRONT_WIDE_LEFT AUDIO_CHANNEL = 16777216 - AAUDIO_CHANNEL_FRONT_WIDE_RIGHT AUDIO_CHANNEL = 33554432 - AAUDIO_CHANNEL_MONO AUDIO_CHANNEL = 1 - AAUDIO_CHANNEL_STEREO AUDIO_CHANNEL = 3 - AAUDIO_CHANNEL_2POINT1 AUDIO_CHANNEL = 11 - AAUDIO_CHANNEL_TRI AUDIO_CHANNEL = 7 - AAUDIO_CHANNEL_TRI_BACK AUDIO_CHANNEL = 259 - AAUDIO_CHANNEL_3POINT1 AUDIO_CHANNEL = 15 - AAUDIO_CHANNEL_2POINT0POINT2 AUDIO_CHANNEL = 786435 - AAUDIO_CHANNEL_2POINT1POINT2 AUDIO_CHANNEL = 786443 - AAUDIO_CHANNEL_3POINT0POINT2 AUDIO_CHANNEL = 786439 - AAUDIO_CHANNEL_3POINT1POINT2 AUDIO_CHANNEL = 786447 - AAUDIO_CHANNEL_QUAD AUDIO_CHANNEL = 51 - AAUDIO_CHANNEL_QUAD_SIDE AUDIO_CHANNEL = 1539 - AAUDIO_CHANNEL_SURROUND AUDIO_CHANNEL = 263 - AAUDIO_CHANNEL_PENTA AUDIO_CHANNEL = 55 - AAUDIO_CHANNEL_5POINT1 AUDIO_CHANNEL = 63 - AAUDIO_CHANNEL_5POINT1_SIDE AUDIO_CHANNEL = 1551 - AAUDIO_CHANNEL_6POINT1 AUDIO_CHANNEL = 319 - AAUDIO_CHANNEL_7POINT1 AUDIO_CHANNEL = 1599 - AAUDIO_CHANNEL_5POINT1POINT2 AUDIO_CHANNEL = 786495 - AAUDIO_CHANNEL_5POINT1POINT4 AUDIO_CHANNEL = 184383 - AAUDIO_CHANNEL_7POINT1POINT2 AUDIO_CHANNEL = 788031 - AAUDIO_CHANNEL_7POINT1POINT4 AUDIO_CHANNEL = 185919 - AAUDIO_CHANNEL_9POINT1POINT4 AUDIO_CHANNEL = 50517567 - AAUDIO_CHANNEL_9POINT1POINT6 AUDIO_CHANNEL = 51303999 - AAUDIO_CHANNEL_FRONT_BACK AUDIO_CHANNEL = 260 -) diff --git a/audio/audio_content_type.go b/audio/audio_content_type.go deleted file mode 100644 index 7b370c9..0000000 --- a/audio/audio_content_type.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_CONTENT_TYPE int32 - -const ( - AAUDIO_CONTENT_TYPE_SPEECH AUDIO_CONTENT_TYPE = 1 - AAUDIO_CONTENT_TYPE_MUSIC AUDIO_CONTENT_TYPE = 2 - AAUDIO_CONTENT_TYPE_MOVIE AUDIO_CONTENT_TYPE = 3 - AAUDIO_CONTENT_TYPE_SONIFICATION AUDIO_CONTENT_TYPE = 4 -) diff --git a/audio/audio_direction.go b/audio/audio_direction.go deleted file mode 100644 index e8d6b40..0000000 --- a/audio/audio_direction.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_DIRECTION int32 - -const ( - AAUDIO_DIRECTION_OUTPUT AUDIO_DIRECTION = 0 - AAUDIO_DIRECTION_INPUT AUDIO_DIRECTION = 1 -) diff --git a/audio/audio_file.go b/audio/audio_file.go new file mode 100644 index 0000000..7995b2e --- /dev/null +++ b/audio/audio_file.go @@ -0,0 +1,107 @@ +// Copyright 2016 The G3N Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package audio + +import ( + "fmt" + "io" + "os" +) + +type AudioInfo struct { + Format int // OpenAl Format + Channels int // Number of channels + SampleRate int // Sample rate in hz + BitsSample int // Number of bits per sample (8 or 16) + DataSize int // Total data size in bytes + BytesSec int // Bytes per second + TotalTime float64 // Total time in seconds +} + +type AudioFile struct { + AudioStream + loops int // replay times +} + +type AudioStream interface { + io.ReadSeeker + Close() error + CurrentTime() float64 + Info() AudioInfo +} + +// NewAudioFile creates and returns a pointer to a new audio file object and an error +func NewAudioFile(filename string) (*AudioFile, error) { + + // Checks if file exists + _, err := os.Stat(filename) + if err != nil { + return nil, err + } + fin, err := os.Open(filename) + if err != nil { + return nil, err + } + + return NewAudio(fin) +} + +func NewAudio(in io.ReadSeeker) (*AudioFile, error) { + af := new(AudioFile) + + // Try to open as a wave file + wav, err := openWave(in) + if err == nil { + af.AudioStream = wav + return af, nil + } + + in.Seek(0, os.SEEK_SET) + return nil, fmt.Errorf("Unsuported file type") +} + +// Close closes the audiofile +func (af *AudioFile) Close() error { + return af.AudioStream.Close() +} + +// Read reads decoded data from the audio file +func (af *AudioFile) Read(bs []byte) (int, error) { + nbytes := len(bs) + n, err := af.AudioStream.Read(bs) + if err != nil { + return 0, err + } + if n == nbytes { + return n, nil + } + if af.loops == 0 { + return n, nil + } + af.loops-- + // EOF reached. Position file at the beginning + _, err = af.AudioStream.Seek(0, os.SEEK_SET) + if err != nil { + return 0, nil + } + // Reads next data into the remaining buffer space + n2, err := af.AudioStream.Read(bs[n:]) + if err != nil { + return 0, err + } + return n + n2, err +} + +// Looping returns the current looping state of this audio file +func (af *AudioFile) Looping() bool { + + return af.loops > 0 +} + +// SetLooping sets the looping state of this audio file +func (af *AudioFile) SetLooping(loops int) { + + af.loops = loops +} diff --git a/audio/audio_format.go b/audio/audio_format.go deleted file mode 100644 index 377e1d6..0000000 --- a/audio/audio_format.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_FORMAT int32 - -const ( - AAUDIO_FORMAT_INVALID AUDIO_FORMAT = -1 - AAUDIO_FORMAT_UNSPECIFIED AUDIO_FORMAT = 0 - AAUDIO_FORMAT_PCM_I16 AUDIO_FORMAT = 1 - AAUDIO_FORMAT_PCM_FLOAT AUDIO_FORMAT = 2 - AAUDIO_FORMAT_PCM_I24_PACKED AUDIO_FORMAT = 3 - AAUDIO_FORMAT_PCM_I32 AUDIO_FORMAT = 4 - AAUDIO_FORMAT_IEC61937 AUDIO_FORMAT = 5 -) diff --git a/audio/audio_input_preset.go b/audio/audio_input_preset.go deleted file mode 100644 index 5b102a8..0000000 --- a/audio/audio_input_preset.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_INPUT_PRESET int32 - -const ( - AAUDIO_INPUT_PRESET_GENERIC AUDIO_INPUT_PRESET = 1 - AAUDIO_INPUT_PRESET_CAMCORDER AUDIO_INPUT_PRESET = 5 - AAUDIO_INPUT_PRESET_VOICE_RECOGNITION AUDIO_INPUT_PRESET = 6 - AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION AUDIO_INPUT_PRESET = 7 - AAUDIO_INPUT_PRESET_UNPROCESSED AUDIO_INPUT_PRESET = 9 - AAUDIO_INPUT_PRESET_VOICE_PERFORMANCE AUDIO_INPUT_PRESET = 10 - AAUDIO_INPUT_PRESET_SYSTEM_ECHO_REFERENCE AUDIO_INPUT_PRESET = 1997 - AAUDIO_INPUT_PRESET_SYSTEM_HOTWORD AUDIO_INPUT_PRESET = 1999 -) diff --git a/audio/audio_performance_mode.go b/audio/audio_performance_mode.go deleted file mode 100644 index 49fe36b..0000000 --- a/audio/audio_performance_mode.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_PERFORMANCE_MODE int32 - -const ( - AAUDIO_PERFORMANCE_MODE_NONE AUDIO_PERFORMANCE_MODE = 10 - AAUDIO_PERFORMANCE_MODE_POWER_SAVING AUDIO_PERFORMANCE_MODE = 11 - AAUDIO_PERFORMANCE_MODE_LOW_LATENCY AUDIO_PERFORMANCE_MODE = 12 -) diff --git a/audio/audio_session_id.go b/audio/audio_session_id.go deleted file mode 100644 index b1a51a6..0000000 --- a/audio/audio_session_id.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_SESSION_ID int32 - -const ( - AAUDIO_SESSION_ID_NONE AUDIO_SESSION_ID = -1 - AAUDIO_SESSION_ID_ALLOCATE AUDIO_SESSION_ID = 0 -) diff --git a/audio/audio_sharing_mode.go b/audio/audio_sharing_mode.go deleted file mode 100644 index 3fcec1b..0000000 --- a/audio/audio_sharing_mode.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_SHARING_MODE int32 - -const ( - AAUDIO_SHARING_MODE_EXCLUSIVE AUDIO_SHARING_MODE = 0 - AAUDIO_SHARING_MODE_SHARED AUDIO_SHARING_MODE = 1 -) diff --git a/audio/audio_spatialization_behavior.go b/audio/audio_spatialization_behavior.go deleted file mode 100644 index 677f45c..0000000 --- a/audio/audio_spatialization_behavior.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_SPATIALIZATION_BEHAVIOR int32 - -const ( - AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO AUDIO_SPATIALIZATION_BEHAVIOR = 1 - AAUDIO_SPATIALIZATION_BEHAVIOR_NEVER AUDIO_SPATIALIZATION_BEHAVIOR = 2 -) diff --git a/audio/audio_stream_state.go b/audio/audio_stream_state.go deleted file mode 100644 index 26d51db..0000000 --- a/audio/audio_stream_state.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type AUDIO_STREAM_STATE int32 - -const ( - AAUDIO_STREAM_STATE_UNINITIALIZED AUDIO_STREAM_STATE = 0 - AAUDIO_STREAM_STATE_UNKNOWN AUDIO_STREAM_STATE = 1 - AAUDIO_STREAM_STATE_OPEN AUDIO_STREAM_STATE = 2 - AAUDIO_STREAM_STATE_STARTING AUDIO_STREAM_STATE = 3 - AAUDIO_STREAM_STATE_STARTED AUDIO_STREAM_STATE = 4 - AAUDIO_STREAM_STATE_PAUSING AUDIO_STREAM_STATE = 5 - AAUDIO_STREAM_STATE_PAUSED AUDIO_STREAM_STATE = 6 - AAUDIO_STREAM_STATE_FLUSHING AUDIO_STREAM_STATE = 7 - AAUDIO_STREAM_STATE_FLUSHED AUDIO_STREAM_STATE = 8 - AAUDIO_STREAM_STATE_STOPPING AUDIO_STREAM_STATE = 9 - AAUDIO_STREAM_STATE_STOPPED AUDIO_STREAM_STATE = 10 - AAUDIO_STREAM_STATE_CLOSING AUDIO_STREAM_STATE = 11 - AAUDIO_STREAM_STATE_CLOSED AUDIO_STREAM_STATE = 12 - AAUDIO_STREAM_STATE_DISCONNECTED AUDIO_STREAM_STATE = 13 -) diff --git a/audio/clockid_t.go b/audio/clockid_t.go deleted file mode 100644 index 8d7530a..0000000 --- a/audio/clockid_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -type Clockid_t = capi.Clockid_t diff --git a/audio/constants.go b/audio/constants.go deleted file mode 100644 index 1e4b67c..0000000 --- a/audio/constants.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -const ( - AAUDIO_SYSTEM_USAGE_OFFSET = 1000 - AAUDIO_UNSPECIFIED = 0 -) diff --git a/audio/data_callback_result.go b/audio/data_callback_result.go deleted file mode 100644 index c259be9..0000000 --- a/audio/data_callback_result.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type DataCallbackResult int32 - -const ( - Continue DataCallbackResult = 0 - Stop DataCallbackResult = 1 -) diff --git a/audio/direction.go b/audio/direction.go deleted file mode 100644 index 98b04aa..0000000 --- a/audio/direction.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import "fmt" - -type Direction int32 - -const ( - Output Direction = 0 - Input Direction = 1 -) - -func (v Direction) String() string { - switch v { - case Output: - return "Output" - case Input: - return "Input" - default: - return fmt.Sprintf("Direction(%d)", int(v)) - } -} diff --git a/audio/errors.go b/audio/errors.go deleted file mode 100644 index 543c4bd..0000000 --- a/audio/errors.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -const ( - ErrBase Error = -900 - ErrDisconnected Error = -899 - ErrIllegalArgument Error = -898 - ErrInternal Error = -896 - ErrInvalidState Error = -895 - ErrInvalidHandle Error = -892 - ErrUnimplemented Error = -890 - ErrUnavailable Error = -889 - ErrNoFreeHandles Error = -888 - ErrNoMemory Error = -887 - ErrNull Error = -886 - ErrTimeout Error = -885 - ErrWouldBlock Error = -884 - ErrInvalidFormat Error = -883 - ErrOutOfRange Error = -882 - ErrNoService Error = -881 - ErrInvalidRate Error = -880 -) - -func (e Error) Error() string { - return fmt.Sprintf("audio: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/audio/format.go b/audio/format.go deleted file mode 100644 index 2a10e0f..0000000 --- a/audio/format.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type Format int32 - -const ( - Invalid Format = -1 - Unspecified Format = 0 - PcmI16 Format = 1 - PcmFloat Format = 2 - PcmI24Packed Format = 3 - PcmI32 Format = 4 - Iec61937 Format = 5 -) diff --git a/audio/functions.go b/audio/functions.go deleted file mode 100644 index 7293264..0000000 --- a/audio/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio diff --git a/audio/package.go b/audio/package.go deleted file mode 100644 index 745295a..0000000 --- a/audio/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package audio provides Go bindings for Android AAudio. -package audio diff --git a/audio/performance_mode.go b/audio/performance_mode.go deleted file mode 100644 index 9ccdefd..0000000 --- a/audio/performance_mode.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type PerformanceMode int32 - -const ( - None PerformanceMode = 10 - PowerSaving PerformanceMode = 11 - LowLatency PerformanceMode = 12 -) diff --git a/audio/sharing_mode.go b/audio/sharing_mode.go deleted file mode 100644 index 2a4cd2a..0000000 --- a/audio/sharing_mode.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -type SharingMode int32 - -const ( - Exclusive SharingMode = 0 - Shared SharingMode = 1 -) diff --git a/audio/stream.go b/audio/stream.go deleted file mode 100644 index 3e608f7..0000000 --- a/audio/stream.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - "time" - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -// Stream wraps the NDK AAudioStream handle. -type Stream struct { - ptr *capi.AAudioStream -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Stream) cptr() *capi.AAudioStream { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Stream) Close() error { - if h.ptr == nil { - return nil - } - err := result(capi.AAudioStream_close(h.ptr)) - h.ptr = nil - return err -} - -// NewStreamFromPointer wraps a raw AAudioStream pointer. -func NewStreamFromPointer(ptr unsafe.Pointer) *Stream { - return &Stream{ptr: (*capi.AAudioStream)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Stream) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Stream) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewStreamFromUintPtr wraps a uintptr as a Stream. -// The caller must ensure ptr points to a valid AAudioStream. -func NewStreamFromUintPtr(ptr uintptr) *Stream { - return &Stream{ptr: (*capi.AAudioStream)(unsafe.Pointer(ptr))} -} - -// GetBufferCapacityInFrames calls the underlying NDK function. -func (h *Stream) GetBufferCapacityInFrames() error { - return result(capi.AAudioStream_getBufferCapacityInFrames(h.ptr)) -} - -// GetBufferSizeInFrames calls the underlying NDK function. -func (h *Stream) GetBufferSizeInFrames() error { - return result(capi.AAudioStream_getBufferSizeInFrames(h.ptr)) -} - -// ChannelCount returns the value directly. -func (h *Stream) ChannelCount() int32 { - return (int32)(capi.AAudioStream_getChannelCount(h.ptr)) -} - -// GetDeviceID calls the underlying NDK function. -func (h *Stream) GetDeviceID() error { - return result(capi.AAudioStream_getDeviceId(h.ptr)) -} - -// FramesPerBurst returns the value directly. -func (h *Stream) FramesPerBurst() int32 { - return (int32)(capi.AAudioStream_getFramesPerBurst(h.ptr)) -} - -// GetFramesPerDataCallback calls the underlying NDK function. -func (h *Stream) GetFramesPerDataCallback() error { - return result(capi.AAudioStream_getFramesPerDataCallback(h.ptr)) -} - -// GetFramesRead returns the value directly. -func (h *Stream) GetFramesRead() int64 { - return (int64)(capi.AAudioStream_getFramesRead(h.ptr)) -} - -// GetFramesWritten returns the value directly. -func (h *Stream) GetFramesWritten() int64 { - return (int64)(capi.AAudioStream_getFramesWritten(h.ptr)) -} - -// GetHardwareChannelCount calls the underlying NDK function. -func (h *Stream) GetHardwareChannelCount() error { - return result(capi.AAudioStream_getHardwareChannelCount(h.ptr)) -} - -// GetHardwareSampleRate calls the underlying NDK function. -func (h *Stream) GetHardwareSampleRate() error { - return result(capi.AAudioStream_getHardwareSampleRate(h.ptr)) -} - -// SampleRate returns the value directly. -func (h *Stream) SampleRate() int32 { - return (int32)(capi.AAudioStream_getSampleRate(h.ptr)) -} - -// GetSamplesPerFrame calls the underlying NDK function. -func (h *Stream) GetSamplesPerFrame() error { - return result(capi.AAudioStream_getSamplesPerFrame(h.ptr)) -} - -// State returns the value directly. -func (h *Stream) State() StreamState { - return (StreamState)(capi.AAudioStream_getState(h.ptr)) -} - -// XRunCount returns the value directly. -func (h *Stream) XRunCount() int32 { - return (int32)(capi.AAudioStream_getXRunCount(h.ptr)) -} - -// IsContentSpatialized returns the value directly. -func (h *Stream) IsContentSpatialized() bool { - return (bool)(capi.AAudioStream_isContentSpatialized(h.ptr)) -} - -// IsPrivacySensitive returns the value directly. -func (h *Stream) IsPrivacySensitive() bool { - return (bool)(capi.AAudioStream_isPrivacySensitive(h.ptr)) -} - -// Read calls the underlying NDK function and returns the frame count. -func (h *Stream) Read(buffer []byte, numFrames int32, timeout time.Duration) (int32, error) { - r := capi.AAudioStream_read(h.ptr, unsafe.Pointer(&buffer[0]), numFrames, int64(timeout.Nanoseconds())) - if r < 0 { - return 0, Error(r) - } - return int32(r), nil -} - -// Flush calls the underlying NDK function. -func (h *Stream) Flush() error { - return result(capi.AAudioStream_requestFlush(h.ptr)) -} - -// Pause calls the underlying NDK function. -func (h *Stream) Pause() error { - return result(capi.AAudioStream_requestPause(h.ptr)) -} - -// Start calls the underlying NDK function. -func (h *Stream) Start() error { - return result(capi.AAudioStream_requestStart(h.ptr)) -} - -// Stop calls the underlying NDK function. -func (h *Stream) Stop() error { - return result(capi.AAudioStream_requestStop(h.ptr)) -} - -// Write calls the underlying NDK function and returns the frame count. -func (h *Stream) Write(buffer []byte, numFrames int32, timeout time.Duration) (int32, error) { - r := capi.AAudioStream_write(h.ptr, unsafe.Pointer(&buffer[0]), numFrames, int64(timeout.Nanoseconds())) - if r < 0 { - return 0, Error(r) - } - return int32(r), nil -} diff --git a/audio/stream_builder.go b/audio/stream_builder.go deleted file mode 100644 index 810c5e5..0000000 --- a/audio/stream_builder.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/aaudio" -) - -// StreamBuilder wraps the NDK AAudioStreamBuilder handle. -type StreamBuilder struct { - ptr *capi.AAudioStreamBuilder -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *StreamBuilder) cptr() *capi.AAudioStreamBuilder { - if h == nil { - return nil - } - return h.ptr -} - -// NewStreamBuilder creates a new StreamBuilder. -func NewStreamBuilder() (*StreamBuilder, error) { - var ptr *capi.AAudioStreamBuilder - if err := result(capi.AAudio_createStreamBuilder(&ptr)); err != nil { - return nil, err - } - return &StreamBuilder{ptr: ptr}, nil -} - -// Close releases the underlying NDK handle. -func (h *StreamBuilder) Close() error { - if h.ptr == nil { - return nil - } - err := result(capi.AAudioStreamBuilder_delete(h.ptr)) - h.ptr = nil - return err -} - -// NewStreamBuilderFromPointer wraps a raw AAudioStreamBuilder pointer. -func NewStreamBuilderFromPointer(ptr unsafe.Pointer) *StreamBuilder { - return &StreamBuilder{ptr: (*capi.AAudioStreamBuilder)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *StreamBuilder) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *StreamBuilder) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewStreamBuilderFromUintPtr wraps a uintptr as a StreamBuilder. -// The caller must ensure ptr points to a valid AAudioStreamBuilder. -func NewStreamBuilderFromUintPtr(ptr uintptr) *StreamBuilder { - return &StreamBuilder{ptr: (*capi.AAudioStreamBuilder)(unsafe.Pointer(ptr))} -} - -// Open creates a new Stream from this StreamBuilder. -func (h *StreamBuilder) Open() (*Stream, error) { - var ptr *capi.AAudioStream - if err := result(capi.AAudioStreamBuilder_openStream(h.ptr, &ptr)); err != nil { - return nil, err - } - return &Stream{ptr: ptr}, nil -} - -// SetAttributionTag calls the underlying NDK function. -func (h *StreamBuilder) SetAttributionTag(attributionTag string) { - capi.AAudioStreamBuilder_setAttributionTag(h.ptr, attributionTag) -} - -// SetBufferCapacityInFrames sets a property and returns the receiver for chaining. -func (h *StreamBuilder) SetBufferCapacityInFrames(numFrames int32) *StreamBuilder { - capi.AAudioStreamBuilder_setBufferCapacityInFrames(h.ptr, numFrames) - return h -} - -// SetChannelCount sets a property and returns the receiver for chaining. -func (h *StreamBuilder) SetChannelCount(channelCount int32) *StreamBuilder { - capi.AAudioStreamBuilder_setChannelCount(h.ptr, channelCount) - return h -} - -// SetDeviceID sets a property and returns the receiver for chaining. -func (h *StreamBuilder) SetDeviceID(deviceID int32) *StreamBuilder { - capi.AAudioStreamBuilder_setDeviceId(h.ptr, deviceID) - return h -} - -// SetDirection sets a property and returns the receiver for chaining. -func (h *StreamBuilder) SetDirection(direction Direction) *StreamBuilder { - capi.AAudioStreamBuilder_setDirection(h.ptr, capi.Aaudio_direction_t(direction)) - return h -} - -// SetFormat sets a property and returns the receiver for chaining. -func (h *StreamBuilder) SetFormat(format Format) *StreamBuilder { - capi.AAudioStreamBuilder_setFormat(h.ptr, capi.Aaudio_format_t(format)) - return h -} - -// SetFramesPerDataCallback calls the underlying NDK function. -func (h *StreamBuilder) SetFramesPerDataCallback(numFrames int32) { - capi.AAudioStreamBuilder_setFramesPerDataCallback(h.ptr, numFrames) -} - -// SetIsContentSpatialized calls the underlying NDK function. -func (h *StreamBuilder) SetIsContentSpatialized(isSpatialized bool) { - capi.AAudioStreamBuilder_setIsContentSpatialized(h.ptr, isSpatialized) -} - -// SetPackageName calls the underlying NDK function. -func (h *StreamBuilder) SetPackageName(packageName string) { - capi.AAudioStreamBuilder_setPackageName(h.ptr, packageName) -} - -// SetPerformanceMode sets a property and returns the receiver for chaining. -func (h *StreamBuilder) SetPerformanceMode(mode PerformanceMode) *StreamBuilder { - capi.AAudioStreamBuilder_setPerformanceMode(h.ptr, capi.Aaudio_performance_mode_t(mode)) - return h -} - -// SetPrivacySensitive calls the underlying NDK function. -func (h *StreamBuilder) SetPrivacySensitive(privacySensitive bool) { - capi.AAudioStreamBuilder_setPrivacySensitive(h.ptr, privacySensitive) -} - -// SetSampleRate sets a property and returns the receiver for chaining. -func (h *StreamBuilder) SetSampleRate(sampleRate int32) *StreamBuilder { - capi.AAudioStreamBuilder_setSampleRate(h.ptr, sampleRate) - return h -} - -// SetSamplesPerFrame calls the underlying NDK function. -func (h *StreamBuilder) SetSamplesPerFrame(samplesPerFrame int32) { - capi.AAudioStreamBuilder_setSamplesPerFrame(h.ptr, samplesPerFrame) -} - -// SetSharingMode sets a property and returns the receiver for chaining. -func (h *StreamBuilder) SetSharingMode(sharingMode SharingMode) *StreamBuilder { - capi.AAudioStreamBuilder_setSharingMode(h.ptr, capi.Aaudio_sharing_mode_t(sharingMode)) - return h -} diff --git a/audio/stream_state.go b/audio/stream_state.go deleted file mode 100644 index 4dc87f1..0000000 --- a/audio/stream_state.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package audio - -import "fmt" - -type StreamState int32 - -const ( - Uninitialized StreamState = 0 - Unknown StreamState = 1 - Open StreamState = 2 - Starting StreamState = 3 - Started StreamState = 4 - Pausing StreamState = 5 - Paused StreamState = 6 - Flushing StreamState = 7 - Flushed StreamState = 8 - Stopping StreamState = 9 - Stopped StreamState = 10 - Closing StreamState = 11 - Closed StreamState = 12 - Disconnected StreamState = 13 -) - -func (v StreamState) String() string { - switch v { - case Uninitialized: - return "Uninitialized" - case Unknown: - return "Unknown" - case Open: - return "Open" - case Starting: - return "Starting" - case Started: - return "Started" - case Pausing: - return "Pausing" - case Paused: - return "Paused" - case Flushing: - return "Flushing" - case Flushed: - return "Flushed" - case Stopping: - return "Stopping" - case Stopped: - return "Stopped" - case Closing: - return "Closing" - case Closed: - return "Closed" - case Disconnected: - return "Disconnected" - default: - return fmt.Sprintf("StreamState(%d)", int(v)) - } -} diff --git a/audio/wave.go b/audio/wave.go new file mode 100644 index 0000000..69b9292 --- /dev/null +++ b/audio/wave.go @@ -0,0 +1,222 @@ +// Copyright 2016 The G3N Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package audio + +import ( + "encoding/binary" + "fmt" + "io" + "os" + + "github.com/xaionaro-go/ndk/audio/al" +) + +// WaveSpecs describes the characterists of the audio encoded in a wave file. +type AudioInfo_ struct { + Format int // OpenAl Format + Type int // Type field from wave header + Channels int // Number of channels + SampleRate int // Sample rate in hz + BitsSample int // Number of bits per sample (8 or 16) + DataSize int // Total data size in bytes + BytesSec int // Bytes per second + TotalTime float64 // Total time in seconds +} + +const ( + waveHeaderSize = 44 + fileMark = "RIFF" + fileHead = "WAVE" +) + +// WaveCheck checks if the specified filepath corresponds to a an audio wave file. +// If the file is a valid wave file, return a pointer to WaveSpec structure +// with information about the encoded audio data. +func WaveCheckFile(filepath string) (*AudioInfo, error) { + + // Open file + f, err := os.Open(filepath) + if err != nil { + return nil, err + } + defer f.Close() + + return WaveCheck(f) +} + +func WaveCheck(f io.Reader) (*AudioInfo, error) { + // Reads header + header, err := readWavHead(f) + if err != nil { + return nil, err + } + + // Decodes header fields + var ws AudioInfo + //ws.Type = int(header.Format) + ws.Channels = int(header.Channels) + ws.SampleRate = int(header.SamplesPerSec) + ws.BitsSample = int(header.BitsPerSample) + ws.DataSize = int(header.DataSize) + + // Sets OpenAL format field if possible + if ws.Channels == 1 { + if ws.BitsSample == 8 { + ws.Format = al.FormatMono8 + } else if ws.BitsSample == 16 { + ws.Format = al.FormatMono16 + } + } else if ws.Channels == 2 { + if ws.BitsSample == 8 { + ws.Format = al.FormatStereo8 + } else if ws.BitsSample == 16 { + ws.Format = al.FormatStereo16 + } + } + + // Calculates bytes/sec and total time + bytesChannel := ws.BitsSample / 8 + + ws.BytesSec = ws.SampleRate * ws.Channels * bytesChannel + ws.TotalTime = float64(ws.DataSize) / float64(ws.BytesSec) + return &ws, nil +} + +type wavHeader struct { + Riff [4]byte //'RIFF' + RiffSize uint32 //44+DataSize + Wave [4]byte //'WAVE' + Fmt [4]byte //'fmt ' + FmtSize uint32 // 16 + Format uint16 // 1 + Channels uint16 + SamplesPerSec uint32 + BytesPerSec uint32 + BlockAlign uint16 + BitsPerSample uint16 + Data [4]byte //'data' + DataSize uint32 +} + +func readWavHead(r io.Reader) (*wavHeader, error) { + var head wavHeader + err := binary.Read(r, binary.LittleEndian, &head) + if err != nil { + return nil, err + } + // Checks file marks + if string(head.Riff[:]) != fileMark { + return nil, fmt.Errorf("'RIFF' mark not found") + } + if string(head.Wave[:]) != fileHead { + return nil, fmt.Errorf("'WAVE' mark not found") + } + //"fmt " == string(head.Fmt[:]) + for "data" != string(head.Data[:]) { + _, err := r.Read(head.Data[:]) + if err != nil { + return nil, err + } + if "data" == string(head.Data[:]) { + binary.Read(r, binary.LittleEndian, &head.DataSize) + return &head, nil + } + } + return &head, nil +} + +type WavFile struct { + reader io.ReadSeeker + offset int64 // data offset + info AudioInfo +} + +func openWave(in io.ReadSeeker) (*WavFile, error) { + info, err := WaveCheck(in) + if err != nil { + return nil, err + } + if info.Format == -1 { + return nil, fmt.Errorf("Unsupported OpenAL format") + } + + pos, _ := in.Seek(0, os.SEEK_CUR) + return &WavFile{ + reader: in, + offset: pos, + info: *info, + }, nil +} + +func (w *WavFile) Read(p []byte) (int, error) { + return w.reader.Read(p) +} + +func (w *WavFile) Seek(offset int64, whence int) (int64, error) { + if whence == os.SEEK_SET { + return w.reader.Seek(offset+w.offset, whence) + } else { + return w.reader.Seek(offset, whence) + } +} + +func (w *WavFile) CurrentTime() float64 { + pos, err := w.reader.Seek(0, os.SEEK_CUR) + if err != nil { + return 0 + } + return float64(pos-w.offset) / float64(w.info.BytesSec) +} + +func (w *WavFile) Info() AudioInfo { + return w.info +} + +func (w *WavFile) Close() error { + return nil +} + +func WavWriteHeader(w io.Writer, sampleRate, format int) error { + head := wavHeader{ + Riff: [4]byte{'R', 'I', 'F', 'F'}, //'RIFF' + Wave: [4]byte{'W', 'A', 'V', 'E'}, //'WAVE' + Fmt: [4]byte{'f', 'm', 't', ' '}, //'fmt ' + FmtSize: 16, // 16 + Format: 1, // 1 + Data: [4]byte{'d', 'a', 't', 'a'}, //'data' + } + + switch format { + case al.FormatMono8: + head.Channels = 1 + head.BitsPerSample = 8 + case al.FormatMono16: + head.Channels = 1 + head.BitsPerSample = 16 + case al.FormatStereo8: + head.Channels = 2 + head.BitsPerSample = 8 + case al.FormatStereo16: + head.Channels = 2 + head.BitsPerSample = 16 + } + head.SamplesPerSec = uint32(sampleRate) + head.BlockAlign = head.Channels * head.BitsPerSample / 8 + head.BytesPerSec = head.SamplesPerSec * uint32(head.Channels) * uint32(head.BitsPerSample) / 8 + + return binary.Write(w, binary.LittleEndian, &head) +} + +func WavClose(w io.WriteSeeker) error { + offset64, err := w.Seek(0, os.SEEK_CUR) + offset := uint32(offset64) + if err == nil { + w.Seek(4, os.SEEK_SET) + binary.Write(w, binary.LittleEndian, offset) + w.Seek(40, os.SEEK_SET) + binary.Write(w, binary.LittleEndian, offset-44) + } + return err +} diff --git a/binder/aibinder_class_on_create.go b/binder/aibinder_class_on_create.go deleted file mode 100644 index aba5dd7..0000000 --- a/binder/aibinder_class_on_create.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AIBinder_Class_onCreate = capi.AIBinder_Class_onCreate diff --git a/binder/aibinder_class_on_destroy.go b/binder/aibinder_class_on_destroy.go deleted file mode 100644 index 72ad0b8..0000000 --- a/binder/aibinder_class_on_destroy.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AIBinder_Class_onDestroy = capi.AIBinder_Class_onDestroy diff --git a/binder/aibinder_class_on_transact.go b/binder/aibinder_class_on_transact.go deleted file mode 100644 index e37136f..0000000 --- a/binder/aibinder_class_on_transact.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AIBinder_Class_onTransact = capi.AIBinder_Class_onTransact diff --git a/binder/aibinder_death_recipient_on_binder_died.go b/binder/aibinder_death_recipient_on_binder_died.go deleted file mode 100644 index 95738a8..0000000 --- a/binder/aibinder_death_recipient_on_binder_died.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AIBinder_DeathRecipient_onBinderDied = capi.AIBinder_DeathRecipient_onBinderDied diff --git a/binder/aibinder_death_recipient_on_binder_unlinked.go b/binder/aibinder_death_recipient_on_binder_unlinked.go deleted file mode 100644 index 60bc967..0000000 --- a/binder/aibinder_death_recipient_on_binder_unlinked.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AIBinder_DeathRecipient_onBinderUnlinked = capi.AIBinder_DeathRecipient_onBinderUnlinked diff --git a/binder/aibinder_on_dump.go b/binder/aibinder_on_dump.go deleted file mode 100644 index 6ab2d57..0000000 --- a/binder/aibinder_on_dump.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AIBinder_onDump = capi.AIBinder_onDump diff --git a/binder/aparcel_bool_array_allocator.go b/binder/aparcel_bool_array_allocator.go deleted file mode 100644 index 70a25c1..0000000 --- a/binder/aparcel_bool_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_boolArrayAllocator = capi.AParcel_boolArrayAllocator diff --git a/binder/aparcel_bool_array_getter.go b/binder/aparcel_bool_array_getter.go deleted file mode 100644 index b54ad0d..0000000 --- a/binder/aparcel_bool_array_getter.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_boolArrayGetter = capi.AParcel_boolArrayGetter diff --git a/binder/aparcel_bool_array_setter.go b/binder/aparcel_bool_array_setter.go deleted file mode 100644 index 1222ab0..0000000 --- a/binder/aparcel_bool_array_setter.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_boolArraySetter = capi.AParcel_boolArraySetter diff --git a/binder/aparcel_byte_array_allocator.go b/binder/aparcel_byte_array_allocator.go deleted file mode 100644 index 85bd648..0000000 --- a/binder/aparcel_byte_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_byteArrayAllocator = capi.AParcel_byteArrayAllocator diff --git a/binder/aparcel_char_array_allocator.go b/binder/aparcel_char_array_allocator.go deleted file mode 100644 index 8a9e879..0000000 --- a/binder/aparcel_char_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_charArrayAllocator = capi.AParcel_charArrayAllocator diff --git a/binder/aparcel_double_array_allocator.go b/binder/aparcel_double_array_allocator.go deleted file mode 100644 index 123deea..0000000 --- a/binder/aparcel_double_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_doubleArrayAllocator = capi.AParcel_doubleArrayAllocator diff --git a/binder/aparcel_float_array_allocator.go b/binder/aparcel_float_array_allocator.go deleted file mode 100644 index f416464..0000000 --- a/binder/aparcel_float_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_floatArrayAllocator = capi.AParcel_floatArrayAllocator diff --git a/binder/aparcel_int32_array_allocator.go b/binder/aparcel_int32_array_allocator.go deleted file mode 100644 index 0907bad..0000000 --- a/binder/aparcel_int32_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_int32ArrayAllocator = capi.AParcel_int32ArrayAllocator diff --git a/binder/aparcel_int64_array_allocator.go b/binder/aparcel_int64_array_allocator.go deleted file mode 100644 index c7c9f1b..0000000 --- a/binder/aparcel_int64_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_int64ArrayAllocator = capi.AParcel_int64ArrayAllocator diff --git a/binder/aparcel_parcelable_array_allocator.go b/binder/aparcel_parcelable_array_allocator.go deleted file mode 100644 index 27ecf6d..0000000 --- a/binder/aparcel_parcelable_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_parcelableArrayAllocator = capi.AParcel_parcelableArrayAllocator diff --git a/binder/aparcel_read_parcelable_element.go b/binder/aparcel_read_parcelable_element.go deleted file mode 100644 index eccaff8..0000000 --- a/binder/aparcel_read_parcelable_element.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_readParcelableElement = capi.AParcel_readParcelableElement diff --git a/binder/aparcel_string_allocator.go b/binder/aparcel_string_allocator.go deleted file mode 100644 index 11d52f6..0000000 --- a/binder/aparcel_string_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_stringAllocator = capi.AParcel_stringAllocator diff --git a/binder/aparcel_string_array_allocator.go b/binder/aparcel_string_array_allocator.go deleted file mode 100644 index b30036f..0000000 --- a/binder/aparcel_string_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_stringArrayAllocator = capi.AParcel_stringArrayAllocator diff --git a/binder/aparcel_string_array_element_allocator.go b/binder/aparcel_string_array_element_allocator.go deleted file mode 100644 index a6fd77b..0000000 --- a/binder/aparcel_string_array_element_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_stringArrayElementAllocator = capi.AParcel_stringArrayElementAllocator diff --git a/binder/aparcel_string_array_element_getter.go b/binder/aparcel_string_array_element_getter.go deleted file mode 100644 index 7ca35c0..0000000 --- a/binder/aparcel_string_array_element_getter.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_stringArrayElementGetter = capi.AParcel_stringArrayElementGetter diff --git a/binder/aparcel_uint32_array_allocator.go b/binder/aparcel_uint32_array_allocator.go deleted file mode 100644 index 31fc8eb..0000000 --- a/binder/aparcel_uint32_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_uint32ArrayAllocator = capi.AParcel_uint32ArrayAllocator diff --git a/binder/aparcel_uint64_array_allocator.go b/binder/aparcel_uint64_array_allocator.go deleted file mode 100644 index 9655ae5..0000000 --- a/binder/aparcel_uint64_array_allocator.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_uint64ArrayAllocator = capi.AParcel_uint64ArrayAllocator diff --git a/binder/aparcel_write_parcelable_element.go b/binder/aparcel_write_parcelable_element.go deleted file mode 100644 index 57f316d..0000000 --- a/binder/aparcel_write_parcelable_element.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type AParcel_writeParcelableElement = capi.AParcel_writeParcelableElement diff --git a/binder/binder.go b/binder/binder.go deleted file mode 100644 index 83127bb..0000000 --- a/binder/binder.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -// Binder wraps the NDK AIBinder handle. -type Binder struct { - ptr *capi.AIBinder -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Binder) cptr() *capi.AIBinder { - if h == nil { - return nil - } - return h.ptr -} - -// NewBinder creates a new Binder. -func NewBinder(clazz unsafe.Pointer, args unsafe.Pointer) *Binder { - return &Binder{ptr: capi.AIBinder_new((*capi.AIBinder_Class)(clazz), args)} -} - -// Close releases the underlying NDK handle. -func (h *Binder) Close() error { - if h.ptr == nil { - return nil - } - capi.AIBinder_decStrong(h.ptr) - h.ptr = nil - return nil -} - -// NewBinderFromPointer wraps a raw AIBinder pointer. -func NewBinderFromPointer(ptr unsafe.Pointer) *Binder { - return &Binder{ptr: (*capi.AIBinder)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Binder) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Binder) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewBinderFromUintPtr wraps a uintptr as a Binder. -// The caller must ensure ptr points to a valid AIBinder. -func NewBinderFromUintPtr(ptr uintptr) *Binder { - return &Binder{ptr: (*capi.AIBinder)(unsafe.Pointer(ptr))} -} - -// AssociateClass returns the value directly. -func (h *Binder) AssociateClass(clazz *Class) bool { - return (bool)(capi.AIBinder_associateClass(h.ptr, clazz.cptr())) -} - -// DebugGetRefCount calls the underlying NDK function. -func (h *Binder) DebugGetRefCount() error { - return result(capi.AIBinder_debugGetRefCount(h.ptr)) -} - -// GetClass creates a new Class from this Binder. -func (h *Binder) GetClass() *Class { - return &Class{ptr: capi.AIBinder_getClass(h.ptr)} -} - -// GetUserData returns the value directly. -func (h *Binder) GetUserData() unsafe.Pointer { - return (unsafe.Pointer)(capi.AIBinder_getUserData(h.ptr)) -} - -// IncStrong calls the underlying NDK function. -func (h *Binder) IncStrong() { - capi.AIBinder_incStrong(h.ptr) -} - -// IsAlive returns the value directly. -func (h *Binder) IsAlive() bool { - return (bool)(capi.AIBinder_isAlive(h.ptr)) -} - -// IsRemote returns the value directly. -func (h *Binder) IsRemote() bool { - return (bool)(capi.AIBinder_isRemote(h.ptr)) -} - -// Lt returns the value directly. -func (h *Binder) Lt(rhs *Binder) bool { - return (bool)(capi.AIBinder_lt(h.ptr, rhs.cptr())) -} diff --git a/binder/char16_t.go b/binder/char16_t.go deleted file mode 100644 index 14a59bf..0000000 --- a/binder/char16_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type Char16_t = capi.Char16_t diff --git a/binder/class.go b/binder/class.go deleted file mode 100644 index 03f0d19..0000000 --- a/binder/class.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -// Class wraps the NDK AIBinder_Class handle. -type Class struct { - ptr *capi.AIBinder_Class -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Class) cptr() *capi.AIBinder_Class { - if h == nil { - return nil - } - return h.ptr -} - -// NewClassFromPointer wraps a raw AIBinder_Class pointer. -func NewClassFromPointer(ptr unsafe.Pointer) *Class { - return &Class{ptr: (*capi.AIBinder_Class)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Class) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Class) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewClassFromUintPtr wraps a uintptr as a Class. -// The caller must ensure ptr points to a valid AIBinder_Class. -func NewClassFromUintPtr(ptr uintptr) *Class { - return &Class{ptr: (*capi.AIBinder_Class)(unsafe.Pointer(ptr))} -} - -// DisableInterfaceTokenHeader calls the underlying NDK function. -func (h *Class) DisableInterfaceTokenHeader() { - capi.AIBinder_Class_disableInterfaceTokenHeader(h.ptr) -} - -// GetDescriptor returns the value directly. -func (h *Class) GetDescriptor() string { - return (string)(capi.AIBinder_Class_getDescriptor(h.ptr)) -} diff --git a/binder/errors.go b/binder/errors.go deleted file mode 100644 index e6a74bd..0000000 --- a/binder/errors.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -const ( - ErrUnknownError Error = -2147483648 - ErrNoMemory Error = -12 - ErrInvalidOperation Error = -38 - ErrBadValue Error = -22 - ErrBadType Error = -2147483647 - ErrNameNotFound Error = -2 - ErrPermissionDenied Error = -1 - ErrNoInit Error = -19 - ErrAlreadyExists Error = -17 - ErrDeadObject Error = -32 - ErrFailedTransaction Error = -2147483646 - ErrBadIndex Error = -75 - ErrNotEnoughData Error = -61 - ErrWouldBlock Error = -11 - ErrTimedOut Error = -110 - ErrUnknownTransaction Error = -74 - ErrFdsNotAllowed Error = -2147483641 - ErrUnexpectedNull Error = -2147483640 -) - -func (e Error) Error() string { - return fmt.Sprintf("binder: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/binder/ex.go b/binder/ex.go deleted file mode 100644 index 8e68b34..0000000 --- a/binder/ex.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -type EX int32 - -const ( - EX_NONE EX = 0 - EX_SECURITY EX = -1 - EX_BAD_PARCELABLE EX = -2 - EX_ILLEGAL_ARGUMENT EX = -3 - EX_NULL_POINTER EX = -4 - EX_ILLEGAL_STATE EX = -5 - EX_NETWORK_MAIN_THREAD EX = -6 - EX_UNSUPPORTED_OPERATION EX = -7 - EX_SERVICE_SPECIFIC EX = -8 - EX_PARCELABLE EX = -9 - EX_TRANSACTION_FAILED EX = -129 -) diff --git a/binder/exception_code.go b/binder/exception_code.go deleted file mode 100644 index c800621..0000000 --- a/binder/exception_code.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -type ExceptionCode int32 - -const ( - None ExceptionCode = 0 - Security ExceptionCode = -1 - BadParcelable ExceptionCode = -2 - IllegalArgument ExceptionCode = -3 - NullPointer ExceptionCode = -4 - IllegalState ExceptionCode = -5 - NetworkMainThread ExceptionCode = -6 - UnsupportedOperation ExceptionCode = -7 - ServiceSpecific ExceptionCode = -8 - Parcelable ExceptionCode = -9 - TransactionFailed ExceptionCode = -129 -) diff --git a/binder/flag.go b/binder/flag.go deleted file mode 100644 index 90df45b..0000000 --- a/binder/flag.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -type FLAG int32 - -const ( - FLAG_ONEWAY FLAG = 1 -) diff --git a/binder/flags.go b/binder/flags.go deleted file mode 100644 index 777e60c..0000000 --- a/binder/flags.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -type Flags uint32 - -const ( - Oneway Flags = 1 -) diff --git a/binder/functions.go b/binder/functions.go deleted file mode 100644 index bcde0fc..0000000 --- a/binder/functions.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -// AIBinder_isHandlingTransaction calls the underlying C function. -func AIBinder_isHandlingTransaction() bool { - return (bool)(capi.AIBinder_isHandlingTransaction()) -} - -// AStatus_deleteDescription calls the underlying C function. -func AStatus_deleteDescription(description string) { - capi.AStatus_deleteDescription(description) -} diff --git a/binder/ibinder_death_recipient.go b/binder/ibinder_death_recipient.go deleted file mode 100644 index 36c6455..0000000 --- a/binder/ibinder_death_recipient.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -// IBinder_DeathRecipient wraps the NDK AIBinder_DeathRecipient handle. -type IBinder_DeathRecipient struct { - ptr *capi.AIBinder_DeathRecipient -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *IBinder_DeathRecipient) cptr() *capi.AIBinder_DeathRecipient { - if h == nil { - return nil - } - return h.ptr -} - -// NewIBinder_DeathRecipient creates a new IBinder_DeathRecipient. -func NewIBinder_DeathRecipient(onBinderDied AIBinder_DeathRecipient_onBinderDied) *IBinder_DeathRecipient { - return &IBinder_DeathRecipient{ptr: capi.AIBinder_DeathRecipient_new(onBinderDied)} -} - -// Close releases the underlying NDK handle. -func (h *IBinder_DeathRecipient) Close() error { - if h.ptr == nil { - return nil - } - capi.AIBinder_DeathRecipient_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewIBinder_DeathRecipientFromPointer wraps a raw AIBinder_DeathRecipient pointer. -func NewIBinder_DeathRecipientFromPointer(ptr unsafe.Pointer) *IBinder_DeathRecipient { - return &IBinder_DeathRecipient{ptr: (*capi.AIBinder_DeathRecipient)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *IBinder_DeathRecipient) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *IBinder_DeathRecipient) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewIBinder_DeathRecipientFromUintPtr wraps a uintptr as a IBinder_DeathRecipient. -// The caller must ensure ptr points to a valid AIBinder_DeathRecipient. -func NewIBinder_DeathRecipientFromUintPtr(ptr uintptr) *IBinder_DeathRecipient { - return &IBinder_DeathRecipient{ptr: (*capi.AIBinder_DeathRecipient)(unsafe.Pointer(ptr))} -} diff --git a/binder/ibinder_weak.go b/binder/ibinder_weak.go deleted file mode 100644 index 03c8030..0000000 --- a/binder/ibinder_weak.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -// IBinder_Weak wraps the NDK AIBinder_Weak handle. -type IBinder_Weak struct { - ptr *capi.AIBinder_Weak -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *IBinder_Weak) cptr() *capi.AIBinder_Weak { - if h == nil { - return nil - } - return h.ptr -} - -// NewIBinder_Weak creates a new IBinder_Weak. -func NewIBinder_Weak(binder unsafe.Pointer) *IBinder_Weak { - return &IBinder_Weak{ptr: capi.AIBinder_Weak_new((*capi.AIBinder)(binder))} -} - -// Close releases the underlying NDK handle. -func (h *IBinder_Weak) Close() error { - if h.ptr == nil { - return nil - } - capi.AIBinder_Weak_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewIBinder_WeakFromPointer wraps a raw AIBinder_Weak pointer. -func NewIBinder_WeakFromPointer(ptr unsafe.Pointer) *IBinder_Weak { - return &IBinder_Weak{ptr: (*capi.AIBinder_Weak)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *IBinder_Weak) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *IBinder_Weak) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewIBinder_WeakFromUintPtr wraps a uintptr as a IBinder_Weak. -// The caller must ensure ptr points to a valid AIBinder_Weak. -func NewIBinder_WeakFromUintPtr(ptr uintptr) *IBinder_Weak { - return &IBinder_Weak{ptr: (*capi.AIBinder_Weak)(unsafe.Pointer(ptr))} -} - -// Clone creates a new IBinder_Weak from this IBinder_Weak. -func (h *IBinder_Weak) Clone() *IBinder_Weak { - return &IBinder_Weak{ptr: capi.AIBinder_Weak_clone(h.ptr)} -} - -// Lt returns the value directly. -func (h *IBinder_Weak) Lt(rhs *IBinder_Weak) bool { - return (bool)(capi.AIBinder_Weak_lt(h.ptr, rhs.cptr())) -} - -// Promote creates a new Binder from this IBinder_Weak. -func (h *IBinder_Weak) Promote() *Binder { - return &Binder{ptr: capi.AIBinder_Weak_promote(h.ptr)} -} diff --git a/binder/package.go b/binder/package.go deleted file mode 100644 index 8ea4287..0000000 --- a/binder/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package binder provides Go bindings for Android Binder IPC. -package binder diff --git a/binder/parcel.go b/binder/parcel.go deleted file mode 100644 index 5714960..0000000 --- a/binder/parcel.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -// Parcel wraps the NDK AParcel handle. -type Parcel struct { - ptr *capi.AParcel -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Parcel) cptr() *capi.AParcel { - if h == nil { - return nil - } - return h.ptr -} - -// NewParcel creates a new Parcel. -func NewParcel() *Parcel { - return &Parcel{ptr: capi.AParcel_create()} -} - -// Close releases the underlying NDK handle. -func (h *Parcel) Close() error { - if h.ptr == nil { - return nil - } - capi.AParcel_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewParcelFromPointer wraps a raw AParcel pointer. -func NewParcelFromPointer(ptr unsafe.Pointer) *Parcel { - return &Parcel{ptr: (*capi.AParcel)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Parcel) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Parcel) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewParcelFromUintPtr wraps a uintptr as a Parcel. -// The caller must ensure ptr points to a valid AParcel. -func NewParcelFromUintPtr(ptr uintptr) *Parcel { - return &Parcel{ptr: (*capi.AParcel)(unsafe.Pointer(ptr))} -} - -// GetDataPosition calls the underlying NDK function. -func (h *Parcel) GetDataPosition() error { - return result(capi.AParcel_getDataPosition(h.ptr)) -} - -// GetDataSize calls the underlying NDK function. -func (h *Parcel) GetDataSize() error { - return result(capi.AParcel_getDataSize(h.ptr)) -} diff --git a/binder/pid_t.go b/binder/pid_t.go deleted file mode 100644 index c3e4c4c..0000000 --- a/binder/pid_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type Pid_t = capi.Pid_t diff --git a/binder/status.go b/binder/status.go deleted file mode 100644 index a0c0e08..0000000 --- a/binder/status.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -// Status wraps the NDK AStatus handle. -type Status struct { - ptr *capi.AStatus -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Status) cptr() *capi.AStatus { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Status) Close() error { - if h.ptr == nil { - return nil - } - capi.AStatus_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewStatusFromPointer wraps a raw AStatus pointer. -func NewStatusFromPointer(ptr unsafe.Pointer) *Status { - return &Status{ptr: (*capi.AStatus)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Status) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Status) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewStatusFromUintPtr wraps a uintptr as a Status. -// The caller must ensure ptr points to a valid AStatus. -func NewStatusFromUintPtr(ptr uintptr) *Status { - return &Status{ptr: (*capi.AStatus)(unsafe.Pointer(ptr))} -} - -// GetDescription returns the value directly. -func (h *Status) GetDescription() string { - return (string)(capi.AStatus_getDescription(h.ptr)) -} - -// GetMessage returns the value directly. -func (h *Status) GetMessage() string { - return (string)(capi.AStatus_getMessage(h.ptr)) -} - -// GetServiceSpecificError calls the underlying NDK function. -func (h *Status) GetServiceSpecificError() error { - return result(capi.AStatus_getServiceSpecificError(h.ptr)) -} - -// IsOk returns the value directly. -func (h *Status) IsOk() bool { - return (bool)(capi.AStatus_isOk(h.ptr)) -} - -// AStatus_fromServiceSpecificError calls the underlying C function. -func AStatus_fromServiceSpecificError(serviceSpecific int32) *Status { - return &Status{ptr: capi.AStatus_fromServiceSpecificError(serviceSpecific)} -} - -// AStatus_fromServiceSpecificErrorWithMessage calls the underlying C function. -func AStatus_fromServiceSpecificErrorWithMessage(serviceSpecific int32, message string) *Status { - return &Status{ptr: capi.AStatus_fromServiceSpecificErrorWithMessage(serviceSpecific, message)} -} - -// AStatus_newOk calls the underlying C function. -func AStatus_newOk() *Status { - return &Status{ptr: capi.AStatus_newOk()} -} diff --git a/binder/thread_pool.go b/binder/thread_pool.go new file mode 100644 index 0000000..9147081 --- /dev/null +++ b/binder/thread_pool.go @@ -0,0 +1,78 @@ +package binder + +/* +#include +#include + +static void *dlopen_libbinder_ndk(void) +{ + void *h = dlopen("libbinder_ndk.so", RTLD_NOW | RTLD_LOCAL); + if (h != NULL) + return h; + + return NULL; +} + +int thread_pool_start(unsigned thead_pool_size) +{ + typedef int (*set_thread_pool_max_fn)(uint32_t); + typedef void (*start_thread_pool_fn)(void); + + set_thread_pool_max_fn set_thread_pool_max = NULL; + start_thread_pool_fn start_thread_pool = NULL; + + void *h = dlopen_libbinder_ndk(); + if (h == NULL) { + return 1; + } + + start_thread_pool = + (start_thread_pool_fn) dlsym(h, "ABinderProcess_startThreadPool"); + + if (start_thread_pool == NULL) { + return 2; + } + + if (thead_pool_size != 0) { + set_thread_pool_max = (set_thread_pool_max_fn) dlsym(h, "ABinderProcess_setThreadPoolMaxThreadCount"); + if (set_thread_pool_max == NULL) + return 3; + set_thread_pool_max(thead_pool_size); + } + + start_thread_pool(); + return 0; +} +*/ +import "C" +import "fmt" + +type ErrUnableToDLLoadLibbinderNDK struct{} +type ErrUnableToFindStartThreadPoolSymbol struct{} +type ErrUnableToFindSetThreadPoolMaxSymbol struct{} + +func (e ErrUnableToDLLoadLibbinderNDK) Error() string { + return "unable to dlopen libbinder_ndk.so" +} +func (e ErrUnableToFindStartThreadPoolSymbol) Error() string { + return "unable to find ABinderProcess_startThreadPool symbol" +} +func (e ErrUnableToFindSetThreadPoolMaxSymbol) Error() string { + return "unable to find ABinderProcess_setThreadPoolMaxThreadCount symbol" +} + +func ThreadPoolStart(threads int) error { + rc := C.thread_pool_start(C.uint(threads)) + switch rc { + case 0: + return nil + case 1: + return ErrUnableToDLLoadLibbinderNDK{} + case 2: + return ErrUnableToFindStartThreadPoolSymbol{} + case 3: + return ErrUnableToFindSetThreadPoolMaxSymbol{} + default: + return fmt.Errorf("unknown error code %d from thread_pool_start", rc) + } +} diff --git a/binder/transaction_code_t.go b/binder/transaction_code_t.go deleted file mode 100644 index e2f0b8e..0000000 --- a/binder/transaction_code_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type transaction_code_t = capi.Transaction_code_t diff --git a/binder/uid_t.go b/binder/uid_t.go deleted file mode 100644 index 718a0b1..0000000 --- a/binder/uid_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package binder - -import ( - capi "github.com/AndroidGoLab/ndk/capi/binder" -) - -type Uid_t = capi.Uid_t diff --git a/binderprocess/thread_pool.go b/binderprocess/thread_pool.go deleted file mode 100644 index 5360738..0000000 --- a/binderprocess/thread_pool.go +++ /dev/null @@ -1,77 +0,0 @@ -// Package binderprocess provides access to ABinderProcess_* functions -// that are not part of the public NDK headers but available at runtime -// via dlsym in libbinder_ndk.so. -package binderprocess - -/* -#include -#include - -static int thread_pool_start(unsigned thread_pool_size) -{ - typedef int (*set_thread_pool_max_fn)(uint32_t); - typedef void (*start_thread_pool_fn)(void); - - void *h = dlopen("libbinder_ndk.so", RTLD_NOW | RTLD_LOCAL); - if (h == NULL) - return 1; - - start_thread_pool_fn start_thread_pool = - (start_thread_pool_fn)dlsym(h, "ABinderProcess_startThreadPool"); - if (start_thread_pool == NULL) - return 2; - - if (thread_pool_size != 0) { - set_thread_pool_max_fn set_thread_pool_max = - (set_thread_pool_max_fn)dlsym(h, "ABinderProcess_setThreadPoolMaxThreadCount"); - if (set_thread_pool_max == NULL) - return 3; - set_thread_pool_max(thread_pool_size); - } - - start_thread_pool(); - return 0; -} -*/ -import "C" - -import "fmt" - -// ErrDLOpenLibbinderNDK is returned when libbinder_ndk.so cannot be loaded. -type ErrDLOpenLibbinderNDK struct{} - -func (ErrDLOpenLibbinderNDK) Error() string { - return "unable to dlopen libbinder_ndk.so" -} - -// ErrSymbolStartThreadPool is returned when ABinderProcess_startThreadPool is not found. -type ErrSymbolStartThreadPool struct{} - -func (ErrSymbolStartThreadPool) Error() string { - return "unable to find ABinderProcess_startThreadPool symbol" -} - -// ErrSymbolSetThreadPoolMax is returned when ABinderProcess_setThreadPoolMaxThreadCount is not found. -type ErrSymbolSetThreadPoolMax struct{} - -func (ErrSymbolSetThreadPoolMax) Error() string { - return "unable to find ABinderProcess_setThreadPoolMaxThreadCount symbol" -} - -// StartThreadPool starts the binder thread pool with the given number of threads. -// If threads is 0, the default thread count is used (only startThreadPool is called). -func StartThreadPool(threads int) error { - rc := C.thread_pool_start(C.uint(threads)) - switch rc { - case 0: - return nil - case 1: - return ErrDLOpenLibbinderNDK{} - case 2: - return ErrSymbolStartThreadPool{} - case 3: - return ErrSymbolSetThreadPoolMax{} - default: - return fmt.Errorf("thread_pool_start returned unexpected code %d", rc) - } -} diff --git a/bitmap/android_bitmap_compress_format.go b/bitmap/android_bitmap_compress_format.go deleted file mode 100644 index 46597fa..0000000 --- a/bitmap/android_bitmap_compress_format.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -type AndroidBitmapCompressFormat int32 - -const ( - ANDROID_BITMAP_COMPRESS_FORMAT_JPEG AndroidBitmapCompressFormat = 0 - ANDROID_BITMAP_COMPRESS_FORMAT_PNG AndroidBitmapCompressFormat = 1 - ANDROID_BITMAP_COMPRESS_FORMAT_WEBP_LOSSY AndroidBitmapCompressFormat = 3 - ANDROID_BITMAP_COMPRESS_FORMAT_WEBP_LOSSLESS AndroidBitmapCompressFormat = 4 -) diff --git a/bitmap/android_bitmap_compress_write_func.go b/bitmap/android_bitmap_compress_write_func.go deleted file mode 100644 index 2d2e886..0000000 --- a/bitmap/android_bitmap_compress_write_func.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -import ( - capi "github.com/AndroidGoLab/ndk/capi/bitmap" -) - -type AndroidBitmap_CompressWriteFunc = capi.AndroidBitmap_CompressWriteFunc diff --git a/bitmap/android_bitmap_info.go b/bitmap/android_bitmap_info.go deleted file mode 100644 index 1f2f177..0000000 --- a/bitmap/android_bitmap_info.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/bitmap" -) - -// AndroidBitmapInfo wraps the NDK AndroidBitmapInfo handle. -type AndroidBitmapInfo struct { - ptr *capi.AndroidBitmapInfo -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *AndroidBitmapInfo) cptr() *capi.AndroidBitmapInfo { - if h == nil { - return nil - } - return h.ptr -} - -// NewAndroidBitmapInfoFromPointer wraps a raw AndroidBitmapInfo pointer. -func NewAndroidBitmapInfoFromPointer(ptr unsafe.Pointer) *AndroidBitmapInfo { - return &AndroidBitmapInfo{ptr: (*capi.AndroidBitmapInfo)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *AndroidBitmapInfo) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *AndroidBitmapInfo) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewAndroidBitmapInfoFromUintPtr wraps a uintptr as a AndroidBitmapInfo. -// The caller must ensure ptr points to a valid AndroidBitmapInfo. -func NewAndroidBitmapInfoFromUintPtr(ptr uintptr) *AndroidBitmapInfo { - return &AndroidBitmapInfo{ptr: (*capi.AndroidBitmapInfo)(unsafe.Pointer(ptr))} -} diff --git a/bitmap/errors.go b/bitmap/errors.go deleted file mode 100644 index f2aebda..0000000 --- a/bitmap/errors.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -const ( - ErrBadParameter Error = -1 - ErrJniException Error = -2 - ErrAllocationFailed Error = -3 -) - -func (e Error) Error() string { - return fmt.Sprintf("bitmap: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/bitmap/format.go b/bitmap/format.go deleted file mode 100644 index dc1dd50..0000000 --- a/bitmap/format.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -type Format int32 - -const ( - None Format = 0 - Rgba8888 Format = 1 - Rgb565 Format = 4 - Rgba4444 Format = 7 - A8 Format = 8 - RgbaF16 Format = 9 - Rgba1010102 Format = 10 -) diff --git a/bitmap/functions.go b/bitmap/functions.go deleted file mode 100644 index bbb8856..0000000 --- a/bitmap/functions.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/bitmap" -) - -// GetInfo calls the underlying C function. -func GetInfo(env *JNIEnv, jbitmap Jobject, info *AndroidBitmapInfo) int32 { - return (int32)(capi.AndroidBitmap_getInfo((*capi.JNIEnv)(env), capi.Jobject(jbitmap), info.cptr())) -} - -// LockPixels calls the underlying C function. -func LockPixels(env *JNIEnv, jbitmap Jobject, addrPtr *unsafe.Pointer) int32 { - return (int32)(capi.AndroidBitmap_lockPixels((*capi.JNIEnv)(env), capi.Jobject(jbitmap), addrPtr)) -} - -// UnlockPixels calls the underlying C function. -func UnlockPixels(env *JNIEnv, jbitmap Jobject) int32 { - return (int32)(capi.AndroidBitmap_unlockPixels((*capi.JNIEnv)(env), capi.Jobject(jbitmap))) -} diff --git a/bitmap/hardware_buffer.go b/bitmap/hardware_buffer.go deleted file mode 100644 index 0a31d29..0000000 --- a/bitmap/hardware_buffer.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/bitmap" -) - -// HardwareBuffer wraps the NDK AHardwareBuffer handle. -type HardwareBuffer struct { - ptr *capi.AHardwareBuffer -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *HardwareBuffer) cptr() *capi.AHardwareBuffer { - if h == nil { - return nil - } - return h.ptr -} - -// NewHardwareBufferFromPointer wraps a raw AHardwareBuffer pointer. -func NewHardwareBufferFromPointer(ptr unsafe.Pointer) *HardwareBuffer { - return &HardwareBuffer{ptr: (*capi.AHardwareBuffer)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *HardwareBuffer) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *HardwareBuffer) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewHardwareBufferFromUintPtr wraps a uintptr as a HardwareBuffer. -// The caller must ensure ptr points to a valid AHardwareBuffer. -func NewHardwareBufferFromUintPtr(ptr uintptr) *HardwareBuffer { - return &HardwareBuffer{ptr: (*capi.AHardwareBuffer)(unsafe.Pointer(ptr))} -} diff --git a/bitmap/jnienv.go b/bitmap/jnienv.go deleted file mode 100644 index e6e3680..0000000 --- a/bitmap/jnienv.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -import ( - capi "github.com/AndroidGoLab/ndk/capi/bitmap" -) - -type JNIEnv = capi.JNIEnv diff --git a/bitmap/jobject.go b/bitmap/jobject.go deleted file mode 100644 index c9477a4..0000000 --- a/bitmap/jobject.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -import ( - capi "github.com/AndroidGoLab/ndk/capi/bitmap" -) - -type Jobject = capi.Jobject diff --git a/bitmap/ndroid_bitmap_flags.go b/bitmap/ndroid_bitmap_flags.go deleted file mode 100644 index d9b524c..0000000 --- a/bitmap/ndroid_bitmap_flags.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -type NDROID_BITMAP_FLAGS int32 - -const ( - ANDROID_BITMAP_FLAGS_IS_HARDWARE NDROID_BITMAP_FLAGS = -2147483648 -) diff --git a/bitmap/ndroid_bitmap_flags_alpha.go b/bitmap/ndroid_bitmap_flags_alpha.go deleted file mode 100644 index 5257020..0000000 --- a/bitmap/ndroid_bitmap_flags_alpha.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package bitmap - -type NDROID_BITMAP_FLAGS_ALPHA int32 - -const ( - ANDROID_BITMAP_FLAGS_ALPHA_PREMUL NDROID_BITMAP_FLAGS_ALPHA = 0 - ANDROID_BITMAP_FLAGS_ALPHA_OPAQUE NDROID_BITMAP_FLAGS_ALPHA = 1 - ANDROID_BITMAP_FLAGS_ALPHA_UNPREMUL NDROID_BITMAP_FLAGS_ALPHA = 2 - ANDROID_BITMAP_FLAGS_ALPHA_MASK NDROID_BITMAP_FLAGS_ALPHA = 3 - ANDROID_BITMAP_FLAGS_ALPHA_SHIFT NDROID_BITMAP_FLAGS_ALPHA = 0 -) diff --git a/bitmap/package.go b/bitmap/package.go deleted file mode 100644 index 2edf570..0000000 --- a/bitmap/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package bitmap provides Go bindings for Android Bitmap (jnigraphics). -package bitmap diff --git a/callfn/callfn.go b/callfn/callfn.go new file mode 100644 index 0000000..7a3d050 --- /dev/null +++ b/callfn/callfn.go @@ -0,0 +1,18 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build android && (arm || 386 || amd64 || arm64) +// +build android +// +build arm 386 amd64 arm64 + +// Package callfn provides an android entry point. +// +// It is a separate package from app because it contains Go assembly, +// which does not compile in a package using cgo. +package callfn + +// CallFn calls a zero-argument function by its program counter. +// It is only intended for calling main.main. Using it for +// anything else will not end well. +func CallFn(fn uintptr) diff --git a/callfn/callfn_386.s b/callfn/callfn_386.s new file mode 100644 index 0000000..15e4b5a --- /dev/null +++ b/callfn/callfn_386.s @@ -0,0 +1,12 @@ +// +build android +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "funcdata.h" + +TEXT ·CallFn(SB),$0-4 + MOVL fn+0(FP), AX + CALL AX + RET diff --git a/callfn/callfn_amd64.s b/callfn/callfn_amd64.s new file mode 100644 index 0000000..23544aa --- /dev/null +++ b/callfn/callfn_amd64.s @@ -0,0 +1,12 @@ +// +build android +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "funcdata.h" + +TEXT ·CallFn(SB),$0-8 + MOVQ fn+0(FP), AX + CALL AX + RET diff --git a/callfn/callfn_arm.s b/callfn/callfn_arm.s new file mode 100644 index 0000000..812ae1a --- /dev/null +++ b/callfn/callfn_arm.s @@ -0,0 +1,12 @@ +// +build android +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "funcdata.h" + +TEXT ·CallFn(SB),$0-4 + MOVW fn+0(FP), R0 + BL (R0) + RET diff --git a/callfn/callfn_arm64.s b/callfn/callfn_arm64.s new file mode 100644 index 0000000..1471854 --- /dev/null +++ b/callfn/callfn_arm64.s @@ -0,0 +1,12 @@ +// +build android +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "funcdata.h" + +TEXT ·CallFn(SB),$0-8 + MOVD fn+0(FP), R0 + BL (R0) + RET diff --git a/callfn/callfn_unsupported.go b/callfn/callfn_unsupported.go new file mode 100644 index 0000000..70b74f8 --- /dev/null +++ b/callfn/callfn_unsupported.go @@ -0,0 +1,8 @@ +//go:build !android +// +build !android + +package callfn + +func CallFn(fn uintptr) { + panic("this platform is not supported") +} diff --git a/camera/acamera_capture_session_prepare_callback.go b/camera/acamera_capture_session_prepare_callback.go deleted file mode 100644 index d897cc5..0000000 --- a/camera/acamera_capture_session_prepare_callback.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type ACameraCaptureSession_prepareCallback = capi.ACameraCaptureSession_prepareCallback diff --git a/camera/acamera_capture_session_state_callbacks.go b/camera/acamera_capture_session_state_callbacks.go deleted file mode 100644 index 8927e9f..0000000 --- a/camera/acamera_capture_session_state_callbacks.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type ACameraCaptureSession_stateCallbacks = capi.ACameraCaptureSession_stateCallbacks diff --git a/camera/acamera_device_state_callbacks.go b/camera/acamera_device_state_callbacks.go deleted file mode 100644 index 67ecb8d..0000000 --- a/camera/acamera_device_state_callbacks.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type ACameraDevice_StateCallbacks = capi.ACameraDevice_StateCallbacks diff --git a/camera/acamera_id_list.go b/camera/acamera_id_list.go deleted file mode 100644 index 0cee6ca..0000000 --- a/camera/acamera_id_list.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type ACameraIdList = capi.ACameraIdList diff --git a/camera/acamera_metadata_enum_android_automotive_lens_facing_t.go b/camera/acamera_metadata_enum_android_automotive_lens_facing_t.go deleted file mode 100644 index ed36e3c..0000000 --- a/camera/acamera_metadata_enum_android_automotive_lens_facing_t.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_automotive_lens_facing_t int32 - -const ( - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER acamera_metadata_enum_android_automotive_lens_facing_t = 0 - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT acamera_metadata_enum_android_automotive_lens_facing_t = 1 - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR acamera_metadata_enum_android_automotive_lens_facing_t = 2 - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT acamera_metadata_enum_android_automotive_lens_facing_t = 3 - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT acamera_metadata_enum_android_automotive_lens_facing_t = 4 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER acamera_metadata_enum_android_automotive_lens_facing_t = 5 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT acamera_metadata_enum_android_automotive_lens_facing_t = 6 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER acamera_metadata_enum_android_automotive_lens_facing_t = 7 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT acamera_metadata_enum_android_automotive_lens_facing_t = 8 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT acamera_metadata_enum_android_automotive_lens_facing_t = 9 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER acamera_metadata_enum_android_automotive_lens_facing_t = 10 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT acamera_metadata_enum_android_automotive_lens_facing_t = 11 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT acamera_metadata_enum_android_automotive_lens_facing_t = 12 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER acamera_metadata_enum_android_automotive_lens_facing_t = 13 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT acamera_metadata_enum_android_automotive_lens_facing_t = 14 -) diff --git a/camera/acamera_metadata_enum_android_automotive_location_t.go b/camera/acamera_metadata_enum_android_automotive_location_t.go deleted file mode 100644 index 17b5867..0000000 --- a/camera/acamera_metadata_enum_android_automotive_location_t.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_automotive_location_t int32 - -const ( - ACAMERA_AUTOMOTIVE_LOCATION_INTERIOR acamera_metadata_enum_android_automotive_location_t = 0 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER acamera_metadata_enum_android_automotive_location_t = 1 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT acamera_metadata_enum_android_automotive_location_t = 2 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_REAR acamera_metadata_enum_android_automotive_location_t = 3 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT acamera_metadata_enum_android_automotive_location_t = 4 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT acamera_metadata_enum_android_automotive_location_t = 5 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_OTHER acamera_metadata_enum_android_automotive_location_t = 6 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_FRONT acamera_metadata_enum_android_automotive_location_t = 7 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_REAR acamera_metadata_enum_android_automotive_location_t = 8 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_LEFT acamera_metadata_enum_android_automotive_location_t = 9 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_RIGHT acamera_metadata_enum_android_automotive_location_t = 10 -) diff --git a/camera/acamera_metadata_enum_android_black_level_lock_t.go b/camera/acamera_metadata_enum_android_black_level_lock_t.go deleted file mode 100644 index 265e133..0000000 --- a/camera/acamera_metadata_enum_android_black_level_lock_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_black_level_lock_t int32 - -const ( - ACAMERA_BLACK_LEVEL_LOCK_OFF acamera_metadata_enum_android_black_level_lock_t = 0 - ACAMERA_BLACK_LEVEL_LOCK_ON acamera_metadata_enum_android_black_level_lock_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_color_correction_aberration_mode_t.go b/camera/acamera_metadata_enum_android_color_correction_aberration_mode_t.go deleted file mode 100644 index 8d76ee0..0000000 --- a/camera/acamera_metadata_enum_android_color_correction_aberration_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_color_correction_aberration_mode_t int32 - -const ( - ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_OFF acamera_metadata_enum_android_color_correction_aberration_mode_t = 0 - ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_FAST acamera_metadata_enum_android_color_correction_aberration_mode_t = 1 - ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY acamera_metadata_enum_android_color_correction_aberration_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_color_correction_mode_t.go b/camera/acamera_metadata_enum_android_color_correction_mode_t.go deleted file mode 100644 index a413101..0000000 --- a/camera/acamera_metadata_enum_android_color_correction_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_color_correction_mode_t int32 - -const ( - ACAMERA_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX acamera_metadata_enum_android_color_correction_mode_t = 0 - ACAMERA_COLOR_CORRECTION_MODE_FAST acamera_metadata_enum_android_color_correction_mode_t = 1 - ACAMERA_COLOR_CORRECTION_MODE_HIGH_QUALITY acamera_metadata_enum_android_color_correction_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_control_ae_antibanding_mode_t.go b/camera/acamera_metadata_enum_android_control_ae_antibanding_mode_t.go deleted file mode 100644 index 5ef76ff..0000000 --- a/camera/acamera_metadata_enum_android_control_ae_antibanding_mode_t.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_ae_antibanding_mode_t int32 - -const ( - ACAMERA_CONTROL_AE_ANTIBANDING_MODE_OFF acamera_metadata_enum_android_control_ae_antibanding_mode_t = 0 - ACAMERA_CONTROL_AE_ANTIBANDING_MODE_50HZ acamera_metadata_enum_android_control_ae_antibanding_mode_t = 1 - ACAMERA_CONTROL_AE_ANTIBANDING_MODE_60HZ acamera_metadata_enum_android_control_ae_antibanding_mode_t = 2 - ACAMERA_CONTROL_AE_ANTIBANDING_MODE_AUTO acamera_metadata_enum_android_control_ae_antibanding_mode_t = 3 -) diff --git a/camera/acamera_metadata_enum_android_control_ae_lock_available_t.go b/camera/acamera_metadata_enum_android_control_ae_lock_available_t.go deleted file mode 100644 index f21d018..0000000 --- a/camera/acamera_metadata_enum_android_control_ae_lock_available_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_ae_lock_available_t int32 - -const ( - ACAMERA_CONTROL_AE_LOCK_AVAILABLE_FALSE acamera_metadata_enum_android_control_ae_lock_available_t = 0 - ACAMERA_CONTROL_AE_LOCK_AVAILABLE_TRUE acamera_metadata_enum_android_control_ae_lock_available_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_ae_lock_t.go b/camera/acamera_metadata_enum_android_control_ae_lock_t.go deleted file mode 100644 index 3c137f1..0000000 --- a/camera/acamera_metadata_enum_android_control_ae_lock_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_ae_lock_t int32 - -const ( - ACAMERA_CONTROL_AE_LOCK_OFF acamera_metadata_enum_android_control_ae_lock_t = 0 - ACAMERA_CONTROL_AE_LOCK_ON acamera_metadata_enum_android_control_ae_lock_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_ae_mode_t.go b/camera/acamera_metadata_enum_android_control_ae_mode_t.go deleted file mode 100644 index 70c5324..0000000 --- a/camera/acamera_metadata_enum_android_control_ae_mode_t.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_ae_mode_t int32 - -const ( - ACAMERA_CONTROL_AE_MODE_OFF acamera_metadata_enum_android_control_ae_mode_t = 0 - ACAMERA_CONTROL_AE_MODE_ON acamera_metadata_enum_android_control_ae_mode_t = 1 - ACAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH acamera_metadata_enum_android_control_ae_mode_t = 2 - ACAMERA_CONTROL_AE_MODE_ON_ALWAYS_FLASH acamera_metadata_enum_android_control_ae_mode_t = 3 - ACAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE acamera_metadata_enum_android_control_ae_mode_t = 4 - ACAMERA_CONTROL_AE_MODE_ON_EXTERNAL_FLASH acamera_metadata_enum_android_control_ae_mode_t = 5 - ACAMERA_CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY acamera_metadata_enum_android_control_ae_mode_t = 6 -) diff --git a/camera/acamera_metadata_enum_android_control_ae_precapture_trigger_t.go b/camera/acamera_metadata_enum_android_control_ae_precapture_trigger_t.go deleted file mode 100644 index 855ad8d..0000000 --- a/camera/acamera_metadata_enum_android_control_ae_precapture_trigger_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_ae_precapture_trigger_t int32 - -const ( - ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE acamera_metadata_enum_android_control_ae_precapture_trigger_t = 0 - ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_START acamera_metadata_enum_android_control_ae_precapture_trigger_t = 1 - ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL acamera_metadata_enum_android_control_ae_precapture_trigger_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_control_ae_state_t.go b/camera/acamera_metadata_enum_android_control_ae_state_t.go deleted file mode 100644 index 9f378d5..0000000 --- a/camera/acamera_metadata_enum_android_control_ae_state_t.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_ae_state_t int32 - -const ( - ACAMERA_CONTROL_AE_STATE_INACTIVE acamera_metadata_enum_android_control_ae_state_t = 0 - ACAMERA_CONTROL_AE_STATE_SEARCHING acamera_metadata_enum_android_control_ae_state_t = 1 - ACAMERA_CONTROL_AE_STATE_CONVERGED acamera_metadata_enum_android_control_ae_state_t = 2 - ACAMERA_CONTROL_AE_STATE_LOCKED acamera_metadata_enum_android_control_ae_state_t = 3 - ACAMERA_CONTROL_AE_STATE_FLASH_REQUIRED acamera_metadata_enum_android_control_ae_state_t = 4 - ACAMERA_CONTROL_AE_STATE_PRECAPTURE acamera_metadata_enum_android_control_ae_state_t = 5 -) diff --git a/camera/acamera_metadata_enum_android_control_af_mode_t.go b/camera/acamera_metadata_enum_android_control_af_mode_t.go deleted file mode 100644 index df90d49..0000000 --- a/camera/acamera_metadata_enum_android_control_af_mode_t.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_af_mode_t int32 - -const ( - ACAMERA_CONTROL_AF_MODE_OFF acamera_metadata_enum_android_control_af_mode_t = 0 - ACAMERA_CONTROL_AF_MODE_AUTO acamera_metadata_enum_android_control_af_mode_t = 1 - ACAMERA_CONTROL_AF_MODE_MACRO acamera_metadata_enum_android_control_af_mode_t = 2 - ACAMERA_CONTROL_AF_MODE_CONTINUOUS_VIDEO acamera_metadata_enum_android_control_af_mode_t = 3 - ACAMERA_CONTROL_AF_MODE_CONTINUOUS_PICTURE acamera_metadata_enum_android_control_af_mode_t = 4 - ACAMERA_CONTROL_AF_MODE_EDOF acamera_metadata_enum_android_control_af_mode_t = 5 -) diff --git a/camera/acamera_metadata_enum_android_control_af_scene_change_t.go b/camera/acamera_metadata_enum_android_control_af_scene_change_t.go deleted file mode 100644 index d0e1cb8..0000000 --- a/camera/acamera_metadata_enum_android_control_af_scene_change_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_af_scene_change_t int32 - -const ( - ACAMERA_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED acamera_metadata_enum_android_control_af_scene_change_t = 0 - ACAMERA_CONTROL_AF_SCENE_CHANGE_DETECTED acamera_metadata_enum_android_control_af_scene_change_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_af_state_t.go b/camera/acamera_metadata_enum_android_control_af_state_t.go deleted file mode 100644 index bfa07e5..0000000 --- a/camera/acamera_metadata_enum_android_control_af_state_t.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_af_state_t int32 - -const ( - ACAMERA_CONTROL_AF_STATE_INACTIVE acamera_metadata_enum_android_control_af_state_t = 0 - ACAMERA_CONTROL_AF_STATE_PASSIVE_SCAN acamera_metadata_enum_android_control_af_state_t = 1 - ACAMERA_CONTROL_AF_STATE_PASSIVE_FOCUSED acamera_metadata_enum_android_control_af_state_t = 2 - ACAMERA_CONTROL_AF_STATE_ACTIVE_SCAN acamera_metadata_enum_android_control_af_state_t = 3 - ACAMERA_CONTROL_AF_STATE_FOCUSED_LOCKED acamera_metadata_enum_android_control_af_state_t = 4 - ACAMERA_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED acamera_metadata_enum_android_control_af_state_t = 5 - ACAMERA_CONTROL_AF_STATE_PASSIVE_UNFOCUSED acamera_metadata_enum_android_control_af_state_t = 6 -) diff --git a/camera/acamera_metadata_enum_android_control_af_trigger_t.go b/camera/acamera_metadata_enum_android_control_af_trigger_t.go deleted file mode 100644 index 80c3f63..0000000 --- a/camera/acamera_metadata_enum_android_control_af_trigger_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_af_trigger_t int32 - -const ( - ACAMERA_CONTROL_AF_TRIGGER_IDLE acamera_metadata_enum_android_control_af_trigger_t = 0 - ACAMERA_CONTROL_AF_TRIGGER_START acamera_metadata_enum_android_control_af_trigger_t = 1 - ACAMERA_CONTROL_AF_TRIGGER_CANCEL acamera_metadata_enum_android_control_af_trigger_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_control_autoframing_available_t.go b/camera/acamera_metadata_enum_android_control_autoframing_available_t.go deleted file mode 100644 index 65982a0..0000000 --- a/camera/acamera_metadata_enum_android_control_autoframing_available_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_autoframing_available_t int32 - -const ( - ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE_FALSE acamera_metadata_enum_android_control_autoframing_available_t = 0 - ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE_TRUE acamera_metadata_enum_android_control_autoframing_available_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_autoframing_state_t.go b/camera/acamera_metadata_enum_android_control_autoframing_state_t.go deleted file mode 100644 index 0eddddf..0000000 --- a/camera/acamera_metadata_enum_android_control_autoframing_state_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_autoframing_state_t int32 - -const ( - ACAMERA_CONTROL_AUTOFRAMING_STATE_INACTIVE acamera_metadata_enum_android_control_autoframing_state_t = 0 - ACAMERA_CONTROL_AUTOFRAMING_STATE_FRAMING acamera_metadata_enum_android_control_autoframing_state_t = 1 - ACAMERA_CONTROL_AUTOFRAMING_STATE_CONVERGED acamera_metadata_enum_android_control_autoframing_state_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_control_autoframing_t.go b/camera/acamera_metadata_enum_android_control_autoframing_t.go deleted file mode 100644 index 9efcf6a..0000000 --- a/camera/acamera_metadata_enum_android_control_autoframing_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_autoframing_t int32 - -const ( - ACAMERA_CONTROL_AUTOFRAMING_OFF acamera_metadata_enum_android_control_autoframing_t = 0 - ACAMERA_CONTROL_AUTOFRAMING_ON acamera_metadata_enum_android_control_autoframing_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_awb_lock_available_t.go b/camera/acamera_metadata_enum_android_control_awb_lock_available_t.go deleted file mode 100644 index eb26987..0000000 --- a/camera/acamera_metadata_enum_android_control_awb_lock_available_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_awb_lock_available_t int32 - -const ( - ACAMERA_CONTROL_AWB_LOCK_AVAILABLE_FALSE acamera_metadata_enum_android_control_awb_lock_available_t = 0 - ACAMERA_CONTROL_AWB_LOCK_AVAILABLE_TRUE acamera_metadata_enum_android_control_awb_lock_available_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_awb_lock_t.go b/camera/acamera_metadata_enum_android_control_awb_lock_t.go deleted file mode 100644 index 20c82c5..0000000 --- a/camera/acamera_metadata_enum_android_control_awb_lock_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_awb_lock_t int32 - -const ( - ACAMERA_CONTROL_AWB_LOCK_OFF acamera_metadata_enum_android_control_awb_lock_t = 0 - ACAMERA_CONTROL_AWB_LOCK_ON acamera_metadata_enum_android_control_awb_lock_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_awb_mode_t.go b/camera/acamera_metadata_enum_android_control_awb_mode_t.go deleted file mode 100644 index a2d5468..0000000 --- a/camera/acamera_metadata_enum_android_control_awb_mode_t.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_awb_mode_t int32 - -const ( - ACAMERA_CONTROL_AWB_MODE_OFF acamera_metadata_enum_android_control_awb_mode_t = 0 - ACAMERA_CONTROL_AWB_MODE_AUTO acamera_metadata_enum_android_control_awb_mode_t = 1 - ACAMERA_CONTROL_AWB_MODE_INCANDESCENT acamera_metadata_enum_android_control_awb_mode_t = 2 - ACAMERA_CONTROL_AWB_MODE_FLUORESCENT acamera_metadata_enum_android_control_awb_mode_t = 3 - ACAMERA_CONTROL_AWB_MODE_WARM_FLUORESCENT acamera_metadata_enum_android_control_awb_mode_t = 4 - ACAMERA_CONTROL_AWB_MODE_DAYLIGHT acamera_metadata_enum_android_control_awb_mode_t = 5 - ACAMERA_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT acamera_metadata_enum_android_control_awb_mode_t = 6 - ACAMERA_CONTROL_AWB_MODE_TWILIGHT acamera_metadata_enum_android_control_awb_mode_t = 7 - ACAMERA_CONTROL_AWB_MODE_SHADE acamera_metadata_enum_android_control_awb_mode_t = 8 -) diff --git a/camera/acamera_metadata_enum_android_control_awb_state_t.go b/camera/acamera_metadata_enum_android_control_awb_state_t.go deleted file mode 100644 index ab97b35..0000000 --- a/camera/acamera_metadata_enum_android_control_awb_state_t.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_awb_state_t int32 - -const ( - ACAMERA_CONTROL_AWB_STATE_INACTIVE acamera_metadata_enum_android_control_awb_state_t = 0 - ACAMERA_CONTROL_AWB_STATE_SEARCHING acamera_metadata_enum_android_control_awb_state_t = 1 - ACAMERA_CONTROL_AWB_STATE_CONVERGED acamera_metadata_enum_android_control_awb_state_t = 2 - ACAMERA_CONTROL_AWB_STATE_LOCKED acamera_metadata_enum_android_control_awb_state_t = 3 -) diff --git a/camera/acamera_metadata_enum_android_control_capture_intent_t.go b/camera/acamera_metadata_enum_android_control_capture_intent_t.go deleted file mode 100644 index 7c998a8..0000000 --- a/camera/acamera_metadata_enum_android_control_capture_intent_t.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_capture_intent_t int32 - -const ( - ACAMERA_CONTROL_CAPTURE_INTENT_CUSTOM acamera_metadata_enum_android_control_capture_intent_t = 0 - ACAMERA_CONTROL_CAPTURE_INTENT_PREVIEW acamera_metadata_enum_android_control_capture_intent_t = 1 - ACAMERA_CONTROL_CAPTURE_INTENT_STILL_CAPTURE acamera_metadata_enum_android_control_capture_intent_t = 2 - ACAMERA_CONTROL_CAPTURE_INTENT_VIDEO_RECORD acamera_metadata_enum_android_control_capture_intent_t = 3 - ACAMERA_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT acamera_metadata_enum_android_control_capture_intent_t = 4 - ACAMERA_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG acamera_metadata_enum_android_control_capture_intent_t = 5 - ACAMERA_CONTROL_CAPTURE_INTENT_MANUAL acamera_metadata_enum_android_control_capture_intent_t = 6 - ACAMERA_CONTROL_CAPTURE_INTENT_MOTION_TRACKING acamera_metadata_enum_android_control_capture_intent_t = 7 -) diff --git a/camera/acamera_metadata_enum_android_control_effect_mode_t.go b/camera/acamera_metadata_enum_android_control_effect_mode_t.go deleted file mode 100644 index d665848..0000000 --- a/camera/acamera_metadata_enum_android_control_effect_mode_t.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_effect_mode_t int32 - -const ( - ACAMERA_CONTROL_EFFECT_MODE_OFF acamera_metadata_enum_android_control_effect_mode_t = 0 - ACAMERA_CONTROL_EFFECT_MODE_MONO acamera_metadata_enum_android_control_effect_mode_t = 1 - ACAMERA_CONTROL_EFFECT_MODE_NEGATIVE acamera_metadata_enum_android_control_effect_mode_t = 2 - ACAMERA_CONTROL_EFFECT_MODE_SOLARIZE acamera_metadata_enum_android_control_effect_mode_t = 3 - ACAMERA_CONTROL_EFFECT_MODE_SEPIA acamera_metadata_enum_android_control_effect_mode_t = 4 - ACAMERA_CONTROL_EFFECT_MODE_POSTERIZE acamera_metadata_enum_android_control_effect_mode_t = 5 - ACAMERA_CONTROL_EFFECT_MODE_WHITEBOARD acamera_metadata_enum_android_control_effect_mode_t = 6 - ACAMERA_CONTROL_EFFECT_MODE_BLACKBOARD acamera_metadata_enum_android_control_effect_mode_t = 7 - ACAMERA_CONTROL_EFFECT_MODE_AQUA acamera_metadata_enum_android_control_effect_mode_t = 8 -) diff --git a/camera/acamera_metadata_enum_android_control_enable_zsl_t.go b/camera/acamera_metadata_enum_android_control_enable_zsl_t.go deleted file mode 100644 index 943fb1e..0000000 --- a/camera/acamera_metadata_enum_android_control_enable_zsl_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_enable_zsl_t int32 - -const ( - ACAMERA_CONTROL_ENABLE_ZSL_FALSE acamera_metadata_enum_android_control_enable_zsl_t = 0 - ACAMERA_CONTROL_ENABLE_ZSL_TRUE acamera_metadata_enum_android_control_enable_zsl_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_extended_scene_mode_t.go b/camera/acamera_metadata_enum_android_control_extended_scene_mode_t.go deleted file mode 100644 index a79acac..0000000 --- a/camera/acamera_metadata_enum_android_control_extended_scene_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_extended_scene_mode_t int32 - -const ( - ACAMERA_CONTROL_EXTENDED_SCENE_MODE_DISABLED acamera_metadata_enum_android_control_extended_scene_mode_t = 0 - ACAMERA_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE acamera_metadata_enum_android_control_extended_scene_mode_t = 1 - ACAMERA_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS acamera_metadata_enum_android_control_extended_scene_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_control_low_light_boost_state_t.go b/camera/acamera_metadata_enum_android_control_low_light_boost_state_t.go deleted file mode 100644 index f3b582b..0000000 --- a/camera/acamera_metadata_enum_android_control_low_light_boost_state_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_low_light_boost_state_t int32 - -const ( - ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE_INACTIVE acamera_metadata_enum_android_control_low_light_boost_state_t = 0 - ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE acamera_metadata_enum_android_control_low_light_boost_state_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_mode_t.go b/camera/acamera_metadata_enum_android_control_mode_t.go deleted file mode 100644 index afd2b87..0000000 --- a/camera/acamera_metadata_enum_android_control_mode_t.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_mode_t int32 - -const ( - ACAMERA_CONTROL_MODE_OFF acamera_metadata_enum_android_control_mode_t = 0 - ACAMERA_CONTROL_MODE_AUTO acamera_metadata_enum_android_control_mode_t = 1 - ACAMERA_CONTROL_MODE_USE_SCENE_MODE acamera_metadata_enum_android_control_mode_t = 2 - ACAMERA_CONTROL_MODE_OFF_KEEP_STATE acamera_metadata_enum_android_control_mode_t = 3 - ACAMERA_CONTROL_MODE_USE_EXTENDED_SCENE_MODE acamera_metadata_enum_android_control_mode_t = 4 -) diff --git a/camera/acamera_metadata_enum_android_control_scene_mode_t.go b/camera/acamera_metadata_enum_android_control_scene_mode_t.go deleted file mode 100644 index a0fae49..0000000 --- a/camera/acamera_metadata_enum_android_control_scene_mode_t.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_scene_mode_t int32 - -const ( - ACAMERA_CONTROL_SCENE_MODE_DISABLED acamera_metadata_enum_android_control_scene_mode_t = 0 - ACAMERA_CONTROL_SCENE_MODE_FACE_PRIORITY acamera_metadata_enum_android_control_scene_mode_t = 1 - ACAMERA_CONTROL_SCENE_MODE_ACTION acamera_metadata_enum_android_control_scene_mode_t = 2 - ACAMERA_CONTROL_SCENE_MODE_PORTRAIT acamera_metadata_enum_android_control_scene_mode_t = 3 - ACAMERA_CONTROL_SCENE_MODE_LANDSCAPE acamera_metadata_enum_android_control_scene_mode_t = 4 - ACAMERA_CONTROL_SCENE_MODE_NIGHT acamera_metadata_enum_android_control_scene_mode_t = 5 - ACAMERA_CONTROL_SCENE_MODE_NIGHT_PORTRAIT acamera_metadata_enum_android_control_scene_mode_t = 6 - ACAMERA_CONTROL_SCENE_MODE_THEATRE acamera_metadata_enum_android_control_scene_mode_t = 7 - ACAMERA_CONTROL_SCENE_MODE_BEACH acamera_metadata_enum_android_control_scene_mode_t = 8 - ACAMERA_CONTROL_SCENE_MODE_SNOW acamera_metadata_enum_android_control_scene_mode_t = 9 - ACAMERA_CONTROL_SCENE_MODE_SUNSET acamera_metadata_enum_android_control_scene_mode_t = 10 - ACAMERA_CONTROL_SCENE_MODE_STEADYPHOTO acamera_metadata_enum_android_control_scene_mode_t = 11 - ACAMERA_CONTROL_SCENE_MODE_FIREWORKS acamera_metadata_enum_android_control_scene_mode_t = 12 - ACAMERA_CONTROL_SCENE_MODE_SPORTS acamera_metadata_enum_android_control_scene_mode_t = 13 - ACAMERA_CONTROL_SCENE_MODE_PARTY acamera_metadata_enum_android_control_scene_mode_t = 14 - ACAMERA_CONTROL_SCENE_MODE_CANDLELIGHT acamera_metadata_enum_android_control_scene_mode_t = 15 - ACAMERA_CONTROL_SCENE_MODE_BARCODE acamera_metadata_enum_android_control_scene_mode_t = 16 - ACAMERA_CONTROL_SCENE_MODE_HDR acamera_metadata_enum_android_control_scene_mode_t = 18 -) diff --git a/camera/acamera_metadata_enum_android_control_settings_override_t.go b/camera/acamera_metadata_enum_android_control_settings_override_t.go deleted file mode 100644 index 0421abb..0000000 --- a/camera/acamera_metadata_enum_android_control_settings_override_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_settings_override_t int32 - -const ( - ACAMERA_CONTROL_SETTINGS_OVERRIDE_OFF acamera_metadata_enum_android_control_settings_override_t = 0 - ACAMERA_CONTROL_SETTINGS_OVERRIDE_ZOOM acamera_metadata_enum_android_control_settings_override_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_control_video_stabilization_mode_t.go b/camera/acamera_metadata_enum_android_control_video_stabilization_mode_t.go deleted file mode 100644 index 39cf4c6..0000000 --- a/camera/acamera_metadata_enum_android_control_video_stabilization_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_control_video_stabilization_mode_t int32 - -const ( - ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_OFF acamera_metadata_enum_android_control_video_stabilization_mode_t = 0 - ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_ON acamera_metadata_enum_android_control_video_stabilization_mode_t = 1 - ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION acamera_metadata_enum_android_control_video_stabilization_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t.go b/camera/acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t.go deleted file mode 100644 index 20fe9ed..0000000 --- a/camera/acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t int32 - -const ( - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t = 0 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_depth_available_depth_stream_configurations_t.go b/camera/acamera_metadata_enum_android_depth_available_depth_stream_configurations_t.go deleted file mode 100644 index 05cd257..0000000 --- a/camera/acamera_metadata_enum_android_depth_available_depth_stream_configurations_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_depth_available_depth_stream_configurations_t int32 - -const ( - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT acamera_metadata_enum_android_depth_available_depth_stream_configurations_t = 0 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT acamera_metadata_enum_android_depth_available_depth_stream_configurations_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t.go b/camera/acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t.go deleted file mode 100644 index 498a4b0..0000000 --- a/camera/acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t int32 - -const ( - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t = 0 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t.go b/camera/acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t.go deleted file mode 100644 index 5d2b856..0000000 --- a/camera/acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t int32 - -const ( - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t = 0 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_depth_depth_is_exclusive_t.go b/camera/acamera_metadata_enum_android_depth_depth_is_exclusive_t.go deleted file mode 100644 index 159d532..0000000 --- a/camera/acamera_metadata_enum_android_depth_depth_is_exclusive_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_depth_depth_is_exclusive_t int32 - -const ( - ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE acamera_metadata_enum_android_depth_depth_is_exclusive_t = 0 - ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE acamera_metadata_enum_android_depth_depth_is_exclusive_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_distortion_correction_mode_t.go b/camera/acamera_metadata_enum_android_distortion_correction_mode_t.go deleted file mode 100644 index 9c3f511..0000000 --- a/camera/acamera_metadata_enum_android_distortion_correction_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_distortion_correction_mode_t int32 - -const ( - ACAMERA_DISTORTION_CORRECTION_MODE_OFF acamera_metadata_enum_android_distortion_correction_mode_t = 0 - ACAMERA_DISTORTION_CORRECTION_MODE_FAST acamera_metadata_enum_android_distortion_correction_mode_t = 1 - ACAMERA_DISTORTION_CORRECTION_MODE_HIGH_QUALITY acamera_metadata_enum_android_distortion_correction_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_edge_mode_t.go b/camera/acamera_metadata_enum_android_edge_mode_t.go deleted file mode 100644 index fa7dac0..0000000 --- a/camera/acamera_metadata_enum_android_edge_mode_t.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_edge_mode_t int32 - -const ( - ACAMERA_EDGE_MODE_OFF acamera_metadata_enum_android_edge_mode_t = 0 - ACAMERA_EDGE_MODE_FAST acamera_metadata_enum_android_edge_mode_t = 1 - ACAMERA_EDGE_MODE_HIGH_QUALITY acamera_metadata_enum_android_edge_mode_t = 2 - ACAMERA_EDGE_MODE_ZERO_SHUTTER_LAG acamera_metadata_enum_android_edge_mode_t = 3 -) diff --git a/camera/acamera_metadata_enum_android_flash_info_available_t.go b/camera/acamera_metadata_enum_android_flash_info_available_t.go deleted file mode 100644 index 48ae755..0000000 --- a/camera/acamera_metadata_enum_android_flash_info_available_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_flash_info_available_t int32 - -const ( - ACAMERA_FLASH_INFO_AVAILABLE_FALSE acamera_metadata_enum_android_flash_info_available_t = 0 - ACAMERA_FLASH_INFO_AVAILABLE_TRUE acamera_metadata_enum_android_flash_info_available_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_flash_mode_t.go b/camera/acamera_metadata_enum_android_flash_mode_t.go deleted file mode 100644 index 44575d1..0000000 --- a/camera/acamera_metadata_enum_android_flash_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_flash_mode_t int32 - -const ( - ACAMERA_FLASH_MODE_OFF acamera_metadata_enum_android_flash_mode_t = 0 - ACAMERA_FLASH_MODE_SINGLE acamera_metadata_enum_android_flash_mode_t = 1 - ACAMERA_FLASH_MODE_TORCH acamera_metadata_enum_android_flash_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_flash_state_t.go b/camera/acamera_metadata_enum_android_flash_state_t.go deleted file mode 100644 index 4d7331e..0000000 --- a/camera/acamera_metadata_enum_android_flash_state_t.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_flash_state_t int32 - -const ( - ACAMERA_FLASH_STATE_UNAVAILABLE acamera_metadata_enum_android_flash_state_t = 0 - ACAMERA_FLASH_STATE_CHARGING acamera_metadata_enum_android_flash_state_t = 1 - ACAMERA_FLASH_STATE_READY acamera_metadata_enum_android_flash_state_t = 2 - ACAMERA_FLASH_STATE_FIRED acamera_metadata_enum_android_flash_state_t = 3 - ACAMERA_FLASH_STATE_PARTIAL acamera_metadata_enum_android_flash_state_t = 4 -) diff --git a/camera/acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t.go b/camera/acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t.go deleted file mode 100644 index 5784477..0000000 --- a/camera/acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t int32 - -const ( - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t = 0 - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_heic_available_heic_stream_configurations_t.go b/camera/acamera_metadata_enum_android_heic_available_heic_stream_configurations_t.go deleted file mode 100644 index 856913f..0000000 --- a/camera/acamera_metadata_enum_android_heic_available_heic_stream_configurations_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_heic_available_heic_stream_configurations_t int32 - -const ( - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT acamera_metadata_enum_android_heic_available_heic_stream_configurations_t = 0 - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT acamera_metadata_enum_android_heic_available_heic_stream_configurations_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_hot_pixel_mode_t.go b/camera/acamera_metadata_enum_android_hot_pixel_mode_t.go deleted file mode 100644 index 7569b59..0000000 --- a/camera/acamera_metadata_enum_android_hot_pixel_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_hot_pixel_mode_t int32 - -const ( - ACAMERA_HOT_PIXEL_MODE_OFF acamera_metadata_enum_android_hot_pixel_mode_t = 0 - ACAMERA_HOT_PIXEL_MODE_FAST acamera_metadata_enum_android_hot_pixel_mode_t = 1 - ACAMERA_HOT_PIXEL_MODE_HIGH_QUALITY acamera_metadata_enum_android_hot_pixel_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_info_supported_hardware_level_t.go b/camera/acamera_metadata_enum_android_info_supported_hardware_level_t.go deleted file mode 100644 index 1f2445b..0000000 --- a/camera/acamera_metadata_enum_android_info_supported_hardware_level_t.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_info_supported_hardware_level_t int32 - -const ( - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED acamera_metadata_enum_android_info_supported_hardware_level_t = 0 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL acamera_metadata_enum_android_info_supported_hardware_level_t = 1 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY acamera_metadata_enum_android_info_supported_hardware_level_t = 2 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_3 acamera_metadata_enum_android_info_supported_hardware_level_t = 3 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL acamera_metadata_enum_android_info_supported_hardware_level_t = 4 -) diff --git a/camera/acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t.go b/camera/acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t.go deleted file mode 100644 index 83d1541..0000000 --- a/camera/acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t int32 - -const ( - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t = 0 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t.go b/camera/acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t.go deleted file mode 100644 index 9c91375..0000000 --- a/camera/acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t int32 - -const ( - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t = 0 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_lens_facing_t.go b/camera/acamera_metadata_enum_android_lens_facing_t.go deleted file mode 100644 index 0331d1f..0000000 --- a/camera/acamera_metadata_enum_android_lens_facing_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_lens_facing_t int32 - -const ( - ACAMERA_LENS_FACING_FRONT acamera_metadata_enum_android_lens_facing_t = 0 - ACAMERA_LENS_FACING_BACK acamera_metadata_enum_android_lens_facing_t = 1 - ACAMERA_LENS_FACING_EXTERNAL acamera_metadata_enum_android_lens_facing_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_lens_info_focus_distance_calibration_t.go b/camera/acamera_metadata_enum_android_lens_info_focus_distance_calibration_t.go deleted file mode 100644 index ff9c05f..0000000 --- a/camera/acamera_metadata_enum_android_lens_info_focus_distance_calibration_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_lens_info_focus_distance_calibration_t int32 - -const ( - ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED acamera_metadata_enum_android_lens_info_focus_distance_calibration_t = 0 - ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE acamera_metadata_enum_android_lens_info_focus_distance_calibration_t = 1 - ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED acamera_metadata_enum_android_lens_info_focus_distance_calibration_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_lens_optical_stabilization_mode_t.go b/camera/acamera_metadata_enum_android_lens_optical_stabilization_mode_t.go deleted file mode 100644 index e4bf0be..0000000 --- a/camera/acamera_metadata_enum_android_lens_optical_stabilization_mode_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_lens_optical_stabilization_mode_t int32 - -const ( - ACAMERA_LENS_OPTICAL_STABILIZATION_MODE_OFF acamera_metadata_enum_android_lens_optical_stabilization_mode_t = 0 - ACAMERA_LENS_OPTICAL_STABILIZATION_MODE_ON acamera_metadata_enum_android_lens_optical_stabilization_mode_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_lens_pose_reference_t.go b/camera/acamera_metadata_enum_android_lens_pose_reference_t.go deleted file mode 100644 index 8b6a4af..0000000 --- a/camera/acamera_metadata_enum_android_lens_pose_reference_t.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_lens_pose_reference_t int32 - -const ( - ACAMERA_LENS_POSE_REFERENCE_PRIMARY_CAMERA acamera_metadata_enum_android_lens_pose_reference_t = 0 - ACAMERA_LENS_POSE_REFERENCE_GYROSCOPE acamera_metadata_enum_android_lens_pose_reference_t = 1 - ACAMERA_LENS_POSE_REFERENCE_UNDEFINED acamera_metadata_enum_android_lens_pose_reference_t = 2 - ACAMERA_LENS_POSE_REFERENCE_AUTOMOTIVE acamera_metadata_enum_android_lens_pose_reference_t = 3 -) diff --git a/camera/acamera_metadata_enum_android_lens_state_t.go b/camera/acamera_metadata_enum_android_lens_state_t.go deleted file mode 100644 index 3b0afd8..0000000 --- a/camera/acamera_metadata_enum_android_lens_state_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_lens_state_t int32 - -const ( - ACAMERA_LENS_STATE_STATIONARY acamera_metadata_enum_android_lens_state_t = 0 - ACAMERA_LENS_STATE_MOVING acamera_metadata_enum_android_lens_state_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t.go b/camera/acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t.go deleted file mode 100644 index 2563dd6..0000000 --- a/camera/acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t int32 - -const ( - ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t = 0 - ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_noise_reduction_mode_t.go b/camera/acamera_metadata_enum_android_noise_reduction_mode_t.go deleted file mode 100644 index 194ec96..0000000 --- a/camera/acamera_metadata_enum_android_noise_reduction_mode_t.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_noise_reduction_mode_t int32 - -const ( - ACAMERA_NOISE_REDUCTION_MODE_OFF acamera_metadata_enum_android_noise_reduction_mode_t = 0 - ACAMERA_NOISE_REDUCTION_MODE_FAST acamera_metadata_enum_android_noise_reduction_mode_t = 1 - ACAMERA_NOISE_REDUCTION_MODE_HIGH_QUALITY acamera_metadata_enum_android_noise_reduction_mode_t = 2 - ACAMERA_NOISE_REDUCTION_MODE_MINIMAL acamera_metadata_enum_android_noise_reduction_mode_t = 3 - ACAMERA_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG acamera_metadata_enum_android_noise_reduction_mode_t = 4 -) diff --git a/camera/acamera_metadata_enum_android_request_available_capabilities_t.go b/camera/acamera_metadata_enum_android_request_available_capabilities_t.go deleted file mode 100644 index 563d951..0000000 --- a/camera/acamera_metadata_enum_android_request_available_capabilities_t.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_request_available_capabilities_t int32 - -const ( - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE acamera_metadata_enum_android_request_available_capabilities_t = 0 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR acamera_metadata_enum_android_request_available_capabilities_t = 1 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING acamera_metadata_enum_android_request_available_capabilities_t = 2 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW acamera_metadata_enum_android_request_available_capabilities_t = 3 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS acamera_metadata_enum_android_request_available_capabilities_t = 5 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE acamera_metadata_enum_android_request_available_capabilities_t = 6 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT acamera_metadata_enum_android_request_available_capabilities_t = 8 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING acamera_metadata_enum_android_request_available_capabilities_t = 10 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA acamera_metadata_enum_android_request_available_capabilities_t = 11 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME acamera_metadata_enum_android_request_available_capabilities_t = 12 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA acamera_metadata_enum_android_request_available_capabilities_t = 13 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA acamera_metadata_enum_android_request_available_capabilities_t = 14 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR acamera_metadata_enum_android_request_available_capabilities_t = 16 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE acamera_metadata_enum_android_request_available_capabilities_t = 19 -) diff --git a/camera/acamera_metadata_enum_android_request_available_color_space_profiles_map_t.go b/camera/acamera_metadata_enum_android_request_available_color_space_profiles_map_t.go deleted file mode 100644 index 7862e77..0000000 --- a/camera/acamera_metadata_enum_android_request_available_color_space_profiles_map_t.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_request_available_color_space_profiles_map_t int32 - -const ( - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED acamera_metadata_enum_android_request_available_color_space_profiles_map_t = -1 - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB acamera_metadata_enum_android_request_available_color_space_profiles_map_t = 0 - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 acamera_metadata_enum_android_request_available_color_space_profiles_map_t = 7 - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020_HLG acamera_metadata_enum_android_request_available_color_space_profiles_map_t = 16 -) diff --git a/camera/acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t.go b/camera/acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t.go deleted file mode 100644 index 294b320..0000000 --- a/camera/acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t int32 - -const ( - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 1 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 2 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 4 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 8 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 16 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 32 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 64 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 128 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 256 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 512 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 1024 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 2048 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 4096 -) diff --git a/camera/acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t.go b/camera/acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t.go deleted file mode 100644 index d2f49f5..0000000 --- a/camera/acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t int32 - -const ( - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 0 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 1 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 2 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 3 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 4 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 5 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 6 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 7 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 8 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END_3_8 acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 9 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 24 -) diff --git a/camera/acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t.go b/camera/acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t.go deleted file mode 100644 index 4a0aff1..0000000 --- a/camera/acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t int32 - -const ( - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t = 0 - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_scaler_available_stream_configurations_t.go b/camera/acamera_metadata_enum_android_scaler_available_stream_configurations_t.go deleted file mode 100644 index 2f48081..0000000 --- a/camera/acamera_metadata_enum_android_scaler_available_stream_configurations_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_scaler_available_stream_configurations_t int32 - -const ( - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT acamera_metadata_enum_android_scaler_available_stream_configurations_t = 0 - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT acamera_metadata_enum_android_scaler_available_stream_configurations_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_scaler_available_stream_use_cases_t.go b/camera/acamera_metadata_enum_android_scaler_available_stream_use_cases_t.go deleted file mode 100644 index 7aaaf31..0000000 --- a/camera/acamera_metadata_enum_android_scaler_available_stream_use_cases_t.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_scaler_available_stream_use_cases_t int32 - -const ( - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 0 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 1 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 2 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 3 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 4 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 5 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 6 -) diff --git a/camera/acamera_metadata_enum_android_scaler_cropping_type_t.go b/camera/acamera_metadata_enum_android_scaler_cropping_type_t.go deleted file mode 100644 index e0eda1e..0000000 --- a/camera/acamera_metadata_enum_android_scaler_cropping_type_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_scaler_cropping_type_t int32 - -const ( - ACAMERA_SCALER_CROPPING_TYPE_CENTER_ONLY acamera_metadata_enum_android_scaler_cropping_type_t = 0 - ACAMERA_SCALER_CROPPING_TYPE_FREEFORM acamera_metadata_enum_android_scaler_cropping_type_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t.go b/camera/acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t.go deleted file mode 100644 index 05de8d5..0000000 --- a/camera/acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t int32 - -const ( - ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t = 0 - ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t.go b/camera/acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t.go deleted file mode 100644 index 0beb045..0000000 --- a/camera/acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t int32 - -const ( - ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t = 0 - ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_scaler_rotate_and_crop_t.go b/camera/acamera_metadata_enum_android_scaler_rotate_and_crop_t.go deleted file mode 100644 index ea2e507..0000000 --- a/camera/acamera_metadata_enum_android_scaler_rotate_and_crop_t.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_scaler_rotate_and_crop_t int32 - -const ( - ACAMERA_SCALER_ROTATE_AND_CROP_NONE acamera_metadata_enum_android_scaler_rotate_and_crop_t = 0 - ACAMERA_SCALER_ROTATE_AND_CROP_90 acamera_metadata_enum_android_scaler_rotate_and_crop_t = 1 - ACAMERA_SCALER_ROTATE_AND_CROP_180 acamera_metadata_enum_android_scaler_rotate_and_crop_t = 2 - ACAMERA_SCALER_ROTATE_AND_CROP_270 acamera_metadata_enum_android_scaler_rotate_and_crop_t = 3 - ACAMERA_SCALER_ROTATE_AND_CROP_AUTO acamera_metadata_enum_android_scaler_rotate_and_crop_t = 4 -) diff --git a/camera/acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t.go b/camera/acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t.go deleted file mode 100644 index 867c653..0000000 --- a/camera/acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t int32 - -const ( - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 0 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 1 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 2 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 3 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 4 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 5 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 6 -) diff --git a/camera/acamera_metadata_enum_android_sensor_info_lens_shading_applied_t.go b/camera/acamera_metadata_enum_android_sensor_info_lens_shading_applied_t.go deleted file mode 100644 index eeb0612..0000000 --- a/camera/acamera_metadata_enum_android_sensor_info_lens_shading_applied_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sensor_info_lens_shading_applied_t int32 - -const ( - ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE acamera_metadata_enum_android_sensor_info_lens_shading_applied_t = 0 - ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE acamera_metadata_enum_android_sensor_info_lens_shading_applied_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_sensor_info_timestamp_source_t.go b/camera/acamera_metadata_enum_android_sensor_info_timestamp_source_t.go deleted file mode 100644 index f941ec8..0000000 --- a/camera/acamera_metadata_enum_android_sensor_info_timestamp_source_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sensor_info_timestamp_source_t int32 - -const ( - ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN acamera_metadata_enum_android_sensor_info_timestamp_source_t = 0 - ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME acamera_metadata_enum_android_sensor_info_timestamp_source_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_sensor_pixel_mode_t.go b/camera/acamera_metadata_enum_android_sensor_pixel_mode_t.go deleted file mode 100644 index 4938174..0000000 --- a/camera/acamera_metadata_enum_android_sensor_pixel_mode_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sensor_pixel_mode_t int32 - -const ( - ACAMERA_SENSOR_PIXEL_MODE_DEFAULT acamera_metadata_enum_android_sensor_pixel_mode_t = 0 - ACAMERA_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION acamera_metadata_enum_android_sensor_pixel_mode_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_sensor_raw_binning_factor_used_t.go b/camera/acamera_metadata_enum_android_sensor_raw_binning_factor_used_t.go deleted file mode 100644 index 8f98f0f..0000000 --- a/camera/acamera_metadata_enum_android_sensor_raw_binning_factor_used_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sensor_raw_binning_factor_used_t int32 - -const ( - ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED_TRUE acamera_metadata_enum_android_sensor_raw_binning_factor_used_t = 0 - ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED_FALSE acamera_metadata_enum_android_sensor_raw_binning_factor_used_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_sensor_reference_illuminant1_t.go b/camera/acamera_metadata_enum_android_sensor_reference_illuminant1_t.go deleted file mode 100644 index 70bcc1c..0000000 --- a/camera/acamera_metadata_enum_android_sensor_reference_illuminant1_t.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sensor_reference_illuminant1_t int32 - -const ( - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT acamera_metadata_enum_android_sensor_reference_illuminant1_t = 1 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT acamera_metadata_enum_android_sensor_reference_illuminant1_t = 2 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN acamera_metadata_enum_android_sensor_reference_illuminant1_t = 3 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FLASH acamera_metadata_enum_android_sensor_reference_illuminant1_t = 4 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER acamera_metadata_enum_android_sensor_reference_illuminant1_t = 9 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER acamera_metadata_enum_android_sensor_reference_illuminant1_t = 10 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_SHADE acamera_metadata_enum_android_sensor_reference_illuminant1_t = 11 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT acamera_metadata_enum_android_sensor_reference_illuminant1_t = 12 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT acamera_metadata_enum_android_sensor_reference_illuminant1_t = 13 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT acamera_metadata_enum_android_sensor_reference_illuminant1_t = 14 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT acamera_metadata_enum_android_sensor_reference_illuminant1_t = 15 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A acamera_metadata_enum_android_sensor_reference_illuminant1_t = 17 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B acamera_metadata_enum_android_sensor_reference_illuminant1_t = 18 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C acamera_metadata_enum_android_sensor_reference_illuminant1_t = 19 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D55 acamera_metadata_enum_android_sensor_reference_illuminant1_t = 20 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D65 acamera_metadata_enum_android_sensor_reference_illuminant1_t = 21 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D75 acamera_metadata_enum_android_sensor_reference_illuminant1_t = 22 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D50 acamera_metadata_enum_android_sensor_reference_illuminant1_t = 23 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN acamera_metadata_enum_android_sensor_reference_illuminant1_t = 24 -) diff --git a/camera/acamera_metadata_enum_android_sensor_test_pattern_mode_t.go b/camera/acamera_metadata_enum_android_sensor_test_pattern_mode_t.go deleted file mode 100644 index ad1bc24..0000000 --- a/camera/acamera_metadata_enum_android_sensor_test_pattern_mode_t.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sensor_test_pattern_mode_t int32 - -const ( - ACAMERA_SENSOR_TEST_PATTERN_MODE_OFF acamera_metadata_enum_android_sensor_test_pattern_mode_t = 0 - ACAMERA_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR acamera_metadata_enum_android_sensor_test_pattern_mode_t = 1 - ACAMERA_SENSOR_TEST_PATTERN_MODE_COLOR_BARS acamera_metadata_enum_android_sensor_test_pattern_mode_t = 2 - ACAMERA_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY acamera_metadata_enum_android_sensor_test_pattern_mode_t = 3 - ACAMERA_SENSOR_TEST_PATTERN_MODE_PN9 acamera_metadata_enum_android_sensor_test_pattern_mode_t = 4 - ACAMERA_SENSOR_TEST_PATTERN_MODE_CUSTOM1 acamera_metadata_enum_android_sensor_test_pattern_mode_t = 256 -) diff --git a/camera/acamera_metadata_enum_android_shading_mode_t.go b/camera/acamera_metadata_enum_android_shading_mode_t.go deleted file mode 100644 index 99f7239..0000000 --- a/camera/acamera_metadata_enum_android_shading_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_shading_mode_t int32 - -const ( - ACAMERA_SHADING_MODE_OFF acamera_metadata_enum_android_shading_mode_t = 0 - ACAMERA_SHADING_MODE_FAST acamera_metadata_enum_android_shading_mode_t = 1 - ACAMERA_SHADING_MODE_HIGH_QUALITY acamera_metadata_enum_android_shading_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_statistics_face_detect_mode_t.go b/camera/acamera_metadata_enum_android_statistics_face_detect_mode_t.go deleted file mode 100644 index 4c48290..0000000 --- a/camera/acamera_metadata_enum_android_statistics_face_detect_mode_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_statistics_face_detect_mode_t int32 - -const ( - ACAMERA_STATISTICS_FACE_DETECT_MODE_OFF acamera_metadata_enum_android_statistics_face_detect_mode_t = 0 - ACAMERA_STATISTICS_FACE_DETECT_MODE_SIMPLE acamera_metadata_enum_android_statistics_face_detect_mode_t = 1 - ACAMERA_STATISTICS_FACE_DETECT_MODE_FULL acamera_metadata_enum_android_statistics_face_detect_mode_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t.go b/camera/acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t.go deleted file mode 100644 index 66f306e..0000000 --- a/camera/acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t int32 - -const ( - ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE_OFF acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t = 0 - ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE_ON acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_statistics_lens_shading_map_mode_t.go b/camera/acamera_metadata_enum_android_statistics_lens_shading_map_mode_t.go deleted file mode 100644 index 87a7aa0..0000000 --- a/camera/acamera_metadata_enum_android_statistics_lens_shading_map_mode_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_statistics_lens_shading_map_mode_t int32 - -const ( - ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE_OFF acamera_metadata_enum_android_statistics_lens_shading_map_mode_t = 0 - ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE_ON acamera_metadata_enum_android_statistics_lens_shading_map_mode_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_statistics_ois_data_mode_t.go b/camera/acamera_metadata_enum_android_statistics_ois_data_mode_t.go deleted file mode 100644 index ed8cdb1..0000000 --- a/camera/acamera_metadata_enum_android_statistics_ois_data_mode_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_statistics_ois_data_mode_t int32 - -const ( - ACAMERA_STATISTICS_OIS_DATA_MODE_OFF acamera_metadata_enum_android_statistics_ois_data_mode_t = 0 - ACAMERA_STATISTICS_OIS_DATA_MODE_ON acamera_metadata_enum_android_statistics_ois_data_mode_t = 1 -) diff --git a/camera/acamera_metadata_enum_android_statistics_scene_flicker_t.go b/camera/acamera_metadata_enum_android_statistics_scene_flicker_t.go deleted file mode 100644 index 4bd5ff7..0000000 --- a/camera/acamera_metadata_enum_android_statistics_scene_flicker_t.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_statistics_scene_flicker_t int32 - -const ( - ACAMERA_STATISTICS_SCENE_FLICKER_NONE acamera_metadata_enum_android_statistics_scene_flicker_t = 0 - ACAMERA_STATISTICS_SCENE_FLICKER_50HZ acamera_metadata_enum_android_statistics_scene_flicker_t = 1 - ACAMERA_STATISTICS_SCENE_FLICKER_60HZ acamera_metadata_enum_android_statistics_scene_flicker_t = 2 -) diff --git a/camera/acamera_metadata_enum_android_sync_frame_number_t.go b/camera/acamera_metadata_enum_android_sync_frame_number_t.go deleted file mode 100644 index 1c9fd26..0000000 --- a/camera/acamera_metadata_enum_android_sync_frame_number_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sync_frame_number_t int32 - -const ( - ACAMERA_SYNC_FRAME_NUMBER_CONVERGING acamera_metadata_enum_android_sync_frame_number_t = -1 - ACAMERA_SYNC_FRAME_NUMBER_UNKNOWN acamera_metadata_enum_android_sync_frame_number_t = -2 -) diff --git a/camera/acamera_metadata_enum_android_sync_max_latency_t.go b/camera/acamera_metadata_enum_android_sync_max_latency_t.go deleted file mode 100644 index 05d0201..0000000 --- a/camera/acamera_metadata_enum_android_sync_max_latency_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_sync_max_latency_t int32 - -const ( - ACAMERA_SYNC_MAX_LATENCY_PER_FRAME_CONTROL acamera_metadata_enum_android_sync_max_latency_t = 0 - ACAMERA_SYNC_MAX_LATENCY_UNKNOWN acamera_metadata_enum_android_sync_max_latency_t = -1 -) diff --git a/camera/acamera_metadata_enum_android_tonemap_mode_t.go b/camera/acamera_metadata_enum_android_tonemap_mode_t.go deleted file mode 100644 index 28d0254..0000000 --- a/camera/acamera_metadata_enum_android_tonemap_mode_t.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_tonemap_mode_t int32 - -const ( - ACAMERA_TONEMAP_MODE_CONTRAST_CURVE acamera_metadata_enum_android_tonemap_mode_t = 0 - ACAMERA_TONEMAP_MODE_FAST acamera_metadata_enum_android_tonemap_mode_t = 1 - ACAMERA_TONEMAP_MODE_HIGH_QUALITY acamera_metadata_enum_android_tonemap_mode_t = 2 - ACAMERA_TONEMAP_MODE_GAMMA_VALUE acamera_metadata_enum_android_tonemap_mode_t = 3 - ACAMERA_TONEMAP_MODE_PRESET_CURVE acamera_metadata_enum_android_tonemap_mode_t = 4 -) diff --git a/camera/acamera_metadata_enum_android_tonemap_preset_curve_t.go b/camera/acamera_metadata_enum_android_tonemap_preset_curve_t.go deleted file mode 100644 index 86be30a..0000000 --- a/camera/acamera_metadata_enum_android_tonemap_preset_curve_t.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_enum_android_tonemap_preset_curve_t int32 - -const ( - ACAMERA_TONEMAP_PRESET_CURVE_SRGB acamera_metadata_enum_android_tonemap_preset_curve_t = 0 - ACAMERA_TONEMAP_PRESET_CURVE_REC709 acamera_metadata_enum_android_tonemap_preset_curve_t = 1 -) diff --git a/camera/acamera_metadata_section_start_t.go b/camera/acamera_metadata_section_start_t.go deleted file mode 100644 index 9f2f1fa..0000000 --- a/camera/acamera_metadata_section_start_t.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_section_start_t int32 - -const ( - ACAMERA_COLOR_CORRECTION_START acamera_metadata_section_start_t = 0 - ACAMERA_CONTROL_START acamera_metadata_section_start_t = 65536 - ACAMERA_DEMOSAIC_START acamera_metadata_section_start_t = 131072 - ACAMERA_EDGE_START acamera_metadata_section_start_t = 196608 - ACAMERA_FLASH_START acamera_metadata_section_start_t = 262144 - ACAMERA_FLASH_INFO_START acamera_metadata_section_start_t = 327680 - ACAMERA_HOT_PIXEL_START acamera_metadata_section_start_t = 393216 - ACAMERA_JPEG_START acamera_metadata_section_start_t = 458752 - ACAMERA_LENS_START acamera_metadata_section_start_t = 524288 - ACAMERA_LENS_INFO_START acamera_metadata_section_start_t = 589824 - ACAMERA_NOISE_REDUCTION_START acamera_metadata_section_start_t = 655360 - ACAMERA_QUIRKS_START acamera_metadata_section_start_t = 720896 - ACAMERA_REQUEST_START acamera_metadata_section_start_t = 786432 - ACAMERA_SCALER_START acamera_metadata_section_start_t = 851968 - ACAMERA_SENSOR_START acamera_metadata_section_start_t = 917504 - ACAMERA_SENSOR_INFO_START acamera_metadata_section_start_t = 983040 - ACAMERA_SHADING_START acamera_metadata_section_start_t = 1048576 - ACAMERA_STATISTICS_START acamera_metadata_section_start_t = 1114112 - ACAMERA_STATISTICS_INFO_START acamera_metadata_section_start_t = 1179648 - ACAMERA_TONEMAP_START acamera_metadata_section_start_t = 1245184 - ACAMERA_LED_START acamera_metadata_section_start_t = 1310720 - ACAMERA_INFO_START acamera_metadata_section_start_t = 1376256 - ACAMERA_BLACK_LEVEL_START acamera_metadata_section_start_t = 1441792 - ACAMERA_SYNC_START acamera_metadata_section_start_t = 1507328 - ACAMERA_REPROCESS_START acamera_metadata_section_start_t = 1572864 - ACAMERA_DEPTH_START acamera_metadata_section_start_t = 1638400 - ACAMERA_LOGICAL_MULTI_CAMERA_START acamera_metadata_section_start_t = 1703936 - ACAMERA_DISTORTION_CORRECTION_START acamera_metadata_section_start_t = 1769472 - ACAMERA_HEIC_START acamera_metadata_section_start_t = 1835008 - ACAMERA_HEIC_INFO_START acamera_metadata_section_start_t = 1900544 - ACAMERA_AUTOMOTIVE_START acamera_metadata_section_start_t = 1966080 - ACAMERA_AUTOMOTIVE_LENS_START acamera_metadata_section_start_t = 2031616 - ACAMERA_EXTENSION_START acamera_metadata_section_start_t = 2097152 - ACAMERA_JPEGR_START acamera_metadata_section_start_t = 2162688 - ACAMERA_VENDOR_START acamera_metadata_section_start_t = -2147483648 -) diff --git a/camera/acamera_metadata_section_t.go b/camera/acamera_metadata_section_t.go deleted file mode 100644 index 9a56cad..0000000 --- a/camera/acamera_metadata_section_t.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_section_t int32 - -const ( - ACAMERA_COLOR_CORRECTION acamera_metadata_section_t = 0 - ACAMERA_CONTROL acamera_metadata_section_t = 1 - ACAMERA_DEMOSAIC acamera_metadata_section_t = 2 - ACAMERA_EDGE acamera_metadata_section_t = 3 - ACAMERA_FLASH acamera_metadata_section_t = 4 - ACAMERA_FLASH_INFO acamera_metadata_section_t = 5 - ACAMERA_HOT_PIXEL acamera_metadata_section_t = 6 - ACAMERA_JPEG acamera_metadata_section_t = 7 - ACAMERA_LENS acamera_metadata_section_t = 8 - ACAMERA_LENS_INFO acamera_metadata_section_t = 9 - ACAMERA_NOISE_REDUCTION acamera_metadata_section_t = 10 - ACAMERA_QUIRKS acamera_metadata_section_t = 11 - ACAMERA_REQUEST acamera_metadata_section_t = 12 - ACAMERA_SCALER acamera_metadata_section_t = 13 - ACAMERA_SENSOR acamera_metadata_section_t = 14 - ACAMERA_SENSOR_INFO acamera_metadata_section_t = 15 - ACAMERA_SHADING acamera_metadata_section_t = 16 - ACAMERA_STATISTICS acamera_metadata_section_t = 17 - ACAMERA_STATISTICS_INFO acamera_metadata_section_t = 18 - ACAMERA_TONEMAP acamera_metadata_section_t = 19 - ACAMERA_LED acamera_metadata_section_t = 20 - ACAMERA_INFO acamera_metadata_section_t = 21 - ACAMERA_BLACK_LEVEL acamera_metadata_section_t = 22 - ACAMERA_SYNC acamera_metadata_section_t = 23 - ACAMERA_REPROCESS acamera_metadata_section_t = 24 - ACAMERA_DEPTH acamera_metadata_section_t = 25 - ACAMERA_LOGICAL_MULTI_CAMERA acamera_metadata_section_t = 26 - ACAMERA_DISTORTION_CORRECTION acamera_metadata_section_t = 27 - ACAMERA_HEIC acamera_metadata_section_t = 28 - ACAMERA_HEIC_INFO acamera_metadata_section_t = 29 - ACAMERA_AUTOMOTIVE acamera_metadata_section_t = 30 - ACAMERA_AUTOMOTIVE_LENS acamera_metadata_section_t = 31 - ACAMERA_EXTENSION acamera_metadata_section_t = 32 - ACAMERA_JPEGR acamera_metadata_section_t = 33 - ACAMERA_SECTION_COUNT acamera_metadata_section_t = 34 - ACAMERA_VENDOR acamera_metadata_section_t = 32768 -) diff --git a/camera/acamera_metadata_tag_t.go b/camera/acamera_metadata_tag_t.go deleted file mode 100644 index 0a8e949..0000000 --- a/camera/acamera_metadata_tag_t.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type acamera_metadata_tag_t int32 - -const ( - ACAMERA_COLOR_CORRECTION_MODE acamera_metadata_tag_t = 0 - ACAMERA_COLOR_CORRECTION_TRANSFORM acamera_metadata_tag_t = 1 - ACAMERA_COLOR_CORRECTION_GAINS acamera_metadata_tag_t = 2 - ACAMERA_COLOR_CORRECTION_ABERRATION_MODE acamera_metadata_tag_t = 3 - ACAMERA_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES acamera_metadata_tag_t = 4 - ACAMERA_COLOR_CORRECTION_END acamera_metadata_tag_t = 5 - ACAMERA_CONTROL_AE_ANTIBANDING_MODE acamera_metadata_tag_t = 65536 - ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION acamera_metadata_tag_t = 65537 - ACAMERA_CONTROL_AE_LOCK acamera_metadata_tag_t = 65538 - ACAMERA_CONTROL_AE_MODE acamera_metadata_tag_t = 65539 - ACAMERA_CONTROL_AE_REGIONS acamera_metadata_tag_t = 65540 - ACAMERA_CONTROL_AE_TARGET_FPS_RANGE acamera_metadata_tag_t = 65541 - ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER acamera_metadata_tag_t = 65542 - ACAMERA_CONTROL_AF_MODE acamera_metadata_tag_t = 65543 - ACAMERA_CONTROL_AF_REGIONS acamera_metadata_tag_t = 65544 - ACAMERA_CONTROL_AF_TRIGGER acamera_metadata_tag_t = 65545 - ACAMERA_CONTROL_AWB_LOCK acamera_metadata_tag_t = 65546 - ACAMERA_CONTROL_AWB_MODE acamera_metadata_tag_t = 65547 - ACAMERA_CONTROL_AWB_REGIONS acamera_metadata_tag_t = 65548 - ACAMERA_CONTROL_CAPTURE_INTENT acamera_metadata_tag_t = 65549 - ACAMERA_CONTROL_EFFECT_MODE acamera_metadata_tag_t = 65550 - ACAMERA_CONTROL_MODE acamera_metadata_tag_t = 65551 - ACAMERA_CONTROL_SCENE_MODE acamera_metadata_tag_t = 65552 - ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE acamera_metadata_tag_t = 65553 - ACAMERA_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES acamera_metadata_tag_t = 65554 - ACAMERA_CONTROL_AE_AVAILABLE_MODES acamera_metadata_tag_t = 65555 - ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES acamera_metadata_tag_t = 65556 - ACAMERA_CONTROL_AE_COMPENSATION_RANGE acamera_metadata_tag_t = 65557 - ACAMERA_CONTROL_AE_COMPENSATION_STEP acamera_metadata_tag_t = 65558 - ACAMERA_CONTROL_AF_AVAILABLE_MODES acamera_metadata_tag_t = 65559 - ACAMERA_CONTROL_AVAILABLE_EFFECTS acamera_metadata_tag_t = 65560 - ACAMERA_CONTROL_AVAILABLE_SCENE_MODES acamera_metadata_tag_t = 65561 - ACAMERA_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES acamera_metadata_tag_t = 65562 - ACAMERA_CONTROL_AWB_AVAILABLE_MODES acamera_metadata_tag_t = 65563 - ACAMERA_CONTROL_MAX_REGIONS acamera_metadata_tag_t = 65564 - ACAMERA_CONTROL_AE_STATE acamera_metadata_tag_t = 65567 - ACAMERA_CONTROL_AF_STATE acamera_metadata_tag_t = 65568 - ACAMERA_CONTROL_AWB_STATE acamera_metadata_tag_t = 65570 - ACAMERA_CONTROL_AE_LOCK_AVAILABLE acamera_metadata_tag_t = 65572 - ACAMERA_CONTROL_AWB_LOCK_AVAILABLE acamera_metadata_tag_t = 65573 - ACAMERA_CONTROL_AVAILABLE_MODES acamera_metadata_tag_t = 65574 - ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE acamera_metadata_tag_t = 65575 - ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST acamera_metadata_tag_t = 65576 - ACAMERA_CONTROL_ENABLE_ZSL acamera_metadata_tag_t = 65577 - ACAMERA_CONTROL_AF_SCENE_CHANGE acamera_metadata_tag_t = 65578 - ACAMERA_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES acamera_metadata_tag_t = 65579 - ACAMERA_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES acamera_metadata_tag_t = 65580 - ACAMERA_CONTROL_EXTENDED_SCENE_MODE acamera_metadata_tag_t = 65581 - ACAMERA_CONTROL_ZOOM_RATIO_RANGE acamera_metadata_tag_t = 65582 - ACAMERA_CONTROL_ZOOM_RATIO acamera_metadata_tag_t = 65583 - ACAMERA_CONTROL_SETTINGS_OVERRIDE acamera_metadata_tag_t = 65588 - ACAMERA_CONTROL_AVAILABLE_SETTINGS_OVERRIDES acamera_metadata_tag_t = 65589 - ACAMERA_CONTROL_AUTOFRAMING acamera_metadata_tag_t = 65591 - ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE acamera_metadata_tag_t = 65592 - ACAMERA_CONTROL_AUTOFRAMING_STATE acamera_metadata_tag_t = 65593 - ACAMERA_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE acamera_metadata_tag_t = 65594 - ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE acamera_metadata_tag_t = 65595 - ACAMERA_CONTROL_END acamera_metadata_tag_t = 65596 - ACAMERA_EDGE_MODE acamera_metadata_tag_t = 196608 - ACAMERA_EDGE_AVAILABLE_EDGE_MODES acamera_metadata_tag_t = 196610 - ACAMERA_EDGE_END acamera_metadata_tag_t = 196611 - ACAMERA_FLASH_MODE acamera_metadata_tag_t = 262146 - ACAMERA_FLASH_STATE acamera_metadata_tag_t = 262149 - ACAMERA_FLASH_STRENGTH_LEVEL acamera_metadata_tag_t = 262150 - ACAMERA_FLASH_SINGLE_STRENGTH_MAX_LEVEL acamera_metadata_tag_t = 262151 - ACAMERA_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL acamera_metadata_tag_t = 262152 - ACAMERA_FLASH_TORCH_STRENGTH_MAX_LEVEL acamera_metadata_tag_t = 262153 - ACAMERA_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL acamera_metadata_tag_t = 262154 - ACAMERA_FLASH_END acamera_metadata_tag_t = 262155 - ACAMERA_FLASH_INFO_AVAILABLE acamera_metadata_tag_t = 327680 - ACAMERA_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL acamera_metadata_tag_t = 327682 - ACAMERA_FLASH_INFO_STRENGTH_DEFAULT_LEVEL acamera_metadata_tag_t = 327683 - ACAMERA_FLASH_INFO_END acamera_metadata_tag_t = 327684 - ACAMERA_HOT_PIXEL_MODE acamera_metadata_tag_t = 393216 - ACAMERA_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES acamera_metadata_tag_t = 393217 - ACAMERA_HOT_PIXEL_END acamera_metadata_tag_t = 393218 - ACAMERA_JPEG_GPS_COORDINATES acamera_metadata_tag_t = 458752 - ACAMERA_JPEG_GPS_PROCESSING_METHOD acamera_metadata_tag_t = 458753 - ACAMERA_JPEG_GPS_TIMESTAMP acamera_metadata_tag_t = 458754 - ACAMERA_JPEG_ORIENTATION acamera_metadata_tag_t = 458755 - ACAMERA_JPEG_QUALITY acamera_metadata_tag_t = 458756 - ACAMERA_JPEG_THUMBNAIL_QUALITY acamera_metadata_tag_t = 458757 - ACAMERA_JPEG_THUMBNAIL_SIZE acamera_metadata_tag_t = 458758 - ACAMERA_JPEG_AVAILABLE_THUMBNAIL_SIZES acamera_metadata_tag_t = 458759 - ACAMERA_JPEG_END acamera_metadata_tag_t = 458760 - ACAMERA_LENS_APERTURE acamera_metadata_tag_t = 524288 - ACAMERA_LENS_FILTER_DENSITY acamera_metadata_tag_t = 524289 - ACAMERA_LENS_FOCAL_LENGTH acamera_metadata_tag_t = 524290 - ACAMERA_LENS_FOCUS_DISTANCE acamera_metadata_tag_t = 524291 - ACAMERA_LENS_OPTICAL_STABILIZATION_MODE acamera_metadata_tag_t = 524292 - ACAMERA_LENS_FACING acamera_metadata_tag_t = 524293 - ACAMERA_LENS_POSE_ROTATION acamera_metadata_tag_t = 524294 - ACAMERA_LENS_POSE_TRANSLATION acamera_metadata_tag_t = 524295 - ACAMERA_LENS_FOCUS_RANGE acamera_metadata_tag_t = 524296 - ACAMERA_LENS_STATE acamera_metadata_tag_t = 524297 - ACAMERA_LENS_INTRINSIC_CALIBRATION acamera_metadata_tag_t = 524298 - ACAMERA_LENS_RADIAL_DISTORTION acamera_metadata_tag_t = 524299 - ACAMERA_LENS_POSE_REFERENCE acamera_metadata_tag_t = 524300 - ACAMERA_LENS_DISTORTION acamera_metadata_tag_t = 524301 - ACAMERA_LENS_DISTORTION_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 524302 - ACAMERA_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 524303 - ACAMERA_LENS_END acamera_metadata_tag_t = 524304 - ACAMERA_LENS_INFO_AVAILABLE_APERTURES acamera_metadata_tag_t = 589824 - ACAMERA_LENS_INFO_AVAILABLE_FILTER_DENSITIES acamera_metadata_tag_t = 589825 - ACAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS acamera_metadata_tag_t = 589826 - ACAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION acamera_metadata_tag_t = 589827 - ACAMERA_LENS_INFO_HYPERFOCAL_DISTANCE acamera_metadata_tag_t = 589828 - ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE acamera_metadata_tag_t = 589829 - ACAMERA_LENS_INFO_SHADING_MAP_SIZE acamera_metadata_tag_t = 589830 - ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION acamera_metadata_tag_t = 589831 - ACAMERA_LENS_INFO_END acamera_metadata_tag_t = 589832 - ACAMERA_NOISE_REDUCTION_MODE acamera_metadata_tag_t = 655360 - ACAMERA_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES acamera_metadata_tag_t = 655362 - ACAMERA_NOISE_REDUCTION_END acamera_metadata_tag_t = 655363 - ACAMERA_REQUEST_MAX_NUM_OUTPUT_STREAMS acamera_metadata_tag_t = 786438 - ACAMERA_REQUEST_PIPELINE_DEPTH acamera_metadata_tag_t = 786441 - ACAMERA_REQUEST_PIPELINE_MAX_DEPTH acamera_metadata_tag_t = 786442 - ACAMERA_REQUEST_PARTIAL_RESULT_COUNT acamera_metadata_tag_t = 786443 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES acamera_metadata_tag_t = 786444 - ACAMERA_REQUEST_AVAILABLE_REQUEST_KEYS acamera_metadata_tag_t = 786445 - ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS acamera_metadata_tag_t = 786446 - ACAMERA_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS acamera_metadata_tag_t = 786447 - ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS acamera_metadata_tag_t = 786448 - ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS acamera_metadata_tag_t = 786449 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP acamera_metadata_tag_t = 786451 - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP acamera_metadata_tag_t = 786453 - ACAMERA_REQUEST_END acamera_metadata_tag_t = 786454 - ACAMERA_SCALER_CROP_REGION acamera_metadata_tag_t = 851968 - ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM acamera_metadata_tag_t = 851972 - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS acamera_metadata_tag_t = 851978 - ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS acamera_metadata_tag_t = 851979 - ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS acamera_metadata_tag_t = 851980 - ACAMERA_SCALER_CROPPING_TYPE acamera_metadata_tag_t = 851981 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS acamera_metadata_tag_t = 851982 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP acamera_metadata_tag_t = 851983 - ACAMERA_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES acamera_metadata_tag_t = 851984 - ACAMERA_SCALER_ROTATE_AND_CROP acamera_metadata_tag_t = 851985 - ACAMERA_SCALER_DEFAULT_SECURE_IMAGE_SIZE acamera_metadata_tag_t = 851986 - ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS acamera_metadata_tag_t = 851987 - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 851988 - ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 851989 - ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 851990 - ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED acamera_metadata_tag_t = 851992 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES acamera_metadata_tag_t = 851994 - ACAMERA_SCALER_RAW_CROP_REGION acamera_metadata_tag_t = 851995 - ACAMERA_SCALER_END acamera_metadata_tag_t = 851996 - ACAMERA_SENSOR_EXPOSURE_TIME acamera_metadata_tag_t = 917504 - ACAMERA_SENSOR_FRAME_DURATION acamera_metadata_tag_t = 917505 - ACAMERA_SENSOR_SENSITIVITY acamera_metadata_tag_t = 917506 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 acamera_metadata_tag_t = 917507 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 acamera_metadata_tag_t = 917508 - ACAMERA_SENSOR_CALIBRATION_TRANSFORM1 acamera_metadata_tag_t = 917509 - ACAMERA_SENSOR_CALIBRATION_TRANSFORM2 acamera_metadata_tag_t = 917510 - ACAMERA_SENSOR_COLOR_TRANSFORM1 acamera_metadata_tag_t = 917511 - ACAMERA_SENSOR_COLOR_TRANSFORM2 acamera_metadata_tag_t = 917512 - ACAMERA_SENSOR_FORWARD_MATRIX1 acamera_metadata_tag_t = 917513 - ACAMERA_SENSOR_FORWARD_MATRIX2 acamera_metadata_tag_t = 917514 - ACAMERA_SENSOR_BLACK_LEVEL_PATTERN acamera_metadata_tag_t = 917516 - ACAMERA_SENSOR_MAX_ANALOG_SENSITIVITY acamera_metadata_tag_t = 917517 - ACAMERA_SENSOR_ORIENTATION acamera_metadata_tag_t = 917518 - ACAMERA_SENSOR_TIMESTAMP acamera_metadata_tag_t = 917520 - ACAMERA_SENSOR_NEUTRAL_COLOR_POINT acamera_metadata_tag_t = 917522 - ACAMERA_SENSOR_NOISE_PROFILE acamera_metadata_tag_t = 917523 - ACAMERA_SENSOR_GREEN_SPLIT acamera_metadata_tag_t = 917526 - ACAMERA_SENSOR_TEST_PATTERN_DATA acamera_metadata_tag_t = 917527 - ACAMERA_SENSOR_TEST_PATTERN_MODE acamera_metadata_tag_t = 917528 - ACAMERA_SENSOR_AVAILABLE_TEST_PATTERN_MODES acamera_metadata_tag_t = 917529 - ACAMERA_SENSOR_ROLLING_SHUTTER_SKEW acamera_metadata_tag_t = 917530 - ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS acamera_metadata_tag_t = 917531 - ACAMERA_SENSOR_DYNAMIC_BLACK_LEVEL acamera_metadata_tag_t = 917532 - ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL acamera_metadata_tag_t = 917533 - ACAMERA_SENSOR_PIXEL_MODE acamera_metadata_tag_t = 917536 - ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED acamera_metadata_tag_t = 917537 - ACAMERA_SENSOR_END acamera_metadata_tag_t = 917538 - ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE acamera_metadata_tag_t = 983040 - ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE acamera_metadata_tag_t = 983041 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT acamera_metadata_tag_t = 983042 - ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE acamera_metadata_tag_t = 983043 - ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION acamera_metadata_tag_t = 983044 - ACAMERA_SENSOR_INFO_PHYSICAL_SIZE acamera_metadata_tag_t = 983045 - ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE acamera_metadata_tag_t = 983046 - ACAMERA_SENSOR_INFO_WHITE_LEVEL acamera_metadata_tag_t = 983047 - ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE acamera_metadata_tag_t = 983048 - ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED acamera_metadata_tag_t = 983049 - ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE acamera_metadata_tag_t = 983050 - ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 983051 - ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 983052 - ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 983053 - ACAMERA_SENSOR_INFO_BINNING_FACTOR acamera_metadata_tag_t = 983054 - ACAMERA_SENSOR_INFO_END acamera_metadata_tag_t = 983055 - ACAMERA_SHADING_MODE acamera_metadata_tag_t = 1048576 - ACAMERA_SHADING_AVAILABLE_MODES acamera_metadata_tag_t = 1048578 - ACAMERA_SHADING_END acamera_metadata_tag_t = 1048579 - ACAMERA_STATISTICS_FACE_DETECT_MODE acamera_metadata_tag_t = 1114112 - ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE acamera_metadata_tag_t = 1114115 - ACAMERA_STATISTICS_FACE_IDS acamera_metadata_tag_t = 1114116 - ACAMERA_STATISTICS_FACE_LANDMARKS acamera_metadata_tag_t = 1114117 - ACAMERA_STATISTICS_FACE_RECTANGLES acamera_metadata_tag_t = 1114118 - ACAMERA_STATISTICS_FACE_SCORES acamera_metadata_tag_t = 1114119 - ACAMERA_STATISTICS_LENS_SHADING_MAP acamera_metadata_tag_t = 1114123 - ACAMERA_STATISTICS_SCENE_FLICKER acamera_metadata_tag_t = 1114126 - ACAMERA_STATISTICS_HOT_PIXEL_MAP acamera_metadata_tag_t = 1114127 - ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE acamera_metadata_tag_t = 1114128 - ACAMERA_STATISTICS_OIS_DATA_MODE acamera_metadata_tag_t = 1114129 - ACAMERA_STATISTICS_OIS_TIMESTAMPS acamera_metadata_tag_t = 1114130 - ACAMERA_STATISTICS_OIS_X_SHIFTS acamera_metadata_tag_t = 1114131 - ACAMERA_STATISTICS_OIS_Y_SHIFTS acamera_metadata_tag_t = 1114132 - ACAMERA_STATISTICS_LENS_INTRINSIC_TIMESTAMPS acamera_metadata_tag_t = 1114133 - ACAMERA_STATISTICS_LENS_INTRINSIC_SAMPLES acamera_metadata_tag_t = 1114134 - ACAMERA_STATISTICS_END acamera_metadata_tag_t = 1114135 - ACAMERA_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES acamera_metadata_tag_t = 1179648 - ACAMERA_STATISTICS_INFO_MAX_FACE_COUNT acamera_metadata_tag_t = 1179650 - ACAMERA_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES acamera_metadata_tag_t = 1179654 - ACAMERA_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES acamera_metadata_tag_t = 1179655 - ACAMERA_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES acamera_metadata_tag_t = 1179656 - ACAMERA_STATISTICS_INFO_END acamera_metadata_tag_t = 1179657 - ACAMERA_TONEMAP_CURVE_BLUE acamera_metadata_tag_t = 1245184 - ACAMERA_TONEMAP_CURVE_GREEN acamera_metadata_tag_t = 1245185 - ACAMERA_TONEMAP_CURVE_RED acamera_metadata_tag_t = 1245186 - ACAMERA_TONEMAP_MODE acamera_metadata_tag_t = 1245187 - ACAMERA_TONEMAP_MAX_CURVE_POINTS acamera_metadata_tag_t = 1245188 - ACAMERA_TONEMAP_AVAILABLE_TONE_MAP_MODES acamera_metadata_tag_t = 1245189 - ACAMERA_TONEMAP_GAMMA acamera_metadata_tag_t = 1245190 - ACAMERA_TONEMAP_PRESET_CURVE acamera_metadata_tag_t = 1245191 - ACAMERA_TONEMAP_END acamera_metadata_tag_t = 1245192 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL acamera_metadata_tag_t = 1376256 - ACAMERA_INFO_VERSION acamera_metadata_tag_t = 1376257 - ACAMERA_INFO_DEVICE_STATE_ORIENTATIONS acamera_metadata_tag_t = 1376259 - ACAMERA_INFO_END acamera_metadata_tag_t = 1376260 - ACAMERA_BLACK_LEVEL_LOCK acamera_metadata_tag_t = 1441792 - ACAMERA_BLACK_LEVEL_END acamera_metadata_tag_t = 1441793 - ACAMERA_SYNC_FRAME_NUMBER acamera_metadata_tag_t = 1507328 - ACAMERA_SYNC_MAX_LATENCY acamera_metadata_tag_t = 1507329 - ACAMERA_SYNC_END acamera_metadata_tag_t = 1507330 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS acamera_metadata_tag_t = 1638401 - ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS acamera_metadata_tag_t = 1638402 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS acamera_metadata_tag_t = 1638403 - ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE acamera_metadata_tag_t = 1638404 - ACAMERA_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS acamera_metadata_tag_t = 1638405 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS acamera_metadata_tag_t = 1638406 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS acamera_metadata_tag_t = 1638407 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS acamera_metadata_tag_t = 1638408 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1638409 - ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1638410 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1638411 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1638412 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1638413 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1638414 - ACAMERA_DEPTH_END acamera_metadata_tag_t = 1638415 - ACAMERA_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS acamera_metadata_tag_t = 1703936 - ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE acamera_metadata_tag_t = 1703937 - ACAMERA_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID acamera_metadata_tag_t = 1703938 - ACAMERA_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_SENSOR_CROP_REGION acamera_metadata_tag_t = 1703939 - ACAMERA_LOGICAL_MULTI_CAMERA_END acamera_metadata_tag_t = 1703940 - ACAMERA_DISTORTION_CORRECTION_MODE acamera_metadata_tag_t = 1769472 - ACAMERA_DISTORTION_CORRECTION_AVAILABLE_MODES acamera_metadata_tag_t = 1769473 - ACAMERA_DISTORTION_CORRECTION_END acamera_metadata_tag_t = 1769474 - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS acamera_metadata_tag_t = 1835008 - ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS acamera_metadata_tag_t = 1835009 - ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS acamera_metadata_tag_t = 1835010 - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1835011 - ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1835012 - ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 1835013 - ACAMERA_HEIC_END acamera_metadata_tag_t = 1835014 - ACAMERA_AUTOMOTIVE_LOCATION acamera_metadata_tag_t = 1966080 - ACAMERA_AUTOMOTIVE_END acamera_metadata_tag_t = 1966081 - ACAMERA_AUTOMOTIVE_LENS_FACING acamera_metadata_tag_t = 2031616 - ACAMERA_AUTOMOTIVE_LENS_END acamera_metadata_tag_t = 2031617 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS acamera_metadata_tag_t = 2162688 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS acamera_metadata_tag_t = 2162689 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS acamera_metadata_tag_t = 2162690 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 2162691 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 2162692 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION acamera_metadata_tag_t = 2162693 - ACAMERA_JPEGR_END acamera_metadata_tag_t = 2162694 -) diff --git a/camera/anative_window.go b/camera/anative_window.go deleted file mode 100644 index 7104220..0000000 --- a/camera/anative_window.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type ANativeWindow = capi.ANativeWindow diff --git a/camera/camera.go b/camera/camera.go deleted file mode 100644 index c922ea3..0000000 --- a/camera/camera.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type CAMERA int32 - -const ( - ACAMERA_TYPE_BYTE CAMERA = 0 - ACAMERA_TYPE_INT32 CAMERA = 1 - ACAMERA_TYPE_FLOAT CAMERA = 2 - ACAMERA_TYPE_INT64 CAMERA = 3 - ACAMERA_TYPE_DOUBLE CAMERA = 4 - ACAMERA_TYPE_RATIONAL CAMERA = 5 - ACAMERA_NUM_TYPES CAMERA = 6 -) diff --git a/camera/camera_capture_failure.go b/camera/camera_capture_failure.go deleted file mode 100644 index 40c60ef..0000000 --- a/camera/camera_capture_failure.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraCaptureFailure wraps the NDK ACameraCaptureFailure handle. -type CameraCaptureFailure struct { - ptr *capi.ACameraCaptureFailure -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraCaptureFailure) cptr() *capi.ACameraCaptureFailure { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraCaptureFailureFromPointer wraps a raw ACameraCaptureFailure pointer. -func NewCameraCaptureFailureFromPointer(ptr unsafe.Pointer) *CameraCaptureFailure { - return &CameraCaptureFailure{ptr: (*capi.ACameraCaptureFailure)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraCaptureFailure) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraCaptureFailure) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraCaptureFailureFromUintPtr wraps a uintptr as a CameraCaptureFailure. -// The caller must ensure ptr points to a valid ACameraCaptureFailure. -func NewCameraCaptureFailureFromUintPtr(ptr uintptr) *CameraCaptureFailure { - return &CameraCaptureFailure{ptr: (*capi.ACameraCaptureFailure)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_capture_session_capture_callbacks.go b/camera/camera_capture_session_capture_callbacks.go deleted file mode 100644 index 6090bca..0000000 --- a/camera/camera_capture_session_capture_callbacks.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraCaptureSession_captureCallbacks wraps the NDK ACameraCaptureSession_captureCallbacks handle. -type CameraCaptureSession_captureCallbacks struct { - ptr *capi.ACameraCaptureSession_captureCallbacks -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraCaptureSession_captureCallbacks) cptr() *capi.ACameraCaptureSession_captureCallbacks { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraCaptureSession_captureCallbacksFromPointer wraps a raw ACameraCaptureSession_captureCallbacks pointer. -func NewCameraCaptureSession_captureCallbacksFromPointer(ptr unsafe.Pointer) *CameraCaptureSession_captureCallbacks { - return &CameraCaptureSession_captureCallbacks{ptr: (*capi.ACameraCaptureSession_captureCallbacks)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraCaptureSession_captureCallbacks) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraCaptureSession_captureCallbacks) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraCaptureSession_captureCallbacksFromUintPtr wraps a uintptr as a CameraCaptureSession_captureCallbacks. -// The caller must ensure ptr points to a valid ACameraCaptureSession_captureCallbacks. -func NewCameraCaptureSession_captureCallbacksFromUintPtr(ptr uintptr) *CameraCaptureSession_captureCallbacks { - return &CameraCaptureSession_captureCallbacks{ptr: (*capi.ACameraCaptureSession_captureCallbacks)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_capture_session_capture_callbacks_v2.go b/camera/camera_capture_session_capture_callbacks_v2.go deleted file mode 100644 index 5efeaf7..0000000 --- a/camera/camera_capture_session_capture_callbacks_v2.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraCaptureSession_captureCallbacksV2 wraps the NDK ACameraCaptureSession_captureCallbacksV2 handle. -type CameraCaptureSession_captureCallbacksV2 struct { - ptr *capi.ACameraCaptureSession_captureCallbacksV2 -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraCaptureSession_captureCallbacksV2) cptr() *capi.ACameraCaptureSession_captureCallbacksV2 { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraCaptureSession_captureCallbacksV2FromPointer wraps a raw ACameraCaptureSession_captureCallbacksV2 pointer. -func NewCameraCaptureSession_captureCallbacksV2FromPointer(ptr unsafe.Pointer) *CameraCaptureSession_captureCallbacksV2 { - return &CameraCaptureSession_captureCallbacksV2{ptr: (*capi.ACameraCaptureSession_captureCallbacksV2)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraCaptureSession_captureCallbacksV2) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraCaptureSession_captureCallbacksV2) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraCaptureSession_captureCallbacksV2FromUintPtr wraps a uintptr as a CameraCaptureSession_captureCallbacksV2. -// The caller must ensure ptr points to a valid ACameraCaptureSession_captureCallbacksV2. -func NewCameraCaptureSession_captureCallbacksV2FromUintPtr(ptr uintptr) *CameraCaptureSession_captureCallbacksV2 { - return &CameraCaptureSession_captureCallbacksV2{ptr: (*capi.ACameraCaptureSession_captureCallbacksV2)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_capture_session_logical_camera_capture_callbacks.go b/camera/camera_capture_session_logical_camera_capture_callbacks.go deleted file mode 100644 index 6fda3d1..0000000 --- a/camera/camera_capture_session_logical_camera_capture_callbacks.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraCaptureSession_logicalCamera_captureCallbacks wraps the NDK ACameraCaptureSession_logicalCamera_captureCallbacks handle. -type CameraCaptureSession_logicalCamera_captureCallbacks struct { - ptr *capi.ACameraCaptureSession_logicalCamera_captureCallbacks -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraCaptureSession_logicalCamera_captureCallbacks) cptr() *capi.ACameraCaptureSession_logicalCamera_captureCallbacks { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraCaptureSession_logicalCamera_captureCallbacksFromPointer wraps a raw ACameraCaptureSession_logicalCamera_captureCallbacks pointer. -func NewCameraCaptureSession_logicalCamera_captureCallbacksFromPointer(ptr unsafe.Pointer) *CameraCaptureSession_logicalCamera_captureCallbacks { - return &CameraCaptureSession_logicalCamera_captureCallbacks{ptr: (*capi.ACameraCaptureSession_logicalCamera_captureCallbacks)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraCaptureSession_logicalCamera_captureCallbacks) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraCaptureSession_logicalCamera_captureCallbacks) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraCaptureSession_logicalCamera_captureCallbacksFromUintPtr wraps a uintptr as a CameraCaptureSession_logicalCamera_captureCallbacks. -// The caller must ensure ptr points to a valid ACameraCaptureSession_logicalCamera_captureCallbacks. -func NewCameraCaptureSession_logicalCamera_captureCallbacksFromUintPtr(ptr uintptr) *CameraCaptureSession_logicalCamera_captureCallbacks { - return &CameraCaptureSession_logicalCamera_captureCallbacks{ptr: (*capi.ACameraCaptureSession_logicalCamera_captureCallbacks)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_capture_session_logical_camera_capture_callbacks_v2.go b/camera/camera_capture_session_logical_camera_capture_callbacks_v2.go deleted file mode 100644 index e2e0344..0000000 --- a/camera/camera_capture_session_logical_camera_capture_callbacks_v2.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraCaptureSession_logicalCamera_captureCallbacksV2 wraps the NDK ACameraCaptureSession_logicalCamera_captureCallbacksV2 handle. -type CameraCaptureSession_logicalCamera_captureCallbacksV2 struct { - ptr *capi.ACameraCaptureSession_logicalCamera_captureCallbacksV2 -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraCaptureSession_logicalCamera_captureCallbacksV2) cptr() *capi.ACameraCaptureSession_logicalCamera_captureCallbacksV2 { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraCaptureSession_logicalCamera_captureCallbacksV2FromPointer wraps a raw ACameraCaptureSession_logicalCamera_captureCallbacksV2 pointer. -func NewCameraCaptureSession_logicalCamera_captureCallbacksV2FromPointer(ptr unsafe.Pointer) *CameraCaptureSession_logicalCamera_captureCallbacksV2 { - return &CameraCaptureSession_logicalCamera_captureCallbacksV2{ptr: (*capi.ACameraCaptureSession_logicalCamera_captureCallbacksV2)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraCaptureSession_logicalCamera_captureCallbacksV2) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraCaptureSession_logicalCamera_captureCallbacksV2) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraCaptureSession_logicalCamera_captureCallbacksV2FromUintPtr wraps a uintptr as a CameraCaptureSession_logicalCamera_captureCallbacksV2. -// The caller must ensure ptr points to a valid ACameraCaptureSession_logicalCamera_captureCallbacksV2. -func NewCameraCaptureSession_logicalCamera_captureCallbacksV2FromUintPtr(ptr uintptr) *CameraCaptureSession_logicalCamera_captureCallbacksV2 { - return &CameraCaptureSession_logicalCamera_captureCallbacksV2{ptr: (*capi.ACameraCaptureSession_logicalCamera_captureCallbacksV2)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_manager_availability_callbacks.go b/camera/camera_manager_availability_callbacks.go deleted file mode 100644 index 5e1bd89..0000000 --- a/camera/camera_manager_availability_callbacks.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraManager_AvailabilityCallbacks wraps the NDK ACameraManager_AvailabilityCallbacks handle. -type CameraManager_AvailabilityCallbacks struct { - ptr *capi.ACameraManager_AvailabilityCallbacks -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraManager_AvailabilityCallbacks) cptr() *capi.ACameraManager_AvailabilityCallbacks { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraManager_AvailabilityCallbacksFromPointer wraps a raw ACameraManager_AvailabilityCallbacks pointer. -func NewCameraManager_AvailabilityCallbacksFromPointer(ptr unsafe.Pointer) *CameraManager_AvailabilityCallbacks { - return &CameraManager_AvailabilityCallbacks{ptr: (*capi.ACameraManager_AvailabilityCallbacks)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraManager_AvailabilityCallbacks) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraManager_AvailabilityCallbacks) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraManager_AvailabilityCallbacksFromUintPtr wraps a uintptr as a CameraManager_AvailabilityCallbacks. -// The caller must ensure ptr points to a valid ACameraManager_AvailabilityCallbacks. -func NewCameraManager_AvailabilityCallbacksFromUintPtr(ptr uintptr) *CameraManager_AvailabilityCallbacks { - return &CameraManager_AvailabilityCallbacks{ptr: (*capi.ACameraManager_AvailabilityCallbacks)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_manager_extended_availability_callbacks.go b/camera/camera_manager_extended_availability_callbacks.go deleted file mode 100644 index 2778b4e..0000000 --- a/camera/camera_manager_extended_availability_callbacks.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraManager_ExtendedAvailabilityCallbacks wraps the NDK ACameraManager_ExtendedAvailabilityCallbacks handle. -type CameraManager_ExtendedAvailabilityCallbacks struct { - ptr *capi.ACameraManager_ExtendedAvailabilityCallbacks -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraManager_ExtendedAvailabilityCallbacks) cptr() *capi.ACameraManager_ExtendedAvailabilityCallbacks { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraManager_ExtendedAvailabilityCallbacksFromPointer wraps a raw ACameraManager_ExtendedAvailabilityCallbacks pointer. -func NewCameraManager_ExtendedAvailabilityCallbacksFromPointer(ptr unsafe.Pointer) *CameraManager_ExtendedAvailabilityCallbacks { - return &CameraManager_ExtendedAvailabilityCallbacks{ptr: (*capi.ACameraManager_ExtendedAvailabilityCallbacks)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraManager_ExtendedAvailabilityCallbacks) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraManager_ExtendedAvailabilityCallbacks) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraManager_ExtendedAvailabilityCallbacksFromUintPtr wraps a uintptr as a CameraManager_ExtendedAvailabilityCallbacks. -// The caller must ensure ptr points to a valid ACameraManager_ExtendedAvailabilityCallbacks. -func NewCameraManager_ExtendedAvailabilityCallbacksFromUintPtr(ptr uintptr) *CameraManager_ExtendedAvailabilityCallbacks { - return &CameraManager_ExtendedAvailabilityCallbacks{ptr: (*capi.ACameraManager_ExtendedAvailabilityCallbacks)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_metadata_const_entry.go b/camera/camera_metadata_const_entry.go deleted file mode 100644 index 4601ea4..0000000 --- a/camera/camera_metadata_const_entry.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraMetadata_const_entry wraps the NDK ACameraMetadata_const_entry handle. -type CameraMetadata_const_entry struct { - ptr *capi.ACameraMetadata_const_entry -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraMetadata_const_entry) cptr() *capi.ACameraMetadata_const_entry { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraMetadata_const_entryFromPointer wraps a raw ACameraMetadata_const_entry pointer. -func NewCameraMetadata_const_entryFromPointer(ptr unsafe.Pointer) *CameraMetadata_const_entry { - return &CameraMetadata_const_entry{ptr: (*capi.ACameraMetadata_const_entry)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraMetadata_const_entry) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraMetadata_const_entry) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraMetadata_const_entryFromUintPtr wraps a uintptr as a CameraMetadata_const_entry. -// The caller must ensure ptr points to a valid ACameraMetadata_const_entry. -func NewCameraMetadata_const_entryFromUintPtr(ptr uintptr) *CameraMetadata_const_entry { - return &CameraMetadata_const_entry{ptr: (*capi.ACameraMetadata_const_entry)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_metadata_entry.go b/camera/camera_metadata_entry.go deleted file mode 100644 index 2269f26..0000000 --- a/camera/camera_metadata_entry.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraMetadata_entry wraps the NDK ACameraMetadata_entry handle. -type CameraMetadata_entry struct { - ptr *capi.ACameraMetadata_entry -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraMetadata_entry) cptr() *capi.ACameraMetadata_entry { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraMetadata_entryFromPointer wraps a raw ACameraMetadata_entry pointer. -func NewCameraMetadata_entryFromPointer(ptr unsafe.Pointer) *CameraMetadata_entry { - return &CameraMetadata_entry{ptr: (*capi.ACameraMetadata_entry)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraMetadata_entry) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraMetadata_entry) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraMetadata_entryFromUintPtr wraps a uintptr as a CameraMetadata_entry. -// The caller must ensure ptr points to a valid ACameraMetadata_entry. -func NewCameraMetadata_entryFromUintPtr(ptr uintptr) *CameraMetadata_entry { - return &CameraMetadata_entry{ptr: (*capi.ACameraMetadata_entry)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_metadata_rational.go b/camera/camera_metadata_rational.go deleted file mode 100644 index 4ea3df7..0000000 --- a/camera/camera_metadata_rational.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraMetadata_rational wraps the NDK ACameraMetadata_rational handle. -type CameraMetadata_rational struct { - ptr *capi.ACameraMetadata_rational -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraMetadata_rational) cptr() *capi.ACameraMetadata_rational { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraMetadata_rationalFromPointer wraps a raw ACameraMetadata_rational pointer. -func NewCameraMetadata_rationalFromPointer(ptr unsafe.Pointer) *CameraMetadata_rational { - return &CameraMetadata_rational{ptr: (*capi.ACameraMetadata_rational)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraMetadata_rational) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraMetadata_rational) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraMetadata_rationalFromUintPtr wraps a uintptr as a CameraMetadata_rational. -// The caller must ensure ptr points to a valid ACameraMetadata_rational. -func NewCameraMetadata_rationalFromUintPtr(ptr uintptr) *CameraMetadata_rational { - return &CameraMetadata_rational{ptr: (*capi.ACameraMetadata_rational)(unsafe.Pointer(ptr))} -} diff --git a/camera/camera_output_targets.go b/camera/camera_output_targets.go deleted file mode 100644 index f986603..0000000 --- a/camera/camera_output_targets.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CameraOutputTargets wraps the NDK ACameraOutputTargets handle. -type CameraOutputTargets struct { - ptr *capi.ACameraOutputTargets -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CameraOutputTargets) cptr() *capi.ACameraOutputTargets { - if h == nil { - return nil - } - return h.ptr -} - -// NewCameraOutputTargetsFromPointer wraps a raw ACameraOutputTargets pointer. -func NewCameraOutputTargetsFromPointer(ptr unsafe.Pointer) *CameraOutputTargets { - return &CameraOutputTargets{ptr: (*capi.ACameraOutputTargets)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CameraOutputTargets) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CameraOutputTargets) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCameraOutputTargetsFromUintPtr wraps a uintptr as a CameraOutputTargets. -// The caller must ensure ptr points to a valid ACameraOutputTargets. -func NewCameraOutputTargetsFromUintPtr(ptr uintptr) *CameraOutputTargets { - return &CameraOutputTargets{ptr: (*capi.ACameraOutputTargets)(unsafe.Pointer(ptr))} -} diff --git a/camera/capture_failure_reason.go b/camera/capture_failure_reason.go deleted file mode 100644 index 4272b90..0000000 --- a/camera/capture_failure_reason.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type CAPTURE_FAILURE_REASON int32 - -const ( - CAPTURE_FAILURE_REASON_FLUSHED CAPTURE_FAILURE_REASON = 0 - CAPTURE_FAILURE_REASON_ERROR CAPTURE_FAILURE_REASON = 1 -) diff --git a/camera/capture_request.go b/camera/capture_request.go deleted file mode 100644 index 1808fd0..0000000 --- a/camera/capture_request.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// CaptureRequest wraps the NDK ACaptureRequest handle. -type CaptureRequest struct { - ptr *capi.ACaptureRequest -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CaptureRequest) cptr() *capi.ACaptureRequest { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *CaptureRequest) Close() error { - if h.ptr == nil { - return nil - } - capi.ACaptureRequest_free(h.ptr) - h.ptr = nil - return nil -} - -// NewCaptureRequestFromPointer wraps a raw ACaptureRequest pointer. -func NewCaptureRequestFromPointer(ptr unsafe.Pointer) *CaptureRequest { - return &CaptureRequest{ptr: (*capi.ACaptureRequest)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CaptureRequest) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CaptureRequest) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCaptureRequestFromUintPtr wraps a uintptr as a CaptureRequest. -// The caller must ensure ptr points to a valid ACaptureRequest. -func NewCaptureRequestFromUintPtr(ptr uintptr) *CaptureRequest { - return &CaptureRequest{ptr: (*capi.ACaptureRequest)(unsafe.Pointer(ptr))} -} - -// AddTarget sets a property and returns the receiver for chaining. -func (h *CaptureRequest) AddTarget(output *OutputTarget) *CaptureRequest { - capi.ACaptureRequest_addTarget(h.ptr, output.cptr()) - return h -} - -// Copy creates a new CaptureRequest from this CaptureRequest. -func (h *CaptureRequest) Copy() *CaptureRequest { - return &CaptureRequest{ptr: capi.ACaptureRequest_copy(h.ptr)} -} - -// RemoveTarget calls the underlying NDK function. -func (h *CaptureRequest) RemoveTarget(output *OutputTarget) error { - return result(capi.ACaptureRequest_removeTarget(h.ptr, output.cptr())) -} diff --git a/camera/capture_sequence.go b/camera/capture_sequence.go deleted file mode 100644 index 86f9460..0000000 --- a/camera/capture_sequence.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type CAPTURE_SEQUENCE int32 - -const ( - CAPTURE_SEQUENCE_ID_NONE CAPTURE_SEQUENCE = -1 -) diff --git a/camera/capture_session.go b/camera/capture_session.go index c5f4eed..f51ac72 100644 --- a/camera/capture_session.go +++ b/camera/capture_session.go @@ -1,66 +1,834 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + */ + +/** + * @file NdkCameraCaptureSession.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ package camera +/* +#cgo LDFLAGS: -lcamera2ndk + +#include +static bool bFalse() { return false; } +#include +#include +#include + +extern void cgoCaptureStarted( + void* context, ACameraCaptureSession* session, + ACaptureRequest* request, int64_t timestamp); +extern void cgoCaptureProgressed( + void* context, ACameraCaptureSession* session, + ACaptureRequest* request, ACameraMetadata* result); +extern void cgoCaptureCompleted( + void* context, ACameraCaptureSession* session, + ACaptureRequest* request, ACameraMetadata* result); +extern void cgoCaptureFailed( + void* context, ACameraCaptureSession* session, + ACaptureRequest* request, ACameraCaptureFailure* failure); +extern void cgoCaptureSequenceCompleted( + void* context, ACameraCaptureSession* session, + int sequenceId, int64_t frameNumber); +extern void cgoCaptureSequenceAborted( + void* context, ACameraCaptureSession* session, + int sequenceId); +extern void cgoCaptureBufferLost( + void* context, ACameraCaptureSession* session, + ACaptureRequest* request, ANativeWindow* window, int64_t frameNumber); +*/ +import "C" import ( + "time" "unsafe" - capi "github.com/AndroidGoLab/ndk/capi/camera" + "github.com/xaionaro-go/ndk" +) + +/** + * ACameraCaptureSession is an opaque type that manages frame captures of a camera device. + * + * A pointer can be obtained using {@link ACameraDevice_createCaptureSession} method. + */ +type CaptureSession C.ACameraCaptureSession + +func (session *CaptureSession) cptr() *C.ACameraCaptureSession { + return (*C.ACameraCaptureSession)(session) +} + +/** + * The definition of camera capture session state callback. + * + * @param context The optional application context provided by user in + * {@link ACameraCaptureSession_stateCallbacks}. + * @param session The camera capture session whose state is changing. + */ +//typedef void (*ACameraCaptureSession_stateCallback)(void* context, ACameraCaptureSession *session); + +// typedef struct ACameraCaptureSession_stateCallbacks { +type CaptureSessionStateCallbacks interface { + /// optional application context. + // void* context; + + /** + * This callback is called when the session is closed and deleted from memory. + * + *

A session is closed when {@link ACameraCaptureSession_close} is called, a new session + * is created by the parent camera device, + * or when the parent camera device is closed (either by the user closing the device, + * or due to a camera device disconnection or fatal error).

+ * + *

Once this callback is called, all access to this ACameraCaptureSession object will cause + * a crash.

+ */ + // ACameraCaptureSession_stateCallback onClosed; + OnClosed(*CaptureSession) + + /** + * This callback is called every time the session has no more capture requests to process. + * + *

This callback will be invoked any time the session finishes processing + * all of its active capture requests, and no repeating request or burst is set up.

+ */ + // ACameraCaptureSession_stateCallback onReady; + OnReady(*CaptureSession) + + /** + * This callback is called when the session starts actively processing capture requests. + * + *

If the session runs out of capture requests to process and calls {@link onReady}, + * then this callback will be invoked again once new requests are submitted for capture.

+ */ + // ACameraCaptureSession_stateCallback onActive; + OnActive(*CaptureSession) +} //ACameraCaptureSession_stateCallbacks; + +// / Enum for describing error reason in {@link ACameraCaptureFailure} +const ( + /** + * The capture session has dropped this frame due to an + * {@link ACameraCaptureSession_abortCaptures} call. + */ + CAPTURE_FAILURE_REASON_FLUSHED = C.CAPTURE_FAILURE_REASON_FLUSHED + + /** + * The capture session has dropped this frame due to an error in the framework. + */ + CAPTURE_FAILURE_REASON_ERROR = C.CAPTURE_FAILURE_REASON_ERROR +) + +/// Struct to describe a capture failure +//typedef struct ACameraCaptureFailure { +/** + * The frame number associated with this failed capture. + * + *

Whenever a request has been processed, regardless of failed capture or success, + * it gets a unique frame number assigned to its future result/failed capture.

+ * + *

This value monotonically increments, starting with 0, + * for every new result or failure; and the scope is the lifetime of the + * {@link ACameraDevice}.

+ */ +//go int64_t frameNumber; + +/** + * Determine why the request was dropped, whether due to an error or to a user + * action. + * + * @see CAPTURE_FAILURE_REASON_ERROR + * @see CAPTURE_FAILURE_REASON_FLUSHED + */ +//go int reason; + +/** + * The sequence ID for this failed capture that was returned by the + * {@link ACameraCaptureSession_capture} or {@link ACameraCaptureSession_setRepeatingRequest}. + * + *

The sequence ID is a unique monotonically increasing value starting from 0, + * incremented every time a new group of requests is submitted to the ACameraDevice.

+ */ +//go int sequenceId; + +/** + * Determine if the image was captured from the camera. + * + *

If the image was not captured, no image buffers will be available. + * If the image was captured, then image buffers may be available.

+ * + */ +//go bool wasImageCaptured; +//go } ACameraCaptureFailure; +type CaptureFailure C.ACameraCaptureFailure + +func (f *CaptureFailure) FrameNumber() int64 { + return int64((*C.ACameraCaptureFailure)(f).frameNumber) +} + +func (f *CaptureFailure) Reason() int { + return int((*C.ACameraCaptureFailure)(f).reason) +} + +func (f *CaptureFailure) SequenceId() int { + return int((*C.ACameraCaptureFailure)(f).sequenceId) +} + +func (f *CaptureFailure) WasImageCaptured() bool { + return (*C.ACameraCaptureFailure)(f).wasImageCaptured != C.bFalse() +} + +/** + * The definition of camera capture start callback. + * + * @param context The optional application context provided by user in + * {@link ACameraCaptureSession_captureCallbacks}. + * @param session The camera capture session of interest. + * @param request The capture request that is starting. Note that this pointer points to a copy of + * capture request sent by application, so the address is different to what + * application sent but the content will match. This request will be freed by + * framework immediately after this callback returns. + * @param timestamp The timestamp when the capture is started. This timestamp will match + * {@link ACAMERA_SENSOR_TIMESTAMP} of the {@link ACameraMetadata} in + * {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted} callback. + */ +//typedef void (*ACameraCaptureSession_captureCallback_start)( +// void* context, ACameraCaptureSession* session, +// const ACaptureRequest* request, int64_t timestamp); + +/** + * The definition of camera capture progress/result callback. + * + * @param context The optional application context provided by user in + * {@link ACameraCaptureSession_captureCallbacks}. + * @param session The camera capture session of interest. + * @param request The capture request of interest. Note that this pointer points to a copy of + * capture request sent by application, so the address is different to what + * application sent but the content will match. This request will be freed by + * framework immediately after this callback returns. + * @param result The capture result metadata reported by camera device. The memory is managed by + * camera framework. Do not access this pointer after this callback returns. + */ +//typedef void (*ACameraCaptureSession_captureCallback_result)( +// void* context, ACameraCaptureSession* session, +// ACaptureRequest* request, const ACameraMetadata* result); + +/** + * The definition of camera capture failure callback. + * + * @param context The optional application context provided by user in + * {@link ACameraCaptureSession_captureCallbacks}. + * @param session The camera capture session of interest. + * @param request The capture request of interest. Note that this pointer points to a copy of + * capture request sent by application, so the address is different to what + * application sent but the content will match. This request will be freed by + * framework immediately after this callback returns. + * @param failure The {@link ACameraCaptureFailure} describes the capture failure. The memory is + * managed by camera framework. Do not access this pointer after this callback + * returns. + */ +//typedef void (*ACameraCaptureSession_captureCallback_failed)( +// void* context, ACameraCaptureSession* session, +// ACaptureRequest* request, ACameraCaptureFailure* failure); + +/** + * The definition of camera sequence end callback. + * + * @param context The optional application context provided by user in + * {@link ACameraCaptureSession_captureCallbacks}. + * @param session The camera capture session of interest. + * @param sequenceId The capture sequence ID of the finished sequence. + * @param frameNumber The frame number of the last frame of this sequence. + */ +//typedef void (*ACameraCaptureSession_captureCallback_sequenceEnd)( +// void* context, ACameraCaptureSession* session, +// int sequenceId, int64_t frameNumber); + +/** + * The definition of camera sequence aborted callback. + * + * @param context The optional application context provided by user in + * {@link ACameraCaptureSession_captureCallbacks}. + * @param session The camera capture session of interest. + * @param sequenceId The capture sequence ID of the aborted sequence. + */ +//typedef void (*ACameraCaptureSession_captureCallback_sequenceAbort)( +// void* context, ACameraCaptureSession* session, +// int sequenceId); + +/** + * The definition of camera buffer lost callback. + * + * @param context The optional application context provided by user in + * {@link ACameraCaptureSession_captureCallbacks}. + * @param session The camera capture session of interest. + * @param request The capture request of interest. Note that this pointer points to a copy of + * capture request sent by application, so the address is different to what + * application sent but the content will match. This request will be freed by + * framework immediately after this callback returns. + * @param window The {@link ANativeWindow} that the lost buffer would have been sent to. + * @param frameNumber The frame number of the lost buffer. + */ +//typedef void (*ACameraCaptureSession_captureCallback_bufferLost)( +// void* context, ACameraCaptureSession* session, +// ACaptureRequest* request, ANativeWindow* window, int64_t frameNumber); + +//go typedef struct ACameraCaptureSession_captureCallbacks { +/// optional application context. +//go void* context; + +/** + * This callback is called when the camera device has started capturing + * the output image for the request, at the beginning of image exposure. + * + *

This callback is invoked right as + * the capture of a frame begins, so it is the most appropriate time + * for playing a shutter sound, or triggering UI indicators of capture.

+ * + *

The request that is being used for this capture is provided, along + * with the actual timestamp for the start of exposure. + * This timestamp matches the timestamps that will be + * included in {@link ACAMERA_SENSOR_TIMESTAMP} of the {@link ACameraMetadata} in + * {@link onCaptureCompleted} callback, + * and in the buffers sent to each output ANativeWindow. These buffer + * timestamps are accessible through, for example, + * {@link AImage_getTimestamp} or + * + * android.graphics.SurfaceTexture#getTimestamp().

+ * + *

Note that the ACaptureRequest pointer in the callback will not match what application has + * submitted, but the contents the ACaptureRequest will match what application submitted.

+ * + */ +//go ACameraCaptureSession_captureCallback_start onCaptureStarted; + +/** + * This callback is called when an image capture makes partial forward progress; some + * (but not all) results from an image capture are available. + * + *

The result provided here will contain some subset of the fields of + * a full result. Multiple {@link onCaptureProgressed} calls may happen per + * capture; a given result field will only be present in one partial + * capture at most. The final {@link onCaptureCompleted} call will always + * contain all the fields (in particular, the union of all the fields of all + * the partial results composing the total result).

+ * + *

For each request, some result data might be available earlier than others. The typical + * delay between each partial result (per request) is a single frame interval. + * For performance-oriented use-cases, applications should query the metadata they need + * to make forward progress from the partial results and avoid waiting for the completed + * result.

+ * + *

For a particular request, {@link onCaptureProgressed} may happen before or after + * {@link onCaptureStarted}.

+ * + *

Each request will generate at least `1` partial results, and at most + * {@link ACAMERA_REQUEST_PARTIAL_RESULT_COUNT} partial results.

+ * + *

Depending on the request settings, the number of partial results per request + * will vary, although typically the partial count could be the same as long as the + * camera device subsystems enabled stay the same.

+ * + *

Note that the ACaptureRequest pointer in the callback will not match what application has + * submitted, but the contents the ACaptureRequest will match what application submitted.

+ */ +//go ACameraCaptureSession_captureCallback_result onCaptureProgressed; + +/** + * This callback is called when an image capture has fully completed and all the + * result metadata is available. + * + *

This callback will always fire after the last {@link onCaptureProgressed}; + * in other words, no more partial results will be delivered once the completed result + * is available.

+ * + *

For performance-intensive use-cases where latency is a factor, consider + * using {@link onCaptureProgressed} instead.

+ * + *

Note that the ACaptureRequest pointer in the callback will not match what application has + * submitted, but the contents the ACaptureRequest will match what application submitted.

+ */ +//go ACameraCaptureSession_captureCallback_result onCaptureCompleted; + +/** + * This callback is called instead of {@link onCaptureCompleted} when the + * camera device failed to produce a capture result for the + * request. + * + *

Other requests are unaffected, and some or all image buffers from + * the capture may have been pushed to their respective output + * streams.

+ * + *

Note that the ACaptureRequest pointer in the callback will not match what application has + * submitted, but the contents the ACaptureRequest will match what application submitted.

+ * + * @see ACameraCaptureFailure + */ +//go ACameraCaptureSession_captureCallback_failed onCaptureFailed; + +/** + * This callback is called independently of the others in {@link ACameraCaptureSession_captureCallbacks}, + * when a capture sequence finishes and all capture result + * or capture failure for it have been returned via this {@link ACameraCaptureSession_captureCallbacks}. + * + *

In total, there will be at least one result/failure returned by this listener + * before this callback is invoked. If the capture sequence is aborted before any + * requests have been processed, {@link onCaptureSequenceAborted} is invoked instead.

+ */ +//go ACameraCaptureSession_captureCallback_sequenceEnd onCaptureSequenceCompleted; + +/** + * This callback is called independently of the others in {@link ACameraCaptureSession_captureCallbacks}, + * when a capture sequence aborts before any capture result + * or capture failure for it have been returned via this {@link ACameraCaptureSession_captureCallbacks}. + * + *

Due to the asynchronous nature of the camera device, not all submitted captures + * are immediately processed. It is possible to clear out the pending requests + * by a variety of operations such as {@link ACameraCaptureSession_stopRepeating} or + * {@link ACameraCaptureSession_abortCaptures}. When such an event happens, + * {@link onCaptureSequenceCompleted} will not be called.

+ */ +//go ACameraCaptureSession_captureCallback_sequenceAbort onCaptureSequenceAborted; + +/** + * This callback is called if a single buffer for a capture could not be sent to its + * destination ANativeWindow. + * + *

If the whole capture failed, then {@link onCaptureFailed} will be called instead. If + * some but not all buffers were captured but the result metadata will not be available, + * then onCaptureFailed will be invoked with {@link ACameraCaptureFailure#wasImageCaptured} + * returning true, along with one or more calls to {@link onCaptureBufferLost} for the + * failed outputs.

+ * + *

Note that the ACaptureRequest pointer in the callback will not match what application has + * submitted, but the contents the ACaptureRequest will match what application submitted. + * The ANativeWindow pointer will always match what application submitted in + * {@link ACameraDevice_createCaptureSession}

+ * + */ +//go ACameraCaptureSession_captureCallback_bufferLost onCaptureBufferLost; +//go } ACameraCaptureSession_captureCallbacks; + +const ( + CAPTURE_SEQUENCE_ID_NONE = C.CAPTURE_SEQUENCE_ID_NONE ) -// CaptureSession wraps the NDK ACameraCaptureSession handle. -type CaptureSession struct { - ptr *capi.ACameraCaptureSession +/** + * Close this capture session. + * + *

Closing a session frees up the target output Surfaces of the session for reuse with either + * a new session, or to other APIs that can draw to Surfaces.

+ * + *

Note that creating a new capture session with {@link ACameraDevice_createCaptureSession} + * will close any existing capture session automatically, and call the older session listener's + * {@link ACameraCaptureSession_stateCallbacks#onClosed} callback. Using + * {@link ACameraDevice_createCaptureSession} directly without closing is the recommended approach + * for quickly switching to a new session, since unchanged target outputs can be reused more + * efficiently.

+ * + *

After a session is closed and before {@link ACameraCaptureSession_stateCallbacks#onClosed} + * is called, all methods invoked on the session will return {@link ACAMERA_ERROR_SESSION_CLOSED}, + * and any repeating requests are stopped (as if {@link ACameraCaptureSession_stopRepeating} was + * called). However, any in-progress capture requests submitted to the session will be completed as + * normal; once all captures have completed and the session has been torn down, + * {@link ACameraCaptureSession_stateCallbacks#onClosed} callback will be called and the seesion + * will be removed from memory.

+ * + *

Closing a session is idempotent; closing more than once has no effect.

+ * + * @param session the capture session of interest + */ +//void ACameraCaptureSession_close(ACameraCaptureSession* session); +func (session *CaptureSession) Close() { + delete(captureSessionMap, session.cptr()) + delete(captureSessionCaptureMap, unsafe.Pointer(session.cptr())) + C.ACameraCaptureSession_close(session.cptr()) } -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CaptureSession) cptr() *capi.ACameraCaptureSession { - if h == nil { - return nil +//struct ACameraDevice; +//typedef struct ACameraDevice ACameraDevice; + +/** + * Get the ACameraDevice pointer associated with this capture session in the device argument + * if the method succeeds. + * + * @param session the capture session of interest + * @param device the {@link ACameraDevice} associated with session. Will be set to NULL + * if the session is closed or this method fails. + * @return
  • + * {@link ACAMERA_OK} if the method call succeeds. The {@link ACameraDevice} + * will be stored in device argument
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if session or device is NULL
  • + *
  • {@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons
+ * + */ +//camera_status_t ACameraCaptureSession_getDevice( +// ACameraCaptureSession* session, /*out*/ACameraDevice** device); +func (session *CaptureSession) GetDevice() (*Device, error) { + var dev *C.ACameraDevice + ret := Status(C.ACameraCaptureSession_getDevice(session.cptr(), &dev)) + return (*Device)(dev), ret +} + +/** + * Submit an array of requests to be captured in sequence as a burst in the minimum of time possible. + * + *

The burst will be captured in the minimum amount of time possible, and will not be + * interleaved with requests submitted by other capture or repeat calls.

+ * + *

Each capture produces one {@link ACameraMetadata} as a capture result and image buffers for + * one or more target {@link ANativeWindow}s. The target ANativeWindows (set with + * {@link ACaptureRequest_addTarget}) must be a subset of the ANativeWindow provided when + * this capture session was created.

+ * + * @param session the capture session of interest + * @param callbacks the {@link ACameraCaptureSession_captureCallbacks} to be associated this capture + * sequence. No capture callback will be fired if this is set to NULL. + * @param numRequests number of requests in requests argument. Must be at least 1. + * @param requests an array of {@link ACaptureRequest} to be captured. Length must be at least + * numRequests. + * @param captureSequenceId the capture sequence ID associated with this capture method invocation + * will be stored here if this argument is not NULL and the method call succeeds. + * When this argument is set to NULL, the capture sequence ID will not be returned. + * + * @return
  • + * {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled + * if it is not NULL.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if session or requests is NULL, or + * if numRequests < 1
  • + *
  • {@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error
  • + *
  • {@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons
+ */ +//camera_status_t ACameraCaptureSession_capture( +// ACameraCaptureSession* session, +// /*optional*/ACameraCaptureSession_captureCallbacks* callbacks, +// int numRequests, ACaptureRequest** requests, +// /*optional*/int* captureSequenceId); +func (session *CaptureSession) Capture(cb interface{}, + requests []*CaptureRequest) (int, error) { + numRequests := C.int(len(requests)) + ccaptureSequenceId := C.int(0) + crequests := make([]*C.ACaptureRequest, numRequests) + for i, r := range requests { + crequests[i] = r.cptr() } - return h.ptr + + ccallbacks := getCaptureCallbacks(cb, unsafe.Pointer(session.cptr())) + ret := C.ACameraCaptureSession_capture(session.cptr(), + ccallbacks, numRequests, &crequests[0], &ccaptureSequenceId) + return int(ccaptureSequenceId), Status(ret) } -// Close releases the underlying NDK handle. -func (h *CaptureSession) Close() error { - if h.ptr == nil { - return nil +/** + * Request endlessly repeating capture of a sequence of images by this capture session. + * + *

With this method, the camera device will continually capture images, + * cycling through the settings in the provided list of + * {@link ACaptureRequest}, at the maximum rate possible.

+ * + *

If a request is submitted through {@link ACameraCaptureSession_capture}, + * the current repetition of the request list will be + * completed before the higher-priority request is handled. This guarantees + * that the application always receives a complete repeat burst captured in + * minimal time, instead of bursts interleaved with higher-priority + * captures, or incomplete captures.

+ * + *

Repeating burst requests are a simple way for an application to + * maintain a preview or other continuous stream of frames where each + * request is different in a predicatable way, without having to continually + * submit requests through {@link ACameraCaptureSession_capture}.

+ * + *

To stop the repeating capture, call {@link ACameraCaptureSession_stopRepeating}. Any + * ongoing burst will still be completed, however. Calling + * {@link ACameraCaptureSession_abortCaptures} will also clear the request.

+ * + *

Calling this method will replace a previously-set repeating requests + * set up by this method, although any in-progress burst will be completed before the new repeat + * burst will be used.

+ * + * @param session the capture session of interest + * @param callbacks the {@link ACameraCaptureSession_captureCallbacks} to be associated with this + * capture sequence. No capture callback will be fired if callbacks is set to NULL. + * @param numRequests number of requests in requests array. Must be at least 1. + * @param requests an array of {@link ACaptureRequest} to be captured. Length must be at least + * numRequests. + * @param captureSequenceId the capture sequence ID associated with this capture method invocation + * will be stored here if this argument is not NULL and the method call succeeds. + * When this argument is set to NULL, the capture sequence ID will not be returned. + * + * @return
  • + * {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled + * if it is not NULL.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if session or requests is NULL, or + * if numRequests < 1
  • + *
  • {@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error
  • + *
  • {@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons
+ */ +//camera_status_t ACameraCaptureSession_setRepeatingRequest( +// ACameraCaptureSession* session, +// /*optional*/ACameraCaptureSession_captureCallbacks* callbacks, +// int numRequests, ACaptureRequest** requests, +// /*optional*/int* captureSequenceId); +func (session *CaptureSession) SetRepeatingRequest(requests []*CaptureRequest) error { + creqs := make([]*C.ACaptureRequest, len(requests)) + for i, r := range requests { + creqs[i] = r.cptr() } - capi.ACameraCaptureSession_close(h.ptr) - h.ptr = nil - return nil + return Status(C.ACameraCaptureSession_setRepeatingRequest(session.cptr(), + nil, C.int(len(requests)), &creqs[0], nil)) + // (**C.ACaptureRequest)(unsafe.Pointer( +} + +/** + * Cancel any ongoing repeating capture set by {@link ACameraCaptureSession_setRepeatingRequest}. + * Has no effect on requests submitted through {@link ACameraCaptureSession_capture}. + * + *

Any currently in-flight captures will still complete, as will any burst that is + * mid-capture. To ensure that the device has finished processing all of its capture requests + * and is in ready state, wait for the {@link ACameraCaptureSession_stateCallbacks#onReady} callback + * after calling this method.

+ * + * @param session the capture session of interest + * + * @return
  • + * {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled + * if it is not NULL.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if session is NULL.
  • + *
  • {@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error
  • + *
  • {@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons
+ */ +//camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* session); +func (session *CaptureSession) StopRepeating() error { + return Status(C.ACameraCaptureSession_stopRepeating(session.cptr())) +} + +/** + * Discard all captures currently pending and in-progress as fast as possible. + * + *

The camera device will discard all of its current work as fast as possible. Some in-flight + * captures may complete successfully and call + * {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted}, + * while others will trigger their {@link ACameraCaptureSession_captureCallbacks#onCaptureFailed} + * callbacks. If a repeating request list is set, it will be cleared.

+ * + *

This method is the fastest way to switch the camera device to a new session with + * {@link ACameraDevice_createCaptureSession}, at the cost of discarding in-progress + * work. It must be called before the new session is created. Once all pending requests are + * either completed or thrown away, the {@link ACameraCaptureSession_stateCallbacks#onReady} + * callback will be called, if the session has not been closed. Otherwise, the + * {@link ACameraCaptureSession_stateCallbacks#onClosed} + * callback will be fired when a new session is created by the camera device and the previous + * session is being removed from memory.

+ * + *

Cancelling will introduce at least a brief pause in the stream of data from the camera + * device, since once the camera device is emptied, the first new request has to make it through + * the entire camera pipeline before new output buffers are produced.

+ * + *

This means that using ACameraCaptureSession_abortCaptures to simply remove pending requests is + * not recommended; it's best used for quickly switching output configurations, or for cancelling + * long in-progress requests (such as a multi-second capture).

+ * + * @param session the capture session of interest + * + * @return
  • + * {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled + * if it is not NULL.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if session is NULL.
  • + *
  • {@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error
  • + *
  • {@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons
+ */ +//camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session); +func (session *CaptureSession) AbortCaptures() error { + return Status(C.ACameraCaptureSession_abortCaptures(session.cptr())) +} + +// capture callbacks +var captureSessionCaptureMap = map[unsafe.Pointer]interface{}{} + +type OnCaptureStarted interface { + OnCaptureStarted(*CaptureSession, *CaptureRequest, time.Duration) +} + +//export cgoCaptureStarted +func cgoCaptureStarted(context unsafe.Pointer, session *C.ACameraCaptureSession, + request *C.ACaptureRequest, timestamp C.int64_t) { + if o, ok := captureSessionCaptureMap[context]; ok && o != nil { + if i, ok := o.(OnCaptureStarted); ok { + i.OnCaptureStarted((*CaptureSession)(session), + (*CaptureRequest)(request), time.Nanosecond*time.Duration(timestamp)) + } + } +} + +// Capture Callbacks +type OnCaptureProgressed interface { + OnCaptureProgressed(*CaptureSession, *CaptureRequest, *Metadata) +} + +type OnCaptureCompleted interface { + OnCaptureCompleted(*CaptureSession, *CaptureRequest, *Metadata) +} + +type OnCaptureFailed interface { + OnCaptureFailed(*CaptureSession, *CaptureRequest, *CaptureFailure) +} + +type OnCaptureSequenceCompleted interface { + OnCaptureSequenceCompleted(*CaptureSession, int, int64) +} + +type OnCaptureSequenceAborted interface { + OnCaptureSequenceAborted(*CaptureSession, int) } -// NewCaptureSessionFromPointer wraps a raw ACameraCaptureSession pointer. -func NewCaptureSessionFromPointer(ptr unsafe.Pointer) *CaptureSession { - return &CaptureSession{ptr: (*capi.ACameraCaptureSession)(ptr)} +type OnCaptureBufferLost interface { + OnCaptureBufferLost(*CaptureSession, *CaptureRequest, *ndk.Window, int64) } -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CaptureSession) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) +//export cgoCaptureProgressed +func cgoCaptureProgressed(context unsafe.Pointer, session *C.ACameraCaptureSession, + request *C.ACaptureRequest, result *C.ACameraMetadata) { + if o, ok := captureSessionCaptureMap[context]; ok && o != nil { + if i, ok := o.(OnCaptureProgressed); ok { + i.OnCaptureProgressed((*CaptureSession)(session), + (*CaptureRequest)(request), (*Metadata)(result)) + } + } } -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CaptureSession) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) +//export cgoCaptureCompleted +func cgoCaptureCompleted(context unsafe.Pointer, session *C.ACameraCaptureSession, + request *C.ACaptureRequest, result *C.ACameraMetadata) { + if o, ok := captureSessionCaptureMap[context]; ok && o != nil { + if i, ok := o.(OnCaptureCompleted); ok { + i.OnCaptureCompleted((*CaptureSession)(session), + (*CaptureRequest)(request), (*Metadata)(result)) + } + } +} + +//export cgoCaptureFailed +func cgoCaptureFailed(context unsafe.Pointer, session *C.ACameraCaptureSession, + request *C.ACaptureRequest, failure *C.ACameraCaptureFailure) { + if o, ok := captureSessionCaptureMap[context]; ok && o != nil { + if i, ok := o.(OnCaptureFailed); ok { + i.OnCaptureFailed((*CaptureSession)(session), + (*CaptureRequest)(request), (*CaptureFailure)(failure)) + } + } +} + +//export cgoCaptureSequenceCompleted +func cgoCaptureSequenceCompleted(context unsafe.Pointer, session *C.ACameraCaptureSession, + sequenceId C.int, frameNumber C.int64_t) { + if o, ok := captureSessionCaptureMap[context]; ok && o != nil { + if i, ok := o.(OnCaptureSequenceCompleted); ok { + i.OnCaptureSequenceCompleted((*CaptureSession)(session), + int(sequenceId), int64(frameNumber)) + } + } } -// NewCaptureSessionFromUintPtr wraps a uintptr as a CaptureSession. -// The caller must ensure ptr points to a valid ACameraCaptureSession. -func NewCaptureSessionFromUintPtr(ptr uintptr) *CaptureSession { - return &CaptureSession{ptr: (*capi.ACameraCaptureSession)(unsafe.Pointer(ptr))} +//export cgoCaptureSequenceAborted +func cgoCaptureSequenceAborted(context unsafe.Pointer, session *C.ACameraCaptureSession, + sequenceId C.int) { + if o, ok := captureSessionCaptureMap[context]; ok && o != nil { + if i, ok := o.(OnCaptureSequenceAborted); ok { + i.OnCaptureSequenceAborted((*CaptureSession)(session), int(sequenceId)) + } + } } -// SetRepeatingRequest calls the underlying NDK function. -func (h *CaptureSession) SetRepeatingRequest(req *CaptureRequest) error { - return result(capi.ACameraCaptureSession_setRepeatingRequest(h.ptr, nil, 1, &req.ptr, nil)) +//export cgoCaptureBufferLost +func cgoCaptureBufferLost(context unsafe.Pointer, session *C.ACameraCaptureSession, + request *C.ACaptureRequest, window *C.ANativeWindow, frameNumber C.int64_t) { + if o, ok := captureSessionCaptureMap[context]; ok && o != nil { + if i, ok := o.(OnCaptureBufferLost); ok { + i.OnCaptureBufferLost((*CaptureSession)(session), + (*CaptureRequest)(request), (*ndk.Window)(window), int64(frameNumber)) + } + } } -// StopRepeating calls the underlying NDK function. -func (h *CaptureSession) StopRepeating() error { - return result(capi.ACameraCaptureSession_stopRepeating(h.ptr)) +func getCaptureCallbacks(o interface{}, context unsafe.Pointer) *C.ACameraCaptureSession_captureCallbacks { + var captureListener C.ACameraCaptureSession_captureCallbacks + captureListener.context = context + n := 0 + if _, ok := o.(OnCaptureStarted); ok { + n++ + captureListener.onCaptureStarted = C.ACameraCaptureSession_captureCallback_start(C.cgoCaptureStarted) + } + if _, ok := o.(OnCaptureProgressed); ok { + n++ + captureListener.onCaptureProgressed = C.ACameraCaptureSession_captureCallback_result(C.cgoCaptureProgressed) + } + if _, ok := o.(OnCaptureCompleted); ok { + n++ + captureListener.onCaptureCompleted = C.ACameraCaptureSession_captureCallback_result(C.cgoCaptureCompleted) + } + if _, ok := o.(OnCaptureFailed); ok { + n++ + captureListener.onCaptureFailed = C.ACameraCaptureSession_captureCallback_failed(C.cgoCaptureFailed) + } + if _, ok := o.(OnCaptureSequenceCompleted); ok { + n++ + captureListener.onCaptureSequenceCompleted = C.ACameraCaptureSession_captureCallback_sequenceEnd(C.cgoCaptureSequenceCompleted) + } + if _, ok := o.(OnCaptureSequenceAborted); ok { + n++ + captureListener.onCaptureSequenceAborted = C.ACameraCaptureSession_captureCallback_sequenceAbort(C.cgoCaptureSequenceAborted) + } + if _, ok := o.(OnCaptureBufferLost); ok { + n++ + captureListener.onCaptureBufferLost = C.ACameraCaptureSession_captureCallback_bufferLost(C.cgoCaptureBufferLost) + } + if n > 0 { + captureSessionCaptureMap[context] = o + return &captureListener + } + return nil } diff --git a/camera/device.go b/camera/device.go index 62f86b7..a12f429 100644 --- a/camera/device.go +++ b/camera/device.go @@ -1,83 +1,758 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + */ + +/** + * @file NdkCameraDevice.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ package camera +/* +#include +#include + +extern void cgoSessionStateClosed(void*, ACameraCaptureSession*); +extern void cgoSessionStateReady(void*, ACameraCaptureSession*); +extern void cgoSessionStateActive(void*, ACameraCaptureSession*); +*/ +import "C" + import ( "unsafe" - capi "github.com/AndroidGoLab/ndk/capi/camera" + "github.com/xaionaro-go/ndk/ndk" ) -// Device wraps the NDK ACameraDevice handle. -type Device struct { - ptr *capi.ACameraDevice +/** + * ACameraDevice is opaque type that provides access to a camera device. + * + * A pointer can be obtained using {@link ACameraManager_openCamera} method. + */ +type Device C.ACameraDevice + +func (device *Device) cptr() *C.ACameraDevice { + return (*C.ACameraDevice)(device) } -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Device) cptr() *capi.ACameraDevice { - if h == nil { - return nil - } - return h.ptr +// / Enum for ACameraDevice_ErrorStateCallback error code +const ( + /** + * The camera device is in use already. + */ + ERROR_CAMERA_IN_USE = C.ERROR_CAMERA_IN_USE + + /** + * The system-wide limit for number of open cameras or camera resources has + * been reached, and more camera devices cannot be opened until previous + * instances are closed. + */ + ERROR_MAX_CAMERAS_IN_USE = C.ERROR_MAX_CAMERAS_IN_USE + + /** + * The camera is disabled due to a device policy, and cannot be opened. + */ + ERROR_CAMERA_DISABLED = C.ERROR_CAMERA_DISABLED + + /** + * The camera device has encountered a fatal error. + *

The camera device needs to be re-opened to be used again.

+ */ + ERROR_CAMERA_DEVICE = C.ERROR_CAMERA_DEVICE + + /** + * The camera service has encountered a fatal error. + *

The Android device may need to be shut down and restarted to restore + * camera function, or there may be a persistent hardware problem. + * An attempt at recovery may be possible by closing the + * CameraDevice and the CameraManager, and trying to acquire all resources + * again from scratch.

+ */ + ERROR_CAMERA_SERVICE = C.ERROR_CAMERA_SERVICE +) + +/** + * Camera device state callbacks to be used in {@link ACameraDevice_stateCallbacks}. + * + * @param context The optional context in {@link ACameraDevice_stateCallbacks} will be + * passed to this callback. + * @param device The {@link ACameraDevice} that is being disconnected. + */ +//typedef void (*ACameraDevice_StateCallback)(void* context, ACameraDevice* device); + +/** + * Camera device error state callbacks to be used in {@link ACameraDevice_stateCallbacks}. + * + * @param context The optional context in {@link ACameraDevice_stateCallbacks} will be + * passed to this callback. + * @param device The {@link ACameraDevice} that is being disconnected. + * @param error The error code describes the cause of this error callback. See the folowing + * links for more detail. + * + * @see ERROR_CAMERA_IN_USE + * @see ERROR_MAX_CAMERAS_IN_USE + * @see ERROR_CAMERA_DISABLED + * @see ERROR_CAMERA_DEVICE + * @see ERROR_CAMERA_SERVICE + */ +//typedef void (*ACameraDevice_ErrorStateCallback)(void* context, ACameraDevice* device, int error); + +// typedef struct ACameraDevice_StateCallbacks { +type DeviceStateCallbacks interface { + /// optional application context. + // void* context; + + /** + * The function is called when a camera device is no longer available for use. + * + *

Any attempt to call API methods on this ACameraDevice will return + * {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}. The disconnection could be due to a + * change in security policy or permissions; the physical disconnection + * of a removable camera device; or the camera being needed for a + * higher-priority camera API client.

+ * + *

Application should clean up the camera with {@link ACameraDevice_close} after + * this happens, as it is not recoverable until the camera can be opened + * again.

+ * + */ + // ACameraDevice_StateCallback onDisconnected; + OnDisconnected(*Device) + + /** + * The function called when a camera device has encountered a serious error. + * + *

This indicates a failure of the camera device or camera service in some way. + * Any attempt to call API methods on this ACameraDevice in the future will return + * {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}.

+ * + *

There may still be capture completion or camera stream callbacks that will be called + * after this error is received.

+ * + *

Application should clean up the camera with {@link ACameraDevice_close} after this + * happens. Further attempts at recovery are error-code specific.

+ * + */ + // ACameraDevice_ErrorStateCallback onError; + OnError(*Device, int) + + //} ACameraDevice_stateCallbacks; } -// Close releases the underlying NDK handle. -func (h *Device) Close() error { - if h.ptr == nil { - return nil - } - err := result(capi.ACameraDevice_close(h.ptr)) - h.ptr = nil - return err +/** + * Close the connection and free this ACameraDevice synchronously. Access to the ACameraDevice + * after calling this method will cause a crash. + * + *

After this call, all calls to the active ACameraCaptureSession associated to this + * ACameraDevice will return {@link ACAMERA_ERROR_SESSION_CLOSED} except for calls to + * {@link ACameraCaptureSession_close}.

+ * + *

This method will stop all repeating captures sent via + * {@link ACameraCaptureSession_setRepeatingRequest} and block until all capture requests sent via + * {@link ACameraCaptureSession_capture} is complete. Once the method returns, the camera device + * will be removed from memory and access to the closed camera device pointer will cause a crash.

+ * + * @param device the camera device to be closed + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if device is NULL.
+ */ +//camera_status_t ACameraDevice_close(ACameraDevice* device); +func (device *Device) Close() error { + return Status(C.ACameraDevice_close(device.cptr())) } -// NewDeviceFromPointer wraps a raw ACameraDevice pointer. -func NewDeviceFromPointer(ptr unsafe.Pointer) *Device { - return &Device{ptr: (*capi.ACameraDevice)(ptr)} +/** + * Return the camera id associated with this camera device. + * + * @param device the camera device to be closed + * + * @return camera ID string. The returned string is managed by framework and should not be + * delete/free by the application. Also the returned string must not be used after the device + * has been closed. + */ +//const char* ACameraDevice_getId(const ACameraDevice* device); +func (device *Device) GetId() string { + return C.GoString(C.ACameraDevice_getId(device.cptr())) } -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Device) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) +type DeviceRequestTemplate int + +const ( + /** + * Create a request suitable for a camera preview window. Specifically, this + * means that high frame rate is given priority over the highest-quality + * post-processing. These requests would normally be used with the + * {@link ACameraCaptureSession_setRepeatingRequest} method. + * This template is guaranteed to be supported on all camera devices. + * + * @see ACameraDevice_createCaptureRequest + */ + TEMPLATE_PREVIEW DeviceRequestTemplate = C.TEMPLATE_PREVIEW + + /** + * Create a request suitable for still image capture. Specifically, this + * means prioritizing image quality over frame rate. These requests would + * commonly be used with the {@link ACameraCaptureSession_capture} method. + * This template is guaranteed to be supported on all camera devices. + * + * @see ACameraDevice_createCaptureRequest + */ + TEMPLATE_STILL_CAPTURE DeviceRequestTemplate = C.TEMPLATE_STILL_CAPTURE + + /** + * Create a request suitable for video recording. Specifically, this means + * that a stable frame rate is used, and post-processing is set for + * recording quality. These requests would commonly be used with the + * {@link ACameraCaptureSession_setRepeatingRequest} method. + * This template is guaranteed to be supported on all camera devices. + * + * @see ACameraDevice_createCaptureRequest + */ + TEMPLATE_RECORD DeviceRequestTemplate = C.TEMPLATE_RECORD + + /** + * Create a request suitable for still image capture while recording + * video. Specifically, this means maximizing image quality without + * disrupting the ongoing recording. These requests would commonly be used + * with the {@link ACameraCaptureSession_capture} method while a request based on + * {@link TEMPLATE_RECORD} is is in use with {@link ACameraCaptureSession_setRepeatingRequest}. + * This template is guaranteed to be supported on all camera devices. + * + * @see ACameraDevice_createCaptureRequest + */ + TEMPLATE_VIDEO_SNAPSHOT DeviceRequestTemplate = C.TEMPLATE_VIDEO_SNAPSHOT + + /** + * Create a request suitable for zero shutter lag still capture. This means + * means maximizing image quality without compromising preview frame rate. + * AE/AWB/AF should be on auto mode. + * + * @see ACameraDevice_createCaptureRequest + */ + TEMPLATE_ZERO_SHUTTER_LAG DeviceRequestTemplate = C.TEMPLATE_ZERO_SHUTTER_LAG + + /** + * A basic template for direct application control of capture + * parameters. All automatic control is disabled (auto-exposure, auto-white + * balance, auto-focus), and post-processing parameters are set to preview + * quality. The manual capture parameters (exposure, sensitivity, and so on) + * are set to reasonable defaults, but should be overriden by the + * application depending on the intended use case. + * This template is guaranteed to be supported on camera devices that support the + * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR} capability. + * + * @see ACameraDevice_createCaptureRequest + */ + TEMPLATE_MANUAL DeviceRequestTemplate = C.TEMPLATE_MANUAL +) + +/** + * Create a ACaptureRequest for capturing images, initialized with template + * for a target use case. + * + *

The settings are chosen to be the best options for this camera device, + * so it is not recommended to reuse the same request for a different camera device.

+ * + * @param device the camera device of interest + * @param templateId the type of capture request to be created. + * See {@link }. + * @param request the output request will be stored here if the method call succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds. The created capture request will be + * filled in request argument.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if device or request is NULL, templateId + * is undefined or camera device does not support requested template. + *
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ * + * @see TEMPLATE_PREVIEW + * @see TEMPLATE_RECORD + * @see TEMPLATE_STILL_CAPTURE + * @see TEMPLATE_VIDEO_SNAPSHOT + * @see TEMPLATE_MANUAL + */ +//camera_status_t ACameraDevice_createCaptureRequest( +// const ACameraDevice* device, ACameraDevice_request_template templateId, +// /*out*/ACaptureRequest** request); +func (device *Device) CreateCaptureRequest(templateId DeviceRequestTemplate) (*CaptureRequest, error) { + var request *C.ACaptureRequest + ret := Status(C.ACameraDevice_createCaptureRequest(device.cptr(), C.ACameraDevice_request_template(templateId), &request)) + return (*CaptureRequest)(request), ret +} + +// typedef struct ACaptureSessionOutputContainer ACaptureSessionOutputContainer; +type CaptureSessionOutputContainer C.ACaptureSessionOutputContainer + +func (container *CaptureSessionOutputContainer) cptr() *C.ACaptureSessionOutputContainer { + return (*C.ACaptureSessionOutputContainer)(container) +} + +// typedef struct ACaptureSessionOutput ACaptureSessionOutput; +type CaptureSessionOutput C.ACaptureSessionOutput + +func (output *CaptureSessionOutput) cptr() *C.ACaptureSessionOutput { + return (*C.ACaptureSessionOutput)(output) +} + +/** + * Create a capture session output container. + * + *

The container is used in {@link ACameraDevice_createCaptureSession} method to create a capture + * session. Use {@link ACaptureSessionOutputContainer_free} to free the container and its memory + * after application no longer needs the ACaptureSessionOutputContainer.

+ * + * @param container the output {@link ACaptureSessionOutputContainer} will be stored here if the + * method call succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds. The created container will be + * filled in container argument.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if container is NULL.
+ */ +//camera_status_t ACaptureSessionOutputContainer_create( +// /*out*/ACaptureSessionOutputContainer** container); +func CaptureSessionOutputContainerCreate() (*CaptureSessionOutputContainer, error) { + var container *C.ACaptureSessionOutputContainer + ret := Status(C.ACaptureSessionOutputContainer_create(&container)) + return (*CaptureSessionOutputContainer)(container), ret +} + +/** + * Free a capture session output container. + * + * @param container the {@link ACaptureSessionOutputContainer} to be freed. + * + * @see ACaptureSessionOutputContainer_create + */ +//void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* container); +func (container *CaptureSessionOutputContainer) Free() { + C.ACaptureSessionOutputContainer_free(container.cptr()) +} + +/** + * Create a ACaptureSessionOutput object. + * + *

The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add + * an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use + * {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer + * needs the {@link ACaptureSessionOutput}.

+ * + * @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput} + * @param output the output {@link ACaptureSessionOutput} will be stored here if the + * method call succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds. The created container will be + * filled in the output argument.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL.
+ * + * @see ACaptureSessionOutputContainer_add + */ +//camera_status_t ACaptureSessionOutput_create( +// ANativeWindow* anw, /*out*/ACaptureSessionOutput** output); +func CaptureSessionOutputCreate(anw *ndk.Window) (*CaptureSessionOutput, error) { + var output *C.ACaptureSessionOutput + ret := Status(C.ACaptureSessionOutput_create((*C.ANativeWindow)(anw.Pointer()), &output)) + return (*CaptureSessionOutput)(output), ret +} + +/** + * Free a ACaptureSessionOutput object. + * + * @param output the {@link ACaptureSessionOutput} to be freed. + * + * @see ACaptureSessionOutput_create + */ +//void ACaptureSessionOutput_free(ACaptureSessionOutput* output); +func (output *CaptureSessionOutput) Free() { + C.ACaptureSessionOutput_free(output.cptr()) +} + +/** + * Add an {@link ACaptureSessionOutput} object to {@link ACaptureSessionOutputContainer}. + * + * @param container the {@link ACaptureSessionOutputContainer} of interest. + * @param output the output {@link ACaptureSessionOutput} to be added to container. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.
+ */ +//camera_status_t ACaptureSessionOutputContainer_add( +// ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output); +func (container *CaptureSessionOutputContainer) Add(output *CaptureSessionOutput) error { + return Status(C.ACaptureSessionOutputContainer_add(container.cptr(), output.cptr())) } -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Device) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) +/** + * Remove an {@link ACaptureSessionOutput} object from {@link ACaptureSessionOutputContainer}. + * + *

This method has no effect if the ACaptureSessionOutput does not exist in + * ACaptureSessionOutputContainer.

+ * + * @param container the {@link ACaptureSessionOutputContainer} of interest. + * @param output the output {@link ACaptureSessionOutput} to be removed from container. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.
+ */ +//camera_status_t ACaptureSessionOutputContainer_remove( +// ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output); +func (container *CaptureSessionOutputContainer) Remove(output *CaptureSessionOutput) error { + return Status(C.ACaptureSessionOutputContainer_remove(container.cptr(), output.cptr())) } -// NewDeviceFromUintPtr wraps a uintptr as a Device. -// The caller must ensure ptr points to a valid ACameraDevice. -func NewDeviceFromUintPtr(ptr uintptr) *Device { - return &Device{ptr: (*capi.ACameraDevice)(unsafe.Pointer(ptr))} +/** + * Create a new camera capture session by providing the target output set of {@link ANativeWindow} + * to the camera device. + * + *

If there is a preexisting session, the previous session will be closed + * automatically. However, app still needs to call {@link ACameraCaptureSession_close} on previous + * session. Otherwise the resources held by previous session will NOT be freed.

+ * + *

The active capture session determines the set of potential output {@link ANativeWindow}s for + * the camera device for each capture request. A given request may use all + * or only some of the outputs. Once the ACameraCaptureSession is created, requests can be + * submitted with {@link ACameraCaptureSession_capture} or + * {@link ACameraCaptureSession_setRepeatingRequest}.

+ * + *

Often the {@link ANativeWindow} used with this method can be obtained from a Surface java object by + * {@link ANativeWindow_fromSurface} NDK method. Surfaces or ANativeWindow suitable for inclusion as a camera + * output can be created for various use cases and targets:

+ * + *
    + * + *
  • For drawing to a + * SurfaceView: + * Once the SurfaceView's Surface is created, set the size + * of the Surface with + * + * android.view.SurfaceHolder\#setFixedSize to be one of the PRIVATE output sizes + * returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} + * and then obtain the Surface by calling + * android.view.SurfaceHolder\#getSurface. If the size is not set by the application, it will + * be rounded to the nearest supported size less than 1080p, by the camera device.
  • + * + *
  • For accessing through an OpenGL texture via a SurfaceTexture: + * Set the size of the SurfaceTexture with + * setDefaultBufferSize to be one of the PRIVATE output sizes + * returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} + * before creating a Surface from the SurfaceTexture with + * Surface\#Surface(SurfaceTextrue). If the size is not set by the application, it will be set to be the + * smallest supported size less than 1080p, by the camera device.
  • + * + *
  • For recording with + * MediaCodec: Call + * + * android.media.MediaCodec\#createInputSurface after configuring + * the media codec to use one of the PRIVATE output sizes + * returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}. + *
  • + * + *
  • For recording with + * MediaRecorder: Call + * + * android.media.MediaRecorder\#getSurface after configuring the media recorder to use + * one of the PRIVATE output sizes returned by + * {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}, or configuring it to use one of the supported + * + * CamcorderProfiles.
  • + * + *
  • For efficient YUV processing with + * RenderScript: + * Create a RenderScript + * + * Allocation with a supported YUV + * type, the IO_INPUT flag, and one of the YUV output sizes returned by + * {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}, + * Then obtain the Surface with + * + * Allocation#getSurface}.
  • + * + *
  • For access to RAW, uncompressed YUV, or compressed JPEG data in the application: Create an + * {@link AImageReader} object using the {@link AImageReader_new} method with one of the supported + * output formats given by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}. Then obtain a + * ANativeWindow from it with {@link AImageReader_getWindow}. + * If the AImageReader size is not set to a supported size, it will be rounded to a supported + * size less than 1080p by the camera device. + *
  • + * + *
+ * + *

The camera device will query each ANativeWindow's size and formats upon this + * call, so they must be set to a valid setting at this time.

+ * + *

It can take several hundred milliseconds for the session's configuration to complete, + * since camera hardware may need to be powered on or reconfigured.

+ * + *

If a prior ACameraCaptureSession already exists when this method is called, the previous + * session will no longer be able to accept new capture requests and will be closed. Any + * in-progress capture requests made on the prior session will be completed before it's closed. + * To minimize the transition time, + * the ACameraCaptureSession_abortCaptures method can be used to discard the remaining + * requests for the prior capture session before a new one is created. Note that once the new + * session is created, the old one can no longer have its captures aborted.

+ * + *

Using larger resolution outputs, or more outputs, can result in slower + * output rate from the device.

+ * + *

Configuring a session with an empty list will close the current session, if + * any. This can be used to release the current session's target surfaces for another use.

+ * + *

While any of the sizes from {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} can be used when + * a single output stream is configured, a given camera device may not be able to support all + * combination of sizes, formats, and targets when multiple outputs are configured at once. The + * tables below list the maximum guaranteed resolutions for combinations of streams and targets, + * given the capabilities of the camera device.

+ * + *

If an application tries to create a session using a set of targets that exceed the limits + * described in the below tables, one of three possibilities may occur. First, the session may + * be successfully created and work normally. Second, the session may be successfully created, + * but the camera device won't meet the frame rate guarantees as described in + * {@link ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS}. Or third, if the output set + * cannot be used at all, session creation will fail entirely, with + * {@link ACAMERA_ERROR_STREAM_CONFIGURE_FAIL} being returned.

+ * + *

For the type column `PRIV` refers to output format {@link AIMAGE_FORMAT_PRIVATE}, + * `YUV` refers to output format {@link AIMAGE_FORMAT_YUV_420_888}, + * `JPEG` refers to output format {@link AIMAGE_FORMAT_JPEG}, + * and `RAW` refers to output format {@link AIMAGE_FORMAT_RAW16} + * + * + *

For the maximum size column, `PREVIEW` refers to the best size match to the + * device's screen resolution, or to 1080p `(1920x1080)`, whichever is + * smaller. `RECORD` refers to the camera device's maximum supported recording resolution, + * as determined by + * android.media.CamcorderProfiles. And `MAXIMUM` refers to the + * camera device's maximum output resolution for that format or target from + * {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}.

+ * + *

To use these tables, determine the number and the formats/targets of outputs needed, and + * find the row(s) of the table with those targets. The sizes indicate the maximum set of sizes + * that can be used; it is guaranteed that for those targets, the listed sizes and anything + * smaller from the list given by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} can be + * successfully used to create a session. For example, if a row indicates that a 8 megapixel + * (MP) YUV_420_888 output can be used together with a 2 MP `PRIV` output, then a session + * can be created with targets `[8 MP YUV, 2 MP PRIV]` or targets `[2 MP YUV, 2 MP PRIV]`; + * but a session with targets `[8 MP YUV, 4 MP PRIV]`, targets `[4 MP YUV, 4 MP PRIV]`, + * or targets `[8 MP PRIV, 2 MP YUV]` would not be guaranteed to work, unless + * some other row of the table lists such a combination.

+ * + *

Legacy devices ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL} + * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY}) support at + * least the following stream combinations: + * + * + * + * + * + * + * + * + * + * + * + * + * + *
LEGACY-level guaranteed configurations
Target 1 Target 2 Target 3 Sample use case(s)
TypeMax size TypeMax size TypeMax size
`PRIV``MAXIMUM` Simple preview, GPU video processing, or no-preview video recording.
`JPEG``MAXIMUM` No-viewfinder still image capture.
`YUV ``MAXIMUM` In-application video/image processing.
`PRIV``PREVIEW` `JPEG``MAXIMUM` Standard still imaging.
`YUV ``PREVIEW` `JPEG``MAXIMUM` In-app processing plus still capture.
`PRIV``PREVIEW` `PRIV``PREVIEW` Standard recording.
`PRIV``PREVIEW` `YUV ``PREVIEW` Preview plus in-app processing.
`PRIV``PREVIEW` `YUV ``PREVIEW` `JPEG``MAXIMUM` Still capture plus in-app processing.

+ *

+ * + *

Limited-level ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL} + * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED}) devices + * support at least the following stream combinations in addition to those for + * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY} devices: + * + * + * + * + * + * + * + * + * + * + * + *
LIMITED-level additional guaranteed configurations
Target 1Target 2Target 3 Sample use case(s)
TypeMax sizeTypeMax sizeTypeMax size
`PRIV``PREVIEW` `PRIV``RECORD ` High-resolution video recording with preview.
`PRIV``PREVIEW` `YUV ``RECORD ` High-resolution in-app video processing with preview.
`YUV ``PREVIEW` `YUV ``RECORD ` Two-input in-app video processing.
`PRIV``PREVIEW` `PRIV``RECORD ` `JPEG``RECORD ` High-resolution recording with video snapshot.
`PRIV``PREVIEW` `YUV ``RECORD ` `JPEG``RECORD ` High-resolution in-app processing with video snapshot.
`YUV ``PREVIEW` `YUV ``PREVIEW` `JPEG``MAXIMUM` Two-input in-app processing with still capture.

+ *

+ * + *

FULL-level ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL} + * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL}) devices + * support at least the following stream combinations in addition to those for + * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices: + * + * + * + * + * + * + * + * + * + * + * + *
FULL-level additional guaranteed configurations
Target 1Target 2Target 3 Sample use case(s)
TypeMax sizeTypeMax sizeTypeMax size
`PRIV``PREVIEW` `PRIV``MAXIMUM` Maximum-resolution GPU processing with preview.
`PRIV``PREVIEW` `YUV ``MAXIMUM` Maximum-resolution in-app processing with preview.
`YUV ``PREVIEW` `YUV ``MAXIMUM` Maximum-resolution two-input in-app processing.
`PRIV``PREVIEW` `PRIV``PREVIEW` `JPEG``MAXIMUM` Video recording with maximum-size video snapshot
`YUV ``640x480` `PRIV``PREVIEW` `YUV ``MAXIMUM` Standard video recording plus maximum-resolution in-app processing.
`YUV ``640x480` `YUV ``PREVIEW` `YUV ``MAXIMUM` Preview plus two-input maximum-resolution in-app processing.

+ *

+ * + *

RAW-capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes + * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}) devices additionally support + * at least the following stream combinations on both + * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL} and + * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices: + * + * + * + * + * + * + * + * + * + * + * + * + * + *
RAW-capability additional guaranteed configurations
Target 1Target 2Target 3 Sample use case(s)
TypeMax sizeTypeMax sizeTypeMax size
`RAW ``MAXIMUM` No-preview DNG capture.
`PRIV``PREVIEW` `RAW ``MAXIMUM` Standard DNG capture.
`YUV ``PREVIEW` `RAW ``MAXIMUM` In-app processing plus DNG capture.
`PRIV``PREVIEW` `PRIV``PREVIEW` `RAW ``MAXIMUM` Video recording with DNG capture.
`PRIV``PREVIEW` `YUV ``PREVIEW` `RAW ``MAXIMUM` Preview with in-app processing and DNG capture.
`YUV ``PREVIEW` `YUV ``PREVIEW` `RAW ``MAXIMUM` Two-input in-app processing plus DNG capture.
`PRIV``PREVIEW` `JPEG``MAXIMUM` `RAW ``MAXIMUM` Still capture with simultaneous JPEG and DNG.
`YUV ``PREVIEW` `JPEG``MAXIMUM` `RAW ``MAXIMUM` In-app processing with simultaneous JPEG and DNG.

+ *

+ * + *

BURST-capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes + * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE BURST_CAPTURE}) devices + * support at least the below stream combinations in addition to those for + * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices. Note that all + * FULL-level devices support the BURST capability, and the below list is a strict subset of the + * list for FULL-level devices, so this table is only relevant for LIMITED-level devices that + * support the BURST_CAPTURE capability. + * + * + * + * + * + * + * + * + *
BURST-capability additional guaranteed configurations
Target 1Target 2Sample use case(s)
TypeMax sizeTypeMax size
`PRIV``PREVIEW` `PRIV``MAXIMUM` Maximum-resolution GPU processing with preview.
`PRIV``PREVIEW` `YUV ``MAXIMUM` Maximum-resolution in-app processing with preview.
`YUV ``PREVIEW` `YUV ``MAXIMUM` Maximum-resolution two-input in-app processing.

+ *

+ * + *

LEVEL-3 ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL} + * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_3 LEVEL_3}) + * support at least the following stream combinations in addition to the combinations for + * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL} and for + * RAW capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes + * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}): + * + * + * + * + * + * + * + *
LEVEL-3 additional guaranteed configurations
Target 1Target 2Target 3Target 4Sample use case(s)
TypeMax sizeTypeMax sizeTypeMax sizeTypeMax size
`PRIV``PREVIEW` `PRIV``640x480` `YUV``MAXIMUM` `RAW``MAXIMUM` In-app viewfinder analysis with dynamic selection of output format.
`PRIV``PREVIEW` `PRIV``640x480` `JPEG``MAXIMUM` `RAW``MAXIMUM` In-app viewfinder analysis with dynamic selection of output format.

+ *

+ * + *

Since the capabilities of camera devices vary greatly, a given camera device may support + * target combinations with sizes outside of these guarantees, but this can only be tested for + * by attempting to create a session with such targets.

+ * + * @param device the camera device of interest. + * @param outputs the {@link ACaptureSessionOutputContainer} describes all output streams. + * @param callbacks the {@link ACameraCaptureSession_stateCallbacks capture session state callbacks}. + * @param session the created {@link ACameraCaptureSession} will be filled here if the method call + * succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds. The created capture session will be + * filled in session argument.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if any of device, outputs, callbacks or + * session is NULL.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ */ +//camera_status_t ACameraDevice_createCaptureSession( +// ACameraDevice* device, +// const ACaptureSessionOutputContainer* outputs, +// const ACameraCaptureSession_stateCallbacks* callbacks, +// /*out*/ACameraCaptureSession** session); +func (device *Device) CreateCaptureSession(outputs *CaptureSessionOutputContainer, cb CaptureSessionStateCallbacks) (*CaptureSession, error) { + var session *C.ACameraCaptureSession + var stateCB C.ACameraCaptureSession_stateCallbacks + stateCB.onClosed = (C.ACameraCaptureSession_stateCallback)(C.cgoSessionStateClosed) + stateCB.onReady = (C.ACameraCaptureSession_stateCallback)(C.cgoSessionStateReady) + stateCB.onActive = (C.ACameraCaptureSession_stateCallback)(C.cgoSessionStateActive) + ret := Status(C.ACameraDevice_createCaptureSession(device.cptr(), outputs.cptr(), &stateCB, &session)) + if ret == nil { + captureSessionMap[session] = cb + } + return (*CaptureSession)(session), ret } -// CreateCaptureRequest creates a new CaptureRequest from this Device. -func (h *Device) CreateCaptureRequest(templateID TemplateType) (*CaptureRequest, error) { - var ptr *capi.ACaptureRequest - if err := result(capi.ACameraDevice_createCaptureRequest(h.ptr, capi.ACameraDevice_request_template(templateID), &ptr)); err != nil { - return nil, err +var captureSessionMap = map[*C.ACameraCaptureSession]CaptureSessionStateCallbacks{} + +//export cgoSessionStateClosed +func cgoSessionStateClosed(context unsafe.Pointer, session *C.ACameraCaptureSession) { + if o, ok := captureSessionMap[session]; ok && o != nil { + o.OnClosed((*CaptureSession)(session)) } - return &CaptureRequest{ptr: ptr}, nil -} - -// CreateCaptureSession creates a new CaptureSession from this Device. -func (h *Device) CreateCaptureSession(outputs *SessionOutputContainer, cbs SessionStateCallbacks) (*CaptureSession, error) { - cbID := capi.BridgeRegisterSessionStateCallbacks(cbs) - var cbsC capi.ACameraCaptureSession_stateCallbacks - capi.BridgeInitSessionStateCallbacks(&cbsC, cbID) - var ptr *capi.ACameraCaptureSession - if err := result(capi.ACameraDevice_createCaptureSession(h.ptr, outputs.cptr(), &cbsC, &ptr)); err != nil { - capi.BridgeUnregisterSessionStateCallbacks(cbID) - return nil, err + delete(captureSessionMap, session) +} + +//export cgoSessionStateReady +func cgoSessionStateReady(context unsafe.Pointer, session *C.ACameraCaptureSession) { + if o, ok := captureSessionMap[session]; ok && o != nil { + o.OnReady((*CaptureSession)(session)) } - return &CaptureSession{ptr: ptr}, nil } -// GetID returns the value directly. -func (h *Device) GetID() string { - return (string)(capi.ACameraDevice_getId(h.ptr)) +//export cgoSessionStateActive +func cgoSessionStateActive(context unsafe.Pointer, session *C.ACameraCaptureSession) { + if o, ok := captureSessionMap[session]; ok && o != nil { + o.OnActive((*CaptureSession)(session)) + } } diff --git a/camera/device_state_callbacks.go b/camera/device_state_callbacks.go deleted file mode 100644 index bd8ca67..0000000 --- a/camera/device_state_callbacks.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type DeviceStateCallbacks = capi.DeviceStateCallbacks diff --git a/camera/error.go b/camera/error.go index abc3521..c99616f 100644 --- a/camera/error.go +++ b/camera/error.go @@ -1,13 +1,185 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + */ + +/** + * @file NdkCameraError.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ package camera -type ERROR int32 +import ( + "fmt" +) + +/* +#include +*/ +import "C" + +type iStatus int const ( - ERROR_CAMERA_IN_USE ERROR = 1 - ERROR_MAX_CAMERAS_IN_USE ERROR = 2 - ERROR_CAMERA_DISABLED ERROR = 3 - ERROR_CAMERA_DEVICE ERROR = 4 - ERROR_CAMERA_SERVICE ERROR = 5 + iSTATUS_OK iStatus = C.ACAMERA_OK + + STATUS_ERROR_BASE iStatus = C.ACAMERA_ERROR_BASE + + /** + * Camera operation has failed due to an unspecified cause. + */ + STATUS_ERROR_UNKNOWN iStatus = C.ACAMERA_ERROR_UNKNOWN + + /** + * Camera operation has failed due to an invalid parameter being passed to the method. + */ + STATUS_ERROR_INVALID_PARAMETER iStatus = C.ACAMERA_ERROR_INVALID_PARAMETER + + /** + * Camera operation has failed because the camera device has been closed, possibly because a + * higher-priority client has taken ownership of the camera device. + */ + STATUS_ERROR_CAMERA_DISCONNECTED iStatus = C.ACAMERA_ERROR_CAMERA_DISCONNECTED + + /** + * Camera operation has failed due to insufficient memory. + */ + STATUS_ERROR_NOT_ENOUGH_MEMORY iStatus = C.ACAMERA_ERROR_NOT_ENOUGH_MEMORY + + /** + * Camera operation has failed due to the requested metadata tag cannot be found in input + * {@link ACameraMetadata} or {@link ACaptureRequest}. + */ + STATUS_ERROR_METADATA_NOT_FOUND iStatus = C.ACAMERA_ERROR_METADATA_NOT_FOUND + + /** + * Camera operation has failed and the camera device has encountered a fatal error and needs to + * be re-opened before it can be used again. + */ + STATUS_ERROR_CAMERA_DEVICE iStatus = C.ACAMERA_ERROR_CAMERA_DEVICE + + /** + * Camera operation has failed and the camera service has encountered a fatal error. + * + *

The Android device may need to be shut down and restarted to restore + * camera function, or there may be a persistent hardware problem.

+ * + *

An attempt at recovery may be possible by closing the + * ACameraDevice and the ACameraManager, and trying to acquire all resources + * again from scratch.

+ */ + STATUS_ERROR_CAMERA_SERVICE iStatus = C.ACAMERA_ERROR_CAMERA_SERVICE + + /** + * The {@link ACameraCaptureSession} has been closed and cannnot perform any operation other + * than {@link ACameraCaptureSession_close}. + */ + STATUS_ERROR_SESSION_CLOSED iStatus = C.ACAMERA_ERROR_SESSION_CLOSED + + /** + * Camera operation has failed due to an invalid internal operation. Usually this is due to a + * low-level problem that may resolve itself on retry + */ + STATUS_ERROR_INVALID_OPERATION iStatus = C.ACAMERA_ERROR_INVALID_OPERATION + + /** + * Camera device does not support the stream configuration provided by application in + * {@link ACameraDevice_createCaptureSession}. + */ + STATUS_ERROR_STREAM_CONFIGURE_FAIL iStatus = C.ACAMERA_ERROR_STREAM_CONFIGURE_FAIL + + /** + * Camera device is being used by another higher priority camera API client. + */ + STATUS_ERROR_CAMERA_IN_USE iStatus = C.ACAMERA_ERROR_CAMERA_IN_USE + + /** + * The system-wide limit for number of open cameras or camera resources has been reached, and + * more camera devices cannot be opened until previous instances are closed. + */ + STATUS_ERROR_MAX_CAMERA_IN_USE iStatus = C.ACAMERA_ERROR_MAX_CAMERA_IN_USE + + /** + * The camera is disabled due to a device policy, and cannot be opened. + */ + STATUS_ERROR_CAMERA_DISABLED iStatus = C.ACAMERA_ERROR_CAMERA_DISABLED + + /** + * The application does not have permission to open camera. + */ + STATUS_ERROR_PERMISSION_DENIED iStatus = C.ACAMERA_ERROR_PERMISSION_DENIED ) + +func (s iStatus) Error() string { + switch s { + case iSTATUS_OK: + return "OK" + case STATUS_ERROR_UNKNOWN: + return "ERROR_UNKNOWN" + case STATUS_ERROR_INVALID_PARAMETER: + return "ERROR_INVALID_PARAMETER" + case STATUS_ERROR_CAMERA_DISCONNECTED: + return "ERROR_CAMERA_DISCONNECTED" + case STATUS_ERROR_NOT_ENOUGH_MEMORY: + return "ERROR_NOT_ENOUGH_MEMORY" + case STATUS_ERROR_METADATA_NOT_FOUND: + return "ERROR_METADATA_NOT_FOUND" + case STATUS_ERROR_CAMERA_DEVICE: + return "ERROR_CAMERA_DEVICE" + case STATUS_ERROR_CAMERA_SERVICE: + return "ERROR_CAMERA_SERVICE" + case STATUS_ERROR_SESSION_CLOSED: + return "ERROR_SESSION_CLOSED" + case STATUS_ERROR_INVALID_OPERATION: + return "ERROR_INVALID_OPERATION" + case STATUS_ERROR_STREAM_CONFIGURE_FAIL: + return "ERROR_STREAM_CONFIGURE_FAIL" + case STATUS_ERROR_CAMERA_IN_USE: + return "ERROR_CAMERA_IN_USE" + case STATUS_ERROR_MAX_CAMERA_IN_USE: + return "ERROR_MAX_CAMERA_IN_USE" + case STATUS_ERROR_CAMERA_DISABLED: + return "ERROR_CAMERA_DISABLED" + case STATUS_ERROR_PERMISSION_DENIED: + return "ERROR_PERMISSION_DENIED" + default: + return fmt.Sprintf("ERROR_UNKNOW(%d)", int(s)) + } +} + +func Status(i C.camera_status_t) error { + if i != C.ACAMERA_OK { + return iStatus(i) + } + return nil +} diff --git a/camera/errors.go b/camera/errors.go deleted file mode 100644 index cc2962c..0000000 --- a/camera/errors.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -const ( - ErrUnknown Error = -10000 - ErrInvalidParameter Error = -10001 - ErrCameraDisconnected Error = -10002 - ErrNotEnoughMemory Error = -10003 - ErrMetadataNotFound Error = -10004 - ErrCameraDevice Error = -10005 - ErrCameraService Error = -10006 - ErrSessionClosed Error = -10007 - ErrInvalidOperation Error = -10008 - ErrStreamConfigureFail Error = -10009 - ErrCameraInUse Error = -10010 - ErrMaxCamerasInUse Error = -10011 - ErrCameraDisabled Error = -10012 - ErrPermissionDenied Error = -10013 - ErrUnsupportedOperation Error = -10014 -) - -func (e Error) Error() string { - return fmt.Sprintf("camera: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/camera/functions.go b/camera/functions.go deleted file mode 100644 index 7eab277..0000000 --- a/camera/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera diff --git a/camera/jnienv.go b/camera/jnienv.go deleted file mode 100644 index 2fa40fb..0000000 --- a/camera/jnienv.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type JNIEnv = capi.JNIEnv diff --git a/camera/jobject.go b/camera/jobject.go deleted file mode 100644 index 3282b6d..0000000 --- a/camera/jobject.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type Jobject = capi.Jobject diff --git a/camera/logical_camera_capture_failure.go b/camera/logical_camera_capture_failure.go deleted file mode 100644 index 9df2399..0000000 --- a/camera/logical_camera_capture_failure.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// LogicalCameraCaptureFailure wraps the NDK ALogicalCameraCaptureFailure handle. -type LogicalCameraCaptureFailure struct { - ptr *capi.ALogicalCameraCaptureFailure -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *LogicalCameraCaptureFailure) cptr() *capi.ALogicalCameraCaptureFailure { - if h == nil { - return nil - } - return h.ptr -} - -// NewLogicalCameraCaptureFailureFromPointer wraps a raw ALogicalCameraCaptureFailure pointer. -func NewLogicalCameraCaptureFailureFromPointer(ptr unsafe.Pointer) *LogicalCameraCaptureFailure { - return &LogicalCameraCaptureFailure{ptr: (*capi.ALogicalCameraCaptureFailure)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *LogicalCameraCaptureFailure) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *LogicalCameraCaptureFailure) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewLogicalCameraCaptureFailureFromUintPtr wraps a uintptr as a LogicalCameraCaptureFailure. -// The caller must ensure ptr points to a valid ALogicalCameraCaptureFailure. -func NewLogicalCameraCaptureFailureFromUintPtr(ptr uintptr) *LogicalCameraCaptureFailure { - return &LogicalCameraCaptureFailure{ptr: (*capi.ALogicalCameraCaptureFailure)(unsafe.Pointer(ptr))} -} diff --git a/camera/manager.go b/camera/manager.go index 5aecb4b..27de871 100644 --- a/camera/manager.go +++ b/camera/manager.go @@ -1,98 +1,399 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + */ + +/** + * @file NdkCameraManager.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ package camera import ( + "log" + "reflect" "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" ) -// Manager wraps the NDK ACameraManager handle. -type Manager struct { - ptr *capi.ACameraManager +/* +#include +#include +#include + +typedef const char* pcchar; +extern void cgoCameraAvailable(void* context, const char* cameraId); +extern void cgoCameraUnavailable(void* context, const char* cameraId); +extern void cgoCameraDeviceStateCallbacksOnError(void* context, ACameraDevice* device, int error); +extern void cgoCameraDeviceStateCallbacksOnDisconnected(void* context, ACameraDevice* device); + +*/ +import "C" + +/** + * ACameraManager is opaque type that provides access to camera service. + * + * A pointer can be obtained using {@link ACameraManager_create} method. + */ +//typedef struct ACameraManager ACameraManager; +type Manager C.ACameraManager + +func (device *Manager) cptr() *C.ACameraManager { + return (*C.ACameraManager)(device) } -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Manager) cptr() *capi.ACameraManager { - if h == nil { - return nil - } - return h.ptr +/** + * Create ACameraManager instance. + * + *

The ACameraManager is responsible for + * detecting, characterizing, and connecting to {@link ACameraDevice}s.

+ * + *

The caller must call {@link ACameraManager_delete} to free the resources once it is done + * using the ACameraManager instance.

+ * + * @return a {@link ACameraManager} instance. + * + */ +//ACameraManager* ACameraManager_create(); +func ManagerCreate() *Manager { + return (*Manager)(C.ACameraManager_create()) } -// NewManager creates a new Manager. -func NewManager() *Manager { - return &Manager{ptr: capi.ACameraManager_create()} +/** + *

Delete the {@link ACameraManager} instance and free its resources.

+ * + * @param manager the {@link ACameraManager} instance to be deleted. + */ +//void ACameraManager_delete(ACameraManager* manager); +func (manager *Manager) Delete() { + C.ACameraManager_delete(manager.cptr()) } -// Close releases the underlying NDK handle. -func (h *Manager) Close() error { - if h.ptr == nil { - return nil +/// Struct to hold list of camera devices +//typedef struct ACameraIdList { +// int numCameras; ///< Number of connected camera devices +// const char** cameraIds; ///< list of identifier of connected camera devices +//} ACameraIdList; + +/** + * Create a list of currently connected camera devices, including + * cameras that may be in use by other camera API clients. + * + *

Non-removable cameras use integers starting at 0 for their + * identifiers, while removable cameras have a unique identifier for each + * individual device, even if they are the same model.

+ * + *

ACameraManager_getCameraIdList will allocate and return an {@link ACameraIdList}. + * The caller must call {@link ACameraManager_deleteCameraIdList} to free the memory

+ * + * @param manager the {@link ACameraManager} of interest + * @param cameraIdList the output {@link ACameraIdList} will be filled in here if the method call + * succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if manager or cameraIdList is NULL.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if connection to camera service fails.
  • + *
  • {@link ACAMERA_ERROR_NOT_ENOUGH_MEMORY} if allocating memory fails.
+ */ +//camera_status_t ACameraManager_getCameraIdList(ACameraManager* manager, +// /*out*/ACameraIdList** cameraIdList); +func (manager *Manager) GetCameraIdList() ([]string, error) { + var list *C.ACameraIdList + status := Status(C.ACameraManager_getCameraIdList(manager.cptr(), &list)) + if status == nil { + log.Println(" GetCameraIdList:", int(list.numCameras)) + ids := make([]string, list.numCameras) + if list.numCameras > 0 { + for i, ptr := range (*[1 << 27]*C.char)(unsafe.Pointer(list.cameraIds))[:list.numCameras] { + ids[i] = C.GoString(ptr) + } + } + C.ACameraManager_deleteCameraIdList(list) + return ids, status } - capi.ACameraManager_delete(h.ptr) - h.ptr = nil - return nil + return nil, status } -// NewManagerFromPointer wraps a raw ACameraManager pointer. -func NewManagerFromPointer(ptr unsafe.Pointer) *Manager { - return &Manager{ptr: (*capi.ACameraManager)(ptr)} +/** + * Delete a list of camera devices allocated via {@link ACameraManager_getCameraIdList}. + * + * @param cameraIdList the {@link ACameraIdList} to be deleted. + */ +//void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList); + +/** + * Definition of camera availability callbacks. + * + * @param context The optional application context provided by user in + * {@link ACameraManager_AvailabilityCallbacks}. + * @param cameraId The ID of the camera device whose availability is changing. The memory of this + * argument is owned by camera framework and will become invalid immediately after + * this callback returns. + */ +//typedef void (*ACameraManager_AvailabilityCallback)(void* context, const char* cameraId); + +/** + * A listener for camera devices becoming available or unavailable to open. + * + *

Cameras become available when they are no longer in use, or when a new + * removable camera is connected. They become unavailable when some + * application or service starts using a camera, or when a removable camera + * is disconnected.

+ * + * @see ACameraManager_registerAvailabilityCallback + */ +//go typedef struct ACameraManager_AvailabilityListener { +/// Optional application context. +//go void* context; +/// Called when a camera becomes available +//go ACameraManager_AvailabilityCallback onCameraAvailable; +/// Called when a camera becomes unavailable +//go ACameraManager_AvailabilityCallback onCameraUnavailable; +//go } ACameraManager_AvailabilityCallbacks; +type AvailabilityCallbacks interface { + OnCameraAvailable(id string) + OnCameraUnavailable(id string) } -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Manager) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) +/** + * Register camera availability callbacks. + * + *

onCameraUnavailable will be called whenever a camera device is opened by any camera API client. + * Other camera API clients may still be able to open such a camera device, evicting the existing + * client if they have higher priority than the existing client of a camera device. + * See {@link ACameraManager_openCamera} for more details.

+ * + *

The callbacks will be called on a dedicated thread shared among all ACameraManager + * instances.

+ * + *

Since this callback will be registered with the camera service, remember to unregister it + * once it is no longer needed; otherwise the callback will continue to receive events + * indefinitely and it may prevent other resources from being released. Specifically, the + * callbacks will be invoked independently of the general activity lifecycle and independently + * of the state of individual ACameraManager instances.

+ * + * @param manager the {@link ACameraManager} of interest. + * @param callback the {@link ACameraManager_AvailabilityCallbacks} to be registered. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if manager or callback is NULL, or + * {ACameraManager_AvailabilityCallbacks#onCameraAvailable} or + * {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL.
+ */ +//camera_status_t ACameraManager_registerAvailabilityCallback( +// ACameraManager* manager, const ACameraManager_AvailabilityCallbacks* callback); +func (manager *Manager) RegisterAvailabilityCallback(cbs AvailabilityCallbacks) error { + var ccbs C.ACameraManager_AvailabilityCallbacks + ccbs.context = unsafe.Pointer(^reflect.ValueOf(cbs).Pointer()) + availabilityKeepLives[ccbs.context] = cbs + ccbs.onCameraAvailable = C.ACameraManager_AvailabilityCallback(C.cgoCameraAvailable) + ccbs.onCameraUnavailable = C.ACameraManager_AvailabilityCallback(C.cgoCameraUnavailable) + return Status(C.ACameraManager_registerAvailabilityCallback(manager.cptr(), &ccbs)) } -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Manager) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) +var availabilityKeepLives = map[unsafe.Pointer]interface{}{} + +//export cgoCameraAvailable +func cgoCameraAvailable(context unsafe.Pointer, cameraId C.pcchar) { + cbs := availabilityKeepLives[context].(AvailabilityCallbacks) + cbs.OnCameraAvailable(C.GoString(cameraId)) } -// NewManagerFromUintPtr wraps a uintptr as a Manager. -// The caller must ensure ptr points to a valid ACameraManager. -func NewManagerFromUintPtr(ptr uintptr) *Manager { - return &Manager{ptr: (*capi.ACameraManager)(unsafe.Pointer(ptr))} +//export cgoCameraUnavailable +func cgoCameraUnavailable(context unsafe.Pointer, cameraId C.pcchar) { + cbs := availabilityKeepLives[context].(AvailabilityCallbacks) + cbs.OnCameraUnavailable(C.GoString(cameraId)) } -// GetCameraCharacteristics creates a new Metadata from this Manager. -func (h *Manager) GetCameraCharacteristics(cameraID string) (*Metadata, error) { - var ptr *capi.ACameraMetadata - if err := result(capi.ACameraManager_getCameraCharacteristics(h.ptr, cameraID, &ptr)); err != nil { - return nil, err +/** + * Unregister camera availability callbacks. + * + *

Removing a callback that isn't registered has no effect.

+ * + * @param manager the {@link ACameraManager} of interest. + * @param callback the {@link ACameraManager_AvailabilityCallbacks} to be unregistered. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if callback, + * {ACameraManager_AvailabilityCallbacks#onCameraAvailable} or + * {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL.
+ */ +//camera_status_t ACameraManager_unregisterAvailabilityCallback( +// ACameraManager* manager, const ACameraManager_AvailabilityCallbacks* callback); +func (manager *Manager) UnregisterAvailabilityCallback(cbs AvailabilityCallbacks) error { + context := unsafe.Pointer(^reflect.ValueOf(cbs).Pointer()) + if _, ok := availabilityKeepLives[context]; ok { + delete(availabilityKeepLives, context) + if len(availabilityKeepLives) == 0 { + var ccbs C.ACameraManager_AvailabilityCallbacks + ccbs.context = context + ccbs.onCameraAvailable = C.ACameraManager_AvailabilityCallback(C.cgoCameraAvailable) + ccbs.onCameraUnavailable = C.ACameraManager_AvailabilityCallback(C.cgoCameraUnavailable) + return Status(C.ACameraManager_unregisterAvailabilityCallback(manager.cptr(), &ccbs)) + } + return nil } - return &Metadata{ptr: ptr}, nil + return STATUS_ERROR_INVALID_PARAMETER } -// CameraIDList returns items from the underlying list. -func (h *Manager) CameraIDList() ([]string, error) { - var list *capi.ACameraIdList - if err := result(capi.ACameraManager_getCameraIdList(h.ptr, &list)); err != nil { - return nil, err - } - defer capi.ACameraManager_deleteCameraIdList(list) - count := capi.BridgeACameraIdListCount(list) - items := make([]string, count) - for i := range items { - items[i] = capi.BridgeACameraIdListItem(list, i) - } - return items, nil +/** + * Query the capabilities of a camera device. These capabilities are + * immutable for a given camera. + * + *

See {@link ACameraMetadata} document and {@link NdkCameraMetadataTags.h} for more details.

+ * + *

The caller must call {@link ACameraMetadata_free} to free the memory of the output + * characteristics.

+ * + * @param manager the {@link ACameraManager} of interest. + * @param cameraId the ID string of the camera device of interest. + * @param characteristics the output {@link ACameraMetadata} will be filled here if the method call + * succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if manager, cameraId, or characteristics + * is NULL, or cameraId does not match any camera devices connected.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if connection to camera service fails.
  • + *
  • {@link ACAMERA_ERROR_NOT_ENOUGH_MEMORY} if allocating memory fails.
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ */ +//camera_status_t ACameraManager_getCameraCharacteristics( +// ACameraManager* manager, const char* cameraId, +// /*out*/ACameraMetadata** characteristics); +func (manager *Manager) GetCameraCharacteristics(cameraId string) (*Metadata, error) { + ccameraId := C.CString(cameraId) + defer C.free(unsafe.Pointer(ccameraId)) + var v *C.ACameraMetadata + ret := Status(C.ACameraManager_getCameraCharacteristics(manager.cptr(), ccameraId, &v)) + return (*Metadata)(v), ret } -// OpenCamera creates a new Device from this Manager. -func (h *Manager) OpenCamera(cameraID string, cbs DeviceStateCallbacks) (*Device, error) { - cbID := capi.BridgeRegisterDeviceStateCallbacks(cbs) - var cbsC capi.ACameraDevice_StateCallbacks - capi.BridgeInitDeviceStateCallbacks(&cbsC, cbID) - var ptr *capi.ACameraDevice - if err := result(capi.ACameraManager_openCamera(h.ptr, cameraID, &cbsC, &ptr)); err != nil { - capi.BridgeUnregisterDeviceStateCallbacks(cbID) - return nil, err - } - return &Device{ptr: ptr}, nil +/** + * Open a connection to a camera with the given ID. The opened camera device will be + * returned in the `device` parameter. + * + *

Use {@link ACameraManager_getCameraIdList} to get the list of available camera + * devices. Note that even if an id is listed, open may fail if the device + * is disconnected between the calls to {@link ACameraManager_getCameraIdList} and + * {@link ACameraManager_openCamera}, or if a higher-priority camera API client begins using the + * camera device.

+ * + *

Devices for which the + * {@link ACameraManager_AvailabilityCallbacks#onCameraUnavailable} callback has been called due to + * the device being in use by a lower-priority, background camera API client can still potentially + * be opened by calling this method when the calling camera API client has a higher priority + * than the current camera API client using this device. In general, if the top, foreground + * activity is running within your application process, your process will be given the highest + * priority when accessing the camera, and this method will succeed even if the camera device is + * in use by another camera API client. Any lower-priority application that loses control of the + * camera in this way will receive an + * {@link ACameraDevice_stateCallbacks#onDisconnected} callback.

+ * + *

Once the camera is successfully opened,the ACameraDevice can then be set up + * for operation by calling {@link ACameraDevice_createCaptureSession} and + * {@link ACameraDevice_createCaptureRequest}.

+ * + *

If the camera becomes disconnected after this function call returns, + * {@link ACameraDevice_stateCallbacks#onDisconnected} with a + * ACameraDevice in the disconnected state will be called.

+ * + *

If the camera runs into error after this function call returns, + * {@link ACameraDevice_stateCallbacks#onError} with a + * ACameraDevice in the error state will be called.

+ * + * @param manager the {@link ACameraManager} of interest. + * @param cameraId the ID string of the camera device to be opened. + * @param callback the {@link ACameraDevice_StateCallbacks} associated with the opened camera device. + * @param device the opened {@link ACameraDevice} will be filled here if the method call succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if manager, cameraId, callback, or device + * is NULL, or cameraId does not match any camera devices connected.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if connection to camera service fails.
  • + *
  • {@link ACAMERA_ERROR_NOT_ENOUGH_MEMORY} if allocating memory fails.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_IN_USE} if camera device is being used by a higher + * priority camera API client.
  • + *
  • {@link ACAMERA_ERROR_MAX_CAMERA_IN_USE} if the system-wide limit for number of open + * cameras or camera resources has been reached, and more camera devices cannot be + * opened until previous instances are closed.
  • + *
  • {@link ACAMERA_ERROR_CAMERA_DISABLED} if the camera is disabled due to a device + * policy, and cannot be opened.
  • + *
  • {@link ACAMERA_ERROR_PERMISSION_DENIED} if the application does not have permission + * to open camera.
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ */ +//camera_status_t ACameraManager_openCamera( +// ACameraManager* manager, const char* cameraId, +// ACameraDevice_StateCallbacks* callback, +// /*out*/ACameraDevice** device); +func (manager *Manager) OpenCamera(cameraId string, + callbacks DeviceStateCallbacks) (*Device, error) { + ccameraId := C.CString(cameraId) + defer C.free(unsafe.Pointer(ccameraId)) + var dev *C.ACameraDevice + + var ccallbacks C.ACameraDevice_stateCallbacks + ccallbacks.context = unsafe.Pointer(^reflect.ValueOf(callbacks).Pointer()) + deviceStateKeepLives[ccallbacks.context] = &openCameraContext{ + ccbs: &ccallbacks, cbs: callbacks} + ccallbacks.onDisconnected = C.ACameraDevice_StateCallback(C.cgoCameraDeviceStateCallbacksOnDisconnected) + ccallbacks.onError = C.ACameraDevice_ErrorStateCallback(C.cgoCameraDeviceStateCallbacksOnError) + + ret := Status(C.ACameraManager_openCamera(manager.cptr(), ccameraId, &ccallbacks, &dev)) + return (*Device)(dev), ret +} + +type openCameraContext struct { + ccbs *C.ACameraDevice_stateCallbacks + cbs DeviceStateCallbacks +} + +var deviceStateKeepLives = map[unsafe.Pointer]interface{}{} + +//export cgoCameraDeviceStateCallbacksOnDisconnected +func cgoCameraDeviceStateCallbacksOnDisconnected(context unsafe.Pointer, device *C.ACameraDevice) { + ctx := deviceStateKeepLives[context].(*openCameraContext) + ctx.cbs.OnDisconnected((*Device)(device)) + delete(deviceStateKeepLives, context) +} + +//export cgoCameraDeviceStateCallbacksOnError +func cgoCameraDeviceStateCallbacksOnError(context unsafe.Pointer, device *C.ACameraDevice, error C.int) { + ctx := deviceStateKeepLives[context].(*openCameraContext) + ctx.cbs.OnError((*Device)(device), int(error)) + delete(deviceStateKeepLives, context) } diff --git a/camera/metadata.go b/camera/metadata.go index 52bfcf6..2fff531 100644 --- a/camera/metadata.go +++ b/camera/metadata.go @@ -1,91 +1,376 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + */ + +/** + * @file NdkCameraMetadata.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ package camera import ( "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" ) -// Metadata wraps the NDK ACameraMetadata handle. -type Metadata struct { - ptr *capi.ACameraMetadata -} +/* +#include +#include +#include +#include + +static void* MetadataConstEntry_getData(ACameraMetadata_const_entry* entry) { + switch (entry->type) { + /// Unsigned 8-bit integer (uint8_t) + case ACAMERA_TYPE_BYTE: + return (void *)entry->data.u8; + + /// Signed 32-bit integer (int32_t) + case ACAMERA_TYPE_INT32: + return (void *)entry->data.i32; + + /// 32-bit float (float) + case ACAMERA_TYPE_FLOAT: + return (void *)entry->data.f; + + /// Signed 64-bit integer (int64_t) + case ACAMERA_TYPE_INT64: + return (void *)entry->data.i64; -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Metadata) cptr() *capi.ACameraMetadata { - if h == nil { - return nil + /// 64-bit float (double) + case ACAMERA_TYPE_DOUBLE: + return (void *)entry->data.d; + + /// A 64-bit fraction (ACameraMetadata_rational) + case ACAMERA_TYPE_RATIONAL: + return (void *)entry->data.r; } - return h.ptr + return (void *)0; } +*/ +import "C" -// Close releases the underlying NDK handle. -func (h *Metadata) Close() error { - if h.ptr == nil { - return nil - } - capi.ACameraMetadata_free(h.ptr) - h.ptr = nil - return nil +/** + * ACameraMetadata is opaque type that provides access to read-only camera metadata like camera + * characteristics (via {@link ACameraManager_getCameraCharacteristics}) or capture results (via + * {@link ACameraCaptureSession_captureCallback_result}). + */ +//typedef struct ACameraMetadata ACameraMetadata; +type Metadata C.ACameraMetadata + +func (metadata *Metadata) cptr() *C.ACameraMetadata { + return (*C.ACameraMetadata)(metadata) +} + +/** + * Possible data types of a metadata entry. + * + * Keep in sync with system/media/include/system/camera_metadata.h + */ +type Type int + +const ( + /// Unsigned 8-bit integer (uint8_t) + TYPE_BYTE Type = C.ACAMERA_TYPE_BYTE + /// Signed 32-bit integer (int32_t) + TYPE_INT32 Type = C.ACAMERA_TYPE_INT32 + /// 32-bit float (float) + TYPE_FLOAT Type = C.ACAMERA_TYPE_FLOAT + /// Signed 64-bit integer (int64_t) + TYPE_INT64 Type = C.ACAMERA_TYPE_INT64 + /// 64-bit float (double) + TYPE_DOUBLE Type = C.ACAMERA_TYPE_DOUBLE + /// A 64-bit fraction (ACameraMetadata_rational) + TYPE_RATIONAL Type = C.ACAMERA_TYPE_RATIONAL + /// Number of type fields + NUM_TYPES = C.ACAMERA_NUM_TYPES +) + +/** + * Definition of rational data type in {@link ACameraMetadata}. + */ +//typedef struct ACameraMetadata_rational { +// int32_t numerator; +// int32_t denominator; +//} ACameraMetadata_rational; +type MetadataRational C.ACameraMetadata_rational + +func (r *MetadataRational) cptr() *C.ACameraMetadata_rational { + return (*C.ACameraMetadata_rational)(r) } -// NewMetadataFromPointer wraps a raw ACameraMetadata pointer. -func NewMetadataFromPointer(ptr unsafe.Pointer) *Metadata { - return &Metadata{ptr: (*capi.ACameraMetadata)(ptr)} +func (r *MetadataRational) Numerator() uint32 { + return uint32(r.cptr().numerator) } +func (r *MetadataRational) Denominator() uint32 { + return uint32(r.cptr().denominator) +} + +/** + * A single camera metadata entry. + * + *

Each entry is an array of values, though many metadata fields may only have 1 entry in the + * array.

+ */ +//go typedef struct ACameraMetadata_entry { +/** + * The tag identifying the entry. + * + *

It is one of the values defined in {@link NdkCameraMetadataTags.h}, and defines how the + * entry should be interpreted and which parts of the API provide it. + * See {@link NdkCameraMetadataTags.h} for more details.

+ */ +//go uint32_t tag; + +/** + * The data type of this metadata entry. + * + *

Must be one of ACAMERA_TYPE_* enum values defined above. A particular tag always has the + * same type.

+ */ +//go uint8_t type; + +/** + * Count of elements (NOT count of bytes) in this metadata entry. + */ +//go uint32_t count; + +/** + * Pointer to the data held in this metadata entry. + * + *

The type field above defines which union member pointer is valid. The count field above + * defines the length of the data in number of elements.

+ */ +//go union { +//go uint8_t *u8; +//go int32_t *i32; +//go float *f; +//go int64_t *i64; +//go double *d; +//go ACameraMetadata_rational* r; +//go } data; +//go } ACameraMetadata_entry; +type MetadataEntry MetadataConstEntry -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Metadata) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) +/** + * A single read-only camera metadata entry. + * + *

Each entry is an array of values, though many metadata fields may only have 1 entry in the + * array.

+ */ +//go typedef struct ACameraMetadata_const_entry { +/** + * The tag identifying the entry. + * + *

It is one of the values defined in {@link NdkCameraMetadataTags.h}, and defines how the + * entry should be interpreted and which parts of the API provide it. + * See {@link NdkCameraMetadataTags.h} for more details.

+ */ +//go uint32_t tag; + +/** + * The data type of this metadata entry. + * + *

Must be one of ACAMERA_TYPE_* enum values defined above. A particular tag always has the + * same type.

+ */ +//go uint8_t type; + +/** + * Count of elements (NOT count of bytes) in this metadata entry. + */ +//go uint32_t count; + +/** + * Pointer to the data held in this metadata entry. + * + *

The type field above defines which union member pointer is valid. The count field above + * defines the length of the data in number of elements.

+ */ +//go union { +//go const uint8_t *u8; +//go const int32_t *i32; +//go const float *f; +//go const int64_t *i64; +//go const double *d; +//go const ACameraMetadata_rational* r; +//go } data; +//go } ACameraMetadata_const_entry; +type MetadataConstEntry C.ACameraMetadata_const_entry + +func (entry *MetadataConstEntry) cptr() *C.ACameraMetadata_const_entry { + return (*C.ACameraMetadata_const_entry)(entry) } -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Metadata) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) +func (entry *MetadataConstEntry) Tag() MetadataTag { + return MetadataTag(entry.cptr().tag) } -// NewMetadataFromUintPtr wraps a uintptr as a Metadata. -// The caller must ensure ptr points to a valid ACameraMetadata. -func NewMetadataFromUintPtr(ptr uintptr) *Metadata { - return &Metadata{ptr: (*capi.ACameraMetadata)(unsafe.Pointer(ptr))} +func (entry *MetadataConstEntry) Type() Type { + return Type(entry.cptr()._type) } -// Copy creates a new Metadata from this Metadata. -func (h *Metadata) Copy() *Metadata { - return &Metadata{ptr: capi.ACameraMetadata_copy(h.ptr)} +func (entry *MetadataConstEntry) Count() int { + return int(entry.cptr().count) } -// U8Count returns the value directly. -func (h *Metadata) U8Count(tag uint32) int32 { - return (int32)(capi.BridgeMetadataU8Count(h.ptr, tag)) +func (entry *MetadataConstEntry) Data() interface{} { + dataPtr := unsafe.Pointer(C.MetadataConstEntry_getData(entry.cptr())) + switch entry.Type() { + /// Unsigned 8-bit integer (uint8_t) + case TYPE_BYTE: + return (*[1 << 28]uint8)(dataPtr)[:entry.Count()] + + /// Signed 32-bit integer (int32_t) + case TYPE_INT32: + return (*[1 << 28]int32)(dataPtr)[:entry.Count()] + + /// 32-bit float (float) + case TYPE_FLOAT: + return (*[1 << 28]float32)(dataPtr)[:entry.Count()] + + /// Signed 64-bit integer (int64_t) + case TYPE_INT64: + return (*[1 << 27]int64)(dataPtr)[:entry.Count()] + + /// 64-bit float (double) + case TYPE_DOUBLE: + return (*[1 << 27]float64)(dataPtr)[:entry.Count()] + + /// A 64-bit fraction (ACameraMetadata_rational) + case TYPE_RATIONAL: + return (*[1 << 27]MetadataRational)(dataPtr)[:entry.Count()] + + default: + } + return nil } -// U8At returns the value directly. -func (h *Metadata) U8At(tag uint32, idx int32) uint8 { - return (uint8)(capi.BridgeMetadataU8At(h.ptr, tag, idx)) +/** + * Get a metadata entry from an input {@link ACameraMetadata}. + * + *

The memory of the data field in the returned entry is managed by camera framework. Do not + * attempt to free it.

+ * + * @param metadata the {@link ACameraMetadata} of interest. + * @param tag the tag value of the camera metadata entry to be get. + * @param entry the output {@link ACameraMetadata_const_entry} will be filled here if the method + * call succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if metadata or entry is NULL.
  • + *
  • {@link ACAMERA_ERROR_METADATA_NOT_FOUND} if input metadata does not contain an entry + * of input tag value.
+ */ +//camera_status_t ACameraMetadata_getConstEntry( +// const ACameraMetadata* metadata, uint32_t tag, /*out*/ACameraMetadata_const_entry* entry); +func (metadata *Metadata) GetConstEntry(tag MetadataTag) (*MetadataConstEntry, error) { + var v C.ACameraMetadata_const_entry + ret := Status(C.ACameraMetadata_getConstEntry(metadata.cptr(), C.uint32_t(tag), &v)) + if ret == nil { + return (*MetadataConstEntry)(&v), ret + } + return nil, ret } -// I32Count returns the value directly. -func (h *Metadata) I32Count(tag uint32) int32 { - return (int32)(capi.BridgeMetadataI32Count(h.ptr, tag)) +/** + * List all the entry tags in input {@link ACameraMetadata}. + * + * @param metadata the {@link ACameraMetadata} of interest. + * @param numEntries number of metadata entries in input {@link ACameraMetadata} + * @param tags the tag values of the metadata entries. Length of tags is returned in numEntries + * argument. The memory is managed by ACameraMetadata itself and must NOT be free/delete + * by application. Do NOT access tags after calling ACameraMetadata_free. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if metadata, numEntries or tags is NULL.
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ */ +//camera_status_t ACameraMetadata_getAllTags( +// const ACameraMetadata* metadata, /*out*/int32_t* numEntries, /*out*/const uint32_t** tags); +func (metadata *Metadata) GetAllTags() ([]MetadataTag, error) { + var numEntries C.int32_t + var tags *C.uint32_t + ret := Status(C.ACameraMetadata_getAllTags(metadata.cptr(), &numEntries, &tags)) + if ret == nil { + return (*[1 << 28]MetadataTag)(unsafe.Pointer(tags))[:numEntries], ret + } else { + return nil, ret + } } -// I32At returns the value directly. -func (h *Metadata) I32At(tag uint32, idx int32) int32 { - return (int32)(capi.BridgeMetadataI32At(h.ptr, tag, idx)) +/** + * Create a copy of input {@link ACameraMetadata}. + * + *

The returned ACameraMetadata must be freed by the application by {@link ACameraMetadata_free} + * after application is done using it.

+ * + * @param src the input {@link ACameraMetadata} to be copied. + * + * @return a valid ACameraMetadata pointer or NULL if the input metadata cannot be copied. + */ +//ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src); +func (metadata *Metadata) Copy() *Metadata { + return (*Metadata)(C.ACameraMetadata_copy(metadata.cptr())) } -// FloatCount returns the value directly. -func (h *Metadata) FloatCount(tag uint32) int32 { - return (int32)(capi.BridgeMetadataFloatCount(h.ptr, tag)) +/** + * Free a {@link ACameraMetadata} structure. + * + * @param metadata the {@link ACameraMetadata} to be freed. + */ +//void ACameraMetadata_free(ACameraMetadata* metadata); +func (metadata *Metadata) Free() { + C.ACameraMetadata_free(metadata.cptr()) } -// FloatAt returns the value directly. -func (h *Metadata) FloatAt(tag uint32, idx int32) float32 { - return (float32)(capi.BridgeMetadataFloatAt(h.ptr, tag, idx)) +func (t Type) String() string { + switch t { + case TYPE_BYTE: + return "BYTE" + case TYPE_INT32: + return "INT32" + case TYPE_FLOAT: + return "FLOAT" + case TYPE_INT64: + return "INT64" + case TYPE_DOUBLE: + return "DOUBLE" + case TYPE_RATIONAL: + return "RATIONAL" + default: + return "UNKNOWN" + } } diff --git a/camera/metadata_str.go b/camera/metadata_str.go new file mode 100644 index 0000000..c30ee4c --- /dev/null +++ b/camera/metadata_str.go @@ -0,0 +1,388 @@ +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package camera + +import ( + "fmt" +) + +func (t MetadataTag) String() string { + switch t { + default: + return fmt.Sprintf("UNKNOWN_METADATATAG_%d", t) + case COLOR_CORRECTION_MODE: + return "CAMERA_COLOR_CORRECTION_MODE" + case COLOR_CORRECTION_TRANSFORM: + return "CAMERA_COLOR_CORRECTION_TRANSFORM" + case COLOR_CORRECTION_GAINS: + return "CAMERA_COLOR_CORRECTION_GAINS" + case COLOR_CORRECTION_ABERRATION_MODE: + return "CAMERA_COLOR_CORRECTION_ABERRATION_MODE" + case COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES: + return "CAMERA_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES" + case COLOR_CORRECTION_END: + return "CAMERA_COLOR_CORRECTION_END" + case CONTROL_AE_ANTIBANDING_MODE: + return "CAMERA_CONTROL_AE_ANTIBANDING_MODE" + case CONTROL_AE_EXPOSURE_COMPENSATION: + return "CAMERA_CONTROL_AE_EXPOSURE_COMPENSATION" + case CONTROL_AE_LOCK: + return "CAMERA_CONTROL_AE_LOCK" + case CONTROL_AE_MODE: + return "CAMERA_CONTROL_AE_MODE" + case CONTROL_AE_REGIONS: + return "CAMERA_CONTROL_AE_REGIONS" + case CONTROL_AE_TARGET_FPS_RANGE: + return "CAMERA_CONTROL_AE_TARGET_FPS_RANGE" + case CONTROL_AE_PRECAPTURE_TRIGGER: + return "CAMERA_CONTROL_AE_PRECAPTURE_TRIGGER" + case CONTROL_AF_MODE: + return "CAMERA_CONTROL_AF_MODE" + case CONTROL_AF_REGIONS: + return "CAMERA_CONTROL_AF_REGIONS" + case CONTROL_AF_TRIGGER: + return "CAMERA_CONTROL_AF_TRIGGER" + case CONTROL_AWB_LOCK: + return "CAMERA_CONTROL_AWB_LOCK" + case CONTROL_AWB_MODE: + return "CAMERA_CONTROL_AWB_MODE" + case CONTROL_AWB_REGIONS: + return "CAMERA_CONTROL_AWB_REGIONS" + case CONTROL_CAPTURE_INTENT: + return "CAMERA_CONTROL_CAPTURE_INTENT" + case CONTROL_EFFECT_MODE: + return "CAMERA_CONTROL_EFFECT_MODE" + case CONTROL_MODE: + return "CAMERA_CONTROL_MODE" + case CONTROL_SCENE_MODE: + return "CAMERA_CONTROL_SCENE_MODE" + case CONTROL_VIDEO_STABILIZATION_MODE: + return "CAMERA_CONTROL_VIDEO_STABILIZATION_MODE" + case CONTROL_AE_AVAILABLE_ANTIBANDING_MODES: + return "CAMERA_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES" + case CONTROL_AE_AVAILABLE_MODES: + return "CAMERA_CONTROL_AE_AVAILABLE_MODES" + case CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES: + return "CAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES" + case CONTROL_AE_COMPENSATION_RANGE: + return "CAMERA_CONTROL_AE_COMPENSATION_RANGE" + case CONTROL_AE_COMPENSATION_STEP: + return "CAMERA_CONTROL_AE_COMPENSATION_STEP" + case CONTROL_AF_AVAILABLE_MODES: + return "CAMERA_CONTROL_AF_AVAILABLE_MODES" + case CONTROL_AVAILABLE_EFFECTS: + return "CAMERA_CONTROL_AVAILABLE_EFFECTS" + case CONTROL_AVAILABLE_SCENE_MODES: + return "CAMERA_CONTROL_AVAILABLE_SCENE_MODES" + case CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES: + return "CAMERA_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES" + case CONTROL_AWB_AVAILABLE_MODES: + return "CAMERA_CONTROL_AWB_AVAILABLE_MODES" + case CONTROL_MAX_REGIONS: + return "CAMERA_CONTROL_MAX_REGIONS" + case CONTROL_AE_STATE: + return "CAMERA_CONTROL_AE_STATE" + case CONTROL_AF_STATE: + return "CAMERA_CONTROL_AF_STATE" + case CONTROL_AWB_STATE: + return "CAMERA_CONTROL_AWB_STATE" + case CONTROL_AE_LOCK_AVAILABLE: + return "CAMERA_CONTROL_AE_LOCK_AVAILABLE" + case CONTROL_AWB_LOCK_AVAILABLE: + return "CAMERA_CONTROL_AWB_LOCK_AVAILABLE" + case CONTROL_AVAILABLE_MODES: + return "CAMERA_CONTROL_AVAILABLE_MODES" + case CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE: + return "CAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE" + case CONTROL_POST_RAW_SENSITIVITY_BOOST: + return "CAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST" + case CONTROL_ENABLE_ZSL: + return "CAMERA_CONTROL_ENABLE_ZSL" + case CONTROL_END: + return "CAMERA_CONTROL_END" + case EDGE_MODE: + return "CAMERA_EDGE_MODE" + case EDGE_AVAILABLE_EDGE_MODES: + return "CAMERA_EDGE_AVAILABLE_EDGE_MODES" + case EDGE_END: + return "CAMERA_EDGE_END" + case FLASH_MODE: + return "CAMERA_FLASH_MODE" + case FLASH_STATE: + return "CAMERA_FLASH_STATE" + case FLASH_END: + return "CAMERA_FLASH_END" + case FLASH_INFO_AVAILABLE: + return "CAMERA_FLASH_INFO_AVAILABLE" + case FLASH_INFO_END: + return "CAMERA_FLASH_INFO_END" + case HOT_PIXEL_MODE: + return "CAMERA_HOT_PIXEL_MODE" + case HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES: + return "CAMERA_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES" + case HOT_PIXEL_END: + return "CAMERA_HOT_PIXEL_END" + case JPEG_GPS_COORDINATES: + return "CAMERA_JPEG_GPS_COORDINATES" + case JPEG_GPS_PROCESSING_METHOD: + return "CAMERA_JPEG_GPS_PROCESSING_METHOD" + case JPEG_GPS_TIMESTAMP: + return "CAMERA_JPEG_GPS_TIMESTAMP" + case JPEG_ORIENTATION: + return "CAMERA_JPEG_ORIENTATION" + case JPEG_QUALITY: + return "CAMERA_JPEG_QUALITY" + case JPEG_THUMBNAIL_QUALITY: + return "CAMERA_JPEG_THUMBNAIL_QUALITY" + case JPEG_THUMBNAIL_SIZE: + return "CAMERA_JPEG_THUMBNAIL_SIZE" + case JPEG_AVAILABLE_THUMBNAIL_SIZES: + return "CAMERA_JPEG_AVAILABLE_THUMBNAIL_SIZES" + case JPEG_END: + return "CAMERA_JPEG_END" + case LENS_APERTURE: + return "CAMERA_LENS_APERTURE" + case LENS_FILTER_DENSITY: + return "CAMERA_LENS_FILTER_DENSITY" + case LENS_FOCAL_LENGTH: + return "CAMERA_LENS_FOCAL_LENGTH" + case LENS_FOCUS_DISTANCE: + return "CAMERA_LENS_FOCUS_DISTANCE" + case LENS_OPTICAL_STABILIZATION_MODE: + return "CAMERA_LENS_OPTICAL_STABILIZATION_MODE" + case LENS_FACING: + return "CAMERA_LENS_FACING" + case LENS_POSE_ROTATION: + return "CAMERA_LENS_POSE_ROTATION" + case LENS_POSE_TRANSLATION: + return "CAMERA_LENS_POSE_TRANSLATION" + case LENS_FOCUS_RANGE: + return "CAMERA_LENS_FOCUS_RANGE" + case LENS_STATE: + return "CAMERA_LENS_STATE" + case LENS_INTRINSIC_CALIBRATION: + return "CAMERA_LENS_INTRINSIC_CALIBRATION" + case LENS_RADIAL_DISTORTION: + return "CAMERA_LENS_RADIAL_DISTORTION" + case LENS_END: + return "CAMERA_LENS_END" + case LENS_INFO_AVAILABLE_APERTURES: + return "CAMERA_LENS_INFO_AVAILABLE_APERTURES" + case LENS_INFO_AVAILABLE_FILTER_DENSITIES: + return "CAMERA_LENS_INFO_AVAILABLE_FILTER_DENSITIES" + case LENS_INFO_AVAILABLE_FOCAL_LENGTHS: + return "CAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS" + case LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION: + return "CAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION" + case LENS_INFO_HYPERFOCAL_DISTANCE: + return "CAMERA_LENS_INFO_HYPERFOCAL_DISTANCE" + case LENS_INFO_MINIMUM_FOCUS_DISTANCE: + return "CAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE" + case LENS_INFO_SHADING_MAP_SIZE: + return "CAMERA_LENS_INFO_SHADING_MAP_SIZE" + case LENS_INFO_FOCUS_DISTANCE_CALIBRATION: + return "CAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION" + case LENS_INFO_END: + return "CAMERA_LENS_INFO_END" + case NOISE_REDUCTION_MODE: + return "CAMERA_NOISE_REDUCTION_MODE" + case NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES: + return "CAMERA_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES" + case NOISE_REDUCTION_END: + return "CAMERA_NOISE_REDUCTION_END" + case REQUEST_MAX_NUM_OUTPUT_STREAMS: + return "CAMERA_REQUEST_MAX_NUM_OUTPUT_STREAMS" + case REQUEST_PIPELINE_DEPTH: + return "CAMERA_REQUEST_PIPELINE_DEPTH" + case REQUEST_PIPELINE_MAX_DEPTH: + return "CAMERA_REQUEST_PIPELINE_MAX_DEPTH" + case REQUEST_PARTIAL_RESULT_COUNT: + return "CAMERA_REQUEST_PARTIAL_RESULT_COUNT" + case REQUEST_AVAILABLE_CAPABILITIES: + return "CAMERA_REQUEST_AVAILABLE_CAPABILITIES" + case REQUEST_AVAILABLE_REQUEST_KEYS: + return "CAMERA_REQUEST_AVAILABLE_REQUEST_KEYS" + case REQUEST_AVAILABLE_RESULT_KEYS: + return "CAMERA_REQUEST_AVAILABLE_RESULT_KEYS" + case REQUEST_AVAILABLE_CHARACTERISTICS_KEYS: + return "CAMERA_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS" + case REQUEST_END: + return "CAMERA_REQUEST_END" + case SCALER_CROP_REGION: + return "CAMERA_SCALER_CROP_REGION" + case SCALER_AVAILABLE_MAX_DIGITAL_ZOOM: + return "CAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM" + case SCALER_AVAILABLE_STREAM_CONFIGURATIONS: + return "CAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS" + case SCALER_AVAILABLE_MIN_FRAME_DURATIONS: + return "CAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS" + case SCALER_AVAILABLE_STALL_DURATIONS: + return "CAMERA_SCALER_AVAILABLE_STALL_DURATIONS" + case SCALER_CROPPING_TYPE: + return "CAMERA_SCALER_CROPPING_TYPE" + case SCALER_END: + return "CAMERA_SCALER_END" + case SENSOR_EXPOSURE_TIME: + return "CAMERA_SENSOR_EXPOSURE_TIME" + case SENSOR_FRAME_DURATION: + return "CAMERA_SENSOR_FRAME_DURATION" + case SENSOR_SENSITIVITY: + return "CAMERA_SENSOR_SENSITIVITY" + case SENSOR_REFERENCE_ILLUMINANT1: + return "CAMERA_SENSOR_REFERENCE_ILLUMINANT1" + case SENSOR_REFERENCE_ILLUMINANT2: + return "CAMERA_SENSOR_REFERENCE_ILLUMINANT2" + case SENSOR_CALIBRATION_TRANSFORM1: + return "CAMERA_SENSOR_CALIBRATION_TRANSFORM1" + case SENSOR_CALIBRATION_TRANSFORM2: + return "CAMERA_SENSOR_CALIBRATION_TRANSFORM2" + case SENSOR_COLOR_TRANSFORM1: + return "CAMERA_SENSOR_COLOR_TRANSFORM1" + case SENSOR_COLOR_TRANSFORM2: + return "CAMERA_SENSOR_COLOR_TRANSFORM2" + case SENSOR_FORWARD_MATRIX1: + return "CAMERA_SENSOR_FORWARD_MATRIX1" + case SENSOR_FORWARD_MATRIX2: + return "CAMERA_SENSOR_FORWARD_MATRIX2" + case SENSOR_BLACK_LEVEL_PATTERN: + return "CAMERA_SENSOR_BLACK_LEVEL_PATTERN" + case SENSOR_MAX_ANALOG_SENSITIVITY: + return "CAMERA_SENSOR_MAX_ANALOG_SENSITIVITY" + case SENSOR_ORIENTATION: + return "CAMERA_SENSOR_ORIENTATION" + case SENSOR_TIMESTAMP: + return "CAMERA_SENSOR_TIMESTAMP" + case SENSOR_NEUTRAL_COLOR_POINT: + return "CAMERA_SENSOR_NEUTRAL_COLOR_POINT" + case SENSOR_NOISE_PROFILE: + return "CAMERA_SENSOR_NOISE_PROFILE" + case SENSOR_GREEN_SPLIT: + return "CAMERA_SENSOR_GREEN_SPLIT" + case SENSOR_TEST_PATTERN_DATA: + return "CAMERA_SENSOR_TEST_PATTERN_DATA" + case SENSOR_TEST_PATTERN_MODE: + return "CAMERA_SENSOR_TEST_PATTERN_MODE" + case SENSOR_AVAILABLE_TEST_PATTERN_MODES: + return "CAMERA_SENSOR_AVAILABLE_TEST_PATTERN_MODES" + case SENSOR_ROLLING_SHUTTER_SKEW: + return "CAMERA_SENSOR_ROLLING_SHUTTER_SKEW" + case SENSOR_OPTICAL_BLACK_REGIONS: + return "CAMERA_SENSOR_OPTICAL_BLACK_REGIONS" + case SENSOR_DYNAMIC_BLACK_LEVEL: + return "CAMERA_SENSOR_DYNAMIC_BLACK_LEVEL" + case SENSOR_DYNAMIC_WHITE_LEVEL: + return "CAMERA_SENSOR_DYNAMIC_WHITE_LEVEL" + case SENSOR_END: + return "CAMERA_SENSOR_END" + case SENSOR_INFO_ACTIVE_ARRAY_SIZE: + return "CAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE" + case SENSOR_INFO_SENSITIVITY_RANGE: + return "CAMERA_SENSOR_INFO_SENSITIVITY_RANGE" + case SENSOR_INFO_COLOR_FILTER_ARRANGEMENT: + return "CAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT" + case SENSOR_INFO_EXPOSURE_TIME_RANGE: + return "CAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE" + case SENSOR_INFO_MAX_FRAME_DURATION: + return "CAMERA_SENSOR_INFO_MAX_FRAME_DURATION" + case SENSOR_INFO_PHYSICAL_SIZE: + return "CAMERA_SENSOR_INFO_PHYSICAL_SIZE" + case SENSOR_INFO_PIXEL_ARRAY_SIZE: + return "CAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE" + case SENSOR_INFO_WHITE_LEVEL: + return "CAMERA_SENSOR_INFO_WHITE_LEVEL" + case SENSOR_INFO_TIMESTAMP_SOURCE: + return "CAMERA_SENSOR_INFO_TIMESTAMP_SOURCE" + case SENSOR_INFO_LENS_SHADING_APPLIED: + return "CAMERA_SENSOR_INFO_LENS_SHADING_APPLIED" + case SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE: + return "CAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE" + case SENSOR_INFO_END: + return "CAMERA_SENSOR_INFO_END" + case SHADING_MODE: + return "CAMERA_SHADING_MODE" + case SHADING_AVAILABLE_MODES: + return "CAMERA_SHADING_AVAILABLE_MODES" + case SHADING_END: + return "CAMERA_SHADING_END" + case STATISTICS_FACE_DETECT_MODE: + return "CAMERA_STATISTICS_FACE_DETECT_MODE" + case STATISTICS_HOT_PIXEL_MAP_MODE: + return "CAMERA_STATISTICS_HOT_PIXEL_MAP_MODE" + case STATISTICS_FACE_IDS: + return "CAMERA_STATISTICS_FACE_IDS" + case STATISTICS_FACE_LANDMARKS: + return "CAMERA_STATISTICS_FACE_LANDMARKS" + case STATISTICS_FACE_RECTANGLES: + return "CAMERA_STATISTICS_FACE_RECTANGLES" + case STATISTICS_FACE_SCORES: + return "CAMERA_STATISTICS_FACE_SCORES" + case STATISTICS_LENS_SHADING_MAP: + return "CAMERA_STATISTICS_LENS_SHADING_MAP" + case STATISTICS_SCENE_FLICKER: + return "CAMERA_STATISTICS_SCENE_FLICKER" + case STATISTICS_HOT_PIXEL_MAP: + return "CAMERA_STATISTICS_HOT_PIXEL_MAP" + case STATISTICS_LENS_SHADING_MAP_MODE: + return "CAMERA_STATISTICS_LENS_SHADING_MAP_MODE" + case STATISTICS_END: + return "CAMERA_STATISTICS_END" + case STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES: + return "CAMERA_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES" + case STATISTICS_INFO_MAX_FACE_COUNT: + return "CAMERA_STATISTICS_INFO_MAX_FACE_COUNT" + case STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES: + return "CAMERA_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES" + case STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES: + return "CAMERA_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES" + case STATISTICS_INFO_END: + return "CAMERA_STATISTICS_INFO_END" + case TONEMAP_CURVE_BLUE: + return "CAMERA_TONEMAP_CURVE_BLUE" + case TONEMAP_CURVE_GREEN: + return "CAMERA_TONEMAP_CURVE_GREEN" + case TONEMAP_CURVE_RED: + return "CAMERA_TONEMAP_CURVE_RED" + case TONEMAP_MODE: + return "CAMERA_TONEMAP_MODE" + case TONEMAP_MAX_CURVE_POINTS: + return "CAMERA_TONEMAP_MAX_CURVE_POINTS" + case TONEMAP_AVAILABLE_TONE_MAP_MODES: + return "CAMERA_TONEMAP_AVAILABLE_TONE_MAP_MODES" + case TONEMAP_GAMMA: + return "CAMERA_TONEMAP_GAMMA" + case TONEMAP_PRESET_CURVE: + return "CAMERA_TONEMAP_PRESET_CURVE" + case TONEMAP_END: + return "CAMERA_TONEMAP_END" + case INFO_SUPPORTED_HARDWARE_LEVEL: + return "CAMERA_INFO_SUPPORTED_HARDWARE_LEVEL" + case INFO_END: + return "CAMERA_INFO_END" + case BLACK_LEVEL_LOCK: + return "CAMERA_BLACK_LEVEL_LOCK" + case BLACK_LEVEL_END: + return "CAMERA_BLACK_LEVEL_END" + case SYNC_FRAME_NUMBER: + return "CAMERA_SYNC_FRAME_NUMBER" + case SYNC_MAX_LATENCY: + return "CAMERA_SYNC_MAX_LATENCY" + case SYNC_END: + return "CAMERA_SYNC_END" + case DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS: + return "CAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS" + case DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS: + return "CAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS" + case DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS: + return "CAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS" + case DEPTH_DEPTH_IS_EXCLUSIVE: + return "CAMERA_DEPTH_DEPTH_IS_EXCLUSIVE" + case DEPTH_END: + return "CAMERA_DEPTH_END" + } +} + +func (r *MetadataRational) String() string { + return fmt.Sprintf("Rational{%d, %d}", r.Numerator(), r.Denominator()) +} diff --git a/camera/metadata_tag.go b/camera/metadata_tag.go deleted file mode 100644 index 077bf7c..0000000 --- a/camera/metadata_tag.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type MetadataTag int32 - -const ( - SensorOrientation MetadataTag = 917518 - ScalerAvailableStreamConfigurations MetadataTag = 851978 -) diff --git a/camera/metadata_tags.go b/camera/metadata_tags.go new file mode 100644 index 0000000..28d5e31 --- /dev/null +++ b/camera/metadata_tags.go @@ -0,0 +1,7315 @@ +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + */ + +/** + * @file NdkCameraMetadataTags.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ + +package camera + +/* +#include +*/ +import "C" + +type CameraMetadataSection int + +const ( + COLOR_CORRECTION CameraMetadataSection = C.ACAMERA_COLOR_CORRECTION + CAMERA_CONTROL CameraMetadataSection = C.ACAMERA_CONTROL + CAMERA_DEMOSAIC CameraMetadataSection = C.ACAMERA_DEMOSAIC + CAMERA_EDGE CameraMetadataSection = C.ACAMERA_EDGE + CAMERA_FLASH CameraMetadataSection = C.ACAMERA_FLASH + FLASH_INFO CameraMetadataSection = C.ACAMERA_FLASH_INFO + HOT_PIXEL CameraMetadataSection = C.ACAMERA_HOT_PIXEL + CAMERA_JPEG CameraMetadataSection = C.ACAMERA_JPEG + CAMERA_LENS CameraMetadataSection = C.ACAMERA_LENS + LENS_INFO CameraMetadataSection = C.ACAMERA_LENS_INFO + NOISE_REDUCTION CameraMetadataSection = C.ACAMERA_NOISE_REDUCTION + CAMERA_QUIRKS CameraMetadataSection = C.ACAMERA_QUIRKS + CAMERA_REQUEST CameraMetadataSection = C.ACAMERA_REQUEST + CAMERA_SCALER CameraMetadataSection = C.ACAMERA_SCALER + CAMERA_SENSOR CameraMetadataSection = C.ACAMERA_SENSOR + SENSOR_INFO CameraMetadataSection = C.ACAMERA_SENSOR_INFO + CAMERA_SHADING CameraMetadataSection = C.ACAMERA_SHADING + CAMERA_STATISTICS CameraMetadataSection = C.ACAMERA_STATISTICS + STATISTICS_INFO CameraMetadataSection = C.ACAMERA_STATISTICS_INFO + CAMERA_TONEMAP CameraMetadataSection = C.ACAMERA_TONEMAP + CAMERA_LED CameraMetadataSection = C.ACAMERA_LED + CAMERA_INFO CameraMetadataSection = C.ACAMERA_INFO + BLACK_LEVEL CameraMetadataSection = C.ACAMERA_BLACK_LEVEL + CAMERA_SYNC CameraMetadataSection = C.ACAMERA_SYNC + CAMERA_REPROCESS CameraMetadataSection = C.ACAMERA_REPROCESS + CAMERA_DEPTH CameraMetadataSection = C.ACAMERA_DEPTH + SECTION_COUNT CameraMetadataSection = C.ACAMERA_SECTION_COUNT + + CAMERA_VENDOR CameraMetadataSection = C.ACAMERA_VENDOR +) + +/** + * Hierarchy positions in enum space. + */ +type CameraMetadataSectionStart int + +const ( + COLOR_CORRECTION_START CameraMetadataSectionStart = C.ACAMERA_COLOR_CORRECTION_START + CONTROL_START CameraMetadataSectionStart = C.ACAMERA_CONTROL_START + DEMOSAIC_START CameraMetadataSectionStart = C.ACAMERA_DEMOSAIC_START + EDGE_START CameraMetadataSectionStart = C.ACAMERA_EDGE_START + FLASH_START CameraMetadataSectionStart = C.ACAMERA_FLASH_START + FLASH_INFO_START CameraMetadataSectionStart = C.ACAMERA_FLASH_INFO_START + HOT_PIXEL_START CameraMetadataSectionStart = C.ACAMERA_HOT_PIXEL_START + JPEG_START CameraMetadataSectionStart = C.ACAMERA_JPEG_START + LENS_START CameraMetadataSectionStart = C.ACAMERA_LENS_START + LENS_INFO_START CameraMetadataSectionStart = C.ACAMERA_LENS_INFO_START + NOISE_REDUCTION_START CameraMetadataSectionStart = C.ACAMERA_NOISE_REDUCTION_START + QUIRKS_START CameraMetadataSectionStart = C.ACAMERA_QUIRKS_START + REQUEST_START CameraMetadataSectionStart = C.ACAMERA_REQUEST_START + SCALER_START CameraMetadataSectionStart = C.ACAMERA_SCALER_START + SENSOR_START CameraMetadataSectionStart = C.ACAMERA_SENSOR_START + SENSOR_INFO_START CameraMetadataSectionStart = C.ACAMERA_SENSOR_INFO_START + SHADING_START CameraMetadataSectionStart = C.ACAMERA_SHADING_START + STATISTICS_START CameraMetadataSectionStart = C.ACAMERA_STATISTICS_START + STATISTICS_INFO_START CameraMetadataSectionStart = C.ACAMERA_STATISTICS_INFO_START + TONEMAP_START CameraMetadataSectionStart = C.ACAMERA_TONEMAP_START + LED_START CameraMetadataSectionStart = C.ACAMERA_LED_START + INFO_START CameraMetadataSectionStart = C.ACAMERA_INFO_START + BLACK_LEVEL_START CameraMetadataSectionStart = C.ACAMERA_BLACK_LEVEL_START + SYNC_START CameraMetadataSectionStart = C.ACAMERA_SYNC_START + REPROCESS_START CameraMetadataSectionStart = C.ACAMERA_REPROCESS_START + DEPTH_START CameraMetadataSectionStart = C.ACAMERA_DEPTH_START + VENDOR_START CameraMetadataSectionStart = C.ACAMERA_VENDOR_START +) + +/** + * Main enum for camera metadata tags. + */ +type MetadataTag uint32 + +const ( + /** + *

The mode control selects how the image data is converted from the + * sensor's native color into linear sRGB color.

+ * + *

Type: byte (acamera_metadata_enum_android_color_correction_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When auto-white balance (AWB) is enabled with ACAMERA_CONTROL_AWB_MODE, this + * control is overridden by the AWB routine. When AWB is disabled, the + * application controls how the color mapping is performed.

+ *

We define the expected processing pipeline below. For consistency + * across devices, this is always the case with TRANSFORM_MATRIX.

+ *

When either FULL or HIGH_QUALITY is used, the camera device may + * do additional processing but ACAMERA_COLOR_CORRECTION_GAINS and + * ACAMERA_COLOR_CORRECTION_TRANSFORM will still be provided by the + * camera device (in the results) and be roughly correct.

+ *

Switching to TRANSFORM_MATRIX and using the data provided from + * FAST or HIGH_QUALITY will yield a picture with the same white point + * as what was produced by the camera device in the earlier frame.

+ *

The expected processing pipeline is as follows:

+ *

White balance processing pipeline

+ *

The white balance is encoded by two values, a 4-channel white-balance + * gain vector (applied in the Bayer domain), and a 3x3 color transform + * matrix (applied after demosaic).

+ *

The 4-channel white-balance gains are defined as:

+ *
ACAMERA_COLOR_CORRECTION_GAINS = [ R G_even G_odd B ]
+	 * 
+ *

where G_even is the gain for green pixels on even rows of the + * output, and G_odd is the gain for green pixels on the odd rows. + * These may be identical for a given camera device implementation; if + * the camera device does not support a separate gain for even/odd green + * channels, it will use the G_even value, and write G_odd equal to + * G_even in the output result metadata.

+ *

The matrices for color transforms are defined as a 9-entry vector:

+ *
ACAMERA_COLOR_CORRECTION_TRANSFORM = [ I0 I1 I2 I3 I4 I5 I6 I7 I8 ]
+	 * 
+ *

which define a transform from input sensor colors, P_in = [ r g b ], + * to output linear sRGB, P_out = [ r' g' b' ],

+ *

with colors as follows:

+ *
r' = I0r + I1g + I2b
+	 * g' = I3r + I4g + I5b
+	 * b' = I6r + I7g + I8b
+	 * 
+ *

Both the input and output value ranges must match. Overflow/underflow + * values are clipped to fit within the range.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + * @see ACAMERA_CONTROL_AWB_MODE + */ + COLOR_CORRECTION_MODE MetadataTag = C.ACAMERA_COLOR_CORRECTION_MODE // byte (acamera_metadata_enum_android_color_correction_mode_t) + + /** + *

A color transform matrix to use to transform + * from sensor RGB color space to output linear sRGB color space.

+ * + *

Type: rational[3*3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This matrix is either set by the camera device when the request + * ACAMERA_COLOR_CORRECTION_MODE is not TRANSFORM_MATRIX, or + * directly by the application in the request when the + * ACAMERA_COLOR_CORRECTION_MODE is TRANSFORM_MATRIX.

+ *

In the latter case, the camera device may round the matrix to account + * for precision issues; the final rounded matrix should be reported back + * in this matrix result metadata. The transform should keep the magnitude + * of the output color values within [0, 1.0] (assuming input color + * values is within the normalized range [0, 1.0]), or clipping may occur.

+ *

The valid range of each matrix element varies on different devices, but + * values within [-1.5, 3.0] are guaranteed not to be clipped.

+ * + * @see ACAMERA_COLOR_CORRECTION_MODE + */ + COLOR_CORRECTION_TRANSFORM MetadataTag = C.ACAMERA_COLOR_CORRECTION_TRANSFORM // rational[3*3] + + /** + *

Gains applying to Bayer raw color channels for + * white-balance.

+ * + *

Type: float[4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

These per-channel gains are either set by the camera device + * when the request ACAMERA_COLOR_CORRECTION_MODE is not + * TRANSFORM_MATRIX, or directly by the application in the + * request when the ACAMERA_COLOR_CORRECTION_MODE is + * TRANSFORM_MATRIX.

+ *

The gains in the result metadata are the gains actually + * applied by the camera device to the current frame.

+ *

The valid range of gains varies on different devices, but gains + * between [1.0, 3.0] are guaranteed not to be clipped. Even if a given + * device allows gains below 1.0, this is usually not recommended because + * this can create color artifacts.

+ * + * @see ACAMERA_COLOR_CORRECTION_MODE + */ + COLOR_CORRECTION_GAINS MetadataTag = C.ACAMERA_COLOR_CORRECTION_GAINS // float[4] + + /** + *

Mode of operation for the chromatic aberration correction algorithm.

+ * + *

Type: byte (acamera_metadata_enum_android_color_correction_aberration_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Chromatic (color) aberration is caused by the fact that different wavelengths of light + * can not focus on the same point after exiting from the lens. This metadata defines + * the high level control of chromatic aberration correction algorithm, which aims to + * minimize the chromatic artifacts that may occur along the object boundaries in an + * image.

+ *

FAST/HIGH_QUALITY both mean that camera device determined aberration + * correction will be applied. HIGH_QUALITY mode indicates that the camera device will + * use the highest-quality aberration correction algorithms, even if it slows down + * capture rate. FAST means the camera device will not slow down capture rate when + * applying aberration correction.

+ *

LEGACY devices will always be in FAST mode.

+ */ + COLOR_CORRECTION_ABERRATION_MODE MetadataTag = C.ACAMERA_COLOR_CORRECTION_ABERRATION_MODE // byte (acamera_metadata_enum_android_color_correction_aberration_mode_t) + + /** + *

List of aberration correction modes for ACAMERA_COLOR_CORRECTION_ABERRATION_MODE that are + * supported by this camera device.

+ * + * @see ACAMERA_COLOR_CORRECTION_ABERRATION_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This key lists the valid modes for ACAMERA_COLOR_CORRECTION_ABERRATION_MODE. If no + * aberration correction modes are available for a device, this list will solely include + * OFF mode. All camera devices will support either OFF or FAST mode.

+ *

Camera devices that support the MANUAL_POST_PROCESSING capability will always list + * OFF mode. This includes all FULL level devices.

+ *

LEGACY devices will always only support FAST mode.

+ * + * @see ACAMERA_COLOR_CORRECTION_ABERRATION_MODE + */ + COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES MetadataTag = C.ACAMERA_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES // byte[n] + + COLOR_CORRECTION_END MetadataTag = C.ACAMERA_COLOR_CORRECTION_END + + /** + *

The desired setting for the camera device's auto-exposure + * algorithm's antibanding compensation.

+ * + *

Type: byte (acamera_metadata_enum_android_control_ae_antibanding_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Some kinds of lighting fixtures, such as some fluorescent + * lights, flicker at the rate of the power supply frequency + * (60Hz or 50Hz, depending on country). While this is + * typically not noticeable to a person, it can be visible to + * a camera device. If a camera sets its exposure time to the + * wrong value, the flicker may become visible in the + * viewfinder as flicker or in a final captured image, as a + * set of variable-brightness bands across the image.

+ *

Therefore, the auto-exposure routines of camera devices + * include antibanding routines that ensure that the chosen + * exposure value will not cause such banding. The choice of + * exposure time depends on the rate of flicker, which the + * camera device can detect automatically, or the expected + * rate can be selected by the application using this + * control.

+ *

A given camera device may not support all of the possible + * options for the antibanding mode. The + * ACAMERA_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES key contains + * the available modes for a given camera device.

+ *

AUTO mode is the default if it is available on given + * camera device. When AUTO mode is not available, the + * default will be either 50HZ or 60HZ, and both 50HZ + * and 60HZ will be available.

+ *

If manual exposure control is enabled (by setting + * ACAMERA_CONTROL_AE_MODE or ACAMERA_CONTROL_MODE to OFF), + * then this setting has no effect, and the application must + * ensure it selects exposure times that do not cause banding + * issues. The ACAMERA_STATISTICS_SCENE_FLICKER key can assist + * the application in this.

+ * + * @see ACAMERA_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_STATISTICS_SCENE_FLICKER + */ + CONTROL_AE_ANTIBANDING_MODE MetadataTag = C.ACAMERA_CONTROL_AE_ANTIBANDING_MODE // byte (acamera_metadata_enum_android_control_ae_antibanding_mode_t) + + /** + *

Adjustment to auto-exposure (AE) target image + * brightness.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

The adjustment is measured as a count of steps, with the + * step size defined by ACAMERA_CONTROL_AE_COMPENSATION_STEP and the + * allowed range by ACAMERA_CONTROL_AE_COMPENSATION_RANGE.

+ *

For example, if the exposure value (EV) step is 0.333, '6' + * will mean an exposure compensation of +2 EV; -3 will mean an + * exposure compensation of -1 EV. One EV represents a doubling + * of image brightness. Note that this control will only be + * effective if ACAMERA_CONTROL_AE_MODE != OFF. This control + * will take effect even when ACAMERA_CONTROL_AE_LOCK == true.

+ *

In the event of exposure compensation value being changed, camera device + * may take several frames to reach the newly requested exposure target. + * During that time, ACAMERA_CONTROL_AE_STATE field will be in the SEARCHING + * state. Once the new exposure target is reached, ACAMERA_CONTROL_AE_STATE will + * change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or + * FLASH_REQUIRED (if the scene is too dark for still capture).

+ * + * @see ACAMERA_CONTROL_AE_COMPENSATION_RANGE + * @see ACAMERA_CONTROL_AE_COMPENSATION_STEP + * @see ACAMERA_CONTROL_AE_LOCK + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AE_STATE + */ + CONTROL_AE_EXPOSURE_COMPENSATION MetadataTag = C.ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION // int32 + + /** + *

Whether auto-exposure (AE) is currently locked to its latest + * calculated values.

+ * + *

Type: byte (acamera_metadata_enum_android_control_ae_lock_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When set to true (ON), the AE algorithm is locked to its latest parameters, + * and will not change exposure settings until the lock is set to false (OFF).

+ *

Note that even when AE is locked, the flash may be fired if + * the ACAMERA_CONTROL_AE_MODE is ON_AUTO_FLASH / + * ON_ALWAYS_FLASH / ON_AUTO_FLASH_REDEYE.

+ *

When ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION is changed, even if the AE lock + * is ON, the camera device will still adjust its exposure value.

+ *

If AE precapture is triggered (see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER) + * when AE is already locked, the camera device will not change the exposure time + * (ACAMERA_SENSOR_EXPOSURE_TIME) and sensitivity (ACAMERA_SENSOR_SENSITIVITY) + * parameters. The flash may be fired if the ACAMERA_CONTROL_AE_MODE + * is ON_AUTO_FLASH/ON_AUTO_FLASH_REDEYE and the scene is too dark. If the + * ACAMERA_CONTROL_AE_MODE is ON_ALWAYS_FLASH, the scene may become overexposed. + * Similarly, AE precapture trigger CANCEL has no effect when AE is already locked.

+ *

When an AE precapture sequence is triggered, AE unlock will not be able to unlock + * the AE if AE is locked by the camera device internally during precapture metering + * sequence In other words, submitting requests with AE unlock has no effect for an + * ongoing precapture metering sequence. Otherwise, the precapture metering sequence + * will never succeed in a sequence of preview requests where AE lock is always set + * to false.

+ *

Since the camera device has a pipeline of in-flight requests, the settings that + * get locked do not necessarily correspond to the settings that were present in the + * latest capture result received from the camera device, since additional captures + * and AE updates may have occurred even before the result was sent out. If an + * application is switching between automatic and manual control and wishes to eliminate + * any flicker during the switch, the following procedure is recommended:

+ *
    + *
  1. Starting in auto-AE mode:
  2. + *
  3. Lock AE
  4. + *
  5. Wait for the first result to be output that has the AE locked
  6. + *
  7. Copy exposure settings from that result into a request, set the request to manual AE
  8. + *
  9. Submit the capture request, proceed to run manual AE as desired.
  10. + *
+ *

See ACAMERA_CONTROL_AE_STATE for AE lock related state transition details.

+ * + * @see ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * @see ACAMERA_CONTROL_AE_STATE + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_SENSITIVITY + */ + CONTROL_AE_LOCK MetadataTag = C.ACAMERA_CONTROL_AE_LOCK // byte (acamera_metadata_enum_android_control_ae_lock_t) + + /** + *

The desired mode for the camera device's + * auto-exposure routine.

+ * + *

Type: byte (acamera_metadata_enum_android_control_ae_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This control is only effective if ACAMERA_CONTROL_MODE is + * AUTO.

+ *

When set to any of the ON modes, the camera device's + * auto-exposure routine is enabled, overriding the + * application's selected exposure time, sensor sensitivity, + * and frame duration (ACAMERA_SENSOR_EXPOSURE_TIME, + * ACAMERA_SENSOR_SENSITIVITY, and + * ACAMERA_SENSOR_FRAME_DURATION). If one of the FLASH modes + * is selected, the camera device's flash unit controls are + * also overridden.

+ *

The FLASH modes are only available if the camera device + * has a flash unit (ACAMERA_FLASH_INFO_AVAILABLE is true).

+ *

If flash TORCH mode is desired, this field must be set to + * ON or OFF, and ACAMERA_FLASH_MODE set to TORCH.

+ *

When set to any of the ON modes, the values chosen by the + * camera device auto-exposure routine for the overridden + * fields for a given capture will be available in its + * CaptureResult.

+ * + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_FLASH_INFO_AVAILABLE + * @see ACAMERA_FLASH_MODE + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_FRAME_DURATION + * @see ACAMERA_SENSOR_SENSITIVITY + */ + CONTROL_AE_MODE MetadataTag = C.ACAMERA_CONTROL_AE_MODE // byte (acamera_metadata_enum_android_control_ae_mode_t) + + /** + *

List of metering areas to use for auto-exposure adjustment.

+ * + *

Type: int32[5*area_count]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Not available if android.control.maxRegionsAe is 0. + * Otherwise will always be present.

+ *

The maximum number of regions supported by the device is determined by the value + * of android.control.maxRegionsAe.

+ *

The data representation is int[5 * area_count]. + * Every five elements represent a metering region of (xmin, ymin, xmax, ymax, weight). + * The rectangle is defined to be inclusive on xmin and ymin, but exclusive on xmax and + * ymax.

+ *

The coordinate system is based on the active pixel array, + * with (0,0) being the top-left pixel in the active pixel array, and + * (ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.width - 1, + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.height - 1) being the + * bottom-right pixel in the active pixel array.

+ *

The weight must be within [0, 1000], and represents a weight + * for every pixel in the area. This means that a large metering area + * with the same weight as a smaller area will have more effect in + * the metering result. Metering areas can partially overlap and the + * camera device will add the weights in the overlap region.

+ *

The weights are relative to weights of other exposure metering regions, so if only one + * region is used, all non-zero weights will have the same effect. A region with 0 + * weight is ignored.

+ *

If all regions have 0 weight, then no specific metering area needs to be used by the + * camera device.

+ *

If the metering region is outside the used ACAMERA_SCALER_CROP_REGION returned in + * capture result metadata, the camera device will ignore the sections outside the crop + * region and output only the intersection rectangle as the metering region in the result + * metadata. If the region is entirely outside the crop region, it will be ignored and + * not reported in the result metadata.

+ * + * @see ACAMERA_SCALER_CROP_REGION + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + */ + CONTROL_AE_REGIONS MetadataTag = C.ACAMERA_CONTROL_AE_REGIONS // int32[5*area_count] + + /** + *

Range over which the auto-exposure routine can + * adjust the capture frame rate to maintain good + * exposure.

+ * + *

Type: int32[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Only constrains auto-exposure (AE) algorithm, not + * manual control of ACAMERA_SENSOR_EXPOSURE_TIME and + * ACAMERA_SENSOR_FRAME_DURATION.

+ * + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_FRAME_DURATION + */ + CONTROL_AE_TARGET_FPS_RANGE MetadataTag = C.ACAMERA_CONTROL_AE_TARGET_FPS_RANGE // int32[2] + + /** + *

Whether the camera device will trigger a precapture + * metering sequence when it processes this request.

+ * + *

Type: byte (acamera_metadata_enum_android_control_ae_precapture_trigger_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This entry is normally set to IDLE, or is not + * included at all in the request settings. When included and + * set to START, the camera device will trigger the auto-exposure (AE) + * precapture metering sequence.

+ *

When set to CANCEL, the camera device will cancel any active + * precapture metering trigger, and return to its initial AE state. + * If a precapture metering sequence is already completed, and the camera + * device has implicitly locked the AE for subsequent still capture, the + * CANCEL trigger will unlock the AE and return to its initial AE state.

+ *

The precapture sequence should be triggered before starting a + * high-quality still capture for final metering decisions to + * be made, and for firing pre-capture flash pulses to estimate + * scene brightness and required final capture flash power, when + * the flash is enabled.

+ *

Normally, this entry should be set to START for only a + * single request, and the application should wait until the + * sequence completes before starting a new one.

+ *

When a precapture metering sequence is finished, the camera device + * may lock the auto-exposure routine internally to be able to accurately expose the + * subsequent still capture image (ACAMERA_CONTROL_CAPTURE_INTENT == STILL_CAPTURE). + * For this case, the AE may not resume normal scan if no subsequent still capture is + * submitted. To ensure that the AE routine restarts normal scan, the application should + * submit a request with ACAMERA_CONTROL_AE_LOCK == true, followed by a request + * with ACAMERA_CONTROL_AE_LOCK == false, if the application decides not to submit a + * still capture request after the precapture sequence completes. Alternatively, for + * API level 23 or newer devices, the CANCEL can be used to unlock the camera device + * internally locked AE if the application doesn't submit a still capture request after + * the AE precapture trigger. Note that, the CANCEL was added in API level 23, and must not + * be used in devices that have earlier API levels.

+ *

The exact effect of auto-exposure (AE) precapture trigger + * depends on the current AE mode and state; see + * ACAMERA_CONTROL_AE_STATE for AE precapture state transition + * details.

+ *

On LEGACY-level devices, the precapture trigger is not supported; + * capturing a high-resolution JPEG image will automatically trigger a + * precapture sequence before the high-resolution capture, including + * potentially firing a pre-capture flash.

+ *

Using the precapture trigger and the auto-focus trigger ACAMERA_CONTROL_AF_TRIGGER + * simultaneously is allowed. However, since these triggers often require cooperation between + * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a + * focus sweep), the camera device may delay acting on a later trigger until the previous + * trigger has been fully handled. This may lead to longer intervals between the trigger and + * changes to ACAMERA_CONTROL_AE_STATE indicating the start of the precapture sequence, for + * example.

+ *

If both the precapture and the auto-focus trigger are activated on the same request, then + * the camera device will complete them in the optimal order for that device.

+ * + * @see ACAMERA_CONTROL_AE_LOCK + * @see ACAMERA_CONTROL_AE_STATE + * @see ACAMERA_CONTROL_AF_TRIGGER + * @see ACAMERA_CONTROL_CAPTURE_INTENT + */ + CONTROL_AE_PRECAPTURE_TRIGGER MetadataTag = C.ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER // byte (acamera_metadata_enum_android_control_ae_precapture_trigger_t) + + /** + *

Whether auto-focus (AF) is currently enabled, and what + * mode it is set to.

+ * + *

Type: byte (acamera_metadata_enum_android_control_af_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Only effective if ACAMERA_CONTROL_MODE = AUTO and the lens is not fixed focus + * (i.e. ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE > 0). Also note that + * when ACAMERA_CONTROL_AE_MODE is OFF, the behavior of AF is device + * dependent. It is recommended to lock AF by using ACAMERA_CONTROL_AF_TRIGGER before + * setting ACAMERA_CONTROL_AE_MODE to OFF, or set AF mode to OFF when AE is OFF.

+ *

If the lens is controlled by the camera device auto-focus algorithm, + * the camera device will report the current AF status in ACAMERA_CONTROL_AF_STATE + * in result metadata.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AF_STATE + * @see ACAMERA_CONTROL_AF_TRIGGER + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE + */ + CONTROL_AF_MODE MetadataTag = C.ACAMERA_CONTROL_AF_MODE // byte (acamera_metadata_enum_android_control_af_mode_t) + + /** + *

List of metering areas to use for auto-focus.

+ * + *

Type: int32[5*area_count]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Not available if android.control.maxRegionsAf is 0. + * Otherwise will always be present.

+ *

The maximum number of focus areas supported by the device is determined by the value + * of android.control.maxRegionsAf.

+ *

The data representation is int[5 * area_count]. + * Every five elements represent a metering region of (xmin, ymin, xmax, ymax, weight). + * The rectangle is defined to be inclusive on xmin and ymin, but exclusive on xmax and + * ymax.

+ *

The coordinate system is based on the active pixel array, + * with (0,0) being the top-left pixel in the active pixel array, and + * (ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.width - 1, + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.height - 1) being the + * bottom-right pixel in the active pixel array.

+ *

The weight must be within [0, 1000], and represents a weight + * for every pixel in the area. This means that a large metering area + * with the same weight as a smaller area will have more effect in + * the metering result. Metering areas can partially overlap and the + * camera device will add the weights in the overlap region.

+ *

The weights are relative to weights of other metering regions, so if only one region + * is used, all non-zero weights will have the same effect. A region with 0 weight is + * ignored.

+ *

If all regions have 0 weight, then no specific metering area needs to be used by the + * camera device.

+ *

If the metering region is outside the used ACAMERA_SCALER_CROP_REGION returned in + * capture result metadata, the camera device will ignore the sections outside the crop + * region and output only the intersection rectangle as the metering region in the result + * metadata. If the region is entirely outside the crop region, it will be ignored and + * not reported in the result metadata.

+ * + * @see ACAMERA_SCALER_CROP_REGION + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + */ + CONTROL_AF_REGIONS MetadataTag = C.ACAMERA_CONTROL_AF_REGIONS // int32[5*area_count] + + /** + *

Whether the camera device will trigger autofocus for this request.

+ * + *

Type: byte (acamera_metadata_enum_android_control_af_trigger_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This entry is normally set to IDLE, or is not + * included at all in the request settings.

+ *

When included and set to START, the camera device will trigger the + * autofocus algorithm. If autofocus is disabled, this trigger has no effect.

+ *

When set to CANCEL, the camera device will cancel any active trigger, + * and return to its initial AF state.

+ *

Generally, applications should set this entry to START or CANCEL for only a + * single capture, and then return it to IDLE (or not set at all). Specifying + * START for multiple captures in a row means restarting the AF operation over + * and over again.

+ *

See ACAMERA_CONTROL_AF_STATE for what the trigger means for each AF mode.

+ *

Using the autofocus trigger and the precapture trigger ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * simultaneously is allowed. However, since these triggers often require cooperation between + * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a + * focus sweep), the camera device may delay acting on a later trigger until the previous + * trigger has been fully handled. This may lead to longer intervals between the trigger and + * changes to ACAMERA_CONTROL_AF_STATE, for example.

+ * + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * @see ACAMERA_CONTROL_AF_STATE + */ + CONTROL_AF_TRIGGER MetadataTag = C.ACAMERA_CONTROL_AF_TRIGGER // byte (acamera_metadata_enum_android_control_af_trigger_t) + + /** + *

Whether auto-white balance (AWB) is currently locked to its + * latest calculated values.

+ * + *

Type: byte (acamera_metadata_enum_android_control_awb_lock_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When set to true (ON), the AWB algorithm is locked to its latest parameters, + * and will not change color balance settings until the lock is set to false (OFF).

+ *

Since the camera device has a pipeline of in-flight requests, the settings that + * get locked do not necessarily correspond to the settings that were present in the + * latest capture result received from the camera device, since additional captures + * and AWB updates may have occurred even before the result was sent out. If an + * application is switching between automatic and manual control and wishes to eliminate + * any flicker during the switch, the following procedure is recommended:

+ *
    + *
  1. Starting in auto-AWB mode:
  2. + *
  3. Lock AWB
  4. + *
  5. Wait for the first result to be output that has the AWB locked
  6. + *
  7. Copy AWB settings from that result into a request, set the request to manual AWB
  8. + *
  9. Submit the capture request, proceed to run manual AWB as desired.
  10. + *
+ *

Note that AWB lock is only meaningful when + * ACAMERA_CONTROL_AWB_MODE is in the AUTO mode; in other modes, + * AWB is already fixed to a specific setting.

+ *

Some LEGACY devices may not support ON; the value is then overridden to OFF.

+ * + * @see ACAMERA_CONTROL_AWB_MODE + */ + CONTROL_AWB_LOCK MetadataTag = C.ACAMERA_CONTROL_AWB_LOCK // byte (acamera_metadata_enum_android_control_awb_lock_t) + + /** + *

Whether auto-white balance (AWB) is currently setting the color + * transform fields, and what its illumination target + * is.

+ * + *

Type: byte (acamera_metadata_enum_android_control_awb_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This control is only effective if ACAMERA_CONTROL_MODE is AUTO.

+ *

When set to the ON mode, the camera device's auto-white balance + * routine is enabled, overriding the application's selected + * ACAMERA_COLOR_CORRECTION_TRANSFORM, ACAMERA_COLOR_CORRECTION_GAINS and + * ACAMERA_COLOR_CORRECTION_MODE. Note that when ACAMERA_CONTROL_AE_MODE + * is OFF, the behavior of AWB is device dependent. It is recommened to + * also set AWB mode to OFF or lock AWB by using ACAMERA_CONTROL_AWB_LOCK before + * setting AE mode to OFF.

+ *

When set to the OFF mode, the camera device's auto-white balance + * routine is disabled. The application manually controls the white + * balance by ACAMERA_COLOR_CORRECTION_TRANSFORM, ACAMERA_COLOR_CORRECTION_GAINS + * and ACAMERA_COLOR_CORRECTION_MODE.

+ *

When set to any other modes, the camera device's auto-white + * balance routine is disabled. The camera device uses each + * particular illumination target for white balance + * adjustment. The application's values for + * ACAMERA_COLOR_CORRECTION_TRANSFORM, + * ACAMERA_COLOR_CORRECTION_GAINS and + * ACAMERA_COLOR_CORRECTION_MODE are ignored.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_MODE + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AWB_LOCK + * @see ACAMERA_CONTROL_MODE + */ + CONTROL_AWB_MODE MetadataTag = C.ACAMERA_CONTROL_AWB_MODE // byte (acamera_metadata_enum_android_control_awb_mode_t) + + /** + *

List of metering areas to use for auto-white-balance illuminant + * estimation.

+ * + *

Type: int32[5*area_count]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Not available if android.control.maxRegionsAwb is 0. + * Otherwise will always be present.

+ *

The maximum number of regions supported by the device is determined by the value + * of android.control.maxRegionsAwb.

+ *

The data representation is int[5 * area_count]. + * Every five elements represent a metering region of (xmin, ymin, xmax, ymax, weight). + * The rectangle is defined to be inclusive on xmin and ymin, but exclusive on xmax and + * ymax.

+ *

The coordinate system is based on the active pixel array, + * with (0,0) being the top-left pixel in the active pixel array, and + * (ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.width - 1, + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.height - 1) being the + * bottom-right pixel in the active pixel array.

+ *

The weight must range from 0 to 1000, and represents a weight + * for every pixel in the area. This means that a large metering area + * with the same weight as a smaller area will have more effect in + * the metering result. Metering areas can partially overlap and the + * camera device will add the weights in the overlap region.

+ *

The weights are relative to weights of other white balance metering regions, so if + * only one region is used, all non-zero weights will have the same effect. A region with + * 0 weight is ignored.

+ *

If all regions have 0 weight, then no specific metering area needs to be used by the + * camera device.

+ *

If the metering region is outside the used ACAMERA_SCALER_CROP_REGION returned in + * capture result metadata, the camera device will ignore the sections outside the crop + * region and output only the intersection rectangle as the metering region in the result + * metadata. If the region is entirely outside the crop region, it will be ignored and + * not reported in the result metadata.

+ * + * @see ACAMERA_SCALER_CROP_REGION + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + */ + CONTROL_AWB_REGIONS MetadataTag = C.ACAMERA_CONTROL_AWB_REGIONS // int32[5*area_count] + + /** + *

Information to the camera device 3A (auto-exposure, + * auto-focus, auto-white balance) routines about the purpose + * of this capture, to help the camera device to decide optimal 3A + * strategy.

+ * + *

Type: byte (acamera_metadata_enum_android_control_capture_intent_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This control (except for MANUAL) is only effective if + * ACAMERA_CONTROL_MODE != OFF and any 3A routine is active.

+ *

ZERO_SHUTTER_LAG will be supported if ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + * contains PRIVATE_REPROCESSING or YUV_REPROCESSING. MANUAL will be supported if + * ACAMERA_REQUEST_AVAILABLE_CAPABILITIES contains MANUAL_SENSOR. Other intent values are + * always supported.

+ * + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + */ + CONTROL_CAPTURE_INTENT MetadataTag = C.ACAMERA_CONTROL_CAPTURE_INTENT // byte (acamera_metadata_enum_android_control_capture_intent_t) + + /** + *

A special color effect to apply.

+ * + *

Type: byte (acamera_metadata_enum_android_control_effect_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When this mode is set, a color effect will be applied + * to images produced by the camera device. The interpretation + * and implementation of these color effects is left to the + * implementor of the camera device, and should not be + * depended on to be consistent (or present) across all + * devices.

+ */ + CONTROL_EFFECT_MODE MetadataTag = C.ACAMERA_CONTROL_EFFECT_MODE // byte (acamera_metadata_enum_android_control_effect_mode_t) + + /** + *

Overall mode of 3A (auto-exposure, auto-white-balance, auto-focus) control + * routines.

+ * + *

Type: byte (acamera_metadata_enum_android_control_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This is a top-level 3A control switch. When set to OFF, all 3A control + * by the camera device is disabled. The application must set the fields for + * capture parameters itself.

+ *

When set to AUTO, the individual algorithm controls in + * ACAMERA_CONTROL_* are in effect, such as ACAMERA_CONTROL_AF_MODE.

+ *

When set to USE_SCENE_MODE, the individual controls in + * ACAMERA_CONTROL_* are mostly disabled, and the camera device implements + * one of the scene mode settings (such as ACTION, SUNSET, or PARTY) + * as it wishes. The camera device scene mode 3A settings are provided by + * capture results {@link ACameraMetadata} from + * {@link ACameraCaptureSession_captureCallback_result}.

+ *

When set to OFF_KEEP_STATE, it is similar to OFF mode, the only difference + * is that this frame will not be used by camera device background 3A statistics + * update, as if this frame is never captured. This mode can be used in the scenario + * where the application doesn't want a 3A manual control capture to affect + * the subsequent auto 3A capture results.

+ * + * @see ACAMERA_CONTROL_AF_MODE + */ + CONTROL_MODE MetadataTag = C.ACAMERA_CONTROL_MODE // byte (acamera_metadata_enum_android_control_mode_t) + + /** + *

Control for which scene mode is currently active.

+ * + *

Type: byte (acamera_metadata_enum_android_control_scene_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Scene modes are custom camera modes optimized for a certain set of conditions and + * capture settings.

+ *

This is the mode that that is active when + * ACAMERA_CONTROL_MODE == USE_SCENE_MODE. Aside from FACE_PRIORITY, these modes will + * disable ACAMERA_CONTROL_AE_MODE, ACAMERA_CONTROL_AWB_MODE, and ACAMERA_CONTROL_AF_MODE + * while in use.

+ *

The interpretation and implementation of these scene modes is left + * to the implementor of the camera device. Their behavior will not be + * consistent across all devices, and any given device may only implement + * a subset of these modes.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AF_MODE + * @see ACAMERA_CONTROL_AWB_MODE + * @see ACAMERA_CONTROL_MODE + */ + CONTROL_SCENE_MODE MetadataTag = C.ACAMERA_CONTROL_SCENE_MODE // byte (acamera_metadata_enum_android_control_scene_mode_t) + + /** + *

Whether video stabilization is + * active.

+ * + *

Type: byte (acamera_metadata_enum_android_control_video_stabilization_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Video stabilization automatically warps images from + * the camera in order to stabilize motion between consecutive frames.

+ *

If enabled, video stabilization can modify the + * ACAMERA_SCALER_CROP_REGION to keep the video stream stabilized.

+ *

Switching between different video stabilization modes may take several + * frames to initialize, the camera device will report the current mode + * in capture result metadata. For example, When "ON" mode is requested, + * the video stabilization modes in the first several capture results may + * still be "OFF", and it will become "ON" when the initialization is + * done.

+ *

In addition, not all recording sizes or frame rates may be supported for + * stabilization by a device that reports stabilization support. It is guaranteed + * that an output targeting a MediaRecorder or MediaCodec will be stabilized if + * the recording resolution is less than or equal to 1920 x 1080 (width less than + * or equal to 1920, height less than or equal to 1080), and the recording + * frame rate is less than or equal to 30fps. At other sizes, the CaptureResult + * ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE field will return + * OFF if the recording output is not stabilized, or if there are no output + * Surface types that can be stabilized.

+ *

If a camera device supports both this mode and OIS + * (ACAMERA_LENS_OPTICAL_STABILIZATION_MODE), turning both modes on may + * produce undesirable interaction, so it is recommended not to enable + * both at the same time.

+ * + * @see ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE + * @see ACAMERA_LENS_OPTICAL_STABILIZATION_MODE + * @see ACAMERA_SCALER_CROP_REGION + */ + CONTROL_VIDEO_STABILIZATION_MODE MetadataTag = C.ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE // byte (acamera_metadata_enum_android_control_video_stabilization_mode_t) + + /** + *

List of auto-exposure antibanding modes for ACAMERA_CONTROL_AE_ANTIBANDING_MODE that are + * supported by this camera device.

+ * + * @see ACAMERA_CONTROL_AE_ANTIBANDING_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Not all of the auto-exposure anti-banding modes may be + * supported by a given camera device. This field lists the + * valid anti-banding modes that the application may request + * for this camera device with the + * ACAMERA_CONTROL_AE_ANTIBANDING_MODE control.

+ * + * @see ACAMERA_CONTROL_AE_ANTIBANDING_MODE + */ + CONTROL_AE_AVAILABLE_ANTIBANDING_MODES MetadataTag = C.ACAMERA_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES // byte[n] + + /** + *

List of auto-exposure modes for ACAMERA_CONTROL_AE_MODE that are supported by this camera + * device.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Not all the auto-exposure modes may be supported by a + * given camera device, especially if no flash unit is + * available. This entry lists the valid modes for + * ACAMERA_CONTROL_AE_MODE for this camera device.

+ *

All camera devices support ON, and all camera devices with flash + * units support ON_AUTO_FLASH and ON_ALWAYS_FLASH.

+ *

FULL mode camera devices always support OFF mode, + * which enables application control of camera exposure time, + * sensitivity, and frame duration.

+ *

LEGACY mode camera devices never support OFF mode. + * LIMITED mode devices support OFF if they support the MANUAL_SENSOR + * capability.

+ * + * @see ACAMERA_CONTROL_AE_MODE + */ + CONTROL_AE_AVAILABLE_MODES MetadataTag = C.ACAMERA_CONTROL_AE_AVAILABLE_MODES // byte[n] + + /** + *

List of frame rate ranges for ACAMERA_CONTROL_AE_TARGET_FPS_RANGE supported by + * this camera device.

+ * + * @see ACAMERA_CONTROL_AE_TARGET_FPS_RANGE + * + *

Type: int32[2*n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

For devices at the LEGACY level or above:

+ * + *

For devices at the LIMITED level or above:

+ *
    + *
  • For YUV_420_888 burst capture use case, this list will always include (min, max) + * and (max, max) where min <= 15 and max = the maximum output frame rate of the + * maximum YUV_420_888 output size.
  • + *
+ */ + CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES MetadataTag = C.ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES // int32[2*n] + + /** + *

Maximum and minimum exposure compensation values for + * ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION, in counts of ACAMERA_CONTROL_AE_COMPENSATION_STEP, + * that are supported by this camera device.

+ * + * @see ACAMERA_CONTROL_AE_COMPENSATION_STEP + * @see ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION + * + *

Type: int32[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + */ + CONTROL_AE_COMPENSATION_RANGE MetadataTag = C.ACAMERA_CONTROL_AE_COMPENSATION_RANGE // int32[2] + + /** + *

Smallest step by which the exposure compensation + * can be changed.

+ * + *

Type: rational

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This is the unit for ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION. For example, if this key has + * a value of 1/2, then a setting of -2 for ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION means + * that the target EV offset for the auto-exposure routine is -1 EV.

+ *

One unit of EV compensation changes the brightness of the captured image by a factor + * of two. +1 EV doubles the image brightness, while -1 EV halves the image brightness.

+ * + * @see ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION + */ + CONTROL_AE_COMPENSATION_STEP MetadataTag = C.ACAMERA_CONTROL_AE_COMPENSATION_STEP // rational + + /** + *

List of auto-focus (AF) modes for ACAMERA_CONTROL_AF_MODE that are + * supported by this camera device.

+ * + * @see ACAMERA_CONTROL_AF_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Not all the auto-focus modes may be supported by a + * given camera device. This entry lists the valid modes for + * ACAMERA_CONTROL_AF_MODE for this camera device.

+ *

All LIMITED and FULL mode camera devices will support OFF mode, and all + * camera devices with adjustable focuser units + * (ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE > 0) will support AUTO mode.

+ *

LEGACY devices will support OFF mode only if they support + * focusing to infinity (by also setting ACAMERA_LENS_FOCUS_DISTANCE to + * 0.0f).

+ * + * @see ACAMERA_CONTROL_AF_MODE + * @see ACAMERA_LENS_FOCUS_DISTANCE + * @see ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE + */ + CONTROL_AF_AVAILABLE_MODES MetadataTag = C.ACAMERA_CONTROL_AF_AVAILABLE_MODES // byte[n] + + /** + *

List of color effects for ACAMERA_CONTROL_EFFECT_MODE that are supported by this camera + * device.

+ * + * @see ACAMERA_CONTROL_EFFECT_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This list contains the color effect modes that can be applied to + * images produced by the camera device. + * Implementations are not expected to be consistent across all devices. + * If no color effect modes are available for a device, this will only list + * OFF.

+ *

A color effect will only be applied if + * ACAMERA_CONTROL_MODE != OFF. OFF is always included in this list.

+ *

This control has no effect on the operation of other control routines such + * as auto-exposure, white balance, or focus.

+ * + * @see ACAMERA_CONTROL_MODE + */ + CONTROL_AVAILABLE_EFFECTS MetadataTag = C.ACAMERA_CONTROL_AVAILABLE_EFFECTS // byte[n] + + /** + *

List of scene modes for ACAMERA_CONTROL_SCENE_MODE that are supported by this camera + * device.

+ * + * @see ACAMERA_CONTROL_SCENE_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This list contains scene modes that can be set for the camera device. + * Only scene modes that have been fully implemented for the + * camera device may be included here. Implementations are not expected + * to be consistent across all devices.

+ *

If no scene modes are supported by the camera device, this + * will be set to DISABLED. Otherwise DISABLED will not be listed.

+ *

FACE_PRIORITY is always listed if face detection is + * supported (i.e.ACAMERA_STATISTICS_INFO_MAX_FACE_COUNT > + * 0).

+ * + * @see ACAMERA_STATISTICS_INFO_MAX_FACE_COUNT + */ + CONTROL_AVAILABLE_SCENE_MODES MetadataTag = C.ACAMERA_CONTROL_AVAILABLE_SCENE_MODES // byte[n] + + /** + *

List of video stabilization modes for ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE + * that are supported by this camera device.

+ * + * @see ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

OFF will always be listed.

+ */ + CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES MetadataTag = C.ACAMERA_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES // byte[n] + + /** + *

List of auto-white-balance modes for ACAMERA_CONTROL_AWB_MODE that are supported by this + * camera device.

+ * + * @see ACAMERA_CONTROL_AWB_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Not all the auto-white-balance modes may be supported by a + * given camera device. This entry lists the valid modes for + * ACAMERA_CONTROL_AWB_MODE for this camera device.

+ *

All camera devices will support ON mode.

+ *

Camera devices that support the MANUAL_POST_PROCESSING capability will always support OFF + * mode, which enables application control of white balance, by using + * ACAMERA_COLOR_CORRECTION_TRANSFORM and ACAMERA_COLOR_CORRECTION_GAINS(ACAMERA_COLOR_CORRECTION_MODE must be set to TRANSFORM_MATRIX). This includes all FULL + * mode camera devices.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_MODE + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + * @see ACAMERA_CONTROL_AWB_MODE + */ + CONTROL_AWB_AVAILABLE_MODES MetadataTag = C.ACAMERA_CONTROL_AWB_AVAILABLE_MODES // byte[n] + + /** + *

List of the maximum number of regions that can be used for metering in + * auto-exposure (AE), auto-white balance (AWB), and auto-focus (AF); + * this corresponds to the the maximum number of elements in + * ACAMERA_CONTROL_AE_REGIONS, ACAMERA_CONTROL_AWB_REGIONS, + * and ACAMERA_CONTROL_AF_REGIONS.

+ * + * @see ACAMERA_CONTROL_AE_REGIONS + * @see ACAMERA_CONTROL_AF_REGIONS + * @see ACAMERA_CONTROL_AWB_REGIONS + * + *

Type: int32[3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + */ + CONTROL_MAX_REGIONS MetadataTag = C.ACAMERA_CONTROL_MAX_REGIONS // int32[3] + + /** + *

Current state of the auto-exposure (AE) algorithm.

+ * + *

Type: byte (acamera_metadata_enum_android_control_ae_state_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Switching between or enabling AE modes (ACAMERA_CONTROL_AE_MODE) always + * resets the AE state to INACTIVE. Similarly, switching between ACAMERA_CONTROL_MODE, + * or ACAMERA_CONTROL_SCENE_MODE if ACAMERA_CONTROL_MODE == USE_SCENE_MODE resets all + * the algorithm states to INACTIVE.

+ *

The camera device can do several state transitions between two results, if it is + * allowed by the state transition table. For example: INACTIVE may never actually be + * seen in a result.

+ *

The state in the result is the state for this image (in sync with this image): if + * AE state becomes CONVERGED, then the image data associated with this result should + * be good to use.

+ *

Below are state transition tables for different AE modes.

+ *

State | Transition Cause | New State | Notes + * :------------:|:----------------:|:---------:|:-----------------------: + * INACTIVE | | INACTIVE | Camera device auto exposure algorithm is disabled

+ *

When ACAMERA_CONTROL_AE_MODE is AE_MODE_ON_*:

+ *

State | Transition Cause | New State | Notes + * :-------------:|:--------------------------------------------:|:--------------:|:-----------------: + * INACTIVE | Camera device initiates AE scan | SEARCHING | Values changing + * INACTIVE | ACAMERA_CONTROL_AE_LOCK is ON | LOCKED | Values locked + * SEARCHING | Camera device finishes AE scan | CONVERGED | Good values, not changing + * SEARCHING | Camera device finishes AE scan | FLASH_REQUIRED | Converged but too dark w/o flash + * SEARCHING | ACAMERA_CONTROL_AE_LOCK is ON | LOCKED | Values locked + * CONVERGED | Camera device initiates AE scan | SEARCHING | Values changing + * CONVERGED | ACAMERA_CONTROL_AE_LOCK is ON | LOCKED | Values locked + * FLASH_REQUIRED | Camera device initiates AE scan | SEARCHING | Values changing + * FLASH_REQUIRED | ACAMERA_CONTROL_AE_LOCK is ON | LOCKED | Values locked + * LOCKED | ACAMERA_CONTROL_AE_LOCK is OFF | SEARCHING | Values not good after unlock + * LOCKED | ACAMERA_CONTROL_AE_LOCK is OFF | CONVERGED | Values good after unlock + * LOCKED | ACAMERA_CONTROL_AE_LOCK is OFF | FLASH_REQUIRED | Exposure good, but too dark + * PRECAPTURE | Sequence done. ACAMERA_CONTROL_AE_LOCK is OFF | CONVERGED | Ready for high-quality capture + * PRECAPTURE | Sequence done. ACAMERA_CONTROL_AE_LOCK is ON | LOCKED | Ready for high-quality capture + * LOCKED | aeLock is ON and aePrecaptureTrigger is START | LOCKED | Precapture trigger is ignored when AE is already locked + * LOCKED | aeLock is ON and aePrecaptureTrigger is CANCEL| LOCKED | Precapture trigger is ignored when AE is already locked + * Any state (excluding LOCKED) | ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is START | PRECAPTURE | Start AE precapture metering sequence + * Any state (excluding LOCKED) | ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is CANCEL| INACTIVE | Currently active precapture metering sequence is canceled

+ *

For the above table, the camera device may skip reporting any state changes that happen + * without application intervention (i.e. mode switch, trigger, locking). Any state that + * can be skipped in that manner is called a transient state.

+ *

For example, for above AE modes (AE_MODE_ON_*), in addition to the state transitions + * listed in above table, it is also legal for the camera device to skip one or more + * transient states between two results. See below table for examples:

+ *

State | Transition Cause | New State | Notes + * :-------------:|:-----------------------------------------------------------:|:--------------:|:-----------------: + * INACTIVE | Camera device finished AE scan | CONVERGED | Values are already good, transient states are skipped by camera device. + * Any state (excluding LOCKED) | ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is START, sequence done | FLASH_REQUIRED | Converged but too dark w/o flash after a precapture sequence, transient states are skipped by camera device. + * Any state (excluding LOCKED) | ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is START, sequence done | CONVERGED | Converged after a precapture sequence, transient states are skipped by camera device. + * Any state (excluding LOCKED) | ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is CANCEL, converged | FLASH_REQUIRED | Converged but too dark w/o flash after a precapture sequence is canceled, transient states are skipped by camera device. + * Any state (excluding LOCKED) | ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is CANCEL, converged | CONVERGED | Converged after a precapture sequenceis canceled, transient states are skipped by camera device. + * CONVERGED | Camera device finished AE scan | FLASH_REQUIRED | Converged but too dark w/o flash after a new scan, transient states are skipped by camera device. + * FLASH_REQUIRED | Camera device finished AE scan | CONVERGED | Converged after a new scan, transient states are skipped by camera device.

+ * + * @see ACAMERA_CONTROL_AE_LOCK + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_CONTROL_SCENE_MODE + */ + CONTROL_AE_STATE MetadataTag = C.ACAMERA_CONTROL_AE_STATE // byte (acamera_metadata_enum_android_control_ae_state_t) + + /** + *

Current state of auto-focus (AF) algorithm.

+ * + *

Type: byte (acamera_metadata_enum_android_control_af_state_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Switching between or enabling AF modes (ACAMERA_CONTROL_AF_MODE) always + * resets the AF state to INACTIVE. Similarly, switching between ACAMERA_CONTROL_MODE, + * or ACAMERA_CONTROL_SCENE_MODE if ACAMERA_CONTROL_MODE == USE_SCENE_MODE resets all + * the algorithm states to INACTIVE.

+ *

The camera device can do several state transitions between two results, if it is + * allowed by the state transition table. For example: INACTIVE may never actually be + * seen in a result.

+ *

The state in the result is the state for this image (in sync with this image): if + * AF state becomes FOCUSED, then the image data associated with this result should + * be sharp.

+ *

Below are state transition tables for different AF modes.

+ *

When ACAMERA_CONTROL_AF_MODE is AF_MODE_OFF or AF_MODE_EDOF:

+ *

State | Transition Cause | New State | Notes + * :------------:|:----------------:|:---------:|:-----------: + * INACTIVE | | INACTIVE | Never changes

+ *

When ACAMERA_CONTROL_AF_MODE is AF_MODE_AUTO or AF_MODE_MACRO:

+ *

State | Transition Cause | New State | Notes + * :-----------------:|:----------------:|:------------------:|:--------------: + * INACTIVE | AF_TRIGGER | ACTIVE_SCAN | Start AF sweep, Lens now moving + * ACTIVE_SCAN | AF sweep done | FOCUSED_LOCKED | Focused, Lens now locked + * ACTIVE_SCAN | AF sweep done | NOT_FOCUSED_LOCKED | Not focused, Lens now locked + * ACTIVE_SCAN | AF_CANCEL | INACTIVE | Cancel/reset AF, Lens now locked + * FOCUSED_LOCKED | AF_CANCEL | INACTIVE | Cancel/reset AF + * FOCUSED_LOCKED | AF_TRIGGER | ACTIVE_SCAN | Start new sweep, Lens now moving + * NOT_FOCUSED_LOCKED | AF_CANCEL | INACTIVE | Cancel/reset AF + * NOT_FOCUSED_LOCKED | AF_TRIGGER | ACTIVE_SCAN | Start new sweep, Lens now moving + * Any state | Mode change | INACTIVE |

+ *

For the above table, the camera device may skip reporting any state changes that happen + * without application intervention (i.e. mode switch, trigger, locking). Any state that + * can be skipped in that manner is called a transient state.

+ *

For example, for these AF modes (AF_MODE_AUTO and AF_MODE_MACRO), in addition to the + * state transitions listed in above table, it is also legal for the camera device to skip + * one or more transient states between two results. See below table for examples:

+ *

State | Transition Cause | New State | Notes + * :-----------------:|:----------------:|:------------------:|:--------------: + * INACTIVE | AF_TRIGGER | FOCUSED_LOCKED | Focus is already good or good after a scan, lens is now locked. + * INACTIVE | AF_TRIGGER | NOT_FOCUSED_LOCKED | Focus failed after a scan, lens is now locked. + * FOCUSED_LOCKED | AF_TRIGGER | FOCUSED_LOCKED | Focus is already good or good after a scan, lens is now locked. + * NOT_FOCUSED_LOCKED | AF_TRIGGER | FOCUSED_LOCKED | Focus is good after a scan, lens is not locked.

+ *

When ACAMERA_CONTROL_AF_MODE is AF_MODE_CONTINUOUS_VIDEO:

+ *

State | Transition Cause | New State | Notes + * :-----------------:|:-----------------------------------:|:------------------:|:--------------: + * INACTIVE | Camera device initiates new scan | PASSIVE_SCAN | Start AF scan, Lens now moving + * INACTIVE | AF_TRIGGER | NOT_FOCUSED_LOCKED | AF state query, Lens now locked + * PASSIVE_SCAN | Camera device completes current scan| PASSIVE_FOCUSED | End AF scan, Lens now locked + * PASSIVE_SCAN | Camera device fails current scan | PASSIVE_UNFOCUSED | End AF scan, Lens now locked + * PASSIVE_SCAN | AF_TRIGGER | FOCUSED_LOCKED | Immediate transition, if focus is good. Lens now locked + * PASSIVE_SCAN | AF_TRIGGER | NOT_FOCUSED_LOCKED | Immediate transition, if focus is bad. Lens now locked + * PASSIVE_SCAN | AF_CANCEL | INACTIVE | Reset lens position, Lens now locked + * PASSIVE_FOCUSED | Camera device initiates new scan | PASSIVE_SCAN | Start AF scan, Lens now moving + * PASSIVE_UNFOCUSED | Camera device initiates new scan | PASSIVE_SCAN | Start AF scan, Lens now moving + * PASSIVE_FOCUSED | AF_TRIGGER | FOCUSED_LOCKED | Immediate transition, lens now locked + * PASSIVE_UNFOCUSED | AF_TRIGGER | NOT_FOCUSED_LOCKED | Immediate transition, lens now locked + * FOCUSED_LOCKED | AF_TRIGGER | FOCUSED_LOCKED | No effect + * FOCUSED_LOCKED | AF_CANCEL | INACTIVE | Restart AF scan + * NOT_FOCUSED_LOCKED | AF_TRIGGER | NOT_FOCUSED_LOCKED | No effect + * NOT_FOCUSED_LOCKED | AF_CANCEL | INACTIVE | Restart AF scan

+ *

When ACAMERA_CONTROL_AF_MODE is AF_MODE_CONTINUOUS_PICTURE:

+ *

State | Transition Cause | New State | Notes + * :-----------------:|:------------------------------------:|:------------------:|:--------------: + * INACTIVE | Camera device initiates new scan | PASSIVE_SCAN | Start AF scan, Lens now moving + * INACTIVE | AF_TRIGGER | NOT_FOCUSED_LOCKED | AF state query, Lens now locked + * PASSIVE_SCAN | Camera device completes current scan | PASSIVE_FOCUSED | End AF scan, Lens now locked + * PASSIVE_SCAN | Camera device fails current scan | PASSIVE_UNFOCUSED | End AF scan, Lens now locked + * PASSIVE_SCAN | AF_TRIGGER | FOCUSED_LOCKED | Eventual transition once the focus is good. Lens now locked + * PASSIVE_SCAN | AF_TRIGGER | NOT_FOCUSED_LOCKED | Eventual transition if cannot find focus. Lens now locked + * PASSIVE_SCAN | AF_CANCEL | INACTIVE | Reset lens position, Lens now locked + * PASSIVE_FOCUSED | Camera device initiates new scan | PASSIVE_SCAN | Start AF scan, Lens now moving + * PASSIVE_UNFOCUSED | Camera device initiates new scan | PASSIVE_SCAN | Start AF scan, Lens now moving + * PASSIVE_FOCUSED | AF_TRIGGER | FOCUSED_LOCKED | Immediate trans. Lens now locked + * PASSIVE_UNFOCUSED | AF_TRIGGER | NOT_FOCUSED_LOCKED | Immediate trans. Lens now locked + * FOCUSED_LOCKED | AF_TRIGGER | FOCUSED_LOCKED | No effect + * FOCUSED_LOCKED | AF_CANCEL | INACTIVE | Restart AF scan + * NOT_FOCUSED_LOCKED | AF_TRIGGER | NOT_FOCUSED_LOCKED | No effect + * NOT_FOCUSED_LOCKED | AF_CANCEL | INACTIVE | Restart AF scan

+ *

When switch between AF_MODE_CONTINUOUS_* (CAF modes) and AF_MODE_AUTO/AF_MODE_MACRO + * (AUTO modes), the initial INACTIVE or PASSIVE_SCAN states may be skipped by the + * camera device. When a trigger is included in a mode switch request, the trigger + * will be evaluated in the context of the new mode in the request. + * See below table for examples:

+ *

State | Transition Cause | New State | Notes + * :-----------:|:--------------------------------------:|:----------------------------------------:|:--------------: + * any state | CAF-->AUTO mode switch | INACTIVE | Mode switch without trigger, initial state must be INACTIVE + * any state | CAF-->AUTO mode switch with AF_TRIGGER | trigger-reachable states from INACTIVE | Mode switch with trigger, INACTIVE is skipped + * any state | AUTO-->CAF mode switch | passively reachable states from INACTIVE | Mode switch without trigger, passive transient state is skipped

+ * + * @see ACAMERA_CONTROL_AF_MODE + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_CONTROL_SCENE_MODE + */ + CONTROL_AF_STATE MetadataTag = C.ACAMERA_CONTROL_AF_STATE // byte (acamera_metadata_enum_android_control_af_state_t) + + /** + *

Current state of auto-white balance (AWB) algorithm.

+ * + *

Type: byte (acamera_metadata_enum_android_control_awb_state_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Switching between or enabling AWB modes (ACAMERA_CONTROL_AWB_MODE) always + * resets the AWB state to INACTIVE. Similarly, switching between ACAMERA_CONTROL_MODE, + * or ACAMERA_CONTROL_SCENE_MODE if ACAMERA_CONTROL_MODE == USE_SCENE_MODE resets all + * the algorithm states to INACTIVE.

+ *

The camera device can do several state transitions between two results, if it is + * allowed by the state transition table. So INACTIVE may never actually be seen in + * a result.

+ *

The state in the result is the state for this image (in sync with this image): if + * AWB state becomes CONVERGED, then the image data associated with this result should + * be good to use.

+ *

Below are state transition tables for different AWB modes.

+ *

When ACAMERA_CONTROL_AWB_MODE != AWB_MODE_AUTO:

+ *

State | Transition Cause | New State | Notes + * :------------:|:----------------:|:---------:|:-----------------------: + * INACTIVE | |INACTIVE |Camera device auto white balance algorithm is disabled

+ *

When ACAMERA_CONTROL_AWB_MODE is AWB_MODE_AUTO:

+ *

State | Transition Cause | New State | Notes + * :-------------:|:--------------------------------:|:-------------:|:-----------------: + * INACTIVE | Camera device initiates AWB scan | SEARCHING | Values changing + * INACTIVE | ACAMERA_CONTROL_AWB_LOCK is ON | LOCKED | Values locked + * SEARCHING | Camera device finishes AWB scan | CONVERGED | Good values, not changing + * SEARCHING | ACAMERA_CONTROL_AWB_LOCK is ON | LOCKED | Values locked + * CONVERGED | Camera device initiates AWB scan | SEARCHING | Values changing + * CONVERGED | ACAMERA_CONTROL_AWB_LOCK is ON | LOCKED | Values locked + * LOCKED | ACAMERA_CONTROL_AWB_LOCK is OFF | SEARCHING | Values not good after unlock

+ *

For the above table, the camera device may skip reporting any state changes that happen + * without application intervention (i.e. mode switch, trigger, locking). Any state that + * can be skipped in that manner is called a transient state.

+ *

For example, for this AWB mode (AWB_MODE_AUTO), in addition to the state transitions + * listed in above table, it is also legal for the camera device to skip one or more + * transient states between two results. See below table for examples:

+ *

State | Transition Cause | New State | Notes + * :-------------:|:--------------------------------:|:-------------:|:-----------------: + * INACTIVE | Camera device finished AWB scan | CONVERGED | Values are already good, transient states are skipped by camera device. + * LOCKED | ACAMERA_CONTROL_AWB_LOCK is OFF | CONVERGED | Values good after unlock, transient states are skipped by camera device.

+ * + * @see ACAMERA_CONTROL_AWB_LOCK + * @see ACAMERA_CONTROL_AWB_MODE + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_CONTROL_SCENE_MODE + */ + CONTROL_AWB_STATE MetadataTag = C.ACAMERA_CONTROL_AWB_STATE // byte (acamera_metadata_enum_android_control_awb_state_t) + + /** + *

Whether the camera device supports ACAMERA_CONTROL_AE_LOCK

+ * + * @see ACAMERA_CONTROL_AE_LOCK + * + *

Type: byte (acamera_metadata_enum_android_control_ae_lock_available_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Devices with MANUAL_SENSOR capability or BURST_CAPTURE capability will always + * list true. This includes FULL devices.

+ */ + CONTROL_AE_LOCK_AVAILABLE MetadataTag = C.ACAMERA_CONTROL_AE_LOCK_AVAILABLE // byte (acamera_metadata_enum_android_control_ae_lock_available_t) + + /** + *

Whether the camera device supports ACAMERA_CONTROL_AWB_LOCK

+ * + * @see ACAMERA_CONTROL_AWB_LOCK + * + *

Type: byte (acamera_metadata_enum_android_control_awb_lock_available_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Devices with MANUAL_POST_PROCESSING capability or BURST_CAPTURE capability will + * always list true. This includes FULL devices.

+ */ + CONTROL_AWB_LOCK_AVAILABLE MetadataTag = C.ACAMERA_CONTROL_AWB_LOCK_AVAILABLE // byte (acamera_metadata_enum_android_control_awb_lock_available_t) + + /** + *

List of control modes for ACAMERA_CONTROL_MODE that are supported by this camera + * device.

+ * + * @see ACAMERA_CONTROL_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This list contains control modes that can be set for the camera device. + * LEGACY mode devices will always support AUTO mode. LIMITED and FULL + * devices will always support OFF, AUTO modes.

+ */ + CONTROL_AVAILABLE_MODES MetadataTag = C.ACAMERA_CONTROL_AVAILABLE_MODES // byte[n] + + /** + *

Range of boosts for ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST supported + * by this camera device.

+ * + * @see ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST + * + *

Type: int32[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Devices support post RAW sensitivity boost will advertise + * ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST key for controling + * post RAW sensitivity boost.

+ *

This key will be null for devices that do not support any RAW format + * outputs. For devices that do support RAW format outputs, this key will always + * present, and if a device does not support post RAW sensitivity boost, it will + * list (100, 100) in this key.

+ * + * @see ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST + */ + CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE MetadataTag = C.ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE // int32[2] + + /** + *

The amount of additional sensitivity boost applied to output images + * after RAW sensor data is captured.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Some camera devices support additional digital sensitivity boosting in the + * camera processing pipeline after sensor RAW image is captured. + * Such a boost will be applied to YUV/JPEG format output images but will not + * have effect on RAW output formats like RAW_SENSOR, RAW10, RAW12 or RAW_OPAQUE.

+ *

This key will be null for devices that do not support any RAW format + * outputs. For devices that do support RAW format outputs, this key will always + * present, and if a device does not support post RAW sensitivity boost, it will + * list 100 in this key.

+ *

If the camera device cannot apply the exact boost requested, it will reduce the + * boost to the nearest supported value. + * The final boost value used will be available in the output capture result.

+ *

For devices that support post RAW sensitivity boost, the YUV/JPEG output images + * of such device will have the total sensitivity of + * ACAMERA_SENSOR_SENSITIVITY * ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST / 100 + * The sensitivity of RAW format images will always be ACAMERA_SENSOR_SENSITIVITY

+ *

This control is only effective if ACAMERA_CONTROL_AE_MODE or ACAMERA_CONTROL_MODE is set to + * OFF; otherwise the auto-exposure algorithm will override this value.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST + * @see ACAMERA_SENSOR_SENSITIVITY + */ + CONTROL_POST_RAW_SENSITIVITY_BOOST MetadataTag = C.ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST // int32 + + /** + *

Allow camera device to enable zero-shutter-lag mode for requests with + * ACAMERA_CONTROL_CAPTURE_INTENT == STILL_CAPTURE.

+ * + * @see ACAMERA_CONTROL_CAPTURE_INTENT + * + *

Type: byte (acamera_metadata_enum_android_control_enable_zsl_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

If enableZsl is true, the camera device may enable zero-shutter-lag mode for requests with + * STILL_CAPTURE capture intent. The camera device may use images captured in the past to + * produce output images for a zero-shutter-lag request. The result metadata including the + * ACAMERA_SENSOR_TIMESTAMP reflects the source frames used to produce output images. + * Therefore, the contents of the output images and the result metadata may be out of order + * compared to previous regular requests. enableZsl does not affect requests with other + * capture intents.

+ *

For example, when requests are submitted in the following order: + * Request A: enableZsl is true, ACAMERA_CONTROL_CAPTURE_INTENT is PREVIEW + * Request B: enableZsl is true, ACAMERA_CONTROL_CAPTURE_INTENT is STILL_CAPTURE

+ *

The output images for request B may have contents captured before the output images for + * request A, and the result metadata for request B may be older than the result metadata for + * request A.

+ *

Note that when enableZsl is true, it is not guaranteed to get output images captured in the + * past for requests with STILL_CAPTURE capture intent.

+ *

For applications targeting SDK versions O and newer, the value of enableZsl in + * TEMPLATE_STILL_CAPTURE template may be true. The value in other templates is always + * false if present.

+ *

For applications targeting SDK versions older than O, the value of enableZsl in all + * capture templates is always false if present.

+ *

For application-operated ZSL, use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.

+ * + * @see ACAMERA_CONTROL_CAPTURE_INTENT + * @see ACAMERA_SENSOR_TIMESTAMP + */ + CONTROL_ENABLE_ZSL MetadataTag = C.ACAMERA_CONTROL_ENABLE_ZSL // byte (acamera_metadata_enum_android_control_enable_zsl_t) + + CONTROL_END MetadataTag = C.ACAMERA_CONTROL_END + + /** + *

Operation mode for edge + * enhancement.

+ * + *

Type: byte (acamera_metadata_enum_android_edge_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Edge enhancement improves sharpness and details in the captured image. OFF means + * no enhancement will be applied by the camera device.

+ *

FAST/HIGH_QUALITY both mean camera device determined enhancement + * will be applied. HIGH_QUALITY mode indicates that the + * camera device will use the highest-quality enhancement algorithms, + * even if it slows down capture rate. FAST means the camera device will + * not slow down capture rate when applying edge enhancement. FAST may be the same as OFF if + * edge enhancement will slow down capture rate. Every output stream will have a similar + * amount of enhancement applied.

+ *

ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular + * buffer of high-resolution images during preview and reprocess image(s) from that buffer + * into a final capture when triggered by the user. In this mode, the camera device applies + * edge enhancement to low-resolution streams (below maximum recording resolution) to + * maximize preview quality, but does not apply edge enhancement to high-resolution streams, + * since those will be reprocessed later if necessary.

+ *

For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera + * device will apply FAST/HIGH_QUALITY YUV-domain edge enhancement, respectively. + * The camera device may adjust its internal edge enhancement parameters for best + * image quality based on the android.reprocess.effectiveExposureFactor, if it is set.

+ */ + EDGE_MODE MetadataTag = C.ACAMERA_EDGE_MODE // byte (acamera_metadata_enum_android_edge_mode_t) + + /** + *

List of edge enhancement modes for ACAMERA_EDGE_MODE that are supported by this camera + * device.

+ * + * @see ACAMERA_EDGE_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Full-capability camera devices must always support OFF; camera devices that support + * YUV_REPROCESSING or PRIVATE_REPROCESSING will list ZERO_SHUTTER_LAG; all devices will + * list FAST.

+ */ + EDGE_AVAILABLE_EDGE_MODES MetadataTag = C.ACAMERA_EDGE_AVAILABLE_EDGE_MODES // byte[n] + + EDGE_END MetadataTag = C.ACAMERA_EDGE_END + + /** + *

The desired mode for for the camera device's flash control.

+ * + *

Type: byte (acamera_metadata_enum_android_flash_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This control is only effective when flash unit is available + * (ACAMERA_FLASH_INFO_AVAILABLE == true).

+ *

When this control is used, the ACAMERA_CONTROL_AE_MODE must be set to ON or OFF. + * Otherwise, the camera device auto-exposure related flash control (ON_AUTO_FLASH, + * ON_ALWAYS_FLASH, or ON_AUTO_FLASH_REDEYE) will override this control.

+ *

When set to OFF, the camera device will not fire flash for this capture.

+ *

When set to SINGLE, the camera device will fire flash regardless of the camera + * device's auto-exposure routine's result. When used in still capture case, this + * control should be used along with auto-exposure (AE) precapture metering sequence + * (ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER), otherwise, the image may be incorrectly exposed.

+ *

When set to TORCH, the flash will be on continuously. This mode can be used + * for use cases such as preview, auto-focus assist, still capture, or video recording.

+ *

The flash status will be reported by ACAMERA_FLASH_STATE in the capture result metadata.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * @see ACAMERA_FLASH_INFO_AVAILABLE + * @see ACAMERA_FLASH_STATE + */ + FLASH_MODE MetadataTag = C.ACAMERA_FLASH_MODE // byte (acamera_metadata_enum_android_flash_mode_t) + + /** + *

Current state of the flash + * unit.

+ * + *

Type: byte (acamera_metadata_enum_android_flash_state_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

When the camera device doesn't have flash unit + * (i.e. ACAMERA_FLASH_INFO_AVAILABLE == false), this state will always be UNAVAILABLE. + * Other states indicate the current flash status.

+ *

In certain conditions, this will be available on LEGACY devices:

+ *
    + *
  • Flash-less cameras always return UNAVAILABLE.
  • + *
  • Using ACAMERA_CONTROL_AE_MODE == ON_ALWAYS_FLASH + * will always return FIRED.
  • + *
  • Using ACAMERA_FLASH_MODE == TORCH + * will always return FIRED.
  • + *
+ *

In all other conditions the state will not be available on + * LEGACY devices (i.e. it will be null).

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_FLASH_INFO_AVAILABLE + * @see ACAMERA_FLASH_MODE + */ + FLASH_STATE MetadataTag = C.ACAMERA_FLASH_STATE // byte (acamera_metadata_enum_android_flash_state_t) + + FLASH_END MetadataTag = C.ACAMERA_FLASH_END + + /** + *

Whether this camera device has a + * flash unit.

+ * + *

Type: byte (acamera_metadata_enum_android_flash_info_available_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Will be false if no flash is available.

+ *

If there is no flash unit, none of the flash controls do + * anything.

+ */ + FLASH_INFO_AVAILABLE MetadataTag = C.ACAMERA_FLASH_INFO_AVAILABLE // byte (acamera_metadata_enum_android_flash_info_available_t) + + FLASH_INFO_END MetadataTag = C.ACAMERA_FLASH_INFO_END + + /** + *

Operational mode for hot pixel correction.

+ * + *

Type: byte (acamera_metadata_enum_android_hot_pixel_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Hotpixel correction interpolates out, or otherwise removes, pixels + * that do not accurately measure the incoming light (i.e. pixels that + * are stuck at an arbitrary value or are oversensitive).

+ */ + HOT_PIXEL_MODE MetadataTag = C.ACAMERA_HOT_PIXEL_MODE // byte (acamera_metadata_enum_android_hot_pixel_mode_t) + + /** + *

List of hot pixel correction modes for ACAMERA_HOT_PIXEL_MODE that are supported by this + * camera device.

+ * + * @see ACAMERA_HOT_PIXEL_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

FULL mode camera devices will always support FAST.

+ */ + HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES MetadataTag = C.ACAMERA_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES // byte[n] + + HOT_PIXEL_END MetadataTag = C.ACAMERA_HOT_PIXEL_END + + /** + *

GPS coordinates to include in output JPEG + * EXIF.

+ * + *

Type: double[3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + */ + JPEG_GPS_COORDINATES MetadataTag = C.ACAMERA_JPEG_GPS_COORDINATES // double[3] + + /** + *

32 characters describing GPS algorithm to + * include in EXIF.

+ * + *

Type: byte

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + */ + JPEG_GPS_PROCESSING_METHOD MetadataTag = C.ACAMERA_JPEG_GPS_PROCESSING_METHOD // byte + + /** + *

Time GPS fix was made to include in + * EXIF.

+ * + *

Type: int64

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + */ + JPEG_GPS_TIMESTAMP MetadataTag = C.ACAMERA_JPEG_GPS_TIMESTAMP // int64 + + /** + *

The orientation for a JPEG image.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

The clockwise rotation angle in degrees, relative to the orientation + * to the camera, that the JPEG picture needs to be rotated by, to be viewed + * upright.

+ *

Camera devices may either encode this value into the JPEG EXIF header, or + * rotate the image data to match this orientation. When the image data is rotated, + * the thumbnail data will also be rotated.

+ *

Note that this orientation is relative to the orientation of the camera sensor, given + * by ACAMERA_SENSOR_ORIENTATION.

+ *

To translate from the device orientation given by the Android sensor APIs, the following + * sample code may be used:

+ *
private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
+	 *     if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
+	 *     int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
+	 *
+	 *     // Round device orientation to a multiple of 90
+	 *     deviceOrientation = (deviceOrientation + 45) / 90 * 90;
+	 *
+	 *     // Reverse device orientation for front-facing cameras
+	 *     boolean facingFront = c.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT;
+	 *     if (facingFront) deviceOrientation = -deviceOrientation;
+	 *
+	 *     // Calculate desired JPEG orientation relative to camera orientation to make
+	 *     // the image upright relative to the device orientation
+	 *     int jpegOrientation = (sensorOrientation + deviceOrientation + 360) % 360;
+	 *
+	 *     return jpegOrientation;
+	 * }
+	 * 
+ * + * @see ACAMERA_SENSOR_ORIENTATION + */ + JPEG_ORIENTATION MetadataTag = C.ACAMERA_JPEG_ORIENTATION // int32 + + /** + *

Compression quality of the final JPEG + * image.

+ * + *

Type: byte

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

85-95 is typical usage range.

+ */ + JPEG_QUALITY MetadataTag = C.ACAMERA_JPEG_QUALITY // byte + + /** + *

Compression quality of JPEG + * thumbnail.

+ * + *

Type: byte

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + */ + JPEG_THUMBNAIL_QUALITY MetadataTag = C.ACAMERA_JPEG_THUMBNAIL_QUALITY // byte + + /** + *

Resolution of embedded JPEG thumbnail.

+ * + *

Type: int32[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When set to (0, 0) value, the JPEG EXIF will not contain thumbnail, + * but the captured JPEG will still be a valid image.

+ *

For best results, when issuing a request for a JPEG image, the thumbnail size selected + * should have the same aspect ratio as the main JPEG output.

+ *

If the thumbnail image aspect ratio differs from the JPEG primary image aspect + * ratio, the camera device creates the thumbnail by cropping it from the primary image. + * For example, if the primary image has 4:3 aspect ratio, the thumbnail image has + * 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to + * generate the thumbnail image. The thumbnail image will always have a smaller Field + * Of View (FOV) than the primary image when aspect ratios differ.

+ *

When an ACAMERA_JPEG_ORIENTATION of non-zero degree is requested, + * the camera device will handle thumbnail rotation in one of the following ways:

+ *
    + *
  • Set the + * EXIF orientation flag + * and keep jpeg and thumbnail image data unrotated.
  • + *
  • Rotate the jpeg and thumbnail image data and not set + * EXIF orientation flag. + * In this case, LIMITED or FULL hardware level devices will report rotated thumnail size + * in capture result, so the width and height will be interchanged if 90 or 270 degree + * orientation is requested. LEGACY device will always report unrotated thumbnail size.
  • + *
+ * + * @see ACAMERA_JPEG_ORIENTATION + */ + JPEG_THUMBNAIL_SIZE MetadataTag = C.ACAMERA_JPEG_THUMBNAIL_SIZE // int32[2] + + /** + *

List of JPEG thumbnail sizes for ACAMERA_JPEG_THUMBNAIL_SIZE supported by this + * camera device.

+ * + * @see ACAMERA_JPEG_THUMBNAIL_SIZE + * + *

Type: int32[2*n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This list will include at least one non-zero resolution, plus (0,0) for indicating no + * thumbnail should be generated.

+ *

Below condiditions will be satisfied for this size list:

+ *
    + *
  • The sizes will be sorted by increasing pixel area (width x height). + * If several resolutions have the same area, they will be sorted by increasing width.
  • + *
  • The aspect ratio of the largest thumbnail size will be same as the + * aspect ratio of largest JPEG output size in ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS. + * The largest size is defined as the size that has the largest pixel area + * in a given size list.
  • + *
  • Each output JPEG size in ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS will have at least + * one corresponding size that has the same aspect ratio in availableThumbnailSizes, + * and vice versa.
  • + *
  • All non-(0, 0) sizes will have non-zero widths and heights.
  • + *
+ * + * @see ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS + */ + JPEG_AVAILABLE_THUMBNAIL_SIZES MetadataTag = C.ACAMERA_JPEG_AVAILABLE_THUMBNAIL_SIZES // int32[2*n] + + JPEG_END MetadataTag = C.ACAMERA_JPEG_END + + /** + *

The desired lens aperture size, as a ratio of lens focal length to the + * effective aperture diameter.

+ * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Setting this value is only supported on the camera devices that have a variable + * aperture lens.

+ *

When this is supported and ACAMERA_CONTROL_AE_MODE is OFF, + * this can be set along with ACAMERA_SENSOR_EXPOSURE_TIME, + * ACAMERA_SENSOR_SENSITIVITY, and ACAMERA_SENSOR_FRAME_DURATION + * to achieve manual exposure control.

+ *

The requested aperture value may take several frames to reach the + * requested value; the camera device will report the current (intermediate) + * aperture size in capture result metadata while the aperture is changing. + * While the aperture is still changing, ACAMERA_LENS_STATE will be set to MOVING.

+ *

When this is supported and ACAMERA_CONTROL_AE_MODE is one of + * the ON modes, this will be overridden by the camera device + * auto-exposure algorithm, the overridden values are then provided + * back to the user in the corresponding result.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_LENS_STATE + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_FRAME_DURATION + * @see ACAMERA_SENSOR_SENSITIVITY + */ + LENS_APERTURE MetadataTag = C.ACAMERA_LENS_APERTURE // float + + /** + *

The desired setting for the lens neutral density filter(s).

+ * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This control will not be supported on most camera devices.

+ *

Lens filters are typically used to lower the amount of light the + * sensor is exposed to (measured in steps of EV). As used here, an EV + * step is the standard logarithmic representation, which are + * non-negative, and inversely proportional to the amount of light + * hitting the sensor. For example, setting this to 0 would result + * in no reduction of the incoming light, and setting this to 2 would + * mean that the filter is set to reduce incoming light by two stops + * (allowing 1/4 of the prior amount of light to the sensor).

+ *

It may take several frames before the lens filter density changes + * to the requested value. While the filter density is still changing, + * ACAMERA_LENS_STATE will be set to MOVING.

+ * + * @see ACAMERA_LENS_STATE + */ + LENS_FILTER_DENSITY MetadataTag = C.ACAMERA_LENS_FILTER_DENSITY // float + + /** + *

The desired lens focal length; used for optical zoom.

+ * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This setting controls the physical focal length of the camera + * device's lens. Changing the focal length changes the field of + * view of the camera device, and is usually used for optical zoom.

+ *

Like ACAMERA_LENS_FOCUS_DISTANCE and ACAMERA_LENS_APERTURE, this + * setting won't be applied instantaneously, and it may take several + * frames before the lens can change to the requested focal length. + * While the focal length is still changing, ACAMERA_LENS_STATE will + * be set to MOVING.

+ *

Optical zoom will not be supported on most devices.

+ * + * @see ACAMERA_LENS_APERTURE + * @see ACAMERA_LENS_FOCUS_DISTANCE + * @see ACAMERA_LENS_STATE + */ + LENS_FOCAL_LENGTH MetadataTag = C.ACAMERA_LENS_FOCAL_LENGTH // float + + /** + *

Desired distance to plane of sharpest focus, + * measured from frontmost surface of the lens.

+ * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Should be zero for fixed-focus cameras

+ */ + LENS_FOCUS_DISTANCE MetadataTag = C.ACAMERA_LENS_FOCUS_DISTANCE // float + + /** + *

Sets whether the camera device uses optical image stabilization (OIS) + * when capturing images.

+ * + *

Type: byte (acamera_metadata_enum_android_lens_optical_stabilization_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

OIS is used to compensate for motion blur due to small + * movements of the camera during capture. Unlike digital image + * stabilization (ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE), OIS + * makes use of mechanical elements to stabilize the camera + * sensor, and thus allows for longer exposure times before + * camera shake becomes apparent.

+ *

Switching between different optical stabilization modes may take several + * frames to initialize, the camera device will report the current mode in + * capture result metadata. For example, When "ON" mode is requested, the + * optical stabilization modes in the first several capture results may still + * be "OFF", and it will become "ON" when the initialization is done.

+ *

If a camera device supports both OIS and digital image stabilization + * (ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE), turning both modes on may produce undesirable + * interaction, so it is recommended not to enable both at the same time.

+ *

Not all devices will support OIS; see + * ACAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION for + * available controls.

+ * + * @see ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE + * @see ACAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION + */ + LENS_OPTICAL_STABILIZATION_MODE MetadataTag = C.ACAMERA_LENS_OPTICAL_STABILIZATION_MODE // byte (acamera_metadata_enum_android_lens_optical_stabilization_mode_t) + + /** + *

Direction the camera faces relative to + * device screen.

+ * + *

Type: byte (acamera_metadata_enum_android_lens_facing_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + */ + LENS_FACING MetadataTag = C.ACAMERA_LENS_FACING // byte (acamera_metadata_enum_android_lens_facing_t) + + /** + *

The orientation of the camera relative to the sensor + * coordinate system.

+ * + *

Type: float[4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

The four coefficients that describe the quaternion + * rotation from the Android sensor coordinate system to a + * camera-aligned coordinate system where the X-axis is + * aligned with the long side of the image sensor, the Y-axis + * is aligned with the short side of the image sensor, and + * the Z-axis is aligned with the optical axis of the sensor.

+ *

To convert from the quaternion coefficients (x,y,z,w) + * to the axis of rotation (a_x, a_y, a_z) and rotation + * amount theta, the following formulas can be used:

+ *
 theta = 2 * acos(w)
+	 * a_x = x / sin(theta/2)
+	 * a_y = y / sin(theta/2)
+	 * a_z = z / sin(theta/2)
+	 * 
+ *

To create a 3x3 rotation matrix that applies the rotation + * defined by this quaternion, the following matrix can be + * used:

+ *
R = [ 1 - 2y^2 - 2z^2,       2xy - 2zw,       2xz + 2yw,
+	 *            2xy + 2zw, 1 - 2x^2 - 2z^2,       2yz - 2xw,
+	 *            2xz - 2yw,       2yz + 2xw, 1 - 2x^2 - 2y^2 ]
+	 * 
+ *

This matrix can then be used to apply the rotation to a + * column vector point with

+ *

p' = Rp

+ *

where p is in the device sensor coordinate system, and + * p' is in the camera-oriented coordinate system.

+ */ + LENS_POSE_ROTATION MetadataTag = C.ACAMERA_LENS_POSE_ROTATION // float[4] + + /** + *

Position of the camera optical center.

+ * + *

Type: float[3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

The position of the camera device's lens optical center, + * as a three-dimensional vector (x,y,z), relative to the + * optical center of the largest camera device facing in the + * same direction as this camera, in the + * Android sensor coordinate axes. + * Note that only the axis definitions are shared with + * the sensor coordinate system, but not the origin.

+ *

If this device is the largest or only camera device with a + * given facing, then this position will be (0, 0, 0); a + * camera device with a lens optical center located 3 cm from + * the main sensor along the +X axis (to the right from the + * user's perspective) will report (0.03, 0, 0).

+ *

To transform a pixel coordinates between two cameras + * facing the same direction, first the source camera + * ACAMERA_LENS_RADIAL_DISTORTION must be corrected for. Then + * the source camera ACAMERA_LENS_INTRINSIC_CALIBRATION needs + * to be applied, followed by the ACAMERA_LENS_POSE_ROTATION + * of the source camera, the translation of the source camera + * relative to the destination camera, the + * ACAMERA_LENS_POSE_ROTATION of the destination camera, and + * finally the inverse of ACAMERA_LENS_INTRINSIC_CALIBRATION + * of the destination camera. This obtains a + * radial-distortion-free coordinate in the destination + * camera pixel coordinates.

+ *

To compare this against a real image from the destination + * camera, the destination camera image then needs to be + * corrected for radial distortion before comparison or + * sampling.

+ * + * @see ACAMERA_LENS_INTRINSIC_CALIBRATION + * @see ACAMERA_LENS_POSE_ROTATION + * @see ACAMERA_LENS_RADIAL_DISTORTION + */ + LENS_POSE_TRANSLATION MetadataTag = C.ACAMERA_LENS_POSE_TRANSLATION // float[3] + + /** + *

The range of scene distances that are in + * sharp focus (depth of field).

+ * + *

Type: float[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

If variable focus not supported, can still report + * fixed depth of field range

+ */ + LENS_FOCUS_RANGE MetadataTag = C.ACAMERA_LENS_FOCUS_RANGE // float[2] + + /** + *

Current lens status.

+ * + *

Type: byte (acamera_metadata_enum_android_lens_state_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

For lens parameters ACAMERA_LENS_FOCAL_LENGTH, ACAMERA_LENS_FOCUS_DISTANCE, + * ACAMERA_LENS_FILTER_DENSITY and ACAMERA_LENS_APERTURE, when changes are requested, + * they may take several frames to reach the requested values. This state indicates + * the current status of the lens parameters.

+ *

When the state is STATIONARY, the lens parameters are not changing. This could be + * either because the parameters are all fixed, or because the lens has had enough + * time to reach the most recently-requested values. + * If all these lens parameters are not changable for a camera device, as listed below:

+ *
    + *
  • Fixed focus (ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE == 0), which means + * ACAMERA_LENS_FOCUS_DISTANCE parameter will always be 0.
  • + *
  • Fixed focal length (ACAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS contains single value), + * which means the optical zoom is not supported.
  • + *
  • No ND filter (ACAMERA_LENS_INFO_AVAILABLE_FILTER_DENSITIES contains only 0).
  • + *
  • Fixed aperture (ACAMERA_LENS_INFO_AVAILABLE_APERTURES contains single value).
  • + *
+ *

Then this state will always be STATIONARY.

+ *

When the state is MOVING, it indicates that at least one of the lens parameters + * is changing.

+ * + * @see ACAMERA_LENS_APERTURE + * @see ACAMERA_LENS_FILTER_DENSITY + * @see ACAMERA_LENS_FOCAL_LENGTH + * @see ACAMERA_LENS_FOCUS_DISTANCE + * @see ACAMERA_LENS_INFO_AVAILABLE_APERTURES + * @see ACAMERA_LENS_INFO_AVAILABLE_FILTER_DENSITIES + * @see ACAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS + * @see ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE + */ + LENS_STATE MetadataTag = C.ACAMERA_LENS_STATE // byte (acamera_metadata_enum_android_lens_state_t) + + /** + *

The parameters for this camera device's intrinsic + * calibration.

+ * + *

Type: float[5]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

The five calibration parameters that describe the + * transform from camera-centric 3D coordinates to sensor + * pixel coordinates:

+ *
[f_x, f_y, c_x, c_y, s]
+	 * 
+ *

Where f_x and f_y are the horizontal and vertical + * focal lengths, [c_x, c_y] is the position of the optical + * axis, and s is a skew parameter for the sensor plane not + * being aligned with the lens plane.

+ *

These are typically used within a transformation matrix K:

+ *
K = [ f_x,   s, c_x,
+	 *        0, f_y, c_y,
+	 *        0    0,   1 ]
+	 * 
+ *

which can then be combined with the camera pose rotation + * R and translation t (ACAMERA_LENS_POSE_ROTATION and + * ACAMERA_LENS_POSE_TRANSLATION, respective) to calculate the + * complete transform from world coordinates to pixel + * coordinates:

+ *
P = [ K 0   * [ R t
+	 *      0 1 ]     0 1 ]
+	 * 
+ *

and with p_w being a point in the world coordinate system + * and p_s being a point in the camera active pixel array + * coordinate system, and with the mapping including the + * homogeneous division by z:

+ *
 p_h = (x_h, y_h, z_h) = P p_w
+	 * p_s = p_h / z_h
+	 * 
+ *

so [x_s, y_s] is the pixel coordinates of the world + * point, z_s = 1, and w_s is a measurement of disparity + * (depth) in pixel coordinates.

+ *

Note that the coordinate system for this transform is the + * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE system, + * where (0,0) is the top-left of the + * preCorrectionActiveArraySize rectangle. Once the pose and + * intrinsic calibration transforms have been applied to a + * world point, then the ACAMERA_LENS_RADIAL_DISTORTION + * transform needs to be applied, and the result adjusted to + * be in the ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE coordinate + * system (where (0, 0) is the top-left of the + * activeArraySize rectangle), to determine the final pixel + * coordinate of the world point for processed (non-RAW) + * output buffers.

+ * + * @see ACAMERA_LENS_POSE_ROTATION + * @see ACAMERA_LENS_POSE_TRANSLATION + * @see ACAMERA_LENS_RADIAL_DISTORTION + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE + */ + LENS_INTRINSIC_CALIBRATION MetadataTag = C.ACAMERA_LENS_INTRINSIC_CALIBRATION // float[5] + + /** + *

The correction coefficients to correct for this camera device's + * radial and tangential lens distortion.

+ * + *

Type: float[6]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Four radial distortion coefficients [kappa_0, kappa_1, kappa_2, + * kappa_3] and two tangential distortion coefficients + * [kappa_4, kappa_5] that can be used to correct the + * lens's geometric distortion with the mapping equations:

+ *
 x_c = x_i * ( kappa_0 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
+	 *        kappa_4 * (2 * x_i * y_i) + kappa_5 * ( r^2 + 2 * x_i^2 )
+	 *  y_c = y_i * ( kappa_0 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
+	 *        kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 )
+	 * 
+ *

Here, [x_c, y_c] are the coordinates to sample in the + * input image that correspond to the pixel values in the + * corrected image at the coordinate [x_i, y_i]:

+ *
 correctedImage(x_i, y_i) = sample_at(x_c, y_c, inputImage)
+	 * 
+ *

The pixel coordinates are defined in a normalized + * coordinate system related to the + * ACAMERA_LENS_INTRINSIC_CALIBRATION calibration fields. + * Both [x_i, y_i] and [x_c, y_c] have (0,0) at the + * lens optical center [c_x, c_y]. The maximum magnitudes + * of both x and y coordinates are normalized to be 1 at the + * edge further from the optical center, so the range + * for both dimensions is -1 <= x <= 1.

+ *

Finally, r represents the radial distance from the + * optical center, r^2 = x_i^2 + y_i^2, and its magnitude + * is therefore no larger than |r| <= sqrt(2).

+ *

The distortion model used is the Brown-Conrady model.

+ * + * @see ACAMERA_LENS_INTRINSIC_CALIBRATION + */ + LENS_RADIAL_DISTORTION MetadataTag = C.ACAMERA_LENS_RADIAL_DISTORTION // float[6] + + LENS_END MetadataTag = C.ACAMERA_LENS_END + + /** + *

List of aperture size values for ACAMERA_LENS_APERTURE that are + * supported by this camera device.

+ * + * @see ACAMERA_LENS_APERTURE + * + *

Type: float[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If the camera device doesn't support a variable lens aperture, + * this list will contain only one value, which is the fixed aperture size.

+ *

If the camera device supports a variable aperture, the aperture values + * in this list will be sorted in ascending order.

+ */ + LENS_INFO_AVAILABLE_APERTURES MetadataTag = C.ACAMERA_LENS_INFO_AVAILABLE_APERTURES // float[n] + + /** + *

List of neutral density filter values for + * ACAMERA_LENS_FILTER_DENSITY that are supported by this camera device.

+ * + * @see ACAMERA_LENS_FILTER_DENSITY + * + *

Type: float[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If a neutral density filter is not supported by this camera device, + * this list will contain only 0. Otherwise, this list will include every + * filter density supported by the camera device, in ascending order.

+ */ + LENS_INFO_AVAILABLE_FILTER_DENSITIES MetadataTag = C.ACAMERA_LENS_INFO_AVAILABLE_FILTER_DENSITIES // float[n] + + /** + *

List of focal lengths for ACAMERA_LENS_FOCAL_LENGTH that are supported by this camera + * device.

+ * + * @see ACAMERA_LENS_FOCAL_LENGTH + * + *

Type: float[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If optical zoom is not supported, this list will only contain + * a single value corresponding to the fixed focal length of the + * device. Otherwise, this list will include every focal length supported + * by the camera device, in ascending order.

+ */ + LENS_INFO_AVAILABLE_FOCAL_LENGTHS MetadataTag = C.ACAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS // float[n] + + /** + *

List of optical image stabilization (OIS) modes for + * ACAMERA_LENS_OPTICAL_STABILIZATION_MODE that are supported by this camera device.

+ * + * @see ACAMERA_LENS_OPTICAL_STABILIZATION_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If OIS is not supported by a given camera device, this list will + * contain only OFF.

+ */ + LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION MetadataTag = C.ACAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION // byte[n] + + /** + *

Hyperfocal distance for this lens.

+ * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If the lens is not fixed focus, the camera device will report this + * field when ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION is APPROXIMATE or CALIBRATED.

+ * + * @see ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION + */ + LENS_INFO_HYPERFOCAL_DISTANCE MetadataTag = C.ACAMERA_LENS_INFO_HYPERFOCAL_DISTANCE // float + + /** + *

Shortest distance from frontmost surface + * of the lens that can be brought into sharp focus.

+ * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If the lens is fixed-focus, this will be + * 0.

+ */ + LENS_INFO_MINIMUM_FOCUS_DISTANCE MetadataTag = C.ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE // float + + /** + *

Dimensions of lens shading map.

+ * + *

Type: int32[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The map should be on the order of 30-40 rows and columns, and + * must be smaller than 64x64.

+ */ + LENS_INFO_SHADING_MAP_SIZE MetadataTag = C.ACAMERA_LENS_INFO_SHADING_MAP_SIZE // int32[2] + + /** + *

The lens focus distance calibration quality.

+ * + *

Type: byte (acamera_metadata_enum_android_lens_info_focus_distance_calibration_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The lens focus distance calibration quality determines the reliability of + * focus related metadata entries, i.e. ACAMERA_LENS_FOCUS_DISTANCE, + * ACAMERA_LENS_FOCUS_RANGE, ACAMERA_LENS_INFO_HYPERFOCAL_DISTANCE, and + * ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE.

+ *

APPROXIMATE and CALIBRATED devices report the focus metadata in + * units of diopters (1/meter), so 0.0f represents focusing at infinity, + * and increasing positive numbers represent focusing closer and closer + * to the camera device. The focus distance control also uses diopters + * on these devices.

+ *

UNCALIBRATED devices do not use units that are directly comparable + * to any real physical measurement, but 0.0f still represents farthest + * focus, and ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE represents the + * nearest focus the device can achieve.

+ * + * @see ACAMERA_LENS_FOCUS_DISTANCE + * @see ACAMERA_LENS_FOCUS_RANGE + * @see ACAMERA_LENS_INFO_HYPERFOCAL_DISTANCE + * @see ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE + */ + LENS_INFO_FOCUS_DISTANCE_CALIBRATION MetadataTag = C.ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION // byte (acamera_metadata_enum_android_lens_info_focus_distance_calibration_t) + + LENS_INFO_END MetadataTag = C.ACAMERA_LENS_INFO_END + + /** + *

Mode of operation for the noise reduction algorithm.

+ * + *

Type: byte (acamera_metadata_enum_android_noise_reduction_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

The noise reduction algorithm attempts to improve image quality by removing + * excessive noise added by the capture process, especially in dark conditions.

+ *

OFF means no noise reduction will be applied by the camera device, for both raw and + * YUV domain.

+ *

MINIMAL means that only sensor raw domain basic noise reduction is enabled ,to remove + * demosaicing or other processing artifacts. For YUV_REPROCESSING, MINIMAL is same as OFF. + * This mode is optional, may not be support by all devices. The application should check + * ACAMERA_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES before using it.

+ *

FAST/HIGH_QUALITY both mean camera device determined noise filtering + * will be applied. HIGH_QUALITY mode indicates that the camera device + * will use the highest-quality noise filtering algorithms, + * even if it slows down capture rate. FAST means the camera device will not + * slow down capture rate when applying noise filtering. FAST may be the same as MINIMAL if + * MINIMAL is listed, or the same as OFF if any noise filtering will slow down capture rate. + * Every output stream will have a similar amount of enhancement applied.

+ *

ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular + * buffer of high-resolution images during preview and reprocess image(s) from that buffer + * into a final capture when triggered by the user. In this mode, the camera device applies + * noise reduction to low-resolution streams (below maximum recording resolution) to maximize + * preview quality, but does not apply noise reduction to high-resolution streams, since + * those will be reprocessed later if necessary.

+ *

For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera device + * will apply FAST/HIGH_QUALITY YUV domain noise reduction, respectively. The camera device + * may adjust the noise reduction parameters for best image quality based on the + * android.reprocess.effectiveExposureFactor if it is set.

+ * + * @see ACAMERA_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES + */ + NOISE_REDUCTION_MODE MetadataTag = C.ACAMERA_NOISE_REDUCTION_MODE // byte (acamera_metadata_enum_android_noise_reduction_mode_t) + + /** + *

List of noise reduction modes for ACAMERA_NOISE_REDUCTION_MODE that are supported + * by this camera device.

+ * + * @see ACAMERA_NOISE_REDUCTION_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Full-capability camera devices will always support OFF and FAST.

+ *

Camera devices that support YUV_REPROCESSING or PRIVATE_REPROCESSING will support + * ZERO_SHUTTER_LAG.

+ *

Legacy-capability camera devices will only support FAST mode.

+ */ + NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES MetadataTag = C.ACAMERA_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES // byte[n] + + NOISE_REDUCTION_END MetadataTag = C.ACAMERA_NOISE_REDUCTION_END + + /** + *

The maximum numbers of different types of output streams + * that can be configured and used simultaneously by a camera device.

+ * + *

Type: int32[3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This is a 3 element tuple that contains the max number of output simultaneous + * streams for raw sensor, processed (but not stalling), and processed (and stalling) + * formats respectively. For example, assuming that JPEG is typically a processed and + * stalling stream, if max raw sensor format output stream number is 1, max YUV streams + * number is 3, and max JPEG stream number is 2, then this tuple should be (1, 3, 2).

+ *

This lists the upper bound of the number of output streams supported by + * the camera device. Using more streams simultaneously may require more hardware and + * CPU resources that will consume more power. The image format for an output stream can + * be any supported format provided by ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS. + * The formats defined in ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS can be catergorized + * into the 3 stream types as below:

+ *
    + *
  • Processed (but stalling): any non-RAW format with a stallDurations > 0. + * Typically {@link AIMAGE_FORMAT_JPEG} format.
  • + *
  • Raw formats: {@link AIMAGE_FORMAT_RAW16}, {@link AIMAGE_FORMAT_RAW10}, or + * {@link AIMAGE_FORMAT_RAW12}.
  • + *
  • Processed (but not-stalling): any non-RAW format without a stall duration. + * Typically {@link AIMAGE_FORMAT_YUV_420_888}.
  • + *
+ * + * @see ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS + */ + REQUEST_MAX_NUM_OUTPUT_STREAMS MetadataTag = C.ACAMERA_REQUEST_MAX_NUM_OUTPUT_STREAMS // int32[3] + + /** + *

Specifies the number of pipeline stages the frame went + * through from when it was exposed to when the final completed result + * was available to the framework.

+ * + *

Type: byte

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Depending on what settings are used in the request, and + * what streams are configured, the data may undergo less processing, + * and some pipeline stages skipped.

+ *

See ACAMERA_REQUEST_PIPELINE_MAX_DEPTH for more details.

+ * + * @see ACAMERA_REQUEST_PIPELINE_MAX_DEPTH + */ + REQUEST_PIPELINE_DEPTH MetadataTag = C.ACAMERA_REQUEST_PIPELINE_DEPTH // byte + + /** + *

Specifies the number of maximum pipeline stages a frame + * has to go through from when it's exposed to when it's available + * to the framework.

+ * + *

Type: byte

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

A typical minimum value for this is 2 (one stage to expose, + * one stage to readout) from the sensor. The ISP then usually adds + * its own stages to do custom HW processing. Further stages may be + * added by SW processing.

+ *

Depending on what settings are used (e.g. YUV, JPEG) and what + * processing is enabled (e.g. face detection), the actual pipeline + * depth (specified by ACAMERA_REQUEST_PIPELINE_DEPTH) may be less than + * the max pipeline depth.

+ *

A pipeline depth of X stages is equivalent to a pipeline latency of + * X frame intervals.

+ *

This value will normally be 8 or less, however, for high speed capture session, + * the max pipeline depth will be up to 8 x size of high speed capture request list.

+ * + * @see ACAMERA_REQUEST_PIPELINE_DEPTH + */ + REQUEST_PIPELINE_MAX_DEPTH MetadataTag = C.ACAMERA_REQUEST_PIPELINE_MAX_DEPTH // byte + + /** + *

Defines how many sub-components + * a result will be composed of.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

In order to combat the pipeline latency, partial results + * may be delivered to the application layer from the camera device as + * soon as they are available.

+ *

Optional; defaults to 1. A value of 1 means that partial + * results are not supported, and only the final TotalCaptureResult will + * be produced by the camera device.

+ *

A typical use case for this might be: after requesting an + * auto-focus (AF) lock the new AF state might be available 50% + * of the way through the pipeline. The camera device could + * then immediately dispatch this state via a partial result to + * the application, and the rest of the metadata via later + * partial results.

+ */ + REQUEST_PARTIAL_RESULT_COUNT MetadataTag = C.ACAMERA_REQUEST_PARTIAL_RESULT_COUNT // int32 + + /** + *

List of capabilities that this camera device + * advertises as fully supporting.

+ * + *

Type: byte[n] (acamera_metadata_enum_android_request_available_capabilities_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

A capability is a contract that the camera device makes in order + * to be able to satisfy one or more use cases.

+ *

Listing a capability guarantees that the whole set of features + * required to support a common use will all be available.

+ *

Using a subset of the functionality provided by an unsupported + * capability may be possible on a specific camera device implementation; + * to do this query each of ACAMERA_REQUEST_AVAILABLE_REQUEST_KEYS, + * ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS, + * ACAMERA_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS.

+ *

The following capabilities are guaranteed to be available on + * ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL == FULL devices:

+ *
    + *
  • MANUAL_SENSOR
  • + *
  • MANUAL_POST_PROCESSING
  • + *
+ *

Other capabilities may be available on either FULL or LIMITED + * devices, but the application should query this key to be sure.

+ * + * @see ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL + * @see ACAMERA_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS + * @see ACAMERA_REQUEST_AVAILABLE_REQUEST_KEYS + * @see ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS + */ + REQUEST_AVAILABLE_CAPABILITIES MetadataTag = C.ACAMERA_REQUEST_AVAILABLE_CAPABILITIES // byte[n] (acamera_metadata_enum_android_request_available_capabilities_t) + + /** + *

A list of all keys that the camera device has available + * to use with {@link ACaptureRequest}.

+ * + *

Type: int32[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Attempting to set a key into a CaptureRequest that is not + * listed here will result in an invalid request and will be rejected + * by the camera device.

+ *

This field can be used to query the feature set of a camera device + * at a more granular level than capabilities. This is especially + * important for optional keys that are not listed under any capability + * in ACAMERA_REQUEST_AVAILABLE_CAPABILITIES.

+ * + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + */ + REQUEST_AVAILABLE_REQUEST_KEYS MetadataTag = C.ACAMERA_REQUEST_AVAILABLE_REQUEST_KEYS // int32[n] + + /** + *

A list of all keys that the camera device has available + * to query with {@link ACameraMetadata} from + * {@link ACameraCaptureSession_captureCallback_result}.

+ * + *

Type: int32[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Attempting to get a key from a CaptureResult that is not + * listed here will always return a null value. Getting a key from + * a CaptureResult that is listed here will generally never return a null + * value.

+ *

The following keys may return null unless they are enabled:

+ *
    + *
  • ACAMERA_STATISTICS_LENS_SHADING_MAP (non-null iff ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE == ON)
  • + *
+ *

(Those sometimes-null keys will nevertheless be listed here + * if they are available.)

+ *

This field can be used to query the feature set of a camera device + * at a more granular level than capabilities. This is especially + * important for optional keys that are not listed under any capability + * in ACAMERA_REQUEST_AVAILABLE_CAPABILITIES.

+ * + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + * @see ACAMERA_STATISTICS_LENS_SHADING_MAP + * @see ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE + */ + REQUEST_AVAILABLE_RESULT_KEYS MetadataTag = C.ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS // int32[n] + + /** + *

A list of all keys that the camera device has available + * to query with {@link ACameraMetadata} from + * {@link ACameraManager_getCameraCharacteristics}.

+ * + *

Type: int32[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This entry follows the same rules as + * ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS (except that it applies for + * CameraCharacteristics instead of CaptureResult). See above for more + * details.

+ * + * @see ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS + */ + REQUEST_AVAILABLE_CHARACTERISTICS_KEYS MetadataTag = C.ACAMERA_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS // int32[n] + + REQUEST_END MetadataTag = C.ACAMERA_REQUEST_END + + /** + *

The desired region of the sensor to read out for this capture.

+ * + *

Type: int32[4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

This control can be used to implement digital zoom.

+ *

The data representation is int[4], which maps to (left, top, width, height).

+ *

The crop region coordinate system is based off + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, with (0, 0) being the + * top-left corner of the sensor active array.

+ *

Output streams use this rectangle to produce their output, + * cropping to a smaller region if necessary to maintain the + * stream's aspect ratio, then scaling the sensor input to + * match the output's configured resolution.

+ *

The crop region is applied after the RAW to other color + * space (e.g. YUV) conversion. Since raw streams + * (e.g. RAW16) don't have the conversion stage, they are not + * croppable. The crop region will be ignored by raw streams.

+ *

For non-raw streams, any additional per-stream cropping will + * be done to maximize the final pixel area of the stream.

+ *

For example, if the crop region is set to a 4:3 aspect + * ratio, then 4:3 streams will use the exact crop + * region. 16:9 streams will further crop vertically + * (letterbox).

+ *

Conversely, if the crop region is set to a 16:9, then 4:3 + * outputs will crop horizontally (pillarbox), and 16:9 + * streams will match exactly. These additional crops will + * be centered within the crop region.

+ *

The width and height of the crop region cannot + * be set to be smaller than + * floor( activeArraySize.width / ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM ) and + * floor( activeArraySize.height / ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM ), respectively.

+ *

The camera device may adjust the crop region to account + * for rounding and other hardware requirements; the final + * crop region used will be included in the output capture + * result.

+ * + * @see ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + */ + SCALER_CROP_REGION MetadataTag = C.ACAMERA_SCALER_CROP_REGION // int32[4] + + /** + *

The maximum ratio between both active area width + * and crop region width, and active area height and + * crop region height, for ACAMERA_SCALER_CROP_REGION.

+ * + * @see ACAMERA_SCALER_CROP_REGION + * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This represents the maximum amount of zooming possible by + * the camera device, or equivalently, the minimum cropping + * window size.

+ *

Crop regions that have a width or height that is smaller + * than this ratio allows will be rounded up to the minimum + * allowed size by the camera device.

+ */ + SCALER_AVAILABLE_MAX_DIGITAL_ZOOM MetadataTag = C.ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM // float + + /** + *

The available stream configurations that this + * camera device supports + * (i.e. format, width, height, output/input stream).

+ * + *

Type: int32[n*4] (acamera_metadata_enum_android_scaler_available_stream_configurations_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The configurations are listed as (format, width, height, input?) + * tuples.

+ *

For a given use case, the actual maximum supported resolution + * may be lower than what is listed here, depending on the destination + * Surface for the image data. For example, for recording video, + * the video encoder chosen may have a maximum size limit (e.g. 1080p) + * smaller than what the camera (e.g. maximum resolution is 3264x2448) + * can provide.

+ *

Please reference the documentation for the image data destination to + * check if it limits the maximum size for image data.

+ *

Not all output formats may be supported in a configuration with + * an input stream of a particular format. For more details, see + * android.scaler.availableInputOutputFormatsMap.

+ *

The following table describes the minimum required output stream + * configurations based on the hardware level + * (ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL):

+ *

Format | Size | Hardware Level | Notes + * :-------------:|:--------------------------------------------:|:--------------:|:--------------: + * JPEG | ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE | Any | + * JPEG | 1920x1080 (1080p) | Any | if 1080p <= activeArraySize + * JPEG | 1280x720 (720) | Any | if 720p <= activeArraySize + * JPEG | 640x480 (480p) | Any | if 480p <= activeArraySize + * JPEG | 320x240 (240p) | Any | if 240p <= activeArraySize + * YUV_420_888 | all output sizes available for JPEG | FULL | + * YUV_420_888 | all output sizes available for JPEG, up to the maximum video size | LIMITED | + * IMPLEMENTATION_DEFINED | same as YUV_420_888 | Any |

+ *

Refer to ACAMERA_REQUEST_AVAILABLE_CAPABILITIES for additional + * mandatory stream configurations on a per-capability basis.

+ * + * @see ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + */ + SCALER_AVAILABLE_STREAM_CONFIGURATIONS MetadataTag = C.ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS // int32[n*4] (acamera_metadata_enum_android_scaler_available_stream_configurations_t) + + /** + *

This lists the minimum frame duration for each + * format/size combination.

+ * + *

Type: int64[4*n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This should correspond to the frame duration when only that + * stream is active, with all processing (typically in android.*.mode) + * set to either OFF or FAST.

+ *

When multiple streams are used in a request, the minimum frame + * duration will be max(individual stream min durations).

+ *

The minimum frame duration of a stream (of a particular format, size) + * is the same regardless of whether the stream is input or output.

+ *

See ACAMERA_SENSOR_FRAME_DURATION and + * ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS for more details about + * calculating the max frame rate.

+ * + * @see ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS + * @see ACAMERA_SENSOR_FRAME_DURATION + */ + SCALER_AVAILABLE_MIN_FRAME_DURATIONS MetadataTag = C.ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS // int64[4*n] + + /** + *

This lists the maximum stall duration for each + * output format/size combination.

+ * + *

Type: int64[4*n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

A stall duration is how much extra time would get added + * to the normal minimum frame duration for a repeating request + * that has streams with non-zero stall.

+ *

For example, consider JPEG captures which have the following + * characteristics:

+ *
    + *
  • JPEG streams act like processed YUV streams in requests for which + * they are not included; in requests in which they are directly + * referenced, they act as JPEG streams. This is because supporting a + * JPEG stream requires the underlying YUV data to always be ready for + * use by a JPEG encoder, but the encoder will only be used (and impact + * frame duration) on requests that actually reference a JPEG stream.
  • + *
  • The JPEG processor can run concurrently to the rest of the camera + * pipeline, but cannot process more than 1 capture at a time.
  • + *
+ *

In other words, using a repeating YUV request would result + * in a steady frame rate (let's say it's 30 FPS). If a single + * JPEG request is submitted periodically, the frame rate will stay + * at 30 FPS (as long as we wait for the previous JPEG to return each + * time). If we try to submit a repeating YUV + JPEG request, then + * the frame rate will drop from 30 FPS.

+ *

In general, submitting a new request with a non-0 stall time + * stream will not cause a frame rate drop unless there are still + * outstanding buffers for that stream from previous requests.

+ *

Submitting a repeating request with streams (call this S) + * is the same as setting the minimum frame duration from + * the normal minimum frame duration corresponding to S, added with + * the maximum stall duration for S.

+ *

If interleaving requests with and without a stall duration, + * a request will stall by the maximum of the remaining times + * for each can-stall stream with outstanding buffers.

+ *

This means that a stalling request will not have an exposure start + * until the stall has completed.

+ *

This should correspond to the stall duration when only that stream is + * active, with all processing (typically in android.*.mode) set to FAST + * or OFF. Setting any of the processing modes to HIGH_QUALITY + * effectively results in an indeterminate stall duration for all + * streams in a request (the regular stall calculation rules are + * ignored).

+ *

The following formats may always have a stall duration:

+ *
    + *
  • {@link AIMAGE_FORMAT_JPEG}
  • + *
  • {@link AIMAGE_FORMAT_RAW16}
  • + *
+ *

The following formats will never have a stall duration:

+ *
    + *
  • {@link AIMAGE_FORMAT_YUV_420_888}
  • + *
  • {@link AIMAGE_FORMAT_RAW10}
  • + *
+ *

All other formats may or may not have an allowed stall duration on + * a per-capability basis; refer to ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + * for more details.

+ *

See ACAMERA_SENSOR_FRAME_DURATION for more information about + * calculating the max frame rate (absent stalls).

+ * + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + * @see ACAMERA_SENSOR_FRAME_DURATION + */ + SCALER_AVAILABLE_STALL_DURATIONS MetadataTag = C.ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS // int64[4*n] + + /** + *

The crop type that this camera device supports.

+ * + *

Type: byte (acamera_metadata_enum_android_scaler_cropping_type_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

When passing a non-centered crop region (ACAMERA_SCALER_CROP_REGION) to a camera + * device that only supports CENTER_ONLY cropping, the camera device will move the + * crop region to the center of the sensor active array (ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE) + * and keep the crop region width and height unchanged. The camera device will return the + * final used crop region in metadata result ACAMERA_SCALER_CROP_REGION.

+ *

Camera devices that support FREEFORM cropping will support any crop region that + * is inside of the active array. The camera device will apply the same crop region and + * return the final used crop region in capture result metadata ACAMERA_SCALER_CROP_REGION.

+ *

LEGACY capability devices will only support CENTER_ONLY cropping.

+ * + * @see ACAMERA_SCALER_CROP_REGION + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + */ + SCALER_CROPPING_TYPE MetadataTag = C.ACAMERA_SCALER_CROPPING_TYPE // byte (acamera_metadata_enum_android_scaler_cropping_type_t) + + SCALER_END MetadataTag = C.ACAMERA_SCALER_END + + /** + *

Duration each pixel is exposed to + * light.

+ * + *

Type: int64

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

If the sensor can't expose this exact duration, it will shorten the + * duration exposed to the nearest possible value (rather than expose longer). + * The final exposure time used will be available in the output capture result.

+ *

This control is only effective if ACAMERA_CONTROL_AE_MODE or ACAMERA_CONTROL_MODE is set to + * OFF; otherwise the auto-exposure algorithm will override this value.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_MODE + */ + SENSOR_EXPOSURE_TIME MetadataTag = C.ACAMERA_SENSOR_EXPOSURE_TIME // int64 + + /** + *

Duration from start of frame exposure to + * start of next frame exposure.

+ * + *

Type: int64

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

The maximum frame rate that can be supported by a camera subsystem is + * a function of many factors:

+ *
    + *
  • Requested resolutions of output image streams
  • + *
  • Availability of binning / skipping modes on the imager
  • + *
  • The bandwidth of the imager interface
  • + *
  • The bandwidth of the various ISP processing blocks
  • + *
+ *

Since these factors can vary greatly between different ISPs and + * sensors, the camera abstraction tries to represent the bandwidth + * restrictions with as simple a model as possible.

+ *

The model presented has the following characteristics:

+ *
    + *
  • The image sensor is always configured to output the smallest + * resolution possible given the application's requested output stream + * sizes. The smallest resolution is defined as being at least as large + * as the largest requested output stream size; the camera pipeline must + * never digitally upsample sensor data when the crop region covers the + * whole sensor. In general, this means that if only small output stream + * resolutions are configured, the sensor can provide a higher frame + * rate.
  • + *
  • Since any request may use any or all the currently configured + * output streams, the sensor and ISP must be configured to support + * scaling a single capture to all the streams at the same time. This + * means the camera pipeline must be ready to produce the largest + * requested output size without any delay. Therefore, the overall + * frame rate of a given configured stream set is governed only by the + * largest requested stream resolution.
  • + *
  • Using more than one output stream in a request does not affect the + * frame duration.
  • + *
  • Certain format-streams may need to do additional background processing + * before data is consumed/produced by that stream. These processors + * can run concurrently to the rest of the camera pipeline, but + * cannot process more than 1 capture at a time.
  • + *
+ *

The necessary information for the application, given the model above, + * is provided via + * {@link ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS}. + * These are used to determine the maximum frame rate / minimum frame + * duration that is possible for a given stream configuration.

+ *

Specifically, the application can use the following rules to + * determine the minimum frame duration it can request from the camera + * device:

+ *
    + *
  1. Let the set of currently configured input/output streams + * be called S.
  2. + *
  3. Find the minimum frame durations for each stream in S, by looking + * it up in {@link ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS} + * (with its respective size/format). Let this set of frame durations be + * called F.
  4. + *
  5. For any given request R, the minimum frame duration allowed + * for R is the maximum out of all values in F. Let the streams + * used in R be called S_r.
  6. + *
+ *

If none of the streams in S_r have a stall time (listed in {@link + * ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS} + * using its respective size/format), then the frame duration in F + * determines the steady state frame rate that the application will get + * if it uses R as a repeating request. Let this special kind of + * request be called Rsimple.

+ *

A repeating request Rsimple can be occasionally interleaved + * by a single capture of a new request Rstall (which has at least + * one in-use stream with a non-0 stall time) and if Rstall has the + * same minimum frame duration this will not cause a frame rate loss + * if all buffers from the previous Rstall have already been + * delivered.

+ *

For more details about stalling, see + * {@link ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS}.

+ *

This control is only effective if ACAMERA_CONTROL_AE_MODE or ACAMERA_CONTROL_MODE is set to + * OFF; otherwise the auto-exposure algorithm will override this value.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_MODE + */ + SENSOR_FRAME_DURATION MetadataTag = C.ACAMERA_SENSOR_FRAME_DURATION // int64 + + /** + *

The amount of gain applied to sensor data + * before processing.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

The sensitivity is the standard ISO sensitivity value, + * as defined in ISO 12232:2006.

+ *

The sensitivity must be within ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE, and + * if if it less than ACAMERA_SENSOR_MAX_ANALOG_SENSITIVITY, the camera device + * is guaranteed to use only analog amplification for applying the gain.

+ *

If the camera device cannot apply the exact sensitivity + * requested, it will reduce the gain to the nearest supported + * value. The final sensitivity used will be available in the + * output capture result.

+ *

This control is only effective if ACAMERA_CONTROL_AE_MODE or ACAMERA_CONTROL_MODE is set to + * OFF; otherwise the auto-exposure algorithm will override this value.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_MODE + * @see ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE + * @see ACAMERA_SENSOR_MAX_ANALOG_SENSITIVITY + */ + SENSOR_SENSITIVITY MetadataTag = C.ACAMERA_SENSOR_SENSITIVITY // int32 + + /** + *

The standard reference illuminant used as the scene light source when + * calculating the ACAMERA_SENSOR_COLOR_TRANSFORM1, + * ACAMERA_SENSOR_CALIBRATION_TRANSFORM1, and + * ACAMERA_SENSOR_FORWARD_MATRIX1 matrices.

+ * + * @see ACAMERA_SENSOR_CALIBRATION_TRANSFORM1 + * @see ACAMERA_SENSOR_COLOR_TRANSFORM1 + * @see ACAMERA_SENSOR_FORWARD_MATRIX1 + * + *

Type: byte (acamera_metadata_enum_android_sensor_reference_illuminant1_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The values in this key correspond to the values defined for the + * EXIF LightSource tag. These illuminants are standard light sources + * that are often used calibrating camera devices.

+ *

If this key is present, then ACAMERA_SENSOR_COLOR_TRANSFORM1, + * ACAMERA_SENSOR_CALIBRATION_TRANSFORM1, and + * ACAMERA_SENSOR_FORWARD_MATRIX1 will also be present.

+ *

Some devices may choose to provide a second set of calibration + * information for improved quality, including + * ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 and its corresponding matrices.

+ * + * @see ACAMERA_SENSOR_CALIBRATION_TRANSFORM1 + * @see ACAMERA_SENSOR_COLOR_TRANSFORM1 + * @see ACAMERA_SENSOR_FORWARD_MATRIX1 + * @see ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 + */ + SENSOR_REFERENCE_ILLUMINANT1 MetadataTag = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 // byte (acamera_metadata_enum_android_sensor_reference_illuminant1_t) + + /** + *

The standard reference illuminant used as the scene light source when + * calculating the ACAMERA_SENSOR_COLOR_TRANSFORM2, + * ACAMERA_SENSOR_CALIBRATION_TRANSFORM2, and + * ACAMERA_SENSOR_FORWARD_MATRIX2 matrices.

+ * + * @see ACAMERA_SENSOR_CALIBRATION_TRANSFORM2 + * @see ACAMERA_SENSOR_COLOR_TRANSFORM2 + * @see ACAMERA_SENSOR_FORWARD_MATRIX2 + * + *

Type: byte

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

See ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 for more details.

+ *

If this key is present, then ACAMERA_SENSOR_COLOR_TRANSFORM2, + * ACAMERA_SENSOR_CALIBRATION_TRANSFORM2, and + * ACAMERA_SENSOR_FORWARD_MATRIX2 will also be present.

+ * + * @see ACAMERA_SENSOR_CALIBRATION_TRANSFORM2 + * @see ACAMERA_SENSOR_COLOR_TRANSFORM2 + * @see ACAMERA_SENSOR_FORWARD_MATRIX2 + * @see ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 + */ + SENSOR_REFERENCE_ILLUMINANT2 MetadataTag = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 // byte + + /** + *

A per-device calibration transform matrix that maps from the + * reference sensor colorspace to the actual device sensor colorspace.

+ * + *

Type: rational[3*3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This matrix is used to correct for per-device variations in the + * sensor colorspace, and is used for processing raw buffer data.

+ *

The matrix is expressed as a 3x3 matrix in row-major-order, and + * contains a per-device calibration transform that maps colors + * from reference sensor color space (i.e. the "golden module" + * colorspace) into this camera device's native sensor color + * space under the first reference illuminant + * (ACAMERA_SENSOR_REFERENCE_ILLUMINANT1).

+ * + * @see ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 + */ + SENSOR_CALIBRATION_TRANSFORM1 MetadataTag = C.ACAMERA_SENSOR_CALIBRATION_TRANSFORM1 // rational[3*3] + + /** + *

A per-device calibration transform matrix that maps from the + * reference sensor colorspace to the actual device sensor colorspace + * (this is the colorspace of the raw buffer data).

+ * + *

Type: rational[3*3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This matrix is used to correct for per-device variations in the + * sensor colorspace, and is used for processing raw buffer data.

+ *

The matrix is expressed as a 3x3 matrix in row-major-order, and + * contains a per-device calibration transform that maps colors + * from reference sensor color space (i.e. the "golden module" + * colorspace) into this camera device's native sensor color + * space under the second reference illuminant + * (ACAMERA_SENSOR_REFERENCE_ILLUMINANT2).

+ *

This matrix will only be present if the second reference + * illuminant is present.

+ * + * @see ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 + */ + SENSOR_CALIBRATION_TRANSFORM2 MetadataTag = C.ACAMERA_SENSOR_CALIBRATION_TRANSFORM2 // rational[3*3] + + /** + *

A matrix that transforms color values from CIE XYZ color space to + * reference sensor color space.

+ * + *

Type: rational[3*3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This matrix is used to convert from the standard CIE XYZ color + * space to the reference sensor colorspace, and is used when processing + * raw buffer data.

+ *

The matrix is expressed as a 3x3 matrix in row-major-order, and + * contains a color transform matrix that maps colors from the CIE + * XYZ color space to the reference sensor color space (i.e. the + * "golden module" colorspace) under the first reference illuminant + * (ACAMERA_SENSOR_REFERENCE_ILLUMINANT1).

+ *

The white points chosen in both the reference sensor color space + * and the CIE XYZ colorspace when calculating this transform will + * match the standard white point for the first reference illuminant + * (i.e. no chromatic adaptation will be applied by this transform).

+ * + * @see ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 + */ + SENSOR_COLOR_TRANSFORM1 MetadataTag = C.ACAMERA_SENSOR_COLOR_TRANSFORM1 // rational[3*3] + + /** + *

A matrix that transforms color values from CIE XYZ color space to + * reference sensor color space.

+ * + *

Type: rational[3*3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This matrix is used to convert from the standard CIE XYZ color + * space to the reference sensor colorspace, and is used when processing + * raw buffer data.

+ *

The matrix is expressed as a 3x3 matrix in row-major-order, and + * contains a color transform matrix that maps colors from the CIE + * XYZ color space to the reference sensor color space (i.e. the + * "golden module" colorspace) under the second reference illuminant + * (ACAMERA_SENSOR_REFERENCE_ILLUMINANT2).

+ *

The white points chosen in both the reference sensor color space + * and the CIE XYZ colorspace when calculating this transform will + * match the standard white point for the second reference illuminant + * (i.e. no chromatic adaptation will be applied by this transform).

+ *

This matrix will only be present if the second reference + * illuminant is present.

+ * + * @see ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 + */ + SENSOR_COLOR_TRANSFORM2 MetadataTag = C.ACAMERA_SENSOR_COLOR_TRANSFORM2 // rational[3*3] + + /** + *

A matrix that transforms white balanced camera colors from the reference + * sensor colorspace to the CIE XYZ colorspace with a D50 whitepoint.

+ * + *

Type: rational[3*3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This matrix is used to convert to the standard CIE XYZ colorspace, and + * is used when processing raw buffer data.

+ *

This matrix is expressed as a 3x3 matrix in row-major-order, and contains + * a color transform matrix that maps white balanced colors from the + * reference sensor color space to the CIE XYZ color space with a D50 white + * point.

+ *

Under the first reference illuminant (ACAMERA_SENSOR_REFERENCE_ILLUMINANT1) + * this matrix is chosen so that the standard white point for this reference + * illuminant in the reference sensor colorspace is mapped to D50 in the + * CIE XYZ colorspace.

+ * + * @see ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 + */ + SENSOR_FORWARD_MATRIX1 MetadataTag = C.ACAMERA_SENSOR_FORWARD_MATRIX1 // rational[3*3] + + /** + *

A matrix that transforms white balanced camera colors from the reference + * sensor colorspace to the CIE XYZ colorspace with a D50 whitepoint.

+ * + *

Type: rational[3*3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This matrix is used to convert to the standard CIE XYZ colorspace, and + * is used when processing raw buffer data.

+ *

This matrix is expressed as a 3x3 matrix in row-major-order, and contains + * a color transform matrix that maps white balanced colors from the + * reference sensor color space to the CIE XYZ color space with a D50 white + * point.

+ *

Under the second reference illuminant (ACAMERA_SENSOR_REFERENCE_ILLUMINANT2) + * this matrix is chosen so that the standard white point for this reference + * illuminant in the reference sensor colorspace is mapped to D50 in the + * CIE XYZ colorspace.

+ *

This matrix will only be present if the second reference + * illuminant is present.

+ * + * @see ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 + */ + SENSOR_FORWARD_MATRIX2 MetadataTag = C.ACAMERA_SENSOR_FORWARD_MATRIX2 // rational[3*3] + + /** + *

A fixed black level offset for each of the color filter arrangement + * (CFA) mosaic channels.

+ * + *

Type: int32[4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This key specifies the zero light value for each of the CFA mosaic + * channels in the camera sensor. The maximal value output by the + * sensor is represented by the value in ACAMERA_SENSOR_INFO_WHITE_LEVEL.

+ *

The values are given in the same order as channels listed for the CFA + * layout key (see ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT), i.e. the + * nth value given corresponds to the black level offset for the nth + * color channel listed in the CFA.

+ *

The black level values of captured images may vary for different + * capture settings (e.g., ACAMERA_SENSOR_SENSITIVITY). This key + * represents a coarse approximation for such case. It is recommended to + * use ACAMERA_SENSOR_DYNAMIC_BLACK_LEVEL or use pixels from + * ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS directly for captures when + * supported by the camera device, which provides more accurate black + * level values. For raw capture in particular, it is recommended to use + * pixels from ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS to calculate black + * level values for each frame.

+ * + * @see ACAMERA_SENSOR_DYNAMIC_BLACK_LEVEL + * @see ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT + * @see ACAMERA_SENSOR_INFO_WHITE_LEVEL + * @see ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS + * @see ACAMERA_SENSOR_SENSITIVITY + */ + SENSOR_BLACK_LEVEL_PATTERN MetadataTag = C.ACAMERA_SENSOR_BLACK_LEVEL_PATTERN // int32[4] + + /** + *

Maximum sensitivity that is implemented + * purely through analog gain.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

For ACAMERA_SENSOR_SENSITIVITY values less than or + * equal to this, all applied gain must be analog. For + * values above this, the gain applied can be a mix of analog and + * digital.

+ * + * @see ACAMERA_SENSOR_SENSITIVITY + */ + SENSOR_MAX_ANALOG_SENSITIVITY MetadataTag = C.ACAMERA_SENSOR_MAX_ANALOG_SENSITIVITY // int32 + + /** + *

Clockwise angle through which the output image needs to be rotated to be + * upright on the device screen in its native orientation.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Also defines the direction of rolling shutter readout, which is from top to bottom in + * the sensor's coordinate system.

+ */ + SENSOR_ORIENTATION MetadataTag = C.ACAMERA_SENSOR_ORIENTATION // int32 + + /** + *

Time at start of exposure of first + * row of the image sensor active array, in nanoseconds.

+ * + *

Type: int64

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

The timestamps are also included in all image + * buffers produced for the same capture, and will be identical + * on all the outputs.

+ *

When ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE == UNKNOWN, + * the timestamps measure time since an unspecified starting point, + * and are monotonically increasing. They can be compared with the + * timestamps for other captures from the same camera device, but are + * not guaranteed to be comparable to any other time source.

+ *

When ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE == REALTIME, the + * timestamps measure time in the same timebase as + * elapsedRealtimeNanos + * (or CLOCK_BOOTTIME), and they can + * be compared to other timestamps from other subsystems that + * are using that base.

+ *

For reprocessing, the timestamp will match the start of exposure of + * the input image, i.e. {@link CaptureResult#SENSOR_TIMESTAMP the + * timestamp} in the TotalCaptureResult that was used to create the + * reprocess capture request.

+ * + * @see ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE + */ + SENSOR_TIMESTAMP MetadataTag = C.ACAMERA_SENSOR_TIMESTAMP // int64 + + /** + *

The estimated camera neutral color in the native sensor colorspace at + * the time of capture.

+ * + *

Type: rational[3]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

This value gives the neutral color point encoded as an RGB value in the + * native sensor color space. The neutral color point indicates the + * currently estimated white point of the scene illumination. It can be + * used to interpolate between the provided color transforms when + * processing raw sensor data.

+ *

The order of the values is R, G, B; where R is in the lowest index.

+ */ + SENSOR_NEUTRAL_COLOR_POINT MetadataTag = C.ACAMERA_SENSOR_NEUTRAL_COLOR_POINT // rational[3] + + /** + *

Noise model coefficients for each CFA mosaic channel.

+ * + *

Type: double[2*CFA Channels]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

This key contains two noise model coefficients for each CFA channel + * corresponding to the sensor amplification (S) and sensor readout + * noise (O). These are given as pairs of coefficients for each channel + * in the same order as channels listed for the CFA layout key + * (see ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT). This is + * represented as an array of Pair<Double, Double>, where + * the first member of the Pair at index n is the S coefficient and the + * second member is the O coefficient for the nth color channel in the CFA.

+ *

These coefficients are used in a two parameter noise model to describe + * the amount of noise present in the image for each CFA channel. The + * noise model used here is:

+ *

N(x) = sqrt(Sx + O)

+ *

Where x represents the recorded signal of a CFA channel normalized to + * the range [0, 1], and S and O are the noise model coeffiecients for + * that channel.

+ *

A more detailed description of the noise model can be found in the + * Adobe DNG specification for the NoiseProfile tag.

+ * + * @see ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT + */ + SENSOR_NOISE_PROFILE MetadataTag = C.ACAMERA_SENSOR_NOISE_PROFILE // double[2*CFA Channels] + + /** + *

The worst-case divergence between Bayer green channels.

+ * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

This value is an estimate of the worst case split between the + * Bayer green channels in the red and blue rows in the sensor color + * filter array.

+ *

The green split is calculated as follows:

+ *
    + *
  1. A 5x5 pixel (or larger) window W within the active sensor array is + * chosen. The term 'pixel' here is taken to mean a group of 4 Bayer + * mosaic channels (R, Gr, Gb, B). The location and size of the window + * chosen is implementation defined, and should be chosen to provide a + * green split estimate that is both representative of the entire image + * for this camera sensor, and can be calculated quickly.
  2. + *
  3. The arithmetic mean of the green channels from the red + * rows (mean_Gr) within W is computed.
  4. + *
  5. The arithmetic mean of the green channels from the blue + * rows (mean_Gb) within W is computed.
  6. + *
  7. The maximum ratio R of the two means is computed as follows: + * R = max((mean_Gr + 1)/(mean_Gb + 1), (mean_Gb + 1)/(mean_Gr + 1))
  8. + *
+ *

The ratio R is the green split divergence reported for this property, + * which represents how much the green channels differ in the mosaic + * pattern. This value is typically used to determine the treatment of + * the green mosaic channels when demosaicing.

+ *

The green split value can be roughly interpreted as follows:

+ *
    + *
  • R < 1.03 is a negligible split (<3% divergence).
  • + *
  • 1.20 <= R >= 1.03 will require some software + * correction to avoid demosaic errors (3-20% divergence).
  • + *
  • R > 1.20 will require strong software correction to produce + * a usuable image (>20% divergence).
  • + *
+ */ + SENSOR_GREEN_SPLIT MetadataTag = C.ACAMERA_SENSOR_GREEN_SPLIT // float + + /** + *

A pixel [R, G_even, G_odd, B] that supplies the test pattern + * when ACAMERA_SENSOR_TEST_PATTERN_MODE is SOLID_COLOR.

+ * + * @see ACAMERA_SENSOR_TEST_PATTERN_MODE + * + *

Type: int32[4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Each color channel is treated as an unsigned 32-bit integer. + * The camera device then uses the most significant X bits + * that correspond to how many bits are in its Bayer raw sensor + * output.

+ *

For example, a sensor with RAW10 Bayer output would use the + * 10 most significant bits from each color channel.

+ */ + SENSOR_TEST_PATTERN_DATA MetadataTag = C.ACAMERA_SENSOR_TEST_PATTERN_DATA // int32[4] + + /** + *

When enabled, the sensor sends a test pattern instead of + * doing a real exposure from the camera.

+ * + *

Type: int32 (acamera_metadata_enum_android_sensor_test_pattern_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When a test pattern is enabled, all manual sensor controls specified + * by ACAMERA_SENSOR_* will be ignored. All other controls should + * work as normal.

+ *

For example, if manual flash is enabled, flash firing should still + * occur (and that the test pattern remain unmodified, since the flash + * would not actually affect it).

+ *

Defaults to OFF.

+ */ + SENSOR_TEST_PATTERN_MODE MetadataTag = C.ACAMERA_SENSOR_TEST_PATTERN_MODE // int32 (acamera_metadata_enum_android_sensor_test_pattern_mode_t) + + /** + *

List of sensor test pattern modes for ACAMERA_SENSOR_TEST_PATTERN_MODE + * supported by this camera device.

+ * + * @see ACAMERA_SENSOR_TEST_PATTERN_MODE + * + *

Type: int32[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Defaults to OFF, and always includes OFF if defined.

+ */ + SENSOR_AVAILABLE_TEST_PATTERN_MODES MetadataTag = C.ACAMERA_SENSOR_AVAILABLE_TEST_PATTERN_MODES // int32[n] + + /** + *

Duration between the start of first row exposure + * and the start of last row exposure.

+ * + *

Type: int64

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

This is the exposure time skew between the first and last + * row exposure start times. The first row and the last row are + * the first and last rows inside of the + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.

+ *

For typical camera sensors that use rolling shutters, this is also equivalent + * to the frame readout time.

+ * + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + */ + SENSOR_ROLLING_SHUTTER_SKEW MetadataTag = C.ACAMERA_SENSOR_ROLLING_SHUTTER_SKEW // int64 + + /** + *

List of disjoint rectangles indicating the sensor + * optically shielded black pixel regions.

+ * + *

Type: int32[4*num_regions]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

In most camera sensors, the active array is surrounded by some + * optically shielded pixel areas. By blocking light, these pixels + * provides a reliable black reference for black level compensation + * in active array region.

+ *

The data representation is int[4], which maps to (left, top, width, height).

+ *

This key provides a list of disjoint rectangles specifying the + * regions of optically shielded (with metal shield) black pixel + * regions if the camera device is capable of reading out these black + * pixels in the output raw images. In comparison to the fixed black + * level values reported by ACAMERA_SENSOR_BLACK_LEVEL_PATTERN, this key + * may provide a more accurate way for the application to calculate + * black level of each captured raw images.

+ *

When this key is reported, the ACAMERA_SENSOR_DYNAMIC_BLACK_LEVEL and + * ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL will also be reported.

+ * + * @see ACAMERA_SENSOR_BLACK_LEVEL_PATTERN + * @see ACAMERA_SENSOR_DYNAMIC_BLACK_LEVEL + * @see ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL + */ + SENSOR_OPTICAL_BLACK_REGIONS MetadataTag = C.ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS // int32[4*num_regions] + + /** + *

A per-frame dynamic black level offset for each of the color filter + * arrangement (CFA) mosaic channels.

+ * + *

Type: float[4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Camera sensor black levels may vary dramatically for different + * capture settings (e.g. ACAMERA_SENSOR_SENSITIVITY). The fixed black + * level reported by ACAMERA_SENSOR_BLACK_LEVEL_PATTERN may be too + * inaccurate to represent the actual value on a per-frame basis. The + * camera device internal pipeline relies on reliable black level values + * to process the raw images appropriately. To get the best image + * quality, the camera device may choose to estimate the per frame black + * level values either based on optically shielded black regions + * (ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS) or its internal model.

+ *

This key reports the camera device estimated per-frame zero light + * value for each of the CFA mosaic channels in the camera sensor. The + * ACAMERA_SENSOR_BLACK_LEVEL_PATTERN may only represent a coarse + * approximation of the actual black level values. This value is the + * black level used in camera device internal image processing pipeline + * and generally more accurate than the fixed black level values. + * However, since they are estimated values by the camera device, they + * may not be as accurate as the black level values calculated from the + * optical black pixels reported by ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS.

+ *

The values are given in the same order as channels listed for the CFA + * layout key (see ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT), i.e. the + * nth value given corresponds to the black level offset for the nth + * color channel listed in the CFA.

+ *

This key will be available if ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS is + * available or the camera device advertises this key via + * {@link ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS}.

+ * + * @see ACAMERA_SENSOR_BLACK_LEVEL_PATTERN + * @see ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT + * @see ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS + * @see ACAMERA_SENSOR_SENSITIVITY + */ + SENSOR_DYNAMIC_BLACK_LEVEL MetadataTag = C.ACAMERA_SENSOR_DYNAMIC_BLACK_LEVEL // float[4] + + /** + *

Maximum raw value output by sensor for this frame.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Since the ACAMERA_SENSOR_BLACK_LEVEL_PATTERN may change for different + * capture settings (e.g., ACAMERA_SENSOR_SENSITIVITY), the white + * level will change accordingly. This key is similar to + * ACAMERA_SENSOR_INFO_WHITE_LEVEL, but specifies the camera device + * estimated white level for each frame.

+ *

This key will be available if ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS is + * available or the camera device advertises this key via + * {@link ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS}.

+ * + * @see ACAMERA_SENSOR_BLACK_LEVEL_PATTERN + * @see ACAMERA_SENSOR_INFO_WHITE_LEVEL + * @see ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS + * @see ACAMERA_SENSOR_SENSITIVITY + */ + SENSOR_DYNAMIC_WHITE_LEVEL MetadataTag = C.ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL // int32 + + SENSOR_END MetadataTag = C.ACAMERA_SENSOR_END + + /** + *

The area of the image sensor which corresponds to active pixels after any geometric + * distortion correction has been applied.

+ * + *

Type: int32[4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This is the rectangle representing the size of the active region of the sensor (i.e. + * the region that actually receives light from the scene) after any geometric correction + * has been applied, and should be treated as the maximum size in pixels of any of the + * image output formats aside from the raw formats.

+ *

This rectangle is defined relative to the full pixel array; (0,0) is the top-left of + * the full pixel array, and the size of the full pixel array is given by + * ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE.

+ *

The data representation is int[4], which maps to (left, top, width, height).

+ *

The coordinate system for most other keys that list pixel coordinates, including + * ACAMERA_SCALER_CROP_REGION, is defined relative to the active array rectangle given in + * this field, with (0, 0) being the top-left of this rectangle.

+ *

The active array may be smaller than the full pixel array, since the full array may + * include black calibration pixels or other inactive regions, and geometric correction + * resulting in scaling or cropping may have been applied.

+ * + * @see ACAMERA_SCALER_CROP_REGION + * @see ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE + */ + SENSOR_INFO_ACTIVE_ARRAY_SIZE MetadataTag = C.ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE // int32[4] + + /** + *

Range of sensitivities for ACAMERA_SENSOR_SENSITIVITY supported by this + * camera device.

+ * + * @see ACAMERA_SENSOR_SENSITIVITY + * + *

Type: int32[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The values are the standard ISO sensitivity values, + * as defined in ISO 12232:2006.

+ */ + SENSOR_INFO_SENSITIVITY_RANGE MetadataTag = C.ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE // int32[2] + + /** + *

The arrangement of color filters on sensor; + * represents the colors in the top-left 2x2 section of + * the sensor, in reading order.

+ * + *

Type: byte (acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + */ + SENSOR_INFO_COLOR_FILTER_ARRANGEMENT MetadataTag = C.ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT // byte (acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t) + + /** + *

The range of image exposure times for ACAMERA_SENSOR_EXPOSURE_TIME supported + * by this camera device.

+ * + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * + *

Type: int64[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + */ + SENSOR_INFO_EXPOSURE_TIME_RANGE MetadataTag = C.ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE // int64[2] + + /** + *

The maximum possible frame duration (minimum frame rate) for + * ACAMERA_SENSOR_FRAME_DURATION that is supported this camera device.

+ * + * @see ACAMERA_SENSOR_FRAME_DURATION + * + *

Type: int64

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Attempting to use frame durations beyond the maximum will result in the frame + * duration being clipped to the maximum. See that control for a full definition of frame + * durations.

+ *

Refer to {@link + * ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS} + * for the minimum frame duration values.

+ */ + SENSOR_INFO_MAX_FRAME_DURATION MetadataTag = C.ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION // int64 + + /** + *

The physical dimensions of the full pixel + * array.

+ * + *

Type: float[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This is the physical size of the sensor pixel + * array defined by ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE.

+ * + * @see ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE + */ + SENSOR_INFO_PHYSICAL_SIZE MetadataTag = C.ACAMERA_SENSOR_INFO_PHYSICAL_SIZE // float[2] + + /** + *

Dimensions of the full pixel array, possibly + * including black calibration pixels.

+ * + *

Type: int32[2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The pixel count of the full pixel array of the image sensor, which covers + * ACAMERA_SENSOR_INFO_PHYSICAL_SIZE area. This represents the full pixel dimensions of + * the raw buffers produced by this sensor.

+ *

If a camera device supports raw sensor formats, either this or + * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE is the maximum dimensions for the raw + * output formats listed in ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS (this depends on + * whether or not the image sensor returns buffers containing pixels that are not + * part of the active array region for blacklevel calibration or other purposes).

+ *

Some parts of the full pixel array may not receive light from the scene, + * or be otherwise inactive. The ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE key + * defines the rectangle of active pixels that will be included in processed image + * formats.

+ * + * @see ACAMERA_SENSOR_INFO_PHYSICAL_SIZE + * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE + */ + SENSOR_INFO_PIXEL_ARRAY_SIZE MetadataTag = C.ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE // int32[2] + + /** + *

Maximum raw value output by sensor.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This specifies the fully-saturated encoding level for the raw + * sample values from the sensor. This is typically caused by the + * sensor becoming highly non-linear or clipping. The minimum for + * each channel is specified by the offset in the + * ACAMERA_SENSOR_BLACK_LEVEL_PATTERN key.

+ *

The white level is typically determined either by sensor bit depth + * (8-14 bits is expected), or by the point where the sensor response + * becomes too non-linear to be useful. The default value for this is + * maximum representable value for a 16-bit raw sample (2^16 - 1).

+ *

The white level values of captured images may vary for different + * capture settings (e.g., ACAMERA_SENSOR_SENSITIVITY). This key + * represents a coarse approximation for such case. It is recommended + * to use ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL for captures when supported + * by the camera device, which provides more accurate white level values.

+ * + * @see ACAMERA_SENSOR_BLACK_LEVEL_PATTERN + * @see ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL + * @see ACAMERA_SENSOR_SENSITIVITY + */ + SENSOR_INFO_WHITE_LEVEL MetadataTag = C.ACAMERA_SENSOR_INFO_WHITE_LEVEL // int32 + + /** + *

The time base source for sensor capture start timestamps.

+ * + *

Type: byte (acamera_metadata_enum_android_sensor_info_timestamp_source_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The timestamps provided for captures are always in nanoseconds and monotonic, but + * may not based on a time source that can be compared to other system time sources.

+ *

This characteristic defines the source for the timestamps, and therefore whether they + * can be compared against other system time sources/timestamps.

+ */ + SENSOR_INFO_TIMESTAMP_SOURCE MetadataTag = C.ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE // byte (acamera_metadata_enum_android_sensor_info_timestamp_source_t) + + /** + *

Whether the RAW images output from this camera device are subject to + * lens shading correction.

+ * + *

Type: byte (acamera_metadata_enum_android_sensor_info_lens_shading_applied_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If TRUE, all images produced by the camera device in the RAW image formats will + * have lens shading correction already applied to it. If FALSE, the images will + * not be adjusted for lens shading correction. + * See android.request.maxNumOutputRaw for a list of RAW image formats.

+ *

This key will be null for all devices do not report this information. + * Devices with RAW capability will always report this information in this key.

+ */ + SENSOR_INFO_LENS_SHADING_APPLIED MetadataTag = C.ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED // byte (acamera_metadata_enum_android_sensor_info_lens_shading_applied_t) + + /** + *

The area of the image sensor which corresponds to active pixels prior to the + * application of any geometric distortion correction.

+ * + *

Type: int32[4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The data representation is int[4], which maps to (left, top, width, height).

+ *

This is the rectangle representing the size of the active region of the sensor (i.e. + * the region that actually receives light from the scene) before any geometric correction + * has been applied, and should be treated as the active region rectangle for any of the + * raw formats. All metadata associated with raw processing (e.g. the lens shading + * correction map, and radial distortion fields) treats the top, left of this rectangle as + * the origin, (0,0).

+ *

The size of this region determines the maximum field of view and the maximum number of + * pixels that an image from this sensor can contain, prior to the application of + * geometric distortion correction. The effective maximum pixel dimensions of a + * post-distortion-corrected image is given by the ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + * field, and the effective maximum field of view for a post-distortion-corrected image + * can be calculated by applying the geometric distortion correction fields to this + * rectangle, and cropping to the rectangle given in ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.

+ *

E.g. to calculate position of a pixel, (x,y), in a processed YUV output image with the + * dimensions in ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE given the position of a pixel, + * (x', y'), in the raw pixel array with dimensions give in + * ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE:

+ *
    + *
  1. Choose a pixel (x', y') within the active array region of the raw buffer given in + * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, otherwise this pixel is considered + * to be outside of the FOV, and will not be shown in the processed output image.
  2. + *
  3. Apply geometric distortion correction to get the post-distortion pixel coordinate, + * (x_i, y_i). When applying geometric correction metadata, note that metadata for raw + * buffers is defined relative to the top, left of the + * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE rectangle.
  4. + *
  5. If the resulting corrected pixel coordinate is within the region given in + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, then the position of this pixel in the + * processed output image buffer is (x_i - activeArray.left, y_i - activeArray.top), + * when the top, left coordinate of that buffer is treated as (0, 0).
  6. + *
+ *

Thus, for pixel x',y' = (25, 25) on a sensor where ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE + * is (100,100), ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE is (10, 10, 100, 100), + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE is (20, 20, 80, 80), and the geometric distortion + * correction doesn't change the pixel coordinate, the resulting pixel selected in + * pixel coordinates would be x,y = (25, 25) relative to the top,left of the raw buffer + * with dimensions given in ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE, and would be (5, 5) + * relative to the top,left of post-processed YUV output buffer with dimensions given in + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.

+ *

The currently supported fields that correct for geometric distortion are:

+ *
    + *
  1. ACAMERA_LENS_RADIAL_DISTORTION.
  2. + *
+ *

If all of the geometric distortion fields are no-ops, this rectangle will be the same + * as the post-distortion-corrected rectangle given in + * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.

+ *

This rectangle is defined relative to the full pixel array; (0,0) is the top-left of + * the full pixel array, and the size of the full pixel array is given by + * ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE.

+ *

The pre-correction active array may be smaller than the full pixel array, since the + * full array may include black calibration pixels or other inactive regions.

+ * + * @see ACAMERA_LENS_RADIAL_DISTORTION + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + * @see ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE + * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE + */ + SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE MetadataTag = C.ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE // int32[4] + + SENSOR_INFO_END MetadataTag = C.ACAMERA_SENSOR_INFO_END + + /** + *

Quality of lens shading correction applied + * to the image data.

+ * + *

Type: byte (acamera_metadata_enum_android_shading_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When set to OFF mode, no lens shading correction will be applied by the + * camera device, and an identity lens shading map data will be provided + * if ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE == ON. For example, for lens + * shading map with size of [ 4, 3 ], + * the output android.statistics.lensShadingCorrectionMap for this case will be an identity + * map shown below:

+ *
[ 1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
+	 *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
+	 *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
+	 *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
+	 *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0,
+	 *  1.0, 1.0, 1.0, 1.0,  1.0, 1.0, 1.0, 1.0 ]
+	 * 
+ *

When set to other modes, lens shading correction will be applied by the camera + * device. Applications can request lens shading map data by setting + * ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE to ON, and then the camera device will provide lens + * shading map data in android.statistics.lensShadingCorrectionMap; the returned shading map + * data will be the one applied by the camera device for this capture request.

+ *

The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore + * the reliability of the map data may be affected by the AE and AWB algorithms. When AE and + * AWB are in AUTO modes(ACAMERA_CONTROL_AE_MODE != OFF and ACAMERA_CONTROL_AWB_MODE != + * OFF), to get best results, it is recommended that the applications wait for the AE and AWB + * to be converged before using the returned shading map data.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AWB_MODE + * @see ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE + */ + SHADING_MODE MetadataTag = C.ACAMERA_SHADING_MODE // byte (acamera_metadata_enum_android_shading_mode_t) + + /** + *

List of lens shading modes for ACAMERA_SHADING_MODE that are supported by this camera device.

+ * + * @see ACAMERA_SHADING_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This list contains lens shading modes that can be set for the camera device. + * Camera devices that support the MANUAL_POST_PROCESSING capability will always + * list OFF and FAST mode. This includes all FULL level devices. + * LEGACY devices will always only support FAST mode.

+ */ + SHADING_AVAILABLE_MODES MetadataTag = C.ACAMERA_SHADING_AVAILABLE_MODES // byte[n] + + SHADING_END MetadataTag = C.ACAMERA_SHADING_END + + /** + *

Operating mode for the face detector + * unit.

+ * + *

Type: byte (acamera_metadata_enum_android_statistics_face_detect_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Whether face detection is enabled, and whether it + * should output just the basic fields or the full set of + * fields.

+ */ + STATISTICS_FACE_DETECT_MODE MetadataTag = C.ACAMERA_STATISTICS_FACE_DETECT_MODE // byte (acamera_metadata_enum_android_statistics_face_detect_mode_t) + + /** + *

Operating mode for hot pixel map generation.

+ * + *

Type: byte (acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

If set to true, a hot pixel map is returned in ACAMERA_STATISTICS_HOT_PIXEL_MAP. + * If set to false, no hot pixel map will be returned.

+ * + * @see ACAMERA_STATISTICS_HOT_PIXEL_MAP + */ + STATISTICS_HOT_PIXEL_MAP_MODE MetadataTag = C.ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE // byte (acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t) + + /** + *

List of unique IDs for detected faces.

+ * + *

Type: int32[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Each detected face is given a unique ID that is valid for as long as the face is visible + * to the camera device. A face that leaves the field of view and later returns may be + * assigned a new ID.

+ *

Only available if ACAMERA_STATISTICS_FACE_DETECT_MODE == FULL

+ * + * @see ACAMERA_STATISTICS_FACE_DETECT_MODE + */ + STATISTICS_FACE_IDS MetadataTag = C.ACAMERA_STATISTICS_FACE_IDS // int32[n] + + /** + *

List of landmarks for detected + * faces.

+ * + *

Type: int32[n*6]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

The coordinate system is that of ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, with + * (0, 0) being the top-left pixel of the active array.

+ *

Only available if ACAMERA_STATISTICS_FACE_DETECT_MODE == FULL

+ * + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + * @see ACAMERA_STATISTICS_FACE_DETECT_MODE + */ + STATISTICS_FACE_LANDMARKS MetadataTag = C.ACAMERA_STATISTICS_FACE_LANDMARKS // int32[n*6] + + /** + *

List of the bounding rectangles for detected + * faces.

+ * + *

Type: int32[n*4]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

The data representation is int[4], which maps to (left, top, width, height).

+ *

The coordinate system is that of ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, with + * (0, 0) being the top-left pixel of the active array.

+ *

Only available if ACAMERA_STATISTICS_FACE_DETECT_MODE != OFF

+ * + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + * @see ACAMERA_STATISTICS_FACE_DETECT_MODE + */ + STATISTICS_FACE_RECTANGLES MetadataTag = C.ACAMERA_STATISTICS_FACE_RECTANGLES // int32[n*4] + + /** + *

List of the face confidence scores for + * detected faces

+ * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Only available if ACAMERA_STATISTICS_FACE_DETECT_MODE != OFF.

+ * + * @see ACAMERA_STATISTICS_FACE_DETECT_MODE + */ + STATISTICS_FACE_SCORES MetadataTag = C.ACAMERA_STATISTICS_FACE_SCORES // byte[n] + + /** + *

The shading map is a low-resolution floating-point map + * that lists the coefficients used to correct for vignetting and color shading, + * for each Bayer color channel of RAW image data.

+ * + *

Type: float[4*n*m]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

The map provided here is the same map that is used by the camera device to + * correct both color shading and vignetting for output non-RAW images.

+ *

When there is no lens shading correction applied to RAW + * output images (ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED == + * false), this map is the complete lens shading correction + * map; when there is some lens shading correction applied to + * the RAW output image (ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED== true), this map reports the remaining lens shading + * correction map that needs to be applied to get shading + * corrected images that match the camera device's output for + * non-RAW formats.

+ *

For a complete shading correction map, the least shaded + * section of the image will have a gain factor of 1; all + * other sections will have gains above 1.

+ *

When ACAMERA_COLOR_CORRECTION_MODE = TRANSFORM_MATRIX, the map + * will take into account the colorCorrection settings.

+ *

The shading map is for the entire active pixel array, and is not + * affected by the crop region specified in the request. Each shading map + * entry is the value of the shading compensation map over a specific + * pixel on the sensor. Specifically, with a (N x M) resolution shading + * map, and an active pixel array size (W x H), shading map entry + * (x,y) ϵ (0 ... N-1, 0 ... M-1) is the value of the shading map at + * pixel ( ((W-1)/(N-1)) * x, ((H-1)/(M-1)) * y) for the four color channels. + * The map is assumed to be bilinearly interpolated between the sample points.

+ *

The channel order is [R, Geven, Godd, B], where Geven is the green + * channel for the even rows of a Bayer pattern, and Godd is the odd rows. + * The shading map is stored in a fully interleaved format, and its size + * is provided in the camera static metadata by ACAMERA_LENS_INFO_SHADING_MAP_SIZE.

+ *

The shading map will generally have on the order of 30-40 rows and columns, + * and will be smaller than 64x64.

+ *

As an example, given a very small map defined as:

+ *
ACAMERA_LENS_INFO_SHADING_MAP_SIZE = [ 4, 3 ]
+	 * ACAMERA_STATISTICS_LENS_SHADING_MAP =
+	 * [ 1.3, 1.2, 1.15, 1.2,  1.2, 1.2, 1.15, 1.2,
+	 *     1.1, 1.2, 1.2, 1.2,  1.3, 1.2, 1.3, 1.3,
+	 *   1.2, 1.2, 1.25, 1.1,  1.1, 1.1, 1.1, 1.0,
+	 *     1.0, 1.0, 1.0, 1.0,  1.2, 1.3, 1.25, 1.2,
+	 *   1.3, 1.2, 1.2, 1.3,   1.2, 1.15, 1.1, 1.2,
+	 *     1.2, 1.1, 1.0, 1.2,  1.3, 1.15, 1.2, 1.3 ]
+	 * 
+ *

The low-resolution scaling map images for each channel are + * (displayed using nearest-neighbor interpolation):

+ *

Red lens shading map + * Green (even rows) lens shading map + * Green (odd rows) lens shading map + * Blue lens shading map

+ *

As a visualization only, inverting the full-color map to recover an + * image of a gray wall (using bicubic interpolation for visual quality) + * as captured by the sensor gives:

+ *

Image of a uniform white wall (inverse shading map)

+ *

Note that the RAW image data might be subject to lens shading + * correction not reported on this map. Query + * ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED to see if RAW image data has subject + * to lens shading correction. If ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED + * is TRUE, the RAW image data is subject to partial or full lens shading + * correction. In the case full lens shading correction is applied to RAW + * images, the gain factor map reported in this key will contain all 1.0 gains. + * In other words, the map reported in this key is the remaining lens shading + * that needs to be applied on the RAW image to get images without lens shading + * artifacts. See android.request.maxNumOutputRaw for a list of RAW image + * formats.

+ * + * @see ACAMERA_COLOR_CORRECTION_MODE + * @see ACAMERA_LENS_INFO_SHADING_MAP_SIZE + * @see ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED + * @see ACAMERA_STATISTICS_LENS_SHADING_MAP + */ + STATISTICS_LENS_SHADING_MAP MetadataTag = C.ACAMERA_STATISTICS_LENS_SHADING_MAP // float[4*n*m] + + /** + *

The camera device estimated scene illumination lighting + * frequency.

+ * + *

Type: byte (acamera_metadata_enum_android_statistics_scene_flicker_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

Many light sources, such as most fluorescent lights, flicker at a rate + * that depends on the local utility power standards. This flicker must be + * accounted for by auto-exposure routines to avoid artifacts in captured images. + * The camera device uses this entry to tell the application what the scene + * illuminant frequency is.

+ *

When manual exposure control is enabled + * (ACAMERA_CONTROL_AE_MODE == OFF or ACAMERA_CONTROL_MODE == + * OFF), the ACAMERA_CONTROL_AE_ANTIBANDING_MODE doesn't perform + * antibanding, and the application can ensure it selects + * exposure times that do not cause banding issues by looking + * into this metadata field. See + * ACAMERA_CONTROL_AE_ANTIBANDING_MODE for more details.

+ *

Reports NONE if there doesn't appear to be flickering illumination.

+ * + * @see ACAMERA_CONTROL_AE_ANTIBANDING_MODE + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_MODE + */ + STATISTICS_SCENE_FLICKER MetadataTag = C.ACAMERA_STATISTICS_SCENE_FLICKER // byte (acamera_metadata_enum_android_statistics_scene_flicker_t) + + /** + *

List of (x, y) coordinates of hot/defective pixels on the sensor.

+ * + *

Type: int32[2*n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

A coordinate (x, y) must lie between (0, 0), and + * (width - 1, height - 1) (inclusive), which are the top-left and + * bottom-right of the pixel array, respectively. The width and + * height dimensions are given in ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE. + * This may include hot pixels that lie outside of the active array + * bounds given by ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE.

+ * + * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE + * @see ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE + */ + STATISTICS_HOT_PIXEL_MAP MetadataTag = C.ACAMERA_STATISTICS_HOT_PIXEL_MAP // int32[2*n] + + /** + *

Whether the camera device will output the lens + * shading map in output result metadata.

+ * + *

Type: byte (acamera_metadata_enum_android_statistics_lens_shading_map_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When set to ON, + * ACAMERA_STATISTICS_LENS_SHADING_MAP will be provided in + * the output result metadata.

+ *

ON is always supported on devices with the RAW capability.

+ * + * @see ACAMERA_STATISTICS_LENS_SHADING_MAP + */ + STATISTICS_LENS_SHADING_MAP_MODE MetadataTag = C.ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE // byte (acamera_metadata_enum_android_statistics_lens_shading_map_mode_t) + + STATISTICS_END MetadataTag = C.ACAMERA_STATISTICS_END + + /** + *

List of face detection modes for ACAMERA_STATISTICS_FACE_DETECT_MODE that are + * supported by this camera device.

+ * + * @see ACAMERA_STATISTICS_FACE_DETECT_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

OFF is always supported.

+ */ + STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES MetadataTag = C.ACAMERA_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES // byte[n] + + /** + *

The maximum number of simultaneously detectable + * faces.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + */ + STATISTICS_INFO_MAX_FACE_COUNT MetadataTag = C.ACAMERA_STATISTICS_INFO_MAX_FACE_COUNT // int32 + + /** + *

List of hot pixel map output modes for ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE that are + * supported by this camera device.

+ * + * @see ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If no hotpixel map output is available for this camera device, this will contain only + * false.

+ *

ON is always supported on devices with the RAW capability.

+ */ + STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES MetadataTag = C.ACAMERA_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES // byte[n] + + /** + *

List of lens shading map output modes for ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE that + * are supported by this camera device.

+ * + * @see ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If no lens shading map output is available for this camera device, this key will + * contain only OFF.

+ *

ON is always supported on devices with the RAW capability. + * LEGACY mode devices will always only support OFF.

+ */ + STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES MetadataTag = C.ACAMERA_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES // byte[n] + + STATISTICS_INFO_END MetadataTag = C.ACAMERA_STATISTICS_INFO_END + + /** + *

Tonemapping / contrast / gamma curve for the blue + * channel, to use when ACAMERA_TONEMAP_MODE is + * CONTRAST_CURVE.

+ * + * @see ACAMERA_TONEMAP_MODE + * + *

Type: float[n*2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

See ACAMERA_TONEMAP_CURVE_RED for more details.

+ * + * @see ACAMERA_TONEMAP_CURVE_RED + */ + TONEMAP_CURVE_BLUE MetadataTag = C.ACAMERA_TONEMAP_CURVE_BLUE // float[n*2] + + /** + *

Tonemapping / contrast / gamma curve for the green + * channel, to use when ACAMERA_TONEMAP_MODE is + * CONTRAST_CURVE.

+ * + * @see ACAMERA_TONEMAP_MODE + * + *

Type: float[n*2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

See ACAMERA_TONEMAP_CURVE_RED for more details.

+ * + * @see ACAMERA_TONEMAP_CURVE_RED + */ + TONEMAP_CURVE_GREEN MetadataTag = C.ACAMERA_TONEMAP_CURVE_GREEN // float[n*2] + + /** + *

Tonemapping / contrast / gamma curve for the red + * channel, to use when ACAMERA_TONEMAP_MODE is + * CONTRAST_CURVE.

+ * + * @see ACAMERA_TONEMAP_MODE + * + *

Type: float[n*2]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Each channel's curve is defined by an array of control points:

+ *
ACAMERA_TONEMAP_CURVE_RED =
+	 *   [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ]
+	 * 2 <= N <= ACAMERA_TONEMAP_MAX_CURVE_POINTS
+ *

These are sorted in order of increasing Pin; it is + * required that input values 0.0 and 1.0 are included in the list to + * define a complete mapping. For input values between control points, + * the camera device must linearly interpolate between the control + * points.

+ *

Each curve can have an independent number of points, and the number + * of points can be less than max (that is, the request doesn't have to + * always provide a curve with number of points equivalent to + * ACAMERA_TONEMAP_MAX_CURVE_POINTS).

+ *

A few examples, and their corresponding graphical mappings; these + * only specify the red channel and the precision is limited to 4 + * digits, for conciseness.

+ *

Linear mapping:

+ *
ACAMERA_TONEMAP_CURVE_RED = [ 0, 0, 1.0, 1.0 ]
+	 * 
+ *

Linear mapping curve

+ *

Invert mapping:

+ *
ACAMERA_TONEMAP_CURVE_RED = [ 0, 1.0, 1.0, 0 ]
+	 * 
+ *

Inverting mapping curve

+ *

Gamma 1/2.2 mapping, with 16 control points:

+ *
ACAMERA_TONEMAP_CURVE_RED = [
+	 *   0.0000, 0.0000, 0.0667, 0.2920, 0.1333, 0.4002, 0.2000, 0.4812,
+	 *   0.2667, 0.5484, 0.3333, 0.6069, 0.4000, 0.6594, 0.4667, 0.7072,
+	 *   0.5333, 0.7515, 0.6000, 0.7928, 0.6667, 0.8317, 0.7333, 0.8685,
+	 *   0.8000, 0.9035, 0.8667, 0.9370, 0.9333, 0.9691, 1.0000, 1.0000 ]
+	 * 
+ *

Gamma = 1/2.2 tonemapping curve

+ *

Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:

+ *
ACAMERA_TONEMAP_CURVE_RED = [
+	 *   0.0000, 0.0000, 0.0667, 0.2864, 0.1333, 0.4007, 0.2000, 0.4845,
+	 *   0.2667, 0.5532, 0.3333, 0.6125, 0.4000, 0.6652, 0.4667, 0.7130,
+	 *   0.5333, 0.7569, 0.6000, 0.7977, 0.6667, 0.8360, 0.7333, 0.8721,
+	 *   0.8000, 0.9063, 0.8667, 0.9389, 0.9333, 0.9701, 1.0000, 1.0000 ]
+	 * 
+ *

sRGB tonemapping curve

+ * + * @see ACAMERA_TONEMAP_CURVE_RED + * @see ACAMERA_TONEMAP_MAX_CURVE_POINTS + */ + TONEMAP_CURVE_RED MetadataTag = C.ACAMERA_TONEMAP_CURVE_RED // float[n*2] + + /** + *

High-level global contrast/gamma/tonemapping control.

+ * + *

Type: byte (acamera_metadata_enum_android_tonemap_mode_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

When switching to an application-defined contrast curve by setting + * ACAMERA_TONEMAP_MODE to CONTRAST_CURVE, the curve is defined + * per-channel with a set of (in, out) points that specify the + * mapping from input high-bit-depth pixel value to the output + * low-bit-depth value. Since the actual pixel ranges of both input + * and output may change depending on the camera pipeline, the values + * are specified by normalized floating-point numbers.

+ *

More-complex color mapping operations such as 3D color look-up + * tables, selective chroma enhancement, or other non-linear color + * transforms will be disabled when ACAMERA_TONEMAP_MODE is + * CONTRAST_CURVE.

+ *

When using either FAST or HIGH_QUALITY, the camera device will + * emit its own tonemap curve in android.tonemap.curve. + * These values are always available, and as close as possible to the + * actually used nonlinear/nonglobal transforms.

+ *

If a request is sent with CONTRAST_CURVE with the camera device's + * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be + * roughly the same.

+ * + * @see ACAMERA_TONEMAP_MODE + */ + TONEMAP_MODE MetadataTag = C.ACAMERA_TONEMAP_MODE // byte (acamera_metadata_enum_android_tonemap_mode_t) + + /** + *

Maximum number of supported points in the + * tonemap curve that can be used for android.tonemap.curve.

+ * + *

Type: int32

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If the actual number of points provided by the application (in ACAMERA_TONEMAPCURVE_*) is + * less than this maximum, the camera device will resample the curve to its internal + * representation, using linear interpolation.

+ *

The output curves in the result metadata may have a different number + * of points than the input curves, and will represent the actual + * hardware curves used as closely as possible when linearly interpolated.

+ */ + TONEMAP_MAX_CURVE_POINTS MetadataTag = C.ACAMERA_TONEMAP_MAX_CURVE_POINTS // int32 + + /** + *

List of tonemapping modes for ACAMERA_TONEMAP_MODE that are supported by this camera + * device.

+ * + * @see ACAMERA_TONEMAP_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

Camera devices that support the MANUAL_POST_PROCESSING capability will always contain + * at least one of below mode combinations:

+ *
    + *
  • CONTRAST_CURVE, FAST and HIGH_QUALITY
  • + *
  • GAMMA_VALUE, PRESET_CURVE, FAST and HIGH_QUALITY
  • + *
+ *

This includes all FULL level devices.

+ */ + TONEMAP_AVAILABLE_TONE_MAP_MODES MetadataTag = C.ACAMERA_TONEMAP_AVAILABLE_TONE_MAP_MODES // byte[n] + + /** + *

Tonemapping curve to use when ACAMERA_TONEMAP_MODE is + * GAMMA_VALUE

+ * + * @see ACAMERA_TONEMAP_MODE + * + *

Type: float

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

The tonemap curve will be defined the following formula: + * * OUT = pow(IN, 1.0 / gamma) + * where IN and OUT is the input pixel value scaled to range [0.0, 1.0], + * pow is the power function and gamma is the gamma value specified by this + * key.

+ *

The same curve will be applied to all color channels. The camera device + * may clip the input gamma value to its supported range. The actual applied + * value will be returned in capture result.

+ *

The valid range of gamma value varies on different devices, but values + * within [1.0, 5.0] are guaranteed not to be clipped.

+ */ + TONEMAP_GAMMA MetadataTag = C.ACAMERA_TONEMAP_GAMMA // float + + /** + *

Tonemapping curve to use when ACAMERA_TONEMAP_MODE is + * PRESET_CURVE

+ * + * @see ACAMERA_TONEMAP_MODE + * + *

Type: byte (acamera_metadata_enum_android_tonemap_preset_curve_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

The tonemap curve will be defined by specified standard.

+ *

sRGB (approximated by 16 control points):

+ *

sRGB tonemapping curve

+ *

Rec. 709 (approximated by 16 control points):

+ *

Rec. 709 tonemapping curve

+ *

Note that above figures show a 16 control points approximation of preset + * curves. Camera devices may apply a different approximation to the curve.

+ */ + TONEMAP_PRESET_CURVE MetadataTag = C.ACAMERA_TONEMAP_PRESET_CURVE // byte (acamera_metadata_enum_android_tonemap_preset_curve_t) + + TONEMAP_END MetadataTag = C.ACAMERA_TONEMAP_END + + /** + *

Generally classifies the overall set of the camera device functionality.

+ * + *

Type: byte (acamera_metadata_enum_android_info_supported_hardware_level_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

The supported hardware level is a high-level description of the camera device's + * capabilities, summarizing several capabilities into one field. Each level adds additional + * features to the previous one, and is always a strict superset of the previous level. + * The ordering is LEGACY < LIMITED < FULL < LEVEL_3.

+ *

Starting from LEVEL_3, the level enumerations are guaranteed to be in increasing + * numerical value as well. To check if a given device is at least at a given hardware level, + * the following code snippet can be used:

+ *
// Returns true if the device supports the required hardware level, or better.
+	 * boolean isHardwareLevelSupported(CameraCharacteristics c, int requiredLevel) {
+	 *     int deviceLevel = c.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
+	 *     if (deviceLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
+	 *         return requiredLevel == deviceLevel;
+	 *     }
+	 *     // deviceLevel is not LEGACY, can use numerical sort
+	 *     return requiredLevel <= deviceLevel;
+	 * }
+	 * 
+ *

At a high level, the levels are:

+ *
    + *
  • LEGACY devices operate in a backwards-compatibility mode for older + * Android devices, and have very limited capabilities.
  • + *
  • LIMITED devices represent the + * baseline feature set, and may also include additional capabilities that are + * subsets of FULL.
  • + *
  • FULL devices additionally support per-frame manual control of sensor, flash, lens and + * post-processing settings, and image capture at a high rate.
  • + *
  • LEVEL_3 devices additionally support YUV reprocessing and RAW image capture, along + * with additional output stream configurations.
  • + *
+ *

See the individual level enums for full descriptions of the supported capabilities. The + * ACAMERA_REQUEST_AVAILABLE_CAPABILITIES entry describes the device's capabilities at a + * finer-grain level, if needed. In addition, many controls have their available settings or + * ranges defined in individual metadata tag entries in this document.

+ *

Some features are not part of any particular hardware level or capability and must be + * queried separately. These include:

+ *
    + *
  • Calibrated timestamps (ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE == REALTIME)
  • + *
  • Precision lens control (ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION == CALIBRATED)
  • + *
  • Face detection (ACAMERA_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES)
  • + *
  • Optical or electrical image stabilization + * (ACAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION, + * ACAMERA_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES)
  • + *
+ * + * @see ACAMERA_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES + * @see ACAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION + * @see ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + * @see ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE + * @see ACAMERA_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES + */ + INFO_SUPPORTED_HARDWARE_LEVEL MetadataTag = C.ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL // byte (acamera_metadata_enum_android_info_supported_hardware_level_t) + + INFO_END MetadataTag = C.ACAMERA_INFO_END + + /** + *

Whether black-level compensation is locked + * to its current values, or is free to vary.

+ * + *

Type: byte (acamera_metadata_enum_android_black_level_lock_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *
  • ACaptureRequest
  • + *

+ * + *

Whether the black level offset was locked for this frame. Should be + * ON if ACAMERA_BLACK_LEVEL_LOCK was ON in the capture request, unless + * a change in other capture settings forced the camera device to + * perform a black level reset.

+ * + * @see ACAMERA_BLACK_LEVEL_LOCK + */ + BLACK_LEVEL_LOCK MetadataTag = C.ACAMERA_BLACK_LEVEL_LOCK // byte (acamera_metadata_enum_android_black_level_lock_t) + + BLACK_LEVEL_END MetadataTag = C.ACAMERA_BLACK_LEVEL_END + + /** + *

The frame number corresponding to the last request + * with which the output result (metadata + buffers) has been fully + * synchronized.

+ * + *

Type: int64 (acamera_metadata_enum_android_sync_frame_number_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks
  • + *

+ * + *

When a request is submitted to the camera device, there is usually a + * delay of several frames before the controls get applied. A camera + * device may either choose to account for this delay by implementing a + * pipeline and carefully submit well-timed atomic control updates, or + * it may start streaming control changes that span over several frame + * boundaries.

+ *

In the latter case, whenever a request's settings change relative to + * the previous submitted request, the full set of changes may take + * multiple frame durations to fully take effect. Some settings may + * take effect sooner (in less frame durations) than others.

+ *

While a set of control changes are being propagated, this value + * will be CONVERGING.

+ *

Once it is fully known that a set of control changes have been + * finished propagating, and the resulting updated control settings + * have been read back by the camera device, this value will be set + * to a non-negative frame number (corresponding to the request to + * which the results have synchronized to).

+ *

Older camera device implementations may not have a way to detect + * when all camera controls have been applied, and will always set this + * value to UNKNOWN.

+ *

FULL capability devices will always have this value set to the + * frame number of the request corresponding to this result.

+ *

Further details:

+ *
    + *
  • Whenever a request differs from the last request, any future + * results not yet returned may have this value set to CONVERGING (this + * could include any in-progress captures not yet returned by the camera + * device, for more details see pipeline considerations below).
  • + *
  • Submitting a series of multiple requests that differ from the + * previous request (e.g. r1, r2, r3 s.t. r1 != r2 != r3) + * moves the new synchronization frame to the last non-repeating + * request (using the smallest frame number from the contiguous list of + * repeating requests).
  • + *
  • Submitting the same request repeatedly will not change this value + * to CONVERGING, if it was already a non-negative value.
  • + *
  • When this value changes to non-negative, that means that all of the + * metadata controls from the request have been applied, all of the + * metadata controls from the camera device have been read to the + * updated values (into the result), and all of the graphics buffers + * corresponding to this result are also synchronized to the request.
  • + *
+ *

Pipeline considerations:

+ *

Submitting a request with updated controls relative to the previously + * submitted requests may also invalidate the synchronization state + * of all the results corresponding to currently in-flight requests.

+ *

In other words, results for this current request and up to + * ACAMERA_REQUEST_PIPELINE_MAX_DEPTH prior requests may have their + * ACAMERA_SYNC_FRAME_NUMBER change to CONVERGING.

+ * + * @see ACAMERA_REQUEST_PIPELINE_MAX_DEPTH + * @see ACAMERA_SYNC_FRAME_NUMBER + */ + SYNC_FRAME_NUMBER MetadataTag = C.ACAMERA_SYNC_FRAME_NUMBER // int64 (acamera_metadata_enum_android_sync_frame_number_t) + + /** + *

The maximum number of frames that can occur after a request + * (different than the previous) has been submitted, and before the + * result's state becomes synchronized.

+ * + *

Type: int32 (acamera_metadata_enum_android_sync_max_latency_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This defines the maximum distance (in number of metadata results), + * between the frame number of the request that has new controls to apply + * and the frame number of the result that has all the controls applied.

+ *

In other words this acts as an upper boundary for how many frames + * must occur before the camera device knows for a fact that the new + * submitted camera settings have been applied in outgoing frames.

+ */ + SYNC_MAX_LATENCY MetadataTag = C.ACAMERA_SYNC_MAX_LATENCY // int32 (acamera_metadata_enum_android_sync_max_latency_t) + + SYNC_END MetadataTag = C.ACAMERA_SYNC_END + + /** + *

The available depth dataspace stream + * configurations that this camera device supports + * (i.e. format, width, height, output/input stream).

+ * + *

Type: int32[n*4] (acamera_metadata_enum_android_depth_available_depth_stream_configurations_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

These are output stream configurations for use with + * dataSpace HAL_DATASPACE_DEPTH. The configurations are + * listed as (format, width, height, input?) tuples.

+ *

Only devices that support depth output for at least + * the HAL_PIXEL_FORMAT_Y16 dense depth map may include + * this entry.

+ *

A device that also supports the HAL_PIXEL_FORMAT_BLOB + * sparse depth point cloud must report a single entry for + * the format in this list as (HAL_PIXEL_FORMAT_BLOB, + * android.depth.maxDepthSamples, 1, OUTPUT) in addition to + * the entries for HAL_PIXEL_FORMAT_Y16.

+ */ + DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS MetadataTag = C.ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS // int32[n*4] (acamera_metadata_enum_android_depth_available_depth_stream_configurations_t) + + /** + *

This lists the minimum frame duration for each + * format/size combination for depth output formats.

+ * + *

Type: int64[4*n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

This should correspond to the frame duration when only that + * stream is active, with all processing (typically in android.*.mode) + * set to either OFF or FAST.

+ *

When multiple streams are used in a request, the minimum frame + * duration will be max(individual stream min durations).

+ *

The minimum frame duration of a stream (of a particular format, size) + * is the same regardless of whether the stream is input or output.

+ *

See ACAMERA_SENSOR_FRAME_DURATION and + * ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS for more details about + * calculating the max frame rate.

+ * + * @see ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS + * @see ACAMERA_SENSOR_FRAME_DURATION + */ + DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS MetadataTag = C.ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS // int64[4*n] + + /** + *

This lists the maximum stall duration for each + * output format/size combination for depth streams.

+ * + *

Type: int64[4*n]

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

A stall duration is how much extra time would get added + * to the normal minimum frame duration for a repeating request + * that has streams with non-zero stall.

+ *

This functions similarly to + * ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS for depth + * streams.

+ *

All depth output stream formats may have a nonzero stall + * duration.

+ * + * @see ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS + */ + DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS MetadataTag = C.ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS // int64[4*n] + + /** + *

Indicates whether a capture request may target both a + * DEPTH16 / DEPTH_POINT_CLOUD output, and normal color outputs (such as + * YUV_420_888, JPEG, or RAW) simultaneously.

+ * + *

Type: byte (acamera_metadata_enum_android_depth_depth_is_exclusive_t)

+ * + *

This tag may appear in: + *

    + *
  • ACameraMetadata from ACameraManager_getCameraCharacteristics
  • + *

+ * + *

If TRUE, including both depth and color outputs in a single + * capture request is not supported. An application must interleave color + * and depth requests. If FALSE, a single request can target both types + * of output.

+ *

Typically, this restriction exists on camera devices that + * need to emit a specific pattern or wavelength of light to + * measure depth values, which causes the color image to be + * corrupted during depth measurement.

+ */ + DEPTH_DEPTH_IS_EXCLUSIVE MetadataTag = C.ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE // byte (acamera_metadata_enum_android_depth_depth_is_exclusive_t) + + DEPTH_END MetadataTag = C.ACAMERA_DEPTH_END +) + +/** + * Enumeration definitions for the various entries that need them + */ + +// ACAMERA_COLOR_CORRECTION_MODE +type MetadataColor_correction_mode int + +const ( + /** + *

Use the ACAMERA_COLOR_CORRECTION_TRANSFORM matrix + * and ACAMERA_COLOR_CORRECTION_GAINS to do color conversion.

+ *

All advanced white balance adjustments (not specified + * by our white balance pipeline) must be disabled.

+ *

If AWB is enabled with ACAMERA_CONTROL_AWB_MODE != OFF, then + * TRANSFORM_MATRIX is ignored. The camera device will override + * this value to either FAST or HIGH_QUALITY.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + * @see ACAMERA_CONTROL_AWB_MODE + */ + COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = C.ACAMERA_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX + + /** + *

Color correction processing must not slow down + * capture rate relative to sensor raw output.

+ *

Advanced white balance adjustments above and beyond + * the specified white balance pipeline may be applied.

+ *

If AWB is enabled with ACAMERA_CONTROL_AWB_MODE != OFF, then + * the camera device uses the last frame's AWB values + * (or defaults if AWB has never been run).

+ * + * @see ACAMERA_CONTROL_AWB_MODE + */ + COLOR_CORRECTION_MODE_FAST = C.ACAMERA_COLOR_CORRECTION_MODE_FAST + + /** + *

Color correction processing operates at improved + * quality but the capture rate might be reduced (relative to sensor + * raw output rate)

+ *

Advanced white balance adjustments above and beyond + * the specified white balance pipeline may be applied.

+ *

If AWB is enabled with ACAMERA_CONTROL_AWB_MODE != OFF, then + * the camera device uses the last frame's AWB values + * (or defaults if AWB has never been run).

+ * + * @see ACAMERA_CONTROL_AWB_MODE + */ + COLOR_CORRECTION_MODE_HIGH_QUALITY = C.ACAMERA_COLOR_CORRECTION_MODE_HIGH_QUALITY +) + +// ACAMERA_COLOR_CORRECTION_ABERRATION_MODE +type MetadataColor_correction_aberration_mode int + +const ( + /** + *

No aberration correction is applied.

+ */ + COLOR_CORRECTION_ABERRATION_MODE_OFF = C.ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_OFF + + /** + *

Aberration correction will not slow down capture rate + * relative to sensor raw output.

+ */ + COLOR_CORRECTION_ABERRATION_MODE_FAST = C.ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_FAST + + /** + *

Aberration correction operates at improved quality but the capture rate might be + * reduced (relative to sensor raw output rate)

+ */ + COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY = C.ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY +) + +// ACAMERA_CONTROL_AE_ANTIBANDING_MODE +type MetadataControl_ae_antibanding_mode int + +const ( + /** + *

The camera device will not adjust exposure duration to + * avoid banding problems.

+ */ + CONTROL_AE_ANTIBANDING_MODE_OFF = C.ACAMERA_CONTROL_AE_ANTIBANDING_MODE_OFF + + /** + *

The camera device will adjust exposure duration to + * avoid banding problems with 50Hz illumination sources.

+ */ + CONTROL_AE_ANTIBANDING_MODE_50HZ = C.ACAMERA_CONTROL_AE_ANTIBANDING_MODE_50HZ + + /** + *

The camera device will adjust exposure duration to + * avoid banding problems with 60Hz illumination + * sources.

+ */ + CONTROL_AE_ANTIBANDING_MODE_60HZ = C.ACAMERA_CONTROL_AE_ANTIBANDING_MODE_60HZ + + /** + *

The camera device will automatically adapt its + * antibanding routine to the current illumination + * condition. This is the default mode if AUTO is + * available on given camera device.

+ */ + CONTROL_AE_ANTIBANDING_MODE_AUTO = C.ACAMERA_CONTROL_AE_ANTIBANDING_MODE_AUTO +) + +// ACAMERA_CONTROL_AE_LOCK +type MetadataControl_ae_lock int + +const ( + /** + *

Auto-exposure lock is disabled; the AE algorithm + * is free to update its parameters.

+ */ + CONTROL_AE_LOCK_OFF = C.ACAMERA_CONTROL_AE_LOCK_OFF + + /** + *

Auto-exposure lock is enabled; the AE algorithm + * must not update the exposure and sensitivity parameters + * while the lock is active.

+ *

ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION setting changes + * will still take effect while auto-exposure is locked.

+ *

Some rare LEGACY devices may not support + * this, in which case the value will always be overridden to OFF.

+ * + * @see ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION + */ + CONTROL_AE_LOCK_ON = C.ACAMERA_CONTROL_AE_LOCK_ON +) + +// ACAMERA_CONTROL_AE_MODE +type MetadataEnumAcameraControlAeMode int + +const ( + /** + *

The camera device's autoexposure routine is disabled.

+ *

The application-selected ACAMERA_SENSOR_EXPOSURE_TIME, + * ACAMERA_SENSOR_SENSITIVITY and + * ACAMERA_SENSOR_FRAME_DURATION are used by the camera + * device, along with ACAMERA_FLASH_* fields, if there's + * a flash unit for this camera device.

+ *

Note that auto-white balance (AWB) and auto-focus (AF) + * behavior is device dependent when AE is in OFF mode. + * To have consistent behavior across different devices, + * it is recommended to either set AWB and AF to OFF mode + * or lock AWB and AF before setting AE to OFF. + * See ACAMERA_CONTROL_AWB_MODE, ACAMERA_CONTROL_AF_MODE, + * ACAMERA_CONTROL_AWB_LOCK, and ACAMERA_CONTROL_AF_TRIGGER + * for more details.

+ *

LEGACY devices do not support the OFF mode and will + * override attempts to use this value to ON.

+ * + * @see ACAMERA_CONTROL_AF_MODE + * @see ACAMERA_CONTROL_AF_TRIGGER + * @see ACAMERA_CONTROL_AWB_LOCK + * @see ACAMERA_CONTROL_AWB_MODE + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_FRAME_DURATION + * @see ACAMERA_SENSOR_SENSITIVITY + */ + CONTROL_AE_MODE_OFF = C.ACAMERA_CONTROL_AE_MODE_OFF + + /** + *

The camera device's autoexposure routine is active, + * with no flash control.

+ *

The application's values for + * ACAMERA_SENSOR_EXPOSURE_TIME, + * ACAMERA_SENSOR_SENSITIVITY, and + * ACAMERA_SENSOR_FRAME_DURATION are ignored. The + * application has control over the various + * ACAMERA_FLASH_* fields.

+ * + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_FRAME_DURATION + * @see ACAMERA_SENSOR_SENSITIVITY + */ + CONTROL_AE_MODE_ON = C.ACAMERA_CONTROL_AE_MODE_ON + + /** + *

Like ON, except that the camera device also controls + * the camera's flash unit, firing it in low-light + * conditions.

+ *

The flash may be fired during a precapture sequence + * (triggered by ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER) and + * may be fired for captures for which the + * ACAMERA_CONTROL_CAPTURE_INTENT field is set to + * STILL_CAPTURE

+ * + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * @see ACAMERA_CONTROL_CAPTURE_INTENT + */ + CONTROL_AE_MODE_ON_AUTO_FLASH = C.ACAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH + + /** + *

Like ON, except that the camera device also controls + * the camera's flash unit, always firing it for still + * captures.

+ *

The flash may be fired during a precapture sequence + * (triggered by ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER) and + * will always be fired for captures for which the + * ACAMERA_CONTROL_CAPTURE_INTENT field is set to + * STILL_CAPTURE

+ * + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * @see ACAMERA_CONTROL_CAPTURE_INTENT + */ + CONTROL_AE_MODE_ON_ALWAYS_FLASH = C.ACAMERA_CONTROL_AE_MODE_ON_ALWAYS_FLASH + + /** + *

Like ON_AUTO_FLASH, but with automatic red eye + * reduction.

+ *

If deemed necessary by the camera device, a red eye + * reduction flash will fire during the precapture + * sequence.

+ */ + CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE = C.ACAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE +) + +// ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER +type MetadataControl_ae_precapture_trigger int + +const ( + /** + *

The trigger is idle.

+ */ + CONTROL_AE_PRECAPTURE_TRIGGER_IDLE = C.ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE + + /** + *

The precapture metering sequence will be started + * by the camera device.

+ *

The exact effect of the precapture trigger depends on + * the current AE mode and state.

+ */ + CONTROL_AE_PRECAPTURE_TRIGGER_START = C.ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_START + + /** + *

The camera device will cancel any currently active or completed + * precapture metering sequence, the auto-exposure routine will return to its + * initial state.

+ */ + CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL = C.ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL +) + +// ACAMERA_CONTROL_AF_MODE +type MetadataControl_af_mode int + +const ( + /** + *

The auto-focus routine does not control the lens; + * ACAMERA_LENS_FOCUS_DISTANCE is controlled by the + * application.

+ * + * @see ACAMERA_LENS_FOCUS_DISTANCE + */ + CONTROL_AF_MODE_OFF = C.ACAMERA_CONTROL_AF_MODE_OFF + + /** + *

Basic automatic focus mode.

+ *

In this mode, the lens does not move unless + * the autofocus trigger action is called. When that trigger + * is activated, AF will transition to ACTIVE_SCAN, then to + * the outcome of the scan (FOCUSED or NOT_FOCUSED).

+ *

Always supported if lens is not fixed focus.

+ *

Use ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE to determine if lens + * is fixed-focus.

+ *

Triggering AF_CANCEL resets the lens position to default, + * and sets the AF state to INACTIVE.

+ * + * @see ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE + */ + CONTROL_AF_MODE_AUTO = C.ACAMERA_CONTROL_AF_MODE_AUTO + + /** + *

Close-up focusing mode.

+ *

In this mode, the lens does not move unless the + * autofocus trigger action is called. When that trigger is + * activated, AF will transition to ACTIVE_SCAN, then to + * the outcome of the scan (FOCUSED or NOT_FOCUSED). This + * mode is optimized for focusing on objects very close to + * the camera.

+ *

When that trigger is activated, AF will transition to + * ACTIVE_SCAN, then to the outcome of the scan (FOCUSED or + * NOT_FOCUSED). Triggering cancel AF resets the lens + * position to default, and sets the AF state to + * INACTIVE.

+ */ + CONTROL_AF_MODE_MACRO = C.ACAMERA_CONTROL_AF_MODE_MACRO + + /** + *

In this mode, the AF algorithm modifies the lens + * position continually to attempt to provide a + * constantly-in-focus image stream.

+ *

The focusing behavior should be suitable for good quality + * video recording; typically this means slower focus + * movement and no overshoots. When the AF trigger is not + * involved, the AF algorithm should start in INACTIVE state, + * and then transition into PASSIVE_SCAN and PASSIVE_FOCUSED + * states as appropriate. When the AF trigger is activated, + * the algorithm should immediately transition into + * AF_FOCUSED or AF_NOT_FOCUSED as appropriate, and lock the + * lens position until a cancel AF trigger is received.

+ *

Once cancel is received, the algorithm should transition + * back to INACTIVE and resume passive scan. Note that this + * behavior is not identical to CONTINUOUS_PICTURE, since an + * ongoing PASSIVE_SCAN must immediately be + * canceled.

+ */ + CONTROL_AF_MODE_CONTINUOUS_VIDEO = C.ACAMERA_CONTROL_AF_MODE_CONTINUOUS_VIDEO + + /** + *

In this mode, the AF algorithm modifies the lens + * position continually to attempt to provide a + * constantly-in-focus image stream.

+ *

The focusing behavior should be suitable for still image + * capture; typically this means focusing as fast as + * possible. When the AF trigger is not involved, the AF + * algorithm should start in INACTIVE state, and then + * transition into PASSIVE_SCAN and PASSIVE_FOCUSED states as + * appropriate as it attempts to maintain focus. When the AF + * trigger is activated, the algorithm should finish its + * PASSIVE_SCAN if active, and then transition into + * AF_FOCUSED or AF_NOT_FOCUSED as appropriate, and lock the + * lens position until a cancel AF trigger is received.

+ *

When the AF cancel trigger is activated, the algorithm + * should transition back to INACTIVE and then act as if it + * has just been started.

+ */ + CONTROL_AF_MODE_CONTINUOUS_PICTURE = C.ACAMERA_CONTROL_AF_MODE_CONTINUOUS_PICTURE + + /** + *

Extended depth of field (digital focus) mode.

+ *

The camera device will produce images with an extended + * depth of field automatically; no special focusing + * operations need to be done before taking a picture.

+ *

AF triggers are ignored, and the AF state will always be + * INACTIVE.

+ */ + CONTROL_AF_MODE_EDOF = C.ACAMERA_CONTROL_AF_MODE_EDOF +) + +// ACAMERA_CONTROL_AF_TRIGGER +type MetadataEnumAcameraControlAfTrigger int + +const ( + /** + *

The trigger is idle.

+ */ + CONTROL_AF_TRIGGER_IDLE = C.ACAMERA_CONTROL_AF_TRIGGER_IDLE + + /** + *

Autofocus will trigger now.

+ */ + CONTROL_AF_TRIGGER_START = C.ACAMERA_CONTROL_AF_TRIGGER_START + + /** + *

Autofocus will return to its initial + * state, and cancel any currently active trigger.

+ */ + CONTROL_AF_TRIGGER_CANCEL = C.ACAMERA_CONTROL_AF_TRIGGER_CANCEL +) + +// ACAMERA_CONTROL_AWB_LOCK +type MetadataControl_awb_lock int + +const ( + /** + *

Auto-white balance lock is disabled; the AWB + * algorithm is free to update its parameters if in AUTO + * mode.

+ */ + CONTROL_AWB_LOCK_OFF = C.ACAMERA_CONTROL_AWB_LOCK_OFF + + /** + *

Auto-white balance lock is enabled; the AWB + * algorithm will not update its parameters while the lock + * is active.

+ */ + CONTROL_AWB_LOCK_ON = C.ACAMERA_CONTROL_AWB_LOCK_ON +) + +// ACAMERA_CONTROL_AWB_MODE +type MetadataControl_awb_mode int + +const ( + /** + *

The camera device's auto-white balance routine is disabled.

+ *

The application-selected color transform matrix + * (ACAMERA_COLOR_CORRECTION_TRANSFORM) and gains + * (ACAMERA_COLOR_CORRECTION_GAINS) are used by the camera + * device for manual white balance control.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_OFF = C.ACAMERA_CONTROL_AWB_MODE_OFF + + /** + *

The camera device's auto-white balance routine is active.

+ *

The application's values for ACAMERA_COLOR_CORRECTION_TRANSFORM + * and ACAMERA_COLOR_CORRECTION_GAINS are ignored. + * For devices that support the MANUAL_POST_PROCESSING capability, the + * values used by the camera device for the transform and gains + * will be available in the capture result for this request.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_AUTO = C.ACAMERA_CONTROL_AWB_MODE_AUTO + + /** + *

The camera device's auto-white balance routine is disabled; + * the camera device uses incandescent light as the assumed scene + * illumination for white balance.

+ *

While the exact white balance transforms are up to the + * camera device, they will approximately match the CIE + * standard illuminant A.

+ *

The application's values for ACAMERA_COLOR_CORRECTION_TRANSFORM + * and ACAMERA_COLOR_CORRECTION_GAINS are ignored. + * For devices that support the MANUAL_POST_PROCESSING capability, the + * values used by the camera device for the transform and gains + * will be available in the capture result for this request.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_INCANDESCENT = C.ACAMERA_CONTROL_AWB_MODE_INCANDESCENT + + /** + *

The camera device's auto-white balance routine is disabled; + * the camera device uses fluorescent light as the assumed scene + * illumination for white balance.

+ *

While the exact white balance transforms are up to the + * camera device, they will approximately match the CIE + * standard illuminant F2.

+ *

The application's values for ACAMERA_COLOR_CORRECTION_TRANSFORM + * and ACAMERA_COLOR_CORRECTION_GAINS are ignored. + * For devices that support the MANUAL_POST_PROCESSING capability, the + * values used by the camera device for the transform and gains + * will be available in the capture result for this request.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_FLUORESCENT = C.ACAMERA_CONTROL_AWB_MODE_FLUORESCENT + + /** + *

The camera device's auto-white balance routine is disabled; + * the camera device uses warm fluorescent light as the assumed scene + * illumination for white balance.

+ *

While the exact white balance transforms are up to the + * camera device, they will approximately match the CIE + * standard illuminant F4.

+ *

The application's values for ACAMERA_COLOR_CORRECTION_TRANSFORM + * and ACAMERA_COLOR_CORRECTION_GAINS are ignored. + * For devices that support the MANUAL_POST_PROCESSING capability, the + * values used by the camera device for the transform and gains + * will be available in the capture result for this request.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_WARM_FLUORESCENT = C.ACAMERA_CONTROL_AWB_MODE_WARM_FLUORESCENT + + /** + *

The camera device's auto-white balance routine is disabled; + * the camera device uses daylight light as the assumed scene + * illumination for white balance.

+ *

While the exact white balance transforms are up to the + * camera device, they will approximately match the CIE + * standard illuminant D65.

+ *

The application's values for ACAMERA_COLOR_CORRECTION_TRANSFORM + * and ACAMERA_COLOR_CORRECTION_GAINS are ignored. + * For devices that support the MANUAL_POST_PROCESSING capability, the + * values used by the camera device for the transform and gains + * will be available in the capture result for this request.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_DAYLIGHT = C.ACAMERA_CONTROL_AWB_MODE_DAYLIGHT + + /** + *

The camera device's auto-white balance routine is disabled; + * the camera device uses cloudy daylight light as the assumed scene + * illumination for white balance.

+ *

The application's values for ACAMERA_COLOR_CORRECTION_TRANSFORM + * and ACAMERA_COLOR_CORRECTION_GAINS are ignored. + * For devices that support the MANUAL_POST_PROCESSING capability, the + * values used by the camera device for the transform and gains + * will be available in the capture result for this request.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_CLOUDY_DAYLIGHT = C.ACAMERA_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT + + /** + *

The camera device's auto-white balance routine is disabled; + * the camera device uses twilight light as the assumed scene + * illumination for white balance.

+ *

The application's values for ACAMERA_COLOR_CORRECTION_TRANSFORM + * and ACAMERA_COLOR_CORRECTION_GAINS are ignored. + * For devices that support the MANUAL_POST_PROCESSING capability, the + * values used by the camera device for the transform and gains + * will be available in the capture result for this request.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_TWILIGHT = C.ACAMERA_CONTROL_AWB_MODE_TWILIGHT + + /** + *

The camera device's auto-white balance routine is disabled; + * the camera device uses shade light as the assumed scene + * illumination for white balance.

+ *

The application's values for ACAMERA_COLOR_CORRECTION_TRANSFORM + * and ACAMERA_COLOR_CORRECTION_GAINS are ignored. + * For devices that support the MANUAL_POST_PROCESSING capability, the + * values used by the camera device for the transform and gains + * will be available in the capture result for this request.

+ * + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + */ + CONTROL_AWB_MODE_SHADE = C.ACAMERA_CONTROL_AWB_MODE_SHADE +) + +// ACAMERA_CONTROL_CAPTURE_INTENT +type MetadataControl_capture_intent int + +const ( + /** + *

The goal of this request doesn't fall into the other + * categories. The camera device will default to preview-like + * behavior.

+ */ + CONTROL_CAPTURE_INTENT_CUSTOM = C.ACAMERA_CONTROL_CAPTURE_INTENT_CUSTOM + + /** + *

This request is for a preview-like use case.

+ *

The precapture trigger may be used to start off a metering + * w/flash sequence.

+ */ + CONTROL_CAPTURE_INTENT_PREVIEW = C.ACAMERA_CONTROL_CAPTURE_INTENT_PREVIEW + + /** + *

This request is for a still capture-type + * use case.

+ *

If the flash unit is under automatic control, it may fire as needed.

+ */ + CONTROL_CAPTURE_INTENT_STILL_CAPTURE = C.ACAMERA_CONTROL_CAPTURE_INTENT_STILL_CAPTURE + + /** + *

This request is for a video recording + * use case.

+ */ + CONTROL_CAPTURE_INTENT_VIDEO_RECORD = C.ACAMERA_CONTROL_CAPTURE_INTENT_VIDEO_RECORD + + /** + *

This request is for a video snapshot (still + * image while recording video) use case.

+ *

The camera device should take the highest-quality image + * possible (given the other settings) without disrupting the + * frame rate of video recording.

+ */ + CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = C.ACAMERA_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT + + /** + *

This request is for a ZSL usecase; the + * application will stream full-resolution images and + * reprocess one or several later for a final + * capture.

+ */ + CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG = C.ACAMERA_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG + + /** + *

This request is for manual capture use case where + * the applications want to directly control the capture parameters.

+ *

For example, the application may wish to manually control + * ACAMERA_SENSOR_EXPOSURE_TIME, ACAMERA_SENSOR_SENSITIVITY, etc.

+ * + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_SENSITIVITY + */ + CONTROL_CAPTURE_INTENT_MANUAL = C.ACAMERA_CONTROL_CAPTURE_INTENT_MANUAL +) + +// ACAMERA_CONTROL_EFFECT_MODE +type MetadataControl_effect_mode int + +const ( + /** + *

No color effect will be applied.

+ */ + CONTROL_EFFECT_MODE_OFF = C.ACAMERA_CONTROL_EFFECT_MODE_OFF + + /** + *

A "monocolor" effect where the image is mapped into + * a single color.

+ *

This will typically be grayscale.

+ */ + CONTROL_EFFECT_MODE_MONO = C.ACAMERA_CONTROL_EFFECT_MODE_MONO + + /** + *

A "photo-negative" effect where the image's colors + * are inverted.

+ */ + CONTROL_EFFECT_MODE_NEGATIVE = C.ACAMERA_CONTROL_EFFECT_MODE_NEGATIVE + + /** + *

A "solarisation" effect (Sabattier effect) where the + * image is wholly or partially reversed in + * tone.

+ */ + CONTROL_EFFECT_MODE_SOLARIZE = C.ACAMERA_CONTROL_EFFECT_MODE_SOLARIZE + + /** + *

A "sepia" effect where the image is mapped into warm + * gray, red, and brown tones.

+ */ + CONTROL_EFFECT_MODE_SEPIA = C.ACAMERA_CONTROL_EFFECT_MODE_SEPIA + + /** + *

A "posterization" effect where the image uses + * discrete regions of tone rather than a continuous + * gradient of tones.

+ */ + CONTROL_EFFECT_MODE_POSTERIZE = C.ACAMERA_CONTROL_EFFECT_MODE_POSTERIZE + + /** + *

A "whiteboard" effect where the image is typically displayed + * as regions of white, with black or grey details.

+ */ + CONTROL_EFFECT_MODE_WHITEBOARD = C.ACAMERA_CONTROL_EFFECT_MODE_WHITEBOARD + + /** + *

A "blackboard" effect where the image is typically displayed + * as regions of black, with white or grey details.

+ */ + CONTROL_EFFECT_MODE_BLACKBOARD = C.ACAMERA_CONTROL_EFFECT_MODE_BLACKBOARD + + /** + *

An "aqua" effect where a blue hue is added to the image.

+ */ + CONTROL_EFFECT_MODE_AQUA = C.ACAMERA_CONTROL_EFFECT_MODE_AQUA +) + +// ACAMERA_CONTROL_MODE +type MetadataControl_mode int + +const ( + /** + *

Full application control of pipeline.

+ *

All control by the device's metering and focusing (3A) + * routines is disabled, and no other settings in + * ACAMERA_CONTROL_* have any effect, except that + * ACAMERA_CONTROL_CAPTURE_INTENT may be used by the camera + * device to select post-processing values for processing + * blocks that do not allow for manual control, or are not + * exposed by the camera API.

+ *

However, the camera device's 3A routines may continue to + * collect statistics and update their internal state so that + * when control is switched to AUTO mode, good control values + * can be immediately applied.

+ * + * @see ACAMERA_CONTROL_CAPTURE_INTENT + */ + CONTROL_MODE_OFF = C.ACAMERA_CONTROL_MODE_OFF + + /** + *

Use settings for each individual 3A routine.

+ *

Manual control of capture parameters is disabled. All + * controls in ACAMERA_CONTROL_* besides sceneMode take + * effect.

+ */ + CONTROL_MODE_AUTO = C.ACAMERA_CONTROL_MODE_AUTO + + /** + *

Use a specific scene mode.

+ *

Enabling this disables control.aeMode, control.awbMode and + * control.afMode controls; the camera device will ignore + * those settings while USE_SCENE_MODE is active (except for + * FACE_PRIORITY scene mode). Other control entries are still active. + * This setting can only be used if scene mode is supported (i.e. + * ACAMERA_CONTROL_AVAILABLE_SCENE_MODES + * contain some modes other than DISABLED).

+ * + * @see ACAMERA_CONTROL_AVAILABLE_SCENE_MODES + */ + CONTROL_MODE_USE_SCENE_MODE = C.ACAMERA_CONTROL_MODE_USE_SCENE_MODE + + /** + *

Same as OFF mode, except that this capture will not be + * used by camera device background auto-exposure, auto-white balance and + * auto-focus algorithms (3A) to update their statistics.

+ *

Specifically, the 3A routines are locked to the last + * values set from a request with AUTO, OFF, or + * USE_SCENE_MODE, and any statistics or state updates + * collected from manual captures with OFF_KEEP_STATE will be + * discarded by the camera device.

+ */ + CONTROL_MODE_OFF_KEEP_STATE = C.ACAMERA_CONTROL_MODE_OFF_KEEP_STATE +) + +// ACAMERA_CONTROL_SCENE_MODE +type MetadataControl_scene_mode int + +const ( + /** + *

Indicates that no scene modes are set for a given capture request.

+ */ + CONTROL_SCENE_MODE_DISABLED = C.ACAMERA_CONTROL_SCENE_MODE_DISABLED + + /** + *

If face detection support exists, use face + * detection data for auto-focus, auto-white balance, and + * auto-exposure routines.

+ *

If face detection statistics are disabled + * (i.e. ACAMERA_STATISTICS_FACE_DETECT_MODE is set to OFF), + * this should still operate correctly (but will not return + * face detection statistics to the framework).

+ *

Unlike the other scene modes, ACAMERA_CONTROL_AE_MODE, + * ACAMERA_CONTROL_AWB_MODE, and ACAMERA_CONTROL_AF_MODE + * remain active when FACE_PRIORITY is set.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AF_MODE + * @see ACAMERA_CONTROL_AWB_MODE + * @see ACAMERA_STATISTICS_FACE_DETECT_MODE + */ + CONTROL_SCENE_MODE_FACE_PRIORITY = C.ACAMERA_CONTROL_SCENE_MODE_FACE_PRIORITY + + /** + *

Optimized for photos of quickly moving objects.

+ *

Similar to SPORTS.

+ */ + CONTROL_SCENE_MODE_ACTION = C.ACAMERA_CONTROL_SCENE_MODE_ACTION + + /** + *

Optimized for still photos of people.

+ */ + CONTROL_SCENE_MODE_PORTRAIT = C.ACAMERA_CONTROL_SCENE_MODE_PORTRAIT + + /** + *

Optimized for photos of distant macroscopic objects.

+ */ + CONTROL_SCENE_MODE_LANDSCAPE = C.ACAMERA_CONTROL_SCENE_MODE_LANDSCAPE + + /** + *

Optimized for low-light settings.

+ */ + CONTROL_SCENE_MODE_NIGHT = C.ACAMERA_CONTROL_SCENE_MODE_NIGHT + + /** + *

Optimized for still photos of people in low-light + * settings.

+ */ + CONTROL_SCENE_MODE_NIGHT_PORTRAIT = C.ACAMERA_CONTROL_SCENE_MODE_NIGHT_PORTRAIT + + /** + *

Optimized for dim, indoor settings where flash must + * remain off.

+ */ + CONTROL_SCENE_MODE_THEATRE = C.ACAMERA_CONTROL_SCENE_MODE_THEATRE + + /** + *

Optimized for bright, outdoor beach settings.

+ */ + CONTROL_SCENE_MODE_BEACH = C.ACAMERA_CONTROL_SCENE_MODE_BEACH + + /** + *

Optimized for bright, outdoor settings containing snow.

+ */ + CONTROL_SCENE_MODE_SNOW = C.ACAMERA_CONTROL_SCENE_MODE_SNOW + + /** + *

Optimized for scenes of the setting sun.

+ */ + CONTROL_SCENE_MODE_SUNSET = C.ACAMERA_CONTROL_SCENE_MODE_SUNSET + + /** + *

Optimized to avoid blurry photos due to small amounts of + * device motion (for example: due to hand shake).

+ */ + CONTROL_SCENE_MODE_STEADYPHOTO = C.ACAMERA_CONTROL_SCENE_MODE_STEADYPHOTO + + /** + *

Optimized for nighttime photos of fireworks.

+ */ + CONTROL_SCENE_MODE_FIREWORKS = C.ACAMERA_CONTROL_SCENE_MODE_FIREWORKS + + /** + *

Optimized for photos of quickly moving people.

+ *

Similar to ACTION.

+ */ + CONTROL_SCENE_MODE_SPORTS = C.ACAMERA_CONTROL_SCENE_MODE_SPORTS + + /** + *

Optimized for dim, indoor settings with multiple moving + * people.

+ */ + CONTROL_SCENE_MODE_PARTY = C.ACAMERA_CONTROL_SCENE_MODE_PARTY + + /** + *

Optimized for dim settings where the main light source + * is a flame.

+ */ + CONTROL_SCENE_MODE_CANDLELIGHT = C.ACAMERA_CONTROL_SCENE_MODE_CANDLELIGHT + + /** + *

Optimized for accurately capturing a photo of barcode + * for use by camera applications that wish to read the + * barcode value.

+ */ + CONTROL_SCENE_MODE_BARCODE = C.ACAMERA_CONTROL_SCENE_MODE_BARCODE + + /** + *

Turn on a device-specific high dynamic range (HDR) mode.

+ *

In this scene mode, the camera device captures images + * that keep a larger range of scene illumination levels + * visible in the final image. For example, when taking a + * picture of a object in front of a bright window, both + * the object and the scene through the window may be + * visible when using HDR mode, while in normal AUTO mode, + * one or the other may be poorly exposed. As a tradeoff, + * HDR mode generally takes much longer to capture a single + * image, has no user control, and may have other artifacts + * depending on the HDR method used.

+ *

Therefore, HDR captures operate at a much slower rate + * than regular captures.

+ *

In this mode, on LIMITED or FULL devices, when a request + * is made with a ACAMERA_CONTROL_CAPTURE_INTENT of + * STILL_CAPTURE, the camera device will capture an image + * using a high dynamic range capture technique. On LEGACY + * devices, captures that target a JPEG-format output will + * be captured with HDR, and the capture intent is not + * relevant.

+ *

The HDR capture may involve the device capturing a burst + * of images internally and combining them into one, or it + * may involve the device using specialized high dynamic + * range capture hardware. In all cases, a single image is + * produced in response to a capture request submitted + * while in HDR mode.

+ *

Since substantial post-processing is generally needed to + * produce an HDR image, only YUV, PRIVATE, and JPEG + * outputs are supported for LIMITED/FULL device HDR + * captures, and only JPEG outputs are supported for LEGACY + * HDR captures. Using a RAW output for HDR capture is not + * supported.

+ *

Some devices may also support always-on HDR, which + * applies HDR processing at full frame rate. For these + * devices, intents other than STILL_CAPTURE will also + * produce an HDR output with no frame rate impact compared + * to normal operation, though the quality may be lower + * than for STILL_CAPTURE intents.

+ *

If SCENE_MODE_HDR is used with unsupported output types + * or capture intents, the images captured will be as if + * the SCENE_MODE was not enabled at all.

+ * + * @see ACAMERA_CONTROL_CAPTURE_INTENT + */ + CONTROL_SCENE_MODE_HDR = C.ACAMERA_CONTROL_SCENE_MODE_HDR +) + +// ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE +type MetadataControl_video_stabilization_mode int + +const ( + /** + *

Video stabilization is disabled.

+ */ + CONTROL_VIDEO_STABILIZATION_MODE_OFF = C.ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_OFF + + /** + *

Video stabilization is enabled.

+ */ + CONTROL_VIDEO_STABILIZATION_MODE_ON = C.ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_ON +) + +// ACAMERA_CONTROL_AE_STATE +type MetadataControl_ae_state int + +const ( + /** + *

AE is off or recently reset.

+ *

When a camera device is opened, it starts in + * this state. This is a transient state, the camera device may skip reporting + * this state in capture result.

+ */ + CONTROL_AE_STATE_INACTIVE = C.ACAMERA_CONTROL_AE_STATE_INACTIVE + + /** + *

AE doesn't yet have a good set of control values + * for the current scene.

+ *

This is a transient state, the camera device may skip + * reporting this state in capture result.

+ */ + CONTROL_AE_STATE_SEARCHING = C.ACAMERA_CONTROL_AE_STATE_SEARCHING + + /** + *

AE has a good set of control values for the + * current scene.

+ */ + CONTROL_AE_STATE_CONVERGED = C.ACAMERA_CONTROL_AE_STATE_CONVERGED + + /** + *

AE has been locked.

+ */ + CONTROL_AE_STATE_LOCKED = C.ACAMERA_CONTROL_AE_STATE_LOCKED + + /** + *

AE has a good set of control values, but flash + * needs to be fired for good quality still + * capture.

+ */ + CONTROL_AE_STATE_FLASH_REQUIRED = C.ACAMERA_CONTROL_AE_STATE_FLASH_REQUIRED + + /** + *

AE has been asked to do a precapture sequence + * and is currently executing it.

+ *

Precapture can be triggered through setting + * ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER to START. Currently + * active and completed (if it causes camera device internal AE lock) precapture + * metering sequence can be canceled through setting + * ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER to CANCEL.

+ *

Once PRECAPTURE completes, AE will transition to CONVERGED + * or FLASH_REQUIRED as appropriate. This is a transient + * state, the camera device may skip reporting this state in + * capture result.

+ * + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + */ + CONTROL_AE_STATE_PRECAPTURE = C.ACAMERA_CONTROL_AE_STATE_PRECAPTURE +) + +// ACAMERA_CONTROL_AF_STATE +type MetadataControl_af_state int + +const ( + /** + *

AF is off or has not yet tried to scan/been asked + * to scan.

+ *

When a camera device is opened, it starts in this + * state. This is a transient state, the camera device may + * skip reporting this state in capture + * result.

+ */ + CONTROL_AF_STATE_INACTIVE = C.ACAMERA_CONTROL_AF_STATE_INACTIVE + + /** + *

AF is currently performing an AF scan initiated the + * camera device in a continuous autofocus mode.

+ *

Only used by CONTINUOUS_* AF modes. This is a transient + * state, the camera device may skip reporting this state in + * capture result.

+ */ + CONTROL_AF_STATE_PASSIVE_SCAN = C.ACAMERA_CONTROL_AF_STATE_PASSIVE_SCAN + + /** + *

AF currently believes it is in focus, but may + * restart scanning at any time.

+ *

Only used by CONTINUOUS_* AF modes. This is a transient + * state, the camera device may skip reporting this state in + * capture result.

+ */ + CONTROL_AF_STATE_PASSIVE_FOCUSED = C.ACAMERA_CONTROL_AF_STATE_PASSIVE_FOCUSED + + /** + *

AF is performing an AF scan because it was + * triggered by AF trigger.

+ *

Only used by AUTO or MACRO AF modes. This is a transient + * state, the camera device may skip reporting this state in + * capture result.

+ */ + CONTROL_AF_STATE_ACTIVE_SCAN = C.ACAMERA_CONTROL_AF_STATE_ACTIVE_SCAN + + /** + *

AF believes it is focused correctly and has locked + * focus.

+ *

This state is reached only after an explicit START AF trigger has been + * sent (ACAMERA_CONTROL_AF_TRIGGER), when good focus has been obtained.

+ *

The lens will remain stationary until the AF mode (ACAMERA_CONTROL_AF_MODE) is changed or + * a new AF trigger is sent to the camera device (ACAMERA_CONTROL_AF_TRIGGER).

+ * + * @see ACAMERA_CONTROL_AF_MODE + * @see ACAMERA_CONTROL_AF_TRIGGER + */ + CONTROL_AF_STATE_FOCUSED_LOCKED = C.ACAMERA_CONTROL_AF_STATE_FOCUSED_LOCKED + + /** + *

AF has failed to focus successfully and has locked + * focus.

+ *

This state is reached only after an explicit START AF trigger has been + * sent (ACAMERA_CONTROL_AF_TRIGGER), when good focus cannot be obtained.

+ *

The lens will remain stationary until the AF mode (ACAMERA_CONTROL_AF_MODE) is changed or + * a new AF trigger is sent to the camera device (ACAMERA_CONTROL_AF_TRIGGER).

+ * + * @see ACAMERA_CONTROL_AF_MODE + * @see ACAMERA_CONTROL_AF_TRIGGER + */ + CONTROL_AF_STATE_NOT_FOCUSED_LOCKED = C.ACAMERA_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED + + /** + *

AF finished a passive scan without finding focus, + * and may restart scanning at any time.

+ *

Only used by CONTINUOUS_* AF modes. This is a transient state, the camera + * device may skip reporting this state in capture result.

+ *

LEGACY camera devices do not support this state. When a passive + * scan has finished, it will always go to PASSIVE_FOCUSED.

+ */ + CONTROL_AF_STATE_PASSIVE_UNFOCUSED = C.ACAMERA_CONTROL_AF_STATE_PASSIVE_UNFOCUSED +) + +// ACAMERA_CONTROL_AWB_STATE +type MetadataControl_awb_state int + +const ( + /** + *

AWB is not in auto mode, or has not yet started metering.

+ *

When a camera device is opened, it starts in this + * state. This is a transient state, the camera device may + * skip reporting this state in capture + * result.

+ */ + CONTROL_AWB_STATE_INACTIVE = C.ACAMERA_CONTROL_AWB_STATE_INACTIVE + + /** + *

AWB doesn't yet have a good set of control + * values for the current scene.

+ *

This is a transient state, the camera device + * may skip reporting this state in capture result.

+ */ + CONTROL_AWB_STATE_SEARCHING = C.ACAMERA_CONTROL_AWB_STATE_SEARCHING + + /** + *

AWB has a good set of control values for the + * current scene.

+ */ + CONTROL_AWB_STATE_CONVERGED = C.ACAMERA_CONTROL_AWB_STATE_CONVERGED + + /** + *

AWB has been locked.

+ */ + CONTROL_AWB_STATE_LOCKED = C.ACAMERA_CONTROL_AWB_STATE_LOCKED +) + +// ACAMERA_CONTROL_AE_LOCK_AVAILABLE +type MetadataControl_ae_lock_available int + +const ( + CONTROL_AE_LOCK_AVAILABLE_FALSE = C.ACAMERA_CONTROL_AE_LOCK_AVAILABLE_FALSE + + CONTROL_AE_LOCK_AVAILABLE_TRUE = C.ACAMERA_CONTROL_AE_LOCK_AVAILABLE_TRUE +) + +// ACAMERA_CONTROL_AWB_LOCK_AVAILABLE +type MetadataControl_awb_lock_available int + +const ( + CONTROL_AWB_LOCK_AVAILABLE_FALSE = C.ACAMERA_CONTROL_AWB_LOCK_AVAILABLE_FALSE + + CONTROL_AWB_LOCK_AVAILABLE_TRUE = C.ACAMERA_CONTROL_AWB_LOCK_AVAILABLE_TRUE +) + +// ACAMERA_CONTROL_ENABLE_ZSL +type MetadataControl_enable_zsl int + +const ( + /** + *

Requests with ACAMERA_CONTROL_CAPTURE_INTENT == STILL_CAPTURE must be captured + * after previous requests.

+ * + * @see ACAMERA_CONTROL_CAPTURE_INTENT + */ + CONTROL_ENABLE_ZSL_FALSE = C.ACAMERA_CONTROL_ENABLE_ZSL_FALSE + + /** + *

Requests with ACAMERA_CONTROL_CAPTURE_INTENT == STILL_CAPTURE may or may not be + * captured before previous requests.

+ * + * @see ACAMERA_CONTROL_CAPTURE_INTENT + */ + CONTROL_ENABLE_ZSL_TRUE = C.ACAMERA_CONTROL_ENABLE_ZSL_TRUE +) + +// ACAMERA_EDGE_MODE +type MetadataEdge_mode int + +const ( + /** + *

No edge enhancement is applied.

+ */ + EDGE_MODE_OFF = C.ACAMERA_EDGE_MODE_OFF + + /** + *

Apply edge enhancement at a quality level that does not slow down frame rate + * relative to sensor output. It may be the same as OFF if edge enhancement will + * slow down frame rate relative to sensor.

+ */ + EDGE_MODE_FAST = C.ACAMERA_EDGE_MODE_FAST + + /** + *

Apply high-quality edge enhancement, at a cost of possibly reduced output frame rate.

+ */ + EDGE_MODE_HIGH_QUALITY = C.ACAMERA_EDGE_MODE_HIGH_QUALITY + + /** + *

Edge enhancement is applied at different levels for different output streams, + * based on resolution. Streams at maximum recording resolution (see {@link + * ACameraDevice_createCaptureSession}) or below have + * edge enhancement applied, while higher-resolution streams have no edge enhancement + * applied. The level of edge enhancement for low-resolution streams is tuned so that + * frame rate is not impacted, and the quality is equal to or better than FAST (since it + * is only applied to lower-resolution outputs, quality may improve from FAST).

+ *

This mode is intended to be used by applications operating in a zero-shutter-lag mode + * with YUV or PRIVATE reprocessing, where the application continuously captures + * high-resolution intermediate buffers into a circular buffer, from which a final image is + * produced via reprocessing when a user takes a picture. For such a use case, the + * high-resolution buffers must not have edge enhancement applied to maximize efficiency of + * preview and to avoid double-applying enhancement when reprocessed, while low-resolution + * buffers (used for recording or preview, generally) need edge enhancement applied for + * reasonable preview quality.

+ *

This mode is guaranteed to be supported by devices that support either the + * YUV_REPROCESSING or PRIVATE_REPROCESSING capabilities + * (ACAMERA_REQUEST_AVAILABLE_CAPABILITIES lists either of those capabilities) and it will + * be the default mode for CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.

+ * + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + */ + EDGE_MODE_ZERO_SHUTTER_LAG = C.ACAMERA_EDGE_MODE_ZERO_SHUTTER_LAG +) + +// ACAMERA_FLASH_MODE +type MetadataFlash_mode int + +const ( + /** + *

Do not fire the flash for this capture.

+ */ + FLASH_MODE_OFF = C.ACAMERA_FLASH_MODE_OFF + + /** + *

If the flash is available and charged, fire flash + * for this capture.

+ */ + FLASH_MODE_SINGLE = C.ACAMERA_FLASH_MODE_SINGLE + + /** + *

Transition flash to continuously on.

+ */ + FLASH_MODE_TORCH = C.ACAMERA_FLASH_MODE_TORCH +) + +// ACAMERA_FLASH_STATE +type MetadataFlash_state int + +const ( + /** + *

No flash on camera.

+ */ + FLASH_STATE_UNAVAILABLE = C.ACAMERA_FLASH_STATE_UNAVAILABLE + + /** + *

Flash is charging and cannot be fired.

+ */ + FLASH_STATE_CHARGING = C.ACAMERA_FLASH_STATE_CHARGING + + /** + *

Flash is ready to fire.

+ */ + FLASH_STATE_READY = C.ACAMERA_FLASH_STATE_READY + + /** + *

Flash fired for this capture.

+ */ + FLASH_STATE_FIRED = C.ACAMERA_FLASH_STATE_FIRED + + /** + *

Flash partially illuminated this frame.

+ *

This is usually due to the next or previous frame having + * the flash fire, and the flash spilling into this capture + * due to hardware limitations.

+ */ + FLASH_STATE_PARTIAL = C.ACAMERA_FLASH_STATE_PARTIAL +) + +// ACAMERA_FLASH_INFO_AVAILABLE +type MetadataFlash_info_available int + +const ( + FLASH_INFO_AVAILABLE_FALSE = C.ACAMERA_FLASH_INFO_AVAILABLE_FALSE + + FLASH_INFO_AVAILABLE_TRUE = C.ACAMERA_FLASH_INFO_AVAILABLE_TRUE +) + +// ACAMERA_HOT_PIXEL_MODE +type MetadataHot_pixel_mode int + +const ( + /** + *

No hot pixel correction is applied.

+ *

The frame rate must not be reduced relative to sensor raw output + * for this option.

+ *

The hotpixel map may be returned in ACAMERA_STATISTICS_HOT_PIXEL_MAP.

+ * + * @see ACAMERA_STATISTICS_HOT_PIXEL_MAP + */ + HOT_PIXEL_MODE_OFF = C.ACAMERA_HOT_PIXEL_MODE_OFF + + /** + *

Hot pixel correction is applied, without reducing frame + * rate relative to sensor raw output.

+ *

The hotpixel map may be returned in ACAMERA_STATISTICS_HOT_PIXEL_MAP.

+ * + * @see ACAMERA_STATISTICS_HOT_PIXEL_MAP + */ + HOT_PIXEL_MODE_FAST = C.ACAMERA_HOT_PIXEL_MODE_FAST + + /** + *

High-quality hot pixel correction is applied, at a cost + * of possibly reduced frame rate relative to sensor raw output.

+ *

The hotpixel map may be returned in ACAMERA_STATISTICS_HOT_PIXEL_MAP.

+ * + * @see ACAMERA_STATISTICS_HOT_PIXEL_MAP + */ + HOT_PIXEL_MODE_HIGH_QUALITY = C.ACAMERA_HOT_PIXEL_MODE_HIGH_QUALITY +) + +// ACAMERA_LENS_OPTICAL_STABILIZATION_MODE +type MetadataLens_optical_stabilization_mode int + +const ( + /** + *

Optical stabilization is unavailable.

+ */ + LENS_OPTICAL_STABILIZATION_MODE_OFF = C.ACAMERA_LENS_OPTICAL_STABILIZATION_MODE_OFF + + /** + *

Optical stabilization is enabled.

+ */ + LENS_OPTICAL_STABILIZATION_MODE_ON = C.ACAMERA_LENS_OPTICAL_STABILIZATION_MODE_ON +) + +// ACAMERA_LENS_FACING +type MetadataLens_facing int + +const ( + /** + *

The camera device faces the same direction as the device's screen.

+ */ + LENS_FACING_FRONT = C.ACAMERA_LENS_FACING_FRONT + + /** + *

The camera device faces the opposite direction as the device's screen.

+ */ + LENS_FACING_BACK = C.ACAMERA_LENS_FACING_BACK + + /** + *

The camera device is an external camera, and has no fixed facing relative to the + * device's screen.

+ */ + LENS_FACING_EXTERNAL = C.ACAMERA_LENS_FACING_EXTERNAL +) + +// ACAMERA_LENS_STATE +type MetadataLens_state int + +const ( + /** + *

The lens parameters (ACAMERA_LENS_FOCAL_LENGTH, ACAMERA_LENS_FOCUS_DISTANCE, + * ACAMERA_LENS_FILTER_DENSITY and ACAMERA_LENS_APERTURE) are not changing.

+ * + * @see ACAMERA_LENS_APERTURE + * @see ACAMERA_LENS_FILTER_DENSITY + * @see ACAMERA_LENS_FOCAL_LENGTH + * @see ACAMERA_LENS_FOCUS_DISTANCE + */ + LENS_STATE_STATIONARY = C.ACAMERA_LENS_STATE_STATIONARY + + /** + *

One or several of the lens parameters + * (ACAMERA_LENS_FOCAL_LENGTH, ACAMERA_LENS_FOCUS_DISTANCE, + * ACAMERA_LENS_FILTER_DENSITY or ACAMERA_LENS_APERTURE) is + * currently changing.

+ * + * @see ACAMERA_LENS_APERTURE + * @see ACAMERA_LENS_FILTER_DENSITY + * @see ACAMERA_LENS_FOCAL_LENGTH + * @see ACAMERA_LENS_FOCUS_DISTANCE + */ + LENS_STATE_MOVING = C.ACAMERA_LENS_STATE_MOVING +) + +// ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION +type MetadataLens_info_focus_distance_calibration int + +const ( + /** + *

The lens focus distance is not accurate, and the units used for + * ACAMERA_LENS_FOCUS_DISTANCE do not correspond to any physical units.

+ *

Setting the lens to the same focus distance on separate occasions may + * result in a different real focus distance, depending on factors such + * as the orientation of the device, the age of the focusing mechanism, + * and the device temperature. The focus distance value will still be + * in the range of [0, ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE], where 0 + * represents the farthest focus.

+ * + * @see ACAMERA_LENS_FOCUS_DISTANCE + * @see ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE + */ + LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED = C.ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED + + /** + *

The lens focus distance is measured in diopters.

+ *

However, setting the lens to the same focus distance + * on separate occasions may result in a different real + * focus distance, depending on factors such as the + * orientation of the device, the age of the focusing + * mechanism, and the device temperature.

+ */ + LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE = C.ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE + + /** + *

The lens focus distance is measured in diopters, and + * is calibrated.

+ *

The lens mechanism is calibrated so that setting the + * same focus distance is repeatable on multiple + * occasions with good accuracy, and the focus distance + * corresponds to the real physical distance to the plane + * of best focus.

+ */ + LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED = C.ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED +) + +// ACAMERA_NOISE_REDUCTION_MODE +type MetadataNoise_reduction_mode int + +const ( + /** + *

No noise reduction is applied.

+ */ + NOISE_REDUCTION_MODE_OFF = C.ACAMERA_NOISE_REDUCTION_MODE_OFF + + /** + *

Noise reduction is applied without reducing frame rate relative to sensor + * output. It may be the same as OFF if noise reduction will reduce frame rate + * relative to sensor.

+ */ + NOISE_REDUCTION_MODE_FAST = C.ACAMERA_NOISE_REDUCTION_MODE_FAST + + /** + *

High-quality noise reduction is applied, at the cost of possibly reduced frame + * rate relative to sensor output.

+ */ + NOISE_REDUCTION_MODE_HIGH_QUALITY = C.ACAMERA_NOISE_REDUCTION_MODE_HIGH_QUALITY + + /** + *

MINIMAL noise reduction is applied without reducing frame rate relative to + * sensor output.

+ */ + NOISE_REDUCTION_MODE_MINIMAL = C.ACAMERA_NOISE_REDUCTION_MODE_MINIMAL + + /** + *

Noise reduction is applied at different levels for different output streams, + * based on resolution. Streams at maximum recording resolution (see {@link + * ACameraDevice_createCaptureSession}) or below have noise + * reduction applied, while higher-resolution streams have MINIMAL (if supported) or no + * noise reduction applied (if MINIMAL is not supported.) The degree of noise reduction + * for low-resolution streams is tuned so that frame rate is not impacted, and the quality + * is equal to or better than FAST (since it is only applied to lower-resolution outputs, + * quality may improve from FAST).

+ *

This mode is intended to be used by applications operating in a zero-shutter-lag mode + * with YUV or PRIVATE reprocessing, where the application continuously captures + * high-resolution intermediate buffers into a circular buffer, from which a final image is + * produced via reprocessing when a user takes a picture. For such a use case, the + * high-resolution buffers must not have noise reduction applied to maximize efficiency of + * preview and to avoid over-applying noise filtering when reprocessing, while + * low-resolution buffers (used for recording or preview, generally) need noise reduction + * applied for reasonable preview quality.

+ *

This mode is guaranteed to be supported by devices that support either the + * YUV_REPROCESSING or PRIVATE_REPROCESSING capabilities + * (ACAMERA_REQUEST_AVAILABLE_CAPABILITIES lists either of those capabilities) and it will + * be the default mode for CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.

+ * + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + */ + NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG = C.ACAMERA_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG +) + +// ACAMERA_REQUEST_AVAILABLE_CAPABILITIES +type MetadataRequest_available_capabilities int + +const ( + /** + *

The minimal set of capabilities that every camera + * device (regardless of ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL) + * supports.

+ *

This capability is listed by all normal devices, and + * indicates that the camera device has a feature set + * that's comparable to the baseline requirements for the + * older android.hardware.Camera API.

+ *

Devices with the DEPTH_OUTPUT capability might not list this + * capability, indicating that they support only depth measurement, + * not standard color output.

+ * + * @see ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL + */ + REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = C.ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE + + /** + *

The camera device can be manually controlled (3A algorithms such + * as auto-exposure, and auto-focus can be bypassed). + * The camera device supports basic manual control of the sensor image + * acquisition related stages. This means the following controls are + * guaranteed to be supported:

+ *
    + *
  • Manual frame duration control
      + *
    • ACAMERA_SENSOR_FRAME_DURATION
    • + *
    • ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION
    • + *
    + *
  • + *
  • Manual exposure control
      + *
    • ACAMERA_SENSOR_EXPOSURE_TIME
    • + *
    • ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE
    • + *
    + *
  • + *
  • Manual sensitivity control
      + *
    • ACAMERA_SENSOR_SENSITIVITY
    • + *
    • ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE
    • + *
    + *
  • + *
  • Manual lens control (if the lens is adjustable)
      + *
    • ACAMERA_LENS_*
    • + *
    + *
  • + *
  • Manual flash control (if a flash unit is present)
      + *
    • ACAMERA_FLASH_*
    • + *
    + *
  • + *
  • Manual black level locking
      + *
    • ACAMERA_BLACK_LEVEL_LOCK
    • + *
    + *
  • + *
  • Auto exposure lock
      + *
    • ACAMERA_CONTROL_AE_LOCK
    • + *
    + *
  • + *
+ *

If any of the above 3A algorithms are enabled, then the camera + * device will accurately report the values applied by 3A in the + * result.

+ *

A given camera device may also support additional manual sensor controls, + * but this capability only covers the above list of controls.

+ *

If this is supported, android.scaler.streamConfigurationMap will + * additionally return a min frame duration that is greater than + * zero for each supported size-format combination.

+ * + * @see ACAMERA_BLACK_LEVEL_LOCK + * @see ACAMERA_CONTROL_AE_LOCK + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_FRAME_DURATION + * @see ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE + * @see ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION + * @see ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE + * @see ACAMERA_SENSOR_SENSITIVITY + */ + REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = C.ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR + + /** + *

The camera device post-processing stages can be manually controlled. + * The camera device supports basic manual control of the image post-processing + * stages. This means the following controls are guaranteed to be supported:

+ *
    + *
  • + *

    Manual tonemap control

    + *
      + *
    • android.tonemap.curve
    • + *
    • ACAMERA_TONEMAP_MODE
    • + *
    • ACAMERA_TONEMAP_MAX_CURVE_POINTS
    • + *
    • ACAMERA_TONEMAP_GAMMA
    • + *
    • ACAMERA_TONEMAP_PRESET_CURVE
    • + *
    + *
  • + *
  • + *

    Manual white balance control

    + *
      + *
    • ACAMERA_COLOR_CORRECTION_TRANSFORM
    • + *
    • ACAMERA_COLOR_CORRECTION_GAINS
    • + *
    + *
  • + *
  • Manual lens shading map control
      + *
    • ACAMERA_SHADING_MODE
    • + *
    • ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE
    • + *
    • ACAMERA_STATISTICS_LENS_SHADING_MAP
    • + *
    • ACAMERA_LENS_INFO_SHADING_MAP_SIZE
    • + *
    + *
  • + *
  • Manual aberration correction control (if aberration correction is supported)
      + *
    • ACAMERA_COLOR_CORRECTION_ABERRATION_MODE
    • + *
    • ACAMERA_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
    • + *
    + *
  • + *
  • Auto white balance lock
      + *
    • ACAMERA_CONTROL_AWB_LOCK
    • + *
    + *
  • + *
+ *

If auto white balance is enabled, then the camera device + * will accurately report the values applied by AWB in the result.

+ *

A given camera device may also support additional post-processing + * controls, but this capability only covers the above list of controls.

+ * + * @see ACAMERA_COLOR_CORRECTION_ABERRATION_MODE + * @see ACAMERA_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES + * @see ACAMERA_COLOR_CORRECTION_GAINS + * @see ACAMERA_COLOR_CORRECTION_TRANSFORM + * @see ACAMERA_CONTROL_AWB_LOCK + * @see ACAMERA_LENS_INFO_SHADING_MAP_SIZE + * @see ACAMERA_SHADING_MODE + * @see ACAMERA_STATISTICS_LENS_SHADING_MAP + * @see ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE + * @see ACAMERA_TONEMAP_GAMMA + * @see ACAMERA_TONEMAP_MAX_CURVE_POINTS + * @see ACAMERA_TONEMAP_MODE + * @see ACAMERA_TONEMAP_PRESET_CURVE + */ + REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = C.ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING + + /** + *

The camera device supports outputting RAW buffers and + * metadata for interpreting them.

+ *

Devices supporting the RAW capability allow both for + * saving DNG files, and for direct application processing of + * raw sensor images.

+ *
    + *
  • RAW_SENSOR is supported as an output format.
  • + *
  • The maximum available resolution for RAW_SENSOR streams + * will match either the value in + * ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE or + * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE.
  • + *
  • All DNG-related optional metadata entries are provided + * by the camera device.
  • + *
+ * + * @see ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE + * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE + */ + REQUEST_AVAILABLE_CAPABILITIES_RAW = C.ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW + + /** + *

The camera device supports accurately reporting the sensor settings for many of + * the sensor controls while the built-in 3A algorithm is running. This allows + * reporting of sensor settings even when these settings cannot be manually changed.

+ *

The values reported for the following controls are guaranteed to be available + * in the CaptureResult, including when 3A is enabled:

+ *
    + *
  • Exposure control
      + *
    • ACAMERA_SENSOR_EXPOSURE_TIME
    • + *
    + *
  • + *
  • Sensitivity control
      + *
    • ACAMERA_SENSOR_SENSITIVITY
    • + *
    + *
  • + *
  • Lens controls (if the lens is adjustable)
      + *
    • ACAMERA_LENS_FOCUS_DISTANCE
    • + *
    • ACAMERA_LENS_APERTURE
    • + *
    + *
  • + *
+ *

This capability is a subset of the MANUAL_SENSOR control capability, and will + * always be included if the MANUAL_SENSOR capability is available.

+ * + * @see ACAMERA_LENS_APERTURE + * @see ACAMERA_LENS_FOCUS_DISTANCE + * @see ACAMERA_SENSOR_EXPOSURE_TIME + * @see ACAMERA_SENSOR_SENSITIVITY + */ + REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS = C.ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS + + /** + *

The camera device supports capturing high-resolution images at >= 20 frames per + * second, in at least the uncompressed YUV format, when post-processing settings are set + * to FAST. Additionally, maximum-resolution images can be captured at >= 10 frames + * per second. Here, 'high resolution' means at least 8 megapixels, or the maximum + * resolution of the device, whichever is smaller.

+ *

More specifically, this means that at least one output {@link + * AIMAGE_FORMAT_YUV_420_888} size listed in + * {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} is larger or equal to the + * 'high resolution' defined above, and can be captured at at least 20 fps. + * For the largest {@link AIMAGE_FORMAT_YUV_420_888} size listed in + * {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}, camera device can capture this + * size for at least 10 frames per second. + * Also the ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES entry lists at least one FPS range + * where the minimum FPS is >= 1 / minimumFrameDuration for the largest YUV_420_888 size.

+ *

If the device supports the {@link AIMAGE_FORMAT_RAW10}, {@link + * AIMAGE_FORMAT_RAW12}, then those can also be captured at the same rate + * as the maximum-size YUV_420_888 resolution is.

+ *

In addition, the ACAMERA_SYNC_MAX_LATENCY field is guaranted to have a value between 0 + * and 4, inclusive. ACAMERA_CONTROL_AE_LOCK_AVAILABLE and ACAMERA_CONTROL_AWB_LOCK_AVAILABLE + * are also guaranteed to be true so burst capture with these two locks ON yields + * consistent image output.

+ * + * @see ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES + * @see ACAMERA_CONTROL_AE_LOCK_AVAILABLE + * @see ACAMERA_CONTROL_AWB_LOCK_AVAILABLE + * @see ACAMERA_SYNC_MAX_LATENCY + */ + REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE = C.ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE + + /** + *

The camera device can produce depth measurements from its field of view.

+ *

This capability requires the camera device to support the following:

+ *
    + *
  • {@link AIMAGE_FORMAT_DEPTH16} is supported as an output format.
  • + *
  • {@link AIMAGE_FORMAT_DEPTH_POINT_CLOUD} is optionally supported as an + * output format.
  • + *
  • This camera device, and all camera devices with the same ACAMERA_LENS_FACING, + * will list the following calibration entries in {@link ACameraMetadata} from both + * {@link ACameraManager_getCameraCharacteristics} and + * {@link ACameraCaptureSession_captureCallback_result}:
      + *
    • ACAMERA_LENS_POSE_TRANSLATION
    • + *
    • ACAMERA_LENS_POSE_ROTATION
    • + *
    • ACAMERA_LENS_INTRINSIC_CALIBRATION
    • + *
    • ACAMERA_LENS_RADIAL_DISTORTION
    • + *
    + *
  • + *
  • The ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE entry is listed by this device.
  • + *
  • A LIMITED camera with only the DEPTH_OUTPUT capability does not have to support + * normal YUV_420_888, JPEG, and PRIV-format outputs. It only has to support the DEPTH16 + * format.
  • + *
+ *

Generally, depth output operates at a slower frame rate than standard color capture, + * so the DEPTH16 and DEPTH_POINT_CLOUD formats will commonly have a stall duration that + * should be accounted for (see + * {@link ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS}). + * On a device that supports both depth and color-based output, to enable smooth preview, + * using a repeating burst is recommended, where a depth-output target is only included + * once every N frames, where N is the ratio between preview output rate and depth output + * rate, including depth stall time.

+ * + * @see ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE + * @see ACAMERA_LENS_FACING + * @see ACAMERA_LENS_INTRINSIC_CALIBRATION + * @see ACAMERA_LENS_POSE_ROTATION + * @see ACAMERA_LENS_POSE_TRANSLATION + * @see ACAMERA_LENS_RADIAL_DISTORTION + */ + REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT = C.ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT +) + +// ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS +type MetadataScaler_available_stream_configurations int + +const ( + SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT = C.ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT + + SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT = C.ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT +) + +// ACAMERA_SCALER_CROPPING_TYPE +type MetadataScaler_cropping_type int + +const ( + /** + *

The camera device only supports centered crop regions.

+ */ + SCALER_CROPPING_TYPE_CENTER_ONLY = C.ACAMERA_SCALER_CROPPING_TYPE_CENTER_ONLY + + /** + *

The camera device supports arbitrarily chosen crop regions.

+ */ + SCALER_CROPPING_TYPE_FREEFORM = C.ACAMERA_SCALER_CROPPING_TYPE_FREEFORM +) + +// ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 +type MetadataSensor_reference_illuminant1 int + +const ( + SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT + + SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT + + /** + *

Incandescent light

+ */ + SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN + + SENSOR_REFERENCE_ILLUMINANT1_FLASH = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FLASH + + SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER + + SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER + + SENSOR_REFERENCE_ILLUMINANT1_SHADE = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_SHADE + + /** + *

D 5700 - 7100K

+ */ + SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT + + /** + *

N 4600 - 5400K

+ */ + SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT + + /** + *

W 3900 - 4500K

+ */ + SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT + + /** + *

WW 3200 - 3700K

+ */ + SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT + + SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A + + SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B + + SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C + + SENSOR_REFERENCE_ILLUMINANT1_D55 = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D55 + + SENSOR_REFERENCE_ILLUMINANT1_D65 = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D65 + + SENSOR_REFERENCE_ILLUMINANT1_D75 = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D75 + + SENSOR_REFERENCE_ILLUMINANT1_D50 = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D50 + + SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN = C.ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN +) + +// ACAMERA_SENSOR_TEST_PATTERN_MODE +type MetadataSensor_test_pattern_mode int + +const ( + /** + *

No test pattern mode is used, and the camera + * device returns captures from the image sensor.

+ *

This is the default if the key is not set.

+ */ + SENSOR_TEST_PATTERN_MODE_OFF = C.ACAMERA_SENSOR_TEST_PATTERN_MODE_OFF + + /** + *

Each pixel in [R, G_even, G_odd, B] is replaced by its + * respective color channel provided in + * ACAMERA_SENSOR_TEST_PATTERN_DATA.

+ *

For example:

+ *
android.testPatternData = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0]
+	 * 
+ *

All green pixels are 100% green. All red/blue pixels are black.

+ *
android.testPatternData = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0]
+	 * 
+ *

All red pixels are 100% red. Only the odd green pixels + * are 100% green. All blue pixels are 100% black.

+ * + * @see ACAMERA_SENSOR_TEST_PATTERN_DATA + */ + SENSOR_TEST_PATTERN_MODE_SOLID_COLOR = C.ACAMERA_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR + + /** + *

All pixel data is replaced with an 8-bar color pattern.

+ *

The vertical bars (left-to-right) are as follows:

+ *
    + *
  • 100% white
  • + *
  • yellow
  • + *
  • cyan
  • + *
  • green
  • + *
  • magenta
  • + *
  • red
  • + *
  • blue
  • + *
  • black
  • + *
+ *

In general the image would look like the following:

+ *
W Y C G M R B K
+	 * W Y C G M R B K
+	 * W Y C G M R B K
+	 * W Y C G M R B K
+	 * W Y C G M R B K
+	 * . . . . . . . .
+	 * . . . . . . . .
+	 * . . . . . . . .
+	 *
+	 * (B = Blue, K = Black)
+	 * 
+ *

Each bar should take up 1/8 of the sensor pixel array width. + * When this is not possible, the bar size should be rounded + * down to the nearest integer and the pattern can repeat + * on the right side.

+ *

Each bar's height must always take up the full sensor + * pixel array height.

+ *

Each pixel in this test pattern must be set to either + * 0% intensity or 100% intensity.

+ */ + SENSOR_TEST_PATTERN_MODE_COLOR_BARS = C.ACAMERA_SENSOR_TEST_PATTERN_MODE_COLOR_BARS + + /** + *

The test pattern is similar to COLOR_BARS, except that + * each bar should start at its specified color at the top, + * and fade to gray at the bottom.

+ *

Furthermore each bar is further subdivided into a left and + * right half. The left half should have a smooth gradient, + * and the right half should have a quantized gradient.

+ *

In particular, the right half's should consist of blocks of the + * same color for 1/16th active sensor pixel array width.

+ *

The least significant bits in the quantized gradient should + * be copied from the most significant bits of the smooth gradient.

+ *

The height of each bar should always be a multiple of 128. + * When this is not the case, the pattern should repeat at the bottom + * of the image.

+ */ + SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY = C.ACAMERA_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY + + /** + *

All pixel data is replaced by a pseudo-random sequence + * generated from a PN9 512-bit sequence (typically implemented + * in hardware with a linear feedback shift register).

+ *

The generator should be reset at the beginning of each frame, + * and thus each subsequent raw frame with this test pattern should + * be exactly the same as the last.

+ */ + SENSOR_TEST_PATTERN_MODE_PN9 = C.ACAMERA_SENSOR_TEST_PATTERN_MODE_PN9 + + /** + *

The first custom test pattern. All custom patterns that are + * available only on this camera device are at least this numeric + * value.

+ *

All of the custom test patterns will be static + * (that is the raw image must not vary from frame to frame).

+ */ + SENSOR_TEST_PATTERN_MODE_CUSTOM1 = C.ACAMERA_SENSOR_TEST_PATTERN_MODE_CUSTOM1 +) + +// ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT +type MetadataSensor_info_color_filter_arrangement int + +const ( + SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB = C.ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB + + SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG = C.ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG + + SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG = C.ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG + + SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR = C.ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR + + /** + *

Sensor is not Bayer; output has 3 16-bit + * values for each pixel, instead of just 1 16-bit value + * per pixel.

+ */ + SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB = C.ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB +) + +// ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE +type MetadataSensor_info_timestamp_source int + +const ( + /** + *

Timestamps from ACAMERA_SENSOR_TIMESTAMP are in nanoseconds and monotonic, + * but can not be compared to timestamps from other subsystems + * (e.g. accelerometer, gyro etc.), or other instances of the same or different + * camera devices in the same system. Timestamps between streams and results for + * a single camera instance are comparable, and the timestamps for all buffers + * and the result metadata generated by a single capture are identical.

+ * + * @see ACAMERA_SENSOR_TIMESTAMP + */ + SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN = C.ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN + + /** + *

Timestamps from ACAMERA_SENSOR_TIMESTAMP are in the same timebase as + * elapsedRealtimeNanos + * (or CLOCK_BOOTTIME), and they can be compared to other timestamps using that base.

+ * + * @see ACAMERA_SENSOR_TIMESTAMP + */ + SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME = C.ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME +) + +// ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED +type MetadataSensor_info_lens_shading_applied int + +const ( + SENSOR_INFO_LENS_SHADING_APPLIED_FALSE = C.ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE + + SENSOR_INFO_LENS_SHADING_APPLIED_TRUE = C.ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE +) + +// ACAMERA_SHADING_MODE +type MetadataShading_mode int + +const ( + /** + *

No lens shading correction is applied.

+ */ + SHADING_MODE_OFF = C.ACAMERA_SHADING_MODE_OFF + + /** + *

Apply lens shading corrections, without slowing + * frame rate relative to sensor raw output

+ */ + SHADING_MODE_FAST = C.ACAMERA_SHADING_MODE_FAST + + /** + *

Apply high-quality lens shading correction, at the + * cost of possibly reduced frame rate.

+ */ + SHADING_MODE_HIGH_QUALITY = C.ACAMERA_SHADING_MODE_HIGH_QUALITY +) + +// ACAMERA_STATISTICS_FACE_DETECT_MODE +type MetadataStatistics_face_detect_mode int + +const ( + /** + *

Do not include face detection statistics in capture + * results.

+ */ + STATISTICS_FACE_DETECT_MODE_OFF = C.ACAMERA_STATISTICS_FACE_DETECT_MODE_OFF + + /** + *

Return face rectangle and confidence values only.

+ */ + STATISTICS_FACE_DETECT_MODE_SIMPLE = C.ACAMERA_STATISTICS_FACE_DETECT_MODE_SIMPLE + + /** + *

Return all face + * metadata.

+ *

In this mode, face rectangles, scores, landmarks, and face IDs are all valid.

+ */ + STATISTICS_FACE_DETECT_MODE_FULL = C.ACAMERA_STATISTICS_FACE_DETECT_MODE_FULL +) + +// ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE +type MetadataStatistics_hot_pixel_map_mode int + +const ( + /** + *

Hot pixel map production is disabled.

+ */ + STATISTICS_HOT_PIXEL_MAP_MODE_OFF = C.ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE_OFF + + /** + *

Hot pixel map production is enabled.

+ */ + STATISTICS_HOT_PIXEL_MAP_MODE_ON = C.ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE_ON +) + +// ACAMERA_STATISTICS_SCENE_FLICKER +type MetadataStatistics_scene_flicker int + +const ( + /** + *

The camera device does not detect any flickering illumination + * in the current scene.

+ */ + STATISTICS_SCENE_FLICKER_NONE = C.ACAMERA_STATISTICS_SCENE_FLICKER_NONE + + /** + *

The camera device detects illumination flickering at 50Hz + * in the current scene.

+ */ + STATISTICS_SCENE_FLICKER_50HZ = C.ACAMERA_STATISTICS_SCENE_FLICKER_50HZ + + /** + *

The camera device detects illumination flickering at 60Hz + * in the current scene.

+ */ + STATISTICS_SCENE_FLICKER_60HZ = C.ACAMERA_STATISTICS_SCENE_FLICKER_60HZ +) + +// ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE +type MetadataStatistics_lens_shading_map_mode int + +const ( + /** + *

Do not include a lens shading map in the capture result.

+ */ + STATISTICS_LENS_SHADING_MAP_MODE_OFF = C.ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE_OFF + + /** + *

Include a lens shading map in the capture result.

+ */ + STATISTICS_LENS_SHADING_MAP_MODE_ON = C.ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE_ON +) + +// ACAMERA_TONEMAP_MODE +type MetadataTonemap_mode int + +const ( + /** + *

Use the tone mapping curve specified in + * the ACAMERA_TONEMAPCURVE_* entries.

+ *

All color enhancement and tonemapping must be disabled, except + * for applying the tonemapping curve specified by + * android.tonemap.curve.

+ *

Must not slow down frame rate relative to raw + * sensor output.

+ */ + TONEMAP_MODE_CONTRAST_CURVE = C.ACAMERA_TONEMAP_MODE_CONTRAST_CURVE + + /** + *

Advanced gamma mapping and color enhancement may be applied, without + * reducing frame rate compared to raw sensor output.

+ */ + TONEMAP_MODE_FAST = C.ACAMERA_TONEMAP_MODE_FAST + + /** + *

High-quality gamma mapping and color enhancement will be applied, at + * the cost of possibly reduced frame rate compared to raw sensor output.

+ */ + TONEMAP_MODE_HIGH_QUALITY = C.ACAMERA_TONEMAP_MODE_HIGH_QUALITY + + /** + *

Use the gamma value specified in ACAMERA_TONEMAP_GAMMA to peform + * tonemapping.

+ *

All color enhancement and tonemapping must be disabled, except + * for applying the tonemapping curve specified by ACAMERA_TONEMAP_GAMMA.

+ *

Must not slow down frame rate relative to raw sensor output.

+ * + * @see ACAMERA_TONEMAP_GAMMA + */ + TONEMAP_MODE_GAMMA_VALUE = C.ACAMERA_TONEMAP_MODE_GAMMA_VALUE + + /** + *

Use the preset tonemapping curve specified in + * ACAMERA_TONEMAP_PRESET_CURVE to peform tonemapping.

+ *

All color enhancement and tonemapping must be disabled, except + * for applying the tonemapping curve specified by + * ACAMERA_TONEMAP_PRESET_CURVE.

+ *

Must not slow down frame rate relative to raw sensor output.

+ * + * @see ACAMERA_TONEMAP_PRESET_CURVE + */ + TONEMAP_MODE_PRESET_CURVE = C.ACAMERA_TONEMAP_MODE_PRESET_CURVE +) + +// ACAMERA_TONEMAP_PRESET_CURVE +type MetadataTonemap_preset_curve int + +const ( + /** + *

Tonemapping curve is defined by sRGB

+ */ + TONEMAP_PRESET_CURVE_SRGB = C.ACAMERA_TONEMAP_PRESET_CURVE_SRGB + + /** + *

Tonemapping curve is defined by ITU-R BT.709

+ */ + TONEMAP_PRESET_CURVE_REC709 = C.ACAMERA_TONEMAP_PRESET_CURVE_REC709 +) + +// ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL +type MetadataInfo_supported_hardware_level int + +const ( + /** + *

This camera device does not have enough capabilities to qualify as a FULL device or + * better.

+ *

Only the stream configurations listed in the LEGACY and LIMITED tables in the + * {@link ACameraDevice_createCaptureSession} documentation are guaranteed to be supported.

+ *

All LIMITED devices support the BACKWARDS_COMPATIBLE capability, indicating basic + * support for color image capture. The only exception is that the device may + * alternatively support only the DEPTH_OUTPUT capability, if it can only output depth + * measurements and not color images.

+ *

LIMITED devices and above require the use of ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * to lock exposure metering (and calculate flash power, for cameras with flash) before + * capturing a high-quality still image.

+ *

A LIMITED device that only lists the BACKWARDS_COMPATIBLE capability is only + * required to support full-automatic operation and post-processing (OFF is not + * supported for ACAMERA_CONTROL_AE_MODE, ACAMERA_CONTROL_AF_MODE, or + * ACAMERA_CONTROL_AWB_MODE)

+ *

Additional capabilities may optionally be supported by a LIMITED-level device, and + * can be checked for in ACAMERA_REQUEST_AVAILABLE_CAPABILITIES.

+ * + * @see ACAMERA_CONTROL_AE_MODE + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * @see ACAMERA_CONTROL_AF_MODE + * @see ACAMERA_CONTROL_AWB_MODE + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + */ + INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = C.ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED + + /** + *

This camera device is capable of supporting advanced imaging applications.

+ *

The stream configurations listed in the FULL, LEGACY and LIMITED tables in the + * {@link ACameraDevice_createCaptureSession} documentation are guaranteed to be supported.

+ *

A FULL device will support below capabilities:

+ *
    + *
  • BURST_CAPTURE capability (ACAMERA_REQUEST_AVAILABLE_CAPABILITIES contains + * BURST_CAPTURE)
  • + *
  • Per frame control (ACAMERA_SYNC_MAX_LATENCY == PER_FRAME_CONTROL)
  • + *
  • Manual sensor control (ACAMERA_REQUEST_AVAILABLE_CAPABILITIES contains MANUAL_SENSOR)
  • + *
  • Manual post-processing control (ACAMERA_REQUEST_AVAILABLE_CAPABILITIES contains + * MANUAL_POST_PROCESSING)
  • + *
  • The required exposure time range defined in ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE
  • + *
  • The required maxFrameDuration defined in ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION
  • + *
+ *

Note: + * Pre-API level 23, FULL devices also supported arbitrary cropping region + * (ACAMERA_SCALER_CROPPING_TYPE == FREEFORM); this requirement was relaxed in API level + * 23, and FULL devices may only support CENTERED cropping.

+ * + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + * @see ACAMERA_SCALER_CROPPING_TYPE + * @see ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE + * @see ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION + * @see ACAMERA_SYNC_MAX_LATENCY + */ + INFO_SUPPORTED_HARDWARE_LEVEL_FULL = C.ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL + + /** + *

This camera device is running in backward compatibility mode.

+ *

Only the stream configurations listed in the LEGACY table in the {@link + * ACameraDevice_createCaptureSession} documentation are supported.

+ *

A LEGACY device does not support per-frame control, manual sensor control, manual + * post-processing, arbitrary cropping regions, and has relaxed performance constraints. + * No additional capabilities beyond BACKWARD_COMPATIBLE will ever be listed by a + * LEGACY device in ACAMERA_REQUEST_AVAILABLE_CAPABILITIES.

+ *

In addition, the ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is not functional on LEGACY + * devices. Instead, every request that includes a JPEG-format output target is treated + * as triggering a still capture, internally executing a precapture trigger. This may + * fire the flash for flash power metering during precapture, and then fire the flash + * for the final capture, if a flash is available on the device and the AE mode is set to + * enable the flash.

+ * + * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + */ + INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = C.ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY + + /** + *

This camera device is capable of YUV reprocessing and RAW data capture, in addition to + * FULL-level capabilities.

+ *

The stream configurations listed in the LEVEL_3, RAW, FULL, LEGACY and + * LIMITED tables in the {@link + * ACameraDevice_createCaptureSession} + * documentation are guaranteed to be supported.

+ *

The following additional capabilities are guaranteed to be supported:

+ *
    + *
  • YUV_REPROCESSING capability (ACAMERA_REQUEST_AVAILABLE_CAPABILITIES contains + * YUV_REPROCESSING)
  • + *
  • RAW capability (ACAMERA_REQUEST_AVAILABLE_CAPABILITIES contains + * RAW)
  • + *
+ * + * @see ACAMERA_REQUEST_AVAILABLE_CAPABILITIES + */ + INFO_SUPPORTED_HARDWARE_LEVEL_3 = C.ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_3 +) + +// ACAMERA_BLACK_LEVEL_LOCK +type MetadataBlack_level_lock int + +const ( + BLACK_LEVEL_LOCK_OFF = C.ACAMERA_BLACK_LEVEL_LOCK_OFF + + BLACK_LEVEL_LOCK_ON = C.ACAMERA_BLACK_LEVEL_LOCK_ON +) + +// ACAMERA_SYNC_FRAME_NUMBER +type MetadataSync_frame_number int + +const ( + /** + *

The current result is not yet fully synchronized to any request.

+ *

Synchronization is in progress, and reading metadata from this + * result may include a mix of data that have taken effect since the + * last synchronization time.

+ *

In some future result, within ACAMERA_SYNC_MAX_LATENCY frames, + * this value will update to the actual frame number frame number + * the result is guaranteed to be synchronized to (as long as the + * request settings remain constant).

+ * + * @see ACAMERA_SYNC_MAX_LATENCY + */ + SYNC_FRAME_NUMBER_CONVERGING = C.ACAMERA_SYNC_FRAME_NUMBER_CONVERGING + + /** + *

The current result's synchronization status is unknown.

+ *

The result may have already converged, or it may be in + * progress. Reading from this result may include some mix + * of settings from past requests.

+ *

After a settings change, the new settings will eventually all + * take effect for the output buffers and results. However, this + * value will not change when that happens. Altering settings + * rapidly may provide outcomes using mixes of settings from recent + * requests.

+ *

This value is intended primarily for backwards compatibility with + * the older camera implementations (for android.hardware.Camera).

+ */ + SYNC_FRAME_NUMBER_UNKNOWN = C.ACAMERA_SYNC_FRAME_NUMBER_UNKNOWN +) + +// ACAMERA_SYNC_MAX_LATENCY +type MetadataSync_max_latency int + +const ( + /** + *

Every frame has the requests immediately applied.

+ *

Changing controls over multiple requests one after another will + * produce results that have those controls applied atomically + * each frame.

+ *

All FULL capability devices will have this as their maxLatency.

+ */ + SYNC_MAX_LATENCY_PER_FRAME_CONTROL = C.ACAMERA_SYNC_MAX_LATENCY_PER_FRAME_CONTROL + + /** + *

Each new frame has some subset (potentially the entire set) + * of the past requests applied to the camera settings.

+ *

By submitting a series of identical requests, the camera device + * will eventually have the camera settings applied, but it is + * unknown when that exact point will be.

+ *

All LEGACY capability devices will have this as their maxLatency.

+ */ + SYNC_MAX_LATENCY_UNKNOWN = C.ACAMERA_SYNC_MAX_LATENCY_UNKNOWN +) + +// ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS +type MetadataDepth_available_depth_stream_configurations int + +const ( + DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT = C.ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT + + DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT = C.ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT +) + +// ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE +type MetadataDepth_depth_is_exclusive int + +const ( + DEPTH_DEPTH_IS_EXCLUSIVE_FALSE = C.ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE + + DEPTH_DEPTH_IS_EXCLUSIVE_TRUE = C.ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE +) diff --git a/camera/output_target.go b/camera/output_target.go deleted file mode 100644 index 4f5ee6b..0000000 --- a/camera/output_target.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// OutputTarget wraps the NDK ACameraOutputTarget handle. -type OutputTarget struct { - ptr *capi.ACameraOutputTarget -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *OutputTarget) cptr() *capi.ACameraOutputTarget { - if h == nil { - return nil - } - return h.ptr -} - -// NewOutputTarget creates a new OutputTarget. -func NewOutputTarget(window *ANativeWindow) (*OutputTarget, error) { - var ptr *capi.ACameraOutputTarget - if err := result(capi.ACameraOutputTarget_create(window, &ptr)); err != nil { - return nil, err - } - return &OutputTarget{ptr: ptr}, nil -} - -// Close releases the underlying NDK handle. -func (h *OutputTarget) Close() error { - if h.ptr == nil { - return nil - } - capi.ACameraOutputTarget_free(h.ptr) - h.ptr = nil - return nil -} - -// NewOutputTargetFromPointer wraps a raw ACameraOutputTarget pointer. -func NewOutputTargetFromPointer(ptr unsafe.Pointer) *OutputTarget { - return &OutputTarget{ptr: (*capi.ACameraOutputTarget)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *OutputTarget) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *OutputTarget) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewOutputTargetFromUintPtr wraps a uintptr as a OutputTarget. -// The caller must ensure ptr points to a valid ACameraOutputTarget. -func NewOutputTargetFromUintPtr(ptr uintptr) *OutputTarget { - return &OutputTarget{ptr: (*capi.ACameraOutputTarget)(unsafe.Pointer(ptr))} -} diff --git a/camera/package.go b/camera/package.go deleted file mode 100644 index d03b1e2..0000000 --- a/camera/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package camera provides Go bindings for Android Camera2 NDK. -package camera diff --git a/camera/request.go b/camera/request.go new file mode 100644 index 0000000..e876763 --- /dev/null +++ b/camera/request.go @@ -0,0 +1,367 @@ +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + */ + +/** + * @file NdkCaptureRequest.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ + +package camera + +/* +#include +*/ +import "C" + +import ( + "unsafe" + + "github.com/xaionaro-go/ndk/ndk" +) + +// Container for output targets +type OutputTargets C.ACameraOutputTargets + +// Container for a single output target +type OutputTarget C.ACameraOutputTarget + +func (target *OutputTarget) cptr() *C.ACameraOutputTarget { + return (*C.ACameraOutputTarget)(target) +} + +/** + * ACaptureRequest is an opaque type that contains settings and output targets needed to capture + * a single image from camera device. + * + *

ACaptureRequest contains the configuration for the capture hardware (sensor, lens, flash), + * the processing pipeline, the control algorithms, and the output buffers. Also + * contains the list of target {@link ANativeWindow}s to send image data to for this + * capture.

+ * + *

ACaptureRequest is created by {@link ACameraDevice_createCaptureRequest}. + * + *

ACaptureRequest is given to {@link ACameraCaptureSession_capture} or + * {@link ACameraCaptureSession_setRepeatingRequest} to capture images from a camera.

+ * + *

Each request can specify a different subset of target {@link ANativeWindow}s for the + * camera to send the captured data to. All the {@link ANativeWindow}s used in a request must + * be part of the {@link ANativeWindow} list given to the last call to + * {@link ACameraDevice_createCaptureSession}, when the request is submitted to the + * session.

+ * + *

For example, a request meant for repeating preview might only include the + * {@link ANativeWindow} for the preview SurfaceView or SurfaceTexture, while a + * high-resolution still capture would also include a {@link ANativeWindow} from a + * {@link AImageReader} configured for high-resolution JPEG images.

+ * + * @see ACameraDevice_createCaptureRequest + * @see ACameraCaptureSession_capture + * @see ACameraCaptureSession_setRepeatingRequest + */ +type CaptureRequest C.ACaptureRequest + +func (request *CaptureRequest) cptr() *C.ACaptureRequest { + return (*C.ACaptureRequest)(request) +} + +/** + * Create a ACameraOutputTarget object. + * + *

The ACameraOutputTarget is used in {@link ACaptureRequest_addTarget} method to add an output + * {@link ANativeWindow} to ACaptureRequest. Use {@link ACameraOutputTarget_free} to free the object + * and its memory after application no longer needs the {@link ACameraOutputTarget}.

+ * + * @param window the {@link ANativeWindow} to be associated with the {@link ACameraOutputTarget} + * @param output the output {@link ACameraOutputTarget} will be stored here if the + * method call succeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds. The created ACameraOutputTarget will + * be filled in the output argument.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if window or output is NULL.
+ * + * @see ACaptureRequest_addTarget + */ +//camera_status_t ACameraOutputTarget_create(ANativeWindow* window, ACameraOutputTarget** output); +func CameraOutputTargetCreate(window *ndk.Window) (*OutputTarget, error) { + var output *C.ACameraOutputTarget + ret := Status(C.ACameraOutputTarget_create((*C.ANativeWindow)(window.Pointer()), &output)) + return (*OutputTarget)(output), ret +} + +/** + * Free a ACameraOutputTarget object. + * + * @param output the {@link ACameraOutputTarget} to be freed. + * + * @see ACameraOutputTarget_create + */ +//void ACameraOutputTarget_free(ACameraOutputTarget* output); +func (output *OutputTarget) Free() { + C.ACameraOutputTarget_free(output.cptr()) +} + +/** + * Add an {@link ACameraOutputTarget} object to {@link ACaptureRequest}. + * + * @param request the {@link ACaptureRequest} of interest. + * @param output the output {@link ACameraOutputTarget} to be added to capture request. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.
+ */ +//camera_status_t ACaptureRequest_addTarget(ACaptureRequest* request, +// const ACameraOutputTarget* output); +func (request *CaptureRequest) AddTarget(output *OutputTarget) error { + return Status(C.ACaptureRequest_addTarget(request.cptr(), output.cptr())) +} + +/** + * Remove an {@link ACameraOutputTarget} object from {@link ACaptureRequest}. + * + *

This method has no effect if the ACameraOutputTarget does not exist in ACaptureRequest.

+ * + * @param request the {@link ACaptureRequest} of interest. + * @param output the output {@link ACameraOutputTarget} to be removed from capture request. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.
+ */ +//camera_status_t ACaptureRequest_removeTarget(ACaptureRequest* request, +// const ACameraOutputTarget* output); +func (request *CaptureRequest) RemoveTarget(output *OutputTarget) error { + return Status(C.ACaptureRequest_removeTarget(request.cptr(), output.cptr())) +} + +/** + * Get a metadata entry from input {@link ACaptureRequest}. + * + *

The memory of the data field in returned entry is managed by camera framework. Do not + * attempt to free it.

+ * + * @param request the {@link ACaptureRequest} of interest. + * @param tag the tag value of the camera metadata entry to be get. + * @param entry the output {@link ACameraMetadata_const_entry} will be filled here if the method + * call succeeeds. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if metadata or entry is NULL.
  • + *
  • {@link ACAMERA_ERROR_METADATA_NOT_FOUND} if the capture request does not contain an + * entry of input tag value.
+ */ +//camera_status_t ACaptureRequest_getConstEntry( +// const ACaptureRequest* request, uint32_t tag, ACameraMetadata_const_entry* entry); +func (request *CaptureRequest) GetConstEntry(tag MetadataTag) (*MetadataConstEntry, error) { + var ent C.ACameraMetadata_const_entry + ret := Status(C.ACaptureRequest_getConstEntry(request.cptr(), C.uint32_t(tag), &ent)) + return (*MetadataConstEntry)(&ent), ret +} + +/* + * List all the entry tags in input {@link ACaptureRequest}. + * + * @param request the {@link ACaptureRequest} of interest. + * @param numEntries number of metadata entries in input {@link ACaptureRequest} + * @param tags the tag values of the metadata entries. Length of tags is returned in numEntries + * argument. The memory is managed by ACaptureRequest itself and must NOT be free/delete + * by application. Calling ACaptureRequest_setEntry_* methods will invalidate previous + * output of ACaptureRequest_getAllTags. Do not access tags after calling + * ACaptureRequest_setEntry_*. To get new list of tags after updating capture request, + * application must call ACaptureRequest_getAllTags again. Do NOT access tags after + * calling ACaptureRequest_free. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request, numEntries or tags is NULL.
  • + *
  • {@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ */ +//camera_status_t ACaptureRequest_getAllTags( +// const ACaptureRequest* request, /*out*/int32_t* numTags, /*out*/const uint32_t** tags); +func (request *CaptureRequest) GetAllTags() ([]uint32, error) { + var numEntries C.int32_t + var tags *C.uint32_t + ret := Status(C.ACaptureRequest_getAllTags(request.cptr(), &numEntries, &tags)) + return (*[1 << 28]uint32)(unsafe.Pointer(&tags))[:numEntries], ret +} + +/** + * Set/change a camera capture control entry with unsigned 8 bits data type. + * + *

Set count to 0 and data to NULL to remove a tag from the capture request.

+ * + * @param request the {@link ACaptureRequest} of interest. + * @param tag the tag value of the camera metadata entry to be set. + * @param count number of elements to be set in data argument + * @param data the entries to be set/change in the capture request. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than + * zero while data is NULL, the data type of the tag is not unsigned 8 bits, or + * the tag is not controllable by application.
+ */ +//camera_status_t ACaptureRequest_setEntry_u8( +// ACaptureRequest* request, uint32_t tag, uint32_t count, const uint8_t* data); +func (request *CaptureRequest) SetEntryU8(tag MetadataTag, data []uint8) error { + return Status(C.ACaptureRequest_setEntry_u8(request.cptr(), C.uint32_t(tag), C.uint32_t(len(data)), (*C.uint8_t)(&data[0]))) +} + +/** + * Set/change a camera capture control entry with signed 32 bits data type. + * + *

Set count to 0 and data to NULL to remove a tag from the capture request.

+ * + * @param request the {@link ACaptureRequest} of interest. + * @param tag the tag value of the camera metadata entry to be set. + * @param count number of elements to be set in data argument + * @param data the entries to be set/change in the capture request. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than + * zero while data is NULL, the data type of the tag is not signed 32 bits, or + * the tag is not controllable by application.
+ */ +//camera_status_t ACaptureRequest_setEntry_i32( +// ACaptureRequest* request, uint32_t tag, uint32_t count, const int32_t* data); +func (request *CaptureRequest) SetEntryI32(tag MetadataTag, data []int32) error { + return Status(C.ACaptureRequest_setEntry_i32(request.cptr(), C.uint32_t(tag), C.uint32_t(len(data)), (*C.int32_t)(&data[0]))) +} + +/** + * Set/change a camera capture control entry with float data type. + * + *

Set count to 0 and data to NULL to remove a tag from the capture request.

+ * + * @param request the {@link ACaptureRequest} of interest. + * @param tag the tag value of the camera metadata entry to be set. + * @param count number of elements to be set in data argument + * @param data the entries to be set/change in the capture request. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than + * zero while data is NULL, the data type of the tag is not float, or + * the tag is not controllable by application.
+ */ +//camera_status_t ACaptureRequest_setEntry_float( +// ACaptureRequest* request, uint32_t tag, uint32_t count, const float* data); +func (request *CaptureRequest) SetEntryF32(tag MetadataTag, data []float32) error { + return Status(C.ACaptureRequest_setEntry_float(request.cptr(), C.uint32_t(tag), C.uint32_t(len(data)), (*C.float)(&data[0]))) +} + +/** + * Set/change a camera capture control entry with signed 64 bits data type. + * + *

Set count to 0 and data to NULL to remove a tag from the capture request.

+ * + * @param request the {@link ACaptureRequest} of interest. + * @param tag the tag value of the camera metadata entry to be set. + * @param count number of elements to be set in data argument + * @param data the entries to be set/change in the capture request. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than + * zero while data is NULL, the data type of the tag is not signed 64 bits, or + * the tag is not controllable by application.
+ */ +//camera_status_t ACaptureRequest_setEntry_i64( +// ACaptureRequest* request, uint32_t tag, uint32_t count, const int64_t* data); +func (request *CaptureRequest) SetEntryI64(tag MetadataTag, data []int64) error { + return Status(C.ACaptureRequest_setEntry_i64(request.cptr(), C.uint32_t(tag), C.uint32_t(len(data)), (*C.int64_t)(&data[0]))) +} + +/** + * Set/change a camera capture control entry with double data type. + * + *

Set count to 0 and data to NULL to remove a tag from the capture request.

+ * + * @param request the {@link ACaptureRequest} of interest. + * @param tag the tag value of the camera metadata entry to be set. + * @param count number of elements to be set in data argument + * @param data the entries to be set/change in the capture request. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than + * zero while data is NULL, the data type of the tag is not double, or + * the tag is not controllable by application.
+ */ +//camera_status_t ACaptureRequest_setEntry_double( +// ACaptureRequest* request, uint32_t tag, uint32_t count, const double* data); +func (request *CaptureRequest) SetEntryF64(tag MetadataTag, data []float64) error { + return Status(C.ACaptureRequest_setEntry_double(request.cptr(), C.uint32_t(tag), C.uint32_t(len(data)), (*C.double)(&data[0]))) +} + +/** + * Set/change a camera capture control entry with rational data type. + * + *

Set count to 0 and data to NULL to remove a tag from the capture request.

+ * + * @param request the {@link ACaptureRequest} of interest. + * @param tag the tag value of the camera metadata entry to be set. + * @param count number of elements to be set in data argument + * @param data the entries to be set/change in the capture request. + * + * @return
    + *
  • {@link ACAMERA_OK} if the method call succeeds.
  • + *
  • {@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than + * zero while data is NULL, the data type of the tag is not rational, or + * the tag is not controllable by application.
+ */ +//camera_status_t ACaptureRequest_setEntry_rational( +// ACaptureRequest* request, uint32_t tag, uint32_t count, +// const ACameraMetadata_rational* data); +func (request *CaptureRequest) SetEntryRational(tag MetadataTag, data []MetadataRational) error { + cdata := make([]C.ACameraMetadata_rational, len(data)) + for i, d := range data { + cdata[i].numerator = C.int32_t(d.numerator) + cdata[i].denominator = C.int32_t(d.denominator) + } + return Status(C.ACaptureRequest_setEntry_rational(request.cptr(), C.uint32_t(tag), C.uint32_t(len(data)), &cdata[0])) +} + +/** + * Free a {@link ACaptureRequest} structure. + * + * @param request the {@link ACaptureRequest} to be freed. + */ +//void ACaptureRequest_free(ACaptureRequest* request); +func (request *CaptureRequest) Free() { + C.ACaptureRequest_free(request.cptr()) +} diff --git a/camera/session_output.go b/camera/session_output.go deleted file mode 100644 index 3466902..0000000 --- a/camera/session_output.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// SessionOutput wraps the NDK ACaptureSessionOutput handle. -type SessionOutput struct { - ptr *capi.ACaptureSessionOutput -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *SessionOutput) cptr() *capi.ACaptureSessionOutput { - if h == nil { - return nil - } - return h.ptr -} - -// NewSessionOutput creates a new SessionOutput. -func NewSessionOutput(anw *ANativeWindow) (*SessionOutput, error) { - var ptr *capi.ACaptureSessionOutput - if err := result(capi.ACaptureSessionOutput_create(anw, &ptr)); err != nil { - return nil, err - } - return &SessionOutput{ptr: ptr}, nil -} - -// Close releases the underlying NDK handle. -func (h *SessionOutput) Close() error { - if h.ptr == nil { - return nil - } - capi.ACaptureSessionOutput_free(h.ptr) - h.ptr = nil - return nil -} - -// NewSessionOutputFromPointer wraps a raw ACaptureSessionOutput pointer. -func NewSessionOutputFromPointer(ptr unsafe.Pointer) *SessionOutput { - return &SessionOutput{ptr: (*capi.ACaptureSessionOutput)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *SessionOutput) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *SessionOutput) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSessionOutputFromUintPtr wraps a uintptr as a SessionOutput. -// The caller must ensure ptr points to a valid ACaptureSessionOutput. -func NewSessionOutputFromUintPtr(ptr uintptr) *SessionOutput { - return &SessionOutput{ptr: (*capi.ACaptureSessionOutput)(unsafe.Pointer(ptr))} -} - -// NewPhysicalSessionOutput calls the underlying C function. -func NewPhysicalSessionOutput(anw *ANativeWindow, physicalID string) (*SessionOutput, error) { - var outputPtr *capi.ACaptureSessionOutput - ret := capi.ACaptureSessionPhysicalOutput_create((*capi.ANativeWindow)(anw), physicalID, &outputPtr) - if err := result(ret); err != nil { - return nil, err - } - return &SessionOutput{ptr: outputPtr}, nil -} diff --git a/camera/session_output_container.go b/camera/session_output_container.go deleted file mode 100644 index 942b8a0..0000000 --- a/camera/session_output_container.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -// SessionOutputContainer wraps the NDK ACaptureSessionOutputContainer handle. -type SessionOutputContainer struct { - ptr *capi.ACaptureSessionOutputContainer -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *SessionOutputContainer) cptr() *capi.ACaptureSessionOutputContainer { - if h == nil { - return nil - } - return h.ptr -} - -// NewSessionOutputContainer creates a new SessionOutputContainer. -func NewSessionOutputContainer() (*SessionOutputContainer, error) { - var ptr *capi.ACaptureSessionOutputContainer - if err := result(capi.ACaptureSessionOutputContainer_create(&ptr)); err != nil { - return nil, err - } - return &SessionOutputContainer{ptr: ptr}, nil -} - -// Close releases the underlying NDK handle. -func (h *SessionOutputContainer) Close() error { - if h.ptr == nil { - return nil - } - capi.ACaptureSessionOutputContainer_free(h.ptr) - h.ptr = nil - return nil -} - -// NewSessionOutputContainerFromPointer wraps a raw ACaptureSessionOutputContainer pointer. -func NewSessionOutputContainerFromPointer(ptr unsafe.Pointer) *SessionOutputContainer { - return &SessionOutputContainer{ptr: (*capi.ACaptureSessionOutputContainer)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *SessionOutputContainer) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *SessionOutputContainer) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSessionOutputContainerFromUintPtr wraps a uintptr as a SessionOutputContainer. -// The caller must ensure ptr points to a valid ACaptureSessionOutputContainer. -func NewSessionOutputContainerFromUintPtr(ptr uintptr) *SessionOutputContainer { - return &SessionOutputContainer{ptr: (*capi.ACaptureSessionOutputContainer)(unsafe.Pointer(ptr))} -} - -// Add calls the underlying NDK function. -func (h *SessionOutputContainer) Add(output *SessionOutput) error { - return result(capi.ACaptureSessionOutputContainer_add(h.ptr, output.cptr())) -} - -// Remove calls the underlying NDK function. -func (h *SessionOutputContainer) Remove(output *SessionOutput) error { - return result(capi.ACaptureSessionOutputContainer_remove(h.ptr, output.cptr())) -} diff --git a/camera/session_state_callbacks.go b/camera/session_state_callbacks.go deleted file mode 100644 index 8c55c56..0000000 --- a/camera/session_state_callbacks.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import ( - capi "github.com/AndroidGoLab/ndk/capi/camera" -) - -type SessionStateCallbacks = capi.SessionStateCallbacks diff --git a/camera/template_type.go b/camera/template_type.go deleted file mode 100644 index 195249b..0000000 --- a/camera/template_type.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -type TemplateType int32 - -const ( - Preview TemplateType = 1 - StillCapture TemplateType = 2 - Record TemplateType = 3 - VideoSnapshot TemplateType = 4 - ZeroShutterLag TemplateType = 5 - Manual TemplateType = 6 -) diff --git a/capi/aaudio/aaudio.go b/capi/aaudio/aaudio.go deleted file mode 100644 index 008e72d..0000000 --- a/capi/aaudio/aaudio.go +++ /dev/null @@ -1,598 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package aaudio - -/* -#cgo LDFLAGS: -laaudio -#include "aaudio/AAudio.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AAudioStreamBuilder_delete(builder *AAudioStreamBuilder) Aaudio_result_t { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - __ret := C.AAudioStreamBuilder_delete(cbuilder) - runtime.KeepAlive(cbuilderAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStreamBuilder_openStream(builder *AAudioStreamBuilder, stream **AAudioStream) Aaudio_result_t { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cstream, cstreamAllocMap := (**C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - var pinnercstream runtime.Pinner - pinnercstream.Pin(stream) - if stream != nil { - pinnercstream.Pin(unsafe.Pointer(*stream)) - } - defer pinnercstream.Unpin() - __ret := C.AAudioStreamBuilder_openStream(cbuilder, cstream) - runtime.KeepAlive(cstreamAllocMap) - runtime.KeepAlive(cbuilderAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStreamBuilder_setAllowedCapturePolicy(builder *AAudioStreamBuilder, capturePolicy Aaudio_allowed_capture_policy_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - ccapturePolicy, ccapturePolicyAllocMap := (C.aaudio_allowed_capture_policy_t)(capturePolicy), cgoAllocsUnknown - C.AAudioStreamBuilder_setAllowedCapturePolicy(cbuilder, ccapturePolicy) - runtime.KeepAlive(ccapturePolicyAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setAttributionTag(builder *AAudioStreamBuilder, attributionTag string) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cattributionTag, cattributionTagAllocMap := UnpackPCharString(attributionTag) - C.AAudioStreamBuilder_setAttributionTag(cbuilder, cattributionTag) - runtime.KeepAlive(cattributionTagAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setBufferCapacityInFrames(builder *AAudioStreamBuilder, numFrames int32) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cnumFrames, cnumFramesAllocMap := (C.int)(numFrames), cgoAllocsUnknown - C.AAudioStreamBuilder_setBufferCapacityInFrames(cbuilder, cnumFrames) - runtime.KeepAlive(cnumFramesAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setChannelCount(builder *AAudioStreamBuilder, channelCount int32) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cchannelCount, cchannelCountAllocMap := (C.int)(channelCount), cgoAllocsUnknown - C.AAudioStreamBuilder_setChannelCount(cbuilder, cchannelCount) - runtime.KeepAlive(cchannelCountAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setChannelMask(builder *AAudioStreamBuilder, channelMask Aaudio_channel_mask_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cchannelMask, cchannelMaskAllocMap := (C.aaudio_channel_mask_t)(channelMask), cgoAllocsUnknown - C.AAudioStreamBuilder_setChannelMask(cbuilder, cchannelMask) - runtime.KeepAlive(cchannelMaskAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setContentType(builder *AAudioStreamBuilder, contentType Aaudio_content_type_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - ccontentType, ccontentTypeAllocMap := (C.aaudio_content_type_t)(contentType), cgoAllocsUnknown - C.AAudioStreamBuilder_setContentType(cbuilder, ccontentType) - runtime.KeepAlive(ccontentTypeAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setDataCallback(builder *AAudioStreamBuilder, callback AAudioStream_dataCallback, userData unsafe.Pointer) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cuserData, cuserDataAllocMap := userData, cgoAllocsUnknown - C.AAudioStreamBuilder_setDataCallback(cbuilder, ccallback, cuserData) - runtime.KeepAlive(cuserDataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setDeviceId(builder *AAudioStreamBuilder, deviceId int32) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cdeviceId, cdeviceIdAllocMap := (C.int)(deviceId), cgoAllocsUnknown - C.AAudioStreamBuilder_setDeviceId(cbuilder, cdeviceId) - runtime.KeepAlive(cdeviceIdAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setDirection(builder *AAudioStreamBuilder, direction Aaudio_direction_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cdirection, cdirectionAllocMap := (C.aaudio_direction_t)(direction), cgoAllocsUnknown - C.AAudioStreamBuilder_setDirection(cbuilder, cdirection) - runtime.KeepAlive(cdirectionAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setErrorCallback(builder *AAudioStreamBuilder, callback AAudioStream_errorCallback, userData unsafe.Pointer) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cuserData, cuserDataAllocMap := userData, cgoAllocsUnknown - C.AAudioStreamBuilder_setErrorCallback(cbuilder, ccallback, cuserData) - runtime.KeepAlive(cuserDataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setFormat(builder *AAudioStreamBuilder, format Aaudio_format_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cformat, cformatAllocMap := (C.aaudio_format_t)(format), cgoAllocsUnknown - C.AAudioStreamBuilder_setFormat(cbuilder, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setFramesPerDataCallback(builder *AAudioStreamBuilder, numFrames int32) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cnumFrames, cnumFramesAllocMap := (C.int)(numFrames), cgoAllocsUnknown - C.AAudioStreamBuilder_setFramesPerDataCallback(cbuilder, cnumFrames) - runtime.KeepAlive(cnumFramesAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setInputPreset(builder *AAudioStreamBuilder, inputPreset Aaudio_input_preset_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cinputPreset, cinputPresetAllocMap := (C.aaudio_input_preset_t)(inputPreset), cgoAllocsUnknown - C.AAudioStreamBuilder_setInputPreset(cbuilder, cinputPreset) - runtime.KeepAlive(cinputPresetAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setIsContentSpatialized(builder *AAudioStreamBuilder, isSpatialized bool) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cisSpatialized, cisSpatializedAllocMap := (C._Bool)(isSpatialized), cgoAllocsUnknown - C.AAudioStreamBuilder_setIsContentSpatialized(cbuilder, cisSpatialized) - runtime.KeepAlive(cisSpatializedAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setPackageName(builder *AAudioStreamBuilder, packageName string) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cpackageName, cpackageNameAllocMap := UnpackPCharString(packageName) - C.AAudioStreamBuilder_setPackageName(cbuilder, cpackageName) - runtime.KeepAlive(cpackageNameAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setPerformanceMode(builder *AAudioStreamBuilder, mode Aaudio_performance_mode_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cmode, cmodeAllocMap := (C.aaudio_performance_mode_t)(mode), cgoAllocsUnknown - C.AAudioStreamBuilder_setPerformanceMode(cbuilder, cmode) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setPrivacySensitive(builder *AAudioStreamBuilder, privacySensitive bool) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cprivacySensitive, cprivacySensitiveAllocMap := (C._Bool)(privacySensitive), cgoAllocsUnknown - C.AAudioStreamBuilder_setPrivacySensitive(cbuilder, cprivacySensitive) - runtime.KeepAlive(cprivacySensitiveAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setSampleRate(builder *AAudioStreamBuilder, sampleRate int32) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - csampleRate, csampleRateAllocMap := (C.int)(sampleRate), cgoAllocsUnknown - C.AAudioStreamBuilder_setSampleRate(cbuilder, csampleRate) - runtime.KeepAlive(csampleRateAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setSamplesPerFrame(builder *AAudioStreamBuilder, samplesPerFrame int32) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - csamplesPerFrame, csamplesPerFrameAllocMap := (C.int)(samplesPerFrame), cgoAllocsUnknown - C.AAudioStreamBuilder_setSamplesPerFrame(cbuilder, csamplesPerFrame) - runtime.KeepAlive(csamplesPerFrameAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setSessionId(builder *AAudioStreamBuilder, sessionId Aaudio_session_id_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (C.aaudio_session_id_t)(sessionId), cgoAllocsUnknown - C.AAudioStreamBuilder_setSessionId(cbuilder, csessionId) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setSharingMode(builder *AAudioStreamBuilder, sharingMode Aaudio_sharing_mode_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - csharingMode, csharingModeAllocMap := (C.aaudio_sharing_mode_t)(sharingMode), cgoAllocsUnknown - C.AAudioStreamBuilder_setSharingMode(cbuilder, csharingMode) - runtime.KeepAlive(csharingModeAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setSpatializationBehavior(builder *AAudioStreamBuilder, spatializationBehavior Aaudio_spatialization_behavior_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cspatializationBehavior, cspatializationBehaviorAllocMap := (C.aaudio_spatialization_behavior_t)(spatializationBehavior), cgoAllocsUnknown - C.AAudioStreamBuilder_setSpatializationBehavior(cbuilder, cspatializationBehavior) - runtime.KeepAlive(cspatializationBehaviorAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStreamBuilder_setUsage(builder *AAudioStreamBuilder, usage Aaudio_usage_t) { - cbuilder, cbuilderAllocMap := (*C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - cusage, cusageAllocMap := (C.aaudio_usage_t)(usage), cgoAllocsUnknown - C.AAudioStreamBuilder_setUsage(cbuilder, cusage) - runtime.KeepAlive(cusageAllocMap) - runtime.KeepAlive(cbuilderAllocMap) -} - -func AAudioStream_close(stream *AAudioStream) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_close(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_getAllowedCapturePolicy(stream *AAudioStream) Aaudio_allowed_capture_policy_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getAllowedCapturePolicy(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_allowed_capture_policy_t)(__ret) - return __v -} - -func AAudioStream_getBufferCapacityInFrames(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getBufferCapacityInFrames(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getBufferSizeInFrames(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getBufferSizeInFrames(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getChannelCount(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getChannelCount(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getChannelMask(stream *AAudioStream) Aaudio_channel_mask_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getChannelMask(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_channel_mask_t)(__ret) - return __v -} - -func AAudioStream_getContentType(stream *AAudioStream) Aaudio_content_type_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getContentType(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_content_type_t)(__ret) - return __v -} - -func AAudioStream_getDeviceId(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getDeviceId(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getDirection(stream *AAudioStream) Aaudio_direction_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getDirection(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_direction_t)(__ret) - return __v -} - -func AAudioStream_getFormat(stream *AAudioStream) Aaudio_format_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getFormat(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_format_t)(__ret) - return __v -} - -func AAudioStream_getFramesPerBurst(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getFramesPerBurst(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getFramesPerDataCallback(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getFramesPerDataCallback(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getFramesRead(stream *AAudioStream) int64 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getFramesRead(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int64)(__ret) - return __v -} - -func AAudioStream_getFramesWritten(stream *AAudioStream) int64 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getFramesWritten(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int64)(__ret) - return __v -} - -func AAudioStream_getHardwareChannelCount(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getHardwareChannelCount(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getHardwareFormat(stream *AAudioStream) Aaudio_format_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getHardwareFormat(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_format_t)(__ret) - return __v -} - -func AAudioStream_getHardwareSampleRate(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getHardwareSampleRate(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getInputPreset(stream *AAudioStream) Aaudio_input_preset_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getInputPreset(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_input_preset_t)(__ret) - return __v -} - -func AAudioStream_getPerformanceMode(stream *AAudioStream) Aaudio_performance_mode_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getPerformanceMode(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_performance_mode_t)(__ret) - return __v -} - -func AAudioStream_getSampleRate(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getSampleRate(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getSamplesPerFrame(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getSamplesPerFrame(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_getSessionId(stream *AAudioStream) Aaudio_session_id_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getSessionId(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_session_id_t)(__ret) - return __v -} - -func AAudioStream_getSharingMode(stream *AAudioStream) Aaudio_sharing_mode_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getSharingMode(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_sharing_mode_t)(__ret) - return __v -} - -func AAudioStream_getSpatializationBehavior(stream *AAudioStream) Aaudio_spatialization_behavior_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getSpatializationBehavior(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_spatialization_behavior_t)(__ret) - return __v -} - -func AAudioStream_getState(stream *AAudioStream) Aaudio_stream_state_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getState(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_stream_state_t)(__ret) - return __v -} - -func AAudioStream_getTimestamp(stream *AAudioStream, clockid Clockid_t, framePosition *int64, timeNanoseconds *int64) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - cclockid, cclockidAllocMap := (C.clockid_t)(clockid), cgoAllocsUnknown - cframePosition, cframePositionAllocMap := (*C.int64_t)(unsafe.Pointer(framePosition)), cgoAllocsUnknown - ctimeNanoseconds, ctimeNanosecondsAllocMap := (*C.int64_t)(unsafe.Pointer(timeNanoseconds)), cgoAllocsUnknown - __ret := C.AAudioStream_getTimestamp(cstream, cclockid, cframePosition, ctimeNanoseconds) - runtime.KeepAlive(ctimeNanosecondsAllocMap) - runtime.KeepAlive(cframePositionAllocMap) - runtime.KeepAlive(cclockidAllocMap) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_getUsage(stream *AAudioStream) Aaudio_usage_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getUsage(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_usage_t)(__ret) - return __v -} - -func AAudioStream_getXRunCount(stream *AAudioStream) int32 { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_getXRunCount(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAudioStream_isContentSpatialized(stream *AAudioStream) bool { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_isContentSpatialized(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (bool)(__ret) - return __v -} - -func AAudioStream_isPrivacySensitive(stream *AAudioStream) bool { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_isPrivacySensitive(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (bool)(__ret) - return __v -} - -func AAudioStream_read(stream *AAudioStream, buffer unsafe.Pointer, numFrames int32, timeoutNanoseconds int64) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := buffer, cgoAllocsUnknown - cnumFrames, cnumFramesAllocMap := (C.int)(numFrames), cgoAllocsUnknown - ctimeoutNanoseconds, ctimeoutNanosecondsAllocMap := (C.int64_t)(timeoutNanoseconds), cgoAllocsUnknown - __ret := C.AAudioStream_read(cstream, cbuffer, cnumFrames, ctimeoutNanoseconds) - runtime.KeepAlive(ctimeoutNanosecondsAllocMap) - runtime.KeepAlive(cnumFramesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_release(stream *AAudioStream) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_release(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_requestFlush(stream *AAudioStream) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_requestFlush(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_requestPause(stream *AAudioStream) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_requestPause(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_requestStart(stream *AAudioStream) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_requestStart(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_requestStop(stream *AAudioStream) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - __ret := C.AAudioStream_requestStop(cstream) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_setBufferSizeInFrames(stream *AAudioStream, numFrames int32) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - cnumFrames, cnumFramesAllocMap := (C.int)(numFrames), cgoAllocsUnknown - __ret := C.AAudioStream_setBufferSizeInFrames(cstream, cnumFrames) - runtime.KeepAlive(cnumFramesAllocMap) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_waitForStateChange(stream *AAudioStream, inputState Aaudio_stream_state_t, nextState *Aaudio_stream_state_t, timeoutNanoseconds int64) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - cinputState, cinputStateAllocMap := (C.aaudio_stream_state_t)(inputState), cgoAllocsUnknown - cnextState, cnextStateAllocMap := (*C.aaudio_stream_state_t)(unsafe.Pointer(nextState)), cgoAllocsUnknown - ctimeoutNanoseconds, ctimeoutNanosecondsAllocMap := (C.int64_t)(timeoutNanoseconds), cgoAllocsUnknown - __ret := C.AAudioStream_waitForStateChange(cstream, cinputState, cnextState, ctimeoutNanoseconds) - runtime.KeepAlive(ctimeoutNanosecondsAllocMap) - runtime.KeepAlive(cnextStateAllocMap) - runtime.KeepAlive(cinputStateAllocMap) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudioStream_write(stream *AAudioStream, buffer unsafe.Pointer, numFrames int32, timeoutNanoseconds int64) Aaudio_result_t { - cstream, cstreamAllocMap := (*C.AAudioStream)(unsafe.Pointer(stream)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := buffer, cgoAllocsUnknown - cnumFrames, cnumFramesAllocMap := (C.int)(numFrames), cgoAllocsUnknown - ctimeoutNanoseconds, ctimeoutNanosecondsAllocMap := (C.int64_t)(timeoutNanoseconds), cgoAllocsUnknown - __ret := C.AAudioStream_write(cstream, cbuffer, cnumFrames, ctimeoutNanoseconds) - runtime.KeepAlive(ctimeoutNanosecondsAllocMap) - runtime.KeepAlive(cnumFramesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cstreamAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} - -func AAudio_convertResultToText(returnCode Aaudio_result_t) string { - creturnCode, creturnCodeAllocMap := (C.aaudio_result_t)(returnCode), cgoAllocsUnknown - __ret := C.AAudio_convertResultToText(creturnCode) - runtime.KeepAlive(creturnCodeAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AAudio_convertStreamStateToText(state Aaudio_stream_state_t) string { - cstate, cstateAllocMap := (C.aaudio_stream_state_t)(state), cgoAllocsUnknown - __ret := C.AAudio_convertStreamStateToText(cstate) - runtime.KeepAlive(cstateAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AAudio_createStreamBuilder(builder **AAudioStreamBuilder) Aaudio_result_t { - cbuilder, cbuilderAllocMap := (**C.AAudioStreamBuilder)(unsafe.Pointer(builder)), cgoAllocsUnknown - var pinnercbuilder runtime.Pinner - pinnercbuilder.Pin(builder) - if builder != nil { - pinnercbuilder.Pin(unsafe.Pointer(*builder)) - } - defer pinnercbuilder.Unpin() - __ret := C.AAudio_createStreamBuilder(cbuilder) - runtime.KeepAlive(cbuilderAllocMap) - __v := (Aaudio_result_t)(__ret) - return __v -} diff --git a/capi/aaudio/cgo_helpers.c b/capi/aaudio/cgo_helpers.c deleted file mode 100644 index d481acc..0000000 --- a/capi/aaudio/cgo_helpers.c +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -aaudio_data_callback_result_t AAudioStream_dataCallback_aeff7e8c(AAudioStream* stream, void* userData, void* audioData, int32_t numFrames) { - return AAudioStream_dataCallbackAEFF7E8C(stream, userData, audioData, numFrames); -} - -void AAudioStream_errorCallback_272a051c(AAudioStream* stream, void* userData, aaudio_result_t _error) { - AAudioStream_errorCallback272A051C(stream, userData, _error); -} - diff --git a/capi/aaudio/cgo_helpers.go b/capi/aaudio/cgo_helpers.go deleted file mode 100644 index f860511..0000000 --- a/capi/aaudio/cgo_helpers.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package aaudio - -/* -#cgo LDFLAGS: -laaudio -#include "aaudio/AAudio.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x AAudioStream_dataCallback) PassRef() (ref *C.AAudioStream_dataCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aAudioStream_dataCallbackAEFF7E8CFunc == nil { - aAudioStream_dataCallbackAEFF7E8CFunc = x - } - return (*C.AAudioStream_dataCallback)(C.AAudioStream_dataCallback_aeff7e8c), nil -} - -func (x AAudioStream_dataCallback) PassValue() (ref C.AAudioStream_dataCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aAudioStream_dataCallbackAEFF7E8CFunc == nil { - aAudioStream_dataCallbackAEFF7E8CFunc = x - } - return (C.AAudioStream_dataCallback)(C.AAudioStream_dataCallback_aeff7e8c), nil -} - -func NewAAudioStream_dataCallbackRef(ref unsafe.Pointer) *AAudioStream_dataCallback { - return (*AAudioStream_dataCallback)(ref) -} - -//export AAudioStream_dataCallbackAEFF7E8C -func AAudioStream_dataCallbackAEFF7E8C(cstream *C.AAudioStream, cuserData unsafe.Pointer, caudioData unsafe.Pointer, cnumFrames C.int32_t) C.aaudio_data_callback_result_t { - if aAudioStream_dataCallbackAEFF7E8CFunc != nil { - streamaeff7e8c := (*AAudioStream)(unsafe.Pointer(cstream)) - userDataaeff7e8c := (unsafe.Pointer)(unsafe.Pointer(cuserData)) - audioDataaeff7e8c := (unsafe.Pointer)(unsafe.Pointer(caudioData)) - numFramesaeff7e8c := (int32)(cnumFrames) - retaeff7e8c := aAudioStream_dataCallbackAEFF7E8CFunc(streamaeff7e8c, userDataaeff7e8c, audioDataaeff7e8c, numFramesaeff7e8c) - ret, _ := (C.aaudio_data_callback_result_t)(retaeff7e8c), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aAudioStream_dataCallbackAEFF7E8CFunc AAudioStream_dataCallback - -func (x AAudioStream_errorCallback) PassRef() (ref *C.AAudioStream_errorCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aAudioStream_errorCallback272A051CFunc == nil { - aAudioStream_errorCallback272A051CFunc = x - } - return (*C.AAudioStream_errorCallback)(C.AAudioStream_errorCallback_272a051c), nil -} - -func (x AAudioStream_errorCallback) PassValue() (ref C.AAudioStream_errorCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aAudioStream_errorCallback272A051CFunc == nil { - aAudioStream_errorCallback272A051CFunc = x - } - return (C.AAudioStream_errorCallback)(C.AAudioStream_errorCallback_272a051c), nil -} - -func NewAAudioStream_errorCallbackRef(ref unsafe.Pointer) *AAudioStream_errorCallback { - return (*AAudioStream_errorCallback)(ref) -} - -//export AAudioStream_errorCallback272A051C -func AAudioStream_errorCallback272A051C(cstream *C.AAudioStream, cuserData unsafe.Pointer, c_error C.aaudio_result_t) { - if aAudioStream_errorCallback272A051CFunc != nil { - stream272a051c := (*AAudioStream)(unsafe.Pointer(cstream)) - userData272a051c := (unsafe.Pointer)(unsafe.Pointer(cuserData)) - _error272a051c := (Aaudio_result_t)(c_error) - aAudioStream_errorCallback272A051CFunc(stream272a051c, userData272a051c, _error272a051c) - return - } - panic("callback func has not been set (race?)") -} - -var aAudioStream_errorCallback272A051CFunc AAudioStream_errorCallback - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/aaudio/cgo_helpers.h b/capi/aaudio/cgo_helpers.h deleted file mode 100644 index 372f073..0000000 --- a/capi/aaudio/cgo_helpers.h +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "aaudio/AAudio.h" -#include -#pragma once - -#define __CGOGEN 1 - -// AAudioStream_dataCallback_aeff7e8c is a proxy for callback AAudioStream_dataCallback. -aaudio_data_callback_result_t AAudioStream_dataCallback_aeff7e8c(AAudioStream* stream, void* userData, void* audioData, int32_t numFrames); - -// AAudioStream_errorCallback_272a051c is a proxy for callback AAudioStream_errorCallback. -void AAudioStream_errorCallback_272a051c(AAudioStream* stream, void* userData, aaudio_result_t _error); - diff --git a/capi/aaudio/const.go b/capi/aaudio/const.go deleted file mode 100644 index 90d3718..0000000 --- a/capi/aaudio/const.go +++ /dev/null @@ -1,159 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package aaudio - -const ( - AAUDIO_USAGE_MEDIA = 1 - AAUDIO_USAGE_VOICE_COMMUNICATION = 2 - AAUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING = 3 - AAUDIO_USAGE_ALARM = 4 - AAUDIO_USAGE_NOTIFICATION = 5 - AAUDIO_USAGE_NOTIFICATION_RINGTONE = 6 - AAUDIO_USAGE_NOTIFICATION_EVENT = 10 - AAUDIO_USAGE_ASSISTANCE_ACCESSIBILITY = 11 - AAUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12 - AAUDIO_USAGE_ASSISTANCE_SONIFICATION = 13 - AAUDIO_USAGE_GAME = 14 - AAUDIO_USAGE_ASSISTANT = 16 - AAUDIO_SYSTEM_USAGE_EMERGENCY = 1000 - AAUDIO_SYSTEM_USAGE_SAFETY = 1001 - AAUDIO_SYSTEM_USAGE_VEHICLE_STATUS = 1002 - AAUDIO_SYSTEM_USAGE_ANNOUNCEMENT = 1003 -) - -const ( - AAUDIO_ALLOW_CAPTURE_BY_ALL = 1 - AAUDIO_ALLOW_CAPTURE_BY_SYSTEM = 2 - AAUDIO_ALLOW_CAPTURE_BY_NONE = 3 -) - -const ( - AAUDIO_CALLBACK_RESULT_CONTINUE = 0 - AAUDIO_CALLBACK_RESULT_STOP = 1 -) - -const ( - AAUDIO_CHANNEL_INVALID = -1 - AAUDIO_CHANNEL_FRONT_LEFT = 1 - AAUDIO_CHANNEL_FRONT_RIGHT = 2 - AAUDIO_CHANNEL_FRONT_CENTER = 4 - AAUDIO_CHANNEL_LOW_FREQUENCY = 8 - AAUDIO_CHANNEL_BACK_LEFT = 16 - AAUDIO_CHANNEL_BACK_RIGHT = 32 - AAUDIO_CHANNEL_FRONT_LEFT_OF_CENTER = 64 - AAUDIO_CHANNEL_FRONT_RIGHT_OF_CENTER = 128 - AAUDIO_CHANNEL_BACK_CENTER = 256 - AAUDIO_CHANNEL_SIDE_LEFT = 512 - AAUDIO_CHANNEL_SIDE_RIGHT = 1024 - AAUDIO_CHANNEL_TOP_CENTER = 2048 - AAUDIO_CHANNEL_TOP_FRONT_LEFT = 4096 - AAUDIO_CHANNEL_TOP_FRONT_CENTER = 8192 - AAUDIO_CHANNEL_TOP_FRONT_RIGHT = 16384 - AAUDIO_CHANNEL_TOP_BACK_LEFT = 32768 - AAUDIO_CHANNEL_TOP_BACK_CENTER = 65536 - AAUDIO_CHANNEL_TOP_BACK_RIGHT = 131072 - AAUDIO_CHANNEL_TOP_SIDE_LEFT = 262144 - AAUDIO_CHANNEL_TOP_SIDE_RIGHT = 524288 - AAUDIO_CHANNEL_BOTTOM_FRONT_LEFT = 1048576 - AAUDIO_CHANNEL_BOTTOM_FRONT_CENTER = 2097152 - AAUDIO_CHANNEL_BOTTOM_FRONT_RIGHT = 4194304 - AAUDIO_CHANNEL_LOW_FREQUENCY_2 = 8388608 - AAUDIO_CHANNEL_FRONT_WIDE_LEFT = 16777216 - AAUDIO_CHANNEL_FRONT_WIDE_RIGHT = 33554432 - AAUDIO_CHANNEL_MONO = 1 - AAUDIO_CHANNEL_STEREO = 3 - AAUDIO_CHANNEL_2POINT1 = 11 - AAUDIO_CHANNEL_TRI = 7 - AAUDIO_CHANNEL_TRI_BACK = 259 - AAUDIO_CHANNEL_3POINT1 = 15 - AAUDIO_CHANNEL_2POINT0POINT2 = 786435 - AAUDIO_CHANNEL_2POINT1POINT2 = 786443 - AAUDIO_CHANNEL_3POINT0POINT2 = 786439 - AAUDIO_CHANNEL_3POINT1POINT2 = 786447 - AAUDIO_CHANNEL_QUAD = 51 - AAUDIO_CHANNEL_QUAD_SIDE = 1539 - AAUDIO_CHANNEL_SURROUND = 263 - AAUDIO_CHANNEL_PENTA = 55 - AAUDIO_CHANNEL_5POINT1 = 63 - AAUDIO_CHANNEL_5POINT1_SIDE = 1551 - AAUDIO_CHANNEL_6POINT1 = 319 - AAUDIO_CHANNEL_7POINT1 = 1599 - AAUDIO_CHANNEL_5POINT1POINT2 = 786495 - AAUDIO_CHANNEL_5POINT1POINT4 = 184383 - AAUDIO_CHANNEL_7POINT1POINT2 = 788031 - AAUDIO_CHANNEL_7POINT1POINT4 = 185919 - AAUDIO_CHANNEL_9POINT1POINT4 = 50517567 - AAUDIO_CHANNEL_9POINT1POINT6 = 51303999 - AAUDIO_CHANNEL_FRONT_BACK = 260 -) - -const ( - AAUDIO_CONTENT_TYPE_SPEECH = 1 - AAUDIO_CONTENT_TYPE_MUSIC = 2 - AAUDIO_CONTENT_TYPE_MOVIE = 3 - AAUDIO_CONTENT_TYPE_SONIFICATION = 4 -) - -const ( - AAUDIO_DIRECTION_OUTPUT = 0 - AAUDIO_DIRECTION_INPUT = 1 -) - -const ( - AAUDIO_FORMAT_INVALID = -1 - AAUDIO_FORMAT_UNSPECIFIED = 0 - AAUDIO_FORMAT_PCM_I16 = 1 - AAUDIO_FORMAT_PCM_FLOAT = 2 - AAUDIO_FORMAT_PCM_I24_PACKED = 3 - AAUDIO_FORMAT_PCM_I32 = 4 - AAUDIO_FORMAT_IEC61937 = 5 -) - -const ( - AAUDIO_INPUT_PRESET_GENERIC = 1 - AAUDIO_INPUT_PRESET_CAMCORDER = 5 - AAUDIO_INPUT_PRESET_VOICE_RECOGNITION = 6 - AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION = 7 - AAUDIO_INPUT_PRESET_UNPROCESSED = 9 - AAUDIO_INPUT_PRESET_VOICE_PERFORMANCE = 10 - AAUDIO_INPUT_PRESET_SYSTEM_ECHO_REFERENCE = 1997 - AAUDIO_INPUT_PRESET_SYSTEM_HOTWORD = 1999 -) - -const ( - AAUDIO_PERFORMANCE_MODE_NONE = 10 - AAUDIO_PERFORMANCE_MODE_POWER_SAVING = 11 - AAUDIO_PERFORMANCE_MODE_LOW_LATENCY = 12 -) - -const ( - AAUDIO_SESSION_ID_NONE = -1 - AAUDIO_SESSION_ID_ALLOCATE = 0 -) - -const ( - AAUDIO_SHARING_MODE_EXCLUSIVE = 0 - AAUDIO_SHARING_MODE_SHARED = 1 -) - -const ( - AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO = 1 - AAUDIO_SPATIALIZATION_BEHAVIOR_NEVER = 2 -) - -const ( - AAUDIO_STREAM_STATE_UNINITIALIZED = 0 - AAUDIO_STREAM_STATE_UNKNOWN = 1 - AAUDIO_STREAM_STATE_OPEN = 2 - AAUDIO_STREAM_STATE_STARTING = 3 - AAUDIO_STREAM_STATE_STARTED = 4 - AAUDIO_STREAM_STATE_PAUSING = 5 - AAUDIO_STREAM_STATE_PAUSED = 6 - AAUDIO_STREAM_STATE_FLUSHING = 7 - AAUDIO_STREAM_STATE_FLUSHED = 8 - AAUDIO_STREAM_STATE_STOPPING = 9 - AAUDIO_STREAM_STATE_STOPPED = 10 - AAUDIO_STREAM_STATE_CLOSING = 11 - AAUDIO_STREAM_STATE_CLOSED = 12 - AAUDIO_STREAM_STATE_DISCONNECTED = 13 -) diff --git a/capi/aaudio/doc.go b/capi/aaudio/doc.go deleted file mode 100644 index 81a8d48..0000000 --- a/capi/aaudio/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android AAudio -*/ -package aaudio diff --git a/capi/aaudio/types.go b/capi/aaudio/types.go deleted file mode 100644 index b1e8957..0000000 --- a/capi/aaudio/types.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package aaudio - -/* -#cgo LDFLAGS: -laaudio -#include "aaudio/AAudio.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type AAudioStream C.AAudioStream - -type AAudioStreamBuilder C.AAudioStreamBuilder - -type Aaudio_allowed_capture_policy_t int32 - -type Aaudio_channel_mask_t uint32 - -type Aaudio_content_type_t int32 - -type Aaudio_data_callback_result_t int32 - -type Aaudio_direction_t int32 - -type Aaudio_format_t int32 - -type Aaudio_input_preset_t int32 - -type Aaudio_performance_mode_t int32 - -type Aaudio_result_t int32 - -type Aaudio_session_id_t int32 - -type Aaudio_sharing_mode_t int32 - -type Aaudio_spatialization_behavior_t int32 - -type Aaudio_stream_state_t int32 - -type Aaudio_usage_t int32 - -type Clockid_t C.clockid_t - -type AAudioStream_dataCallback func(stream *AAudioStream, userData unsafe.Pointer, audioData unsafe.Pointer, numFrames int32) Aaudio_data_callback_result_t - -type AAudioStream_errorCallback func(stream *AAudioStream, userData unsafe.Pointer, _error Aaudio_result_t) diff --git a/capi/asset/asset.go b/capi/asset/asset.go deleted file mode 100644 index 8885693..0000000 --- a/capi/asset/asset.go +++ /dev/null @@ -1,174 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package asset - -/* -#cgo LDFLAGS: -landroid -#include "android/asset_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AAssetDir_close(assetDir *AAssetDir) { - cassetDir, cassetDirAllocMap := (*C.AAssetDir)(unsafe.Pointer(assetDir)), cgoAllocsUnknown - C.AAssetDir_close(cassetDir) - runtime.KeepAlive(cassetDirAllocMap) -} - -func AAssetDir_getNextFileName(assetDir *AAssetDir) string { - cassetDir, cassetDirAllocMap := (*C.AAssetDir)(unsafe.Pointer(assetDir)), cgoAllocsUnknown - __ret := C.AAssetDir_getNextFileName(cassetDir) - runtime.KeepAlive(cassetDirAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AAssetDir_rewind(assetDir *AAssetDir) { - cassetDir, cassetDirAllocMap := (*C.AAssetDir)(unsafe.Pointer(assetDir)), cgoAllocsUnknown - C.AAssetDir_rewind(cassetDir) - runtime.KeepAlive(cassetDirAllocMap) -} - -func AAssetManager_open(mgr *AAssetManager, filename string, mode int32) *AAsset { - cmgr, cmgrAllocMap := (*C.AAssetManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - cfilename, cfilenameAllocMap := UnpackPCharString(filename) - cmode, cmodeAllocMap := (C.int)(mode), cgoAllocsUnknown - __ret := C.AAssetManager_open(cmgr, cfilename, cmode) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(cfilenameAllocMap) - runtime.KeepAlive(cmgrAllocMap) - __v := (*AAsset)(unsafe.Pointer(__ret)) - return __v -} - -func AAssetManager_openDir(mgr *AAssetManager, dirName string) *AAssetDir { - cmgr, cmgrAllocMap := (*C.AAssetManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - cdirName, cdirNameAllocMap := UnpackPCharString(dirName) - __ret := C.AAssetManager_openDir(cmgr, cdirName) - runtime.KeepAlive(cdirNameAllocMap) - runtime.KeepAlive(cmgrAllocMap) - __v := (*AAssetDir)(unsafe.Pointer(__ret)) - return __v -} - -func AAsset_close(asset *AAsset) { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - C.AAsset_close(casset) - runtime.KeepAlive(cassetAllocMap) -} - -func AAsset_getBuffer(asset *AAsset) unsafe.Pointer { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getBuffer(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (unsafe.Pointer)(__ret) - return __v -} - -func AAsset_getLength(asset *AAsset) Off_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getLength(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (Off_t)(__ret) - return __v -} - -func AAsset_getLength64(asset *AAsset) Off64_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getLength64(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (Off64_t)(__ret) - return __v -} - -func AAsset_getRemainingLength(asset *AAsset) Off_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getRemainingLength(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (Off_t)(__ret) - return __v -} - -func AAsset_getRemainingLength64(asset *AAsset) Off64_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getRemainingLength64(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (Off64_t)(__ret) - return __v -} - -func AAsset_isAllocated(asset *AAsset) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_isAllocated(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAsset_openFileDescriptor(asset *AAsset, outStart *Off_t, outLength *Off_t) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coutStart, coutStartAllocMap := (*C.off_t)(unsafe.Pointer(outStart)), cgoAllocsUnknown - coutLength, coutLengthAllocMap := (*C.off_t)(unsafe.Pointer(outLength)), cgoAllocsUnknown - __ret := C.AAsset_openFileDescriptor(casset, coutStart, coutLength) - runtime.KeepAlive(coutLengthAllocMap) - runtime.KeepAlive(coutStartAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAsset_openFileDescriptor64(asset *AAsset, outStart *Off64_t, outLength *Off64_t) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coutStart, coutStartAllocMap := (*C.off64_t)(unsafe.Pointer(outStart)), cgoAllocsUnknown - coutLength, coutLengthAllocMap := (*C.off64_t)(unsafe.Pointer(outLength)), cgoAllocsUnknown - __ret := C.AAsset_openFileDescriptor64(casset, coutStart, coutLength) - runtime.KeepAlive(coutLengthAllocMap) - runtime.KeepAlive(coutStartAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAsset_read(asset *AAsset, buf unsafe.Pointer, count uint64) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - cbuf, cbufAllocMap := buf, cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint64_t)(count), cgoAllocsUnknown - __ret := C.AAsset_read(casset, cbuf, ccount) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cbufAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAsset_seek(asset *AAsset, offset Off_t, whence int32) Off_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.off_t)(offset), cgoAllocsUnknown - cwhence, cwhenceAllocMap := (C.int)(whence), cgoAllocsUnknown - __ret := C.AAsset_seek(casset, coffset, cwhence) - runtime.KeepAlive(cwhenceAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (Off_t)(__ret) - return __v -} - -func AAsset_seek64(asset *AAsset, offset Off64_t, whence int32) Off64_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.off64_t)(offset), cgoAllocsUnknown - cwhence, cwhenceAllocMap := (C.int)(whence), cgoAllocsUnknown - __ret := C.AAsset_seek64(casset, coffset, cwhence) - runtime.KeepAlive(cwhenceAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (Off64_t)(__ret) - return __v -} diff --git a/capi/asset/cgo_helpers.c b/capi/asset/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/asset/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/asset/cgo_helpers.go b/capi/asset/cgo_helpers.go deleted file mode 100644 index 3ce2813..0000000 --- a/capi/asset/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package asset - -/* -#cgo LDFLAGS: -landroid -#include "android/asset_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/asset/cgo_helpers.h b/capi/asset/cgo_helpers.h deleted file mode 100644 index 4571162..0000000 --- a/capi/asset/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/asset_manager.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/asset/const.go b/capi/asset/const.go deleted file mode 100644 index 8adcd3a..0000000 --- a/capi/asset/const.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package asset - -const ( - AASSET_MODE_UNKNOWN = 0 - AASSET_MODE_RANDOM = 1 - AASSET_MODE_STREAMING = 2 - AASSET_MODE_BUFFER = 3 -) diff --git a/capi/asset/doc.go b/capi/asset/doc.go deleted file mode 100644 index e916bb9..0000000 --- a/capi/asset/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android asset manager -*/ -package asset diff --git a/capi/asset/types.go b/capi/asset/types.go deleted file mode 100644 index c9ddc6d..0000000 --- a/capi/asset/types.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package asset - -/* -#cgo LDFLAGS: -landroid -#include "android/asset_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AAsset C.AAsset - -type AAssetDir C.AAssetDir - -type AAssetManager C.AAssetManager - -type Off64_t C.off64_t - -type Off_t C.off_t diff --git a/capi/binder/binder.go b/capi/binder/binder.go deleted file mode 100644 index 74a8a3c..0000000 --- a/capi/binder/binder.go +++ /dev/null @@ -1,1088 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package binder - -/* -#cgo LDFLAGS: -lbinder_ndk -#include "android/binder_ibinder.h" -#include "android/binder_parcel.h" -#include "android/binder_status.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AIBinder_Class_define(interfaceDescriptor string, onCreate AIBinder_Class_onCreate, onDestroy AIBinder_Class_onDestroy, onTransact AIBinder_Class_onTransact) *AIBinder_Class { - cinterfaceDescriptor, cinterfaceDescriptorAllocMap := UnpackPCharString(interfaceDescriptor) - conCreate, conCreateAllocMap := onCreate.PassValue() - conDestroy, conDestroyAllocMap := onDestroy.PassValue() - conTransact, conTransactAllocMap := onTransact.PassValue() - __ret := C.AIBinder_Class_define(cinterfaceDescriptor, conCreate, conDestroy, conTransact) - runtime.KeepAlive(conTransactAllocMap) - runtime.KeepAlive(conDestroyAllocMap) - runtime.KeepAlive(conCreateAllocMap) - runtime.KeepAlive(cinterfaceDescriptorAllocMap) - __v := (*AIBinder_Class)(unsafe.Pointer(__ret)) - return __v -} - -func AIBinder_Class_disableInterfaceTokenHeader(clazz *AIBinder_Class) { - cclazz, cclazzAllocMap := (*C.AIBinder_Class)(unsafe.Pointer(clazz)), cgoAllocsUnknown - C.AIBinder_Class_disableInterfaceTokenHeader(cclazz) - runtime.KeepAlive(cclazzAllocMap) -} - -func AIBinder_Class_getDescriptor(clazz *AIBinder_Class) string { - cclazz, cclazzAllocMap := (*C.AIBinder_Class)(unsafe.Pointer(clazz)), cgoAllocsUnknown - __ret := C.AIBinder_Class_getDescriptor(cclazz) - runtime.KeepAlive(cclazzAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AIBinder_Class_setOnDump(clazz *AIBinder_Class, onDump AIBinder_onDump) { - cclazz, cclazzAllocMap := (*C.AIBinder_Class)(unsafe.Pointer(clazz)), cgoAllocsUnknown - conDump, conDumpAllocMap := onDump.PassValue() - C.AIBinder_Class_setOnDump(cclazz, conDump) - runtime.KeepAlive(conDumpAllocMap) - runtime.KeepAlive(cclazzAllocMap) -} - -func AIBinder_DeathRecipient_delete(recipient *AIBinder_DeathRecipient) { - crecipient, crecipientAllocMap := (*C.AIBinder_DeathRecipient)(unsafe.Pointer(recipient)), cgoAllocsUnknown - C.AIBinder_DeathRecipient_delete(crecipient) - runtime.KeepAlive(crecipientAllocMap) -} - -func AIBinder_DeathRecipient_new(onBinderDied AIBinder_DeathRecipient_onBinderDied) *AIBinder_DeathRecipient { - conBinderDied, conBinderDiedAllocMap := onBinderDied.PassValue() - __ret := C.AIBinder_DeathRecipient_new(conBinderDied) - runtime.KeepAlive(conBinderDiedAllocMap) - __v := (*AIBinder_DeathRecipient)(unsafe.Pointer(__ret)) - return __v -} - -func AIBinder_DeathRecipient_setOnUnlinked(recipient *AIBinder_DeathRecipient, onUnlinked AIBinder_DeathRecipient_onBinderUnlinked) { - crecipient, crecipientAllocMap := (*C.AIBinder_DeathRecipient)(unsafe.Pointer(recipient)), cgoAllocsUnknown - conUnlinked, conUnlinkedAllocMap := onUnlinked.PassValue() - C.AIBinder_DeathRecipient_setOnUnlinked(crecipient, conUnlinked) - runtime.KeepAlive(conUnlinkedAllocMap) - runtime.KeepAlive(crecipientAllocMap) -} - -func AIBinder_Weak_clone(weak *AIBinder_Weak) *AIBinder_Weak { - cweak, cweakAllocMap := (*C.AIBinder_Weak)(unsafe.Pointer(weak)), cgoAllocsUnknown - __ret := C.AIBinder_Weak_clone(cweak) - runtime.KeepAlive(cweakAllocMap) - __v := (*AIBinder_Weak)(unsafe.Pointer(__ret)) - return __v -} - -func AIBinder_Weak_delete(weakBinder *AIBinder_Weak) { - cweakBinder, cweakBinderAllocMap := (*C.AIBinder_Weak)(unsafe.Pointer(weakBinder)), cgoAllocsUnknown - C.AIBinder_Weak_delete(cweakBinder) - runtime.KeepAlive(cweakBinderAllocMap) -} - -func AIBinder_Weak_lt(lhs *AIBinder_Weak, rhs *AIBinder_Weak) bool { - clhs, clhsAllocMap := (*C.AIBinder_Weak)(unsafe.Pointer(lhs)), cgoAllocsUnknown - crhs, crhsAllocMap := (*C.AIBinder_Weak)(unsafe.Pointer(rhs)), cgoAllocsUnknown - __ret := C.AIBinder_Weak_lt(clhs, crhs) - runtime.KeepAlive(crhsAllocMap) - runtime.KeepAlive(clhsAllocMap) - __v := (bool)(__ret) - return __v -} - -func AIBinder_Weak_new(binder *AIBinder) *AIBinder_Weak { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - __ret := C.AIBinder_Weak_new(cbinder) - runtime.KeepAlive(cbinderAllocMap) - __v := (*AIBinder_Weak)(unsafe.Pointer(__ret)) - return __v -} - -func AIBinder_Weak_promote(weakBinder *AIBinder_Weak) *AIBinder { - cweakBinder, cweakBinderAllocMap := (*C.AIBinder_Weak)(unsafe.Pointer(weakBinder)), cgoAllocsUnknown - __ret := C.AIBinder_Weak_promote(cweakBinder) - runtime.KeepAlive(cweakBinderAllocMap) - __v := (*AIBinder)(unsafe.Pointer(__ret)) - return __v -} - -func AIBinder_associateClass(binder *AIBinder, clazz *AIBinder_Class) bool { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - cclazz, cclazzAllocMap := (*C.AIBinder_Class)(unsafe.Pointer(clazz)), cgoAllocsUnknown - __ret := C.AIBinder_associateClass(cbinder, cclazz) - runtime.KeepAlive(cclazzAllocMap) - runtime.KeepAlive(cbinderAllocMap) - __v := (bool)(__ret) - return __v -} - -func AIBinder_debugGetRefCount(binder *AIBinder) int32 { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - __ret := C.AIBinder_debugGetRefCount(cbinder) - runtime.KeepAlive(cbinderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AIBinder_decStrong(binder *AIBinder) { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - C.AIBinder_decStrong(cbinder) - runtime.KeepAlive(cbinderAllocMap) -} - -func AIBinder_dump(binder *AIBinder, fd int32, args **int8, numArgs uint32) Binder_status_t { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - cargs, cargsAllocMap := (**C.char)(unsafe.Pointer(args)), cgoAllocsUnknown - var pinnercargs runtime.Pinner - pinnercargs.Pin(args) - if args != nil { - pinnercargs.Pin(unsafe.Pointer(*args)) - } - defer pinnercargs.Unpin() - cnumArgs, cnumArgsAllocMap := (C.uint)(numArgs), cgoAllocsUnknown - __ret := C.AIBinder_dump(cbinder, cfd, cargs, cnumArgs) - runtime.KeepAlive(cnumArgsAllocMap) - runtime.KeepAlive(cargsAllocMap) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(cbinderAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AIBinder_getCallingPid() Pid_t { - __ret := C.AIBinder_getCallingPid() - __v := (Pid_t)(__ret) - return __v -} - -func AIBinder_getCallingUid() Uid_t { - __ret := C.AIBinder_getCallingUid() - __v := (Uid_t)(__ret) - return __v -} - -func AIBinder_getClass(binder *AIBinder) *AIBinder_Class { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - __ret := C.AIBinder_getClass(cbinder) - runtime.KeepAlive(cbinderAllocMap) - __v := (*AIBinder_Class)(unsafe.Pointer(__ret)) - return __v -} - -func AIBinder_getExtension(binder *AIBinder, outExt **AIBinder) Binder_status_t { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - coutExt, coutExtAllocMap := (**C.AIBinder)(unsafe.Pointer(outExt)), cgoAllocsUnknown - var pinnercoutExt runtime.Pinner - pinnercoutExt.Pin(outExt) - if outExt != nil { - pinnercoutExt.Pin(unsafe.Pointer(*outExt)) - } - defer pinnercoutExt.Unpin() - __ret := C.AIBinder_getExtension(cbinder, coutExt) - runtime.KeepAlive(coutExtAllocMap) - runtime.KeepAlive(cbinderAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AIBinder_getUserData(binder *AIBinder) unsafe.Pointer { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - __ret := C.AIBinder_getUserData(cbinder) - runtime.KeepAlive(cbinderAllocMap) - __v := (unsafe.Pointer)(__ret) - return __v -} - -func AIBinder_incStrong(binder *AIBinder) { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - C.AIBinder_incStrong(cbinder) - runtime.KeepAlive(cbinderAllocMap) -} - -func AIBinder_isAlive(binder *AIBinder) bool { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - __ret := C.AIBinder_isAlive(cbinder) - runtime.KeepAlive(cbinderAllocMap) - __v := (bool)(__ret) - return __v -} - -func AIBinder_isHandlingTransaction() bool { - __ret := C.AIBinder_isHandlingTransaction() - __v := (bool)(__ret) - return __v -} - -func AIBinder_isRemote(binder *AIBinder) bool { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - __ret := C.AIBinder_isRemote(cbinder) - runtime.KeepAlive(cbinderAllocMap) - __v := (bool)(__ret) - return __v -} - -func AIBinder_linkToDeath(binder *AIBinder, recipient *AIBinder_DeathRecipient, cookie unsafe.Pointer) Binder_status_t { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - crecipient, crecipientAllocMap := (*C.AIBinder_DeathRecipient)(unsafe.Pointer(recipient)), cgoAllocsUnknown - ccookie, ccookieAllocMap := cookie, cgoAllocsUnknown - __ret := C.AIBinder_linkToDeath(cbinder, crecipient, ccookie) - runtime.KeepAlive(ccookieAllocMap) - runtime.KeepAlive(crecipientAllocMap) - runtime.KeepAlive(cbinderAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AIBinder_lt(lhs *AIBinder, rhs *AIBinder) bool { - clhs, clhsAllocMap := (*C.AIBinder)(unsafe.Pointer(lhs)), cgoAllocsUnknown - crhs, crhsAllocMap := (*C.AIBinder)(unsafe.Pointer(rhs)), cgoAllocsUnknown - __ret := C.AIBinder_lt(clhs, crhs) - runtime.KeepAlive(crhsAllocMap) - runtime.KeepAlive(clhsAllocMap) - __v := (bool)(__ret) - return __v -} - -func AIBinder_new(clazz *AIBinder_Class, args unsafe.Pointer) *AIBinder { - cclazz, cclazzAllocMap := (*C.AIBinder_Class)(unsafe.Pointer(clazz)), cgoAllocsUnknown - cargs, cargsAllocMap := args, cgoAllocsUnknown - __ret := C.AIBinder_new(cclazz, cargs) - runtime.KeepAlive(cargsAllocMap) - runtime.KeepAlive(cclazzAllocMap) - __v := (*AIBinder)(unsafe.Pointer(__ret)) - return __v -} - -func AIBinder_ping(binder *AIBinder) Binder_status_t { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - __ret := C.AIBinder_ping(cbinder) - runtime.KeepAlive(cbinderAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AIBinder_prepareTransaction(binder *AIBinder, in **AParcel) Binder_status_t { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - cin, cinAllocMap := (**C.AParcel)(unsafe.Pointer(in)), cgoAllocsUnknown - var pinnercin runtime.Pinner - pinnercin.Pin(in) - if in != nil { - pinnercin.Pin(unsafe.Pointer(*in)) - } - defer pinnercin.Unpin() - __ret := C.AIBinder_prepareTransaction(cbinder, cin) - runtime.KeepAlive(cinAllocMap) - runtime.KeepAlive(cbinderAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AIBinder_setExtension(binder *AIBinder, ext *AIBinder) Binder_status_t { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - cext, cextAllocMap := (*C.AIBinder)(unsafe.Pointer(ext)), cgoAllocsUnknown - __ret := C.AIBinder_setExtension(cbinder, cext) - runtime.KeepAlive(cextAllocMap) - runtime.KeepAlive(cbinderAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AIBinder_transact(binder *AIBinder, code Transaction_code_t, in **AParcel, out **AParcel, flags Binder_flags_t) Binder_status_t { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - ccode, ccodeAllocMap := (C.transaction_code_t)(code), cgoAllocsUnknown - cin, cinAllocMap := (**C.AParcel)(unsafe.Pointer(in)), cgoAllocsUnknown - var pinnercin runtime.Pinner - pinnercin.Pin(in) - if in != nil { - pinnercin.Pin(unsafe.Pointer(*in)) - } - defer pinnercin.Unpin() - cout, coutAllocMap := (**C.AParcel)(unsafe.Pointer(out)), cgoAllocsUnknown - var pinnercout runtime.Pinner - pinnercout.Pin(out) - if out != nil { - pinnercout.Pin(unsafe.Pointer(*out)) - } - defer pinnercout.Unpin() - cflags, cflagsAllocMap := (C.binder_flags_t)(flags), cgoAllocsUnknown - __ret := C.AIBinder_transact(cbinder, ccode, cin, cout, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(coutAllocMap) - runtime.KeepAlive(cinAllocMap) - runtime.KeepAlive(ccodeAllocMap) - runtime.KeepAlive(cbinderAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AIBinder_unlinkToDeath(binder *AIBinder, recipient *AIBinder_DeathRecipient, cookie unsafe.Pointer) Binder_status_t { - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - crecipient, crecipientAllocMap := (*C.AIBinder_DeathRecipient)(unsafe.Pointer(recipient)), cgoAllocsUnknown - ccookie, ccookieAllocMap := cookie, cgoAllocsUnknown - __ret := C.AIBinder_unlinkToDeath(cbinder, crecipient, ccookie) - runtime.KeepAlive(ccookieAllocMap) - runtime.KeepAlive(crecipientAllocMap) - runtime.KeepAlive(cbinderAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_appendFrom(from *AParcel, to *AParcel, start int32, size int32) Binder_status_t { - cfrom, cfromAllocMap := (*C.AParcel)(unsafe.Pointer(from)), cgoAllocsUnknown - cto, ctoAllocMap := (*C.AParcel)(unsafe.Pointer(to)), cgoAllocsUnknown - cstart, cstartAllocMap := (C.int)(start), cgoAllocsUnknown - csize, csizeAllocMap := (C.int)(size), cgoAllocsUnknown - __ret := C.AParcel_appendFrom(cfrom, cto, cstart, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cstartAllocMap) - runtime.KeepAlive(ctoAllocMap) - runtime.KeepAlive(cfromAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_create() *AParcel { - __ret := C.AParcel_create() - __v := (*AParcel)(unsafe.Pointer(__ret)) - return __v -} - -func AParcel_delete(parcel *AParcel) { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - C.AParcel_delete(cparcel) - runtime.KeepAlive(cparcelAllocMap) -} - -func AParcel_getDataPosition(parcel *AParcel) int32 { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - __ret := C.AParcel_getDataPosition(cparcel) - runtime.KeepAlive(cparcelAllocMap) - __v := (int32)(__ret) - return __v -} - -func AParcel_getDataSize(parcel *AParcel) int32 { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - __ret := C.AParcel_getDataSize(cparcel) - runtime.KeepAlive(cparcelAllocMap) - __v := (int32)(__ret) - return __v -} - -func AParcel_marshal(parcel *AParcel, buffer *uint8, start uint64, len uint64) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (*C.uint8_t)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cstart, cstartAllocMap := (C.uint64_t)(start), cgoAllocsUnknown - clen, clenAllocMap := (C.uint64_t)(len), cgoAllocsUnknown - __ret := C.AParcel_marshal(cparcel, cbuffer, cstart, clen) - runtime.KeepAlive(clenAllocMap) - runtime.KeepAlive(cstartAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readBool(parcel *AParcel, value *bool) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C._Bool)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readBool(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readBoolArray(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_boolArrayAllocator, setter AParcel_boolArraySetter) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - csetter, csetterAllocMap := setter.PassValue() - __ret := C.AParcel_readBoolArray(cparcel, carrayData, callocator, csetter) - runtime.KeepAlive(csetterAllocMap) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readByte(parcel *AParcel, value *int8) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.int8_t)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readByte(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readByteArray(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_byteArrayAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readByteArray(cparcel, carrayData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readChar(parcel *AParcel, value *Char16_t) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.char16_t)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readChar(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readCharArray(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_charArrayAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readCharArray(cparcel, carrayData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readDouble(parcel *AParcel, value *float64) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.double)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readDouble(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readDoubleArray(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_doubleArrayAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readDoubleArray(cparcel, carrayData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readFloat(parcel *AParcel, value *float32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.float)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readFloat(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readFloatArray(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_floatArrayAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readFloatArray(cparcel, carrayData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readInt32(parcel *AParcel, value *int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.int)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readInt32(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readInt32Array(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_int32ArrayAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readInt32Array(cparcel, carrayData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readInt64(parcel *AParcel, value *int64) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.int64_t)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readInt64(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readInt64Array(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_int64ArrayAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readInt64Array(cparcel, carrayData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readParcelFileDescriptor(parcel *AParcel, fd *int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cfd, cfdAllocMap := (*C.int)(unsafe.Pointer(fd)), cgoAllocsUnknown - __ret := C.AParcel_readParcelFileDescriptor(cparcel, cfd) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readParcelableArray(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_parcelableArrayAllocator, elementReader AParcel_readParcelableElement) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - celementReader, celementReaderAllocMap := elementReader.PassValue() - __ret := C.AParcel_readParcelableArray(cparcel, carrayData, callocator, celementReader) - runtime.KeepAlive(celementReaderAllocMap) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readStatusHeader(parcel *AParcel, status **AStatus) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cstatus, cstatusAllocMap := (**C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - var pinnercstatus runtime.Pinner - pinnercstatus.Pin(status) - if status != nil { - pinnercstatus.Pin(unsafe.Pointer(*status)) - } - defer pinnercstatus.Unpin() - __ret := C.AParcel_readStatusHeader(cparcel, cstatus) - runtime.KeepAlive(cstatusAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readString(parcel *AParcel, stringData unsafe.Pointer, allocator AParcel_stringAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cstringData, cstringDataAllocMap := stringData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readString(cparcel, cstringData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(cstringDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readStringArray(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_stringArrayAllocator, elementAllocator AParcel_stringArrayElementAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - celementAllocator, celementAllocatorAllocMap := elementAllocator.PassValue() - __ret := C.AParcel_readStringArray(cparcel, carrayData, callocator, celementAllocator) - runtime.KeepAlive(celementAllocatorAllocMap) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readStrongBinder(parcel *AParcel, binder **AIBinder) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cbinder, cbinderAllocMap := (**C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - var pinnercbinder runtime.Pinner - pinnercbinder.Pin(binder) - if binder != nil { - pinnercbinder.Pin(unsafe.Pointer(*binder)) - } - defer pinnercbinder.Unpin() - __ret := C.AParcel_readStrongBinder(cparcel, cbinder) - runtime.KeepAlive(cbinderAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readUint32(parcel *AParcel, value *uint32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.uint)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readUint32(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readUint32Array(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_uint32ArrayAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readUint32Array(cparcel, carrayData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readUint64(parcel *AParcel, value *uint64) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.uint64_t)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.AParcel_readUint64(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_readUint64Array(parcel *AParcel, arrayData unsafe.Pointer, allocator AParcel_uint64ArrayAllocator) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - callocator, callocatorAllocMap := allocator.PassValue() - __ret := C.AParcel_readUint64Array(cparcel, carrayData, callocator) - runtime.KeepAlive(callocatorAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_reset(parcel *AParcel) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - __ret := C.AParcel_reset(cparcel) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_setDataPosition(parcel *AParcel, position int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cposition, cpositionAllocMap := (C.int)(position), cgoAllocsUnknown - __ret := C.AParcel_setDataPosition(cparcel, cposition) - runtime.KeepAlive(cpositionAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_unmarshal(parcel *AParcel, buffer *uint8, len uint64) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (*C.uint8_t)(unsafe.Pointer(buffer)), cgoAllocsUnknown - clen, clenAllocMap := (C.uint64_t)(len), cgoAllocsUnknown - __ret := C.AParcel_unmarshal(cparcel, cbuffer, clen) - runtime.KeepAlive(clenAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeBool(parcel *AParcel, value bool) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C._Bool)(value), cgoAllocsUnknown - __ret := C.AParcel_writeBool(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeBoolArray(parcel *AParcel, arrayData unsafe.Pointer, length int32, getter AParcel_boolArrayGetter) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - cgetter, cgetterAllocMap := getter.PassValue() - __ret := C.AParcel_writeBoolArray(cparcel, carrayData, clength, cgetter) - runtime.KeepAlive(cgetterAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeByte(parcel *AParcel, value int8) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.int8_t)(value), cgoAllocsUnknown - __ret := C.AParcel_writeByte(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeByteArray(parcel *AParcel, arrayData *int8, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := (*C.int8_t)(unsafe.Pointer(arrayData)), cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeByteArray(cparcel, carrayData, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeChar(parcel *AParcel, value Char16_t) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.char16_t)(value), cgoAllocsUnknown - __ret := C.AParcel_writeChar(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeCharArray(parcel *AParcel, arrayData *Char16_t, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := (*C.char16_t)(unsafe.Pointer(arrayData)), cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeCharArray(cparcel, carrayData, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeDouble(parcel *AParcel, value float64) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.double)(value), cgoAllocsUnknown - __ret := C.AParcel_writeDouble(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeDoubleArray(parcel *AParcel, arrayData *float64, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := (*C.double)(unsafe.Pointer(arrayData)), cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeDoubleArray(cparcel, carrayData, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeFloat(parcel *AParcel, value float32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.float)(value), cgoAllocsUnknown - __ret := C.AParcel_writeFloat(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeFloatArray(parcel *AParcel, arrayData *float32, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := (*C.float)(unsafe.Pointer(arrayData)), cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeFloatArray(cparcel, carrayData, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeInt32(parcel *AParcel, value int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.int)(value), cgoAllocsUnknown - __ret := C.AParcel_writeInt32(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeInt32Array(parcel *AParcel, arrayData *int32, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := (*C.int)(unsafe.Pointer(arrayData)), cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeInt32Array(cparcel, carrayData, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeInt64(parcel *AParcel, value int64) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.int64_t)(value), cgoAllocsUnknown - __ret := C.AParcel_writeInt64(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeInt64Array(parcel *AParcel, arrayData *int64, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := (*C.int64_t)(unsafe.Pointer(arrayData)), cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeInt64Array(cparcel, carrayData, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeParcelFileDescriptor(parcel *AParcel, fd int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - __ret := C.AParcel_writeParcelFileDescriptor(cparcel, cfd) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeParcelableArray(parcel *AParcel, arrayData unsafe.Pointer, length int32, elementWriter AParcel_writeParcelableElement) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - celementWriter, celementWriterAllocMap := elementWriter.PassValue() - __ret := C.AParcel_writeParcelableArray(cparcel, carrayData, clength, celementWriter) - runtime.KeepAlive(celementWriterAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeStatusHeader(parcel *AParcel, status *AStatus) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cstatus, cstatusAllocMap := (*C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - __ret := C.AParcel_writeStatusHeader(cparcel, cstatus) - runtime.KeepAlive(cstatusAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeString(parcel *AParcel, _string string, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - c_string, c_stringAllocMap := UnpackPCharString(_string) - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeString(cparcel, c_string, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(c_stringAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeStringArray(parcel *AParcel, arrayData unsafe.Pointer, length int32, getter AParcel_stringArrayElementGetter) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := arrayData, cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - cgetter, cgetterAllocMap := getter.PassValue() - __ret := C.AParcel_writeStringArray(cparcel, carrayData, clength, cgetter) - runtime.KeepAlive(cgetterAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeStrongBinder(parcel *AParcel, binder *AIBinder) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cbinder, cbinderAllocMap := (*C.AIBinder)(unsafe.Pointer(binder)), cgoAllocsUnknown - __ret := C.AParcel_writeStrongBinder(cparcel, cbinder) - runtime.KeepAlive(cbinderAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeUint32(parcel *AParcel, value uint32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.uint)(value), cgoAllocsUnknown - __ret := C.AParcel_writeUint32(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeUint32Array(parcel *AParcel, arrayData *uint32, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := (*C.uint)(unsafe.Pointer(arrayData)), cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeUint32Array(cparcel, carrayData, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeUint64(parcel *AParcel, value uint64) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.uint64_t)(value), cgoAllocsUnknown - __ret := C.AParcel_writeUint64(cparcel, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AParcel_writeUint64Array(parcel *AParcel, arrayData *uint64, length int32) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - carrayData, carrayDataAllocMap := (*C.uint64_t)(unsafe.Pointer(arrayData)), cgoAllocsUnknown - clength, clengthAllocMap := (C.int)(length), cgoAllocsUnknown - __ret := C.AParcel_writeUint64Array(cparcel, carrayData, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(carrayDataAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AStatus_delete(status *AStatus) { - cstatus, cstatusAllocMap := (*C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - C.AStatus_delete(cstatus) - runtime.KeepAlive(cstatusAllocMap) -} - -func AStatus_deleteDescription(description string) { - cdescription, cdescriptionAllocMap := UnpackPCharString(description) - C.AStatus_deleteDescription(cdescription) - runtime.KeepAlive(cdescriptionAllocMap) -} - -func AStatus_fromExceptionCode(exception Binder_exception_t) *AStatus { - cexception, cexceptionAllocMap := (C.binder_exception_t)(exception), cgoAllocsUnknown - __ret := C.AStatus_fromExceptionCode(cexception) - runtime.KeepAlive(cexceptionAllocMap) - __v := (*AStatus)(unsafe.Pointer(__ret)) - return __v -} - -func AStatus_fromExceptionCodeWithMessage(exception Binder_exception_t, message string) *AStatus { - cexception, cexceptionAllocMap := (C.binder_exception_t)(exception), cgoAllocsUnknown - cmessage, cmessageAllocMap := UnpackPCharString(message) - __ret := C.AStatus_fromExceptionCodeWithMessage(cexception, cmessage) - runtime.KeepAlive(cmessageAllocMap) - runtime.KeepAlive(cexceptionAllocMap) - __v := (*AStatus)(unsafe.Pointer(__ret)) - return __v -} - -func AStatus_fromServiceSpecificError(serviceSpecific int32) *AStatus { - cserviceSpecific, cserviceSpecificAllocMap := (C.int)(serviceSpecific), cgoAllocsUnknown - __ret := C.AStatus_fromServiceSpecificError(cserviceSpecific) - runtime.KeepAlive(cserviceSpecificAllocMap) - __v := (*AStatus)(unsafe.Pointer(__ret)) - return __v -} - -func AStatus_fromServiceSpecificErrorWithMessage(serviceSpecific int32, message string) *AStatus { - cserviceSpecific, cserviceSpecificAllocMap := (C.int)(serviceSpecific), cgoAllocsUnknown - cmessage, cmessageAllocMap := UnpackPCharString(message) - __ret := C.AStatus_fromServiceSpecificErrorWithMessage(cserviceSpecific, cmessage) - runtime.KeepAlive(cmessageAllocMap) - runtime.KeepAlive(cserviceSpecificAllocMap) - __v := (*AStatus)(unsafe.Pointer(__ret)) - return __v -} - -func AStatus_fromStatus(status Binder_status_t) *AStatus { - cstatus, cstatusAllocMap := (C.binder_status_t)(status), cgoAllocsUnknown - __ret := C.AStatus_fromStatus(cstatus) - runtime.KeepAlive(cstatusAllocMap) - __v := (*AStatus)(unsafe.Pointer(__ret)) - return __v -} - -func AStatus_getDescription(status *AStatus) string { - cstatus, cstatusAllocMap := (*C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - __ret := C.AStatus_getDescription(cstatus) - runtime.KeepAlive(cstatusAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AStatus_getExceptionCode(status *AStatus) Binder_exception_t { - cstatus, cstatusAllocMap := (*C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - __ret := C.AStatus_getExceptionCode(cstatus) - runtime.KeepAlive(cstatusAllocMap) - __v := (Binder_exception_t)(__ret) - return __v -} - -func AStatus_getMessage(status *AStatus) string { - cstatus, cstatusAllocMap := (*C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - __ret := C.AStatus_getMessage(cstatus) - runtime.KeepAlive(cstatusAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AStatus_getServiceSpecificError(status *AStatus) int32 { - cstatus, cstatusAllocMap := (*C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - __ret := C.AStatus_getServiceSpecificError(cstatus) - runtime.KeepAlive(cstatusAllocMap) - __v := (int32)(__ret) - return __v -} - -func AStatus_getStatus(status *AStatus) Binder_status_t { - cstatus, cstatusAllocMap := (*C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - __ret := C.AStatus_getStatus(cstatus) - runtime.KeepAlive(cstatusAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func AStatus_isOk(status *AStatus) bool { - cstatus, cstatusAllocMap := (*C.AStatus)(unsafe.Pointer(status)), cgoAllocsUnknown - __ret := C.AStatus_isOk(cstatus) - runtime.KeepAlive(cstatusAllocMap) - __v := (bool)(__ret) - return __v -} - -func AStatus_newOk() *AStatus { - __ret := C.AStatus_newOk() - __v := (*AStatus)(unsafe.Pointer(__ret)) - return __v -} diff --git a/capi/binder/cgo_helpers.c b/capi/binder/cgo_helpers.c deleted file mode 100644 index 46c0a25..0000000 --- a/capi/binder/cgo_helpers.c +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void* AIBinder_Class_onCreate_ae3e288c(void* args) { - return AIBinder_Class_onCreateAE3E288C(args); -} - -void AIBinder_Class_onDestroy_2c719d10(void* userData) { - AIBinder_Class_onDestroy2C719D10(userData); -} - -binder_status_t AIBinder_Class_onTransact_4c5b3f35(AIBinder* binder, transaction_code_t code, const AParcel* in, AParcel* out) { - return AIBinder_Class_onTransact4C5B3F35(binder, code, (AParcel*)in, out); -} - -void AIBinder_DeathRecipient_onBinderDied_7d6f4f1b() { - AIBinder_DeathRecipient_onBinderDied7D6F4F1B(); -} - -void AIBinder_DeathRecipient_onBinderUnlinked_6d499f91() { - AIBinder_DeathRecipient_onBinderUnlinked6D499F91(); -} - -binder_status_t AIBinder_onDump_04709357(AIBinder* binder, int fd, const char** args, uint32_t numArgs) { - return AIBinder_onDump04709357(binder, fd, (char**)args, numArgs); -} - -_Bool AParcel_boolArrayAllocator_6ce04d29(void* arrayData, int32_t length) { - return AParcel_boolArrayAllocator6CE04D29(arrayData, length); -} - -_Bool AParcel_boolArrayGetter_58f10d8e(const void* arrayData, size_t index) { - return AParcel_boolArrayGetter58F10D8E((void*)arrayData, index); -} - -void AParcel_boolArraySetter_c31d06a6(void* arrayData, size_t index, bool value) { - AParcel_boolArraySetterC31D06A6(arrayData, index, value); -} - -_Bool AParcel_byteArrayAllocator_0f5d9bcb(void* arrayData, int32_t length, int8_t** outBuffer) { - return AParcel_byteArrayAllocator0F5D9BCB(arrayData, length, outBuffer); -} - -_Bool AParcel_charArrayAllocator_e28a23c0(void* arrayData, int32_t length, char16_t** outBuffer) { - return AParcel_charArrayAllocatorE28A23C0(arrayData, length, outBuffer); -} - -_Bool AParcel_doubleArrayAllocator_0d8e072d(void* arrayData, int32_t length, double** outBuffer) { - return AParcel_doubleArrayAllocator0D8E072D(arrayData, length, outBuffer); -} - -_Bool AParcel_floatArrayAllocator_ddd314b6(void* arrayData, int32_t length, float** outBuffer) { - return AParcel_floatArrayAllocatorDDD314B6(arrayData, length, outBuffer); -} - -_Bool AParcel_int32ArrayAllocator_632db075(void* arrayData, int32_t length, int32_t** outBuffer) { - return AParcel_int32ArrayAllocator632DB075(arrayData, length, outBuffer); -} - -_Bool AParcel_int64ArrayAllocator_e9ccd3bd(void* arrayData, int32_t length, int64_t** outBuffer) { - return AParcel_int64ArrayAllocatorE9CCD3BD(arrayData, length, outBuffer); -} - -_Bool AParcel_parcelableArrayAllocator_6a96d230(void* arrayData, int32_t length) { - return AParcel_parcelableArrayAllocator6A96D230(arrayData, length); -} - -binder_status_t AParcel_readParcelableElement_f5964747(const AParcel* parcel, void* arrayData, size_t index) { - return AParcel_readParcelableElementF5964747((AParcel*)parcel, arrayData, index); -} - -_Bool AParcel_stringAllocator_fed8100a(void* stringData, int32_t length, char** buffer) { - return AParcel_stringAllocatorFED8100A(stringData, length, buffer); -} - -_Bool AParcel_stringArrayAllocator_a431f501(void* arrayData, int32_t length) { - return AParcel_stringArrayAllocatorA431F501(arrayData, length); -} - -_Bool AParcel_stringArrayElementAllocator_9ac166ca(void* arrayData, size_t index, int32_t length, char** buffer) { - return AParcel_stringArrayElementAllocator9AC166CA(arrayData, index, length, buffer); -} - -const char* AParcel_stringArrayElementGetter_6817b794(const void* arrayData, size_t index, int32_t* outLength) { - return AParcel_stringArrayElementGetter6817B794((void*)arrayData, index, outLength); -} - -_Bool AParcel_uint32ArrayAllocator_dffad45c(void* arrayData, int32_t length, uint32_t** outBuffer) { - return AParcel_uint32ArrayAllocatorDFFAD45C(arrayData, length, outBuffer); -} - -_Bool AParcel_uint64ArrayAllocator_cf52b274(void* arrayData, int32_t length, uint64_t** outBuffer) { - return AParcel_uint64ArrayAllocatorCF52B274(arrayData, length, outBuffer); -} - -binder_status_t AParcel_writeParcelableElement_73cca07c(AParcel* parcel, const void* arrayData, size_t index) { - return AParcel_writeParcelableElement73CCA07C(parcel, (void*)arrayData, index); -} diff --git a/capi/binder/cgo_helpers.go b/capi/binder/cgo_helpers.go deleted file mode 100644 index 9a76aa5..0000000 --- a/capi/binder/cgo_helpers.go +++ /dev/null @@ -1,1007 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package binder - -/* -#cgo LDFLAGS: -lbinder_ndk -#include "android/binder_ibinder.h" -#include "android/binder_parcel.h" -#include "android/binder_status.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x AIBinder_Class_onCreate) PassRef() (ref *C.AIBinder_Class_onCreate, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_Class_onCreateAE3E288CFunc == nil { - aIBinder_Class_onCreateAE3E288CFunc = x - } - return (*C.AIBinder_Class_onCreate)(C.AIBinder_Class_onCreate_ae3e288c), nil -} - -func (x AIBinder_Class_onCreate) PassValue() (ref C.AIBinder_Class_onCreate, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_Class_onCreateAE3E288CFunc == nil { - aIBinder_Class_onCreateAE3E288CFunc = x - } - return (C.AIBinder_Class_onCreate)(C.AIBinder_Class_onCreate_ae3e288c), nil -} - -func NewAIBinder_Class_onCreateRef(ref unsafe.Pointer) *AIBinder_Class_onCreate { - return (*AIBinder_Class_onCreate)(ref) -} - -//export AIBinder_Class_onCreateAE3E288C -func AIBinder_Class_onCreateAE3E288C(cargs unsafe.Pointer) unsafe.Pointer { - if aIBinder_Class_onCreateAE3E288CFunc != nil { - argsae3e288c := (unsafe.Pointer)(unsafe.Pointer(cargs)) - retae3e288c := aIBinder_Class_onCreateAE3E288CFunc(argsae3e288c) - ret, _ := (unsafe.Pointer)(retae3e288c), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aIBinder_Class_onCreateAE3E288CFunc AIBinder_Class_onCreate - -func (x AIBinder_Class_onDestroy) PassRef() (ref *C.AIBinder_Class_onDestroy, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_Class_onDestroy2C719D10Func == nil { - aIBinder_Class_onDestroy2C719D10Func = x - } - return (*C.AIBinder_Class_onDestroy)(C.AIBinder_Class_onDestroy_2c719d10), nil -} - -func (x AIBinder_Class_onDestroy) PassValue() (ref C.AIBinder_Class_onDestroy, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_Class_onDestroy2C719D10Func == nil { - aIBinder_Class_onDestroy2C719D10Func = x - } - return (C.AIBinder_Class_onDestroy)(C.AIBinder_Class_onDestroy_2c719d10), nil -} - -func NewAIBinder_Class_onDestroyRef(ref unsafe.Pointer) *AIBinder_Class_onDestroy { - return (*AIBinder_Class_onDestroy)(ref) -} - -//export AIBinder_Class_onDestroy2C719D10 -func AIBinder_Class_onDestroy2C719D10(cuserData unsafe.Pointer) { - if aIBinder_Class_onDestroy2C719D10Func != nil { - userData2c719d10 := (unsafe.Pointer)(unsafe.Pointer(cuserData)) - aIBinder_Class_onDestroy2C719D10Func(userData2c719d10) - return - } - panic("callback func has not been set (race?)") -} - -var aIBinder_Class_onDestroy2C719D10Func AIBinder_Class_onDestroy - -func (x AIBinder_Class_onTransact) PassRef() (ref *C.AIBinder_Class_onTransact, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_Class_onTransact4C5B3F35Func == nil { - aIBinder_Class_onTransact4C5B3F35Func = x - } - return (*C.AIBinder_Class_onTransact)(C.AIBinder_Class_onTransact_4c5b3f35), nil -} - -func (x AIBinder_Class_onTransact) PassValue() (ref C.AIBinder_Class_onTransact, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_Class_onTransact4C5B3F35Func == nil { - aIBinder_Class_onTransact4C5B3F35Func = x - } - return (C.AIBinder_Class_onTransact)(C.AIBinder_Class_onTransact_4c5b3f35), nil -} - -func NewAIBinder_Class_onTransactRef(ref unsafe.Pointer) *AIBinder_Class_onTransact { - return (*AIBinder_Class_onTransact)(ref) -} - -//export AIBinder_Class_onTransact4C5B3F35 -func AIBinder_Class_onTransact4C5B3F35(cbinder *C.AIBinder, ccode C.transaction_code_t, cin *C.AParcel, cout *C.AParcel) C.binder_status_t { - if aIBinder_Class_onTransact4C5B3F35Func != nil { - binder4c5b3f35 := (*AIBinder)(unsafe.Pointer(cbinder)) - code4c5b3f35 := (Transaction_code_t)(ccode) - in4c5b3f35 := (*AParcel)(unsafe.Pointer(cin)) - out4c5b3f35 := (*AParcel)(unsafe.Pointer(cout)) - ret4c5b3f35 := aIBinder_Class_onTransact4C5B3F35Func(binder4c5b3f35, code4c5b3f35, in4c5b3f35, out4c5b3f35) - ret, _ := (C.binder_status_t)(ret4c5b3f35), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aIBinder_Class_onTransact4C5B3F35Func AIBinder_Class_onTransact - -func (x AIBinder_DeathRecipient_onBinderDied) PassRef() (ref *C.AIBinder_DeathRecipient_onBinderDied, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_DeathRecipient_onBinderDied7D6F4F1BFunc == nil { - aIBinder_DeathRecipient_onBinderDied7D6F4F1BFunc = x - } - return (*C.AIBinder_DeathRecipient_onBinderDied)(C.AIBinder_DeathRecipient_onBinderDied_7d6f4f1b), nil -} - -func (x AIBinder_DeathRecipient_onBinderDied) PassValue() (ref C.AIBinder_DeathRecipient_onBinderDied, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_DeathRecipient_onBinderDied7D6F4F1BFunc == nil { - aIBinder_DeathRecipient_onBinderDied7D6F4F1BFunc = x - } - return (C.AIBinder_DeathRecipient_onBinderDied)(C.AIBinder_DeathRecipient_onBinderDied_7d6f4f1b), nil -} - -func NewAIBinder_DeathRecipient_onBinderDiedRef(ref unsafe.Pointer) *AIBinder_DeathRecipient_onBinderDied { - return (*AIBinder_DeathRecipient_onBinderDied)(ref) -} - -//export AIBinder_DeathRecipient_onBinderDied7D6F4F1B -func AIBinder_DeathRecipient_onBinderDied7D6F4F1B() { - if aIBinder_DeathRecipient_onBinderDied7D6F4F1BFunc != nil { - aIBinder_DeathRecipient_onBinderDied7D6F4F1BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var aIBinder_DeathRecipient_onBinderDied7D6F4F1BFunc AIBinder_DeathRecipient_onBinderDied - -func (x AIBinder_DeathRecipient_onBinderUnlinked) PassRef() (ref *C.AIBinder_DeathRecipient_onBinderUnlinked, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_DeathRecipient_onBinderUnlinked6D499F91Func == nil { - aIBinder_DeathRecipient_onBinderUnlinked6D499F91Func = x - } - return (*C.AIBinder_DeathRecipient_onBinderUnlinked)(C.AIBinder_DeathRecipient_onBinderUnlinked_6d499f91), nil -} - -func (x AIBinder_DeathRecipient_onBinderUnlinked) PassValue() (ref C.AIBinder_DeathRecipient_onBinderUnlinked, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_DeathRecipient_onBinderUnlinked6D499F91Func == nil { - aIBinder_DeathRecipient_onBinderUnlinked6D499F91Func = x - } - return (C.AIBinder_DeathRecipient_onBinderUnlinked)(C.AIBinder_DeathRecipient_onBinderUnlinked_6d499f91), nil -} - -func NewAIBinder_DeathRecipient_onBinderUnlinkedRef(ref unsafe.Pointer) *AIBinder_DeathRecipient_onBinderUnlinked { - return (*AIBinder_DeathRecipient_onBinderUnlinked)(ref) -} - -//export AIBinder_DeathRecipient_onBinderUnlinked6D499F91 -func AIBinder_DeathRecipient_onBinderUnlinked6D499F91() { - if aIBinder_DeathRecipient_onBinderUnlinked6D499F91Func != nil { - aIBinder_DeathRecipient_onBinderUnlinked6D499F91Func() - return - } - panic("callback func has not been set (race?)") -} - -var aIBinder_DeathRecipient_onBinderUnlinked6D499F91Func AIBinder_DeathRecipient_onBinderUnlinked - -func (x AIBinder_onDump) PassRef() (ref *C.AIBinder_onDump, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_onDump04709357Func == nil { - aIBinder_onDump04709357Func = x - } - return (*C.AIBinder_onDump)(C.AIBinder_onDump_04709357), nil -} - -func (x AIBinder_onDump) PassValue() (ref C.AIBinder_onDump, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aIBinder_onDump04709357Func == nil { - aIBinder_onDump04709357Func = x - } - return (C.AIBinder_onDump)(C.AIBinder_onDump_04709357), nil -} - -func NewAIBinder_onDumpRef(ref unsafe.Pointer) *AIBinder_onDump { - return (*AIBinder_onDump)(ref) -} - -//export AIBinder_onDump04709357 -func AIBinder_onDump04709357(cbinder *C.AIBinder, cfd C.int, cargs **C.char, cnumArgs C.uint32_t) C.binder_status_t { - if aIBinder_onDump04709357Func != nil { - binder04709357 := (*AIBinder)(unsafe.Pointer(cbinder)) - fd04709357 := (int32)(cfd) - args04709357 := (**int8)(unsafe.Pointer(cargs)) - numArgs04709357 := (uint32)(cnumArgs) - ret04709357 := aIBinder_onDump04709357Func(binder04709357, fd04709357, args04709357, numArgs04709357) - ret, _ := (C.binder_status_t)(ret04709357), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aIBinder_onDump04709357Func AIBinder_onDump - -func (x AParcel_boolArrayAllocator) PassRef() (ref *C.AParcel_boolArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_boolArrayAllocator6CE04D29Func == nil { - aParcel_boolArrayAllocator6CE04D29Func = x - } - return (*C.AParcel_boolArrayAllocator)(C.AParcel_boolArrayAllocator_6ce04d29), nil -} - -func (x AParcel_boolArrayAllocator) PassValue() (ref C.AParcel_boolArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_boolArrayAllocator6CE04D29Func == nil { - aParcel_boolArrayAllocator6CE04D29Func = x - } - return (C.AParcel_boolArrayAllocator)(C.AParcel_boolArrayAllocator_6ce04d29), nil -} - -func NewAParcel_boolArrayAllocatorRef(ref unsafe.Pointer) *AParcel_boolArrayAllocator { - return (*AParcel_boolArrayAllocator)(ref) -} - -//export AParcel_boolArrayAllocator6CE04D29 -func AParcel_boolArrayAllocator6CE04D29(carrayData unsafe.Pointer, clength C.int32_t) C._Bool { - if aParcel_boolArrayAllocator6CE04D29Func != nil { - arrayData6ce04d29 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - length6ce04d29 := (int32)(clength) - ret6ce04d29 := aParcel_boolArrayAllocator6CE04D29Func(arrayData6ce04d29, length6ce04d29) - ret, _ := (C._Bool)(ret6ce04d29), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_boolArrayAllocator6CE04D29Func AParcel_boolArrayAllocator - -func (x AParcel_boolArrayGetter) PassRef() (ref *C.AParcel_boolArrayGetter, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_boolArrayGetter58F10D8EFunc == nil { - aParcel_boolArrayGetter58F10D8EFunc = x - } - return (*C.AParcel_boolArrayGetter)(C.AParcel_boolArrayGetter_58f10d8e), nil -} - -func (x AParcel_boolArrayGetter) PassValue() (ref C.AParcel_boolArrayGetter, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_boolArrayGetter58F10D8EFunc == nil { - aParcel_boolArrayGetter58F10D8EFunc = x - } - return (C.AParcel_boolArrayGetter)(C.AParcel_boolArrayGetter_58f10d8e), nil -} - -func NewAParcel_boolArrayGetterRef(ref unsafe.Pointer) *AParcel_boolArrayGetter { - return (*AParcel_boolArrayGetter)(ref) -} - -//export AParcel_boolArrayGetter58F10D8E -func AParcel_boolArrayGetter58F10D8E(carrayData unsafe.Pointer, cindex C.size_t) C._Bool { - if aParcel_boolArrayGetter58F10D8EFunc != nil { - arrayData58f10d8e := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - index58f10d8e := (uint64)(cindex) - ret58f10d8e := aParcel_boolArrayGetter58F10D8EFunc(arrayData58f10d8e, index58f10d8e) - ret, _ := (C._Bool)(ret58f10d8e), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_boolArrayGetter58F10D8EFunc AParcel_boolArrayGetter - -func (x AParcel_boolArraySetter) PassRef() (ref *C.AParcel_boolArraySetter, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_boolArraySetterC31D06A6Func == nil { - aParcel_boolArraySetterC31D06A6Func = x - } - return (*C.AParcel_boolArraySetter)(C.AParcel_boolArraySetter_c31d06a6), nil -} - -func (x AParcel_boolArraySetter) PassValue() (ref C.AParcel_boolArraySetter, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_boolArraySetterC31D06A6Func == nil { - aParcel_boolArraySetterC31D06A6Func = x - } - return (C.AParcel_boolArraySetter)(C.AParcel_boolArraySetter_c31d06a6), nil -} - -func NewAParcel_boolArraySetterRef(ref unsafe.Pointer) *AParcel_boolArraySetter { - return (*AParcel_boolArraySetter)(ref) -} - -//export AParcel_boolArraySetterC31D06A6 -func AParcel_boolArraySetterC31D06A6(carrayData unsafe.Pointer, cindex C.size_t, cvalue C.bool) { - if aParcel_boolArraySetterC31D06A6Func != nil { - arrayDatac31d06a6 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - indexc31d06a6 := (uint64)(cindex) - valuec31d06a6 := (bool)(cvalue) - aParcel_boolArraySetterC31D06A6Func(arrayDatac31d06a6, indexc31d06a6, valuec31d06a6) - return - } - panic("callback func has not been set (race?)") -} - -var aParcel_boolArraySetterC31D06A6Func AParcel_boolArraySetter - -func (x AParcel_byteArrayAllocator) PassRef() (ref *C.AParcel_byteArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_byteArrayAllocator0F5D9BCBFunc == nil { - aParcel_byteArrayAllocator0F5D9BCBFunc = x - } - return (*C.AParcel_byteArrayAllocator)(C.AParcel_byteArrayAllocator_0f5d9bcb), nil -} - -func (x AParcel_byteArrayAllocator) PassValue() (ref C.AParcel_byteArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_byteArrayAllocator0F5D9BCBFunc == nil { - aParcel_byteArrayAllocator0F5D9BCBFunc = x - } - return (C.AParcel_byteArrayAllocator)(C.AParcel_byteArrayAllocator_0f5d9bcb), nil -} - -func NewAParcel_byteArrayAllocatorRef(ref unsafe.Pointer) *AParcel_byteArrayAllocator { - return (*AParcel_byteArrayAllocator)(ref) -} - -//export AParcel_byteArrayAllocator0F5D9BCB -func AParcel_byteArrayAllocator0F5D9BCB(carrayData unsafe.Pointer, clength C.int32_t, coutBuffer **C.int8_t) C._Bool { - if aParcel_byteArrayAllocator0F5D9BCBFunc != nil { - arrayData0f5d9bcb := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - length0f5d9bcb := (int32)(clength) - outBuffer0f5d9bcb := (**int8)(unsafe.Pointer(coutBuffer)) - ret0f5d9bcb := aParcel_byteArrayAllocator0F5D9BCBFunc(arrayData0f5d9bcb, length0f5d9bcb, outBuffer0f5d9bcb) - ret, _ := (C._Bool)(ret0f5d9bcb), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_byteArrayAllocator0F5D9BCBFunc AParcel_byteArrayAllocator - -func (x AParcel_charArrayAllocator) PassRef() (ref *C.AParcel_charArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_charArrayAllocatorE28A23C0Func == nil { - aParcel_charArrayAllocatorE28A23C0Func = x - } - return (*C.AParcel_charArrayAllocator)(C.AParcel_charArrayAllocator_e28a23c0), nil -} - -func (x AParcel_charArrayAllocator) PassValue() (ref C.AParcel_charArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_charArrayAllocatorE28A23C0Func == nil { - aParcel_charArrayAllocatorE28A23C0Func = x - } - return (C.AParcel_charArrayAllocator)(C.AParcel_charArrayAllocator_e28a23c0), nil -} - -func NewAParcel_charArrayAllocatorRef(ref unsafe.Pointer) *AParcel_charArrayAllocator { - return (*AParcel_charArrayAllocator)(ref) -} - -//export AParcel_charArrayAllocatorE28A23C0 -func AParcel_charArrayAllocatorE28A23C0(carrayData unsafe.Pointer, clength C.int32_t, coutBuffer **C.char16_t) C._Bool { - if aParcel_charArrayAllocatorE28A23C0Func != nil { - arrayDatae28a23c0 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - lengthe28a23c0 := (int32)(clength) - outBuffere28a23c0 := (**Char16_t)(unsafe.Pointer(coutBuffer)) - rete28a23c0 := aParcel_charArrayAllocatorE28A23C0Func(arrayDatae28a23c0, lengthe28a23c0, outBuffere28a23c0) - ret, _ := (C._Bool)(rete28a23c0), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_charArrayAllocatorE28A23C0Func AParcel_charArrayAllocator - -func (x AParcel_doubleArrayAllocator) PassRef() (ref *C.AParcel_doubleArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_doubleArrayAllocator0D8E072DFunc == nil { - aParcel_doubleArrayAllocator0D8E072DFunc = x - } - return (*C.AParcel_doubleArrayAllocator)(C.AParcel_doubleArrayAllocator_0d8e072d), nil -} - -func (x AParcel_doubleArrayAllocator) PassValue() (ref C.AParcel_doubleArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_doubleArrayAllocator0D8E072DFunc == nil { - aParcel_doubleArrayAllocator0D8E072DFunc = x - } - return (C.AParcel_doubleArrayAllocator)(C.AParcel_doubleArrayAllocator_0d8e072d), nil -} - -func NewAParcel_doubleArrayAllocatorRef(ref unsafe.Pointer) *AParcel_doubleArrayAllocator { - return (*AParcel_doubleArrayAllocator)(ref) -} - -//export AParcel_doubleArrayAllocator0D8E072D -func AParcel_doubleArrayAllocator0D8E072D(carrayData unsafe.Pointer, clength C.int32_t, coutBuffer **C.double) C._Bool { - if aParcel_doubleArrayAllocator0D8E072DFunc != nil { - arrayData0d8e072d := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - length0d8e072d := (int32)(clength) - outBuffer0d8e072d := (**float64)(unsafe.Pointer(coutBuffer)) - ret0d8e072d := aParcel_doubleArrayAllocator0D8E072DFunc(arrayData0d8e072d, length0d8e072d, outBuffer0d8e072d) - ret, _ := (C._Bool)(ret0d8e072d), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_doubleArrayAllocator0D8E072DFunc AParcel_doubleArrayAllocator - -func (x AParcel_floatArrayAllocator) PassRef() (ref *C.AParcel_floatArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_floatArrayAllocatorDDD314B6Func == nil { - aParcel_floatArrayAllocatorDDD314B6Func = x - } - return (*C.AParcel_floatArrayAllocator)(C.AParcel_floatArrayAllocator_ddd314b6), nil -} - -func (x AParcel_floatArrayAllocator) PassValue() (ref C.AParcel_floatArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_floatArrayAllocatorDDD314B6Func == nil { - aParcel_floatArrayAllocatorDDD314B6Func = x - } - return (C.AParcel_floatArrayAllocator)(C.AParcel_floatArrayAllocator_ddd314b6), nil -} - -func NewAParcel_floatArrayAllocatorRef(ref unsafe.Pointer) *AParcel_floatArrayAllocator { - return (*AParcel_floatArrayAllocator)(ref) -} - -//export AParcel_floatArrayAllocatorDDD314B6 -func AParcel_floatArrayAllocatorDDD314B6(carrayData unsafe.Pointer, clength C.int32_t, coutBuffer **C.float) C._Bool { - if aParcel_floatArrayAllocatorDDD314B6Func != nil { - arrayDataddd314b6 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - lengthddd314b6 := (int32)(clength) - outBufferddd314b6 := (**float32)(unsafe.Pointer(coutBuffer)) - retddd314b6 := aParcel_floatArrayAllocatorDDD314B6Func(arrayDataddd314b6, lengthddd314b6, outBufferddd314b6) - ret, _ := (C._Bool)(retddd314b6), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_floatArrayAllocatorDDD314B6Func AParcel_floatArrayAllocator - -func (x AParcel_int32ArrayAllocator) PassRef() (ref *C.AParcel_int32ArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_int32ArrayAllocator632DB075Func == nil { - aParcel_int32ArrayAllocator632DB075Func = x - } - return (*C.AParcel_int32ArrayAllocator)(C.AParcel_int32ArrayAllocator_632db075), nil -} - -func (x AParcel_int32ArrayAllocator) PassValue() (ref C.AParcel_int32ArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_int32ArrayAllocator632DB075Func == nil { - aParcel_int32ArrayAllocator632DB075Func = x - } - return (C.AParcel_int32ArrayAllocator)(C.AParcel_int32ArrayAllocator_632db075), nil -} - -func NewAParcel_int32ArrayAllocatorRef(ref unsafe.Pointer) *AParcel_int32ArrayAllocator { - return (*AParcel_int32ArrayAllocator)(ref) -} - -//export AParcel_int32ArrayAllocator632DB075 -func AParcel_int32ArrayAllocator632DB075(carrayData unsafe.Pointer, clength C.int32_t, coutBuffer **C.int32_t) C._Bool { - if aParcel_int32ArrayAllocator632DB075Func != nil { - arrayData632db075 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - length632db075 := (int32)(clength) - outBuffer632db075 := (**int32)(unsafe.Pointer(coutBuffer)) - ret632db075 := aParcel_int32ArrayAllocator632DB075Func(arrayData632db075, length632db075, outBuffer632db075) - ret, _ := (C._Bool)(ret632db075), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_int32ArrayAllocator632DB075Func AParcel_int32ArrayAllocator - -func (x AParcel_int64ArrayAllocator) PassRef() (ref *C.AParcel_int64ArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_int64ArrayAllocatorE9CCD3BDFunc == nil { - aParcel_int64ArrayAllocatorE9CCD3BDFunc = x - } - return (*C.AParcel_int64ArrayAllocator)(C.AParcel_int64ArrayAllocator_e9ccd3bd), nil -} - -func (x AParcel_int64ArrayAllocator) PassValue() (ref C.AParcel_int64ArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_int64ArrayAllocatorE9CCD3BDFunc == nil { - aParcel_int64ArrayAllocatorE9CCD3BDFunc = x - } - return (C.AParcel_int64ArrayAllocator)(C.AParcel_int64ArrayAllocator_e9ccd3bd), nil -} - -func NewAParcel_int64ArrayAllocatorRef(ref unsafe.Pointer) *AParcel_int64ArrayAllocator { - return (*AParcel_int64ArrayAllocator)(ref) -} - -//export AParcel_int64ArrayAllocatorE9CCD3BD -func AParcel_int64ArrayAllocatorE9CCD3BD(carrayData unsafe.Pointer, clength C.int32_t, coutBuffer **C.int64_t) C._Bool { - if aParcel_int64ArrayAllocatorE9CCD3BDFunc != nil { - arrayDatae9ccd3bd := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - lengthe9ccd3bd := (int32)(clength) - outBuffere9ccd3bd := (**int64)(unsafe.Pointer(coutBuffer)) - rete9ccd3bd := aParcel_int64ArrayAllocatorE9CCD3BDFunc(arrayDatae9ccd3bd, lengthe9ccd3bd, outBuffere9ccd3bd) - ret, _ := (C._Bool)(rete9ccd3bd), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_int64ArrayAllocatorE9CCD3BDFunc AParcel_int64ArrayAllocator - -func (x AParcel_parcelableArrayAllocator) PassRef() (ref *C.AParcel_parcelableArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_parcelableArrayAllocator6A96D230Func == nil { - aParcel_parcelableArrayAllocator6A96D230Func = x - } - return (*C.AParcel_parcelableArrayAllocator)(C.AParcel_parcelableArrayAllocator_6a96d230), nil -} - -func (x AParcel_parcelableArrayAllocator) PassValue() (ref C.AParcel_parcelableArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_parcelableArrayAllocator6A96D230Func == nil { - aParcel_parcelableArrayAllocator6A96D230Func = x - } - return (C.AParcel_parcelableArrayAllocator)(C.AParcel_parcelableArrayAllocator_6a96d230), nil -} - -func NewAParcel_parcelableArrayAllocatorRef(ref unsafe.Pointer) *AParcel_parcelableArrayAllocator { - return (*AParcel_parcelableArrayAllocator)(ref) -} - -//export AParcel_parcelableArrayAllocator6A96D230 -func AParcel_parcelableArrayAllocator6A96D230(carrayData unsafe.Pointer, clength C.int32_t) C._Bool { - if aParcel_parcelableArrayAllocator6A96D230Func != nil { - arrayData6a96d230 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - length6a96d230 := (int32)(clength) - ret6a96d230 := aParcel_parcelableArrayAllocator6A96D230Func(arrayData6a96d230, length6a96d230) - ret, _ := (C._Bool)(ret6a96d230), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_parcelableArrayAllocator6A96D230Func AParcel_parcelableArrayAllocator - -func (x AParcel_readParcelableElement) PassRef() (ref *C.AParcel_readParcelableElement, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_readParcelableElementF5964747Func == nil { - aParcel_readParcelableElementF5964747Func = x - } - return (*C.AParcel_readParcelableElement)(C.AParcel_readParcelableElement_f5964747), nil -} - -func (x AParcel_readParcelableElement) PassValue() (ref C.AParcel_readParcelableElement, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_readParcelableElementF5964747Func == nil { - aParcel_readParcelableElementF5964747Func = x - } - return (C.AParcel_readParcelableElement)(C.AParcel_readParcelableElement_f5964747), nil -} - -func NewAParcel_readParcelableElementRef(ref unsafe.Pointer) *AParcel_readParcelableElement { - return (*AParcel_readParcelableElement)(ref) -} - -//export AParcel_readParcelableElementF5964747 -func AParcel_readParcelableElementF5964747(cparcel *C.AParcel, carrayData unsafe.Pointer, cindex C.size_t) C.binder_status_t { - if aParcel_readParcelableElementF5964747Func != nil { - parcelf5964747 := (*AParcel)(unsafe.Pointer(cparcel)) - arrayDataf5964747 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - indexf5964747 := (uint64)(cindex) - retf5964747 := aParcel_readParcelableElementF5964747Func(parcelf5964747, arrayDataf5964747, indexf5964747) - ret, _ := (C.binder_status_t)(retf5964747), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_readParcelableElementF5964747Func AParcel_readParcelableElement - -func (x AParcel_stringAllocator) PassRef() (ref *C.AParcel_stringAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_stringAllocatorFED8100AFunc == nil { - aParcel_stringAllocatorFED8100AFunc = x - } - return (*C.AParcel_stringAllocator)(C.AParcel_stringAllocator_fed8100a), nil -} - -func (x AParcel_stringAllocator) PassValue() (ref C.AParcel_stringAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_stringAllocatorFED8100AFunc == nil { - aParcel_stringAllocatorFED8100AFunc = x - } - return (C.AParcel_stringAllocator)(C.AParcel_stringAllocator_fed8100a), nil -} - -func NewAParcel_stringAllocatorRef(ref unsafe.Pointer) *AParcel_stringAllocator { - return (*AParcel_stringAllocator)(ref) -} - -//export AParcel_stringAllocatorFED8100A -func AParcel_stringAllocatorFED8100A(cstringData unsafe.Pointer, clength C.int32_t, cbuffer **C.char) C._Bool { - if aParcel_stringAllocatorFED8100AFunc != nil { - stringDatafed8100a := (unsafe.Pointer)(unsafe.Pointer(cstringData)) - lengthfed8100a := (int32)(clength) - bufferfed8100a := (**int8)(unsafe.Pointer(cbuffer)) - retfed8100a := aParcel_stringAllocatorFED8100AFunc(stringDatafed8100a, lengthfed8100a, bufferfed8100a) - ret, _ := (C._Bool)(retfed8100a), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_stringAllocatorFED8100AFunc AParcel_stringAllocator - -func (x AParcel_stringArrayAllocator) PassRef() (ref *C.AParcel_stringArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_stringArrayAllocatorA431F501Func == nil { - aParcel_stringArrayAllocatorA431F501Func = x - } - return (*C.AParcel_stringArrayAllocator)(C.AParcel_stringArrayAllocator_a431f501), nil -} - -func (x AParcel_stringArrayAllocator) PassValue() (ref C.AParcel_stringArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_stringArrayAllocatorA431F501Func == nil { - aParcel_stringArrayAllocatorA431F501Func = x - } - return (C.AParcel_stringArrayAllocator)(C.AParcel_stringArrayAllocator_a431f501), nil -} - -func NewAParcel_stringArrayAllocatorRef(ref unsafe.Pointer) *AParcel_stringArrayAllocator { - return (*AParcel_stringArrayAllocator)(ref) -} - -//export AParcel_stringArrayAllocatorA431F501 -func AParcel_stringArrayAllocatorA431F501(carrayData unsafe.Pointer, clength C.int32_t) C._Bool { - if aParcel_stringArrayAllocatorA431F501Func != nil { - arrayDataa431f501 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - lengtha431f501 := (int32)(clength) - reta431f501 := aParcel_stringArrayAllocatorA431F501Func(arrayDataa431f501, lengtha431f501) - ret, _ := (C._Bool)(reta431f501), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_stringArrayAllocatorA431F501Func AParcel_stringArrayAllocator - -func (x AParcel_stringArrayElementAllocator) PassRef() (ref *C.AParcel_stringArrayElementAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_stringArrayElementAllocator9AC166CAFunc == nil { - aParcel_stringArrayElementAllocator9AC166CAFunc = x - } - return (*C.AParcel_stringArrayElementAllocator)(C.AParcel_stringArrayElementAllocator_9ac166ca), nil -} - -func (x AParcel_stringArrayElementAllocator) PassValue() (ref C.AParcel_stringArrayElementAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_stringArrayElementAllocator9AC166CAFunc == nil { - aParcel_stringArrayElementAllocator9AC166CAFunc = x - } - return (C.AParcel_stringArrayElementAllocator)(C.AParcel_stringArrayElementAllocator_9ac166ca), nil -} - -func NewAParcel_stringArrayElementAllocatorRef(ref unsafe.Pointer) *AParcel_stringArrayElementAllocator { - return (*AParcel_stringArrayElementAllocator)(ref) -} - -//export AParcel_stringArrayElementAllocator9AC166CA -func AParcel_stringArrayElementAllocator9AC166CA(carrayData unsafe.Pointer, cindex C.size_t, clength C.int32_t, cbuffer **C.char) C._Bool { - if aParcel_stringArrayElementAllocator9AC166CAFunc != nil { - arrayData9ac166ca := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - index9ac166ca := (uint64)(cindex) - length9ac166ca := (int32)(clength) - buffer9ac166ca := (**int8)(unsafe.Pointer(cbuffer)) - ret9ac166ca := aParcel_stringArrayElementAllocator9AC166CAFunc(arrayData9ac166ca, index9ac166ca, length9ac166ca, buffer9ac166ca) - ret, _ := (C._Bool)(ret9ac166ca), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_stringArrayElementAllocator9AC166CAFunc AParcel_stringArrayElementAllocator - -func (x AParcel_stringArrayElementGetter) PassRef() (ref *C.AParcel_stringArrayElementGetter, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_stringArrayElementGetter6817B794Func == nil { - aParcel_stringArrayElementGetter6817B794Func = x - } - return (*C.AParcel_stringArrayElementGetter)(C.AParcel_stringArrayElementGetter_6817b794), nil -} - -func (x AParcel_stringArrayElementGetter) PassValue() (ref C.AParcel_stringArrayElementGetter, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_stringArrayElementGetter6817B794Func == nil { - aParcel_stringArrayElementGetter6817B794Func = x - } - return (C.AParcel_stringArrayElementGetter)(C.AParcel_stringArrayElementGetter_6817b794), nil -} - -func NewAParcel_stringArrayElementGetterRef(ref unsafe.Pointer) *AParcel_stringArrayElementGetter { - return (*AParcel_stringArrayElementGetter)(ref) -} - -//export AParcel_stringArrayElementGetter6817B794 -func AParcel_stringArrayElementGetter6817B794(carrayData unsafe.Pointer, cindex C.size_t, coutLength *C.int32_t) *C.char { - if aParcel_stringArrayElementGetter6817B794Func != nil { - arrayData6817b794 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - index6817b794 := (uint64)(cindex) - outLength6817b794 := (*int32)(unsafe.Pointer(coutLength)) - ret6817b794 := aParcel_stringArrayElementGetter6817B794Func(arrayData6817b794, index6817b794, outLength6817b794) - ret, _ := (*C.char)(unsafe.Pointer(ret6817b794)), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_stringArrayElementGetter6817B794Func AParcel_stringArrayElementGetter - -func (x AParcel_uint32ArrayAllocator) PassRef() (ref *C.AParcel_uint32ArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_uint32ArrayAllocatorDFFAD45CFunc == nil { - aParcel_uint32ArrayAllocatorDFFAD45CFunc = x - } - return (*C.AParcel_uint32ArrayAllocator)(C.AParcel_uint32ArrayAllocator_dffad45c), nil -} - -func (x AParcel_uint32ArrayAllocator) PassValue() (ref C.AParcel_uint32ArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_uint32ArrayAllocatorDFFAD45CFunc == nil { - aParcel_uint32ArrayAllocatorDFFAD45CFunc = x - } - return (C.AParcel_uint32ArrayAllocator)(C.AParcel_uint32ArrayAllocator_dffad45c), nil -} - -func NewAParcel_uint32ArrayAllocatorRef(ref unsafe.Pointer) *AParcel_uint32ArrayAllocator { - return (*AParcel_uint32ArrayAllocator)(ref) -} - -//export AParcel_uint32ArrayAllocatorDFFAD45C -func AParcel_uint32ArrayAllocatorDFFAD45C(carrayData unsafe.Pointer, clength C.int32_t, coutBuffer **C.uint32_t) C._Bool { - if aParcel_uint32ArrayAllocatorDFFAD45CFunc != nil { - arrayDatadffad45c := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - lengthdffad45c := (int32)(clength) - outBufferdffad45c := (**uint32)(unsafe.Pointer(coutBuffer)) - retdffad45c := aParcel_uint32ArrayAllocatorDFFAD45CFunc(arrayDatadffad45c, lengthdffad45c, outBufferdffad45c) - ret, _ := (C._Bool)(retdffad45c), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_uint32ArrayAllocatorDFFAD45CFunc AParcel_uint32ArrayAllocator - -func (x AParcel_uint64ArrayAllocator) PassRef() (ref *C.AParcel_uint64ArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_uint64ArrayAllocatorCF52B274Func == nil { - aParcel_uint64ArrayAllocatorCF52B274Func = x - } - return (*C.AParcel_uint64ArrayAllocator)(C.AParcel_uint64ArrayAllocator_cf52b274), nil -} - -func (x AParcel_uint64ArrayAllocator) PassValue() (ref C.AParcel_uint64ArrayAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_uint64ArrayAllocatorCF52B274Func == nil { - aParcel_uint64ArrayAllocatorCF52B274Func = x - } - return (C.AParcel_uint64ArrayAllocator)(C.AParcel_uint64ArrayAllocator_cf52b274), nil -} - -func NewAParcel_uint64ArrayAllocatorRef(ref unsafe.Pointer) *AParcel_uint64ArrayAllocator { - return (*AParcel_uint64ArrayAllocator)(ref) -} - -//export AParcel_uint64ArrayAllocatorCF52B274 -func AParcel_uint64ArrayAllocatorCF52B274(carrayData unsafe.Pointer, clength C.int32_t, coutBuffer **C.uint64_t) C._Bool { - if aParcel_uint64ArrayAllocatorCF52B274Func != nil { - arrayDatacf52b274 := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - lengthcf52b274 := (int32)(clength) - outBuffercf52b274 := (**uint64)(unsafe.Pointer(coutBuffer)) - retcf52b274 := aParcel_uint64ArrayAllocatorCF52B274Func(arrayDatacf52b274, lengthcf52b274, outBuffercf52b274) - ret, _ := (C._Bool)(retcf52b274), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_uint64ArrayAllocatorCF52B274Func AParcel_uint64ArrayAllocator - -func (x AParcel_writeParcelableElement) PassRef() (ref *C.AParcel_writeParcelableElement, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_writeParcelableElement73CCA07CFunc == nil { - aParcel_writeParcelableElement73CCA07CFunc = x - } - return (*C.AParcel_writeParcelableElement)(C.AParcel_writeParcelableElement_73cca07c), nil -} - -func (x AParcel_writeParcelableElement) PassValue() (ref C.AParcel_writeParcelableElement, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aParcel_writeParcelableElement73CCA07CFunc == nil { - aParcel_writeParcelableElement73CCA07CFunc = x - } - return (C.AParcel_writeParcelableElement)(C.AParcel_writeParcelableElement_73cca07c), nil -} - -func NewAParcel_writeParcelableElementRef(ref unsafe.Pointer) *AParcel_writeParcelableElement { - return (*AParcel_writeParcelableElement)(ref) -} - -//export AParcel_writeParcelableElement73CCA07C -func AParcel_writeParcelableElement73CCA07C(cparcel *C.AParcel, carrayData unsafe.Pointer, cindex C.size_t) C.binder_status_t { - if aParcel_writeParcelableElement73CCA07CFunc != nil { - parcel73cca07c := (*AParcel)(unsafe.Pointer(cparcel)) - arrayData73cca07c := (unsafe.Pointer)(unsafe.Pointer(carrayData)) - index73cca07c := (uint64)(cindex) - ret73cca07c := aParcel_writeParcelableElement73CCA07CFunc(parcel73cca07c, arrayData73cca07c, index73cca07c) - ret, _ := (C.binder_status_t)(ret73cca07c), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aParcel_writeParcelableElement73CCA07CFunc AParcel_writeParcelableElement - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/binder/cgo_helpers.h b/capi/binder/cgo_helpers.h deleted file mode 100644 index dd6da7d..0000000 --- a/capi/binder/cgo_helpers.h +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/binder_ibinder.h" -#include "android/binder_parcel.h" -#include "android/binder_status.h" -#include -#pragma once - -#define __CGOGEN 1 - -// AIBinder_Class_onCreate_ae3e288c is a proxy for callback AIBinder_Class_onCreate. -void* AIBinder_Class_onCreate_ae3e288c(void* args); - -// AIBinder_Class_onDestroy_2c719d10 is a proxy for callback AIBinder_Class_onDestroy. -void AIBinder_Class_onDestroy_2c719d10(void* userData); - -// AIBinder_Class_onTransact_4c5b3f35 is a proxy for callback AIBinder_Class_onTransact. -binder_status_t AIBinder_Class_onTransact_4c5b3f35(AIBinder* binder, transaction_code_t code, const AParcel* in, AParcel* out); - -// AIBinder_DeathRecipient_onBinderDied_7d6f4f1b is a proxy for callback AIBinder_DeathRecipient_onBinderDied. -void AIBinder_DeathRecipient_onBinderDied_7d6f4f1b(); - -// AIBinder_DeathRecipient_onBinderUnlinked_6d499f91 is a proxy for callback AIBinder_DeathRecipient_onBinderUnlinked. -void AIBinder_DeathRecipient_onBinderUnlinked_6d499f91(); - -// AIBinder_onDump_04709357 is a proxy for callback AIBinder_onDump. -binder_status_t AIBinder_onDump_04709357(AIBinder* binder, int fd, const char** args, uint32_t numArgs); - -// AParcel_boolArrayAllocator_6ce04d29 is a proxy for callback AParcel_boolArrayAllocator. -_Bool AParcel_boolArrayAllocator_6ce04d29(void* arrayData, int32_t length); - -// AParcel_boolArrayGetter_58f10d8e is a proxy for callback AParcel_boolArrayGetter. -_Bool AParcel_boolArrayGetter_58f10d8e(const void* arrayData, size_t index); - -// AParcel_boolArraySetter_c31d06a6 is a proxy for callback AParcel_boolArraySetter. -void AParcel_boolArraySetter_c31d06a6(void* arrayData, size_t index, bool value); - -// AParcel_byteArrayAllocator_0f5d9bcb is a proxy for callback AParcel_byteArrayAllocator. -_Bool AParcel_byteArrayAllocator_0f5d9bcb(void* arrayData, int32_t length, int8_t** outBuffer); - -// AParcel_charArrayAllocator_e28a23c0 is a proxy for callback AParcel_charArrayAllocator. -_Bool AParcel_charArrayAllocator_e28a23c0(void* arrayData, int32_t length, char16_t** outBuffer); - -// AParcel_doubleArrayAllocator_0d8e072d is a proxy for callback AParcel_doubleArrayAllocator. -_Bool AParcel_doubleArrayAllocator_0d8e072d(void* arrayData, int32_t length, double** outBuffer); - -// AParcel_floatArrayAllocator_ddd314b6 is a proxy for callback AParcel_floatArrayAllocator. -_Bool AParcel_floatArrayAllocator_ddd314b6(void* arrayData, int32_t length, float** outBuffer); - -// AParcel_int32ArrayAllocator_632db075 is a proxy for callback AParcel_int32ArrayAllocator. -_Bool AParcel_int32ArrayAllocator_632db075(void* arrayData, int32_t length, int32_t** outBuffer); - -// AParcel_int64ArrayAllocator_e9ccd3bd is a proxy for callback AParcel_int64ArrayAllocator. -_Bool AParcel_int64ArrayAllocator_e9ccd3bd(void* arrayData, int32_t length, int64_t** outBuffer); - -// AParcel_parcelableArrayAllocator_6a96d230 is a proxy for callback AParcel_parcelableArrayAllocator. -_Bool AParcel_parcelableArrayAllocator_6a96d230(void* arrayData, int32_t length); - -// AParcel_readParcelableElement_f5964747 is a proxy for callback AParcel_readParcelableElement. -binder_status_t AParcel_readParcelableElement_f5964747(const AParcel* parcel, void* arrayData, size_t index); - -// AParcel_stringAllocator_fed8100a is a proxy for callback AParcel_stringAllocator. -_Bool AParcel_stringAllocator_fed8100a(void* stringData, int32_t length, char** buffer); - -// AParcel_stringArrayAllocator_a431f501 is a proxy for callback AParcel_stringArrayAllocator. -_Bool AParcel_stringArrayAllocator_a431f501(void* arrayData, int32_t length); - -// AParcel_stringArrayElementAllocator_9ac166ca is a proxy for callback AParcel_stringArrayElementAllocator. -_Bool AParcel_stringArrayElementAllocator_9ac166ca(void* arrayData, size_t index, int32_t length, char** buffer); - -// AParcel_stringArrayElementGetter_6817b794 is a proxy for callback AParcel_stringArrayElementGetter. -const char* AParcel_stringArrayElementGetter_6817b794(const void* arrayData, size_t index, int32_t* outLength); - -// AParcel_uint32ArrayAllocator_dffad45c is a proxy for callback AParcel_uint32ArrayAllocator. -_Bool AParcel_uint32ArrayAllocator_dffad45c(void* arrayData, int32_t length, uint32_t** outBuffer); - -// AParcel_uint64ArrayAllocator_cf52b274 is a proxy for callback AParcel_uint64ArrayAllocator. -_Bool AParcel_uint64ArrayAllocator_cf52b274(void* arrayData, int32_t length, uint64_t** outBuffer); - -// AParcel_writeParcelableElement_73cca07c is a proxy for callback AParcel_writeParcelableElement. -binder_status_t AParcel_writeParcelableElement_73cca07c(AParcel* parcel, const void* arrayData, size_t index); diff --git a/capi/binder/const.go b/capi/binder/const.go deleted file mode 100644 index b157c01..0000000 --- a/capi/binder/const.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package binder - -const ( - EX_NONE = 0 - EX_SECURITY = -1 - EX_BAD_PARCELABLE = -2 - EX_ILLEGAL_ARGUMENT = -3 - EX_NULL_POINTER = -4 - EX_ILLEGAL_STATE = -5 - EX_NETWORK_MAIN_THREAD = -6 - EX_UNSUPPORTED_OPERATION = -7 - EX_SERVICE_SPECIFIC = -8 - EX_PARCELABLE = -9 - EX_TRANSACTION_FAILED = -129 -) - -const ( - FLAG_ONEWAY = 1 -) - -const ( - STATUS_OK = 0 - STATUS_UNKNOWN_ERROR = -2147483648 - STATUS_NO_MEMORY = -12 - STATUS_INVALID_OPERATION = -38 - STATUS_BAD_VALUE = -22 - STATUS_BAD_TYPE = -2147483647 - STATUS_NAME_NOT_FOUND = -2 - STATUS_PERMISSION_DENIED = -1 - STATUS_NO_INIT = -19 - STATUS_ALREADY_EXISTS = -17 - STATUS_DEAD_OBJECT = -32 - STATUS_FAILED_TRANSACTION = -2147483646 - STATUS_BAD_INDEX = -75 - STATUS_NOT_ENOUGH_DATA = -61 - STATUS_WOULD_BLOCK = -11 - STATUS_TIMED_OUT = -110 - STATUS_UNKNOWN_TRANSACTION = -74 - STATUS_FDS_NOT_ALLOWED = -2147483641 - STATUS_UNEXPECTED_NULL = -2147483640 -) diff --git a/capi/binder/doc.go b/capi/binder/doc.go deleted file mode 100644 index 5c2f50e..0000000 --- a/capi/binder/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Binder NDK -*/ -package binder diff --git a/capi/binder/types.go b/capi/binder/types.go deleted file mode 100644 index c7ca86b..0000000 --- a/capi/binder/types.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package binder - -/* -#cgo LDFLAGS: -lbinder_ndk -#include "android/binder_ibinder.h" -#include "android/binder_parcel.h" -#include "android/binder_status.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type AIBinder C.AIBinder - -type AIBinder_Class C.AIBinder_Class - -type AIBinder_DeathRecipient C.AIBinder_DeathRecipient - -type AIBinder_Weak C.AIBinder_Weak - -type AParcel C.AParcel - -type AStatus C.AStatus - -type Binder_exception_t int32 - -type Binder_flags_t uint32 - -type Binder_status_t int32 - -type Transaction_code_t uint32 - -type Char16_t C.char16_t - -type Pid_t C.pid_t - -type Uid_t C.uid_t - -type AIBinder_Class_onCreate func(args unsafe.Pointer) unsafe.Pointer - -type AIBinder_Class_onDestroy func(userData unsafe.Pointer) - -type AIBinder_Class_onTransact func(binder *AIBinder, code Transaction_code_t, in *AParcel, out *AParcel) Binder_status_t - -type AIBinder_DeathRecipient_onBinderDied func() - -type AIBinder_DeathRecipient_onBinderUnlinked func() - -type AIBinder_onDump func(binder *AIBinder, fd int32, args **int8, numArgs uint32) Binder_status_t - -type AParcel_boolArrayAllocator func(arrayData unsafe.Pointer, length int32) bool - -type AParcel_boolArrayGetter func(arrayData unsafe.Pointer, index uint64) bool - -type AParcel_boolArraySetter func(arrayData unsafe.Pointer, index uint64, value bool) - -type AParcel_byteArrayAllocator func(arrayData unsafe.Pointer, length int32, outBuffer **int8) bool - -type AParcel_charArrayAllocator func(arrayData unsafe.Pointer, length int32, outBuffer **Char16_t) bool - -type AParcel_doubleArrayAllocator func(arrayData unsafe.Pointer, length int32, outBuffer **float64) bool - -type AParcel_floatArrayAllocator func(arrayData unsafe.Pointer, length int32, outBuffer **float32) bool - -type AParcel_int32ArrayAllocator func(arrayData unsafe.Pointer, length int32, outBuffer **int32) bool - -type AParcel_int64ArrayAllocator func(arrayData unsafe.Pointer, length int32, outBuffer **int64) bool - -type AParcel_parcelableArrayAllocator func(arrayData unsafe.Pointer, length int32) bool - -type AParcel_readParcelableElement func(parcel *AParcel, arrayData unsafe.Pointer, index uint64) Binder_status_t - -type AParcel_stringAllocator func(stringData unsafe.Pointer, length int32, buffer **int8) bool - -type AParcel_stringArrayAllocator func(arrayData unsafe.Pointer, length int32) bool - -type AParcel_stringArrayElementAllocator func(arrayData unsafe.Pointer, index uint64, length int32, buffer **int8) bool - -type AParcel_stringArrayElementGetter func(arrayData unsafe.Pointer, index uint64, outLength *int32) *int8 - -type AParcel_uint32ArrayAllocator func(arrayData unsafe.Pointer, length int32, outBuffer **uint32) bool - -type AParcel_uint64ArrayAllocator func(arrayData unsafe.Pointer, length int32, outBuffer **uint64) bool - -type AParcel_writeParcelableElement func(parcel *AParcel, arrayData unsafe.Pointer, index uint64) Binder_status_t diff --git a/capi/bitmap/bitmap.go b/capi/bitmap/bitmap.go deleted file mode 100644 index 2c421f3..0000000 --- a/capi/bitmap/bitmap.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package bitmap - -/* -#cgo LDFLAGS: -ljnigraphics -#include "android/bitmap.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AndroidBitmap_compress(info *AndroidBitmapInfo, dataspace int32, pixels unsafe.Pointer, format int32, quality int32, userContext unsafe.Pointer, fn AndroidBitmap_CompressWriteFunc) int32 { - cinfo, cinfoAllocMap := (*C.AndroidBitmapInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - cdataspace, cdataspaceAllocMap := (C.int)(dataspace), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - cformat, cformatAllocMap := (C.int)(format), cgoAllocsUnknown - cquality, cqualityAllocMap := (C.int)(quality), cgoAllocsUnknown - cuserContext, cuserContextAllocMap := userContext, cgoAllocsUnknown - cfn, cfnAllocMap := fn.PassValue() - __ret := C.AndroidBitmap_compress(cinfo, cdataspace, cpixels, cformat, cquality, cuserContext, cfn) - runtime.KeepAlive(cfnAllocMap) - runtime.KeepAlive(cuserContextAllocMap) - runtime.KeepAlive(cqualityAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(cdataspaceAllocMap) - runtime.KeepAlive(cinfoAllocMap) - __v := (int32)(__ret) - return __v -} - -func AndroidBitmap_getDataSpace(env *JNIEnv, jbitmap Jobject) int32 { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - cjbitmap, cjbitmapAllocMap := (C.jobject)(jbitmap), cgoAllocsUnknown - __ret := C.AndroidBitmap_getDataSpace(cenv, cjbitmap) - runtime.KeepAlive(cjbitmapAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (int32)(__ret) - return __v -} - -func AndroidBitmap_getHardwareBuffer(env *JNIEnv, bitmap Jobject, outBuffer **AHardwareBuffer) int32 { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - cbitmap, cbitmapAllocMap := (C.jobject)(bitmap), cgoAllocsUnknown - coutBuffer, coutBufferAllocMap := (**C.AHardwareBuffer)(unsafe.Pointer(outBuffer)), cgoAllocsUnknown - var pinnercoutBuffer runtime.Pinner - pinnercoutBuffer.Pin(outBuffer) - if outBuffer != nil { - pinnercoutBuffer.Pin(unsafe.Pointer(*outBuffer)) - } - defer pinnercoutBuffer.Unpin() - __ret := C.AndroidBitmap_getHardwareBuffer(cenv, cbitmap, coutBuffer) - runtime.KeepAlive(coutBufferAllocMap) - runtime.KeepAlive(cbitmapAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (int32)(__ret) - return __v -} - -func AndroidBitmap_getInfo(env *JNIEnv, jbitmap Jobject, info *AndroidBitmapInfo) int32 { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - cjbitmap, cjbitmapAllocMap := (C.jobject)(jbitmap), cgoAllocsUnknown - cinfo, cinfoAllocMap := (*C.AndroidBitmapInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AndroidBitmap_getInfo(cenv, cjbitmap, cinfo) - runtime.KeepAlive(cinfoAllocMap) - runtime.KeepAlive(cjbitmapAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (int32)(__ret) - return __v -} - -func AndroidBitmap_lockPixels(env *JNIEnv, jbitmap Jobject, addrPtr *unsafe.Pointer) int32 { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - cjbitmap, cjbitmapAllocMap := (C.jobject)(jbitmap), cgoAllocsUnknown - caddrPtr, caddrPtrAllocMap := addrPtr, cgoAllocsUnknown - __ret := C.AndroidBitmap_lockPixels(cenv, cjbitmap, caddrPtr) - runtime.KeepAlive(caddrPtrAllocMap) - runtime.KeepAlive(cjbitmapAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (int32)(__ret) - return __v -} - -func AndroidBitmap_unlockPixels(env *JNIEnv, jbitmap Jobject) int32 { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - cjbitmap, cjbitmapAllocMap := (C.jobject)(jbitmap), cgoAllocsUnknown - __ret := C.AndroidBitmap_unlockPixels(cenv, cjbitmap) - runtime.KeepAlive(cjbitmapAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/bitmap/cgo_helpers.c b/capi/bitmap/cgo_helpers.c deleted file mode 100644 index e91596f..0000000 --- a/capi/bitmap/cgo_helpers.c +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void AndroidBitmap_CompressWriteFunc_5268df31() { - AndroidBitmap_CompressWriteFunc5268DF31(); -} - diff --git a/capi/bitmap/cgo_helpers.go b/capi/bitmap/cgo_helpers.go deleted file mode 100644 index 947b746..0000000 --- a/capi/bitmap/cgo_helpers.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package bitmap - -/* -#cgo LDFLAGS: -ljnigraphics -#include "android/bitmap.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x AndroidBitmap_CompressWriteFunc) PassRef() (ref *C.AndroidBitmap_CompressWriteFunc, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if androidBitmap_CompressWriteFunc5268DF31Func == nil { - androidBitmap_CompressWriteFunc5268DF31Func = x - } - return (*C.AndroidBitmap_CompressWriteFunc)(C.AndroidBitmap_CompressWriteFunc_5268df31), nil -} - -func (x AndroidBitmap_CompressWriteFunc) PassValue() (ref C.AndroidBitmap_CompressWriteFunc, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if androidBitmap_CompressWriteFunc5268DF31Func == nil { - androidBitmap_CompressWriteFunc5268DF31Func = x - } - return (C.AndroidBitmap_CompressWriteFunc)(C.AndroidBitmap_CompressWriteFunc_5268df31), nil -} - -func NewAndroidBitmap_CompressWriteFuncRef(ref unsafe.Pointer) *AndroidBitmap_CompressWriteFunc { - return (*AndroidBitmap_CompressWriteFunc)(ref) -} - -//export AndroidBitmap_CompressWriteFunc5268DF31 -func AndroidBitmap_CompressWriteFunc5268DF31() { - if androidBitmap_CompressWriteFunc5268DF31Func != nil { - androidBitmap_CompressWriteFunc5268DF31Func() - return - } - panic("callback func has not been set (race?)") -} - -var androidBitmap_CompressWriteFunc5268DF31Func AndroidBitmap_CompressWriteFunc diff --git a/capi/bitmap/cgo_helpers.h b/capi/bitmap/cgo_helpers.h deleted file mode 100644 index 5503ff9..0000000 --- a/capi/bitmap/cgo_helpers.h +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/bitmap.h" -#include -#pragma once - -#define __CGOGEN 1 - -// AndroidBitmap_CompressWriteFunc_5268df31 is a proxy for callback AndroidBitmap_CompressWriteFunc. -void AndroidBitmap_CompressWriteFunc_5268df31(); - diff --git a/capi/bitmap/const.go b/capi/bitmap/const.go deleted file mode 100644 index a394d54..0000000 --- a/capi/bitmap/const.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package bitmap - -const ( - ANDROID_BITMAP_FLAGS_IS_HARDWARE = -2147483648 -) - -const ( - ANDROID_BITMAP_FLAGS_ALPHA_PREMUL = 0 - ANDROID_BITMAP_FLAGS_ALPHA_OPAQUE = 1 - ANDROID_BITMAP_FLAGS_ALPHA_UNPREMUL = 2 - ANDROID_BITMAP_FLAGS_ALPHA_MASK = 3 - ANDROID_BITMAP_FLAGS_ALPHA_SHIFT = 0 -) - -const ( - ANDROID_BITMAP_RESULT_SUCCESS = 0 - ANDROID_BITMAP_RESULT_BAD_PARAMETER = -1 - ANDROID_BITMAP_RESULT_JNI_EXCEPTION = -2 - ANDROID_BITMAP_RESULT_ALLOCATION_FAILED = -3 -) - -const ( - ANDROID_BITMAP_COMPRESS_FORMAT_JPEG = 0 - ANDROID_BITMAP_COMPRESS_FORMAT_PNG = 1 - ANDROID_BITMAP_COMPRESS_FORMAT_WEBP_LOSSY = 3 - ANDROID_BITMAP_COMPRESS_FORMAT_WEBP_LOSSLESS = 4 -) - -const ( - ANDROID_BITMAP_FORMAT_NONE = 0 - ANDROID_BITMAP_FORMAT_RGBA_8888 = 1 - ANDROID_BITMAP_FORMAT_RGB_565 = 4 - ANDROID_BITMAP_FORMAT_RGBA_4444 = 7 - ANDROID_BITMAP_FORMAT_A_8 = 8 - ANDROID_BITMAP_FORMAT_RGBA_F16 = 9 - ANDROID_BITMAP_FORMAT_RGBA_1010102 = 10 -) diff --git a/capi/bitmap/doc.go b/capi/bitmap/doc.go deleted file mode 100644 index 3cc9e79..0000000 --- a/capi/bitmap/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Bitmap -*/ -package bitmap diff --git a/capi/bitmap/types.go b/capi/bitmap/types.go deleted file mode 100644 index cb131d1..0000000 --- a/capi/bitmap/types.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package bitmap - -/* -#cgo LDFLAGS: -ljnigraphics -#include "android/bitmap.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AHardwareBuffer C.AHardwareBuffer - -type AndroidBitmapInfo C.AndroidBitmapInfo - -type JNIEnv C.JNIEnv - -type Jobject C.jobject - -type AndroidBitmap_CompressWriteFunc func() diff --git a/capi/camera/bridge_c.go b/capi/camera/bridge_c.go deleted file mode 100644 index 86c75be..0000000 --- a/capi/camera/bridge_c.go +++ /dev/null @@ -1,184 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -/* -#include "camera/NdkCameraManager.h" -#include "camera/NdkCameraDevice.h" -#include "camera/NdkCaptureRequest.h" -#include "camera/NdkCameraCaptureSession.h" -#include "camera/NdkCameraMetadata.h" -#include "camera/NdkCameraMetadataTags.h" -#include -#include "cgo_helpers.h" - -extern void goBridge_SessionStateCallbacks_OnClosed(void* context, ACameraCaptureSession* session); -extern void goBridge_SessionStateCallbacks_OnReady(void* context, ACameraCaptureSession* session); -extern void goBridge_SessionStateCallbacks_OnActive(void* context, ACameraCaptureSession* session); -extern void goBridge_DeviceStateCallbacks_OnDisconnected(void* context, ACameraDevice* device); -extern void goBridge_DeviceStateCallbacks_OnError(void* context, ACameraDevice* device, int32_t _error); - - -static void bridge_ACameraCaptureSession_stateCallbacks_init(ACameraCaptureSession_stateCallbacks* cbs, uintptr_t cbId) { - cbs->context = (void*)cbId; - cbs->onClosed = goBridge_SessionStateCallbacks_OnClosed; - cbs->onReady = goBridge_SessionStateCallbacks_OnReady; - cbs->onActive = goBridge_SessionStateCallbacks_OnActive; -} - -static void bridge_ACameraDevice_StateCallbacks_init(ACameraDevice_StateCallbacks* cbs, uintptr_t cbId) { - cbs->context = (void*)cbId; - cbs->onDisconnected = goBridge_DeviceStateCallbacks_OnDisconnected; - cbs->onError = goBridge_DeviceStateCallbacks_OnError; -} - - -static int bridge_ACameraIdList_count(ACameraIdList* list) { - return list->numCameras; -} - -static const char* bridge_ACameraIdList_item(ACameraIdList* list, int i) { - return list->cameraIds[i]; -} - - -static inline int32_t bridge_metadataU8Count( - const ACameraMetadata* metadata, uint32_t tag -) { - ACameraMetadata_const_entry entry; - if (ACameraMetadata_getConstEntry(metadata, tag, &entry) != ACAMERA_OK) return 0; - return (int32_t)entry.count; -} - -static inline uint8_t bridge_metadataU8At( - const ACameraMetadata* metadata, uint32_t tag, int32_t idx -) { - ACameraMetadata_const_entry entry; - if (ACameraMetadata_getConstEntry(metadata, tag, &entry) != ACAMERA_OK) return 0; - if ((uint32_t)idx >= entry.count) return 0; - return entry.data.u8[idx]; -} - -static inline int32_t bridge_metadataI32Count( - const ACameraMetadata* metadata, uint32_t tag -) { - ACameraMetadata_const_entry entry; - if (ACameraMetadata_getConstEntry(metadata, tag, &entry) != ACAMERA_OK) return 0; - return (int32_t)entry.count; -} - -static inline int32_t bridge_metadataI32At( - const ACameraMetadata* metadata, uint32_t tag, int32_t idx -) { - ACameraMetadata_const_entry entry; - if (ACameraMetadata_getConstEntry(metadata, tag, &entry) != ACAMERA_OK) return 0; - if ((uint32_t)idx >= entry.count) return 0; - return entry.data.i32[idx]; -} - -static inline int32_t bridge_metadataFloatCount( - const ACameraMetadata* metadata, uint32_t tag -) { - ACameraMetadata_const_entry entry; - if (ACameraMetadata_getConstEntry(metadata, tag, &entry) != ACAMERA_OK) return 0; - return (int32_t)entry.count; -} - -static inline float bridge_metadataFloatAt( - const ACameraMetadata* metadata, uint32_t tag, int32_t idx -) { - ACameraMetadata_const_entry entry; - if (ACameraMetadata_getConstEntry(metadata, tag, &entry) != ACAMERA_OK) return 0; - if ((uint32_t)idx >= entry.count) return 0; - return entry.data.f[idx]; -} - -*/ -import "C" - -import ( - "unsafe" -) - -// SessionStateCallbacks holds Go callbacks for ACameraCaptureSession_stateCallbacks. -type SessionStateCallbacks struct { - OnClosed func() - OnReady func() - OnActive func() -} - -// DeviceStateCallbacks holds Go callbacks for ACameraDevice_StateCallbacks. -type DeviceStateCallbacks struct { - OnDisconnected func() - OnError func(int) -} - -// BridgeRegisterSessionStateCallbacks registers a SessionStateCallbacks and returns its callback ID. -func BridgeRegisterSessionStateCallbacks(cbs SessionStateCallbacks) uintptr { - return bridgeRegisterCB(cbs) -} - -// BridgeUnregisterSessionStateCallbacks unregisters a previously registered SessionStateCallbacks. -func BridgeUnregisterSessionStateCallbacks(id uintptr) { - bridgeUnregisterCB(id) -} - -// BridgeInitSessionStateCallbacks initializes a C ACameraCaptureSession_stateCallbacks with bridge function pointers. -func BridgeInitSessionStateCallbacks(cbs *ACameraCaptureSession_stateCallbacks, cbID uintptr) { - C.bridge_ACameraCaptureSession_stateCallbacks_init((*C.ACameraCaptureSession_stateCallbacks)(unsafe.Pointer(cbs)), C.uintptr_t(cbID)) -} - -// BridgeRegisterDeviceStateCallbacks registers a DeviceStateCallbacks and returns its callback ID. -func BridgeRegisterDeviceStateCallbacks(cbs DeviceStateCallbacks) uintptr { - return bridgeRegisterCB(cbs) -} - -// BridgeUnregisterDeviceStateCallbacks unregisters a previously registered DeviceStateCallbacks. -func BridgeUnregisterDeviceStateCallbacks(id uintptr) { - bridgeUnregisterCB(id) -} - -// BridgeInitDeviceStateCallbacks initializes a C ACameraDevice_StateCallbacks with bridge function pointers. -func BridgeInitDeviceStateCallbacks(cbs *ACameraDevice_StateCallbacks, cbID uintptr) { - C.bridge_ACameraDevice_StateCallbacks_init((*C.ACameraDevice_StateCallbacks)(unsafe.Pointer(cbs)), C.uintptr_t(cbID)) -} - -// BridgeACameraIdListCount returns the count of items in a ACameraIdList. -func BridgeACameraIdListCount(list *ACameraIdList) int { - return int(C.bridge_ACameraIdList_count((*C.ACameraIdList)(unsafe.Pointer(list)))) -} - -// BridgeACameraIdListItem returns the item at index i from a ACameraIdList. -func BridgeACameraIdListItem(list *ACameraIdList, i int) string { - return C.GoString(C.bridge_ACameraIdList_item((*C.ACameraIdList)(unsafe.Pointer(list)), C.int(i))) -} - -// BridgeMetadataU8Count returns the count of uint8 values for a metadata tag. -func BridgeMetadataU8Count(metadata *ACameraMetadata, tag uint32) int32 { - return int32(C.bridge_metadataU8Count((*C.ACameraMetadata)(unsafe.Pointer(metadata)), C.uint32_t(tag))) -} - -// BridgeMetadataU8At returns the uint8 value at the given index for a metadata tag. -func BridgeMetadataU8At(metadata *ACameraMetadata, tag uint32, idx int32) uint8 { - return uint8(C.bridge_metadataU8At((*C.ACameraMetadata)(unsafe.Pointer(metadata)), C.uint32_t(tag), C.int32_t(idx))) -} - -// BridgeMetadataI32Count returns the count of int32 values for a metadata tag. -func BridgeMetadataI32Count(metadata *ACameraMetadata, tag uint32) int32 { - return int32(C.bridge_metadataI32Count((*C.ACameraMetadata)(unsafe.Pointer(metadata)), C.uint32_t(tag))) -} - -// BridgeMetadataI32At returns the int32 value at the given index for a metadata tag. -func BridgeMetadataI32At(metadata *ACameraMetadata, tag uint32, idx int32) int32 { - return int32(C.bridge_metadataI32At((*C.ACameraMetadata)(unsafe.Pointer(metadata)), C.uint32_t(tag), C.int32_t(idx))) -} - -// BridgeMetadataFloatCount returns the count of float32 values for a metadata tag. -func BridgeMetadataFloatCount(metadata *ACameraMetadata, tag uint32) int32 { - return int32(C.bridge_metadataFloatCount((*C.ACameraMetadata)(unsafe.Pointer(metadata)), C.uint32_t(tag))) -} - -// BridgeMetadataFloatAt returns the float32 value at the given index for a metadata tag. -func BridgeMetadataFloatAt(metadata *ACameraMetadata, tag uint32, idx int32) float32 { - return float32(C.bridge_metadataFloatAt((*C.ACameraMetadata)(unsafe.Pointer(metadata)), C.uint32_t(tag), C.int32_t(idx))) -} diff --git a/capi/camera/bridge_export.go b/capi/camera/bridge_export.go deleted file mode 100644 index d89d003..0000000 --- a/capi/camera/bridge_export.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -/* -#include "camera/NdkCameraManager.h" -#include "camera/NdkCameraDevice.h" -#include "camera/NdkCaptureRequest.h" -#include "camera/NdkCameraCaptureSession.h" -#include "camera/NdkCameraMetadata.h" -#include "camera/NdkCameraMetadataTags.h" -#include -#include "cgo_helpers.h" - -*/ -import "C" - -import "unsafe" - -//export goBridge_SessionStateCallbacks_OnClosed -func goBridge_SessionStateCallbacks_OnClosed(context unsafe.Pointer, session *C.ACameraCaptureSession) { - if cb, ok := bridgeLookupCB(uintptr(context)).(SessionStateCallbacks); ok && cb.OnClosed != nil { - cb.OnClosed() - } -} - -//export goBridge_SessionStateCallbacks_OnReady -func goBridge_SessionStateCallbacks_OnReady(context unsafe.Pointer, session *C.ACameraCaptureSession) { - if cb, ok := bridgeLookupCB(uintptr(context)).(SessionStateCallbacks); ok && cb.OnReady != nil { - cb.OnReady() - } -} - -//export goBridge_SessionStateCallbacks_OnActive -func goBridge_SessionStateCallbacks_OnActive(context unsafe.Pointer, session *C.ACameraCaptureSession) { - if cb, ok := bridgeLookupCB(uintptr(context)).(SessionStateCallbacks); ok && cb.OnActive != nil { - cb.OnActive() - } -} - -//export goBridge_DeviceStateCallbacks_OnDisconnected -func goBridge_DeviceStateCallbacks_OnDisconnected(context unsafe.Pointer, device *C.ACameraDevice) { - if cb, ok := bridgeLookupCB(uintptr(context)).(DeviceStateCallbacks); ok && cb.OnDisconnected != nil { - cb.OnDisconnected() - } -} - -//export goBridge_DeviceStateCallbacks_OnError -func goBridge_DeviceStateCallbacks_OnError(context unsafe.Pointer, device *C.ACameraDevice, _error C.int32_t) { - if cb, ok := bridgeLookupCB(uintptr(context)).(DeviceStateCallbacks); ok && cb.OnError != nil { - cb.OnError(int(_error)) - } -} diff --git a/capi/camera/bridge_registry.go b/capi/camera/bridge_registry.go deleted file mode 100644 index 54d336e..0000000 --- a/capi/camera/bridge_registry.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package camera - -import "sync" - -var ( - bridgeCBMu sync.Mutex - bridgeCBMap = map[uintptr]interface{}{} - bridgeCBNext uintptr -) - -func bridgeRegisterCB(cb interface{}) uintptr { - bridgeCBMu.Lock() - bridgeCBNext++ - id := bridgeCBNext - bridgeCBMap[id] = cb - bridgeCBMu.Unlock() - return id -} - -func bridgeUnregisterCB(id uintptr) { - bridgeCBMu.Lock() - delete(bridgeCBMap, id) - bridgeCBMu.Unlock() -} - -func bridgeLookupCB(id uintptr) interface{} { - bridgeCBMu.Lock() - cb := bridgeCBMap[id] - bridgeCBMu.Unlock() - return cb -} diff --git a/capi/camera/camera.go b/capi/camera/camera.go deleted file mode 100644 index e55fa54..0000000 --- a/capi/camera/camera.go +++ /dev/null @@ -1,978 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package camera - -/* -#cgo LDFLAGS: -lcamera2ndk -#include "camera/NdkCameraManager.h" -#include "camera/NdkCameraDevice.h" -#include "camera/NdkCaptureRequest.h" -#include "camera/NdkCameraCaptureSession.h" -#include "camera/NdkCameraMetadata.h" -#include "camera/NdkCameraMetadataTags.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ACameraCaptureSession_abortCaptures(session *ACameraCaptureSession) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_abortCaptures(csession) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_capture(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_captureCallbacks, numRequests int32, requests **ACaptureRequest, captureSequenceId *int32) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_captureCallbacks)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - cnumRequests, cnumRequestsAllocMap := (C.int)(numRequests), cgoAllocsUnknown - crequests, crequestsAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(requests)), cgoAllocsUnknown - var pinnercrequests runtime.Pinner - pinnercrequests.Pin(requests) - if requests != nil { - pinnercrequests.Pin(unsafe.Pointer(*requests)) - } - defer pinnercrequests.Unpin() - ccaptureSequenceId, ccaptureSequenceIdAllocMap := (*C.int)(unsafe.Pointer(captureSequenceId)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_capture(csession, ccallbacks, cnumRequests, crequests, ccaptureSequenceId) - runtime.KeepAlive(ccaptureSequenceIdAllocMap) - runtime.KeepAlive(crequestsAllocMap) - runtime.KeepAlive(cnumRequestsAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_captureV2(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_captureCallbacksV2, numRequests int32, requests **ACaptureRequest, captureSequenceId *int32) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_captureCallbacksV2)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - cnumRequests, cnumRequestsAllocMap := (C.int)(numRequests), cgoAllocsUnknown - crequests, crequestsAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(requests)), cgoAllocsUnknown - var pinnercrequests runtime.Pinner - pinnercrequests.Pin(requests) - if requests != nil { - pinnercrequests.Pin(unsafe.Pointer(*requests)) - } - defer pinnercrequests.Unpin() - ccaptureSequenceId, ccaptureSequenceIdAllocMap := (*C.int)(unsafe.Pointer(captureSequenceId)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_captureV2(csession, ccallbacks, cnumRequests, crequests, ccaptureSequenceId) - runtime.KeepAlive(ccaptureSequenceIdAllocMap) - runtime.KeepAlive(crequestsAllocMap) - runtime.KeepAlive(cnumRequestsAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_close(session *ACameraCaptureSession) { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - C.ACameraCaptureSession_close(csession) - runtime.KeepAlive(csessionAllocMap) -} - -func ACameraCaptureSession_getDevice(session *ACameraCaptureSession, device **ACameraDevice) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - cdevice, cdeviceAllocMap := (**C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - var pinnercdevice runtime.Pinner - pinnercdevice.Pin(device) - if device != nil { - pinnercdevice.Pin(unsafe.Pointer(*device)) - } - defer pinnercdevice.Unpin() - __ret := C.ACameraCaptureSession_getDevice(csession, cdevice) - runtime.KeepAlive(cdeviceAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_logicalCamera_capture(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_logicalCamera_captureCallbacks, numRequests int32, requests **ACaptureRequest, captureSequenceId *int32) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_logicalCamera_captureCallbacks)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - cnumRequests, cnumRequestsAllocMap := (C.int)(numRequests), cgoAllocsUnknown - crequests, crequestsAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(requests)), cgoAllocsUnknown - var pinnercrequests runtime.Pinner - pinnercrequests.Pin(requests) - if requests != nil { - pinnercrequests.Pin(unsafe.Pointer(*requests)) - } - defer pinnercrequests.Unpin() - ccaptureSequenceId, ccaptureSequenceIdAllocMap := (*C.int)(unsafe.Pointer(captureSequenceId)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_logicalCamera_capture(csession, ccallbacks, cnumRequests, crequests, ccaptureSequenceId) - runtime.KeepAlive(ccaptureSequenceIdAllocMap) - runtime.KeepAlive(crequestsAllocMap) - runtime.KeepAlive(cnumRequestsAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_logicalCamera_captureV2(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_logicalCamera_captureCallbacksV2, numRequests int32, requests **ACaptureRequest, captureSequenceId *int32) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_logicalCamera_captureCallbacksV2)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - cnumRequests, cnumRequestsAllocMap := (C.int)(numRequests), cgoAllocsUnknown - crequests, crequestsAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(requests)), cgoAllocsUnknown - var pinnercrequests runtime.Pinner - pinnercrequests.Pin(requests) - if requests != nil { - pinnercrequests.Pin(unsafe.Pointer(*requests)) - } - defer pinnercrequests.Unpin() - ccaptureSequenceId, ccaptureSequenceIdAllocMap := (*C.int)(unsafe.Pointer(captureSequenceId)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_logicalCamera_captureV2(csession, ccallbacks, cnumRequests, crequests, ccaptureSequenceId) - runtime.KeepAlive(ccaptureSequenceIdAllocMap) - runtime.KeepAlive(crequestsAllocMap) - runtime.KeepAlive(cnumRequestsAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_logicalCamera_setRepeatingRequest(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_logicalCamera_captureCallbacks, numRequests int32, requests **ACaptureRequest, captureSequenceId *int32) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_logicalCamera_captureCallbacks)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - cnumRequests, cnumRequestsAllocMap := (C.int)(numRequests), cgoAllocsUnknown - crequests, crequestsAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(requests)), cgoAllocsUnknown - var pinnercrequests runtime.Pinner - pinnercrequests.Pin(requests) - if requests != nil { - pinnercrequests.Pin(unsafe.Pointer(*requests)) - } - defer pinnercrequests.Unpin() - ccaptureSequenceId, ccaptureSequenceIdAllocMap := (*C.int)(unsafe.Pointer(captureSequenceId)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_logicalCamera_setRepeatingRequest(csession, ccallbacks, cnumRequests, crequests, ccaptureSequenceId) - runtime.KeepAlive(ccaptureSequenceIdAllocMap) - runtime.KeepAlive(crequestsAllocMap) - runtime.KeepAlive(cnumRequestsAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_logicalCamera_setRepeatingRequestV2(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_logicalCamera_captureCallbacksV2, numRequests int32, requests **ACaptureRequest, captureSequenceId *int32) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_logicalCamera_captureCallbacksV2)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - cnumRequests, cnumRequestsAllocMap := (C.int)(numRequests), cgoAllocsUnknown - crequests, crequestsAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(requests)), cgoAllocsUnknown - var pinnercrequests runtime.Pinner - pinnercrequests.Pin(requests) - if requests != nil { - pinnercrequests.Pin(unsafe.Pointer(*requests)) - } - defer pinnercrequests.Unpin() - ccaptureSequenceId, ccaptureSequenceIdAllocMap := (*C.int)(unsafe.Pointer(captureSequenceId)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_logicalCamera_setRepeatingRequestV2(csession, ccallbacks, cnumRequests, crequests, ccaptureSequenceId) - runtime.KeepAlive(ccaptureSequenceIdAllocMap) - runtime.KeepAlive(crequestsAllocMap) - runtime.KeepAlive(cnumRequestsAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_prepareWindow(session *ACameraCaptureSession, window *ANativeWindow) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_prepareWindow(csession, cwindow) - runtime.KeepAlive(cwindowAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_setRepeatingRequest(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_captureCallbacks, numRequests int32, requests **ACaptureRequest, captureSequenceId *int32) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_captureCallbacks)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - cnumRequests, cnumRequestsAllocMap := (C.int)(numRequests), cgoAllocsUnknown - crequests, crequestsAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(requests)), cgoAllocsUnknown - var pinnercrequests runtime.Pinner - pinnercrequests.Pin(requests) - if requests != nil { - pinnercrequests.Pin(unsafe.Pointer(*requests)) - } - defer pinnercrequests.Unpin() - ccaptureSequenceId, ccaptureSequenceIdAllocMap := (*C.int)(unsafe.Pointer(captureSequenceId)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_setRepeatingRequest(csession, ccallbacks, cnumRequests, crequests, ccaptureSequenceId) - runtime.KeepAlive(ccaptureSequenceIdAllocMap) - runtime.KeepAlive(crequestsAllocMap) - runtime.KeepAlive(cnumRequestsAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_setRepeatingRequestV2(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_captureCallbacksV2, numRequests int32, requests **ACaptureRequest, captureSequenceId *int32) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_captureCallbacksV2)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - cnumRequests, cnumRequestsAllocMap := (C.int)(numRequests), cgoAllocsUnknown - crequests, crequestsAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(requests)), cgoAllocsUnknown - var pinnercrequests runtime.Pinner - pinnercrequests.Pin(requests) - if requests != nil { - pinnercrequests.Pin(unsafe.Pointer(*requests)) - } - defer pinnercrequests.Unpin() - ccaptureSequenceId, ccaptureSequenceIdAllocMap := (*C.int)(unsafe.Pointer(captureSequenceId)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_setRepeatingRequestV2(csession, ccallbacks, cnumRequests, crequests, ccaptureSequenceId) - runtime.KeepAlive(ccaptureSequenceIdAllocMap) - runtime.KeepAlive(crequestsAllocMap) - runtime.KeepAlive(cnumRequestsAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_setWindowPreparedCallback(session *ACameraCaptureSession, context unsafe.Pointer, callback ACameraCaptureSession_prepareCallback) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - __ret := C.ACameraCaptureSession_setWindowPreparedCallback(csession, ccontext, ccallback) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_stopRepeating(session *ACameraCaptureSession) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_stopRepeating(csession) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraCaptureSession_updateSharedOutput(session *ACameraCaptureSession, output *ACaptureSessionOutput) Camera_status_t { - csession, csessionAllocMap := (*C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - coutput, coutputAllocMap := (*C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - __ret := C.ACameraCaptureSession_updateSharedOutput(csession, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraDevice_close(device *ACameraDevice) Camera_status_t { - cdevice, cdeviceAllocMap := (*C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - __ret := C.ACameraDevice_close(cdevice) - runtime.KeepAlive(cdeviceAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraDevice_createCaptureRequest(device *ACameraDevice, templateId ACameraDevice_request_template, request **ACaptureRequest) Camera_status_t { - cdevice, cdeviceAllocMap := (*C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - ctemplateId, ctemplateIdAllocMap := (C.ACameraDevice_request_template)(templateId), cgoAllocsUnknown - crequest, crequestAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - var pinnercrequest runtime.Pinner - pinnercrequest.Pin(request) - if request != nil { - pinnercrequest.Pin(unsafe.Pointer(*request)) - } - defer pinnercrequest.Unpin() - __ret := C.ACameraDevice_createCaptureRequest(cdevice, ctemplateId, crequest) - runtime.KeepAlive(crequestAllocMap) - runtime.KeepAlive(ctemplateIdAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraDevice_createCaptureRequest_withPhysicalIds(device *ACameraDevice, templateId ACameraDevice_request_template, physicalIdList *ACameraIdList, request **ACaptureRequest) Camera_status_t { - cdevice, cdeviceAllocMap := (*C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - ctemplateId, ctemplateIdAllocMap := (C.ACameraDevice_request_template)(templateId), cgoAllocsUnknown - cphysicalIdList, cphysicalIdListAllocMap := (*C.ACameraIdList)(unsafe.Pointer(physicalIdList)), cgoAllocsUnknown - crequest, crequestAllocMap := (**C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - var pinnercrequest runtime.Pinner - pinnercrequest.Pin(request) - if request != nil { - pinnercrequest.Pin(unsafe.Pointer(*request)) - } - defer pinnercrequest.Unpin() - __ret := C.ACameraDevice_createCaptureRequest_withPhysicalIds(cdevice, ctemplateId, cphysicalIdList, crequest) - runtime.KeepAlive(crequestAllocMap) - runtime.KeepAlive(cphysicalIdListAllocMap) - runtime.KeepAlive(ctemplateIdAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraDevice_createCaptureSession(device *ACameraDevice, outputs *ACaptureSessionOutputContainer, callbacks *ACameraCaptureSession_stateCallbacks, session **ACameraCaptureSession) Camera_status_t { - cdevice, cdeviceAllocMap := (*C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - coutputs, coutputsAllocMap := (*C.ACaptureSessionOutputContainer)(unsafe.Pointer(outputs)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_stateCallbacks)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - csession, csessionAllocMap := (**C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - var pinnercsession runtime.Pinner - pinnercsession.Pin(session) - if session != nil { - pinnercsession.Pin(unsafe.Pointer(*session)) - } - defer pinnercsession.Unpin() - __ret := C.ACameraDevice_createCaptureSession(cdevice, coutputs, ccallbacks, csession) - runtime.KeepAlive(csessionAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(coutputsAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraDevice_createCaptureSessionWithSessionParameters(device *ACameraDevice, outputs *ACaptureSessionOutputContainer, sessionParameters *ACaptureRequest, callbacks *ACameraCaptureSession_stateCallbacks, session **ACameraCaptureSession) Camera_status_t { - cdevice, cdeviceAllocMap := (*C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - coutputs, coutputsAllocMap := (*C.ACaptureSessionOutputContainer)(unsafe.Pointer(outputs)), cgoAllocsUnknown - csessionParameters, csessionParametersAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(sessionParameters)), cgoAllocsUnknown - ccallbacks, ccallbacksAllocMap := (*C.ACameraCaptureSession_stateCallbacks)(unsafe.Pointer(callbacks)), cgoAllocsUnknown - csession, csessionAllocMap := (**C.ACameraCaptureSession)(unsafe.Pointer(session)), cgoAllocsUnknown - var pinnercsession runtime.Pinner - pinnercsession.Pin(session) - if session != nil { - pinnercsession.Pin(unsafe.Pointer(*session)) - } - defer pinnercsession.Unpin() - __ret := C.ACameraDevice_createCaptureSessionWithSessionParameters(cdevice, coutputs, csessionParameters, ccallbacks, csession) - runtime.KeepAlive(csessionAllocMap) - runtime.KeepAlive(ccallbacksAllocMap) - runtime.KeepAlive(csessionParametersAllocMap) - runtime.KeepAlive(coutputsAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraDevice_getId(device *ACameraDevice) string { - cdevice, cdeviceAllocMap := (*C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - __ret := C.ACameraDevice_getId(cdevice) - runtime.KeepAlive(cdeviceAllocMap) - __v := C.GoString(__ret) - return __v -} - -func ACameraDevice_isSessionConfigurationSupported(device *ACameraDevice, sessionOutputContainer *ACaptureSessionOutputContainer) Camera_status_t { - cdevice, cdeviceAllocMap := (*C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - csessionOutputContainer, csessionOutputContainerAllocMap := (*C.ACaptureSessionOutputContainer)(unsafe.Pointer(sessionOutputContainer)), cgoAllocsUnknown - __ret := C.ACameraDevice_isSessionConfigurationSupported(cdevice, csessionOutputContainer) - runtime.KeepAlive(csessionOutputContainerAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraManager_create() *ACameraManager { - __ret := C.ACameraManager_create() - __v := (*ACameraManager)(unsafe.Pointer(__ret)) - return __v -} - -func ACameraManager_delete(manager *ACameraManager) { - cmanager, cmanagerAllocMap := (*C.ACameraManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - C.ACameraManager_delete(cmanager) - runtime.KeepAlive(cmanagerAllocMap) -} - -func ACameraManager_deleteCameraIdList(cameraIdList *ACameraIdList) { - ccameraIdList, ccameraIdListAllocMap := (*C.ACameraIdList)(unsafe.Pointer(cameraIdList)), cgoAllocsUnknown - C.ACameraManager_deleteCameraIdList(ccameraIdList) - runtime.KeepAlive(ccameraIdListAllocMap) -} - -func ACameraManager_getCameraCharacteristics(manager *ACameraManager, cameraId string, characteristics **ACameraMetadata) Camera_status_t { - cmanager, cmanagerAllocMap := (*C.ACameraManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccameraId, ccameraIdAllocMap := UnpackPCharString(cameraId) - ccharacteristics, ccharacteristicsAllocMap := (**C.ACameraMetadata)(unsafe.Pointer(characteristics)), cgoAllocsUnknown - var pinnerccharacteristics runtime.Pinner - pinnerccharacteristics.Pin(characteristics) - if characteristics != nil { - pinnerccharacteristics.Pin(unsafe.Pointer(*characteristics)) - } - defer pinnerccharacteristics.Unpin() - __ret := C.ACameraManager_getCameraCharacteristics(cmanager, ccameraId, ccharacteristics) - runtime.KeepAlive(ccharacteristicsAllocMap) - runtime.KeepAlive(ccameraIdAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraManager_getCameraIdList(manager *ACameraManager, cameraIdList **ACameraIdList) Camera_status_t { - cmanager, cmanagerAllocMap := (*C.ACameraManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccameraIdList, ccameraIdListAllocMap := (**C.ACameraIdList)(unsafe.Pointer(cameraIdList)), cgoAllocsUnknown - var pinnerccameraIdList runtime.Pinner - pinnerccameraIdList.Pin(cameraIdList) - if cameraIdList != nil { - pinnerccameraIdList.Pin(unsafe.Pointer(*cameraIdList)) - } - defer pinnerccameraIdList.Unpin() - __ret := C.ACameraManager_getCameraIdList(cmanager, ccameraIdList) - runtime.KeepAlive(ccameraIdListAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraManager_openCamera(manager *ACameraManager, cameraId string, callback *ACameraDevice_StateCallbacks, device **ACameraDevice) Camera_status_t { - cmanager, cmanagerAllocMap := (*C.ACameraManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccameraId, ccameraIdAllocMap := UnpackPCharString(cameraId) - ccallback, ccallbackAllocMap := (*C.ACameraDevice_StateCallbacks)(unsafe.Pointer(callback)), cgoAllocsUnknown - cdevice, cdeviceAllocMap := (**C.ACameraDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - var pinnercdevice runtime.Pinner - pinnercdevice.Pin(device) - if device != nil { - pinnercdevice.Pin(unsafe.Pointer(*device)) - } - defer pinnercdevice.Unpin() - __ret := C.ACameraManager_openCamera(cmanager, ccameraId, ccallback, cdevice) - runtime.KeepAlive(cdeviceAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(ccameraIdAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraManager_registerAvailabilityCallback(manager *ACameraManager, callback *ACameraManager_AvailabilityCallbacks) Camera_status_t { - cmanager, cmanagerAllocMap := (*C.ACameraManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := (*C.ACameraManager_AvailabilityCallbacks)(unsafe.Pointer(callback)), cgoAllocsUnknown - __ret := C.ACameraManager_registerAvailabilityCallback(cmanager, ccallback) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraManager_registerExtendedAvailabilityCallback(manager *ACameraManager, callback *ACameraManager_ExtendedAvailabilityCallbacks) Camera_status_t { - cmanager, cmanagerAllocMap := (*C.ACameraManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := (*C.ACameraManager_ExtendedAvailabilityCallbacks)(unsafe.Pointer(callback)), cgoAllocsUnknown - __ret := C.ACameraManager_registerExtendedAvailabilityCallback(cmanager, ccallback) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraManager_unregisterAvailabilityCallback(manager *ACameraManager, callback *ACameraManager_AvailabilityCallbacks) Camera_status_t { - cmanager, cmanagerAllocMap := (*C.ACameraManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := (*C.ACameraManager_AvailabilityCallbacks)(unsafe.Pointer(callback)), cgoAllocsUnknown - __ret := C.ACameraManager_unregisterAvailabilityCallback(cmanager, ccallback) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraManager_unregisterExtendedAvailabilityCallback(manager *ACameraManager, callback *ACameraManager_ExtendedAvailabilityCallbacks) Camera_status_t { - cmanager, cmanagerAllocMap := (*C.ACameraManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := (*C.ACameraManager_ExtendedAvailabilityCallbacks)(unsafe.Pointer(callback)), cgoAllocsUnknown - __ret := C.ACameraManager_unregisterExtendedAvailabilityCallback(cmanager, ccallback) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraMetadata_copy(src *ACameraMetadata) *ACameraMetadata { - csrc, csrcAllocMap := (*C.ACameraMetadata)(unsafe.Pointer(src)), cgoAllocsUnknown - __ret := C.ACameraMetadata_copy(csrc) - runtime.KeepAlive(csrcAllocMap) - __v := (*ACameraMetadata)(unsafe.Pointer(__ret)) - return __v -} - -func ACameraMetadata_free(metadata *ACameraMetadata) { - cmetadata, cmetadataAllocMap := (*C.ACameraMetadata)(unsafe.Pointer(metadata)), cgoAllocsUnknown - C.ACameraMetadata_free(cmetadata) - runtime.KeepAlive(cmetadataAllocMap) -} - -func ACameraMetadata_fromCameraMetadata(env *JNIEnv, cameraMetadata Jobject) *ACameraMetadata { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - ccameraMetadata, ccameraMetadataAllocMap := (C.jobject)(cameraMetadata), cgoAllocsUnknown - __ret := C.ACameraMetadata_fromCameraMetadata(cenv, ccameraMetadata) - runtime.KeepAlive(ccameraMetadataAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (*ACameraMetadata)(unsafe.Pointer(__ret)) - return __v -} - -func ACameraMetadata_getAllTags(metadata *ACameraMetadata, numEntries *int32, tags **uint32) Camera_status_t { - cmetadata, cmetadataAllocMap := (*C.ACameraMetadata)(unsafe.Pointer(metadata)), cgoAllocsUnknown - cnumEntries, cnumEntriesAllocMap := (*C.int)(unsafe.Pointer(numEntries)), cgoAllocsUnknown - ctags, ctagsAllocMap := (**C.uint32_t)(unsafe.Pointer(tags)), cgoAllocsUnknown - var pinnerctags runtime.Pinner - pinnerctags.Pin(tags) - if tags != nil { - pinnerctags.Pin(unsafe.Pointer(*tags)) - } - defer pinnerctags.Unpin() - __ret := C.ACameraMetadata_getAllTags(cmetadata, cnumEntries, ctags) - runtime.KeepAlive(ctagsAllocMap) - runtime.KeepAlive(cnumEntriesAllocMap) - runtime.KeepAlive(cmetadataAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraMetadata_getConstEntry(metadata *ACameraMetadata, tag uint32, entry *ACameraMetadata_const_entry) Camera_status_t { - cmetadata, cmetadataAllocMap := (*C.ACameraMetadata)(unsafe.Pointer(metadata)), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - centry, centryAllocMap := (*C.ACameraMetadata_const_entry)(unsafe.Pointer(entry)), cgoAllocsUnknown - __ret := C.ACameraMetadata_getConstEntry(cmetadata, ctag, centry) - runtime.KeepAlive(centryAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cmetadataAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraMetadata_isLogicalMultiCamera(staticMetadata *ACameraMetadata, numPhysicalCameras *uint64, physicalCameraIds ***int8) bool { - cstaticMetadata, cstaticMetadataAllocMap := (*C.ACameraMetadata)(unsafe.Pointer(staticMetadata)), cgoAllocsUnknown - cnumPhysicalCameras, cnumPhysicalCamerasAllocMap := (*C.uint64_t)(unsafe.Pointer(numPhysicalCameras)), cgoAllocsUnknown - cphysicalCameraIds, cphysicalCameraIdsAllocMap := (***C.char)(unsafe.Pointer(physicalCameraIds)), cgoAllocsUnknown - var pinnercphysicalCameraIds runtime.Pinner - pinnercphysicalCameraIds.Pin(physicalCameraIds) - if physicalCameraIds != nil { - pinnercphysicalCameraIds.Pin(unsafe.Pointer(*physicalCameraIds)) - if *physicalCameraIds != nil { - pinnercphysicalCameraIds.Pin(unsafe.Pointer(**physicalCameraIds)) - } - } - defer pinnercphysicalCameraIds.Unpin() - __ret := C.ACameraMetadata_isLogicalMultiCamera(cstaticMetadata, cnumPhysicalCameras, cphysicalCameraIds) - runtime.KeepAlive(cphysicalCameraIdsAllocMap) - runtime.KeepAlive(cnumPhysicalCamerasAllocMap) - runtime.KeepAlive(cstaticMetadataAllocMap) - __v := (bool)(__ret) - return __v -} - -func ACameraOutputTarget_create(window *ANativeWindow, output **ACameraOutputTarget) Camera_status_t { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - coutput, coutputAllocMap := (**C.ACameraOutputTarget)(unsafe.Pointer(output)), cgoAllocsUnknown - var pinnercoutput runtime.Pinner - pinnercoutput.Pin(output) - if output != nil { - pinnercoutput.Pin(unsafe.Pointer(*output)) - } - defer pinnercoutput.Unpin() - __ret := C.ACameraOutputTarget_create(cwindow, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACameraOutputTarget_free(output *ACameraOutputTarget) { - coutput, coutputAllocMap := (*C.ACameraOutputTarget)(unsafe.Pointer(output)), cgoAllocsUnknown - C.ACameraOutputTarget_free(coutput) - runtime.KeepAlive(coutputAllocMap) -} - -func ACaptureRequest_addTarget(request *ACaptureRequest, output *ACameraOutputTarget) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - coutput, coutputAllocMap := (*C.ACameraOutputTarget)(unsafe.Pointer(output)), cgoAllocsUnknown - __ret := C.ACaptureRequest_addTarget(crequest, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_copy(src *ACaptureRequest) *ACaptureRequest { - csrc, csrcAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(src)), cgoAllocsUnknown - __ret := C.ACaptureRequest_copy(csrc) - runtime.KeepAlive(csrcAllocMap) - __v := (*ACaptureRequest)(unsafe.Pointer(__ret)) - return __v -} - -func ACaptureRequest_free(request *ACaptureRequest) { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - C.ACaptureRequest_free(crequest) - runtime.KeepAlive(crequestAllocMap) -} - -func ACaptureRequest_getAllTags(request *ACaptureRequest, numTags *int32, tags **uint32) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - cnumTags, cnumTagsAllocMap := (*C.int)(unsafe.Pointer(numTags)), cgoAllocsUnknown - ctags, ctagsAllocMap := (**C.uint32_t)(unsafe.Pointer(tags)), cgoAllocsUnknown - var pinnerctags runtime.Pinner - pinnerctags.Pin(tags) - if tags != nil { - pinnerctags.Pin(unsafe.Pointer(*tags)) - } - defer pinnerctags.Unpin() - __ret := C.ACaptureRequest_getAllTags(crequest, cnumTags, ctags) - runtime.KeepAlive(ctagsAllocMap) - runtime.KeepAlive(cnumTagsAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_getConstEntry(request *ACaptureRequest, tag uint32, entry *ACameraMetadata_const_entry) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - centry, centryAllocMap := (*C.ACameraMetadata_const_entry)(unsafe.Pointer(entry)), cgoAllocsUnknown - __ret := C.ACaptureRequest_getConstEntry(crequest, ctag, centry) - runtime.KeepAlive(centryAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_getConstEntry_physicalCamera(request *ACaptureRequest, physicalId string, tag uint32, entry *ACameraMetadata_const_entry) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - cphysicalId, cphysicalIdAllocMap := UnpackPCharString(physicalId) - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - centry, centryAllocMap := (*C.ACameraMetadata_const_entry)(unsafe.Pointer(entry)), cgoAllocsUnknown - __ret := C.ACaptureRequest_getConstEntry_physicalCamera(crequest, cphysicalId, ctag, centry) - runtime.KeepAlive(centryAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cphysicalIdAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_getUserContext(request *ACaptureRequest, context *unsafe.Pointer) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.ACaptureRequest_getUserContext(crequest, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_removeTarget(request *ACaptureRequest, output *ACameraOutputTarget) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - coutput, coutputAllocMap := (*C.ACameraOutputTarget)(unsafe.Pointer(output)), cgoAllocsUnknown - __ret := C.ACaptureRequest_removeTarget(crequest, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_double(request *ACaptureRequest, tag uint32, count uint32, data *float64) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.double)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_double(crequest, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_float(request *ACaptureRequest, tag uint32, count uint32, data *float32) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.float)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_float(crequest, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_i32(request *ACaptureRequest, tag uint32, count uint32, data *int32) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.int)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_i32(crequest, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_i64(request *ACaptureRequest, tag uint32, count uint32, data *int64) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.int64_t)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_i64(crequest, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_physicalCamera_double(request *ACaptureRequest, physicalId string, tag uint32, count uint32, data *float64) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - cphysicalId, cphysicalIdAllocMap := UnpackPCharString(physicalId) - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.double)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_physicalCamera_double(crequest, cphysicalId, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cphysicalIdAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_physicalCamera_float(request *ACaptureRequest, physicalId string, tag uint32, count uint32, data *float32) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - cphysicalId, cphysicalIdAllocMap := UnpackPCharString(physicalId) - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.float)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_physicalCamera_float(crequest, cphysicalId, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cphysicalIdAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_physicalCamera_i32(request *ACaptureRequest, physicalId string, tag uint32, count uint32, data *int32) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - cphysicalId, cphysicalIdAllocMap := UnpackPCharString(physicalId) - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.int)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_physicalCamera_i32(crequest, cphysicalId, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cphysicalIdAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_physicalCamera_i64(request *ACaptureRequest, physicalId string, tag uint32, count uint32, data *int64) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - cphysicalId, cphysicalIdAllocMap := UnpackPCharString(physicalId) - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.int64_t)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_physicalCamera_i64(crequest, cphysicalId, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cphysicalIdAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_physicalCamera_rational(request *ACaptureRequest, physicalId string, tag uint32, count uint32, data *ACameraMetadata_rational) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - cphysicalId, cphysicalIdAllocMap := UnpackPCharString(physicalId) - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.ACameraMetadata_rational)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_physicalCamera_rational(crequest, cphysicalId, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cphysicalIdAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_physicalCamera_u8(request *ACaptureRequest, physicalId string, tag uint32, count uint32, data *uint8) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - cphysicalId, cphysicalIdAllocMap := UnpackPCharString(physicalId) - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.uint8_t)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_physicalCamera_u8(crequest, cphysicalId, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cphysicalIdAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_rational(request *ACaptureRequest, tag uint32, count uint32, data *ACameraMetadata_rational) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.ACameraMetadata_rational)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_rational(crequest, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setEntry_u8(request *ACaptureRequest, tag uint32, count uint32, data *uint8) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.uint8_t)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.ACaptureRequest_setEntry_u8(crequest, ctag, ccount, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureRequest_setUserContext(request *ACaptureRequest, context unsafe.Pointer) Camera_status_t { - crequest, crequestAllocMap := (*C.ACaptureRequest)(unsafe.Pointer(request)), cgoAllocsUnknown - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.ACaptureRequest_setUserContext(crequest, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(crequestAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureSessionOutputContainer_add(container *ACaptureSessionOutputContainer, output *ACaptureSessionOutput) Camera_status_t { - ccontainer, ccontainerAllocMap := (*C.ACaptureSessionOutputContainer)(unsafe.Pointer(container)), cgoAllocsUnknown - coutput, coutputAllocMap := (*C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - __ret := C.ACaptureSessionOutputContainer_add(ccontainer, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(ccontainerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureSessionOutputContainer_create(container **ACaptureSessionOutputContainer) Camera_status_t { - ccontainer, ccontainerAllocMap := (**C.ACaptureSessionOutputContainer)(unsafe.Pointer(container)), cgoAllocsUnknown - var pinnerccontainer runtime.Pinner - pinnerccontainer.Pin(container) - if container != nil { - pinnerccontainer.Pin(unsafe.Pointer(*container)) - } - defer pinnerccontainer.Unpin() - __ret := C.ACaptureSessionOutputContainer_create(ccontainer) - runtime.KeepAlive(ccontainerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureSessionOutputContainer_free(container *ACaptureSessionOutputContainer) { - ccontainer, ccontainerAllocMap := (*C.ACaptureSessionOutputContainer)(unsafe.Pointer(container)), cgoAllocsUnknown - C.ACaptureSessionOutputContainer_free(ccontainer) - runtime.KeepAlive(ccontainerAllocMap) -} - -func ACaptureSessionOutputContainer_remove(container *ACaptureSessionOutputContainer, output *ACaptureSessionOutput) Camera_status_t { - ccontainer, ccontainerAllocMap := (*C.ACaptureSessionOutputContainer)(unsafe.Pointer(container)), cgoAllocsUnknown - coutput, coutputAllocMap := (*C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - __ret := C.ACaptureSessionOutputContainer_remove(ccontainer, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(ccontainerAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureSessionOutput_create(anw *ANativeWindow, output **ACaptureSessionOutput) Camera_status_t { - canw, canwAllocMap := (*C.ANativeWindow)(unsafe.Pointer(anw)), cgoAllocsUnknown - coutput, coutputAllocMap := (**C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - var pinnercoutput runtime.Pinner - pinnercoutput.Pin(output) - if output != nil { - pinnercoutput.Pin(unsafe.Pointer(*output)) - } - defer pinnercoutput.Unpin() - __ret := C.ACaptureSessionOutput_create(canw, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(canwAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureSessionOutput_free(output *ACaptureSessionOutput) { - coutput, coutputAllocMap := (*C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - C.ACaptureSessionOutput_free(coutput) - runtime.KeepAlive(coutputAllocMap) -} - -func ACaptureSessionPhysicalOutput_create(anw *ANativeWindow, physicalId string, output **ACaptureSessionOutput) Camera_status_t { - canw, canwAllocMap := (*C.ANativeWindow)(unsafe.Pointer(anw)), cgoAllocsUnknown - cphysicalId, cphysicalIdAllocMap := UnpackPCharString(physicalId) - coutput, coutputAllocMap := (**C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - var pinnercoutput runtime.Pinner - pinnercoutput.Pin(output) - if output != nil { - pinnercoutput.Pin(unsafe.Pointer(*output)) - } - defer pinnercoutput.Unpin() - __ret := C.ACaptureSessionPhysicalOutput_create(canw, cphysicalId, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(cphysicalIdAllocMap) - runtime.KeepAlive(canwAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureSessionSharedOutput_add(output *ACaptureSessionOutput, anw *ANativeWindow) Camera_status_t { - coutput, coutputAllocMap := (*C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - canw, canwAllocMap := (*C.ANativeWindow)(unsafe.Pointer(anw)), cgoAllocsUnknown - __ret := C.ACaptureSessionSharedOutput_add(coutput, canw) - runtime.KeepAlive(canwAllocMap) - runtime.KeepAlive(coutputAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureSessionSharedOutput_create(anw *ANativeWindow, output **ACaptureSessionOutput) Camera_status_t { - canw, canwAllocMap := (*C.ANativeWindow)(unsafe.Pointer(anw)), cgoAllocsUnknown - coutput, coutputAllocMap := (**C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - var pinnercoutput runtime.Pinner - pinnercoutput.Pin(output) - if output != nil { - pinnercoutput.Pin(unsafe.Pointer(*output)) - } - defer pinnercoutput.Unpin() - __ret := C.ACaptureSessionSharedOutput_create(canw, coutput) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(canwAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} - -func ACaptureSessionSharedOutput_remove(output *ACaptureSessionOutput, anw *ANativeWindow) Camera_status_t { - coutput, coutputAllocMap := (*C.ACaptureSessionOutput)(unsafe.Pointer(output)), cgoAllocsUnknown - canw, canwAllocMap := (*C.ANativeWindow)(unsafe.Pointer(anw)), cgoAllocsUnknown - __ret := C.ACaptureSessionSharedOutput_remove(coutput, canw) - runtime.KeepAlive(canwAllocMap) - runtime.KeepAlive(coutputAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} diff --git a/capi/camera/camera_api35.go b/capi/camera/camera_api35.go deleted file mode 100644 index bf425e5..0000000 --- a/capi/camera/camera_api35.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build android_ndk35 - -// Code generated by capigen. DO NOT EDIT. - -package camera - -/* -#cgo LDFLAGS: -lcamera2ndk -#undef __ANDROID_MIN_SDK_VERSION__ -#define __ANDROID_MIN_SDK_VERSION__ 35 -#define __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ 1 -#include "camera/NdkCameraManager.h" -#include "camera/NdkCameraDevice.h" -#include "camera/NdkCaptureRequest.h" -#include "camera/NdkCameraCaptureSession.h" -#include "camera/NdkCameraMetadata.h" -#include "camera/NdkCameraMetadataTags.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ACameraMetadata_getTagFromName(metadata *ACameraMetadata, name string, tag *uint32) Camera_status_t { - cmetadata, cmetadataAllocMap := (*C.ACameraMetadata)(unsafe.Pointer(metadata)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - ctag, ctagAllocMap := (*C.uint)(unsafe.Pointer(tag)), cgoAllocsUnknown - __ret := C.ACameraMetadata_getTagFromName(cmetadata, cname, ctag) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cmetadataAllocMap) - __v := (Camera_status_t)(__ret) - return __v -} diff --git a/capi/camera/cgo_helpers.c b/capi/camera/cgo_helpers.c deleted file mode 100644 index 3d03c3d..0000000 --- a/capi/camera/cgo_helpers.c +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void ACameraCaptureSession_captureCallback_bufferLost_f848f414(void* context, ACameraCaptureSession* session, ACaptureRequest* request, ANativeWindow* window, int64_t frameNumber) { - ACameraCaptureSession_captureCallback_bufferLostF848F414(context, session, request, window, frameNumber); -} - -void ACameraCaptureSession_captureCallback_failed_7ffeb49b(void* context, ACameraCaptureSession* session, ACaptureRequest* request, ACameraCaptureFailure* failure) { - ACameraCaptureSession_captureCallback_failed7FFEB49B(context, session, request, failure); -} - -void ACameraCaptureSession_captureCallback_result_314ecd33(void* context, ACameraCaptureSession* session, ACaptureRequest* request, const ACameraMetadata* result) { - ACameraCaptureSession_captureCallback_result314ECD33(context, session, request, (ACameraMetadata*)result); -} - -void ACameraCaptureSession_captureCallback_sequenceAbort_a6746d19(void* context, ACameraCaptureSession* session, int sequenceId) { - ACameraCaptureSession_captureCallback_sequenceAbortA6746D19(context, session, sequenceId); -} - -void ACameraCaptureSession_captureCallback_sequenceEnd_52945432(void* context, ACameraCaptureSession* session, int sequenceId, int64_t frameNumber) { - ACameraCaptureSession_captureCallback_sequenceEnd52945432(context, session, sequenceId, frameNumber); -} - -void ACameraCaptureSession_captureCallback_start_fd7e5afc(void* context, ACameraCaptureSession* session, const ACaptureRequest* request, int64_t timestamp) { - ACameraCaptureSession_captureCallback_startFD7E5AFC(context, session, (ACaptureRequest*)request, timestamp); -} - -void ACameraCaptureSession_captureCallback_startV2_26e0bf9d(void* context, ACameraCaptureSession* session, const ACaptureRequest* request, int64_t timestamp, int64_t frameNumber) { - ACameraCaptureSession_captureCallback_startV226E0BF9D(context, session, (ACaptureRequest*)request, timestamp, frameNumber); -} - -void ACameraCaptureSession_logicalCamera_captureCallback_failed_47ed36f2(void* context, ACameraCaptureSession* session, ACaptureRequest* request, ALogicalCameraCaptureFailure* failure) { - ACameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2(context, session, request, failure); -} - -void ACameraCaptureSession_logicalCamera_captureCallback_result_1bcff0f4(void* context, ACameraCaptureSession* session, ACaptureRequest* request, const ACameraMetadata* result, size_t physicalResultCount, const char** physicalCameraIds, const ACameraMetadata** physicalResults) { - ACameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4(context, session, request, (ACameraMetadata*)result, physicalResultCount, (char**)physicalCameraIds, (ACameraMetadata**)physicalResults); -} - -void ACameraCaptureSession_prepareCallback_c0ef58e6(void* context, ANativeWindow* window, ACameraCaptureSession* session) { - ACameraCaptureSession_prepareCallbackC0EF58E6(context, window, session); -} - -void ACameraCaptureSession_stateCallback_58745d98(void* context, ACameraCaptureSession* session) { - ACameraCaptureSession_stateCallback58745D98(context, session); -} - -void ACameraDevice_ErrorStateCallback_8c471a01(void* context, ACameraDevice* device, int _error) { - ACameraDevice_ErrorStateCallback8C471A01(context, device, _error); -} - -void ACameraDevice_StateCallback_16aee050(void* context, ACameraDevice* device) { - ACameraDevice_StateCallback16AEE050(context, device); -} - -void ACameraManager_AccessPrioritiesChangedCallback_e0732dc5(void* context) { - ACameraManager_AccessPrioritiesChangedCallbackE0732DC5(context); -} - -void ACameraManager_AvailabilityCallback_aab12960(void* context, const char* cameraId) { - ACameraManager_AvailabilityCallbackAAB12960(context, (char*)cameraId); -} - -void ACameraManager_PhysicalCameraAvailabilityCallback_c6d28c7e(void* context, const char* cameraId, const char* physicalCameraId) { - ACameraManager_PhysicalCameraAvailabilityCallbackC6D28C7E(context, (char*)cameraId, (char*)physicalCameraId); -} - diff --git a/capi/camera/cgo_helpers.go b/capi/camera/cgo_helpers.go deleted file mode 100644 index 1760e8e..0000000 --- a/capi/camera/cgo_helpers.go +++ /dev/null @@ -1,712 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package camera - -/* -#cgo LDFLAGS: -lcamera2ndk -#include "camera/NdkCameraManager.h" -#include "camera/NdkCameraDevice.h" -#include "camera/NdkCaptureRequest.h" -#include "camera/NdkCameraCaptureSession.h" -#include "camera/NdkCameraMetadata.h" -#include "camera/NdkCameraMetadataTags.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || a == b || b.IsEmpty() { - return - } - // Acquire locks in consistent pointer-address order to prevent - // ABBA deadlock when two goroutines call x.Borrow(y) and y.Borrow(x). - if uintptr(unsafe.Pointer(a)) < uintptr(unsafe.Pointer(b)) { - a.mux.Lock() - b.mux.Lock() - } else { - b.mux.Lock() - a.mux.Lock() - } - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x ACameraCaptureSession_captureCallback_bufferLost) PassRef() (ref *C.ACameraCaptureSession_captureCallback_bufferLost, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_bufferLostF848F414Func == nil { - aCameraCaptureSession_captureCallback_bufferLostF848F414Func = x - } - return (*C.ACameraCaptureSession_captureCallback_bufferLost)(C.ACameraCaptureSession_captureCallback_bufferLost_f848f414), nil -} - -func (x ACameraCaptureSession_captureCallback_bufferLost) PassValue() (ref C.ACameraCaptureSession_captureCallback_bufferLost, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_bufferLostF848F414Func == nil { - aCameraCaptureSession_captureCallback_bufferLostF848F414Func = x - } - return (C.ACameraCaptureSession_captureCallback_bufferLost)(C.ACameraCaptureSession_captureCallback_bufferLost_f848f414), nil -} - -func NewACameraCaptureSession_captureCallback_bufferLostRef(ref unsafe.Pointer) *ACameraCaptureSession_captureCallback_bufferLost { - return (*ACameraCaptureSession_captureCallback_bufferLost)(ref) -} - -//export ACameraCaptureSession_captureCallback_bufferLostF848F414 -func ACameraCaptureSession_captureCallback_bufferLostF848F414(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, crequest *C.ACaptureRequest, cwindow *C.ANativeWindow, cframeNumber C.int64_t) { - if aCameraCaptureSession_captureCallback_bufferLostF848F414Func != nil { - contextf848f414 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - sessionf848f414 := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - requestf848f414 := (*ACaptureRequest)(unsafe.Pointer(crequest)) - windowf848f414 := (*ANativeWindow)(unsafe.Pointer(cwindow)) - frameNumberf848f414 := (int64)(cframeNumber) - aCameraCaptureSession_captureCallback_bufferLostF848F414Func(contextf848f414, sessionf848f414, requestf848f414, windowf848f414, frameNumberf848f414) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_captureCallback_bufferLostF848F414Func ACameraCaptureSession_captureCallback_bufferLost - -func (x ACameraCaptureSession_captureCallback_failed) PassRef() (ref *C.ACameraCaptureSession_captureCallback_failed, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_failed7FFEB49BFunc == nil { - aCameraCaptureSession_captureCallback_failed7FFEB49BFunc = x - } - return (*C.ACameraCaptureSession_captureCallback_failed)(C.ACameraCaptureSession_captureCallback_failed_7ffeb49b), nil -} - -func (x ACameraCaptureSession_captureCallback_failed) PassValue() (ref C.ACameraCaptureSession_captureCallback_failed, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_failed7FFEB49BFunc == nil { - aCameraCaptureSession_captureCallback_failed7FFEB49BFunc = x - } - return (C.ACameraCaptureSession_captureCallback_failed)(C.ACameraCaptureSession_captureCallback_failed_7ffeb49b), nil -} - -func NewACameraCaptureSession_captureCallback_failedRef(ref unsafe.Pointer) *ACameraCaptureSession_captureCallback_failed { - return (*ACameraCaptureSession_captureCallback_failed)(ref) -} - -//export ACameraCaptureSession_captureCallback_failed7FFEB49B -func ACameraCaptureSession_captureCallback_failed7FFEB49B(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, crequest *C.ACaptureRequest, cfailure *C.ACameraCaptureFailure) { - if aCameraCaptureSession_captureCallback_failed7FFEB49BFunc != nil { - context7ffeb49b := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - session7ffeb49b := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - request7ffeb49b := (*ACaptureRequest)(unsafe.Pointer(crequest)) - failure7ffeb49b := (*ACameraCaptureFailure)(unsafe.Pointer(cfailure)) - aCameraCaptureSession_captureCallback_failed7FFEB49BFunc(context7ffeb49b, session7ffeb49b, request7ffeb49b, failure7ffeb49b) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_captureCallback_failed7FFEB49BFunc ACameraCaptureSession_captureCallback_failed - -func (x ACameraCaptureSession_captureCallback_result) PassRef() (ref *C.ACameraCaptureSession_captureCallback_result, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_result314ECD33Func == nil { - aCameraCaptureSession_captureCallback_result314ECD33Func = x - } - return (*C.ACameraCaptureSession_captureCallback_result)(C.ACameraCaptureSession_captureCallback_result_314ecd33), nil -} - -func (x ACameraCaptureSession_captureCallback_result) PassValue() (ref C.ACameraCaptureSession_captureCallback_result, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_result314ECD33Func == nil { - aCameraCaptureSession_captureCallback_result314ECD33Func = x - } - return (C.ACameraCaptureSession_captureCallback_result)(C.ACameraCaptureSession_captureCallback_result_314ecd33), nil -} - -func NewACameraCaptureSession_captureCallback_resultRef(ref unsafe.Pointer) *ACameraCaptureSession_captureCallback_result { - return (*ACameraCaptureSession_captureCallback_result)(ref) -} - -//export ACameraCaptureSession_captureCallback_result314ECD33 -func ACameraCaptureSession_captureCallback_result314ECD33(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, crequest *C.ACaptureRequest, cresult *C.ACameraMetadata) { - if aCameraCaptureSession_captureCallback_result314ECD33Func != nil { - context314ecd33 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - session314ecd33 := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - request314ecd33 := (*ACaptureRequest)(unsafe.Pointer(crequest)) - result314ecd33 := (*ACameraMetadata)(unsafe.Pointer(cresult)) - aCameraCaptureSession_captureCallback_result314ECD33Func(context314ecd33, session314ecd33, request314ecd33, result314ecd33) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_captureCallback_result314ECD33Func ACameraCaptureSession_captureCallback_result - -func (x ACameraCaptureSession_captureCallback_sequenceAbort) PassRef() (ref *C.ACameraCaptureSession_captureCallback_sequenceAbort, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_sequenceAbortA6746D19Func == nil { - aCameraCaptureSession_captureCallback_sequenceAbortA6746D19Func = x - } - return (*C.ACameraCaptureSession_captureCallback_sequenceAbort)(C.ACameraCaptureSession_captureCallback_sequenceAbort_a6746d19), nil -} - -func (x ACameraCaptureSession_captureCallback_sequenceAbort) PassValue() (ref C.ACameraCaptureSession_captureCallback_sequenceAbort, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_sequenceAbortA6746D19Func == nil { - aCameraCaptureSession_captureCallback_sequenceAbortA6746D19Func = x - } - return (C.ACameraCaptureSession_captureCallback_sequenceAbort)(C.ACameraCaptureSession_captureCallback_sequenceAbort_a6746d19), nil -} - -func NewACameraCaptureSession_captureCallback_sequenceAbortRef(ref unsafe.Pointer) *ACameraCaptureSession_captureCallback_sequenceAbort { - return (*ACameraCaptureSession_captureCallback_sequenceAbort)(ref) -} - -//export ACameraCaptureSession_captureCallback_sequenceAbortA6746D19 -func ACameraCaptureSession_captureCallback_sequenceAbortA6746D19(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, csequenceId C.int) { - if aCameraCaptureSession_captureCallback_sequenceAbortA6746D19Func != nil { - contexta6746d19 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - sessiona6746d19 := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - sequenceIda6746d19 := (int32)(csequenceId) - aCameraCaptureSession_captureCallback_sequenceAbortA6746D19Func(contexta6746d19, sessiona6746d19, sequenceIda6746d19) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_captureCallback_sequenceAbortA6746D19Func ACameraCaptureSession_captureCallback_sequenceAbort - -func (x ACameraCaptureSession_captureCallback_sequenceEnd) PassRef() (ref *C.ACameraCaptureSession_captureCallback_sequenceEnd, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_sequenceEnd52945432Func == nil { - aCameraCaptureSession_captureCallback_sequenceEnd52945432Func = x - } - return (*C.ACameraCaptureSession_captureCallback_sequenceEnd)(C.ACameraCaptureSession_captureCallback_sequenceEnd_52945432), nil -} - -func (x ACameraCaptureSession_captureCallback_sequenceEnd) PassValue() (ref C.ACameraCaptureSession_captureCallback_sequenceEnd, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_sequenceEnd52945432Func == nil { - aCameraCaptureSession_captureCallback_sequenceEnd52945432Func = x - } - return (C.ACameraCaptureSession_captureCallback_sequenceEnd)(C.ACameraCaptureSession_captureCallback_sequenceEnd_52945432), nil -} - -func NewACameraCaptureSession_captureCallback_sequenceEndRef(ref unsafe.Pointer) *ACameraCaptureSession_captureCallback_sequenceEnd { - return (*ACameraCaptureSession_captureCallback_sequenceEnd)(ref) -} - -//export ACameraCaptureSession_captureCallback_sequenceEnd52945432 -func ACameraCaptureSession_captureCallback_sequenceEnd52945432(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, csequenceId C.int, cframeNumber C.int64_t) { - if aCameraCaptureSession_captureCallback_sequenceEnd52945432Func != nil { - context52945432 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - session52945432 := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - sequenceId52945432 := (int32)(csequenceId) - frameNumber52945432 := (int64)(cframeNumber) - aCameraCaptureSession_captureCallback_sequenceEnd52945432Func(context52945432, session52945432, sequenceId52945432, frameNumber52945432) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_captureCallback_sequenceEnd52945432Func ACameraCaptureSession_captureCallback_sequenceEnd - -func (x ACameraCaptureSession_captureCallback_start) PassRef() (ref *C.ACameraCaptureSession_captureCallback_start, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_startFD7E5AFCFunc == nil { - aCameraCaptureSession_captureCallback_startFD7E5AFCFunc = x - } - return (*C.ACameraCaptureSession_captureCallback_start)(C.ACameraCaptureSession_captureCallback_start_fd7e5afc), nil -} - -func (x ACameraCaptureSession_captureCallback_start) PassValue() (ref C.ACameraCaptureSession_captureCallback_start, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_startFD7E5AFCFunc == nil { - aCameraCaptureSession_captureCallback_startFD7E5AFCFunc = x - } - return (C.ACameraCaptureSession_captureCallback_start)(C.ACameraCaptureSession_captureCallback_start_fd7e5afc), nil -} - -func NewACameraCaptureSession_captureCallback_startRef(ref unsafe.Pointer) *ACameraCaptureSession_captureCallback_start { - return (*ACameraCaptureSession_captureCallback_start)(ref) -} - -//export ACameraCaptureSession_captureCallback_startFD7E5AFC -func ACameraCaptureSession_captureCallback_startFD7E5AFC(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, crequest *C.ACaptureRequest, ctimestamp C.int64_t) { - if aCameraCaptureSession_captureCallback_startFD7E5AFCFunc != nil { - contextfd7e5afc := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - sessionfd7e5afc := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - requestfd7e5afc := (*ACaptureRequest)(unsafe.Pointer(crequest)) - timestampfd7e5afc := (int64)(ctimestamp) - aCameraCaptureSession_captureCallback_startFD7E5AFCFunc(contextfd7e5afc, sessionfd7e5afc, requestfd7e5afc, timestampfd7e5afc) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_captureCallback_startFD7E5AFCFunc ACameraCaptureSession_captureCallback_start - -func (x ACameraCaptureSession_captureCallback_startV2) PassRef() (ref *C.ACameraCaptureSession_captureCallback_startV2, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_startV226E0BF9DFunc == nil { - aCameraCaptureSession_captureCallback_startV226E0BF9DFunc = x - } - return (*C.ACameraCaptureSession_captureCallback_startV2)(C.ACameraCaptureSession_captureCallback_startV2_26e0bf9d), nil -} - -func (x ACameraCaptureSession_captureCallback_startV2) PassValue() (ref C.ACameraCaptureSession_captureCallback_startV2, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_captureCallback_startV226E0BF9DFunc == nil { - aCameraCaptureSession_captureCallback_startV226E0BF9DFunc = x - } - return (C.ACameraCaptureSession_captureCallback_startV2)(C.ACameraCaptureSession_captureCallback_startV2_26e0bf9d), nil -} - -func NewACameraCaptureSession_captureCallback_startV2Ref(ref unsafe.Pointer) *ACameraCaptureSession_captureCallback_startV2 { - return (*ACameraCaptureSession_captureCallback_startV2)(ref) -} - -//export ACameraCaptureSession_captureCallback_startV226E0BF9D -func ACameraCaptureSession_captureCallback_startV226E0BF9D(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, crequest *C.ACaptureRequest, ctimestamp C.int64_t, cframeNumber C.int64_t) { - if aCameraCaptureSession_captureCallback_startV226E0BF9DFunc != nil { - context26e0bf9d := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - session26e0bf9d := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - request26e0bf9d := (*ACaptureRequest)(unsafe.Pointer(crequest)) - timestamp26e0bf9d := (int64)(ctimestamp) - frameNumber26e0bf9d := (int64)(cframeNumber) - aCameraCaptureSession_captureCallback_startV226E0BF9DFunc(context26e0bf9d, session26e0bf9d, request26e0bf9d, timestamp26e0bf9d, frameNumber26e0bf9d) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_captureCallback_startV226E0BF9DFunc ACameraCaptureSession_captureCallback_startV2 - -func (x ACameraCaptureSession_logicalCamera_captureCallback_failed) PassRef() (ref *C.ACameraCaptureSession_logicalCamera_captureCallback_failed, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2Func == nil { - aCameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2Func = x - } - return (*C.ACameraCaptureSession_logicalCamera_captureCallback_failed)(C.ACameraCaptureSession_logicalCamera_captureCallback_failed_47ed36f2), nil -} - -func (x ACameraCaptureSession_logicalCamera_captureCallback_failed) PassValue() (ref C.ACameraCaptureSession_logicalCamera_captureCallback_failed, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2Func == nil { - aCameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2Func = x - } - return (C.ACameraCaptureSession_logicalCamera_captureCallback_failed)(C.ACameraCaptureSession_logicalCamera_captureCallback_failed_47ed36f2), nil -} - -func NewACameraCaptureSession_logicalCamera_captureCallback_failedRef(ref unsafe.Pointer) *ACameraCaptureSession_logicalCamera_captureCallback_failed { - return (*ACameraCaptureSession_logicalCamera_captureCallback_failed)(ref) -} - -//export ACameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2 -func ACameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, crequest *C.ACaptureRequest, cfailure *C.ALogicalCameraCaptureFailure) { - if aCameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2Func != nil { - context47ed36f2 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - session47ed36f2 := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - request47ed36f2 := (*ACaptureRequest)(unsafe.Pointer(crequest)) - failure47ed36f2 := (*ALogicalCameraCaptureFailure)(unsafe.Pointer(cfailure)) - aCameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2Func(context47ed36f2, session47ed36f2, request47ed36f2, failure47ed36f2) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_logicalCamera_captureCallback_failed47ED36F2Func ACameraCaptureSession_logicalCamera_captureCallback_failed - -func (x ACameraCaptureSession_logicalCamera_captureCallback_result) PassRef() (ref *C.ACameraCaptureSession_logicalCamera_captureCallback_result, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4Func == nil { - aCameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4Func = x - } - return (*C.ACameraCaptureSession_logicalCamera_captureCallback_result)(C.ACameraCaptureSession_logicalCamera_captureCallback_result_1bcff0f4), nil -} - -func (x ACameraCaptureSession_logicalCamera_captureCallback_result) PassValue() (ref C.ACameraCaptureSession_logicalCamera_captureCallback_result, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4Func == nil { - aCameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4Func = x - } - return (C.ACameraCaptureSession_logicalCamera_captureCallback_result)(C.ACameraCaptureSession_logicalCamera_captureCallback_result_1bcff0f4), nil -} - -func NewACameraCaptureSession_logicalCamera_captureCallback_resultRef(ref unsafe.Pointer) *ACameraCaptureSession_logicalCamera_captureCallback_result { - return (*ACameraCaptureSession_logicalCamera_captureCallback_result)(ref) -} - -//export ACameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4 -func ACameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession, crequest *C.ACaptureRequest, cresult *C.ACameraMetadata, cphysicalResultCount C.size_t, cphysicalCameraIds **C.char, cphysicalResults **C.ACameraMetadata) { - if aCameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4Func != nil { - context1bcff0f4 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - session1bcff0f4 := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - request1bcff0f4 := (*ACaptureRequest)(unsafe.Pointer(crequest)) - result1bcff0f4 := (*ACameraMetadata)(unsafe.Pointer(cresult)) - physicalResultCount1bcff0f4 := (uint64)(cphysicalResultCount) - physicalCameraIds1bcff0f4 := (**int8)(unsafe.Pointer(cphysicalCameraIds)) - physicalResults1bcff0f4 := (**ACameraMetadata)(unsafe.Pointer(cphysicalResults)) - aCameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4Func(context1bcff0f4, session1bcff0f4, request1bcff0f4, result1bcff0f4, physicalResultCount1bcff0f4, physicalCameraIds1bcff0f4, physicalResults1bcff0f4) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_logicalCamera_captureCallback_result1BCFF0F4Func ACameraCaptureSession_logicalCamera_captureCallback_result - -func (x ACameraCaptureSession_prepareCallback) PassRef() (ref *C.ACameraCaptureSession_prepareCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_prepareCallbackC0EF58E6Func == nil { - aCameraCaptureSession_prepareCallbackC0EF58E6Func = x - } - return (*C.ACameraCaptureSession_prepareCallback)(C.ACameraCaptureSession_prepareCallback_c0ef58e6), nil -} - -func (x ACameraCaptureSession_prepareCallback) PassValue() (ref C.ACameraCaptureSession_prepareCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_prepareCallbackC0EF58E6Func == nil { - aCameraCaptureSession_prepareCallbackC0EF58E6Func = x - } - return (C.ACameraCaptureSession_prepareCallback)(C.ACameraCaptureSession_prepareCallback_c0ef58e6), nil -} - -func NewACameraCaptureSession_prepareCallbackRef(ref unsafe.Pointer) *ACameraCaptureSession_prepareCallback { - return (*ACameraCaptureSession_prepareCallback)(ref) -} - -//export ACameraCaptureSession_prepareCallbackC0EF58E6 -func ACameraCaptureSession_prepareCallbackC0EF58E6(ccontext unsafe.Pointer, cwindow *C.ANativeWindow, csession *C.ACameraCaptureSession) { - if aCameraCaptureSession_prepareCallbackC0EF58E6Func != nil { - contextc0ef58e6 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - windowc0ef58e6 := (*ANativeWindow)(unsafe.Pointer(cwindow)) - sessionc0ef58e6 := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - aCameraCaptureSession_prepareCallbackC0EF58E6Func(contextc0ef58e6, windowc0ef58e6, sessionc0ef58e6) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_prepareCallbackC0EF58E6Func ACameraCaptureSession_prepareCallback - -func (x ACameraCaptureSession_stateCallback) PassRef() (ref *C.ACameraCaptureSession_stateCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_stateCallback58745D98Func == nil { - aCameraCaptureSession_stateCallback58745D98Func = x - } - return (*C.ACameraCaptureSession_stateCallback)(C.ACameraCaptureSession_stateCallback_58745d98), nil -} - -func (x ACameraCaptureSession_stateCallback) PassValue() (ref C.ACameraCaptureSession_stateCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraCaptureSession_stateCallback58745D98Func == nil { - aCameraCaptureSession_stateCallback58745D98Func = x - } - return (C.ACameraCaptureSession_stateCallback)(C.ACameraCaptureSession_stateCallback_58745d98), nil -} - -func NewACameraCaptureSession_stateCallbackRef(ref unsafe.Pointer) *ACameraCaptureSession_stateCallback { - return (*ACameraCaptureSession_stateCallback)(ref) -} - -//export ACameraCaptureSession_stateCallback58745D98 -func ACameraCaptureSession_stateCallback58745D98(ccontext unsafe.Pointer, csession *C.ACameraCaptureSession) { - if aCameraCaptureSession_stateCallback58745D98Func != nil { - context58745d98 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - session58745d98 := (*ACameraCaptureSession)(unsafe.Pointer(csession)) - aCameraCaptureSession_stateCallback58745D98Func(context58745d98, session58745d98) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraCaptureSession_stateCallback58745D98Func ACameraCaptureSession_stateCallback - -func (x ACameraDevice_ErrorStateCallback) PassRef() (ref *C.ACameraDevice_ErrorStateCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraDevice_ErrorStateCallback8C471A01Func == nil { - aCameraDevice_ErrorStateCallback8C471A01Func = x - } - return (*C.ACameraDevice_ErrorStateCallback)(C.ACameraDevice_ErrorStateCallback_8c471a01), nil -} - -func (x ACameraDevice_ErrorStateCallback) PassValue() (ref C.ACameraDevice_ErrorStateCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraDevice_ErrorStateCallback8C471A01Func == nil { - aCameraDevice_ErrorStateCallback8C471A01Func = x - } - return (C.ACameraDevice_ErrorStateCallback)(C.ACameraDevice_ErrorStateCallback_8c471a01), nil -} - -func NewACameraDevice_ErrorStateCallbackRef(ref unsafe.Pointer) *ACameraDevice_ErrorStateCallback { - return (*ACameraDevice_ErrorStateCallback)(ref) -} - -//export ACameraDevice_ErrorStateCallback8C471A01 -func ACameraDevice_ErrorStateCallback8C471A01(ccontext unsafe.Pointer, cdevice *C.ACameraDevice, c_error C.int) { - if aCameraDevice_ErrorStateCallback8C471A01Func != nil { - context8c471a01 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - device8c471a01 := (*ACameraDevice)(unsafe.Pointer(cdevice)) - _error8c471a01 := (int32)(c_error) - aCameraDevice_ErrorStateCallback8C471A01Func(context8c471a01, device8c471a01, _error8c471a01) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraDevice_ErrorStateCallback8C471A01Func ACameraDevice_ErrorStateCallback - -func (x ACameraDevice_StateCallback) PassRef() (ref *C.ACameraDevice_StateCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraDevice_StateCallback16AEE050Func == nil { - aCameraDevice_StateCallback16AEE050Func = x - } - return (*C.ACameraDevice_StateCallback)(C.ACameraDevice_StateCallback_16aee050), nil -} - -func (x ACameraDevice_StateCallback) PassValue() (ref C.ACameraDevice_StateCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraDevice_StateCallback16AEE050Func == nil { - aCameraDevice_StateCallback16AEE050Func = x - } - return (C.ACameraDevice_StateCallback)(C.ACameraDevice_StateCallback_16aee050), nil -} - -func NewACameraDevice_StateCallbackRef(ref unsafe.Pointer) *ACameraDevice_StateCallback { - return (*ACameraDevice_StateCallback)(ref) -} - -//export ACameraDevice_StateCallback16AEE050 -func ACameraDevice_StateCallback16AEE050(ccontext unsafe.Pointer, cdevice *C.ACameraDevice) { - if aCameraDevice_StateCallback16AEE050Func != nil { - context16aee050 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - device16aee050 := (*ACameraDevice)(unsafe.Pointer(cdevice)) - aCameraDevice_StateCallback16AEE050Func(context16aee050, device16aee050) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraDevice_StateCallback16AEE050Func ACameraDevice_StateCallback - -func (x ACameraManager_AccessPrioritiesChangedCallback) PassRef() (ref *C.ACameraManager_AccessPrioritiesChangedCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraManager_AccessPrioritiesChangedCallbackE0732DC5Func == nil { - aCameraManager_AccessPrioritiesChangedCallbackE0732DC5Func = x - } - return (*C.ACameraManager_AccessPrioritiesChangedCallback)(C.ACameraManager_AccessPrioritiesChangedCallback_e0732dc5), nil -} - -func (x ACameraManager_AccessPrioritiesChangedCallback) PassValue() (ref C.ACameraManager_AccessPrioritiesChangedCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraManager_AccessPrioritiesChangedCallbackE0732DC5Func == nil { - aCameraManager_AccessPrioritiesChangedCallbackE0732DC5Func = x - } - return (C.ACameraManager_AccessPrioritiesChangedCallback)(C.ACameraManager_AccessPrioritiesChangedCallback_e0732dc5), nil -} - -func NewACameraManager_AccessPrioritiesChangedCallbackRef(ref unsafe.Pointer) *ACameraManager_AccessPrioritiesChangedCallback { - return (*ACameraManager_AccessPrioritiesChangedCallback)(ref) -} - -//export ACameraManager_AccessPrioritiesChangedCallbackE0732DC5 -func ACameraManager_AccessPrioritiesChangedCallbackE0732DC5(ccontext unsafe.Pointer) { - if aCameraManager_AccessPrioritiesChangedCallbackE0732DC5Func != nil { - contexte0732dc5 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - aCameraManager_AccessPrioritiesChangedCallbackE0732DC5Func(contexte0732dc5) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraManager_AccessPrioritiesChangedCallbackE0732DC5Func ACameraManager_AccessPrioritiesChangedCallback - -func (x ACameraManager_AvailabilityCallback) PassRef() (ref *C.ACameraManager_AvailabilityCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraManager_AvailabilityCallbackAAB12960Func == nil { - aCameraManager_AvailabilityCallbackAAB12960Func = x - } - return (*C.ACameraManager_AvailabilityCallback)(C.ACameraManager_AvailabilityCallback_aab12960), nil -} - -func (x ACameraManager_AvailabilityCallback) PassValue() (ref C.ACameraManager_AvailabilityCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraManager_AvailabilityCallbackAAB12960Func == nil { - aCameraManager_AvailabilityCallbackAAB12960Func = x - } - return (C.ACameraManager_AvailabilityCallback)(C.ACameraManager_AvailabilityCallback_aab12960), nil -} - -func NewACameraManager_AvailabilityCallbackRef(ref unsafe.Pointer) *ACameraManager_AvailabilityCallback { - return (*ACameraManager_AvailabilityCallback)(ref) -} - -//export ACameraManager_AvailabilityCallbackAAB12960 -func ACameraManager_AvailabilityCallbackAAB12960(ccontext unsafe.Pointer, ccameraId *C.char) { - if aCameraManager_AvailabilityCallbackAAB12960Func != nil { - contextaab12960 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - cameraIdaab12960 := C.GoString(ccameraId) - aCameraManager_AvailabilityCallbackAAB12960Func(contextaab12960, cameraIdaab12960) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraManager_AvailabilityCallbackAAB12960Func ACameraManager_AvailabilityCallback - -func (x ACameraManager_PhysicalCameraAvailabilityCallback) PassRef() (ref *C.ACameraManager_PhysicalCameraAvailabilityCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraManager_PhysicalCameraAvailabilityCallbackC6D28C7EFunc == nil { - aCameraManager_PhysicalCameraAvailabilityCallbackC6D28C7EFunc = x - } - return (*C.ACameraManager_PhysicalCameraAvailabilityCallback)(C.ACameraManager_PhysicalCameraAvailabilityCallback_c6d28c7e), nil -} - -func (x ACameraManager_PhysicalCameraAvailabilityCallback) PassValue() (ref C.ACameraManager_PhysicalCameraAvailabilityCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aCameraManager_PhysicalCameraAvailabilityCallbackC6D28C7EFunc == nil { - aCameraManager_PhysicalCameraAvailabilityCallbackC6D28C7EFunc = x - } - return (C.ACameraManager_PhysicalCameraAvailabilityCallback)(C.ACameraManager_PhysicalCameraAvailabilityCallback_c6d28c7e), nil -} - -func NewACameraManager_PhysicalCameraAvailabilityCallbackRef(ref unsafe.Pointer) *ACameraManager_PhysicalCameraAvailabilityCallback { - return (*ACameraManager_PhysicalCameraAvailabilityCallback)(ref) -} - -//export ACameraManager_PhysicalCameraAvailabilityCallbackC6D28C7E -func ACameraManager_PhysicalCameraAvailabilityCallbackC6D28C7E(ccontext unsafe.Pointer, ccameraId *C.char, cphysicalCameraId *C.char) { - if aCameraManager_PhysicalCameraAvailabilityCallbackC6D28C7EFunc != nil { - contextc6d28c7e := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - cameraIdc6d28c7e := C.GoString(ccameraId) - physicalCameraIdc6d28c7e := C.GoString(cphysicalCameraId) - aCameraManager_PhysicalCameraAvailabilityCallbackC6D28C7EFunc(contextc6d28c7e, cameraIdc6d28c7e, physicalCameraIdc6d28c7e) - return - } - panic("callback func has not been set (race?)") -} - -var aCameraManager_PhysicalCameraAvailabilityCallbackC6D28C7EFunc ACameraManager_PhysicalCameraAvailabilityCallback - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/camera/cgo_helpers.h b/capi/camera/cgo_helpers.h deleted file mode 100644 index 988ab25..0000000 --- a/capi/camera/cgo_helpers.h +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "camera/NdkCameraManager.h" -#include "camera/NdkCameraDevice.h" -#include "camera/NdkCaptureRequest.h" -#include "camera/NdkCameraCaptureSession.h" -#include "camera/NdkCameraMetadata.h" -#include "camera/NdkCameraMetadataTags.h" -#include -#pragma once - -#define __CGOGEN 1 - -// ACameraCaptureSession_captureCallback_bufferLost_f848f414 is a proxy for callback ACameraCaptureSession_captureCallback_bufferLost. -void ACameraCaptureSession_captureCallback_bufferLost_f848f414(void* context, ACameraCaptureSession* session, ACaptureRequest* request, ANativeWindow* window, int64_t frameNumber); - -// ACameraCaptureSession_captureCallback_failed_7ffeb49b is a proxy for callback ACameraCaptureSession_captureCallback_failed. -void ACameraCaptureSession_captureCallback_failed_7ffeb49b(void* context, ACameraCaptureSession* session, ACaptureRequest* request, ACameraCaptureFailure* failure); - -// ACameraCaptureSession_captureCallback_result_314ecd33 is a proxy for callback ACameraCaptureSession_captureCallback_result. -void ACameraCaptureSession_captureCallback_result_314ecd33(void* context, ACameraCaptureSession* session, ACaptureRequest* request, const ACameraMetadata* result); - -// ACameraCaptureSession_captureCallback_sequenceAbort_a6746d19 is a proxy for callback ACameraCaptureSession_captureCallback_sequenceAbort. -void ACameraCaptureSession_captureCallback_sequenceAbort_a6746d19(void* context, ACameraCaptureSession* session, int sequenceId); - -// ACameraCaptureSession_captureCallback_sequenceEnd_52945432 is a proxy for callback ACameraCaptureSession_captureCallback_sequenceEnd. -void ACameraCaptureSession_captureCallback_sequenceEnd_52945432(void* context, ACameraCaptureSession* session, int sequenceId, int64_t frameNumber); - -// ACameraCaptureSession_captureCallback_start_fd7e5afc is a proxy for callback ACameraCaptureSession_captureCallback_start. -void ACameraCaptureSession_captureCallback_start_fd7e5afc(void* context, ACameraCaptureSession* session, const ACaptureRequest* request, int64_t timestamp); - -// ACameraCaptureSession_captureCallback_startV2_26e0bf9d is a proxy for callback ACameraCaptureSession_captureCallback_startV2. -void ACameraCaptureSession_captureCallback_startV2_26e0bf9d(void* context, ACameraCaptureSession* session, const ACaptureRequest* request, int64_t timestamp, int64_t frameNumber); - -// ACameraCaptureSession_logicalCamera_captureCallback_failed_47ed36f2 is a proxy for callback ACameraCaptureSession_logicalCamera_captureCallback_failed. -void ACameraCaptureSession_logicalCamera_captureCallback_failed_47ed36f2(void* context, ACameraCaptureSession* session, ACaptureRequest* request, ALogicalCameraCaptureFailure* failure); - -// ACameraCaptureSession_logicalCamera_captureCallback_result_1bcff0f4 is a proxy for callback ACameraCaptureSession_logicalCamera_captureCallback_result. -void ACameraCaptureSession_logicalCamera_captureCallback_result_1bcff0f4(void* context, ACameraCaptureSession* session, ACaptureRequest* request, const ACameraMetadata* result, size_t physicalResultCount, const char** physicalCameraIds, const ACameraMetadata** physicalResults); - -// ACameraCaptureSession_prepareCallback_c0ef58e6 is a proxy for callback ACameraCaptureSession_prepareCallback. -void ACameraCaptureSession_prepareCallback_c0ef58e6(void* context, ANativeWindow* window, ACameraCaptureSession* session); - -// ACameraCaptureSession_stateCallback_58745d98 is a proxy for callback ACameraCaptureSession_stateCallback. -void ACameraCaptureSession_stateCallback_58745d98(void* context, ACameraCaptureSession* session); - -// ACameraDevice_ErrorStateCallback_8c471a01 is a proxy for callback ACameraDevice_ErrorStateCallback. -void ACameraDevice_ErrorStateCallback_8c471a01(void* context, ACameraDevice* device, int _error); - -// ACameraDevice_StateCallback_16aee050 is a proxy for callback ACameraDevice_StateCallback. -void ACameraDevice_StateCallback_16aee050(void* context, ACameraDevice* device); - -// ACameraManager_AccessPrioritiesChangedCallback_e0732dc5 is a proxy for callback ACameraManager_AccessPrioritiesChangedCallback. -void ACameraManager_AccessPrioritiesChangedCallback_e0732dc5(void* context); - -// ACameraManager_AvailabilityCallback_aab12960 is a proxy for callback ACameraManager_AvailabilityCallback. -void ACameraManager_AvailabilityCallback_aab12960(void* context, const char* cameraId); - -// ACameraManager_PhysicalCameraAvailabilityCallback_c6d28c7e is a proxy for callback ACameraManager_PhysicalCameraAvailabilityCallback. -void ACameraManager_PhysicalCameraAvailabilityCallback_c6d28c7e(void* context, const char* cameraId, const char* physicalCameraId); - diff --git a/capi/camera/const.go b/capi/camera/const.go deleted file mode 100644 index b17ed7a..0000000 --- a/capi/camera/const.go +++ /dev/null @@ -1,986 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package camera - -const ( - ACAMERA_TYPE_BYTE = 0 - ACAMERA_TYPE_INT32 = 1 - ACAMERA_TYPE_FLOAT = 2 - ACAMERA_TYPE_INT64 = 3 - ACAMERA_TYPE_DOUBLE = 4 - ACAMERA_TYPE_RATIONAL = 5 - ACAMERA_NUM_TYPES = 6 -) - -const ( - TEMPLATE_PREVIEW ACameraDevice_request_template = 1 - TEMPLATE_STILL_CAPTURE ACameraDevice_request_template = 2 - TEMPLATE_RECORD ACameraDevice_request_template = 3 - TEMPLATE_VIDEO_SNAPSHOT ACameraDevice_request_template = 4 - TEMPLATE_ZERO_SHUTTER_LAG ACameraDevice_request_template = 5 - TEMPLATE_MANUAL ACameraDevice_request_template = 6 -) - -const ( - CAPTURE_FAILURE_REASON_FLUSHED = 0 - CAPTURE_FAILURE_REASON_ERROR = 1 -) - -const ( - CAPTURE_SEQUENCE_ID_NONE = -1 -) - -const ( - ERROR_CAMERA_IN_USE = 1 - ERROR_MAX_CAMERAS_IN_USE = 2 - ERROR_CAMERA_DISABLED = 3 - ERROR_CAMERA_DEVICE = 4 - ERROR_CAMERA_SERVICE = 5 -) - -const ( - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER Acamera_metadata_enum_android_automotive_lens_facing_t = 0 - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT Acamera_metadata_enum_android_automotive_lens_facing_t = 1 - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR Acamera_metadata_enum_android_automotive_lens_facing_t = 2 - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT Acamera_metadata_enum_android_automotive_lens_facing_t = 3 - ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT Acamera_metadata_enum_android_automotive_lens_facing_t = 4 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER Acamera_metadata_enum_android_automotive_lens_facing_t = 5 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT Acamera_metadata_enum_android_automotive_lens_facing_t = 6 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER Acamera_metadata_enum_android_automotive_lens_facing_t = 7 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT Acamera_metadata_enum_android_automotive_lens_facing_t = 8 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT Acamera_metadata_enum_android_automotive_lens_facing_t = 9 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER Acamera_metadata_enum_android_automotive_lens_facing_t = 10 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT Acamera_metadata_enum_android_automotive_lens_facing_t = 11 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT Acamera_metadata_enum_android_automotive_lens_facing_t = 12 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER Acamera_metadata_enum_android_automotive_lens_facing_t = 13 - ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT Acamera_metadata_enum_android_automotive_lens_facing_t = 14 -) - -const ( - ACAMERA_AUTOMOTIVE_LOCATION_INTERIOR Acamera_metadata_enum_android_automotive_location_t = 0 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER Acamera_metadata_enum_android_automotive_location_t = 1 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT Acamera_metadata_enum_android_automotive_location_t = 2 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_REAR Acamera_metadata_enum_android_automotive_location_t = 3 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT Acamera_metadata_enum_android_automotive_location_t = 4 - ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT Acamera_metadata_enum_android_automotive_location_t = 5 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_OTHER Acamera_metadata_enum_android_automotive_location_t = 6 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_FRONT Acamera_metadata_enum_android_automotive_location_t = 7 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_REAR Acamera_metadata_enum_android_automotive_location_t = 8 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_LEFT Acamera_metadata_enum_android_automotive_location_t = 9 - ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_RIGHT Acamera_metadata_enum_android_automotive_location_t = 10 -) - -const ( - ACAMERA_BLACK_LEVEL_LOCK_OFF Acamera_metadata_enum_android_black_level_lock_t = 0 - ACAMERA_BLACK_LEVEL_LOCK_ON Acamera_metadata_enum_android_black_level_lock_t = 1 -) - -const ( - ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_OFF Acamera_metadata_enum_android_color_correction_aberration_mode_t = 0 - ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_FAST Acamera_metadata_enum_android_color_correction_aberration_mode_t = 1 - ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY Acamera_metadata_enum_android_color_correction_aberration_mode_t = 2 -) - -const ( - ACAMERA_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX Acamera_metadata_enum_android_color_correction_mode_t = 0 - ACAMERA_COLOR_CORRECTION_MODE_FAST Acamera_metadata_enum_android_color_correction_mode_t = 1 - ACAMERA_COLOR_CORRECTION_MODE_HIGH_QUALITY Acamera_metadata_enum_android_color_correction_mode_t = 2 -) - -const ( - ACAMERA_CONTROL_AE_ANTIBANDING_MODE_OFF Acamera_metadata_enum_android_control_ae_antibanding_mode_t = 0 - ACAMERA_CONTROL_AE_ANTIBANDING_MODE_50HZ Acamera_metadata_enum_android_control_ae_antibanding_mode_t = 1 - ACAMERA_CONTROL_AE_ANTIBANDING_MODE_60HZ Acamera_metadata_enum_android_control_ae_antibanding_mode_t = 2 - ACAMERA_CONTROL_AE_ANTIBANDING_MODE_AUTO Acamera_metadata_enum_android_control_ae_antibanding_mode_t = 3 -) - -const ( - ACAMERA_CONTROL_AE_LOCK_AVAILABLE_FALSE Acamera_metadata_enum_android_control_ae_lock_available_t = 0 - ACAMERA_CONTROL_AE_LOCK_AVAILABLE_TRUE Acamera_metadata_enum_android_control_ae_lock_available_t = 1 -) - -const ( - ACAMERA_CONTROL_AE_LOCK_OFF Acamera_metadata_enum_android_control_ae_lock_t = 0 - ACAMERA_CONTROL_AE_LOCK_ON Acamera_metadata_enum_android_control_ae_lock_t = 1 -) - -const ( - ACAMERA_CONTROL_AE_MODE_OFF Acamera_metadata_enum_android_control_ae_mode_t = 0 - ACAMERA_CONTROL_AE_MODE_ON Acamera_metadata_enum_android_control_ae_mode_t = 1 - ACAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH Acamera_metadata_enum_android_control_ae_mode_t = 2 - ACAMERA_CONTROL_AE_MODE_ON_ALWAYS_FLASH Acamera_metadata_enum_android_control_ae_mode_t = 3 - ACAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE Acamera_metadata_enum_android_control_ae_mode_t = 4 - ACAMERA_CONTROL_AE_MODE_ON_EXTERNAL_FLASH Acamera_metadata_enum_android_control_ae_mode_t = 5 - ACAMERA_CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY Acamera_metadata_enum_android_control_ae_mode_t = 6 -) - -const ( - ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE Acamera_metadata_enum_android_control_ae_precapture_trigger_t = 0 - ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_START Acamera_metadata_enum_android_control_ae_precapture_trigger_t = 1 - ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL Acamera_metadata_enum_android_control_ae_precapture_trigger_t = 2 -) - -const ( - ACAMERA_CONTROL_AE_STATE_INACTIVE Acamera_metadata_enum_android_control_ae_state_t = 0 - ACAMERA_CONTROL_AE_STATE_SEARCHING Acamera_metadata_enum_android_control_ae_state_t = 1 - ACAMERA_CONTROL_AE_STATE_CONVERGED Acamera_metadata_enum_android_control_ae_state_t = 2 - ACAMERA_CONTROL_AE_STATE_LOCKED Acamera_metadata_enum_android_control_ae_state_t = 3 - ACAMERA_CONTROL_AE_STATE_FLASH_REQUIRED Acamera_metadata_enum_android_control_ae_state_t = 4 - ACAMERA_CONTROL_AE_STATE_PRECAPTURE Acamera_metadata_enum_android_control_ae_state_t = 5 -) - -const ( - ACAMERA_CONTROL_AF_MODE_OFF Acamera_metadata_enum_android_control_af_mode_t = 0 - ACAMERA_CONTROL_AF_MODE_AUTO Acamera_metadata_enum_android_control_af_mode_t = 1 - ACAMERA_CONTROL_AF_MODE_MACRO Acamera_metadata_enum_android_control_af_mode_t = 2 - ACAMERA_CONTROL_AF_MODE_CONTINUOUS_VIDEO Acamera_metadata_enum_android_control_af_mode_t = 3 - ACAMERA_CONTROL_AF_MODE_CONTINUOUS_PICTURE Acamera_metadata_enum_android_control_af_mode_t = 4 - ACAMERA_CONTROL_AF_MODE_EDOF Acamera_metadata_enum_android_control_af_mode_t = 5 -) - -const ( - ACAMERA_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED Acamera_metadata_enum_android_control_af_scene_change_t = 0 - ACAMERA_CONTROL_AF_SCENE_CHANGE_DETECTED Acamera_metadata_enum_android_control_af_scene_change_t = 1 -) - -const ( - ACAMERA_CONTROL_AF_STATE_INACTIVE Acamera_metadata_enum_android_control_af_state_t = 0 - ACAMERA_CONTROL_AF_STATE_PASSIVE_SCAN Acamera_metadata_enum_android_control_af_state_t = 1 - ACAMERA_CONTROL_AF_STATE_PASSIVE_FOCUSED Acamera_metadata_enum_android_control_af_state_t = 2 - ACAMERA_CONTROL_AF_STATE_ACTIVE_SCAN Acamera_metadata_enum_android_control_af_state_t = 3 - ACAMERA_CONTROL_AF_STATE_FOCUSED_LOCKED Acamera_metadata_enum_android_control_af_state_t = 4 - ACAMERA_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED Acamera_metadata_enum_android_control_af_state_t = 5 - ACAMERA_CONTROL_AF_STATE_PASSIVE_UNFOCUSED Acamera_metadata_enum_android_control_af_state_t = 6 -) - -const ( - ACAMERA_CONTROL_AF_TRIGGER_IDLE Acamera_metadata_enum_android_control_af_trigger_t = 0 - ACAMERA_CONTROL_AF_TRIGGER_START Acamera_metadata_enum_android_control_af_trigger_t = 1 - ACAMERA_CONTROL_AF_TRIGGER_CANCEL Acamera_metadata_enum_android_control_af_trigger_t = 2 -) - -const ( - ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE_FALSE Acamera_metadata_enum_android_control_autoframing_available_t = 0 - ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE_TRUE Acamera_metadata_enum_android_control_autoframing_available_t = 1 -) - -const ( - ACAMERA_CONTROL_AUTOFRAMING_STATE_INACTIVE Acamera_metadata_enum_android_control_autoframing_state_t = 0 - ACAMERA_CONTROL_AUTOFRAMING_STATE_FRAMING Acamera_metadata_enum_android_control_autoframing_state_t = 1 - ACAMERA_CONTROL_AUTOFRAMING_STATE_CONVERGED Acamera_metadata_enum_android_control_autoframing_state_t = 2 -) - -const ( - ACAMERA_CONTROL_AUTOFRAMING_OFF Acamera_metadata_enum_android_control_autoframing_t = 0 - ACAMERA_CONTROL_AUTOFRAMING_ON Acamera_metadata_enum_android_control_autoframing_t = 1 -) - -const ( - ACAMERA_CONTROL_AWB_LOCK_AVAILABLE_FALSE Acamera_metadata_enum_android_control_awb_lock_available_t = 0 - ACAMERA_CONTROL_AWB_LOCK_AVAILABLE_TRUE Acamera_metadata_enum_android_control_awb_lock_available_t = 1 -) - -const ( - ACAMERA_CONTROL_AWB_LOCK_OFF Acamera_metadata_enum_android_control_awb_lock_t = 0 - ACAMERA_CONTROL_AWB_LOCK_ON Acamera_metadata_enum_android_control_awb_lock_t = 1 -) - -const ( - ACAMERA_CONTROL_AWB_MODE_OFF Acamera_metadata_enum_android_control_awb_mode_t = 0 - ACAMERA_CONTROL_AWB_MODE_AUTO Acamera_metadata_enum_android_control_awb_mode_t = 1 - ACAMERA_CONTROL_AWB_MODE_INCANDESCENT Acamera_metadata_enum_android_control_awb_mode_t = 2 - ACAMERA_CONTROL_AWB_MODE_FLUORESCENT Acamera_metadata_enum_android_control_awb_mode_t = 3 - ACAMERA_CONTROL_AWB_MODE_WARM_FLUORESCENT Acamera_metadata_enum_android_control_awb_mode_t = 4 - ACAMERA_CONTROL_AWB_MODE_DAYLIGHT Acamera_metadata_enum_android_control_awb_mode_t = 5 - ACAMERA_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT Acamera_metadata_enum_android_control_awb_mode_t = 6 - ACAMERA_CONTROL_AWB_MODE_TWILIGHT Acamera_metadata_enum_android_control_awb_mode_t = 7 - ACAMERA_CONTROL_AWB_MODE_SHADE Acamera_metadata_enum_android_control_awb_mode_t = 8 -) - -const ( - ACAMERA_CONTROL_AWB_STATE_INACTIVE Acamera_metadata_enum_android_control_awb_state_t = 0 - ACAMERA_CONTROL_AWB_STATE_SEARCHING Acamera_metadata_enum_android_control_awb_state_t = 1 - ACAMERA_CONTROL_AWB_STATE_CONVERGED Acamera_metadata_enum_android_control_awb_state_t = 2 - ACAMERA_CONTROL_AWB_STATE_LOCKED Acamera_metadata_enum_android_control_awb_state_t = 3 -) - -const ( - ACAMERA_CONTROL_CAPTURE_INTENT_CUSTOM Acamera_metadata_enum_android_control_capture_intent_t = 0 - ACAMERA_CONTROL_CAPTURE_INTENT_PREVIEW Acamera_metadata_enum_android_control_capture_intent_t = 1 - ACAMERA_CONTROL_CAPTURE_INTENT_STILL_CAPTURE Acamera_metadata_enum_android_control_capture_intent_t = 2 - ACAMERA_CONTROL_CAPTURE_INTENT_VIDEO_RECORD Acamera_metadata_enum_android_control_capture_intent_t = 3 - ACAMERA_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT Acamera_metadata_enum_android_control_capture_intent_t = 4 - ACAMERA_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG Acamera_metadata_enum_android_control_capture_intent_t = 5 - ACAMERA_CONTROL_CAPTURE_INTENT_MANUAL Acamera_metadata_enum_android_control_capture_intent_t = 6 - ACAMERA_CONTROL_CAPTURE_INTENT_MOTION_TRACKING Acamera_metadata_enum_android_control_capture_intent_t = 7 -) - -const ( - ACAMERA_CONTROL_EFFECT_MODE_OFF Acamera_metadata_enum_android_control_effect_mode_t = 0 - ACAMERA_CONTROL_EFFECT_MODE_MONO Acamera_metadata_enum_android_control_effect_mode_t = 1 - ACAMERA_CONTROL_EFFECT_MODE_NEGATIVE Acamera_metadata_enum_android_control_effect_mode_t = 2 - ACAMERA_CONTROL_EFFECT_MODE_SOLARIZE Acamera_metadata_enum_android_control_effect_mode_t = 3 - ACAMERA_CONTROL_EFFECT_MODE_SEPIA Acamera_metadata_enum_android_control_effect_mode_t = 4 - ACAMERA_CONTROL_EFFECT_MODE_POSTERIZE Acamera_metadata_enum_android_control_effect_mode_t = 5 - ACAMERA_CONTROL_EFFECT_MODE_WHITEBOARD Acamera_metadata_enum_android_control_effect_mode_t = 6 - ACAMERA_CONTROL_EFFECT_MODE_BLACKBOARD Acamera_metadata_enum_android_control_effect_mode_t = 7 - ACAMERA_CONTROL_EFFECT_MODE_AQUA Acamera_metadata_enum_android_control_effect_mode_t = 8 -) - -const ( - ACAMERA_CONTROL_ENABLE_ZSL_FALSE Acamera_metadata_enum_android_control_enable_zsl_t = 0 - ACAMERA_CONTROL_ENABLE_ZSL_TRUE Acamera_metadata_enum_android_control_enable_zsl_t = 1 -) - -const ( - ACAMERA_CONTROL_EXTENDED_SCENE_MODE_DISABLED Acamera_metadata_enum_android_control_extended_scene_mode_t = 0 - ACAMERA_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE Acamera_metadata_enum_android_control_extended_scene_mode_t = 1 - ACAMERA_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS Acamera_metadata_enum_android_control_extended_scene_mode_t = 2 -) - -const ( - ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE_INACTIVE Acamera_metadata_enum_android_control_low_light_boost_state_t = 0 - ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE Acamera_metadata_enum_android_control_low_light_boost_state_t = 1 -) - -const ( - ACAMERA_CONTROL_MODE_OFF Acamera_metadata_enum_android_control_mode_t = 0 - ACAMERA_CONTROL_MODE_AUTO Acamera_metadata_enum_android_control_mode_t = 1 - ACAMERA_CONTROL_MODE_USE_SCENE_MODE Acamera_metadata_enum_android_control_mode_t = 2 - ACAMERA_CONTROL_MODE_OFF_KEEP_STATE Acamera_metadata_enum_android_control_mode_t = 3 - ACAMERA_CONTROL_MODE_USE_EXTENDED_SCENE_MODE Acamera_metadata_enum_android_control_mode_t = 4 -) - -const ( - ACAMERA_CONTROL_SCENE_MODE_DISABLED Acamera_metadata_enum_android_control_scene_mode_t = 0 - ACAMERA_CONTROL_SCENE_MODE_FACE_PRIORITY Acamera_metadata_enum_android_control_scene_mode_t = 1 - ACAMERA_CONTROL_SCENE_MODE_ACTION Acamera_metadata_enum_android_control_scene_mode_t = 2 - ACAMERA_CONTROL_SCENE_MODE_PORTRAIT Acamera_metadata_enum_android_control_scene_mode_t = 3 - ACAMERA_CONTROL_SCENE_MODE_LANDSCAPE Acamera_metadata_enum_android_control_scene_mode_t = 4 - ACAMERA_CONTROL_SCENE_MODE_NIGHT Acamera_metadata_enum_android_control_scene_mode_t = 5 - ACAMERA_CONTROL_SCENE_MODE_NIGHT_PORTRAIT Acamera_metadata_enum_android_control_scene_mode_t = 6 - ACAMERA_CONTROL_SCENE_MODE_THEATRE Acamera_metadata_enum_android_control_scene_mode_t = 7 - ACAMERA_CONTROL_SCENE_MODE_BEACH Acamera_metadata_enum_android_control_scene_mode_t = 8 - ACAMERA_CONTROL_SCENE_MODE_SNOW Acamera_metadata_enum_android_control_scene_mode_t = 9 - ACAMERA_CONTROL_SCENE_MODE_SUNSET Acamera_metadata_enum_android_control_scene_mode_t = 10 - ACAMERA_CONTROL_SCENE_MODE_STEADYPHOTO Acamera_metadata_enum_android_control_scene_mode_t = 11 - ACAMERA_CONTROL_SCENE_MODE_FIREWORKS Acamera_metadata_enum_android_control_scene_mode_t = 12 - ACAMERA_CONTROL_SCENE_MODE_SPORTS Acamera_metadata_enum_android_control_scene_mode_t = 13 - ACAMERA_CONTROL_SCENE_MODE_PARTY Acamera_metadata_enum_android_control_scene_mode_t = 14 - ACAMERA_CONTROL_SCENE_MODE_CANDLELIGHT Acamera_metadata_enum_android_control_scene_mode_t = 15 - ACAMERA_CONTROL_SCENE_MODE_BARCODE Acamera_metadata_enum_android_control_scene_mode_t = 16 - ACAMERA_CONTROL_SCENE_MODE_HDR Acamera_metadata_enum_android_control_scene_mode_t = 18 -) - -const ( - ACAMERA_CONTROL_SETTINGS_OVERRIDE_OFF Acamera_metadata_enum_android_control_settings_override_t = 0 - ACAMERA_CONTROL_SETTINGS_OVERRIDE_ZOOM Acamera_metadata_enum_android_control_settings_override_t = 1 -) - -const ( - ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_OFF Acamera_metadata_enum_android_control_video_stabilization_mode_t = 0 - ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_ON Acamera_metadata_enum_android_control_video_stabilization_mode_t = 1 - ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION Acamera_metadata_enum_android_control_video_stabilization_mode_t = 2 -) - -const ( - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT Acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t = 0 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT Acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t = 1 -) - -const ( - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT Acamera_metadata_enum_android_depth_available_depth_stream_configurations_t = 0 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT Acamera_metadata_enum_android_depth_available_depth_stream_configurations_t = 1 -) - -const ( - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT Acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t = 0 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT Acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t = 1 -) - -const ( - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT Acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t = 0 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT Acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t = 1 -) - -const ( - ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE Acamera_metadata_enum_android_depth_depth_is_exclusive_t = 0 - ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE Acamera_metadata_enum_android_depth_depth_is_exclusive_t = 1 -) - -const ( - ACAMERA_DISTORTION_CORRECTION_MODE_OFF Acamera_metadata_enum_android_distortion_correction_mode_t = 0 - ACAMERA_DISTORTION_CORRECTION_MODE_FAST Acamera_metadata_enum_android_distortion_correction_mode_t = 1 - ACAMERA_DISTORTION_CORRECTION_MODE_HIGH_QUALITY Acamera_metadata_enum_android_distortion_correction_mode_t = 2 -) - -const ( - ACAMERA_EDGE_MODE_OFF Acamera_metadata_enum_android_edge_mode_t = 0 - ACAMERA_EDGE_MODE_FAST Acamera_metadata_enum_android_edge_mode_t = 1 - ACAMERA_EDGE_MODE_HIGH_QUALITY Acamera_metadata_enum_android_edge_mode_t = 2 - ACAMERA_EDGE_MODE_ZERO_SHUTTER_LAG Acamera_metadata_enum_android_edge_mode_t = 3 -) - -const ( - ACAMERA_FLASH_INFO_AVAILABLE_FALSE Acamera_metadata_enum_android_flash_info_available_t = 0 - ACAMERA_FLASH_INFO_AVAILABLE_TRUE Acamera_metadata_enum_android_flash_info_available_t = 1 -) - -const ( - ACAMERA_FLASH_MODE_OFF Acamera_metadata_enum_android_flash_mode_t = 0 - ACAMERA_FLASH_MODE_SINGLE Acamera_metadata_enum_android_flash_mode_t = 1 - ACAMERA_FLASH_MODE_TORCH Acamera_metadata_enum_android_flash_mode_t = 2 -) - -const ( - ACAMERA_FLASH_STATE_UNAVAILABLE Acamera_metadata_enum_android_flash_state_t = 0 - ACAMERA_FLASH_STATE_CHARGING Acamera_metadata_enum_android_flash_state_t = 1 - ACAMERA_FLASH_STATE_READY Acamera_metadata_enum_android_flash_state_t = 2 - ACAMERA_FLASH_STATE_FIRED Acamera_metadata_enum_android_flash_state_t = 3 - ACAMERA_FLASH_STATE_PARTIAL Acamera_metadata_enum_android_flash_state_t = 4 -) - -const ( - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT Acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t = 0 - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT Acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t = 1 -) - -const ( - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT Acamera_metadata_enum_android_heic_available_heic_stream_configurations_t = 0 - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT Acamera_metadata_enum_android_heic_available_heic_stream_configurations_t = 1 -) - -const ( - ACAMERA_HOT_PIXEL_MODE_OFF Acamera_metadata_enum_android_hot_pixel_mode_t = 0 - ACAMERA_HOT_PIXEL_MODE_FAST Acamera_metadata_enum_android_hot_pixel_mode_t = 1 - ACAMERA_HOT_PIXEL_MODE_HIGH_QUALITY Acamera_metadata_enum_android_hot_pixel_mode_t = 2 -) - -const ( - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED Acamera_metadata_enum_android_info_supported_hardware_level_t = 0 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL Acamera_metadata_enum_android_info_supported_hardware_level_t = 1 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY Acamera_metadata_enum_android_info_supported_hardware_level_t = 2 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_3 Acamera_metadata_enum_android_info_supported_hardware_level_t = 3 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL Acamera_metadata_enum_android_info_supported_hardware_level_t = 4 -) - -const ( - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT Acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t = 0 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT Acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t = 1 -) - -const ( - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT Acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t = 0 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT Acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t = 1 -) - -const ( - ACAMERA_LENS_FACING_FRONT Acamera_metadata_enum_android_lens_facing_t = 0 - ACAMERA_LENS_FACING_BACK Acamera_metadata_enum_android_lens_facing_t = 1 - ACAMERA_LENS_FACING_EXTERNAL Acamera_metadata_enum_android_lens_facing_t = 2 -) - -const ( - ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED Acamera_metadata_enum_android_lens_info_focus_distance_calibration_t = 0 - ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE Acamera_metadata_enum_android_lens_info_focus_distance_calibration_t = 1 - ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED Acamera_metadata_enum_android_lens_info_focus_distance_calibration_t = 2 -) - -const ( - ACAMERA_LENS_OPTICAL_STABILIZATION_MODE_OFF Acamera_metadata_enum_android_lens_optical_stabilization_mode_t = 0 - ACAMERA_LENS_OPTICAL_STABILIZATION_MODE_ON Acamera_metadata_enum_android_lens_optical_stabilization_mode_t = 1 -) - -const ( - ACAMERA_LENS_POSE_REFERENCE_PRIMARY_CAMERA Acamera_metadata_enum_android_lens_pose_reference_t = 0 - ACAMERA_LENS_POSE_REFERENCE_GYROSCOPE Acamera_metadata_enum_android_lens_pose_reference_t = 1 - ACAMERA_LENS_POSE_REFERENCE_UNDEFINED Acamera_metadata_enum_android_lens_pose_reference_t = 2 - ACAMERA_LENS_POSE_REFERENCE_AUTOMOTIVE Acamera_metadata_enum_android_lens_pose_reference_t = 3 -) - -const ( - ACAMERA_LENS_STATE_STATIONARY Acamera_metadata_enum_android_lens_state_t = 0 - ACAMERA_LENS_STATE_MOVING Acamera_metadata_enum_android_lens_state_t = 1 -) - -const ( - ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE Acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t = 0 - ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED Acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t = 1 -) - -const ( - ACAMERA_NOISE_REDUCTION_MODE_OFF Acamera_metadata_enum_android_noise_reduction_mode_t = 0 - ACAMERA_NOISE_REDUCTION_MODE_FAST Acamera_metadata_enum_android_noise_reduction_mode_t = 1 - ACAMERA_NOISE_REDUCTION_MODE_HIGH_QUALITY Acamera_metadata_enum_android_noise_reduction_mode_t = 2 - ACAMERA_NOISE_REDUCTION_MODE_MINIMAL Acamera_metadata_enum_android_noise_reduction_mode_t = 3 - ACAMERA_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG Acamera_metadata_enum_android_noise_reduction_mode_t = 4 -) - -const ( - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE Acamera_metadata_enum_android_request_available_capabilities_t = 0 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR Acamera_metadata_enum_android_request_available_capabilities_t = 1 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING Acamera_metadata_enum_android_request_available_capabilities_t = 2 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW Acamera_metadata_enum_android_request_available_capabilities_t = 3 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS Acamera_metadata_enum_android_request_available_capabilities_t = 5 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE Acamera_metadata_enum_android_request_available_capabilities_t = 6 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT Acamera_metadata_enum_android_request_available_capabilities_t = 8 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING Acamera_metadata_enum_android_request_available_capabilities_t = 10 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA Acamera_metadata_enum_android_request_available_capabilities_t = 11 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME Acamera_metadata_enum_android_request_available_capabilities_t = 12 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA Acamera_metadata_enum_android_request_available_capabilities_t = 13 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA Acamera_metadata_enum_android_request_available_capabilities_t = 14 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR Acamera_metadata_enum_android_request_available_capabilities_t = 16 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE Acamera_metadata_enum_android_request_available_capabilities_t = 19 -) - -const ( - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED Acamera_metadata_enum_android_request_available_color_space_profiles_map_t = -1 - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB Acamera_metadata_enum_android_request_available_color_space_profiles_map_t = 0 - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 Acamera_metadata_enum_android_request_available_color_space_profiles_map_t = 7 - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020_HLG Acamera_metadata_enum_android_request_available_color_space_profiles_map_t = 16 -) - -const ( - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 1 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 2 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 4 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 8 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 16 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 32 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 64 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 128 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 256 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 512 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 1024 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 2048 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t = 4096 -) - -const ( - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 0 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 1 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 2 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 3 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 4 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 5 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 6 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 7 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 8 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END_3_8 Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 9 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t = 24 -) - -const ( - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT Acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t = 0 - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT Acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t = 1 -) - -const ( - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT Acamera_metadata_enum_android_scaler_available_stream_configurations_t = 0 - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT Acamera_metadata_enum_android_scaler_available_stream_configurations_t = 1 -) - -const ( - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT Acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 0 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW Acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 1 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE Acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 2 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD Acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 3 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL Acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 4 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL Acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 5 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW Acamera_metadata_enum_android_scaler_available_stream_use_cases_t = 6 -) - -const ( - ACAMERA_SCALER_CROPPING_TYPE_CENTER_ONLY Acamera_metadata_enum_android_scaler_cropping_type_t = 0 - ACAMERA_SCALER_CROPPING_TYPE_FREEFORM Acamera_metadata_enum_android_scaler_cropping_type_t = 1 -) - -const ( - ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE Acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t = 0 - ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE Acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t = 1 -) - -const ( - ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT Acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t = 0 - ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT Acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t = 1 -) - -const ( - ACAMERA_SCALER_ROTATE_AND_CROP_NONE Acamera_metadata_enum_android_scaler_rotate_and_crop_t = 0 - ACAMERA_SCALER_ROTATE_AND_CROP_90 Acamera_metadata_enum_android_scaler_rotate_and_crop_t = 1 - ACAMERA_SCALER_ROTATE_AND_CROP_180 Acamera_metadata_enum_android_scaler_rotate_and_crop_t = 2 - ACAMERA_SCALER_ROTATE_AND_CROP_270 Acamera_metadata_enum_android_scaler_rotate_and_crop_t = 3 - ACAMERA_SCALER_ROTATE_AND_CROP_AUTO Acamera_metadata_enum_android_scaler_rotate_and_crop_t = 4 -) - -const ( - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB Acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 0 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG Acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 1 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG Acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 2 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR Acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 3 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB Acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 4 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO Acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 5 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR Acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t = 6 -) - -const ( - ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE Acamera_metadata_enum_android_sensor_info_lens_shading_applied_t = 0 - ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE Acamera_metadata_enum_android_sensor_info_lens_shading_applied_t = 1 -) - -const ( - ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN Acamera_metadata_enum_android_sensor_info_timestamp_source_t = 0 - ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME Acamera_metadata_enum_android_sensor_info_timestamp_source_t = 1 -) - -const ( - ACAMERA_SENSOR_PIXEL_MODE_DEFAULT Acamera_metadata_enum_android_sensor_pixel_mode_t = 0 - ACAMERA_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION Acamera_metadata_enum_android_sensor_pixel_mode_t = 1 -) - -const ( - ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED_TRUE Acamera_metadata_enum_android_sensor_raw_binning_factor_used_t = 0 - ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED_FALSE Acamera_metadata_enum_android_sensor_raw_binning_factor_used_t = 1 -) - -const ( - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 1 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 2 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 3 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FLASH Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 4 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 9 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 10 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_SHADE Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 11 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 12 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 13 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 14 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 15 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 17 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 18 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 19 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D55 Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 20 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D65 Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 21 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D75 Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 22 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D50 Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 23 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN Acamera_metadata_enum_android_sensor_reference_illuminant1_t = 24 -) - -const ( - ACAMERA_SENSOR_TEST_PATTERN_MODE_OFF Acamera_metadata_enum_android_sensor_test_pattern_mode_t = 0 - ACAMERA_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR Acamera_metadata_enum_android_sensor_test_pattern_mode_t = 1 - ACAMERA_SENSOR_TEST_PATTERN_MODE_COLOR_BARS Acamera_metadata_enum_android_sensor_test_pattern_mode_t = 2 - ACAMERA_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY Acamera_metadata_enum_android_sensor_test_pattern_mode_t = 3 - ACAMERA_SENSOR_TEST_PATTERN_MODE_PN9 Acamera_metadata_enum_android_sensor_test_pattern_mode_t = 4 - ACAMERA_SENSOR_TEST_PATTERN_MODE_CUSTOM1 Acamera_metadata_enum_android_sensor_test_pattern_mode_t = 256 -) - -const ( - ACAMERA_SHADING_MODE_OFF Acamera_metadata_enum_android_shading_mode_t = 0 - ACAMERA_SHADING_MODE_FAST Acamera_metadata_enum_android_shading_mode_t = 1 - ACAMERA_SHADING_MODE_HIGH_QUALITY Acamera_metadata_enum_android_shading_mode_t = 2 -) - -const ( - ACAMERA_STATISTICS_FACE_DETECT_MODE_OFF Acamera_metadata_enum_android_statistics_face_detect_mode_t = 0 - ACAMERA_STATISTICS_FACE_DETECT_MODE_SIMPLE Acamera_metadata_enum_android_statistics_face_detect_mode_t = 1 - ACAMERA_STATISTICS_FACE_DETECT_MODE_FULL Acamera_metadata_enum_android_statistics_face_detect_mode_t = 2 -) - -const ( - ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE_OFF Acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t = 0 - ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE_ON Acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t = 1 -) - -const ( - ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE_OFF Acamera_metadata_enum_android_statistics_lens_shading_map_mode_t = 0 - ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE_ON Acamera_metadata_enum_android_statistics_lens_shading_map_mode_t = 1 -) - -const ( - ACAMERA_STATISTICS_OIS_DATA_MODE_OFF Acamera_metadata_enum_android_statistics_ois_data_mode_t = 0 - ACAMERA_STATISTICS_OIS_DATA_MODE_ON Acamera_metadata_enum_android_statistics_ois_data_mode_t = 1 -) - -const ( - ACAMERA_STATISTICS_SCENE_FLICKER_NONE Acamera_metadata_enum_android_statistics_scene_flicker_t = 0 - ACAMERA_STATISTICS_SCENE_FLICKER_50HZ Acamera_metadata_enum_android_statistics_scene_flicker_t = 1 - ACAMERA_STATISTICS_SCENE_FLICKER_60HZ Acamera_metadata_enum_android_statistics_scene_flicker_t = 2 -) - -const ( - ACAMERA_SYNC_FRAME_NUMBER_CONVERGING Acamera_metadata_enum_android_sync_frame_number_t = -1 - ACAMERA_SYNC_FRAME_NUMBER_UNKNOWN Acamera_metadata_enum_android_sync_frame_number_t = -2 -) - -const ( - ACAMERA_SYNC_MAX_LATENCY_PER_FRAME_CONTROL Acamera_metadata_enum_android_sync_max_latency_t = 0 - ACAMERA_SYNC_MAX_LATENCY_UNKNOWN Acamera_metadata_enum_android_sync_max_latency_t = -1 -) - -const ( - ACAMERA_TONEMAP_MODE_CONTRAST_CURVE Acamera_metadata_enum_android_tonemap_mode_t = 0 - ACAMERA_TONEMAP_MODE_FAST Acamera_metadata_enum_android_tonemap_mode_t = 1 - ACAMERA_TONEMAP_MODE_HIGH_QUALITY Acamera_metadata_enum_android_tonemap_mode_t = 2 - ACAMERA_TONEMAP_MODE_GAMMA_VALUE Acamera_metadata_enum_android_tonemap_mode_t = 3 - ACAMERA_TONEMAP_MODE_PRESET_CURVE Acamera_metadata_enum_android_tonemap_mode_t = 4 -) - -const ( - ACAMERA_TONEMAP_PRESET_CURVE_SRGB Acamera_metadata_enum_android_tonemap_preset_curve_t = 0 - ACAMERA_TONEMAP_PRESET_CURVE_REC709 Acamera_metadata_enum_android_tonemap_preset_curve_t = 1 -) - -const ( - ACAMERA_COLOR_CORRECTION_START Acamera_metadata_section_start_t = 0 - ACAMERA_CONTROL_START Acamera_metadata_section_start_t = 65536 - ACAMERA_DEMOSAIC_START Acamera_metadata_section_start_t = 131072 - ACAMERA_EDGE_START Acamera_metadata_section_start_t = 196608 - ACAMERA_FLASH_START Acamera_metadata_section_start_t = 262144 - ACAMERA_FLASH_INFO_START Acamera_metadata_section_start_t = 327680 - ACAMERA_HOT_PIXEL_START Acamera_metadata_section_start_t = 393216 - ACAMERA_JPEG_START Acamera_metadata_section_start_t = 458752 - ACAMERA_LENS_START Acamera_metadata_section_start_t = 524288 - ACAMERA_LENS_INFO_START Acamera_metadata_section_start_t = 589824 - ACAMERA_NOISE_REDUCTION_START Acamera_metadata_section_start_t = 655360 - ACAMERA_QUIRKS_START Acamera_metadata_section_start_t = 720896 - ACAMERA_REQUEST_START Acamera_metadata_section_start_t = 786432 - ACAMERA_SCALER_START Acamera_metadata_section_start_t = 851968 - ACAMERA_SENSOR_START Acamera_metadata_section_start_t = 917504 - ACAMERA_SENSOR_INFO_START Acamera_metadata_section_start_t = 983040 - ACAMERA_SHADING_START Acamera_metadata_section_start_t = 1048576 - ACAMERA_STATISTICS_START Acamera_metadata_section_start_t = 1114112 - ACAMERA_STATISTICS_INFO_START Acamera_metadata_section_start_t = 1179648 - ACAMERA_TONEMAP_START Acamera_metadata_section_start_t = 1245184 - ACAMERA_LED_START Acamera_metadata_section_start_t = 1310720 - ACAMERA_INFO_START Acamera_metadata_section_start_t = 1376256 - ACAMERA_BLACK_LEVEL_START Acamera_metadata_section_start_t = 1441792 - ACAMERA_SYNC_START Acamera_metadata_section_start_t = 1507328 - ACAMERA_REPROCESS_START Acamera_metadata_section_start_t = 1572864 - ACAMERA_DEPTH_START Acamera_metadata_section_start_t = 1638400 - ACAMERA_LOGICAL_MULTI_CAMERA_START Acamera_metadata_section_start_t = 1703936 - ACAMERA_DISTORTION_CORRECTION_START Acamera_metadata_section_start_t = 1769472 - ACAMERA_HEIC_START Acamera_metadata_section_start_t = 1835008 - ACAMERA_HEIC_INFO_START Acamera_metadata_section_start_t = 1900544 - ACAMERA_AUTOMOTIVE_START Acamera_metadata_section_start_t = 1966080 - ACAMERA_AUTOMOTIVE_LENS_START Acamera_metadata_section_start_t = 2031616 - ACAMERA_EXTENSION_START Acamera_metadata_section_start_t = 2097152 - ACAMERA_JPEGR_START Acamera_metadata_section_start_t = 2162688 - ACAMERA_VENDOR_START Acamera_metadata_section_start_t = -2147483648 -) - -const ( - ACAMERA_COLOR_CORRECTION Acamera_metadata_section_t = 0 - ACAMERA_CONTROL Acamera_metadata_section_t = 1 - ACAMERA_DEMOSAIC Acamera_metadata_section_t = 2 - ACAMERA_EDGE Acamera_metadata_section_t = 3 - ACAMERA_FLASH Acamera_metadata_section_t = 4 - ACAMERA_FLASH_INFO Acamera_metadata_section_t = 5 - ACAMERA_HOT_PIXEL Acamera_metadata_section_t = 6 - ACAMERA_JPEG Acamera_metadata_section_t = 7 - ACAMERA_LENS Acamera_metadata_section_t = 8 - ACAMERA_LENS_INFO Acamera_metadata_section_t = 9 - ACAMERA_NOISE_REDUCTION Acamera_metadata_section_t = 10 - ACAMERA_QUIRKS Acamera_metadata_section_t = 11 - ACAMERA_REQUEST Acamera_metadata_section_t = 12 - ACAMERA_SCALER Acamera_metadata_section_t = 13 - ACAMERA_SENSOR Acamera_metadata_section_t = 14 - ACAMERA_SENSOR_INFO Acamera_metadata_section_t = 15 - ACAMERA_SHADING Acamera_metadata_section_t = 16 - ACAMERA_STATISTICS Acamera_metadata_section_t = 17 - ACAMERA_STATISTICS_INFO Acamera_metadata_section_t = 18 - ACAMERA_TONEMAP Acamera_metadata_section_t = 19 - ACAMERA_LED Acamera_metadata_section_t = 20 - ACAMERA_INFO Acamera_metadata_section_t = 21 - ACAMERA_BLACK_LEVEL Acamera_metadata_section_t = 22 - ACAMERA_SYNC Acamera_metadata_section_t = 23 - ACAMERA_REPROCESS Acamera_metadata_section_t = 24 - ACAMERA_DEPTH Acamera_metadata_section_t = 25 - ACAMERA_LOGICAL_MULTI_CAMERA Acamera_metadata_section_t = 26 - ACAMERA_DISTORTION_CORRECTION Acamera_metadata_section_t = 27 - ACAMERA_HEIC Acamera_metadata_section_t = 28 - ACAMERA_HEIC_INFO Acamera_metadata_section_t = 29 - ACAMERA_AUTOMOTIVE Acamera_metadata_section_t = 30 - ACAMERA_AUTOMOTIVE_LENS Acamera_metadata_section_t = 31 - ACAMERA_EXTENSION Acamera_metadata_section_t = 32 - ACAMERA_JPEGR Acamera_metadata_section_t = 33 - ACAMERA_SECTION_COUNT Acamera_metadata_section_t = 34 - ACAMERA_VENDOR Acamera_metadata_section_t = 32768 -) - -const ( - ACAMERA_COLOR_CORRECTION_MODE Acamera_metadata_tag_t = 0 - ACAMERA_COLOR_CORRECTION_TRANSFORM Acamera_metadata_tag_t = 1 - ACAMERA_COLOR_CORRECTION_GAINS Acamera_metadata_tag_t = 2 - ACAMERA_COLOR_CORRECTION_ABERRATION_MODE Acamera_metadata_tag_t = 3 - ACAMERA_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES Acamera_metadata_tag_t = 4 - ACAMERA_COLOR_CORRECTION_END Acamera_metadata_tag_t = 5 - ACAMERA_CONTROL_AE_ANTIBANDING_MODE Acamera_metadata_tag_t = 65536 - ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION Acamera_metadata_tag_t = 65537 - ACAMERA_CONTROL_AE_LOCK Acamera_metadata_tag_t = 65538 - ACAMERA_CONTROL_AE_MODE Acamera_metadata_tag_t = 65539 - ACAMERA_CONTROL_AE_REGIONS Acamera_metadata_tag_t = 65540 - ACAMERA_CONTROL_AE_TARGET_FPS_RANGE Acamera_metadata_tag_t = 65541 - ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER Acamera_metadata_tag_t = 65542 - ACAMERA_CONTROL_AF_MODE Acamera_metadata_tag_t = 65543 - ACAMERA_CONTROL_AF_REGIONS Acamera_metadata_tag_t = 65544 - ACAMERA_CONTROL_AF_TRIGGER Acamera_metadata_tag_t = 65545 - ACAMERA_CONTROL_AWB_LOCK Acamera_metadata_tag_t = 65546 - ACAMERA_CONTROL_AWB_MODE Acamera_metadata_tag_t = 65547 - ACAMERA_CONTROL_AWB_REGIONS Acamera_metadata_tag_t = 65548 - ACAMERA_CONTROL_CAPTURE_INTENT Acamera_metadata_tag_t = 65549 - ACAMERA_CONTROL_EFFECT_MODE Acamera_metadata_tag_t = 65550 - ACAMERA_CONTROL_MODE Acamera_metadata_tag_t = 65551 - ACAMERA_CONTROL_SCENE_MODE Acamera_metadata_tag_t = 65552 - ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE Acamera_metadata_tag_t = 65553 - ACAMERA_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES Acamera_metadata_tag_t = 65554 - ACAMERA_CONTROL_AE_AVAILABLE_MODES Acamera_metadata_tag_t = 65555 - ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES Acamera_metadata_tag_t = 65556 - ACAMERA_CONTROL_AE_COMPENSATION_RANGE Acamera_metadata_tag_t = 65557 - ACAMERA_CONTROL_AE_COMPENSATION_STEP Acamera_metadata_tag_t = 65558 - ACAMERA_CONTROL_AF_AVAILABLE_MODES Acamera_metadata_tag_t = 65559 - ACAMERA_CONTROL_AVAILABLE_EFFECTS Acamera_metadata_tag_t = 65560 - ACAMERA_CONTROL_AVAILABLE_SCENE_MODES Acamera_metadata_tag_t = 65561 - ACAMERA_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES Acamera_metadata_tag_t = 65562 - ACAMERA_CONTROL_AWB_AVAILABLE_MODES Acamera_metadata_tag_t = 65563 - ACAMERA_CONTROL_MAX_REGIONS Acamera_metadata_tag_t = 65564 - ACAMERA_CONTROL_AE_STATE Acamera_metadata_tag_t = 65567 - ACAMERA_CONTROL_AF_STATE Acamera_metadata_tag_t = 65568 - ACAMERA_CONTROL_AWB_STATE Acamera_metadata_tag_t = 65570 - ACAMERA_CONTROL_AE_LOCK_AVAILABLE Acamera_metadata_tag_t = 65572 - ACAMERA_CONTROL_AWB_LOCK_AVAILABLE Acamera_metadata_tag_t = 65573 - ACAMERA_CONTROL_AVAILABLE_MODES Acamera_metadata_tag_t = 65574 - ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE Acamera_metadata_tag_t = 65575 - ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST Acamera_metadata_tag_t = 65576 - ACAMERA_CONTROL_ENABLE_ZSL Acamera_metadata_tag_t = 65577 - ACAMERA_CONTROL_AF_SCENE_CHANGE Acamera_metadata_tag_t = 65578 - ACAMERA_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES Acamera_metadata_tag_t = 65579 - ACAMERA_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES Acamera_metadata_tag_t = 65580 - ACAMERA_CONTROL_EXTENDED_SCENE_MODE Acamera_metadata_tag_t = 65581 - ACAMERA_CONTROL_ZOOM_RATIO_RANGE Acamera_metadata_tag_t = 65582 - ACAMERA_CONTROL_ZOOM_RATIO Acamera_metadata_tag_t = 65583 - ACAMERA_CONTROL_SETTINGS_OVERRIDE Acamera_metadata_tag_t = 65588 - ACAMERA_CONTROL_AVAILABLE_SETTINGS_OVERRIDES Acamera_metadata_tag_t = 65589 - ACAMERA_CONTROL_AUTOFRAMING Acamera_metadata_tag_t = 65591 - ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE Acamera_metadata_tag_t = 65592 - ACAMERA_CONTROL_AUTOFRAMING_STATE Acamera_metadata_tag_t = 65593 - ACAMERA_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE Acamera_metadata_tag_t = 65594 - ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE Acamera_metadata_tag_t = 65595 - ACAMERA_CONTROL_END Acamera_metadata_tag_t = 65596 - ACAMERA_EDGE_MODE Acamera_metadata_tag_t = 196608 - ACAMERA_EDGE_AVAILABLE_EDGE_MODES Acamera_metadata_tag_t = 196610 - ACAMERA_EDGE_END Acamera_metadata_tag_t = 196611 - ACAMERA_FLASH_MODE Acamera_metadata_tag_t = 262146 - ACAMERA_FLASH_STATE Acamera_metadata_tag_t = 262149 - ACAMERA_FLASH_STRENGTH_LEVEL Acamera_metadata_tag_t = 262150 - ACAMERA_FLASH_SINGLE_STRENGTH_MAX_LEVEL Acamera_metadata_tag_t = 262151 - ACAMERA_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL Acamera_metadata_tag_t = 262152 - ACAMERA_FLASH_TORCH_STRENGTH_MAX_LEVEL Acamera_metadata_tag_t = 262153 - ACAMERA_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL Acamera_metadata_tag_t = 262154 - ACAMERA_FLASH_END Acamera_metadata_tag_t = 262155 - ACAMERA_FLASH_INFO_AVAILABLE Acamera_metadata_tag_t = 327680 - ACAMERA_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL Acamera_metadata_tag_t = 327682 - ACAMERA_FLASH_INFO_STRENGTH_DEFAULT_LEVEL Acamera_metadata_tag_t = 327683 - ACAMERA_FLASH_INFO_END Acamera_metadata_tag_t = 327684 - ACAMERA_HOT_PIXEL_MODE Acamera_metadata_tag_t = 393216 - ACAMERA_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES Acamera_metadata_tag_t = 393217 - ACAMERA_HOT_PIXEL_END Acamera_metadata_tag_t = 393218 - ACAMERA_JPEG_GPS_COORDINATES Acamera_metadata_tag_t = 458752 - ACAMERA_JPEG_GPS_PROCESSING_METHOD Acamera_metadata_tag_t = 458753 - ACAMERA_JPEG_GPS_TIMESTAMP Acamera_metadata_tag_t = 458754 - ACAMERA_JPEG_ORIENTATION Acamera_metadata_tag_t = 458755 - ACAMERA_JPEG_QUALITY Acamera_metadata_tag_t = 458756 - ACAMERA_JPEG_THUMBNAIL_QUALITY Acamera_metadata_tag_t = 458757 - ACAMERA_JPEG_THUMBNAIL_SIZE Acamera_metadata_tag_t = 458758 - ACAMERA_JPEG_AVAILABLE_THUMBNAIL_SIZES Acamera_metadata_tag_t = 458759 - ACAMERA_JPEG_END Acamera_metadata_tag_t = 458760 - ACAMERA_LENS_APERTURE Acamera_metadata_tag_t = 524288 - ACAMERA_LENS_FILTER_DENSITY Acamera_metadata_tag_t = 524289 - ACAMERA_LENS_FOCAL_LENGTH Acamera_metadata_tag_t = 524290 - ACAMERA_LENS_FOCUS_DISTANCE Acamera_metadata_tag_t = 524291 - ACAMERA_LENS_OPTICAL_STABILIZATION_MODE Acamera_metadata_tag_t = 524292 - ACAMERA_LENS_FACING Acamera_metadata_tag_t = 524293 - ACAMERA_LENS_POSE_ROTATION Acamera_metadata_tag_t = 524294 - ACAMERA_LENS_POSE_TRANSLATION Acamera_metadata_tag_t = 524295 - ACAMERA_LENS_FOCUS_RANGE Acamera_metadata_tag_t = 524296 - ACAMERA_LENS_STATE Acamera_metadata_tag_t = 524297 - ACAMERA_LENS_INTRINSIC_CALIBRATION Acamera_metadata_tag_t = 524298 - ACAMERA_LENS_RADIAL_DISTORTION Acamera_metadata_tag_t = 524299 - ACAMERA_LENS_POSE_REFERENCE Acamera_metadata_tag_t = 524300 - ACAMERA_LENS_DISTORTION Acamera_metadata_tag_t = 524301 - ACAMERA_LENS_DISTORTION_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 524302 - ACAMERA_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 524303 - ACAMERA_LENS_END Acamera_metadata_tag_t = 524304 - ACAMERA_LENS_INFO_AVAILABLE_APERTURES Acamera_metadata_tag_t = 589824 - ACAMERA_LENS_INFO_AVAILABLE_FILTER_DENSITIES Acamera_metadata_tag_t = 589825 - ACAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS Acamera_metadata_tag_t = 589826 - ACAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION Acamera_metadata_tag_t = 589827 - ACAMERA_LENS_INFO_HYPERFOCAL_DISTANCE Acamera_metadata_tag_t = 589828 - ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE Acamera_metadata_tag_t = 589829 - ACAMERA_LENS_INFO_SHADING_MAP_SIZE Acamera_metadata_tag_t = 589830 - ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION Acamera_metadata_tag_t = 589831 - ACAMERA_LENS_INFO_END Acamera_metadata_tag_t = 589832 - ACAMERA_NOISE_REDUCTION_MODE Acamera_metadata_tag_t = 655360 - ACAMERA_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES Acamera_metadata_tag_t = 655362 - ACAMERA_NOISE_REDUCTION_END Acamera_metadata_tag_t = 655363 - ACAMERA_REQUEST_MAX_NUM_OUTPUT_STREAMS Acamera_metadata_tag_t = 786438 - ACAMERA_REQUEST_PIPELINE_DEPTH Acamera_metadata_tag_t = 786441 - ACAMERA_REQUEST_PIPELINE_MAX_DEPTH Acamera_metadata_tag_t = 786442 - ACAMERA_REQUEST_PARTIAL_RESULT_COUNT Acamera_metadata_tag_t = 786443 - ACAMERA_REQUEST_AVAILABLE_CAPABILITIES Acamera_metadata_tag_t = 786444 - ACAMERA_REQUEST_AVAILABLE_REQUEST_KEYS Acamera_metadata_tag_t = 786445 - ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS Acamera_metadata_tag_t = 786446 - ACAMERA_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS Acamera_metadata_tag_t = 786447 - ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS Acamera_metadata_tag_t = 786448 - ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS Acamera_metadata_tag_t = 786449 - ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP Acamera_metadata_tag_t = 786451 - ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP Acamera_metadata_tag_t = 786453 - ACAMERA_REQUEST_END Acamera_metadata_tag_t = 786454 - ACAMERA_SCALER_CROP_REGION Acamera_metadata_tag_t = 851968 - ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM Acamera_metadata_tag_t = 851972 - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS Acamera_metadata_tag_t = 851978 - ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS Acamera_metadata_tag_t = 851979 - ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS Acamera_metadata_tag_t = 851980 - ACAMERA_SCALER_CROPPING_TYPE Acamera_metadata_tag_t = 851981 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS Acamera_metadata_tag_t = 851982 - ACAMERA_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP Acamera_metadata_tag_t = 851983 - ACAMERA_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES Acamera_metadata_tag_t = 851984 - ACAMERA_SCALER_ROTATE_AND_CROP Acamera_metadata_tag_t = 851985 - ACAMERA_SCALER_DEFAULT_SECURE_IMAGE_SIZE Acamera_metadata_tag_t = 851986 - ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS Acamera_metadata_tag_t = 851987 - ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 851988 - ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 851989 - ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 851990 - ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED Acamera_metadata_tag_t = 851992 - ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES Acamera_metadata_tag_t = 851994 - ACAMERA_SCALER_RAW_CROP_REGION Acamera_metadata_tag_t = 851995 - ACAMERA_SCALER_END Acamera_metadata_tag_t = 851996 - ACAMERA_SENSOR_EXPOSURE_TIME Acamera_metadata_tag_t = 917504 - ACAMERA_SENSOR_FRAME_DURATION Acamera_metadata_tag_t = 917505 - ACAMERA_SENSOR_SENSITIVITY Acamera_metadata_tag_t = 917506 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 Acamera_metadata_tag_t = 917507 - ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 Acamera_metadata_tag_t = 917508 - ACAMERA_SENSOR_CALIBRATION_TRANSFORM1 Acamera_metadata_tag_t = 917509 - ACAMERA_SENSOR_CALIBRATION_TRANSFORM2 Acamera_metadata_tag_t = 917510 - ACAMERA_SENSOR_COLOR_TRANSFORM1 Acamera_metadata_tag_t = 917511 - ACAMERA_SENSOR_COLOR_TRANSFORM2 Acamera_metadata_tag_t = 917512 - ACAMERA_SENSOR_FORWARD_MATRIX1 Acamera_metadata_tag_t = 917513 - ACAMERA_SENSOR_FORWARD_MATRIX2 Acamera_metadata_tag_t = 917514 - ACAMERA_SENSOR_BLACK_LEVEL_PATTERN Acamera_metadata_tag_t = 917516 - ACAMERA_SENSOR_MAX_ANALOG_SENSITIVITY Acamera_metadata_tag_t = 917517 - ACAMERA_SENSOR_ORIENTATION Acamera_metadata_tag_t = 917518 - ACAMERA_SENSOR_TIMESTAMP Acamera_metadata_tag_t = 917520 - ACAMERA_SENSOR_NEUTRAL_COLOR_POINT Acamera_metadata_tag_t = 917522 - ACAMERA_SENSOR_NOISE_PROFILE Acamera_metadata_tag_t = 917523 - ACAMERA_SENSOR_GREEN_SPLIT Acamera_metadata_tag_t = 917526 - ACAMERA_SENSOR_TEST_PATTERN_DATA Acamera_metadata_tag_t = 917527 - ACAMERA_SENSOR_TEST_PATTERN_MODE Acamera_metadata_tag_t = 917528 - ACAMERA_SENSOR_AVAILABLE_TEST_PATTERN_MODES Acamera_metadata_tag_t = 917529 - ACAMERA_SENSOR_ROLLING_SHUTTER_SKEW Acamera_metadata_tag_t = 917530 - ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS Acamera_metadata_tag_t = 917531 - ACAMERA_SENSOR_DYNAMIC_BLACK_LEVEL Acamera_metadata_tag_t = 917532 - ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL Acamera_metadata_tag_t = 917533 - ACAMERA_SENSOR_PIXEL_MODE Acamera_metadata_tag_t = 917536 - ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED Acamera_metadata_tag_t = 917537 - ACAMERA_SENSOR_END Acamera_metadata_tag_t = 917538 - ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE Acamera_metadata_tag_t = 983040 - ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE Acamera_metadata_tag_t = 983041 - ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT Acamera_metadata_tag_t = 983042 - ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE Acamera_metadata_tag_t = 983043 - ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION Acamera_metadata_tag_t = 983044 - ACAMERA_SENSOR_INFO_PHYSICAL_SIZE Acamera_metadata_tag_t = 983045 - ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE Acamera_metadata_tag_t = 983046 - ACAMERA_SENSOR_INFO_WHITE_LEVEL Acamera_metadata_tag_t = 983047 - ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE Acamera_metadata_tag_t = 983048 - ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED Acamera_metadata_tag_t = 983049 - ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE Acamera_metadata_tag_t = 983050 - ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 983051 - ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 983052 - ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 983053 - ACAMERA_SENSOR_INFO_BINNING_FACTOR Acamera_metadata_tag_t = 983054 - ACAMERA_SENSOR_INFO_END Acamera_metadata_tag_t = 983055 - ACAMERA_SHADING_MODE Acamera_metadata_tag_t = 1048576 - ACAMERA_SHADING_AVAILABLE_MODES Acamera_metadata_tag_t = 1048578 - ACAMERA_SHADING_END Acamera_metadata_tag_t = 1048579 - ACAMERA_STATISTICS_FACE_DETECT_MODE Acamera_metadata_tag_t = 1114112 - ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE Acamera_metadata_tag_t = 1114115 - ACAMERA_STATISTICS_FACE_IDS Acamera_metadata_tag_t = 1114116 - ACAMERA_STATISTICS_FACE_LANDMARKS Acamera_metadata_tag_t = 1114117 - ACAMERA_STATISTICS_FACE_RECTANGLES Acamera_metadata_tag_t = 1114118 - ACAMERA_STATISTICS_FACE_SCORES Acamera_metadata_tag_t = 1114119 - ACAMERA_STATISTICS_LENS_SHADING_MAP Acamera_metadata_tag_t = 1114123 - ACAMERA_STATISTICS_SCENE_FLICKER Acamera_metadata_tag_t = 1114126 - ACAMERA_STATISTICS_HOT_PIXEL_MAP Acamera_metadata_tag_t = 1114127 - ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE Acamera_metadata_tag_t = 1114128 - ACAMERA_STATISTICS_OIS_DATA_MODE Acamera_metadata_tag_t = 1114129 - ACAMERA_STATISTICS_OIS_TIMESTAMPS Acamera_metadata_tag_t = 1114130 - ACAMERA_STATISTICS_OIS_X_SHIFTS Acamera_metadata_tag_t = 1114131 - ACAMERA_STATISTICS_OIS_Y_SHIFTS Acamera_metadata_tag_t = 1114132 - ACAMERA_STATISTICS_LENS_INTRINSIC_TIMESTAMPS Acamera_metadata_tag_t = 1114133 - ACAMERA_STATISTICS_LENS_INTRINSIC_SAMPLES Acamera_metadata_tag_t = 1114134 - ACAMERA_STATISTICS_END Acamera_metadata_tag_t = 1114135 - ACAMERA_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES Acamera_metadata_tag_t = 1179648 - ACAMERA_STATISTICS_INFO_MAX_FACE_COUNT Acamera_metadata_tag_t = 1179650 - ACAMERA_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES Acamera_metadata_tag_t = 1179654 - ACAMERA_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES Acamera_metadata_tag_t = 1179655 - ACAMERA_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES Acamera_metadata_tag_t = 1179656 - ACAMERA_STATISTICS_INFO_END Acamera_metadata_tag_t = 1179657 - ACAMERA_TONEMAP_CURVE_BLUE Acamera_metadata_tag_t = 1245184 - ACAMERA_TONEMAP_CURVE_GREEN Acamera_metadata_tag_t = 1245185 - ACAMERA_TONEMAP_CURVE_RED Acamera_metadata_tag_t = 1245186 - ACAMERA_TONEMAP_MODE Acamera_metadata_tag_t = 1245187 - ACAMERA_TONEMAP_MAX_CURVE_POINTS Acamera_metadata_tag_t = 1245188 - ACAMERA_TONEMAP_AVAILABLE_TONE_MAP_MODES Acamera_metadata_tag_t = 1245189 - ACAMERA_TONEMAP_GAMMA Acamera_metadata_tag_t = 1245190 - ACAMERA_TONEMAP_PRESET_CURVE Acamera_metadata_tag_t = 1245191 - ACAMERA_TONEMAP_END Acamera_metadata_tag_t = 1245192 - ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL Acamera_metadata_tag_t = 1376256 - ACAMERA_INFO_VERSION Acamera_metadata_tag_t = 1376257 - ACAMERA_INFO_DEVICE_STATE_ORIENTATIONS Acamera_metadata_tag_t = 1376259 - ACAMERA_INFO_END Acamera_metadata_tag_t = 1376260 - ACAMERA_BLACK_LEVEL_LOCK Acamera_metadata_tag_t = 1441792 - ACAMERA_BLACK_LEVEL_END Acamera_metadata_tag_t = 1441793 - ACAMERA_SYNC_FRAME_NUMBER Acamera_metadata_tag_t = 1507328 - ACAMERA_SYNC_MAX_LATENCY Acamera_metadata_tag_t = 1507329 - ACAMERA_SYNC_END Acamera_metadata_tag_t = 1507330 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS Acamera_metadata_tag_t = 1638401 - ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS Acamera_metadata_tag_t = 1638402 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS Acamera_metadata_tag_t = 1638403 - ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE Acamera_metadata_tag_t = 1638404 - ACAMERA_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS Acamera_metadata_tag_t = 1638405 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS Acamera_metadata_tag_t = 1638406 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS Acamera_metadata_tag_t = 1638407 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS Acamera_metadata_tag_t = 1638408 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1638409 - ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1638410 - ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1638411 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1638412 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1638413 - ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1638414 - ACAMERA_DEPTH_END Acamera_metadata_tag_t = 1638415 - ACAMERA_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS Acamera_metadata_tag_t = 1703936 - ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE Acamera_metadata_tag_t = 1703937 - ACAMERA_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID Acamera_metadata_tag_t = 1703938 - ACAMERA_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_SENSOR_CROP_REGION Acamera_metadata_tag_t = 1703939 - ACAMERA_LOGICAL_MULTI_CAMERA_END Acamera_metadata_tag_t = 1703940 - ACAMERA_DISTORTION_CORRECTION_MODE Acamera_metadata_tag_t = 1769472 - ACAMERA_DISTORTION_CORRECTION_AVAILABLE_MODES Acamera_metadata_tag_t = 1769473 - ACAMERA_DISTORTION_CORRECTION_END Acamera_metadata_tag_t = 1769474 - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS Acamera_metadata_tag_t = 1835008 - ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS Acamera_metadata_tag_t = 1835009 - ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS Acamera_metadata_tag_t = 1835010 - ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1835011 - ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1835012 - ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 1835013 - ACAMERA_HEIC_END Acamera_metadata_tag_t = 1835014 - ACAMERA_AUTOMOTIVE_LOCATION Acamera_metadata_tag_t = 1966080 - ACAMERA_AUTOMOTIVE_END Acamera_metadata_tag_t = 1966081 - ACAMERA_AUTOMOTIVE_LENS_FACING Acamera_metadata_tag_t = 2031616 - ACAMERA_AUTOMOTIVE_LENS_END Acamera_metadata_tag_t = 2031617 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS Acamera_metadata_tag_t = 2162688 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS Acamera_metadata_tag_t = 2162689 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS Acamera_metadata_tag_t = 2162690 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 2162691 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 2162692 - ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION Acamera_metadata_tag_t = 2162693 - ACAMERA_JPEGR_END Acamera_metadata_tag_t = 2162694 -) diff --git a/capi/camera/doc.go b/capi/camera/doc.go deleted file mode 100644 index a82927b..0000000 --- a/capi/camera/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Camera2 NDK -*/ -package camera diff --git a/capi/camera/types.go b/capi/camera/types.go deleted file mode 100644 index 2e075cb..0000000 --- a/capi/camera/types.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package camera - -/* -#cgo LDFLAGS: -lcamera2ndk -#include "camera/NdkCameraManager.h" -#include "camera/NdkCameraDevice.h" -#include "camera/NdkCaptureRequest.h" -#include "camera/NdkCameraCaptureSession.h" -#include "camera/NdkCameraMetadata.h" -#include "camera/NdkCameraMetadataTags.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type ACameraCaptureFailure C.ACameraCaptureFailure - -type ACameraCaptureSession C.ACameraCaptureSession - -type ACameraCaptureSession_captureCallbacks C.ACameraCaptureSession_captureCallbacks - -type ACameraCaptureSession_captureCallbacksV2 C.ACameraCaptureSession_captureCallbacksV2 - -type ACameraCaptureSession_logicalCamera_captureCallbacks C.ACameraCaptureSession_logicalCamera_captureCallbacks - -type ACameraCaptureSession_logicalCamera_captureCallbacksV2 C.ACameraCaptureSession_logicalCamera_captureCallbacksV2 - -type ACameraCaptureSession_stateCallbacks C.ACameraCaptureSession_stateCallbacks - -type ACameraDevice C.ACameraDevice - -type ACameraDevice_StateCallbacks C.ACameraDevice_StateCallbacks - -type ACameraDevice_request_template int32 - -type ACameraDevice_stateCallbacks ACameraDevice_StateCallbacks - -type ACameraIdList C.ACameraIdList - -type ACameraManager C.ACameraManager - -type ACameraManager_AvailabilityCallbacks C.ACameraManager_AvailabilityCallbacks - -type ACameraManager_ExtendedAvailabilityCallbacks C.ACameraManager_ExtendedAvailabilityCallbacks - -type ACameraMetadata C.ACameraMetadata - -type ACameraMetadata_const_entry C.ACameraMetadata_const_entry - -type ACameraMetadata_entry C.ACameraMetadata_entry - -type ACameraMetadata_rational C.ACameraMetadata_rational - -type ACameraOutputTarget C.ACameraOutputTarget - -type ACameraOutputTargets C.ACameraOutputTargets - -type ACaptureRequest C.ACaptureRequest - -type ACaptureSessionOutput C.ACaptureSessionOutput - -type ACaptureSessionOutputContainer C.ACaptureSessionOutputContainer - -type ALogicalCameraCaptureFailure C.ALogicalCameraCaptureFailure - -type Acamera_metadata_enum_android_automotive_lens_facing_t int32 - -type Acamera_metadata_enum_android_automotive_location_t int32 - -type Acamera_metadata_enum_android_black_level_lock_t int32 - -type Acamera_metadata_enum_android_color_correction_aberration_mode_t int32 - -type Acamera_metadata_enum_android_color_correction_mode_t int32 - -type Acamera_metadata_enum_android_control_ae_antibanding_mode_t int32 - -type Acamera_metadata_enum_android_control_ae_lock_available_t int32 - -type Acamera_metadata_enum_android_control_ae_lock_t int32 - -type Acamera_metadata_enum_android_control_ae_mode_t int32 - -type Acamera_metadata_enum_android_control_ae_precapture_trigger_t int32 - -type Acamera_metadata_enum_android_control_ae_state_t int32 - -type Acamera_metadata_enum_android_control_af_mode_t int32 - -type Acamera_metadata_enum_android_control_af_scene_change_t int32 - -type Acamera_metadata_enum_android_control_af_state_t int32 - -type Acamera_metadata_enum_android_control_af_trigger_t int32 - -type Acamera_metadata_enum_android_control_autoframing_available_t int32 - -type Acamera_metadata_enum_android_control_autoframing_state_t int32 - -type Acamera_metadata_enum_android_control_autoframing_t int32 - -type Acamera_metadata_enum_android_control_awb_lock_available_t int32 - -type Acamera_metadata_enum_android_control_awb_lock_t int32 - -type Acamera_metadata_enum_android_control_awb_mode_t int32 - -type Acamera_metadata_enum_android_control_awb_state_t int32 - -type Acamera_metadata_enum_android_control_capture_intent_t int32 - -type Acamera_metadata_enum_android_control_effect_mode_t int32 - -type Acamera_metadata_enum_android_control_enable_zsl_t int32 - -type Acamera_metadata_enum_android_control_extended_scene_mode_t int32 - -type Acamera_metadata_enum_android_control_low_light_boost_state_t int32 - -type Acamera_metadata_enum_android_control_mode_t int32 - -type Acamera_metadata_enum_android_control_scene_mode_t int32 - -type Acamera_metadata_enum_android_control_settings_override_t int32 - -type Acamera_metadata_enum_android_control_video_stabilization_mode_t int32 - -type Acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t int32 - -type Acamera_metadata_enum_android_depth_available_depth_stream_configurations_t int32 - -type Acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t int32 - -type Acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t int32 - -type Acamera_metadata_enum_android_depth_depth_is_exclusive_t int32 - -type Acamera_metadata_enum_android_distortion_correction_mode_t int32 - -type Acamera_metadata_enum_android_edge_mode_t int32 - -type Acamera_metadata_enum_android_flash_info_available_t int32 - -type Acamera_metadata_enum_android_flash_mode_t int32 - -type Acamera_metadata_enum_android_flash_state_t int32 - -type Acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t int32 - -type Acamera_metadata_enum_android_heic_available_heic_stream_configurations_t int32 - -type Acamera_metadata_enum_android_hot_pixel_mode_t int32 - -type Acamera_metadata_enum_android_info_supported_hardware_level_t int32 - -type Acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t int32 - -type Acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t int32 - -type Acamera_metadata_enum_android_lens_facing_t int32 - -type Acamera_metadata_enum_android_lens_info_focus_distance_calibration_t int32 - -type Acamera_metadata_enum_android_lens_optical_stabilization_mode_t int32 - -type Acamera_metadata_enum_android_lens_pose_reference_t int32 - -type Acamera_metadata_enum_android_lens_state_t int32 - -type Acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t int32 - -type Acamera_metadata_enum_android_noise_reduction_mode_t int32 - -type Acamera_metadata_enum_android_request_available_capabilities_t int32 - -type Acamera_metadata_enum_android_request_available_color_space_profiles_map_t int32 - -type Acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t int32 - -type Acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t int32 - -type Acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t int32 - -type Acamera_metadata_enum_android_scaler_available_stream_configurations_t int32 - -type Acamera_metadata_enum_android_scaler_available_stream_use_cases_t int32 - -type Acamera_metadata_enum_android_scaler_cropping_type_t int32 - -type Acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t int32 - -type Acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t int32 - -type Acamera_metadata_enum_android_scaler_rotate_and_crop_t int32 - -type Acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t int32 - -type Acamera_metadata_enum_android_sensor_info_lens_shading_applied_t int32 - -type Acamera_metadata_enum_android_sensor_info_timestamp_source_t int32 - -type Acamera_metadata_enum_android_sensor_pixel_mode_t int32 - -type Acamera_metadata_enum_android_sensor_raw_binning_factor_used_t int32 - -type Acamera_metadata_enum_android_sensor_reference_illuminant1_t int32 - -type Acamera_metadata_enum_android_sensor_test_pattern_mode_t int32 - -type Acamera_metadata_enum_android_shading_mode_t int32 - -type Acamera_metadata_enum_android_statistics_face_detect_mode_t int32 - -type Acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t int32 - -type Acamera_metadata_enum_android_statistics_lens_shading_map_mode_t int32 - -type Acamera_metadata_enum_android_statistics_ois_data_mode_t int32 - -type Acamera_metadata_enum_android_statistics_scene_flicker_t int32 - -type Acamera_metadata_enum_android_sync_frame_number_t int32 - -type Acamera_metadata_enum_android_sync_max_latency_t int32 - -type Acamera_metadata_enum_android_tonemap_mode_t int32 - -type Acamera_metadata_enum_android_tonemap_preset_curve_t int32 - -type Acamera_metadata_section_start_t int32 - -type Acamera_metadata_section_t int32 - -type Acamera_metadata_tag_t int32 - -type ACameraManager_AvailabilityListener C.struct_ACameraManager_AvailabilityListener - -type ACameraManager_ExtendedAvailabilityListener C.struct_ACameraManager_ExtendedAvailabilityListener - -type ANativeWindow C.ANativeWindow - -type JNIEnv C.JNIEnv - -type Camera_status_t C.camera_status_t - -type Jobject C.jobject - -type ACameraCaptureSession_captureCallback_bufferLost func(context unsafe.Pointer, session *ACameraCaptureSession, request *ACaptureRequest, window *ANativeWindow, frameNumber int64) - -type ACameraCaptureSession_captureCallback_failed func(context unsafe.Pointer, session *ACameraCaptureSession, request *ACaptureRequest, failure *ACameraCaptureFailure) - -type ACameraCaptureSession_captureCallback_result func(context unsafe.Pointer, session *ACameraCaptureSession, request *ACaptureRequest, result *ACameraMetadata) - -type ACameraCaptureSession_captureCallback_sequenceAbort func(context unsafe.Pointer, session *ACameraCaptureSession, sequenceId int32) - -type ACameraCaptureSession_captureCallback_sequenceEnd func(context unsafe.Pointer, session *ACameraCaptureSession, sequenceId int32, frameNumber int64) - -type ACameraCaptureSession_captureCallback_start func(context unsafe.Pointer, session *ACameraCaptureSession, request *ACaptureRequest, timestamp int64) - -type ACameraCaptureSession_captureCallback_startV2 func(context unsafe.Pointer, session *ACameraCaptureSession, request *ACaptureRequest, timestamp int64, frameNumber int64) - -type ACameraCaptureSession_logicalCamera_captureCallback_failed func(context unsafe.Pointer, session *ACameraCaptureSession, request *ACaptureRequest, failure *ALogicalCameraCaptureFailure) - -type ACameraCaptureSession_logicalCamera_captureCallback_result func(context unsafe.Pointer, session *ACameraCaptureSession, request *ACaptureRequest, result *ACameraMetadata, physicalResultCount uint64, physicalCameraIds **int8, physicalResults **ACameraMetadata) - -type ACameraCaptureSession_prepareCallback func(context unsafe.Pointer, window *ANativeWindow, session *ACameraCaptureSession) - -type ACameraCaptureSession_stateCallback func(context unsafe.Pointer, session *ACameraCaptureSession) - -type ACameraDevice_ErrorStateCallback func(context unsafe.Pointer, device *ACameraDevice, _error int32) - -type ACameraDevice_StateCallback func(context unsafe.Pointer, device *ACameraDevice) - -type ACameraManager_AccessPrioritiesChangedCallback func(context unsafe.Pointer) - -type ACameraManager_AvailabilityCallback func(context unsafe.Pointer, cameraId string) - -type ACameraManager_PhysicalCameraAvailabilityCallback func(context unsafe.Pointer, cameraId string, physicalCameraId string) diff --git a/capi/choreographer/cgo_helpers.c b/capi/choreographer/cgo_helpers.c deleted file mode 100644 index 0273632..0000000 --- a/capi/choreographer/cgo_helpers.c +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void AChoreographer_frameCallback_b2a0e09c(long frameTimeNanos, void* data) { - AChoreographer_frameCallbackB2A0E09C(frameTimeNanos, data); -} - -void AChoreographer_frameCallback64_a698eb9e(int64_t frameTimeNanos, void* data) { - AChoreographer_frameCallback64A698EB9E(frameTimeNanos, data); -} - -void AChoreographer_refreshRateCallback_872a4fea(int64_t vsyncPeriodNanos, void* data) { - AChoreographer_refreshRateCallback872A4FEA(vsyncPeriodNanos, data); -} - -void AChoreographer_vsyncCallback_c3e58802(const AChoreographerFrameCallbackData* callbackData, void* data) { - AChoreographer_vsyncCallbackC3E58802((AChoreographerFrameCallbackData*)callbackData, data); -} - diff --git a/capi/choreographer/cgo_helpers.go b/capi/choreographer/cgo_helpers.go deleted file mode 100644 index ab1e0ce..0000000 --- a/capi/choreographer/cgo_helpers.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package choreographer - -/* -#cgo LDFLAGS: -landroid -lnativewindow -#include "android/choreographer.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x AChoreographer_frameCallback) PassRef() (ref *C.AChoreographer_frameCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aChoreographer_frameCallbackB2A0E09CFunc == nil { - aChoreographer_frameCallbackB2A0E09CFunc = x - } - return (*C.AChoreographer_frameCallback)(C.AChoreographer_frameCallback_b2a0e09c), nil -} - -func (x AChoreographer_frameCallback) PassValue() (ref C.AChoreographer_frameCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aChoreographer_frameCallbackB2A0E09CFunc == nil { - aChoreographer_frameCallbackB2A0E09CFunc = x - } - return (C.AChoreographer_frameCallback)(C.AChoreographer_frameCallback_b2a0e09c), nil -} - -func NewAChoreographer_frameCallbackRef(ref unsafe.Pointer) *AChoreographer_frameCallback { - return (*AChoreographer_frameCallback)(ref) -} - -//export AChoreographer_frameCallbackB2A0E09C -func AChoreographer_frameCallbackB2A0E09C(cframeTimeNanos C.long, cdata unsafe.Pointer) { - if aChoreographer_frameCallbackB2A0E09CFunc != nil { - frameTimeNanosb2a0e09c := (int64)(cframeTimeNanos) - datab2a0e09c := (unsafe.Pointer)(unsafe.Pointer(cdata)) - aChoreographer_frameCallbackB2A0E09CFunc(frameTimeNanosb2a0e09c, datab2a0e09c) - return - } - panic("callback func has not been set (race?)") -} - -var aChoreographer_frameCallbackB2A0E09CFunc AChoreographer_frameCallback - -func (x AChoreographer_frameCallback64) PassRef() (ref *C.AChoreographer_frameCallback64, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aChoreographer_frameCallback64A698EB9EFunc == nil { - aChoreographer_frameCallback64A698EB9EFunc = x - } - return (*C.AChoreographer_frameCallback64)(C.AChoreographer_frameCallback64_a698eb9e), nil -} - -func (x AChoreographer_frameCallback64) PassValue() (ref C.AChoreographer_frameCallback64, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aChoreographer_frameCallback64A698EB9EFunc == nil { - aChoreographer_frameCallback64A698EB9EFunc = x - } - return (C.AChoreographer_frameCallback64)(C.AChoreographer_frameCallback64_a698eb9e), nil -} - -func NewAChoreographer_frameCallback64Ref(ref unsafe.Pointer) *AChoreographer_frameCallback64 { - return (*AChoreographer_frameCallback64)(ref) -} - -//export AChoreographer_frameCallback64A698EB9E -func AChoreographer_frameCallback64A698EB9E(cframeTimeNanos C.int64_t, cdata unsafe.Pointer) { - if aChoreographer_frameCallback64A698EB9EFunc != nil { - frameTimeNanosa698eb9e := (int64)(cframeTimeNanos) - dataa698eb9e := (unsafe.Pointer)(unsafe.Pointer(cdata)) - aChoreographer_frameCallback64A698EB9EFunc(frameTimeNanosa698eb9e, dataa698eb9e) - return - } - panic("callback func has not been set (race?)") -} - -var aChoreographer_frameCallback64A698EB9EFunc AChoreographer_frameCallback64 - -func (x AChoreographer_refreshRateCallback) PassRef() (ref *C.AChoreographer_refreshRateCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aChoreographer_refreshRateCallback872A4FEAFunc == nil { - aChoreographer_refreshRateCallback872A4FEAFunc = x - } - return (*C.AChoreographer_refreshRateCallback)(C.AChoreographer_refreshRateCallback_872a4fea), nil -} - -func (x AChoreographer_refreshRateCallback) PassValue() (ref C.AChoreographer_refreshRateCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aChoreographer_refreshRateCallback872A4FEAFunc == nil { - aChoreographer_refreshRateCallback872A4FEAFunc = x - } - return (C.AChoreographer_refreshRateCallback)(C.AChoreographer_refreshRateCallback_872a4fea), nil -} - -func NewAChoreographer_refreshRateCallbackRef(ref unsafe.Pointer) *AChoreographer_refreshRateCallback { - return (*AChoreographer_refreshRateCallback)(ref) -} - -//export AChoreographer_refreshRateCallback872A4FEA -func AChoreographer_refreshRateCallback872A4FEA(cvsyncPeriodNanos C.int64_t, cdata unsafe.Pointer) { - if aChoreographer_refreshRateCallback872A4FEAFunc != nil { - vsyncPeriodNanos872a4fea := (int64)(cvsyncPeriodNanos) - data872a4fea := (unsafe.Pointer)(unsafe.Pointer(cdata)) - aChoreographer_refreshRateCallback872A4FEAFunc(vsyncPeriodNanos872a4fea, data872a4fea) - return - } - panic("callback func has not been set (race?)") -} - -var aChoreographer_refreshRateCallback872A4FEAFunc AChoreographer_refreshRateCallback - -func (x AChoreographer_vsyncCallback) PassRef() (ref *C.AChoreographer_vsyncCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aChoreographer_vsyncCallbackC3E58802Func == nil { - aChoreographer_vsyncCallbackC3E58802Func = x - } - return (*C.AChoreographer_vsyncCallback)(C.AChoreographer_vsyncCallback_c3e58802), nil -} - -func (x AChoreographer_vsyncCallback) PassValue() (ref C.AChoreographer_vsyncCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aChoreographer_vsyncCallbackC3E58802Func == nil { - aChoreographer_vsyncCallbackC3E58802Func = x - } - return (C.AChoreographer_vsyncCallback)(C.AChoreographer_vsyncCallback_c3e58802), nil -} - -func NewAChoreographer_vsyncCallbackRef(ref unsafe.Pointer) *AChoreographer_vsyncCallback { - return (*AChoreographer_vsyncCallback)(ref) -} - -//export AChoreographer_vsyncCallbackC3E58802 -func AChoreographer_vsyncCallbackC3E58802(ccallbackData *C.AChoreographerFrameCallbackData, cdata unsafe.Pointer) { - if aChoreographer_vsyncCallbackC3E58802Func != nil { - callbackDatac3e58802 := (*AChoreographerFrameCallbackData)(unsafe.Pointer(ccallbackData)) - datac3e58802 := (unsafe.Pointer)(unsafe.Pointer(cdata)) - aChoreographer_vsyncCallbackC3E58802Func(callbackDatac3e58802, datac3e58802) - return - } - panic("callback func has not been set (race?)") -} - -var aChoreographer_vsyncCallbackC3E58802Func AChoreographer_vsyncCallback diff --git a/capi/choreographer/cgo_helpers.h b/capi/choreographer/cgo_helpers.h deleted file mode 100644 index 7e13583..0000000 --- a/capi/choreographer/cgo_helpers.h +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/choreographer.h" -#include -#pragma once - -#define __CGOGEN 1 - -// AChoreographer_frameCallback_b2a0e09c is a proxy for callback AChoreographer_frameCallback. -void AChoreographer_frameCallback_b2a0e09c(long frameTimeNanos, void* data); - -// AChoreographer_frameCallback64_a698eb9e is a proxy for callback AChoreographer_frameCallback64. -void AChoreographer_frameCallback64_a698eb9e(int64_t frameTimeNanos, void* data); - -// AChoreographer_refreshRateCallback_872a4fea is a proxy for callback AChoreographer_refreshRateCallback. -void AChoreographer_refreshRateCallback_872a4fea(int64_t vsyncPeriodNanos, void* data); - -// AChoreographer_vsyncCallback_c3e58802 is a proxy for callback AChoreographer_vsyncCallback. -void AChoreographer_vsyncCallback_c3e58802(const AChoreographerFrameCallbackData* callbackData, void* data); - diff --git a/capi/choreographer/choreographer.go b/capi/choreographer/choreographer.go deleted file mode 100644 index cb54b77..0000000 --- a/capi/choreographer/choreographer.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package choreographer - -/* -#cgo LDFLAGS: -landroid -lnativewindow -#include "android/choreographer.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AChoreographerFrameCallbackData_getFrameTimeNanos(data *AChoreographerFrameCallbackData) int64 { - cdata, cdataAllocMap := (*C.AChoreographerFrameCallbackData)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.AChoreographerFrameCallbackData_getFrameTimeNanos(cdata) - runtime.KeepAlive(cdataAllocMap) - __v := (int64)(__ret) - return __v -} - -func AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos(data *AChoreographerFrameCallbackData, index uint64) int64 { - cdata, cdataAllocMap := (*C.AChoreographerFrameCallbackData)(unsafe.Pointer(data)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint64_t)(index), cgoAllocsUnknown - __ret := C.AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos(cdata, cindex) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cdataAllocMap) - __v := (int64)(__ret) - return __v -} - -func AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos(data *AChoreographerFrameCallbackData, index uint64) int64 { - cdata, cdataAllocMap := (*C.AChoreographerFrameCallbackData)(unsafe.Pointer(data)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint64_t)(index), cgoAllocsUnknown - __ret := C.AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos(cdata, cindex) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cdataAllocMap) - __v := (int64)(__ret) - return __v -} - -func AChoreographerFrameCallbackData_getFrameTimelineVsyncId(data *AChoreographerFrameCallbackData, index uint64) AVsyncId { - cdata, cdataAllocMap := (*C.AChoreographerFrameCallbackData)(unsafe.Pointer(data)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint64_t)(index), cgoAllocsUnknown - __ret := C.AChoreographerFrameCallbackData_getFrameTimelineVsyncId(cdata, cindex) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cdataAllocMap) - __v := (AVsyncId)(__ret) - return __v -} - -func AChoreographerFrameCallbackData_getFrameTimelinesLength(data *AChoreographerFrameCallbackData) uint64 { - cdata, cdataAllocMap := (*C.AChoreographerFrameCallbackData)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.AChoreographerFrameCallbackData_getFrameTimelinesLength(cdata) - runtime.KeepAlive(cdataAllocMap) - __v := (uint64)(__ret) - return __v -} - -func AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex(data *AChoreographerFrameCallbackData) uint64 { - cdata, cdataAllocMap := (*C.AChoreographerFrameCallbackData)(unsafe.Pointer(data)), cgoAllocsUnknown - __ret := C.AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex(cdata) - runtime.KeepAlive(cdataAllocMap) - __v := (uint64)(__ret) - return __v -} - -func AChoreographer_getInstance() *AChoreographer { - __ret := C.AChoreographer_getInstance() - __v := (*AChoreographer)(unsafe.Pointer(__ret)) - return __v -} - -func AChoreographer_postFrameCallback(choreographer *AChoreographer, callback AChoreographer_frameCallback, data unsafe.Pointer) { - cchoreographer, cchoreographerAllocMap := (*C.AChoreographer)(unsafe.Pointer(choreographer)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.AChoreographer_postFrameCallback(cchoreographer, ccallback, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cchoreographerAllocMap) -} - -func AChoreographer_postFrameCallback64(choreographer *AChoreographer, callback AChoreographer_frameCallback64, data unsafe.Pointer) { - cchoreographer, cchoreographerAllocMap := (*C.AChoreographer)(unsafe.Pointer(choreographer)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.AChoreographer_postFrameCallback64(cchoreographer, ccallback, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cchoreographerAllocMap) -} - -func AChoreographer_postFrameCallbackDelayed(choreographer *AChoreographer, callback AChoreographer_frameCallback, data unsafe.Pointer, delayMillis int64) { - cchoreographer, cchoreographerAllocMap := (*C.AChoreographer)(unsafe.Pointer(choreographer)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - cdelayMillis, cdelayMillisAllocMap := (C.int64_t)(delayMillis), cgoAllocsUnknown - C.AChoreographer_postFrameCallbackDelayed(cchoreographer, ccallback, cdata, cdelayMillis) - runtime.KeepAlive(cdelayMillisAllocMap) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cchoreographerAllocMap) -} - -func AChoreographer_postFrameCallbackDelayed64(choreographer *AChoreographer, callback AChoreographer_frameCallback64, data unsafe.Pointer, delayMillis uint32) { - cchoreographer, cchoreographerAllocMap := (*C.AChoreographer)(unsafe.Pointer(choreographer)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - cdelayMillis, cdelayMillisAllocMap := (C.uint)(delayMillis), cgoAllocsUnknown - C.AChoreographer_postFrameCallbackDelayed64(cchoreographer, ccallback, cdata, cdelayMillis) - runtime.KeepAlive(cdelayMillisAllocMap) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cchoreographerAllocMap) -} - -func AChoreographer_postVsyncCallback(choreographer *AChoreographer, callback AChoreographer_vsyncCallback, data unsafe.Pointer) { - cchoreographer, cchoreographerAllocMap := (*C.AChoreographer)(unsafe.Pointer(choreographer)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.AChoreographer_postVsyncCallback(cchoreographer, ccallback, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cchoreographerAllocMap) -} - -func AChoreographer_registerRefreshRateCallback(choreographer *AChoreographer, p1 AChoreographer_refreshRateCallback, data unsafe.Pointer) { - cchoreographer, cchoreographerAllocMap := (*C.AChoreographer)(unsafe.Pointer(choreographer)), cgoAllocsUnknown - cp1, cp1AllocMap := p1.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.AChoreographer_registerRefreshRateCallback(cchoreographer, cp1, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cp1AllocMap) - runtime.KeepAlive(cchoreographerAllocMap) -} - -func AChoreographer_unregisterRefreshRateCallback(choreographer *AChoreographer, p1 AChoreographer_refreshRateCallback, data unsafe.Pointer) { - cchoreographer, cchoreographerAllocMap := (*C.AChoreographer)(unsafe.Pointer(choreographer)), cgoAllocsUnknown - cp1, cp1AllocMap := p1.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.AChoreographer_unregisterRefreshRateCallback(cchoreographer, cp1, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cp1AllocMap) - runtime.KeepAlive(cchoreographerAllocMap) -} diff --git a/capi/choreographer/const.go b/capi/choreographer/const.go deleted file mode 100644 index 607d914..0000000 --- a/capi/choreographer/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package choreographer diff --git a/capi/choreographer/doc.go b/capi/choreographer/doc.go deleted file mode 100644 index 52be6ed..0000000 --- a/capi/choreographer/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android choreographer -*/ -package choreographer diff --git a/capi/choreographer/types.go b/capi/choreographer/types.go deleted file mode 100644 index be2cf79..0000000 --- a/capi/choreographer/types.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package choreographer - -/* -#cgo LDFLAGS: -landroid -lnativewindow -#include "android/choreographer.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type AChoreographer C.AChoreographer - -type AChoreographerFrameCallbackData C.AChoreographerFrameCallbackData - -type AVsyncId int64 - -type AChoreographer_frameCallback func(frameTimeNanos int64, data unsafe.Pointer) - -type AChoreographer_frameCallback64 func(frameTimeNanos int64, data unsafe.Pointer) - -type AChoreographer_refreshRateCallback func(vsyncPeriodNanos int64, data unsafe.Pointer) - -type AChoreographer_vsyncCallback func(callbackData *AChoreographerFrameCallbackData, data unsafe.Pointer) diff --git a/capi/configuration/cgo_helpers.c b/capi/configuration/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/configuration/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/configuration/cgo_helpers.go b/capi/configuration/cgo_helpers.go deleted file mode 100644 index 7b6aa23..0000000 --- a/capi/configuration/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package configuration - -/* -#cgo LDFLAGS: -landroid -#include "android/configuration.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/configuration/cgo_helpers.h b/capi/configuration/cgo_helpers.h deleted file mode 100644 index 0895284..0000000 --- a/capi/configuration/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/configuration.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/configuration/configuration.go b/capi/configuration/configuration.go deleted file mode 100644 index 375b0c6..0000000 --- a/capi/configuration/configuration.go +++ /dev/null @@ -1,422 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package configuration - -/* -#cgo LDFLAGS: -landroid -#include "android/configuration.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AConfiguration_copy(dest *AConfiguration, src *AConfiguration) { - cdest, cdestAllocMap := (*C.AConfiguration)(unsafe.Pointer(dest)), cgoAllocsUnknown - csrc, csrcAllocMap := (*C.AConfiguration)(unsafe.Pointer(src)), cgoAllocsUnknown - C.AConfiguration_copy(cdest, csrc) - runtime.KeepAlive(csrcAllocMap) - runtime.KeepAlive(cdestAllocMap) -} - -func AConfiguration_delete(config *AConfiguration) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - C.AConfiguration_delete(cconfig) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_diff(config1 *AConfiguration, config2 *AConfiguration) int32 { - cconfig1, cconfig1AllocMap := (*C.AConfiguration)(unsafe.Pointer(config1)), cgoAllocsUnknown - cconfig2, cconfig2AllocMap := (*C.AConfiguration)(unsafe.Pointer(config2)), cgoAllocsUnknown - __ret := C.AConfiguration_diff(cconfig1, cconfig2) - runtime.KeepAlive(cconfig2AllocMap) - runtime.KeepAlive(cconfig1AllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_fromAssetManager(out *AConfiguration, am *AAssetManager) { - cout, coutAllocMap := (*C.AConfiguration)(unsafe.Pointer(out)), cgoAllocsUnknown - cam, camAllocMap := (*C.AAssetManager)(unsafe.Pointer(am)), cgoAllocsUnknown - C.AConfiguration_fromAssetManager(cout, cam) - runtime.KeepAlive(camAllocMap) - runtime.KeepAlive(coutAllocMap) -} - -func AConfiguration_getCountry(config *AConfiguration, outCountry string) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - coutCountry, coutCountryAllocMap := UnpackPCharString(outCountry) - C.AConfiguration_getCountry(cconfig, coutCountry) - runtime.KeepAlive(coutCountryAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_getDensity(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getDensity(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getGrammaticalGender(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getGrammaticalGender(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getKeyboard(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getKeyboard(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getKeysHidden(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getKeysHidden(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getLanguage(config *AConfiguration, outLanguage string) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - coutLanguage, coutLanguageAllocMap := UnpackPCharString(outLanguage) - C.AConfiguration_getLanguage(cconfig, coutLanguage) - runtime.KeepAlive(coutLanguageAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_getLayoutDirection(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getLayoutDirection(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getMcc(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getMcc(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getMnc(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getMnc(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getNavHidden(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getNavHidden(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getNavigation(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getNavigation(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getOrientation(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getOrientation(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getScreenHeightDp(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getScreenHeightDp(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getScreenLong(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getScreenLong(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getScreenRound(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getScreenRound(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getScreenSize(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getScreenSize(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getScreenWidthDp(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getScreenWidthDp(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getSdkVersion(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getSdkVersion(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getSmallestScreenWidthDp(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getSmallestScreenWidthDp(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getTouchscreen(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getTouchscreen(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getUiModeNight(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getUiModeNight(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_getUiModeType(config *AConfiguration) int32 { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - __ret := C.AConfiguration_getUiModeType(cconfig) - runtime.KeepAlive(cconfigAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_isBetterThan(base *AConfiguration, test *AConfiguration, requested *AConfiguration) int32 { - cbase, cbaseAllocMap := (*C.AConfiguration)(unsafe.Pointer(base)), cgoAllocsUnknown - ctest, ctestAllocMap := (*C.AConfiguration)(unsafe.Pointer(test)), cgoAllocsUnknown - crequested, crequestedAllocMap := (*C.AConfiguration)(unsafe.Pointer(requested)), cgoAllocsUnknown - __ret := C.AConfiguration_isBetterThan(cbase, ctest, crequested) - runtime.KeepAlive(crequestedAllocMap) - runtime.KeepAlive(ctestAllocMap) - runtime.KeepAlive(cbaseAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_match(base *AConfiguration, requested *AConfiguration) int32 { - cbase, cbaseAllocMap := (*C.AConfiguration)(unsafe.Pointer(base)), cgoAllocsUnknown - crequested, crequestedAllocMap := (*C.AConfiguration)(unsafe.Pointer(requested)), cgoAllocsUnknown - __ret := C.AConfiguration_match(cbase, crequested) - runtime.KeepAlive(crequestedAllocMap) - runtime.KeepAlive(cbaseAllocMap) - __v := (int32)(__ret) - return __v -} - -func AConfiguration_new() *AConfiguration { - __ret := C.AConfiguration_new() - __v := (*AConfiguration)(unsafe.Pointer(__ret)) - return __v -} - -func AConfiguration_setCountry(config *AConfiguration, country string) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - ccountry, ccountryAllocMap := UnpackPCharString(country) - C.AConfiguration_setCountry(cconfig, ccountry) - runtime.KeepAlive(ccountryAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setDensity(config *AConfiguration, density int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cdensity, cdensityAllocMap := (C.int)(density), cgoAllocsUnknown - C.AConfiguration_setDensity(cconfig, cdensity) - runtime.KeepAlive(cdensityAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setGrammaticalGender(config *AConfiguration, value int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.int)(value), cgoAllocsUnknown - C.AConfiguration_setGrammaticalGender(cconfig, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setKeyboard(config *AConfiguration, keyboard int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - ckeyboard, ckeyboardAllocMap := (C.int)(keyboard), cgoAllocsUnknown - C.AConfiguration_setKeyboard(cconfig, ckeyboard) - runtime.KeepAlive(ckeyboardAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setKeysHidden(config *AConfiguration, keysHidden int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - ckeysHidden, ckeysHiddenAllocMap := (C.int)(keysHidden), cgoAllocsUnknown - C.AConfiguration_setKeysHidden(cconfig, ckeysHidden) - runtime.KeepAlive(ckeysHiddenAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setLanguage(config *AConfiguration, language string) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - clanguage, clanguageAllocMap := UnpackPCharString(language) - C.AConfiguration_setLanguage(cconfig, clanguage) - runtime.KeepAlive(clanguageAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setLayoutDirection(config *AConfiguration, value int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.int)(value), cgoAllocsUnknown - C.AConfiguration_setLayoutDirection(cconfig, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setMcc(config *AConfiguration, mcc int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cmcc, cmccAllocMap := (C.int)(mcc), cgoAllocsUnknown - C.AConfiguration_setMcc(cconfig, cmcc) - runtime.KeepAlive(cmccAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setMnc(config *AConfiguration, mnc int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cmnc, cmncAllocMap := (C.int)(mnc), cgoAllocsUnknown - C.AConfiguration_setMnc(cconfig, cmnc) - runtime.KeepAlive(cmncAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setNavHidden(config *AConfiguration, navHidden int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cnavHidden, cnavHiddenAllocMap := (C.int)(navHidden), cgoAllocsUnknown - C.AConfiguration_setNavHidden(cconfig, cnavHidden) - runtime.KeepAlive(cnavHiddenAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setNavigation(config *AConfiguration, navigation int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cnavigation, cnavigationAllocMap := (C.int)(navigation), cgoAllocsUnknown - C.AConfiguration_setNavigation(cconfig, cnavigation) - runtime.KeepAlive(cnavigationAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setOrientation(config *AConfiguration, orientation int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - corientation, corientationAllocMap := (C.int)(orientation), cgoAllocsUnknown - C.AConfiguration_setOrientation(cconfig, corientation) - runtime.KeepAlive(corientationAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setScreenHeightDp(config *AConfiguration, value int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.int)(value), cgoAllocsUnknown - C.AConfiguration_setScreenHeightDp(cconfig, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setScreenLong(config *AConfiguration, screenLong int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cscreenLong, cscreenLongAllocMap := (C.int)(screenLong), cgoAllocsUnknown - C.AConfiguration_setScreenLong(cconfig, cscreenLong) - runtime.KeepAlive(cscreenLongAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setScreenSize(config *AConfiguration, screenSize int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cscreenSize, cscreenSizeAllocMap := (C.int)(screenSize), cgoAllocsUnknown - C.AConfiguration_setScreenSize(cconfig, cscreenSize) - runtime.KeepAlive(cscreenSizeAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setScreenWidthDp(config *AConfiguration, value int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.int)(value), cgoAllocsUnknown - C.AConfiguration_setScreenWidthDp(cconfig, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setSdkVersion(config *AConfiguration, sdkVersion int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - csdkVersion, csdkVersionAllocMap := (C.int)(sdkVersion), cgoAllocsUnknown - C.AConfiguration_setSdkVersion(cconfig, csdkVersion) - runtime.KeepAlive(csdkVersionAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setSmallestScreenWidthDp(config *AConfiguration, value int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.int)(value), cgoAllocsUnknown - C.AConfiguration_setSmallestScreenWidthDp(cconfig, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setTouchscreen(config *AConfiguration, touchscreen int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - ctouchscreen, ctouchscreenAllocMap := (C.int)(touchscreen), cgoAllocsUnknown - C.AConfiguration_setTouchscreen(cconfig, ctouchscreen) - runtime.KeepAlive(ctouchscreenAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setUiModeNight(config *AConfiguration, uiModeNight int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cuiModeNight, cuiModeNightAllocMap := (C.int)(uiModeNight), cgoAllocsUnknown - C.AConfiguration_setUiModeNight(cconfig, cuiModeNight) - runtime.KeepAlive(cuiModeNightAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} - -func AConfiguration_setUiModeType(config *AConfiguration, uiModeType int32) { - cconfig, cconfigAllocMap := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown - cuiModeType, cuiModeTypeAllocMap := (C.int)(uiModeType), cgoAllocsUnknown - C.AConfiguration_setUiModeType(cconfig, cuiModeType) - runtime.KeepAlive(cuiModeTypeAllocMap) - runtime.KeepAlive(cconfigAllocMap) -} diff --git a/capi/configuration/const.go b/capi/configuration/const.go deleted file mode 100644 index b67d526..0000000 --- a/capi/configuration/const.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package configuration - -const ( - ACONFIGURATION_ORIENTATION_ANY = 0 - ACONFIGURATION_ORIENTATION_PORT = 1 - ACONFIGURATION_ORIENTATION_LAND = 2 - ACONFIGURATION_ORIENTATION_SQUARE = 3 - ACONFIGURATION_TOUCHSCREEN_ANY = 0 - ACONFIGURATION_TOUCHSCREEN_NOTOUCH = 1 - ACONFIGURATION_TOUCHSCREEN_STYLUS = 2 - ACONFIGURATION_TOUCHSCREEN_FINGER = 3 - ACONFIGURATION_DENSITY_DEFAULT = 0 - ACONFIGURATION_DENSITY_LOW = 120 - ACONFIGURATION_DENSITY_MEDIUM = 160 - ACONFIGURATION_DENSITY_TV = 213 - ACONFIGURATION_DENSITY_HIGH = 240 - ACONFIGURATION_DENSITY_XHIGH = 320 - ACONFIGURATION_DENSITY_XXHIGH = 480 - ACONFIGURATION_DENSITY_XXXHIGH = 640 - ACONFIGURATION_DENSITY_ANY = 65534 - ACONFIGURATION_DENSITY_NONE = 65535 - ACONFIGURATION_KEYBOARD_ANY = 0 - ACONFIGURATION_KEYBOARD_NOKEYS = 1 - ACONFIGURATION_KEYBOARD_QWERTY = 2 - ACONFIGURATION_KEYBOARD_12KEY = 3 - ACONFIGURATION_NAVIGATION_ANY = 0 - ACONFIGURATION_NAVIGATION_NONAV = 1 - ACONFIGURATION_NAVIGATION_DPAD = 2 - ACONFIGURATION_NAVIGATION_TRACKBALL = 3 - ACONFIGURATION_NAVIGATION_WHEEL = 4 - ACONFIGURATION_KEYSHIDDEN_ANY = 0 - ACONFIGURATION_KEYSHIDDEN_NO = 1 - ACONFIGURATION_KEYSHIDDEN_YES = 2 - ACONFIGURATION_KEYSHIDDEN_SOFT = 3 - ACONFIGURATION_NAVHIDDEN_ANY = 0 - ACONFIGURATION_NAVHIDDEN_NO = 1 - ACONFIGURATION_NAVHIDDEN_YES = 2 - ACONFIGURATION_SCREENSIZE_ANY = 0 - ACONFIGURATION_SCREENSIZE_SMALL = 1 - ACONFIGURATION_SCREENSIZE_NORMAL = 2 - ACONFIGURATION_SCREENSIZE_LARGE = 3 - ACONFIGURATION_SCREENSIZE_XLARGE = 4 - ACONFIGURATION_SCREENLONG_ANY = 0 - ACONFIGURATION_SCREENLONG_NO = 1 - ACONFIGURATION_SCREENLONG_YES = 2 - ACONFIGURATION_SCREENROUND_ANY = 0 - ACONFIGURATION_SCREENROUND_NO = 1 - ACONFIGURATION_SCREENROUND_YES = 2 - ACONFIGURATION_WIDE_COLOR_GAMUT_ANY = 0 - ACONFIGURATION_WIDE_COLOR_GAMUT_NO = 1 - ACONFIGURATION_WIDE_COLOR_GAMUT_YES = 2 - ACONFIGURATION_HDR_ANY = 0 - ACONFIGURATION_HDR_NO = 1 - ACONFIGURATION_HDR_YES = 2 - ACONFIGURATION_UI_MODE_TYPE_ANY = 0 - ACONFIGURATION_UI_MODE_TYPE_NORMAL = 1 - ACONFIGURATION_UI_MODE_TYPE_DESK = 2 - ACONFIGURATION_UI_MODE_TYPE_CAR = 3 - ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 4 - ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 5 - ACONFIGURATION_UI_MODE_TYPE_WATCH = 6 - ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET = 7 - ACONFIGURATION_UI_MODE_NIGHT_ANY = 0 - ACONFIGURATION_UI_MODE_NIGHT_NO = 1 - ACONFIGURATION_UI_MODE_NIGHT_YES = 2 - ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0 - ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0 - ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0 - ACONFIGURATION_LAYOUTDIR_ANY = 0 - ACONFIGURATION_LAYOUTDIR_LTR = 1 - ACONFIGURATION_LAYOUTDIR_RTL = 2 - ACONFIGURATION_MCC = 1 - ACONFIGURATION_MNC = 2 - ACONFIGURATION_LOCALE = 4 - ACONFIGURATION_TOUCHSCREEN = 8 - ACONFIGURATION_KEYBOARD = 16 - ACONFIGURATION_KEYBOARD_HIDDEN = 32 - ACONFIGURATION_NAVIGATION = 64 - ACONFIGURATION_ORIENTATION = 128 - ACONFIGURATION_DENSITY = 256 - ACONFIGURATION_SCREEN_SIZE = 512 - ACONFIGURATION_VERSION = 1024 - ACONFIGURATION_SCREEN_LAYOUT = 2048 - ACONFIGURATION_UI_MODE = 4096 - ACONFIGURATION_SMALLEST_SCREEN_SIZE = 8192 - ACONFIGURATION_LAYOUTDIR = 16384 - ACONFIGURATION_SCREEN_ROUND = 32768 - ACONFIGURATION_COLOR_MODE = 65536 - ACONFIGURATION_GRAMMATICAL_GENDER = 131072 - ACONFIGURATION_MNC_ZERO = 65535 - ACONFIGURATION_GRAMMATICAL_GENDER_ANY = 0 - ACONFIGURATION_GRAMMATICAL_GENDER_NEUTER = 1 - ACONFIGURATION_GRAMMATICAL_GENDER_FEMININE = 2 - ACONFIGURATION_GRAMMATICAL_GENDER_MASCULINE = 3 -) diff --git a/capi/configuration/doc.go b/capi/configuration/doc.go deleted file mode 100644 index 88a723a..0000000 --- a/capi/configuration/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android configuration -*/ -package configuration diff --git a/capi/configuration/types.go b/capi/configuration/types.go deleted file mode 100644 index df41863..0000000 --- a/capi/configuration/types.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package configuration - -/* -#cgo LDFLAGS: -landroid -#include "android/configuration.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AConfiguration C.AConfiguration - -type AAssetManager C.AAssetManager diff --git a/capi/egl/cgo_helpers.c b/capi/egl/cgo_helpers.c deleted file mode 100644 index 5c59a46..0000000 --- a/capi/egl/cgo_helpers.c +++ /dev/null @@ -1,184 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void PFNEGLBINDAPIPROC_52ac6fbf() { - PFNEGLBINDAPIPROC52AC6FBF(); -} - -void PFNEGLBINDTEXIMAGEPROC_782e9eaf() { - PFNEGLBINDTEXIMAGEPROC782E9EAF(); -} - -void PFNEGLCHOOSECONFIGPROC_484bf5bc() { - PFNEGLCHOOSECONFIGPROC484BF5BC(); -} - -void PFNEGLCLIENTWAITSYNCPROC_b3af6d25() { - PFNEGLCLIENTWAITSYNCPROCB3AF6D25(); -} - -void PFNEGLCOPYBUFFERSPROC_8518aff3() { - PFNEGLCOPYBUFFERSPROC8518AFF3(); -} - -void PFNEGLCREATECONTEXTPROC_71dbbcd5() { - PFNEGLCREATECONTEXTPROC71DBBCD5(); -} - -void PFNEGLCREATEIMAGEPROC_623c290a() { - PFNEGLCREATEIMAGEPROC623C290A(); -} - -void PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC_5a67e3d4() { - PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4(); -} - -void PFNEGLCREATEPBUFFERSURFACEPROC_fb9d4742() { - PFNEGLCREATEPBUFFERSURFACEPROCFB9D4742(); -} - -void PFNEGLCREATEPIXMAPSURFACEPROC_3bcccba7() { - PFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7(); -} - -void PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC_1e44353a() { - PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353A(); -} - -void PFNEGLCREATEPLATFORMWINDOWSURFACEPROC_1fc5eb8a() { - PFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8A(); -} - -void PFNEGLCREATESYNCPROC_590600b6() { - PFNEGLCREATESYNCPROC590600B6(); -} - -void PFNEGLCREATEWINDOWSURFACEPROC_916262c6() { - PFNEGLCREATEWINDOWSURFACEPROC916262C6(); -} - -void PFNEGLDESTROYCONTEXTPROC_2c220a54() { - PFNEGLDESTROYCONTEXTPROC2C220A54(); -} - -void PFNEGLDESTROYIMAGEPROC_05031d5f() { - PFNEGLDESTROYIMAGEPROC05031D5F(); -} - -void PFNEGLDESTROYSURFACEPROC_1403708c() { - PFNEGLDESTROYSURFACEPROC1403708C(); -} - -void PFNEGLDESTROYSYNCPROC_8777522d() { - PFNEGLDESTROYSYNCPROC8777522D(); -} - -void PFNEGLGETCONFIGATTRIBPROC_bc287298() { - PFNEGLGETCONFIGATTRIBPROCBC287298(); -} - -void PFNEGLGETCONFIGSPROC_f08cd467() { - PFNEGLGETCONFIGSPROCF08CD467(); -} - -void PFNEGLGETCURRENTCONTEXTPROC_7799ca1d() { - PFNEGLGETCURRENTCONTEXTPROC7799CA1D(); -} - -void PFNEGLGETCURRENTDISPLAYPROC_de7bb48c() { - PFNEGLGETCURRENTDISPLAYPROCDE7BB48C(); -} - -void PFNEGLGETCURRENTSURFACEPROC_5d98b8f5() { - PFNEGLGETCURRENTSURFACEPROC5D98B8F5(); -} - -void PFNEGLGETDISPLAYPROC_61844e7e() { - PFNEGLGETDISPLAYPROC61844E7E(); -} - -void PFNEGLGETERRORPROC_10983cc3() { - PFNEGLGETERRORPROC10983CC3(); -} - -void PFNEGLGETPLATFORMDISPLAYPROC_d492a1ce() { - PFNEGLGETPLATFORMDISPLAYPROCD492A1CE(); -} - -void PFNEGLGETPROCADDRESSPROC_5db88c70() { - PFNEGLGETPROCADDRESSPROC5DB88C70(); -} - -void PFNEGLGETSYNCATTRIBPROC_1222268f() { - PFNEGLGETSYNCATTRIBPROC1222268F(); -} - -void PFNEGLINITIALIZEPROC_cfcb1ef4() { - PFNEGLINITIALIZEPROCCFCB1EF4(); -} - -void PFNEGLMAKECURRENTPROC_19a41961() { - PFNEGLMAKECURRENTPROC19A41961(); -} - -void PFNEGLQUERYAPIPROC_3c747aa8() { - PFNEGLQUERYAPIPROC3C747AA8(); -} - -void PFNEGLQUERYCONTEXTPROC_2fe21b94() { - PFNEGLQUERYCONTEXTPROC2FE21B94(); -} - -void PFNEGLQUERYSTRINGPROC_0dd98293() { - PFNEGLQUERYSTRINGPROC0DD98293(); -} - -void PFNEGLQUERYSURFACEPROC_0cdde568() { - PFNEGLQUERYSURFACEPROC0CDDE568(); -} - -void PFNEGLRELEASETEXIMAGEPROC_fe8d1edf() { - PFNEGLRELEASETEXIMAGEPROCFE8D1EDF(); -} - -void PFNEGLRELEASETHREADPROC_86ceebe4() { - PFNEGLRELEASETHREADPROC86CEEBE4(); -} - -void PFNEGLSURFACEATTRIBPROC_6e975bb9() { - PFNEGLSURFACEATTRIBPROC6E975BB9(); -} - -void PFNEGLSWAPBUFFERSPROC_94e02dcf() { - PFNEGLSWAPBUFFERSPROC94E02DCF(); -} - -void PFNEGLSWAPINTERVALPROC_3f477745() { - PFNEGLSWAPINTERVALPROC3F477745(); -} - -void PFNEGLTERMINATEPROC_a44ed111() { - PFNEGLTERMINATEPROCA44ED111(); -} - -void PFNEGLWAITCLIENTPROC_711d0475() { - PFNEGLWAITCLIENTPROC711D0475(); -} - -void PFNEGLWAITGLPROC_2b163e1b() { - PFNEGLWAITGLPROC2B163E1B(); -} - -void PFNEGLWAITNATIVEPROC_0a74e00e() { - PFNEGLWAITNATIVEPROC0A74E00E(); -} - -void PFNEGLWAITSYNCPROC_689af046() { - PFNEGLWAITSYNCPROC689AF046(); -} - -void __eglMustCastToProperFunctionPointerType_6489f97c() { - EglMustCastToProperFunctionPointerType6489F97C(); -} - diff --git a/capi/egl/cgo_helpers.go b/capi/egl/cgo_helpers.go deleted file mode 100644 index c27e45a..0000000 --- a/capi/egl/cgo_helpers.go +++ /dev/null @@ -1,1667 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package egl - -/* -#cgo LDFLAGS: -lEGL -landroid -lnativewindow -#include "EGL/egl.h" -#include "android/native_window.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || a == b || b.IsEmpty() { - return - } - // Acquire locks in consistent pointer-address order to prevent - // ABBA deadlock when two goroutines call x.Borrow(y) and y.Borrow(x). - if uintptr(unsafe.Pointer(a)) < uintptr(unsafe.Pointer(b)) { - a.mux.Lock() - b.mux.Lock() - } else { - b.mux.Lock() - a.mux.Lock() - } - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x PFNEGLBINDAPIPROC) PassRef() (ref *C.PFNEGLBINDAPIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLBINDAPIPROC52AC6FBFFunc == nil { - pFNEGLBINDAPIPROC52AC6FBFFunc = x - } - return (*C.PFNEGLBINDAPIPROC)(C.PFNEGLBINDAPIPROC_52ac6fbf), nil -} - -func (x PFNEGLBINDAPIPROC) PassValue() (ref C.PFNEGLBINDAPIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLBINDAPIPROC52AC6FBFFunc == nil { - pFNEGLBINDAPIPROC52AC6FBFFunc = x - } - return (C.PFNEGLBINDAPIPROC)(C.PFNEGLBINDAPIPROC_52ac6fbf), nil -} - -func NewPFNEGLBINDAPIPROCRef(ref unsafe.Pointer) *PFNEGLBINDAPIPROC { - return (*PFNEGLBINDAPIPROC)(ref) -} - -//export PFNEGLBINDAPIPROC52AC6FBF -func PFNEGLBINDAPIPROC52AC6FBF() { - if pFNEGLBINDAPIPROC52AC6FBFFunc != nil { - pFNEGLBINDAPIPROC52AC6FBFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLBINDAPIPROC52AC6FBFFunc PFNEGLBINDAPIPROC - -func (x PFNEGLBINDTEXIMAGEPROC) PassRef() (ref *C.PFNEGLBINDTEXIMAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLBINDTEXIMAGEPROC782E9EAFFunc == nil { - pFNEGLBINDTEXIMAGEPROC782E9EAFFunc = x - } - return (*C.PFNEGLBINDTEXIMAGEPROC)(C.PFNEGLBINDTEXIMAGEPROC_782e9eaf), nil -} - -func (x PFNEGLBINDTEXIMAGEPROC) PassValue() (ref C.PFNEGLBINDTEXIMAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLBINDTEXIMAGEPROC782E9EAFFunc == nil { - pFNEGLBINDTEXIMAGEPROC782E9EAFFunc = x - } - return (C.PFNEGLBINDTEXIMAGEPROC)(C.PFNEGLBINDTEXIMAGEPROC_782e9eaf), nil -} - -func NewPFNEGLBINDTEXIMAGEPROCRef(ref unsafe.Pointer) *PFNEGLBINDTEXIMAGEPROC { - return (*PFNEGLBINDTEXIMAGEPROC)(ref) -} - -//export PFNEGLBINDTEXIMAGEPROC782E9EAF -func PFNEGLBINDTEXIMAGEPROC782E9EAF() { - if pFNEGLBINDTEXIMAGEPROC782E9EAFFunc != nil { - pFNEGLBINDTEXIMAGEPROC782E9EAFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLBINDTEXIMAGEPROC782E9EAFFunc PFNEGLBINDTEXIMAGEPROC - -func (x PFNEGLCHOOSECONFIGPROC) PassRef() (ref *C.PFNEGLCHOOSECONFIGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCHOOSECONFIGPROC484BF5BCFunc == nil { - pFNEGLCHOOSECONFIGPROC484BF5BCFunc = x - } - return (*C.PFNEGLCHOOSECONFIGPROC)(C.PFNEGLCHOOSECONFIGPROC_484bf5bc), nil -} - -func (x PFNEGLCHOOSECONFIGPROC) PassValue() (ref C.PFNEGLCHOOSECONFIGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCHOOSECONFIGPROC484BF5BCFunc == nil { - pFNEGLCHOOSECONFIGPROC484BF5BCFunc = x - } - return (C.PFNEGLCHOOSECONFIGPROC)(C.PFNEGLCHOOSECONFIGPROC_484bf5bc), nil -} - -func NewPFNEGLCHOOSECONFIGPROCRef(ref unsafe.Pointer) *PFNEGLCHOOSECONFIGPROC { - return (*PFNEGLCHOOSECONFIGPROC)(ref) -} - -//export PFNEGLCHOOSECONFIGPROC484BF5BC -func PFNEGLCHOOSECONFIGPROC484BF5BC() { - if pFNEGLCHOOSECONFIGPROC484BF5BCFunc != nil { - pFNEGLCHOOSECONFIGPROC484BF5BCFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCHOOSECONFIGPROC484BF5BCFunc PFNEGLCHOOSECONFIGPROC - -func (x PFNEGLCLIENTWAITSYNCPROC) PassRef() (ref *C.PFNEGLCLIENTWAITSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCLIENTWAITSYNCPROCB3AF6D25Func == nil { - pFNEGLCLIENTWAITSYNCPROCB3AF6D25Func = x - } - return (*C.PFNEGLCLIENTWAITSYNCPROC)(C.PFNEGLCLIENTWAITSYNCPROC_b3af6d25), nil -} - -func (x PFNEGLCLIENTWAITSYNCPROC) PassValue() (ref C.PFNEGLCLIENTWAITSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCLIENTWAITSYNCPROCB3AF6D25Func == nil { - pFNEGLCLIENTWAITSYNCPROCB3AF6D25Func = x - } - return (C.PFNEGLCLIENTWAITSYNCPROC)(C.PFNEGLCLIENTWAITSYNCPROC_b3af6d25), nil -} - -func NewPFNEGLCLIENTWAITSYNCPROCRef(ref unsafe.Pointer) *PFNEGLCLIENTWAITSYNCPROC { - return (*PFNEGLCLIENTWAITSYNCPROC)(ref) -} - -//export PFNEGLCLIENTWAITSYNCPROCB3AF6D25 -func PFNEGLCLIENTWAITSYNCPROCB3AF6D25() { - if pFNEGLCLIENTWAITSYNCPROCB3AF6D25Func != nil { - pFNEGLCLIENTWAITSYNCPROCB3AF6D25Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCLIENTWAITSYNCPROCB3AF6D25Func PFNEGLCLIENTWAITSYNCPROC - -func (x PFNEGLCOPYBUFFERSPROC) PassRef() (ref *C.PFNEGLCOPYBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCOPYBUFFERSPROC8518AFF3Func == nil { - pFNEGLCOPYBUFFERSPROC8518AFF3Func = x - } - return (*C.PFNEGLCOPYBUFFERSPROC)(C.PFNEGLCOPYBUFFERSPROC_8518aff3), nil -} - -func (x PFNEGLCOPYBUFFERSPROC) PassValue() (ref C.PFNEGLCOPYBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCOPYBUFFERSPROC8518AFF3Func == nil { - pFNEGLCOPYBUFFERSPROC8518AFF3Func = x - } - return (C.PFNEGLCOPYBUFFERSPROC)(C.PFNEGLCOPYBUFFERSPROC_8518aff3), nil -} - -func NewPFNEGLCOPYBUFFERSPROCRef(ref unsafe.Pointer) *PFNEGLCOPYBUFFERSPROC { - return (*PFNEGLCOPYBUFFERSPROC)(ref) -} - -//export PFNEGLCOPYBUFFERSPROC8518AFF3 -func PFNEGLCOPYBUFFERSPROC8518AFF3() { - if pFNEGLCOPYBUFFERSPROC8518AFF3Func != nil { - pFNEGLCOPYBUFFERSPROC8518AFF3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCOPYBUFFERSPROC8518AFF3Func PFNEGLCOPYBUFFERSPROC - -func (x PFNEGLCREATECONTEXTPROC) PassRef() (ref *C.PFNEGLCREATECONTEXTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATECONTEXTPROC71DBBCD5Func == nil { - pFNEGLCREATECONTEXTPROC71DBBCD5Func = x - } - return (*C.PFNEGLCREATECONTEXTPROC)(C.PFNEGLCREATECONTEXTPROC_71dbbcd5), nil -} - -func (x PFNEGLCREATECONTEXTPROC) PassValue() (ref C.PFNEGLCREATECONTEXTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATECONTEXTPROC71DBBCD5Func == nil { - pFNEGLCREATECONTEXTPROC71DBBCD5Func = x - } - return (C.PFNEGLCREATECONTEXTPROC)(C.PFNEGLCREATECONTEXTPROC_71dbbcd5), nil -} - -func NewPFNEGLCREATECONTEXTPROCRef(ref unsafe.Pointer) *PFNEGLCREATECONTEXTPROC { - return (*PFNEGLCREATECONTEXTPROC)(ref) -} - -//export PFNEGLCREATECONTEXTPROC71DBBCD5 -func PFNEGLCREATECONTEXTPROC71DBBCD5() { - if pFNEGLCREATECONTEXTPROC71DBBCD5Func != nil { - pFNEGLCREATECONTEXTPROC71DBBCD5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATECONTEXTPROC71DBBCD5Func PFNEGLCREATECONTEXTPROC - -func (x PFNEGLCREATEIMAGEPROC) PassRef() (ref *C.PFNEGLCREATEIMAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEIMAGEPROC623C290AFunc == nil { - pFNEGLCREATEIMAGEPROC623C290AFunc = x - } - return (*C.PFNEGLCREATEIMAGEPROC)(C.PFNEGLCREATEIMAGEPROC_623c290a), nil -} - -func (x PFNEGLCREATEIMAGEPROC) PassValue() (ref C.PFNEGLCREATEIMAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEIMAGEPROC623C290AFunc == nil { - pFNEGLCREATEIMAGEPROC623C290AFunc = x - } - return (C.PFNEGLCREATEIMAGEPROC)(C.PFNEGLCREATEIMAGEPROC_623c290a), nil -} - -func NewPFNEGLCREATEIMAGEPROCRef(ref unsafe.Pointer) *PFNEGLCREATEIMAGEPROC { - return (*PFNEGLCREATEIMAGEPROC)(ref) -} - -//export PFNEGLCREATEIMAGEPROC623C290A -func PFNEGLCREATEIMAGEPROC623C290A() { - if pFNEGLCREATEIMAGEPROC623C290AFunc != nil { - pFNEGLCREATEIMAGEPROC623C290AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATEIMAGEPROC623C290AFunc PFNEGLCREATEIMAGEPROC - -func (x PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) PassRef() (ref *C.PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4Func == nil { - pFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4Func = x - } - return (*C.PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)(C.PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC_5a67e3d4), nil -} - -func (x PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) PassValue() (ref C.PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4Func == nil { - pFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4Func = x - } - return (C.PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)(C.PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC_5a67e3d4), nil -} - -func NewPFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROCRef(ref unsafe.Pointer) *PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC { - return (*PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)(ref) -} - -//export PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4 -func PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4() { - if pFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4Func != nil { - pFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC5A67E3D4Func PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC - -func (x PFNEGLCREATEPBUFFERSURFACEPROC) PassRef() (ref *C.PFNEGLCREATEPBUFFERSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPBUFFERSURFACEPROCFB9D4742Func == nil { - pFNEGLCREATEPBUFFERSURFACEPROCFB9D4742Func = x - } - return (*C.PFNEGLCREATEPBUFFERSURFACEPROC)(C.PFNEGLCREATEPBUFFERSURFACEPROC_fb9d4742), nil -} - -func (x PFNEGLCREATEPBUFFERSURFACEPROC) PassValue() (ref C.PFNEGLCREATEPBUFFERSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPBUFFERSURFACEPROCFB9D4742Func == nil { - pFNEGLCREATEPBUFFERSURFACEPROCFB9D4742Func = x - } - return (C.PFNEGLCREATEPBUFFERSURFACEPROC)(C.PFNEGLCREATEPBUFFERSURFACEPROC_fb9d4742), nil -} - -func NewPFNEGLCREATEPBUFFERSURFACEPROCRef(ref unsafe.Pointer) *PFNEGLCREATEPBUFFERSURFACEPROC { - return (*PFNEGLCREATEPBUFFERSURFACEPROC)(ref) -} - -//export PFNEGLCREATEPBUFFERSURFACEPROCFB9D4742 -func PFNEGLCREATEPBUFFERSURFACEPROCFB9D4742() { - if pFNEGLCREATEPBUFFERSURFACEPROCFB9D4742Func != nil { - pFNEGLCREATEPBUFFERSURFACEPROCFB9D4742Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATEPBUFFERSURFACEPROCFB9D4742Func PFNEGLCREATEPBUFFERSURFACEPROC - -func (x PFNEGLCREATEPIXMAPSURFACEPROC) PassRef() (ref *C.PFNEGLCREATEPIXMAPSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7Func == nil { - pFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7Func = x - } - return (*C.PFNEGLCREATEPIXMAPSURFACEPROC)(C.PFNEGLCREATEPIXMAPSURFACEPROC_3bcccba7), nil -} - -func (x PFNEGLCREATEPIXMAPSURFACEPROC) PassValue() (ref C.PFNEGLCREATEPIXMAPSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7Func == nil { - pFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7Func = x - } - return (C.PFNEGLCREATEPIXMAPSURFACEPROC)(C.PFNEGLCREATEPIXMAPSURFACEPROC_3bcccba7), nil -} - -func NewPFNEGLCREATEPIXMAPSURFACEPROCRef(ref unsafe.Pointer) *PFNEGLCREATEPIXMAPSURFACEPROC { - return (*PFNEGLCREATEPIXMAPSURFACEPROC)(ref) -} - -//export PFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7 -func PFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7() { - if pFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7Func != nil { - pFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATEPIXMAPSURFACEPROC3BCCCBA7Func PFNEGLCREATEPIXMAPSURFACEPROC - -func (x PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) PassRef() (ref *C.PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353AFunc == nil { - pFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353AFunc = x - } - return (*C.PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)(C.PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC_1e44353a), nil -} - -func (x PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) PassValue() (ref C.PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353AFunc == nil { - pFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353AFunc = x - } - return (C.PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)(C.PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC_1e44353a), nil -} - -func NewPFNEGLCREATEPLATFORMPIXMAPSURFACEPROCRef(ref unsafe.Pointer) *PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC { - return (*PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)(ref) -} - -//export PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353A -func PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353A() { - if pFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353AFunc != nil { - pFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATEPLATFORMPIXMAPSURFACEPROC1E44353AFunc PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC - -func (x PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) PassRef() (ref *C.PFNEGLCREATEPLATFORMWINDOWSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8AFunc == nil { - pFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8AFunc = x - } - return (*C.PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)(C.PFNEGLCREATEPLATFORMWINDOWSURFACEPROC_1fc5eb8a), nil -} - -func (x PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) PassValue() (ref C.PFNEGLCREATEPLATFORMWINDOWSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8AFunc == nil { - pFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8AFunc = x - } - return (C.PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)(C.PFNEGLCREATEPLATFORMWINDOWSURFACEPROC_1fc5eb8a), nil -} - -func NewPFNEGLCREATEPLATFORMWINDOWSURFACEPROCRef(ref unsafe.Pointer) *PFNEGLCREATEPLATFORMWINDOWSURFACEPROC { - return (*PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)(ref) -} - -//export PFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8A -func PFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8A() { - if pFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8AFunc != nil { - pFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATEPLATFORMWINDOWSURFACEPROC1FC5EB8AFunc PFNEGLCREATEPLATFORMWINDOWSURFACEPROC - -func (x PFNEGLCREATESYNCPROC) PassRef() (ref *C.PFNEGLCREATESYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATESYNCPROC590600B6Func == nil { - pFNEGLCREATESYNCPROC590600B6Func = x - } - return (*C.PFNEGLCREATESYNCPROC)(C.PFNEGLCREATESYNCPROC_590600b6), nil -} - -func (x PFNEGLCREATESYNCPROC) PassValue() (ref C.PFNEGLCREATESYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATESYNCPROC590600B6Func == nil { - pFNEGLCREATESYNCPROC590600B6Func = x - } - return (C.PFNEGLCREATESYNCPROC)(C.PFNEGLCREATESYNCPROC_590600b6), nil -} - -func NewPFNEGLCREATESYNCPROCRef(ref unsafe.Pointer) *PFNEGLCREATESYNCPROC { - return (*PFNEGLCREATESYNCPROC)(ref) -} - -//export PFNEGLCREATESYNCPROC590600B6 -func PFNEGLCREATESYNCPROC590600B6() { - if pFNEGLCREATESYNCPROC590600B6Func != nil { - pFNEGLCREATESYNCPROC590600B6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATESYNCPROC590600B6Func PFNEGLCREATESYNCPROC - -func (x PFNEGLCREATEWINDOWSURFACEPROC) PassRef() (ref *C.PFNEGLCREATEWINDOWSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEWINDOWSURFACEPROC916262C6Func == nil { - pFNEGLCREATEWINDOWSURFACEPROC916262C6Func = x - } - return (*C.PFNEGLCREATEWINDOWSURFACEPROC)(C.PFNEGLCREATEWINDOWSURFACEPROC_916262c6), nil -} - -func (x PFNEGLCREATEWINDOWSURFACEPROC) PassValue() (ref C.PFNEGLCREATEWINDOWSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLCREATEWINDOWSURFACEPROC916262C6Func == nil { - pFNEGLCREATEWINDOWSURFACEPROC916262C6Func = x - } - return (C.PFNEGLCREATEWINDOWSURFACEPROC)(C.PFNEGLCREATEWINDOWSURFACEPROC_916262c6), nil -} - -func NewPFNEGLCREATEWINDOWSURFACEPROCRef(ref unsafe.Pointer) *PFNEGLCREATEWINDOWSURFACEPROC { - return (*PFNEGLCREATEWINDOWSURFACEPROC)(ref) -} - -//export PFNEGLCREATEWINDOWSURFACEPROC916262C6 -func PFNEGLCREATEWINDOWSURFACEPROC916262C6() { - if pFNEGLCREATEWINDOWSURFACEPROC916262C6Func != nil { - pFNEGLCREATEWINDOWSURFACEPROC916262C6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLCREATEWINDOWSURFACEPROC916262C6Func PFNEGLCREATEWINDOWSURFACEPROC - -func (x PFNEGLDESTROYCONTEXTPROC) PassRef() (ref *C.PFNEGLDESTROYCONTEXTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLDESTROYCONTEXTPROC2C220A54Func == nil { - pFNEGLDESTROYCONTEXTPROC2C220A54Func = x - } - return (*C.PFNEGLDESTROYCONTEXTPROC)(C.PFNEGLDESTROYCONTEXTPROC_2c220a54), nil -} - -func (x PFNEGLDESTROYCONTEXTPROC) PassValue() (ref C.PFNEGLDESTROYCONTEXTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLDESTROYCONTEXTPROC2C220A54Func == nil { - pFNEGLDESTROYCONTEXTPROC2C220A54Func = x - } - return (C.PFNEGLDESTROYCONTEXTPROC)(C.PFNEGLDESTROYCONTEXTPROC_2c220a54), nil -} - -func NewPFNEGLDESTROYCONTEXTPROCRef(ref unsafe.Pointer) *PFNEGLDESTROYCONTEXTPROC { - return (*PFNEGLDESTROYCONTEXTPROC)(ref) -} - -//export PFNEGLDESTROYCONTEXTPROC2C220A54 -func PFNEGLDESTROYCONTEXTPROC2C220A54() { - if pFNEGLDESTROYCONTEXTPROC2C220A54Func != nil { - pFNEGLDESTROYCONTEXTPROC2C220A54Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLDESTROYCONTEXTPROC2C220A54Func PFNEGLDESTROYCONTEXTPROC - -func (x PFNEGLDESTROYIMAGEPROC) PassRef() (ref *C.PFNEGLDESTROYIMAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLDESTROYIMAGEPROC05031D5FFunc == nil { - pFNEGLDESTROYIMAGEPROC05031D5FFunc = x - } - return (*C.PFNEGLDESTROYIMAGEPROC)(C.PFNEGLDESTROYIMAGEPROC_05031d5f), nil -} - -func (x PFNEGLDESTROYIMAGEPROC) PassValue() (ref C.PFNEGLDESTROYIMAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLDESTROYIMAGEPROC05031D5FFunc == nil { - pFNEGLDESTROYIMAGEPROC05031D5FFunc = x - } - return (C.PFNEGLDESTROYIMAGEPROC)(C.PFNEGLDESTROYIMAGEPROC_05031d5f), nil -} - -func NewPFNEGLDESTROYIMAGEPROCRef(ref unsafe.Pointer) *PFNEGLDESTROYIMAGEPROC { - return (*PFNEGLDESTROYIMAGEPROC)(ref) -} - -//export PFNEGLDESTROYIMAGEPROC05031D5F -func PFNEGLDESTROYIMAGEPROC05031D5F() { - if pFNEGLDESTROYIMAGEPROC05031D5FFunc != nil { - pFNEGLDESTROYIMAGEPROC05031D5FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLDESTROYIMAGEPROC05031D5FFunc PFNEGLDESTROYIMAGEPROC - -func (x PFNEGLDESTROYSURFACEPROC) PassRef() (ref *C.PFNEGLDESTROYSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLDESTROYSURFACEPROC1403708CFunc == nil { - pFNEGLDESTROYSURFACEPROC1403708CFunc = x - } - return (*C.PFNEGLDESTROYSURFACEPROC)(C.PFNEGLDESTROYSURFACEPROC_1403708c), nil -} - -func (x PFNEGLDESTROYSURFACEPROC) PassValue() (ref C.PFNEGLDESTROYSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLDESTROYSURFACEPROC1403708CFunc == nil { - pFNEGLDESTROYSURFACEPROC1403708CFunc = x - } - return (C.PFNEGLDESTROYSURFACEPROC)(C.PFNEGLDESTROYSURFACEPROC_1403708c), nil -} - -func NewPFNEGLDESTROYSURFACEPROCRef(ref unsafe.Pointer) *PFNEGLDESTROYSURFACEPROC { - return (*PFNEGLDESTROYSURFACEPROC)(ref) -} - -//export PFNEGLDESTROYSURFACEPROC1403708C -func PFNEGLDESTROYSURFACEPROC1403708C() { - if pFNEGLDESTROYSURFACEPROC1403708CFunc != nil { - pFNEGLDESTROYSURFACEPROC1403708CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLDESTROYSURFACEPROC1403708CFunc PFNEGLDESTROYSURFACEPROC - -func (x PFNEGLDESTROYSYNCPROC) PassRef() (ref *C.PFNEGLDESTROYSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLDESTROYSYNCPROC8777522DFunc == nil { - pFNEGLDESTROYSYNCPROC8777522DFunc = x - } - return (*C.PFNEGLDESTROYSYNCPROC)(C.PFNEGLDESTROYSYNCPROC_8777522d), nil -} - -func (x PFNEGLDESTROYSYNCPROC) PassValue() (ref C.PFNEGLDESTROYSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLDESTROYSYNCPROC8777522DFunc == nil { - pFNEGLDESTROYSYNCPROC8777522DFunc = x - } - return (C.PFNEGLDESTROYSYNCPROC)(C.PFNEGLDESTROYSYNCPROC_8777522d), nil -} - -func NewPFNEGLDESTROYSYNCPROCRef(ref unsafe.Pointer) *PFNEGLDESTROYSYNCPROC { - return (*PFNEGLDESTROYSYNCPROC)(ref) -} - -//export PFNEGLDESTROYSYNCPROC8777522D -func PFNEGLDESTROYSYNCPROC8777522D() { - if pFNEGLDESTROYSYNCPROC8777522DFunc != nil { - pFNEGLDESTROYSYNCPROC8777522DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLDESTROYSYNCPROC8777522DFunc PFNEGLDESTROYSYNCPROC - -func (x PFNEGLGETCONFIGATTRIBPROC) PassRef() (ref *C.PFNEGLGETCONFIGATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCONFIGATTRIBPROCBC287298Func == nil { - pFNEGLGETCONFIGATTRIBPROCBC287298Func = x - } - return (*C.PFNEGLGETCONFIGATTRIBPROC)(C.PFNEGLGETCONFIGATTRIBPROC_bc287298), nil -} - -func (x PFNEGLGETCONFIGATTRIBPROC) PassValue() (ref C.PFNEGLGETCONFIGATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCONFIGATTRIBPROCBC287298Func == nil { - pFNEGLGETCONFIGATTRIBPROCBC287298Func = x - } - return (C.PFNEGLGETCONFIGATTRIBPROC)(C.PFNEGLGETCONFIGATTRIBPROC_bc287298), nil -} - -func NewPFNEGLGETCONFIGATTRIBPROCRef(ref unsafe.Pointer) *PFNEGLGETCONFIGATTRIBPROC { - return (*PFNEGLGETCONFIGATTRIBPROC)(ref) -} - -//export PFNEGLGETCONFIGATTRIBPROCBC287298 -func PFNEGLGETCONFIGATTRIBPROCBC287298() { - if pFNEGLGETCONFIGATTRIBPROCBC287298Func != nil { - pFNEGLGETCONFIGATTRIBPROCBC287298Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETCONFIGATTRIBPROCBC287298Func PFNEGLGETCONFIGATTRIBPROC - -func (x PFNEGLGETCONFIGSPROC) PassRef() (ref *C.PFNEGLGETCONFIGSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCONFIGSPROCF08CD467Func == nil { - pFNEGLGETCONFIGSPROCF08CD467Func = x - } - return (*C.PFNEGLGETCONFIGSPROC)(C.PFNEGLGETCONFIGSPROC_f08cd467), nil -} - -func (x PFNEGLGETCONFIGSPROC) PassValue() (ref C.PFNEGLGETCONFIGSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCONFIGSPROCF08CD467Func == nil { - pFNEGLGETCONFIGSPROCF08CD467Func = x - } - return (C.PFNEGLGETCONFIGSPROC)(C.PFNEGLGETCONFIGSPROC_f08cd467), nil -} - -func NewPFNEGLGETCONFIGSPROCRef(ref unsafe.Pointer) *PFNEGLGETCONFIGSPROC { - return (*PFNEGLGETCONFIGSPROC)(ref) -} - -//export PFNEGLGETCONFIGSPROCF08CD467 -func PFNEGLGETCONFIGSPROCF08CD467() { - if pFNEGLGETCONFIGSPROCF08CD467Func != nil { - pFNEGLGETCONFIGSPROCF08CD467Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETCONFIGSPROCF08CD467Func PFNEGLGETCONFIGSPROC - -func (x PFNEGLGETCURRENTCONTEXTPROC) PassRef() (ref *C.PFNEGLGETCURRENTCONTEXTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCURRENTCONTEXTPROC7799CA1DFunc == nil { - pFNEGLGETCURRENTCONTEXTPROC7799CA1DFunc = x - } - return (*C.PFNEGLGETCURRENTCONTEXTPROC)(C.PFNEGLGETCURRENTCONTEXTPROC_7799ca1d), nil -} - -func (x PFNEGLGETCURRENTCONTEXTPROC) PassValue() (ref C.PFNEGLGETCURRENTCONTEXTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCURRENTCONTEXTPROC7799CA1DFunc == nil { - pFNEGLGETCURRENTCONTEXTPROC7799CA1DFunc = x - } - return (C.PFNEGLGETCURRENTCONTEXTPROC)(C.PFNEGLGETCURRENTCONTEXTPROC_7799ca1d), nil -} - -func NewPFNEGLGETCURRENTCONTEXTPROCRef(ref unsafe.Pointer) *PFNEGLGETCURRENTCONTEXTPROC { - return (*PFNEGLGETCURRENTCONTEXTPROC)(ref) -} - -//export PFNEGLGETCURRENTCONTEXTPROC7799CA1D -func PFNEGLGETCURRENTCONTEXTPROC7799CA1D() { - if pFNEGLGETCURRENTCONTEXTPROC7799CA1DFunc != nil { - pFNEGLGETCURRENTCONTEXTPROC7799CA1DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETCURRENTCONTEXTPROC7799CA1DFunc PFNEGLGETCURRENTCONTEXTPROC - -func (x PFNEGLGETCURRENTDISPLAYPROC) PassRef() (ref *C.PFNEGLGETCURRENTDISPLAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCURRENTDISPLAYPROCDE7BB48CFunc == nil { - pFNEGLGETCURRENTDISPLAYPROCDE7BB48CFunc = x - } - return (*C.PFNEGLGETCURRENTDISPLAYPROC)(C.PFNEGLGETCURRENTDISPLAYPROC_de7bb48c), nil -} - -func (x PFNEGLGETCURRENTDISPLAYPROC) PassValue() (ref C.PFNEGLGETCURRENTDISPLAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCURRENTDISPLAYPROCDE7BB48CFunc == nil { - pFNEGLGETCURRENTDISPLAYPROCDE7BB48CFunc = x - } - return (C.PFNEGLGETCURRENTDISPLAYPROC)(C.PFNEGLGETCURRENTDISPLAYPROC_de7bb48c), nil -} - -func NewPFNEGLGETCURRENTDISPLAYPROCRef(ref unsafe.Pointer) *PFNEGLGETCURRENTDISPLAYPROC { - return (*PFNEGLGETCURRENTDISPLAYPROC)(ref) -} - -//export PFNEGLGETCURRENTDISPLAYPROCDE7BB48C -func PFNEGLGETCURRENTDISPLAYPROCDE7BB48C() { - if pFNEGLGETCURRENTDISPLAYPROCDE7BB48CFunc != nil { - pFNEGLGETCURRENTDISPLAYPROCDE7BB48CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETCURRENTDISPLAYPROCDE7BB48CFunc PFNEGLGETCURRENTDISPLAYPROC - -func (x PFNEGLGETCURRENTSURFACEPROC) PassRef() (ref *C.PFNEGLGETCURRENTSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCURRENTSURFACEPROC5D98B8F5Func == nil { - pFNEGLGETCURRENTSURFACEPROC5D98B8F5Func = x - } - return (*C.PFNEGLGETCURRENTSURFACEPROC)(C.PFNEGLGETCURRENTSURFACEPROC_5d98b8f5), nil -} - -func (x PFNEGLGETCURRENTSURFACEPROC) PassValue() (ref C.PFNEGLGETCURRENTSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETCURRENTSURFACEPROC5D98B8F5Func == nil { - pFNEGLGETCURRENTSURFACEPROC5D98B8F5Func = x - } - return (C.PFNEGLGETCURRENTSURFACEPROC)(C.PFNEGLGETCURRENTSURFACEPROC_5d98b8f5), nil -} - -func NewPFNEGLGETCURRENTSURFACEPROCRef(ref unsafe.Pointer) *PFNEGLGETCURRENTSURFACEPROC { - return (*PFNEGLGETCURRENTSURFACEPROC)(ref) -} - -//export PFNEGLGETCURRENTSURFACEPROC5D98B8F5 -func PFNEGLGETCURRENTSURFACEPROC5D98B8F5() { - if pFNEGLGETCURRENTSURFACEPROC5D98B8F5Func != nil { - pFNEGLGETCURRENTSURFACEPROC5D98B8F5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETCURRENTSURFACEPROC5D98B8F5Func PFNEGLGETCURRENTSURFACEPROC - -func (x PFNEGLGETDISPLAYPROC) PassRef() (ref *C.PFNEGLGETDISPLAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETDISPLAYPROC61844E7EFunc == nil { - pFNEGLGETDISPLAYPROC61844E7EFunc = x - } - return (*C.PFNEGLGETDISPLAYPROC)(C.PFNEGLGETDISPLAYPROC_61844e7e), nil -} - -func (x PFNEGLGETDISPLAYPROC) PassValue() (ref C.PFNEGLGETDISPLAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETDISPLAYPROC61844E7EFunc == nil { - pFNEGLGETDISPLAYPROC61844E7EFunc = x - } - return (C.PFNEGLGETDISPLAYPROC)(C.PFNEGLGETDISPLAYPROC_61844e7e), nil -} - -func NewPFNEGLGETDISPLAYPROCRef(ref unsafe.Pointer) *PFNEGLGETDISPLAYPROC { - return (*PFNEGLGETDISPLAYPROC)(ref) -} - -//export PFNEGLGETDISPLAYPROC61844E7E -func PFNEGLGETDISPLAYPROC61844E7E() { - if pFNEGLGETDISPLAYPROC61844E7EFunc != nil { - pFNEGLGETDISPLAYPROC61844E7EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETDISPLAYPROC61844E7EFunc PFNEGLGETDISPLAYPROC - -func (x PFNEGLGETERRORPROC) PassRef() (ref *C.PFNEGLGETERRORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETERRORPROC10983CC3Func == nil { - pFNEGLGETERRORPROC10983CC3Func = x - } - return (*C.PFNEGLGETERRORPROC)(C.PFNEGLGETERRORPROC_10983cc3), nil -} - -func (x PFNEGLGETERRORPROC) PassValue() (ref C.PFNEGLGETERRORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETERRORPROC10983CC3Func == nil { - pFNEGLGETERRORPROC10983CC3Func = x - } - return (C.PFNEGLGETERRORPROC)(C.PFNEGLGETERRORPROC_10983cc3), nil -} - -func NewPFNEGLGETERRORPROCRef(ref unsafe.Pointer) *PFNEGLGETERRORPROC { - return (*PFNEGLGETERRORPROC)(ref) -} - -//export PFNEGLGETERRORPROC10983CC3 -func PFNEGLGETERRORPROC10983CC3() { - if pFNEGLGETERRORPROC10983CC3Func != nil { - pFNEGLGETERRORPROC10983CC3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETERRORPROC10983CC3Func PFNEGLGETERRORPROC - -func (x PFNEGLGETPLATFORMDISPLAYPROC) PassRef() (ref *C.PFNEGLGETPLATFORMDISPLAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETPLATFORMDISPLAYPROCD492A1CEFunc == nil { - pFNEGLGETPLATFORMDISPLAYPROCD492A1CEFunc = x - } - return (*C.PFNEGLGETPLATFORMDISPLAYPROC)(C.PFNEGLGETPLATFORMDISPLAYPROC_d492a1ce), nil -} - -func (x PFNEGLGETPLATFORMDISPLAYPROC) PassValue() (ref C.PFNEGLGETPLATFORMDISPLAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETPLATFORMDISPLAYPROCD492A1CEFunc == nil { - pFNEGLGETPLATFORMDISPLAYPROCD492A1CEFunc = x - } - return (C.PFNEGLGETPLATFORMDISPLAYPROC)(C.PFNEGLGETPLATFORMDISPLAYPROC_d492a1ce), nil -} - -func NewPFNEGLGETPLATFORMDISPLAYPROCRef(ref unsafe.Pointer) *PFNEGLGETPLATFORMDISPLAYPROC { - return (*PFNEGLGETPLATFORMDISPLAYPROC)(ref) -} - -//export PFNEGLGETPLATFORMDISPLAYPROCD492A1CE -func PFNEGLGETPLATFORMDISPLAYPROCD492A1CE() { - if pFNEGLGETPLATFORMDISPLAYPROCD492A1CEFunc != nil { - pFNEGLGETPLATFORMDISPLAYPROCD492A1CEFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETPLATFORMDISPLAYPROCD492A1CEFunc PFNEGLGETPLATFORMDISPLAYPROC - -func (x PFNEGLGETPROCADDRESSPROC) PassRef() (ref *C.PFNEGLGETPROCADDRESSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETPROCADDRESSPROC5DB88C70Func == nil { - pFNEGLGETPROCADDRESSPROC5DB88C70Func = x - } - return (*C.PFNEGLGETPROCADDRESSPROC)(C.PFNEGLGETPROCADDRESSPROC_5db88c70), nil -} - -func (x PFNEGLGETPROCADDRESSPROC) PassValue() (ref C.PFNEGLGETPROCADDRESSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETPROCADDRESSPROC5DB88C70Func == nil { - pFNEGLGETPROCADDRESSPROC5DB88C70Func = x - } - return (C.PFNEGLGETPROCADDRESSPROC)(C.PFNEGLGETPROCADDRESSPROC_5db88c70), nil -} - -func NewPFNEGLGETPROCADDRESSPROCRef(ref unsafe.Pointer) *PFNEGLGETPROCADDRESSPROC { - return (*PFNEGLGETPROCADDRESSPROC)(ref) -} - -//export PFNEGLGETPROCADDRESSPROC5DB88C70 -func PFNEGLGETPROCADDRESSPROC5DB88C70() { - if pFNEGLGETPROCADDRESSPROC5DB88C70Func != nil { - pFNEGLGETPROCADDRESSPROC5DB88C70Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETPROCADDRESSPROC5DB88C70Func PFNEGLGETPROCADDRESSPROC - -func (x PFNEGLGETSYNCATTRIBPROC) PassRef() (ref *C.PFNEGLGETSYNCATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETSYNCATTRIBPROC1222268FFunc == nil { - pFNEGLGETSYNCATTRIBPROC1222268FFunc = x - } - return (*C.PFNEGLGETSYNCATTRIBPROC)(C.PFNEGLGETSYNCATTRIBPROC_1222268f), nil -} - -func (x PFNEGLGETSYNCATTRIBPROC) PassValue() (ref C.PFNEGLGETSYNCATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLGETSYNCATTRIBPROC1222268FFunc == nil { - pFNEGLGETSYNCATTRIBPROC1222268FFunc = x - } - return (C.PFNEGLGETSYNCATTRIBPROC)(C.PFNEGLGETSYNCATTRIBPROC_1222268f), nil -} - -func NewPFNEGLGETSYNCATTRIBPROCRef(ref unsafe.Pointer) *PFNEGLGETSYNCATTRIBPROC { - return (*PFNEGLGETSYNCATTRIBPROC)(ref) -} - -//export PFNEGLGETSYNCATTRIBPROC1222268F -func PFNEGLGETSYNCATTRIBPROC1222268F() { - if pFNEGLGETSYNCATTRIBPROC1222268FFunc != nil { - pFNEGLGETSYNCATTRIBPROC1222268FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLGETSYNCATTRIBPROC1222268FFunc PFNEGLGETSYNCATTRIBPROC - -func (x PFNEGLINITIALIZEPROC) PassRef() (ref *C.PFNEGLINITIALIZEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLINITIALIZEPROCCFCB1EF4Func == nil { - pFNEGLINITIALIZEPROCCFCB1EF4Func = x - } - return (*C.PFNEGLINITIALIZEPROC)(C.PFNEGLINITIALIZEPROC_cfcb1ef4), nil -} - -func (x PFNEGLINITIALIZEPROC) PassValue() (ref C.PFNEGLINITIALIZEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLINITIALIZEPROCCFCB1EF4Func == nil { - pFNEGLINITIALIZEPROCCFCB1EF4Func = x - } - return (C.PFNEGLINITIALIZEPROC)(C.PFNEGLINITIALIZEPROC_cfcb1ef4), nil -} - -func NewPFNEGLINITIALIZEPROCRef(ref unsafe.Pointer) *PFNEGLINITIALIZEPROC { - return (*PFNEGLINITIALIZEPROC)(ref) -} - -//export PFNEGLINITIALIZEPROCCFCB1EF4 -func PFNEGLINITIALIZEPROCCFCB1EF4() { - if pFNEGLINITIALIZEPROCCFCB1EF4Func != nil { - pFNEGLINITIALIZEPROCCFCB1EF4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLINITIALIZEPROCCFCB1EF4Func PFNEGLINITIALIZEPROC - -func (x PFNEGLMAKECURRENTPROC) PassRef() (ref *C.PFNEGLMAKECURRENTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLMAKECURRENTPROC19A41961Func == nil { - pFNEGLMAKECURRENTPROC19A41961Func = x - } - return (*C.PFNEGLMAKECURRENTPROC)(C.PFNEGLMAKECURRENTPROC_19a41961), nil -} - -func (x PFNEGLMAKECURRENTPROC) PassValue() (ref C.PFNEGLMAKECURRENTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLMAKECURRENTPROC19A41961Func == nil { - pFNEGLMAKECURRENTPROC19A41961Func = x - } - return (C.PFNEGLMAKECURRENTPROC)(C.PFNEGLMAKECURRENTPROC_19a41961), nil -} - -func NewPFNEGLMAKECURRENTPROCRef(ref unsafe.Pointer) *PFNEGLMAKECURRENTPROC { - return (*PFNEGLMAKECURRENTPROC)(ref) -} - -//export PFNEGLMAKECURRENTPROC19A41961 -func PFNEGLMAKECURRENTPROC19A41961() { - if pFNEGLMAKECURRENTPROC19A41961Func != nil { - pFNEGLMAKECURRENTPROC19A41961Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLMAKECURRENTPROC19A41961Func PFNEGLMAKECURRENTPROC - -func (x PFNEGLQUERYAPIPROC) PassRef() (ref *C.PFNEGLQUERYAPIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLQUERYAPIPROC3C747AA8Func == nil { - pFNEGLQUERYAPIPROC3C747AA8Func = x - } - return (*C.PFNEGLQUERYAPIPROC)(C.PFNEGLQUERYAPIPROC_3c747aa8), nil -} - -func (x PFNEGLQUERYAPIPROC) PassValue() (ref C.PFNEGLQUERYAPIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLQUERYAPIPROC3C747AA8Func == nil { - pFNEGLQUERYAPIPROC3C747AA8Func = x - } - return (C.PFNEGLQUERYAPIPROC)(C.PFNEGLQUERYAPIPROC_3c747aa8), nil -} - -func NewPFNEGLQUERYAPIPROCRef(ref unsafe.Pointer) *PFNEGLQUERYAPIPROC { - return (*PFNEGLQUERYAPIPROC)(ref) -} - -//export PFNEGLQUERYAPIPROC3C747AA8 -func PFNEGLQUERYAPIPROC3C747AA8() { - if pFNEGLQUERYAPIPROC3C747AA8Func != nil { - pFNEGLQUERYAPIPROC3C747AA8Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLQUERYAPIPROC3C747AA8Func PFNEGLQUERYAPIPROC - -func (x PFNEGLQUERYCONTEXTPROC) PassRef() (ref *C.PFNEGLQUERYCONTEXTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLQUERYCONTEXTPROC2FE21B94Func == nil { - pFNEGLQUERYCONTEXTPROC2FE21B94Func = x - } - return (*C.PFNEGLQUERYCONTEXTPROC)(C.PFNEGLQUERYCONTEXTPROC_2fe21b94), nil -} - -func (x PFNEGLQUERYCONTEXTPROC) PassValue() (ref C.PFNEGLQUERYCONTEXTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLQUERYCONTEXTPROC2FE21B94Func == nil { - pFNEGLQUERYCONTEXTPROC2FE21B94Func = x - } - return (C.PFNEGLQUERYCONTEXTPROC)(C.PFNEGLQUERYCONTEXTPROC_2fe21b94), nil -} - -func NewPFNEGLQUERYCONTEXTPROCRef(ref unsafe.Pointer) *PFNEGLQUERYCONTEXTPROC { - return (*PFNEGLQUERYCONTEXTPROC)(ref) -} - -//export PFNEGLQUERYCONTEXTPROC2FE21B94 -func PFNEGLQUERYCONTEXTPROC2FE21B94() { - if pFNEGLQUERYCONTEXTPROC2FE21B94Func != nil { - pFNEGLQUERYCONTEXTPROC2FE21B94Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLQUERYCONTEXTPROC2FE21B94Func PFNEGLQUERYCONTEXTPROC - -func (x PFNEGLQUERYSTRINGPROC) PassRef() (ref *C.PFNEGLQUERYSTRINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLQUERYSTRINGPROC0DD98293Func == nil { - pFNEGLQUERYSTRINGPROC0DD98293Func = x - } - return (*C.PFNEGLQUERYSTRINGPROC)(C.PFNEGLQUERYSTRINGPROC_0dd98293), nil -} - -func (x PFNEGLQUERYSTRINGPROC) PassValue() (ref C.PFNEGLQUERYSTRINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLQUERYSTRINGPROC0DD98293Func == nil { - pFNEGLQUERYSTRINGPROC0DD98293Func = x - } - return (C.PFNEGLQUERYSTRINGPROC)(C.PFNEGLQUERYSTRINGPROC_0dd98293), nil -} - -func NewPFNEGLQUERYSTRINGPROCRef(ref unsafe.Pointer) *PFNEGLQUERYSTRINGPROC { - return (*PFNEGLQUERYSTRINGPROC)(ref) -} - -//export PFNEGLQUERYSTRINGPROC0DD98293 -func PFNEGLQUERYSTRINGPROC0DD98293() { - if pFNEGLQUERYSTRINGPROC0DD98293Func != nil { - pFNEGLQUERYSTRINGPROC0DD98293Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLQUERYSTRINGPROC0DD98293Func PFNEGLQUERYSTRINGPROC - -func (x PFNEGLQUERYSURFACEPROC) PassRef() (ref *C.PFNEGLQUERYSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLQUERYSURFACEPROC0CDDE568Func == nil { - pFNEGLQUERYSURFACEPROC0CDDE568Func = x - } - return (*C.PFNEGLQUERYSURFACEPROC)(C.PFNEGLQUERYSURFACEPROC_0cdde568), nil -} - -func (x PFNEGLQUERYSURFACEPROC) PassValue() (ref C.PFNEGLQUERYSURFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLQUERYSURFACEPROC0CDDE568Func == nil { - pFNEGLQUERYSURFACEPROC0CDDE568Func = x - } - return (C.PFNEGLQUERYSURFACEPROC)(C.PFNEGLQUERYSURFACEPROC_0cdde568), nil -} - -func NewPFNEGLQUERYSURFACEPROCRef(ref unsafe.Pointer) *PFNEGLQUERYSURFACEPROC { - return (*PFNEGLQUERYSURFACEPROC)(ref) -} - -//export PFNEGLQUERYSURFACEPROC0CDDE568 -func PFNEGLQUERYSURFACEPROC0CDDE568() { - if pFNEGLQUERYSURFACEPROC0CDDE568Func != nil { - pFNEGLQUERYSURFACEPROC0CDDE568Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLQUERYSURFACEPROC0CDDE568Func PFNEGLQUERYSURFACEPROC - -func (x PFNEGLRELEASETEXIMAGEPROC) PassRef() (ref *C.PFNEGLRELEASETEXIMAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLRELEASETEXIMAGEPROCFE8D1EDFFunc == nil { - pFNEGLRELEASETEXIMAGEPROCFE8D1EDFFunc = x - } - return (*C.PFNEGLRELEASETEXIMAGEPROC)(C.PFNEGLRELEASETEXIMAGEPROC_fe8d1edf), nil -} - -func (x PFNEGLRELEASETEXIMAGEPROC) PassValue() (ref C.PFNEGLRELEASETEXIMAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLRELEASETEXIMAGEPROCFE8D1EDFFunc == nil { - pFNEGLRELEASETEXIMAGEPROCFE8D1EDFFunc = x - } - return (C.PFNEGLRELEASETEXIMAGEPROC)(C.PFNEGLRELEASETEXIMAGEPROC_fe8d1edf), nil -} - -func NewPFNEGLRELEASETEXIMAGEPROCRef(ref unsafe.Pointer) *PFNEGLRELEASETEXIMAGEPROC { - return (*PFNEGLRELEASETEXIMAGEPROC)(ref) -} - -//export PFNEGLRELEASETEXIMAGEPROCFE8D1EDF -func PFNEGLRELEASETEXIMAGEPROCFE8D1EDF() { - if pFNEGLRELEASETEXIMAGEPROCFE8D1EDFFunc != nil { - pFNEGLRELEASETEXIMAGEPROCFE8D1EDFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLRELEASETEXIMAGEPROCFE8D1EDFFunc PFNEGLRELEASETEXIMAGEPROC - -func (x PFNEGLRELEASETHREADPROC) PassRef() (ref *C.PFNEGLRELEASETHREADPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLRELEASETHREADPROC86CEEBE4Func == nil { - pFNEGLRELEASETHREADPROC86CEEBE4Func = x - } - return (*C.PFNEGLRELEASETHREADPROC)(C.PFNEGLRELEASETHREADPROC_86ceebe4), nil -} - -func (x PFNEGLRELEASETHREADPROC) PassValue() (ref C.PFNEGLRELEASETHREADPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLRELEASETHREADPROC86CEEBE4Func == nil { - pFNEGLRELEASETHREADPROC86CEEBE4Func = x - } - return (C.PFNEGLRELEASETHREADPROC)(C.PFNEGLRELEASETHREADPROC_86ceebe4), nil -} - -func NewPFNEGLRELEASETHREADPROCRef(ref unsafe.Pointer) *PFNEGLRELEASETHREADPROC { - return (*PFNEGLRELEASETHREADPROC)(ref) -} - -//export PFNEGLRELEASETHREADPROC86CEEBE4 -func PFNEGLRELEASETHREADPROC86CEEBE4() { - if pFNEGLRELEASETHREADPROC86CEEBE4Func != nil { - pFNEGLRELEASETHREADPROC86CEEBE4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLRELEASETHREADPROC86CEEBE4Func PFNEGLRELEASETHREADPROC - -func (x PFNEGLSURFACEATTRIBPROC) PassRef() (ref *C.PFNEGLSURFACEATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLSURFACEATTRIBPROC6E975BB9Func == nil { - pFNEGLSURFACEATTRIBPROC6E975BB9Func = x - } - return (*C.PFNEGLSURFACEATTRIBPROC)(C.PFNEGLSURFACEATTRIBPROC_6e975bb9), nil -} - -func (x PFNEGLSURFACEATTRIBPROC) PassValue() (ref C.PFNEGLSURFACEATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLSURFACEATTRIBPROC6E975BB9Func == nil { - pFNEGLSURFACEATTRIBPROC6E975BB9Func = x - } - return (C.PFNEGLSURFACEATTRIBPROC)(C.PFNEGLSURFACEATTRIBPROC_6e975bb9), nil -} - -func NewPFNEGLSURFACEATTRIBPROCRef(ref unsafe.Pointer) *PFNEGLSURFACEATTRIBPROC { - return (*PFNEGLSURFACEATTRIBPROC)(ref) -} - -//export PFNEGLSURFACEATTRIBPROC6E975BB9 -func PFNEGLSURFACEATTRIBPROC6E975BB9() { - if pFNEGLSURFACEATTRIBPROC6E975BB9Func != nil { - pFNEGLSURFACEATTRIBPROC6E975BB9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLSURFACEATTRIBPROC6E975BB9Func PFNEGLSURFACEATTRIBPROC - -func (x PFNEGLSWAPBUFFERSPROC) PassRef() (ref *C.PFNEGLSWAPBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLSWAPBUFFERSPROC94E02DCFFunc == nil { - pFNEGLSWAPBUFFERSPROC94E02DCFFunc = x - } - return (*C.PFNEGLSWAPBUFFERSPROC)(C.PFNEGLSWAPBUFFERSPROC_94e02dcf), nil -} - -func (x PFNEGLSWAPBUFFERSPROC) PassValue() (ref C.PFNEGLSWAPBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLSWAPBUFFERSPROC94E02DCFFunc == nil { - pFNEGLSWAPBUFFERSPROC94E02DCFFunc = x - } - return (C.PFNEGLSWAPBUFFERSPROC)(C.PFNEGLSWAPBUFFERSPROC_94e02dcf), nil -} - -func NewPFNEGLSWAPBUFFERSPROCRef(ref unsafe.Pointer) *PFNEGLSWAPBUFFERSPROC { - return (*PFNEGLSWAPBUFFERSPROC)(ref) -} - -//export PFNEGLSWAPBUFFERSPROC94E02DCF -func PFNEGLSWAPBUFFERSPROC94E02DCF() { - if pFNEGLSWAPBUFFERSPROC94E02DCFFunc != nil { - pFNEGLSWAPBUFFERSPROC94E02DCFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLSWAPBUFFERSPROC94E02DCFFunc PFNEGLSWAPBUFFERSPROC - -func (x PFNEGLSWAPINTERVALPROC) PassRef() (ref *C.PFNEGLSWAPINTERVALPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLSWAPINTERVALPROC3F477745Func == nil { - pFNEGLSWAPINTERVALPROC3F477745Func = x - } - return (*C.PFNEGLSWAPINTERVALPROC)(C.PFNEGLSWAPINTERVALPROC_3f477745), nil -} - -func (x PFNEGLSWAPINTERVALPROC) PassValue() (ref C.PFNEGLSWAPINTERVALPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLSWAPINTERVALPROC3F477745Func == nil { - pFNEGLSWAPINTERVALPROC3F477745Func = x - } - return (C.PFNEGLSWAPINTERVALPROC)(C.PFNEGLSWAPINTERVALPROC_3f477745), nil -} - -func NewPFNEGLSWAPINTERVALPROCRef(ref unsafe.Pointer) *PFNEGLSWAPINTERVALPROC { - return (*PFNEGLSWAPINTERVALPROC)(ref) -} - -//export PFNEGLSWAPINTERVALPROC3F477745 -func PFNEGLSWAPINTERVALPROC3F477745() { - if pFNEGLSWAPINTERVALPROC3F477745Func != nil { - pFNEGLSWAPINTERVALPROC3F477745Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLSWAPINTERVALPROC3F477745Func PFNEGLSWAPINTERVALPROC - -func (x PFNEGLTERMINATEPROC) PassRef() (ref *C.PFNEGLTERMINATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLTERMINATEPROCA44ED111Func == nil { - pFNEGLTERMINATEPROCA44ED111Func = x - } - return (*C.PFNEGLTERMINATEPROC)(C.PFNEGLTERMINATEPROC_a44ed111), nil -} - -func (x PFNEGLTERMINATEPROC) PassValue() (ref C.PFNEGLTERMINATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLTERMINATEPROCA44ED111Func == nil { - pFNEGLTERMINATEPROCA44ED111Func = x - } - return (C.PFNEGLTERMINATEPROC)(C.PFNEGLTERMINATEPROC_a44ed111), nil -} - -func NewPFNEGLTERMINATEPROCRef(ref unsafe.Pointer) *PFNEGLTERMINATEPROC { - return (*PFNEGLTERMINATEPROC)(ref) -} - -//export PFNEGLTERMINATEPROCA44ED111 -func PFNEGLTERMINATEPROCA44ED111() { - if pFNEGLTERMINATEPROCA44ED111Func != nil { - pFNEGLTERMINATEPROCA44ED111Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLTERMINATEPROCA44ED111Func PFNEGLTERMINATEPROC - -func (x PFNEGLWAITCLIENTPROC) PassRef() (ref *C.PFNEGLWAITCLIENTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLWAITCLIENTPROC711D0475Func == nil { - pFNEGLWAITCLIENTPROC711D0475Func = x - } - return (*C.PFNEGLWAITCLIENTPROC)(C.PFNEGLWAITCLIENTPROC_711d0475), nil -} - -func (x PFNEGLWAITCLIENTPROC) PassValue() (ref C.PFNEGLWAITCLIENTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLWAITCLIENTPROC711D0475Func == nil { - pFNEGLWAITCLIENTPROC711D0475Func = x - } - return (C.PFNEGLWAITCLIENTPROC)(C.PFNEGLWAITCLIENTPROC_711d0475), nil -} - -func NewPFNEGLWAITCLIENTPROCRef(ref unsafe.Pointer) *PFNEGLWAITCLIENTPROC { - return (*PFNEGLWAITCLIENTPROC)(ref) -} - -//export PFNEGLWAITCLIENTPROC711D0475 -func PFNEGLWAITCLIENTPROC711D0475() { - if pFNEGLWAITCLIENTPROC711D0475Func != nil { - pFNEGLWAITCLIENTPROC711D0475Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLWAITCLIENTPROC711D0475Func PFNEGLWAITCLIENTPROC - -func (x PFNEGLWAITGLPROC) PassRef() (ref *C.PFNEGLWAITGLPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLWAITGLPROC2B163E1BFunc == nil { - pFNEGLWAITGLPROC2B163E1BFunc = x - } - return (*C.PFNEGLWAITGLPROC)(C.PFNEGLWAITGLPROC_2b163e1b), nil -} - -func (x PFNEGLWAITGLPROC) PassValue() (ref C.PFNEGLWAITGLPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLWAITGLPROC2B163E1BFunc == nil { - pFNEGLWAITGLPROC2B163E1BFunc = x - } - return (C.PFNEGLWAITGLPROC)(C.PFNEGLWAITGLPROC_2b163e1b), nil -} - -func NewPFNEGLWAITGLPROCRef(ref unsafe.Pointer) *PFNEGLWAITGLPROC { - return (*PFNEGLWAITGLPROC)(ref) -} - -//export PFNEGLWAITGLPROC2B163E1B -func PFNEGLWAITGLPROC2B163E1B() { - if pFNEGLWAITGLPROC2B163E1BFunc != nil { - pFNEGLWAITGLPROC2B163E1BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLWAITGLPROC2B163E1BFunc PFNEGLWAITGLPROC - -func (x PFNEGLWAITNATIVEPROC) PassRef() (ref *C.PFNEGLWAITNATIVEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLWAITNATIVEPROC0A74E00EFunc == nil { - pFNEGLWAITNATIVEPROC0A74E00EFunc = x - } - return (*C.PFNEGLWAITNATIVEPROC)(C.PFNEGLWAITNATIVEPROC_0a74e00e), nil -} - -func (x PFNEGLWAITNATIVEPROC) PassValue() (ref C.PFNEGLWAITNATIVEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLWAITNATIVEPROC0A74E00EFunc == nil { - pFNEGLWAITNATIVEPROC0A74E00EFunc = x - } - return (C.PFNEGLWAITNATIVEPROC)(C.PFNEGLWAITNATIVEPROC_0a74e00e), nil -} - -func NewPFNEGLWAITNATIVEPROCRef(ref unsafe.Pointer) *PFNEGLWAITNATIVEPROC { - return (*PFNEGLWAITNATIVEPROC)(ref) -} - -//export PFNEGLWAITNATIVEPROC0A74E00E -func PFNEGLWAITNATIVEPROC0A74E00E() { - if pFNEGLWAITNATIVEPROC0A74E00EFunc != nil { - pFNEGLWAITNATIVEPROC0A74E00EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLWAITNATIVEPROC0A74E00EFunc PFNEGLWAITNATIVEPROC - -func (x PFNEGLWAITSYNCPROC) PassRef() (ref *C.PFNEGLWAITSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLWAITSYNCPROC689AF046Func == nil { - pFNEGLWAITSYNCPROC689AF046Func = x - } - return (*C.PFNEGLWAITSYNCPROC)(C.PFNEGLWAITSYNCPROC_689af046), nil -} - -func (x PFNEGLWAITSYNCPROC) PassValue() (ref C.PFNEGLWAITSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNEGLWAITSYNCPROC689AF046Func == nil { - pFNEGLWAITSYNCPROC689AF046Func = x - } - return (C.PFNEGLWAITSYNCPROC)(C.PFNEGLWAITSYNCPROC_689af046), nil -} - -func NewPFNEGLWAITSYNCPROCRef(ref unsafe.Pointer) *PFNEGLWAITSYNCPROC { - return (*PFNEGLWAITSYNCPROC)(ref) -} - -//export PFNEGLWAITSYNCPROC689AF046 -func PFNEGLWAITSYNCPROC689AF046() { - if pFNEGLWAITSYNCPROC689AF046Func != nil { - pFNEGLWAITSYNCPROC689AF046Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNEGLWAITSYNCPROC689AF046Func PFNEGLWAITSYNCPROC - -func (x EglMustCastToProperFunctionPointerType) PassRef() (ref *C.__eglMustCastToProperFunctionPointerType, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if eglMustCastToProperFunctionPointerType6489F97CFunc == nil { - eglMustCastToProperFunctionPointerType6489F97CFunc = x - } - return (*C.__eglMustCastToProperFunctionPointerType)(C.__eglMustCastToProperFunctionPointerType_6489f97c), nil -} - -func (x EglMustCastToProperFunctionPointerType) PassValue() (ref C.__eglMustCastToProperFunctionPointerType, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if eglMustCastToProperFunctionPointerType6489F97CFunc == nil { - eglMustCastToProperFunctionPointerType6489F97CFunc = x - } - return (C.__eglMustCastToProperFunctionPointerType)(C.__eglMustCastToProperFunctionPointerType_6489f97c), nil -} - -func NewEglMustCastToProperFunctionPointerTypeRef(ref unsafe.Pointer) *EglMustCastToProperFunctionPointerType { - return (*EglMustCastToProperFunctionPointerType)(ref) -} - -//export EglMustCastToProperFunctionPointerType6489F97C -func EglMustCastToProperFunctionPointerType6489F97C() { - if eglMustCastToProperFunctionPointerType6489F97CFunc != nil { - eglMustCastToProperFunctionPointerType6489F97CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var eglMustCastToProperFunctionPointerType6489F97CFunc EglMustCastToProperFunctionPointerType - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/egl/cgo_helpers.h b/capi/egl/cgo_helpers.h deleted file mode 100644 index b59cf03..0000000 --- a/capi/egl/cgo_helpers.h +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "EGL/egl.h" -#include "android/native_window.h" -#include -#pragma once - -#define __CGOGEN 1 - -// PFNEGLBINDAPIPROC_52ac6fbf is a proxy for callback PFNEGLBINDAPIPROC. -void PFNEGLBINDAPIPROC_52ac6fbf(); - -// PFNEGLBINDTEXIMAGEPROC_782e9eaf is a proxy for callback PFNEGLBINDTEXIMAGEPROC. -void PFNEGLBINDTEXIMAGEPROC_782e9eaf(); - -// PFNEGLCHOOSECONFIGPROC_484bf5bc is a proxy for callback PFNEGLCHOOSECONFIGPROC. -void PFNEGLCHOOSECONFIGPROC_484bf5bc(); - -// PFNEGLCLIENTWAITSYNCPROC_b3af6d25 is a proxy for callback PFNEGLCLIENTWAITSYNCPROC. -void PFNEGLCLIENTWAITSYNCPROC_b3af6d25(); - -// PFNEGLCOPYBUFFERSPROC_8518aff3 is a proxy for callback PFNEGLCOPYBUFFERSPROC. -void PFNEGLCOPYBUFFERSPROC_8518aff3(); - -// PFNEGLCREATECONTEXTPROC_71dbbcd5 is a proxy for callback PFNEGLCREATECONTEXTPROC. -void PFNEGLCREATECONTEXTPROC_71dbbcd5(); - -// PFNEGLCREATEIMAGEPROC_623c290a is a proxy for callback PFNEGLCREATEIMAGEPROC. -void PFNEGLCREATEIMAGEPROC_623c290a(); - -// PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC_5a67e3d4 is a proxy for callback PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC. -void PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC_5a67e3d4(); - -// PFNEGLCREATEPBUFFERSURFACEPROC_fb9d4742 is a proxy for callback PFNEGLCREATEPBUFFERSURFACEPROC. -void PFNEGLCREATEPBUFFERSURFACEPROC_fb9d4742(); - -// PFNEGLCREATEPIXMAPSURFACEPROC_3bcccba7 is a proxy for callback PFNEGLCREATEPIXMAPSURFACEPROC. -void PFNEGLCREATEPIXMAPSURFACEPROC_3bcccba7(); - -// PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC_1e44353a is a proxy for callback PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC. -void PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC_1e44353a(); - -// PFNEGLCREATEPLATFORMWINDOWSURFACEPROC_1fc5eb8a is a proxy for callback PFNEGLCREATEPLATFORMWINDOWSURFACEPROC. -void PFNEGLCREATEPLATFORMWINDOWSURFACEPROC_1fc5eb8a(); - -// PFNEGLCREATESYNCPROC_590600b6 is a proxy for callback PFNEGLCREATESYNCPROC. -void PFNEGLCREATESYNCPROC_590600b6(); - -// PFNEGLCREATEWINDOWSURFACEPROC_916262c6 is a proxy for callback PFNEGLCREATEWINDOWSURFACEPROC. -void PFNEGLCREATEWINDOWSURFACEPROC_916262c6(); - -// PFNEGLDESTROYCONTEXTPROC_2c220a54 is a proxy for callback PFNEGLDESTROYCONTEXTPROC. -void PFNEGLDESTROYCONTEXTPROC_2c220a54(); - -// PFNEGLDESTROYIMAGEPROC_05031d5f is a proxy for callback PFNEGLDESTROYIMAGEPROC. -void PFNEGLDESTROYIMAGEPROC_05031d5f(); - -// PFNEGLDESTROYSURFACEPROC_1403708c is a proxy for callback PFNEGLDESTROYSURFACEPROC. -void PFNEGLDESTROYSURFACEPROC_1403708c(); - -// PFNEGLDESTROYSYNCPROC_8777522d is a proxy for callback PFNEGLDESTROYSYNCPROC. -void PFNEGLDESTROYSYNCPROC_8777522d(); - -// PFNEGLGETCONFIGATTRIBPROC_bc287298 is a proxy for callback PFNEGLGETCONFIGATTRIBPROC. -void PFNEGLGETCONFIGATTRIBPROC_bc287298(); - -// PFNEGLGETCONFIGSPROC_f08cd467 is a proxy for callback PFNEGLGETCONFIGSPROC. -void PFNEGLGETCONFIGSPROC_f08cd467(); - -// PFNEGLGETCURRENTCONTEXTPROC_7799ca1d is a proxy for callback PFNEGLGETCURRENTCONTEXTPROC. -void PFNEGLGETCURRENTCONTEXTPROC_7799ca1d(); - -// PFNEGLGETCURRENTDISPLAYPROC_de7bb48c is a proxy for callback PFNEGLGETCURRENTDISPLAYPROC. -void PFNEGLGETCURRENTDISPLAYPROC_de7bb48c(); - -// PFNEGLGETCURRENTSURFACEPROC_5d98b8f5 is a proxy for callback PFNEGLGETCURRENTSURFACEPROC. -void PFNEGLGETCURRENTSURFACEPROC_5d98b8f5(); - -// PFNEGLGETDISPLAYPROC_61844e7e is a proxy for callback PFNEGLGETDISPLAYPROC. -void PFNEGLGETDISPLAYPROC_61844e7e(); - -// PFNEGLGETERRORPROC_10983cc3 is a proxy for callback PFNEGLGETERRORPROC. -void PFNEGLGETERRORPROC_10983cc3(); - -// PFNEGLGETPLATFORMDISPLAYPROC_d492a1ce is a proxy for callback PFNEGLGETPLATFORMDISPLAYPROC. -void PFNEGLGETPLATFORMDISPLAYPROC_d492a1ce(); - -// PFNEGLGETPROCADDRESSPROC_5db88c70 is a proxy for callback PFNEGLGETPROCADDRESSPROC. -void PFNEGLGETPROCADDRESSPROC_5db88c70(); - -// PFNEGLGETSYNCATTRIBPROC_1222268f is a proxy for callback PFNEGLGETSYNCATTRIBPROC. -void PFNEGLGETSYNCATTRIBPROC_1222268f(); - -// PFNEGLINITIALIZEPROC_cfcb1ef4 is a proxy for callback PFNEGLINITIALIZEPROC. -void PFNEGLINITIALIZEPROC_cfcb1ef4(); - -// PFNEGLMAKECURRENTPROC_19a41961 is a proxy for callback PFNEGLMAKECURRENTPROC. -void PFNEGLMAKECURRENTPROC_19a41961(); - -// PFNEGLQUERYAPIPROC_3c747aa8 is a proxy for callback PFNEGLQUERYAPIPROC. -void PFNEGLQUERYAPIPROC_3c747aa8(); - -// PFNEGLQUERYCONTEXTPROC_2fe21b94 is a proxy for callback PFNEGLQUERYCONTEXTPROC. -void PFNEGLQUERYCONTEXTPROC_2fe21b94(); - -// PFNEGLQUERYSTRINGPROC_0dd98293 is a proxy for callback PFNEGLQUERYSTRINGPROC. -void PFNEGLQUERYSTRINGPROC_0dd98293(); - -// PFNEGLQUERYSURFACEPROC_0cdde568 is a proxy for callback PFNEGLQUERYSURFACEPROC. -void PFNEGLQUERYSURFACEPROC_0cdde568(); - -// PFNEGLRELEASETEXIMAGEPROC_fe8d1edf is a proxy for callback PFNEGLRELEASETEXIMAGEPROC. -void PFNEGLRELEASETEXIMAGEPROC_fe8d1edf(); - -// PFNEGLRELEASETHREADPROC_86ceebe4 is a proxy for callback PFNEGLRELEASETHREADPROC. -void PFNEGLRELEASETHREADPROC_86ceebe4(); - -// PFNEGLSURFACEATTRIBPROC_6e975bb9 is a proxy for callback PFNEGLSURFACEATTRIBPROC. -void PFNEGLSURFACEATTRIBPROC_6e975bb9(); - -// PFNEGLSWAPBUFFERSPROC_94e02dcf is a proxy for callback PFNEGLSWAPBUFFERSPROC. -void PFNEGLSWAPBUFFERSPROC_94e02dcf(); - -// PFNEGLSWAPINTERVALPROC_3f477745 is a proxy for callback PFNEGLSWAPINTERVALPROC. -void PFNEGLSWAPINTERVALPROC_3f477745(); - -// PFNEGLTERMINATEPROC_a44ed111 is a proxy for callback PFNEGLTERMINATEPROC. -void PFNEGLTERMINATEPROC_a44ed111(); - -// PFNEGLWAITCLIENTPROC_711d0475 is a proxy for callback PFNEGLWAITCLIENTPROC. -void PFNEGLWAITCLIENTPROC_711d0475(); - -// PFNEGLWAITGLPROC_2b163e1b is a proxy for callback PFNEGLWAITGLPROC. -void PFNEGLWAITGLPROC_2b163e1b(); - -// PFNEGLWAITNATIVEPROC_0a74e00e is a proxy for callback PFNEGLWAITNATIVEPROC. -void PFNEGLWAITNATIVEPROC_0a74e00e(); - -// PFNEGLWAITSYNCPROC_689af046 is a proxy for callback PFNEGLWAITSYNCPROC. -void PFNEGLWAITSYNCPROC_689af046(); - -// __eglMustCastToProperFunctionPointerType_6489f97c is a proxy for callback __eglMustCastToProperFunctionPointerType. -void __eglMustCastToProperFunctionPointerType_6489f97c(); - diff --git a/capi/egl/const.go b/capi/egl/const.go deleted file mode 100644 index 6fdecc7..0000000 --- a/capi/egl/const.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package egl - -const ( - ANATIVEWINDOW_TRANSFORM_IDENTITY = 0 - ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL = 1 - ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL = 2 - ANATIVEWINDOW_TRANSFORM_ROTATE_90 = 4 - ANATIVEWINDOW_TRANSFORM_ROTATE_180 = 3 - ANATIVEWINDOW_TRANSFORM_ROTATE_270 = 7 -) - -const ( - ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS = 0 - ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS = 1 -) - -const ( - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT = 0 - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1 -) - -const ( - WINDOW_FORMAT_RGBA_8888 = 1 - WINDOW_FORMAT_RGBX_8888 = 2 - WINDOW_FORMAT_RGB_565 = 4 -) diff --git a/capi/egl/doc.go b/capi/egl/doc.go deleted file mode 100644 index 033647b..0000000 --- a/capi/egl/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for EGL -*/ -package egl diff --git a/capi/egl/egl.go b/capi/egl/egl.go deleted file mode 100644 index 958bdb7..0000000 --- a/capi/egl/egl.go +++ /dev/null @@ -1,643 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package egl - -/* -#cgo LDFLAGS: -lEGL -landroid -lnativewindow -#include "EGL/egl.h" -#include "android/native_window.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ANativeWindow_acquire(window *ANativeWindow) { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - C.ANativeWindow_acquire(cwindow) - runtime.KeepAlive(cwindowAllocMap) -} - -func ANativeWindow_getBuffersDataSpace(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getBuffersDataSpace(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_getBuffersDefaultDataSpace(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getBuffersDefaultDataSpace(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_getFormat(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getFormat(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_getHeight(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getHeight(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_getWidth(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getWidth(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_lock(window *ANativeWindow, outBuffer *ANativeWindow_Buffer, inOutDirtyBounds *ARect) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - coutBuffer, coutBufferAllocMap := (*C.ANativeWindow_Buffer)(unsafe.Pointer(outBuffer)), cgoAllocsUnknown - cinOutDirtyBounds, cinOutDirtyBoundsAllocMap := (*C.ARect)(unsafe.Pointer(inOutDirtyBounds)), cgoAllocsUnknown - __ret := C.ANativeWindow_lock(cwindow, coutBuffer, cinOutDirtyBounds) - runtime.KeepAlive(cinOutDirtyBoundsAllocMap) - runtime.KeepAlive(coutBufferAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_release(window *ANativeWindow) { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - C.ANativeWindow_release(cwindow) - runtime.KeepAlive(cwindowAllocMap) -} - -func ANativeWindow_setBuffersDataSpace(window *ANativeWindow, dataSpace int32) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - cdataSpace, cdataSpaceAllocMap := (C.int)(dataSpace), cgoAllocsUnknown - __ret := C.ANativeWindow_setBuffersDataSpace(cwindow, cdataSpace) - runtime.KeepAlive(cdataSpaceAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_setBuffersGeometry(window *ANativeWindow, width int32, height int32, format int32) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.int)(format), cgoAllocsUnknown - __ret := C.ANativeWindow_setBuffersGeometry(cwindow, cwidth, cheight, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_setBuffersTransform(window *ANativeWindow, transform int32) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - ctransform, ctransformAllocMap := (C.int)(transform), cgoAllocsUnknown - __ret := C.ANativeWindow_setBuffersTransform(cwindow, ctransform) - runtime.KeepAlive(ctransformAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_setFrameRate(window *ANativeWindow, frameRate float32, compatibility int8) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - cframeRate, cframeRateAllocMap := (C.float)(frameRate), cgoAllocsUnknown - ccompatibility, ccompatibilityAllocMap := (C.int8_t)(compatibility), cgoAllocsUnknown - __ret := C.ANativeWindow_setFrameRate(cwindow, cframeRate, ccompatibility) - runtime.KeepAlive(ccompatibilityAllocMap) - runtime.KeepAlive(cframeRateAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_setFrameRateWithChangeStrategy(window *ANativeWindow, frameRate float32, compatibility int8, changeFrameRateStrategy int8) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - cframeRate, cframeRateAllocMap := (C.float)(frameRate), cgoAllocsUnknown - ccompatibility, ccompatibilityAllocMap := (C.int8_t)(compatibility), cgoAllocsUnknown - cchangeFrameRateStrategy, cchangeFrameRateStrategyAllocMap := (C.int8_t)(changeFrameRateStrategy), cgoAllocsUnknown - __ret := C.ANativeWindow_setFrameRateWithChangeStrategy(cwindow, cframeRate, ccompatibility, cchangeFrameRateStrategy) - runtime.KeepAlive(cchangeFrameRateStrategyAllocMap) - runtime.KeepAlive(ccompatibilityAllocMap) - runtime.KeepAlive(cframeRateAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_tryAllocateBuffers(window *ANativeWindow) { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - C.ANativeWindow_tryAllocateBuffers(cwindow) - runtime.KeepAlive(cwindowAllocMap) -} - -func ANativeWindow_unlockAndPost(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_unlockAndPost(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func EglBindAPI(api EGLenum) EGLBoolean { - capi, capiAllocMap := (C.EGLenum)(api), cgoAllocsUnknown - __ret := C.eglBindAPI(capi) - runtime.KeepAlive(capiAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglBindTexImage(dpy EGLDisplay, surface EGLSurface, buffer EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csurface, csurfaceAllocMap := (C.EGLSurface)(surface), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (C.EGLint)(buffer), cgoAllocsUnknown - __ret := C.eglBindTexImage(cdpy, csurface, cbuffer) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglChooseConfig(dpy EGLDisplay, attrib_list *EGLint, configs *EGLConfig, config_size EGLint, num_config *EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLint)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - cconfigs, cconfigsAllocMap := (*C.EGLConfig)(unsafe.Pointer(configs)), cgoAllocsUnknown - cconfig_size, cconfig_sizeAllocMap := (C.EGLint)(config_size), cgoAllocsUnknown - cnum_config, cnum_configAllocMap := (*C.EGLint)(unsafe.Pointer(num_config)), cgoAllocsUnknown - __ret := C.eglChooseConfig(cdpy, cattrib_list, cconfigs, cconfig_size, cnum_config) - runtime.KeepAlive(cnum_configAllocMap) - runtime.KeepAlive(cconfig_sizeAllocMap) - runtime.KeepAlive(cconfigsAllocMap) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglClientWaitSync(dpy EGLDisplay, sync EGLSync, flags EGLint, timeout EGLTime) EGLint { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csync, csyncAllocMap := (C.EGLSync)(sync), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.EGLint)(flags), cgoAllocsUnknown - ctimeout, ctimeoutAllocMap := (C.EGLTime)(timeout), cgoAllocsUnknown - __ret := C.eglClientWaitSync(cdpy, csync, cflags, ctimeout) - runtime.KeepAlive(ctimeoutAllocMap) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(csyncAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLint)(__ret) - return __v -} - -func EglCopyBuffers(dpy EGLDisplay, surface EGLSurface, target EGLNativePixmapType) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csurface, csurfaceAllocMap := (C.EGLSurface)(surface), cgoAllocsUnknown - ctarget, ctargetAllocMap := (C.EGLNativePixmapType)(target), cgoAllocsUnknown - __ret := C.eglCopyBuffers(cdpy, csurface, ctarget) - runtime.KeepAlive(ctargetAllocMap) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglCreateContext(dpy EGLDisplay, config EGLConfig, share_context EGLContext, attrib_list *EGLint) EGLContext { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cconfig, cconfigAllocMap := (C.EGLConfig)(config), cgoAllocsUnknown - cshare_context, cshare_contextAllocMap := (C.EGLContext)(share_context), cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLint)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreateContext(cdpy, cconfig, cshare_context, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cshare_contextAllocMap) - runtime.KeepAlive(cconfigAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLContext)(__ret) - return __v -} - -func EglCreateImage(dpy EGLDisplay, ctx EGLContext, target EGLenum, buffer EGLClientBuffer, attrib_list *EGLAttrib) EGLImage { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cctx, cctxAllocMap := (C.EGLContext)(ctx), cgoAllocsUnknown - ctarget, ctargetAllocMap := (C.EGLenum)(target), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (C.EGLClientBuffer)(buffer), cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLAttrib)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreateImage(cdpy, cctx, ctarget, cbuffer, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(ctargetAllocMap) - runtime.KeepAlive(cctxAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLImage)(__ret) - return __v -} - -func EglCreatePbufferFromClientBuffer(dpy EGLDisplay, buftype EGLenum, buffer EGLClientBuffer, config EGLConfig, attrib_list *EGLint) EGLSurface { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cbuftype, cbuftypeAllocMap := (C.EGLenum)(buftype), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (C.EGLClientBuffer)(buffer), cgoAllocsUnknown - cconfig, cconfigAllocMap := (C.EGLConfig)(config), cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLint)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreatePbufferFromClientBuffer(cdpy, cbuftype, cbuffer, cconfig, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cconfigAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cbuftypeAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLSurface)(__ret) - return __v -} - -func EglCreatePbufferSurface(dpy EGLDisplay, config EGLConfig, attrib_list *EGLint) EGLSurface { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cconfig, cconfigAllocMap := (C.EGLConfig)(config), cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLint)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreatePbufferSurface(cdpy, cconfig, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cconfigAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLSurface)(__ret) - return __v -} - -func EglCreatePixmapSurface(dpy EGLDisplay, config EGLConfig, pixmap EGLNativePixmapType, attrib_list *EGLint) EGLSurface { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cconfig, cconfigAllocMap := (C.EGLConfig)(config), cgoAllocsUnknown - cpixmap, cpixmapAllocMap := (C.EGLNativePixmapType)(pixmap), cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLint)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreatePixmapSurface(cdpy, cconfig, cpixmap, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cpixmapAllocMap) - runtime.KeepAlive(cconfigAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLSurface)(__ret) - return __v -} - -func EglCreatePlatformPixmapSurface(dpy EGLDisplay, config EGLConfig, native_pixmap unsafe.Pointer, attrib_list *EGLAttrib) EGLSurface { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cconfig, cconfigAllocMap := (C.EGLConfig)(config), cgoAllocsUnknown - cnative_pixmap, cnative_pixmapAllocMap := native_pixmap, cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLAttrib)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreatePlatformPixmapSurface(cdpy, cconfig, cnative_pixmap, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cnative_pixmapAllocMap) - runtime.KeepAlive(cconfigAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLSurface)(__ret) - return __v -} - -func EglCreatePlatformWindowSurface(dpy EGLDisplay, config EGLConfig, native_window unsafe.Pointer, attrib_list *EGLAttrib) EGLSurface { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cconfig, cconfigAllocMap := (C.EGLConfig)(config), cgoAllocsUnknown - cnative_window, cnative_windowAllocMap := native_window, cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLAttrib)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreatePlatformWindowSurface(cdpy, cconfig, cnative_window, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cnative_windowAllocMap) - runtime.KeepAlive(cconfigAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLSurface)(__ret) - return __v -} - -func EglCreateSync(dpy EGLDisplay, _type EGLenum, attrib_list *EGLAttrib) EGLSync { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.EGLenum)(_type), cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLAttrib)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreateSync(cdpy, c_type, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLSync)(__ret) - return __v -} - -func EglCreateWindowSurface(dpy EGLDisplay, config EGLConfig, win EGLNativeWindowType, attrib_list *EGLint) EGLSurface { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cconfig, cconfigAllocMap := (C.EGLConfig)(config), cgoAllocsUnknown - cwin, cwinAllocMap := (C.EGLNativeWindowType)(win), cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLint)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglCreateWindowSurface(cdpy, cconfig, cwin, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cwinAllocMap) - runtime.KeepAlive(cconfigAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLSurface)(__ret) - return __v -} - -func EglDestroyContext(dpy EGLDisplay, ctx EGLContext) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cctx, cctxAllocMap := (C.EGLContext)(ctx), cgoAllocsUnknown - __ret := C.eglDestroyContext(cdpy, cctx) - runtime.KeepAlive(cctxAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglDestroyImage(dpy EGLDisplay, image EGLImage) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cimage, cimageAllocMap := (C.EGLImage)(image), cgoAllocsUnknown - __ret := C.eglDestroyImage(cdpy, cimage) - runtime.KeepAlive(cimageAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglDestroySurface(dpy EGLDisplay, surface EGLSurface) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csurface, csurfaceAllocMap := (C.EGLSurface)(surface), cgoAllocsUnknown - __ret := C.eglDestroySurface(cdpy, csurface) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglDestroySync(dpy EGLDisplay, sync EGLSync) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csync, csyncAllocMap := (C.EGLSync)(sync), cgoAllocsUnknown - __ret := C.eglDestroySync(cdpy, csync) - runtime.KeepAlive(csyncAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglGetConfigAttrib(dpy EGLDisplay, config EGLConfig, attribute EGLint, value *EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cconfig, cconfigAllocMap := (C.EGLConfig)(config), cgoAllocsUnknown - cattribute, cattributeAllocMap := (C.EGLint)(attribute), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.EGLint)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.eglGetConfigAttrib(cdpy, cconfig, cattribute, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cattributeAllocMap) - runtime.KeepAlive(cconfigAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglGetConfigs(dpy EGLDisplay, configs *EGLConfig, config_size EGLint, num_config *EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cconfigs, cconfigsAllocMap := (*C.EGLConfig)(unsafe.Pointer(configs)), cgoAllocsUnknown - cconfig_size, cconfig_sizeAllocMap := (C.EGLint)(config_size), cgoAllocsUnknown - cnum_config, cnum_configAllocMap := (*C.EGLint)(unsafe.Pointer(num_config)), cgoAllocsUnknown - __ret := C.eglGetConfigs(cdpy, cconfigs, cconfig_size, cnum_config) - runtime.KeepAlive(cnum_configAllocMap) - runtime.KeepAlive(cconfig_sizeAllocMap) - runtime.KeepAlive(cconfigsAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglGetCurrentContext() EGLContext { - __ret := C.eglGetCurrentContext() - __v := (EGLContext)(__ret) - return __v -} - -func EglGetCurrentDisplay() EGLDisplay { - __ret := C.eglGetCurrentDisplay() - __v := (EGLDisplay)(__ret) - return __v -} - -func EglGetCurrentSurface(readdraw EGLint) EGLSurface { - creaddraw, creaddrawAllocMap := (C.EGLint)(readdraw), cgoAllocsUnknown - __ret := C.eglGetCurrentSurface(creaddraw) - runtime.KeepAlive(creaddrawAllocMap) - __v := (EGLSurface)(__ret) - return __v -} - -func EglGetDisplay(display_id EGLNativeDisplayType) EGLDisplay { - cdisplay_id, cdisplay_idAllocMap := (C.EGLNativeDisplayType)(display_id), cgoAllocsUnknown - __ret := C.eglGetDisplay(cdisplay_id) - runtime.KeepAlive(cdisplay_idAllocMap) - __v := (EGLDisplay)(__ret) - return __v -} - -func EglGetError() EGLint { - __ret := C.eglGetError() - __v := (EGLint)(__ret) - return __v -} - -func EglGetPlatformDisplay(platform EGLenum, native_display unsafe.Pointer, attrib_list *EGLAttrib) EGLDisplay { - cplatform, cplatformAllocMap := (C.EGLenum)(platform), cgoAllocsUnknown - cnative_display, cnative_displayAllocMap := native_display, cgoAllocsUnknown - cattrib_list, cattrib_listAllocMap := (*C.EGLAttrib)(unsafe.Pointer(attrib_list)), cgoAllocsUnknown - __ret := C.eglGetPlatformDisplay(cplatform, cnative_display, cattrib_list) - runtime.KeepAlive(cattrib_listAllocMap) - runtime.KeepAlive(cnative_displayAllocMap) - runtime.KeepAlive(cplatformAllocMap) - __v := (EGLDisplay)(__ret) - return __v -} - -func EglGetProcAddress(procname string) EglMustCastToProperFunctionPointerType { - cprocname, cprocnameAllocMap := UnpackPCharString(procname) - __ret := C.eglGetProcAddress(cprocname) - runtime.KeepAlive(cprocnameAllocMap) - __v := *(*EglMustCastToProperFunctionPointerType)(unsafe.Pointer(&__ret)) - return __v -} - -func EglGetSyncAttrib(dpy EGLDisplay, sync EGLSync, attribute EGLint, value *EGLAttrib) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csync, csyncAllocMap := (C.EGLSync)(sync), cgoAllocsUnknown - cattribute, cattributeAllocMap := (C.EGLint)(attribute), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.EGLAttrib)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.eglGetSyncAttrib(cdpy, csync, cattribute, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cattributeAllocMap) - runtime.KeepAlive(csyncAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglInitialize(dpy EGLDisplay, major *EGLint, minor *EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cmajor, cmajorAllocMap := (*C.EGLint)(unsafe.Pointer(major)), cgoAllocsUnknown - cminor, cminorAllocMap := (*C.EGLint)(unsafe.Pointer(minor)), cgoAllocsUnknown - __ret := C.eglInitialize(cdpy, cmajor, cminor) - runtime.KeepAlive(cminorAllocMap) - runtime.KeepAlive(cmajorAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglMakeCurrent(dpy EGLDisplay, draw EGLSurface, read EGLSurface, ctx EGLContext) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cdraw, cdrawAllocMap := (C.EGLSurface)(draw), cgoAllocsUnknown - cread, creadAllocMap := (C.EGLSurface)(read), cgoAllocsUnknown - cctx, cctxAllocMap := (C.EGLContext)(ctx), cgoAllocsUnknown - __ret := C.eglMakeCurrent(cdpy, cdraw, cread, cctx) - runtime.KeepAlive(cctxAllocMap) - runtime.KeepAlive(creadAllocMap) - runtime.KeepAlive(cdrawAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglQueryAPI() EGLenum { - __ret := C.eglQueryAPI() - __v := (EGLenum)(__ret) - return __v -} - -func EglQueryContext(dpy EGLDisplay, ctx EGLContext, attribute EGLint, value *EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cctx, cctxAllocMap := (C.EGLContext)(ctx), cgoAllocsUnknown - cattribute, cattributeAllocMap := (C.EGLint)(attribute), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.EGLint)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.eglQueryContext(cdpy, cctx, cattribute, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cattributeAllocMap) - runtime.KeepAlive(cctxAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglQueryString(dpy EGLDisplay, name EGLint) string { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cname, cnameAllocMap := (C.EGLint)(name), cgoAllocsUnknown - __ret := C.eglQueryString(cdpy, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := C.GoString(__ret) - return __v -} - -func EglQuerySurface(dpy EGLDisplay, surface EGLSurface, attribute EGLint, value *EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csurface, csurfaceAllocMap := (C.EGLSurface)(surface), cgoAllocsUnknown - cattribute, cattributeAllocMap := (C.EGLint)(attribute), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.EGLint)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.eglQuerySurface(cdpy, csurface, cattribute, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cattributeAllocMap) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglReleaseTexImage(dpy EGLDisplay, surface EGLSurface, buffer EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csurface, csurfaceAllocMap := (C.EGLSurface)(surface), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (C.EGLint)(buffer), cgoAllocsUnknown - __ret := C.eglReleaseTexImage(cdpy, csurface, cbuffer) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglReleaseThread() EGLBoolean { - __ret := C.eglReleaseThread() - __v := (EGLBoolean)(__ret) - return __v -} - -func EglSurfaceAttrib(dpy EGLDisplay, surface EGLSurface, attribute EGLint, value EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csurface, csurfaceAllocMap := (C.EGLSurface)(surface), cgoAllocsUnknown - cattribute, cattributeAllocMap := (C.EGLint)(attribute), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.EGLint)(value), cgoAllocsUnknown - __ret := C.eglSurfaceAttrib(cdpy, csurface, cattribute, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cattributeAllocMap) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglSwapBuffers(dpy EGLDisplay, surface EGLSurface) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csurface, csurfaceAllocMap := (C.EGLSurface)(surface), cgoAllocsUnknown - __ret := C.eglSwapBuffers(cdpy, csurface) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglSwapInterval(dpy EGLDisplay, interval EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - cinterval, cintervalAllocMap := (C.EGLint)(interval), cgoAllocsUnknown - __ret := C.eglSwapInterval(cdpy, cinterval) - runtime.KeepAlive(cintervalAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglTerminate(dpy EGLDisplay) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - __ret := C.eglTerminate(cdpy) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglWaitClient() EGLBoolean { - __ret := C.eglWaitClient() - __v := (EGLBoolean)(__ret) - return __v -} - -func EglWaitGL() EGLBoolean { - __ret := C.eglWaitGL() - __v := (EGLBoolean)(__ret) - return __v -} - -func EglWaitNative(engine EGLint) EGLBoolean { - cengine, cengineAllocMap := (C.EGLint)(engine), cgoAllocsUnknown - __ret := C.eglWaitNative(cengine) - runtime.KeepAlive(cengineAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} - -func EglWaitSync(dpy EGLDisplay, sync EGLSync, flags EGLint) EGLBoolean { - cdpy, cdpyAllocMap := (C.EGLDisplay)(dpy), cgoAllocsUnknown - csync, csyncAllocMap := (C.EGLSync)(sync), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.EGLint)(flags), cgoAllocsUnknown - __ret := C.eglWaitSync(cdpy, csync, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(csyncAllocMap) - runtime.KeepAlive(cdpyAllocMap) - __v := (EGLBoolean)(__ret) - return __v -} diff --git a/capi/egl/types.go b/capi/egl/types.go deleted file mode 100644 index 7be601f..0000000 --- a/capi/egl/types.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package egl - -/* -#cgo LDFLAGS: -lEGL -landroid -lnativewindow -#include "EGL/egl.h" -#include "android/native_window.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type ANativeWindow C.ANativeWindow - -type ANativeWindow_Buffer C.ANativeWindow_Buffer - -type EGLAttrib int64 - -type EGLBoolean uint32 - -type EGLClientBuffer unsafe.Pointer - -type EGLConfig unsafe.Pointer - -type EGLContext unsafe.Pointer - -type EGLDisplay unsafe.Pointer - -type EGLImage unsafe.Pointer - -type EGLSurface unsafe.Pointer - -type EGLSync unsafe.Pointer - -type EGLTime C.EGLTime - -type EGLenum uint32 - -type ARect C.ARect - -type EGLNativeDisplayType C.EGLNativeDisplayType - -type EGLNativePixmapType C.EGLNativePixmapType - -type EGLNativeWindowType C.EGLNativeWindowType - -type EGLint C.EGLint - -type PFNEGLBINDAPIPROC func() - -type PFNEGLBINDTEXIMAGEPROC func() - -type PFNEGLCHOOSECONFIGPROC func() - -type PFNEGLCLIENTWAITSYNCPROC func() - -type PFNEGLCOPYBUFFERSPROC func() - -type PFNEGLCREATECONTEXTPROC func() - -type PFNEGLCREATEIMAGEPROC func() - -type PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC func() - -type PFNEGLCREATEPBUFFERSURFACEPROC func() - -type PFNEGLCREATEPIXMAPSURFACEPROC func() - -type PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC func() - -type PFNEGLCREATEPLATFORMWINDOWSURFACEPROC func() - -type PFNEGLCREATESYNCPROC func() - -type PFNEGLCREATEWINDOWSURFACEPROC func() - -type PFNEGLDESTROYCONTEXTPROC func() - -type PFNEGLDESTROYIMAGEPROC func() - -type PFNEGLDESTROYSURFACEPROC func() - -type PFNEGLDESTROYSYNCPROC func() - -type PFNEGLGETCONFIGATTRIBPROC func() - -type PFNEGLGETCONFIGSPROC func() - -type PFNEGLGETCURRENTCONTEXTPROC func() - -type PFNEGLGETCURRENTDISPLAYPROC func() - -type PFNEGLGETCURRENTSURFACEPROC func() - -type PFNEGLGETDISPLAYPROC func() - -type PFNEGLGETERRORPROC func() - -type PFNEGLGETPLATFORMDISPLAYPROC func() - -type PFNEGLGETPROCADDRESSPROC func() - -type PFNEGLGETSYNCATTRIBPROC func() - -type PFNEGLINITIALIZEPROC func() - -type PFNEGLMAKECURRENTPROC func() - -type PFNEGLQUERYAPIPROC func() - -type PFNEGLQUERYCONTEXTPROC func() - -type PFNEGLQUERYSTRINGPROC func() - -type PFNEGLQUERYSURFACEPROC func() - -type PFNEGLRELEASETEXIMAGEPROC func() - -type PFNEGLRELEASETHREADPROC func() - -type PFNEGLSURFACEATTRIBPROC func() - -type PFNEGLSWAPBUFFERSPROC func() - -type PFNEGLSWAPINTERVALPROC func() - -type PFNEGLTERMINATEPROC func() - -type PFNEGLWAITCLIENTPROC func() - -type PFNEGLWAITGLPROC func() - -type PFNEGLWAITNATIVEPROC func() - -type PFNEGLWAITSYNCPROC func() - -type EglMustCastToProperFunctionPointerType func() diff --git a/capi/font/cgo_helpers.c b/capi/font/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/font/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/font/cgo_helpers.go b/capi/font/cgo_helpers.go deleted file mode 100644 index 78b8256..0000000 --- a/capi/font/cgo_helpers.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package font - -/* -#cgo LDFLAGS: -landroid -#include "android/font.h" -#include "android/font_matcher.h" -#include "android/system_fonts.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/font/cgo_helpers.h b/capi/font/cgo_helpers.h deleted file mode 100644 index 4c751c4..0000000 --- a/capi/font/cgo_helpers.h +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/font.h" -#include "android/font_matcher.h" -#include "android/system_fonts.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/font/const.go b/capi/font/const.go deleted file mode 100644 index f465813..0000000 --- a/capi/font/const.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package font - -const ( - AFAMILY_VARIANT_DEFAULT = 0 - AFAMILY_VARIANT_COMPACT = 1 - AFAMILY_VARIANT_ELEGANT = 2 -) - -const ( - AFONT_WEIGHT_MIN = 0 - AFONT_WEIGHT_THIN = 100 - AFONT_WEIGHT_EXTRA_LIGHT = 200 - AFONT_WEIGHT_LIGHT = 300 - AFONT_WEIGHT_NORMAL = 400 - AFONT_WEIGHT_MEDIUM = 500 - AFONT_WEIGHT_SEMI_BOLD = 600 - AFONT_WEIGHT_BOLD = 700 - AFONT_WEIGHT_EXTRA_BOLD = 800 - AFONT_WEIGHT_BLACK = 900 - AFONT_WEIGHT_MAX = 1000 -) diff --git a/capi/font/doc.go b/capi/font/doc.go deleted file mode 100644 index 74b3c5b..0000000 --- a/capi/font/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Font -*/ -package font diff --git a/capi/font/font.go b/capi/font/font.go deleted file mode 100644 index 7610617..0000000 --- a/capi/font/font.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package font - -/* -#cgo LDFLAGS: -landroid -#include "android/font.h" -#include "android/font_matcher.h" -#include "android/system_fonts.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AFontMatcher_create() *AFontMatcher { - __ret := C.AFontMatcher_create() - __v := (*AFontMatcher)(unsafe.Pointer(__ret)) - return __v -} - -func AFontMatcher_destroy(matcher *AFontMatcher) { - cmatcher, cmatcherAllocMap := (*C.AFontMatcher)(unsafe.Pointer(matcher)), cgoAllocsUnknown - C.AFontMatcher_destroy(cmatcher) - runtime.KeepAlive(cmatcherAllocMap) -} - -func AFontMatcher_match(matcher *AFontMatcher, familyName string, text *uint16, textLength uint32, runLengthOut *uint32) *AFont { - cmatcher, cmatcherAllocMap := (*C.AFontMatcher)(unsafe.Pointer(matcher)), cgoAllocsUnknown - cfamilyName, cfamilyNameAllocMap := UnpackPCharString(familyName) - ctext, ctextAllocMap := (*C.uint16_t)(unsafe.Pointer(text)), cgoAllocsUnknown - ctextLength, ctextLengthAllocMap := (C.uint)(textLength), cgoAllocsUnknown - crunLengthOut, crunLengthOutAllocMap := (*C.uint)(unsafe.Pointer(runLengthOut)), cgoAllocsUnknown - __ret := C.AFontMatcher_match(cmatcher, cfamilyName, ctext, ctextLength, crunLengthOut) - runtime.KeepAlive(crunLengthOutAllocMap) - runtime.KeepAlive(ctextLengthAllocMap) - runtime.KeepAlive(ctextAllocMap) - runtime.KeepAlive(cfamilyNameAllocMap) - runtime.KeepAlive(cmatcherAllocMap) - __v := (*AFont)(unsafe.Pointer(__ret)) - return __v -} - -func AFontMatcher_setFamilyVariant(matcher *AFontMatcher, familyVariant uint32) { - cmatcher, cmatcherAllocMap := (*C.AFontMatcher)(unsafe.Pointer(matcher)), cgoAllocsUnknown - cfamilyVariant, cfamilyVariantAllocMap := (C.uint)(familyVariant), cgoAllocsUnknown - C.AFontMatcher_setFamilyVariant(cmatcher, cfamilyVariant) - runtime.KeepAlive(cfamilyVariantAllocMap) - runtime.KeepAlive(cmatcherAllocMap) -} - -func AFontMatcher_setLocales(matcher *AFontMatcher, languageTags string) { - cmatcher, cmatcherAllocMap := (*C.AFontMatcher)(unsafe.Pointer(matcher)), cgoAllocsUnknown - clanguageTags, clanguageTagsAllocMap := UnpackPCharString(languageTags) - C.AFontMatcher_setLocales(cmatcher, clanguageTags) - runtime.KeepAlive(clanguageTagsAllocMap) - runtime.KeepAlive(cmatcherAllocMap) -} - -func AFontMatcher_setStyle(matcher *AFontMatcher, weight uint16, italic bool) { - cmatcher, cmatcherAllocMap := (*C.AFontMatcher)(unsafe.Pointer(matcher)), cgoAllocsUnknown - cweight, cweightAllocMap := (C.uint16_t)(weight), cgoAllocsUnknown - citalic, citalicAllocMap := (C._Bool)(italic), cgoAllocsUnknown - C.AFontMatcher_setStyle(cmatcher, cweight, citalic) - runtime.KeepAlive(citalicAllocMap) - runtime.KeepAlive(cweightAllocMap) - runtime.KeepAlive(cmatcherAllocMap) -} - -func AFont_close(font *AFont) { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - C.AFont_close(cfont) - runtime.KeepAlive(cfontAllocMap) -} - -func AFont_getAxisCount(font *AFont) uint64 { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - __ret := C.AFont_getAxisCount(cfont) - runtime.KeepAlive(cfontAllocMap) - __v := (uint64)(__ret) - return __v -} - -func AFont_getAxisTag(font *AFont, axisIndex uint32) uint32 { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - caxisIndex, caxisIndexAllocMap := (C.uint)(axisIndex), cgoAllocsUnknown - __ret := C.AFont_getAxisTag(cfont, caxisIndex) - runtime.KeepAlive(caxisIndexAllocMap) - runtime.KeepAlive(cfontAllocMap) - __v := (uint32)(__ret) - return __v -} - -func AFont_getAxisValue(font *AFont, axisIndex uint32) float32 { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - caxisIndex, caxisIndexAllocMap := (C.uint)(axisIndex), cgoAllocsUnknown - __ret := C.AFont_getAxisValue(cfont, caxisIndex) - runtime.KeepAlive(caxisIndexAllocMap) - runtime.KeepAlive(cfontAllocMap) - __v := (float32)(__ret) - return __v -} - -func AFont_getCollectionIndex(font *AFont) uint64 { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - __ret := C.AFont_getCollectionIndex(cfont) - runtime.KeepAlive(cfontAllocMap) - __v := (uint64)(__ret) - return __v -} - -func AFont_getFontFilePath(font *AFont) string { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - __ret := C.AFont_getFontFilePath(cfont) - runtime.KeepAlive(cfontAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AFont_getLocale(font *AFont) string { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - __ret := C.AFont_getLocale(cfont) - runtime.KeepAlive(cfontAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AFont_getWeight(font *AFont) uint16 { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - __ret := C.AFont_getWeight(cfont) - runtime.KeepAlive(cfontAllocMap) - __v := (uint16)(__ret) - return __v -} - -func AFont_isItalic(font *AFont) bool { - cfont, cfontAllocMap := (*C.AFont)(unsafe.Pointer(font)), cgoAllocsUnknown - __ret := C.AFont_isItalic(cfont) - runtime.KeepAlive(cfontAllocMap) - __v := (bool)(__ret) - return __v -} - -func ASystemFontIterator_close(iterator *ASystemFontIterator) { - citerator, citeratorAllocMap := (*C.ASystemFontIterator)(unsafe.Pointer(iterator)), cgoAllocsUnknown - C.ASystemFontIterator_close(citerator) - runtime.KeepAlive(citeratorAllocMap) -} - -func ASystemFontIterator_next(iterator *ASystemFontIterator) *AFont { - citerator, citeratorAllocMap := (*C.ASystemFontIterator)(unsafe.Pointer(iterator)), cgoAllocsUnknown - __ret := C.ASystemFontIterator_next(citerator) - runtime.KeepAlive(citeratorAllocMap) - __v := (*AFont)(unsafe.Pointer(__ret)) - return __v -} - -func ASystemFontIterator_open() *ASystemFontIterator { - __ret := C.ASystemFontIterator_open() - __v := (*ASystemFontIterator)(unsafe.Pointer(__ret)) - return __v -} diff --git a/capi/font/types.go b/capi/font/types.go deleted file mode 100644 index 2672a82..0000000 --- a/capi/font/types.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package font - -/* -#cgo LDFLAGS: -landroid -#include "android/font.h" -#include "android/font_matcher.h" -#include "android/system_fonts.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AFont C.AFont - -type AFontMatcher C.AFontMatcher - -type ASystemFontIterator C.ASystemFontIterator diff --git a/capi/gles2/cgo_helpers.c b/capi/gles2/cgo_helpers.c deleted file mode 100644 index 33e3a2e..0000000 --- a/capi/gles2/cgo_helpers.c +++ /dev/null @@ -1,572 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void PFNGLACTIVETEXTUREPROC_6e47c869() { - PFNGLACTIVETEXTUREPROC6E47C869(); -} - -void PFNGLATTACHSHADERPROC_1307d43f() { - PFNGLATTACHSHADERPROC1307D43F(); -} - -void PFNGLBINDATTRIBLOCATIONPROC_f8b91c30() { - PFNGLBINDATTRIBLOCATIONPROCF8B91C30(); -} - -void PFNGLBINDBUFFERPROC_d94c7932() { - PFNGLBINDBUFFERPROCD94C7932(); -} - -void PFNGLBINDFRAMEBUFFERPROC_6dab872f() { - PFNGLBINDFRAMEBUFFERPROC6DAB872F(); -} - -void PFNGLBINDRENDERBUFFERPROC_3f834dfa() { - PFNGLBINDRENDERBUFFERPROC3F834DFA(); -} - -void PFNGLBINDTEXTUREPROC_8ed8ec9d() { - PFNGLBINDTEXTUREPROC8ED8EC9D(); -} - -void PFNGLBLENDCOLORPROC_c3166a72() { - PFNGLBLENDCOLORPROCC3166A72(); -} - -void PFNGLBLENDEQUATIONPROC_69096e8b() { - PFNGLBLENDEQUATIONPROC69096E8B(); -} - -void PFNGLBLENDEQUATIONSEPARATEPROC_eaf8dd26() { - PFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26(); -} - -void PFNGLBLENDFUNCPROC_9c82df9a() { - PFNGLBLENDFUNCPROC9C82DF9A(); -} - -void PFNGLBLENDFUNCSEPARATEPROC_8f247f05() { - PFNGLBLENDFUNCSEPARATEPROC8F247F05(); -} - -void PFNGLBUFFERDATAPROC_108a8f9a() { - PFNGLBUFFERDATAPROC108A8F9A(); -} - -void PFNGLBUFFERSUBDATAPROC_a57a5d10() { - PFNGLBUFFERSUBDATAPROCA57A5D10(); -} - -void PFNGLCHECKFRAMEBUFFERSTATUSPROC_c70b02ad() { - PFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02AD(); -} - -void PFNGLCLEARCOLORPROC_bbf95dd3() { - PFNGLCLEARCOLORPROCBBF95DD3(); -} - -void PFNGLCLEARDEPTHFPROC_0393ff33() { - PFNGLCLEARDEPTHFPROC0393FF33(); -} - -void PFNGLCLEARPROC_5c505a01() { - PFNGLCLEARPROC5C505A01(); -} - -void PFNGLCLEARSTENCILPROC_294e6113() { - PFNGLCLEARSTENCILPROC294E6113(); -} - -void PFNGLCOLORMASKPROC_c9e06898() { - PFNGLCOLORMASKPROCC9E06898(); -} - -void PFNGLCOMPILESHADERPROC_fa71632c() { - PFNGLCOMPILESHADERPROCFA71632C(); -} - -void PFNGLCOMPRESSEDTEXIMAGE2DPROC_25c09a9d() { - PFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9D(); -} - -void PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_cd1f0169() { - PFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169(); -} - -void PFNGLCOPYTEXIMAGE2DPROC_362cb2c6() { - PFNGLCOPYTEXIMAGE2DPROC362CB2C6(); -} - -void PFNGLCOPYTEXSUBIMAGE2DPROC_f084f8e4() { - PFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4(); -} - -void PFNGLCREATEPROGRAMPROC_b7320e79() { - PFNGLCREATEPROGRAMPROCB7320E79(); -} - -void PFNGLCREATESHADERPROC_90286feb() { - PFNGLCREATESHADERPROC90286FEB(); -} - -void PFNGLCULLFACEPROC_fdd0b6ab() { - PFNGLCULLFACEPROCFDD0B6AB(); -} - -void PFNGLDELETEBUFFERSPROC_71945243() { - PFNGLDELETEBUFFERSPROC71945243(); -} - -void PFNGLDELETEFRAMEBUFFERSPROC_e82ea5e7() { - PFNGLDELETEFRAMEBUFFERSPROCE82EA5E7(); -} - -void PFNGLDELETEPROGRAMPROC_980d924f() { - PFNGLDELETEPROGRAMPROC980D924F(); -} - -void PFNGLDELETERENDERBUFFERSPROC_578e77fb() { - PFNGLDELETERENDERBUFFERSPROC578E77FB(); -} - -void PFNGLDELETESHADERPROC_71a112df() { - PFNGLDELETESHADERPROC71A112DF(); -} - -void PFNGLDELETETEXTURESPROC_b1f8e327() { - PFNGLDELETETEXTURESPROCB1F8E327(); -} - -void PFNGLDEPTHFUNCPROC_14649a7b() { - PFNGLDEPTHFUNCPROC14649A7B(); -} - -void PFNGLDEPTHMASKPROC_eae207ef() { - PFNGLDEPTHMASKPROCEAE207EF(); -} - -void PFNGLDEPTHRANGEFPROC_df1d7c44() { - PFNGLDEPTHRANGEFPROCDF1D7C44(); -} - -void PFNGLDETACHSHADERPROC_cb02fa06() { - PFNGLDETACHSHADERPROCCB02FA06(); -} - -void PFNGLDISABLEPROC_09c452ac() { - PFNGLDISABLEPROC09C452AC(); -} - -void PFNGLDISABLEVERTEXATTRIBARRAYPROC_55dee1b6() { - PFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6(); -} - -void PFNGLDRAWARRAYSPROC_ee5de7f9() { - PFNGLDRAWARRAYSPROCEE5DE7F9(); -} - -void PFNGLDRAWELEMENTSPROC_5cc630d9() { - PFNGLDRAWELEMENTSPROC5CC630D9(); -} - -void PFNGLENABLEPROC_bd9eec48() { - PFNGLENABLEPROCBD9EEC48(); -} - -void PFNGLENABLEVERTEXATTRIBARRAYPROC_5fa65ebb() { - PFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBB(); -} - -void PFNGLFINISHPROC_89486d93() { - PFNGLFINISHPROC89486D93(); -} - -void PFNGLFLUSHPROC_5a17fa98() { - PFNGLFLUSHPROC5A17FA98(); -} - -void PFNGLFRAMEBUFFERRENDERBUFFERPROC_4a3a1f7d() { - PFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7D(); -} - -void PFNGLFRAMEBUFFERTEXTURE2DPROC_947c34c9() { - PFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9(); -} - -void PFNGLFRONTFACEPROC_bb965009() { - PFNGLFRONTFACEPROCBB965009(); -} - -void PFNGLGENBUFFERSPROC_fe169f7f() { - PFNGLGENBUFFERSPROCFE169F7F(); -} - -void PFNGLGENERATEMIPMAPPROC_16259df9() { - PFNGLGENERATEMIPMAPPROC16259DF9(); -} - -void PFNGLGENFRAMEBUFFERSPROC_17a91b18() { - PFNGLGENFRAMEBUFFERSPROC17A91B18(); -} - -void PFNGLGENRENDERBUFFERSPROC_e58b8074() { - PFNGLGENRENDERBUFFERSPROCE58B8074(); -} - -void PFNGLGENTEXTURESPROC_984e35d5() { - PFNGLGENTEXTURESPROC984E35D5(); -} - -void PFNGLGETACTIVEATTRIBPROC_671be206() { - PFNGLGETACTIVEATTRIBPROC671BE206(); -} - -void PFNGLGETACTIVEUNIFORMPROC_b54d7db5() { - PFNGLGETACTIVEUNIFORMPROCB54D7DB5(); -} - -void PFNGLGETATTACHEDSHADERSPROC_37f31c4e() { - PFNGLGETATTACHEDSHADERSPROC37F31C4E(); -} - -void PFNGLGETATTRIBLOCATIONPROC_eee07211() { - PFNGLGETATTRIBLOCATIONPROCEEE07211(); -} - -void PFNGLGETBOOLEANVPROC_28e602f0() { - PFNGLGETBOOLEANVPROC28E602F0(); -} - -void PFNGLGETBUFFERPARAMETERIVPROC_42b6d73e() { - PFNGLGETBUFFERPARAMETERIVPROC42B6D73E(); -} - -void PFNGLGETERRORPROC_493c4fa3() { - PFNGLGETERRORPROC493C4FA3(); -} - -void PFNGLGETFLOATVPROC_2b7c40db() { - PFNGLGETFLOATVPROC2B7C40DB(); -} - -void PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_a7dee7a0() { - PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0(); -} - -void PFNGLGETINTEGERVPROC_d1b0be4b() { - PFNGLGETINTEGERVPROCD1B0BE4B(); -} - -void PFNGLGETPROGRAMINFOLOGPROC_aa65e8fb() { - PFNGLGETPROGRAMINFOLOGPROCAA65E8FB(); -} - -void PFNGLGETPROGRAMIVPROC_77d8dea3() { - PFNGLGETPROGRAMIVPROC77D8DEA3(); -} - -void PFNGLGETRENDERBUFFERPARAMETERIVPROC_433873d6() { - PFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6(); -} - -void PFNGLGETSHADERINFOLOGPROC_0230ef81() { - PFNGLGETSHADERINFOLOGPROC0230EF81(); -} - -void PFNGLGETSHADERIVPROC_9f6bf31d() { - PFNGLGETSHADERIVPROC9F6BF31D(); -} - -void PFNGLGETSHADERPRECISIONFORMATPROC_802a8e22() { - PFNGLGETSHADERPRECISIONFORMATPROC802A8E22(); -} - -void PFNGLGETSHADERSOURCEPROC_720cfc89() { - PFNGLGETSHADERSOURCEPROC720CFC89(); -} - -void PFNGLGETSTRINGPROC_a27c496a() { - PFNGLGETSTRINGPROCA27C496A(); -} - -void PFNGLGETTEXPARAMETERFVPROC_4e2e2b7e() { - PFNGLGETTEXPARAMETERFVPROC4E2E2B7E(); -} - -void PFNGLGETTEXPARAMETERIVPROC_d102ab47() { - PFNGLGETTEXPARAMETERIVPROCD102AB47(); -} - -void PFNGLGETUNIFORMFVPROC_224f0554() { - PFNGLGETUNIFORMFVPROC224F0554(); -} - -void PFNGLGETUNIFORMIVPROC_7ac2feaa() { - PFNGLGETUNIFORMIVPROC7AC2FEAA(); -} - -void PFNGLGETUNIFORMLOCATIONPROC_f7c84f68() { - PFNGLGETUNIFORMLOCATIONPROCF7C84F68(); -} - -void PFNGLGETVERTEXATTRIBFVPROC_fe79a986() { - PFNGLGETVERTEXATTRIBFVPROCFE79A986(); -} - -void PFNGLGETVERTEXATTRIBIVPROC_60c239b0() { - PFNGLGETVERTEXATTRIBIVPROC60C239B0(); -} - -void PFNGLGETVERTEXATTRIBPOINTERVPROC_3cd0d0c9() { - PFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9(); -} - -void PFNGLHINTPROC_fb1b468c() { - PFNGLHINTPROCFB1B468C(); -} - -void PFNGLISBUFFERPROC_ec676601() { - PFNGLISBUFFERPROCEC676601(); -} - -void PFNGLISENABLEDPROC_5f3a913b() { - PFNGLISENABLEDPROC5F3A913B(); -} - -void PFNGLISFRAMEBUFFERPROC_09ec8734() { - PFNGLISFRAMEBUFFERPROC09EC8734(); -} - -void PFNGLISPROGRAMPROC_4b2be4bc() { - PFNGLISPROGRAMPROC4B2BE4BC(); -} - -void PFNGLISRENDERBUFFERPROC_9125a0c4() { - PFNGLISRENDERBUFFERPROC9125A0C4(); -} - -void PFNGLISSHADERPROC_f4ee4c55() { - PFNGLISSHADERPROCF4EE4C55(); -} - -void PFNGLISTEXTUREPROC_b34e7e73() { - PFNGLISTEXTUREPROCB34E7E73(); -} - -void PFNGLLINEWIDTHPROC_31406c60() { - PFNGLLINEWIDTHPROC31406C60(); -} - -void PFNGLLINKPROGRAMPROC_07d669c8() { - PFNGLLINKPROGRAMPROC07D669C8(); -} - -void PFNGLPIXELSTOREIPROC_c91a89bd() { - PFNGLPIXELSTOREIPROCC91A89BD(); -} - -void PFNGLPOLYGONOFFSETPROC_5b26d329() { - PFNGLPOLYGONOFFSETPROC5B26D329(); -} - -void PFNGLREADPIXELSPROC_82fe6500() { - PFNGLREADPIXELSPROC82FE6500(); -} - -void PFNGLRELEASESHADERCOMPILERPROC_5c6bf9f9() { - PFNGLRELEASESHADERCOMPILERPROC5C6BF9F9(); -} - -void PFNGLRENDERBUFFERSTORAGEPROC_fd7b7a1b() { - PFNGLRENDERBUFFERSTORAGEPROCFD7B7A1B(); -} - -void PFNGLSAMPLECOVERAGEPROC_b5636cba() { - PFNGLSAMPLECOVERAGEPROCB5636CBA(); -} - -void PFNGLSCISSORPROC_382195db() { - PFNGLSCISSORPROC382195DB(); -} - -void PFNGLSHADERBINARYPROC_cf214e0a() { - PFNGLSHADERBINARYPROCCF214E0A(); -} - -void PFNGLSHADERSOURCEPROC_320f676d() { - PFNGLSHADERSOURCEPROC320F676D(); -} - -void PFNGLSTENCILFUNCPROC_3234cf9b() { - PFNGLSTENCILFUNCPROC3234CF9B(); -} - -void PFNGLSTENCILFUNCSEPARATEPROC_8236808d() { - PFNGLSTENCILFUNCSEPARATEPROC8236808D(); -} - -void PFNGLSTENCILMASKPROC_e85990de() { - PFNGLSTENCILMASKPROCE85990DE(); -} - -void PFNGLSTENCILMASKSEPARATEPROC_41f6598d() { - PFNGLSTENCILMASKSEPARATEPROC41F6598D(); -} - -void PFNGLSTENCILOPPROC_1011feda() { - PFNGLSTENCILOPPROC1011FEDA(); -} - -void PFNGLSTENCILOPSEPARATEPROC_d4b6cdef() { - PFNGLSTENCILOPSEPARATEPROCD4B6CDEF(); -} - -void PFNGLTEXIMAGE2DPROC_7db9b341() { - PFNGLTEXIMAGE2DPROC7DB9B341(); -} - -void PFNGLTEXPARAMETERFPROC_49c04fc7() { - PFNGLTEXPARAMETERFPROC49C04FC7(); -} - -void PFNGLTEXPARAMETERFVPROC_9ca30911() { - PFNGLTEXPARAMETERFVPROC9CA30911(); -} - -void PFNGLTEXPARAMETERIPROC_bf81a7af() { - PFNGLTEXPARAMETERIPROCBF81A7AF(); -} - -void PFNGLTEXPARAMETERIVPROC_efa19e2e() { - PFNGLTEXPARAMETERIVPROCEFA19E2E(); -} - -void PFNGLTEXSUBIMAGE2DPROC_e0159593() { - PFNGLTEXSUBIMAGE2DPROCE0159593(); -} - -void PFNGLUNIFORM1FPROC_0bff5170() { - PFNGLUNIFORM1FPROC0BFF5170(); -} - -void PFNGLUNIFORM1FVPROC_eead7014() { - PFNGLUNIFORM1FVPROCEEAD7014(); -} - -void PFNGLUNIFORM1IPROC_214d6eff() { - PFNGLUNIFORM1IPROC214D6EFF(); -} - -void PFNGLUNIFORM1IVPROC_53b272c6() { - PFNGLUNIFORM1IVPROC53B272C6(); -} - -void PFNGLUNIFORM2FPROC_abd0fe87() { - PFNGLUNIFORM2FPROCABD0FE87(); -} - -void PFNGLUNIFORM2FVPROC_43206e9a() { - PFNGLUNIFORM2FVPROC43206E9A(); -} - -void PFNGLUNIFORM2IPROC_4a80cbcf() { - PFNGLUNIFORM2IPROC4A80CBCF(); -} - -void PFNGLUNIFORM2IVPROC_7ab23664() { - PFNGLUNIFORM2IVPROC7AB23664(); -} - -void PFNGLUNIFORM3FPROC_75e6607f() { - PFNGLUNIFORM3FPROC75E6607F(); -} - -void PFNGLUNIFORM3FVPROC_7ae5143e() { - PFNGLUNIFORM3FVPROC7AE5143E(); -} - -void PFNGLUNIFORM3IPROC_1e02df35() { - PFNGLUNIFORM3IPROC1E02DF35(); -} - -void PFNGLUNIFORM3IVPROC_7a54ff33() { - PFNGLUNIFORM3IVPROC7A54FF33(); -} - -void PFNGLUNIFORM4FPROC_32347cb5() { - PFNGLUNIFORM4FPROC32347CB5(); -} - -void PFNGLUNIFORM4FVPROC_e695cfd9() { - PFNGLUNIFORM4FVPROCE695CFD9(); -} - -void PFNGLUNIFORM4IPROC_ca68800b() { - PFNGLUNIFORM4IPROCCA68800B(); -} - -void PFNGLUNIFORM4IVPROC_2630316c() { - PFNGLUNIFORM4IVPROC2630316C(); -} - -void PFNGLUNIFORMMATRIX2FVPROC_f82b6c3b() { - PFNGLUNIFORMMATRIX2FVPROCF82B6C3B(); -} - -void PFNGLUNIFORMMATRIX3FVPROC_ca3fe2f1() { - PFNGLUNIFORMMATRIX3FVPROCCA3FE2F1(); -} - -void PFNGLUNIFORMMATRIX4FVPROC_840d6a5d() { - PFNGLUNIFORMMATRIX4FVPROC840D6A5D(); -} - -void PFNGLUSEPROGRAMPROC_d49a8d40() { - PFNGLUSEPROGRAMPROCD49A8D40(); -} - -void PFNGLVALIDATEPROGRAMPROC_ebab0036() { - PFNGLVALIDATEPROGRAMPROCEBAB0036(); -} - -void PFNGLVERTEXATTRIB1FPROC_07978665() { - PFNGLVERTEXATTRIB1FPROC07978665(); -} - -void PFNGLVERTEXATTRIB1FVPROC_9551e9a2() { - PFNGLVERTEXATTRIB1FVPROC9551E9A2(); -} - -void PFNGLVERTEXATTRIB2FPROC_dabe4eef() { - PFNGLVERTEXATTRIB2FPROCDABE4EEF(); -} - -void PFNGLVERTEXATTRIB2FVPROC_63caee6d() { - PFNGLVERTEXATTRIB2FVPROC63CAEE6D(); -} - -void PFNGLVERTEXATTRIB3FPROC_96116a2f() { - PFNGLVERTEXATTRIB3FPROC96116A2F(); -} - -void PFNGLVERTEXATTRIB3FVPROC_ed21de77() { - PFNGLVERTEXATTRIB3FVPROCED21DE77(); -} - -void PFNGLVERTEXATTRIB4FPROC_b1f64ca3() { - PFNGLVERTEXATTRIB4FPROCB1F64CA3(); -} - -void PFNGLVERTEXATTRIB4FVPROC_ae71b07d() { - PFNGLVERTEXATTRIB4FVPROCAE71B07D(); -} - -void PFNGLVERTEXATTRIBPOINTERPROC_6b507f2c() { - PFNGLVERTEXATTRIBPOINTERPROC6B507F2C(); -} - -void PFNGLVIEWPORTPROC_9af8044a() { - PFNGLVIEWPORTPROC9AF8044A(); -} - diff --git a/capi/gles2/cgo_helpers.go b/capi/gles2/cgo_helpers.go deleted file mode 100644 index 0a92823..0000000 --- a/capi/gles2/cgo_helpers.go +++ /dev/null @@ -1,5042 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package gles2 - -/* -#cgo LDFLAGS: -lGLESv2 -#include "GLES2/gl2.h" -#include "GLES2/gl2ext.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x PFNGLACTIVETEXTUREPROC) PassRef() (ref *C.PFNGLACTIVETEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLACTIVETEXTUREPROC6E47C869Func == nil { - pFNGLACTIVETEXTUREPROC6E47C869Func = x - } - return (*C.PFNGLACTIVETEXTUREPROC)(C.PFNGLACTIVETEXTUREPROC_6e47c869), nil -} - -func (x PFNGLACTIVETEXTUREPROC) PassValue() (ref C.PFNGLACTIVETEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLACTIVETEXTUREPROC6E47C869Func == nil { - pFNGLACTIVETEXTUREPROC6E47C869Func = x - } - return (C.PFNGLACTIVETEXTUREPROC)(C.PFNGLACTIVETEXTUREPROC_6e47c869), nil -} - -func NewPFNGLACTIVETEXTUREPROCRef(ref unsafe.Pointer) *PFNGLACTIVETEXTUREPROC { - return (*PFNGLACTIVETEXTUREPROC)(ref) -} - -//export PFNGLACTIVETEXTUREPROC6E47C869 -func PFNGLACTIVETEXTUREPROC6E47C869() { - if pFNGLACTIVETEXTUREPROC6E47C869Func != nil { - pFNGLACTIVETEXTUREPROC6E47C869Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLACTIVETEXTUREPROC6E47C869Func PFNGLACTIVETEXTUREPROC - -func (x PFNGLATTACHSHADERPROC) PassRef() (ref *C.PFNGLATTACHSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLATTACHSHADERPROC1307D43FFunc == nil { - pFNGLATTACHSHADERPROC1307D43FFunc = x - } - return (*C.PFNGLATTACHSHADERPROC)(C.PFNGLATTACHSHADERPROC_1307d43f), nil -} - -func (x PFNGLATTACHSHADERPROC) PassValue() (ref C.PFNGLATTACHSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLATTACHSHADERPROC1307D43FFunc == nil { - pFNGLATTACHSHADERPROC1307D43FFunc = x - } - return (C.PFNGLATTACHSHADERPROC)(C.PFNGLATTACHSHADERPROC_1307d43f), nil -} - -func NewPFNGLATTACHSHADERPROCRef(ref unsafe.Pointer) *PFNGLATTACHSHADERPROC { - return (*PFNGLATTACHSHADERPROC)(ref) -} - -//export PFNGLATTACHSHADERPROC1307D43F -func PFNGLATTACHSHADERPROC1307D43F() { - if pFNGLATTACHSHADERPROC1307D43FFunc != nil { - pFNGLATTACHSHADERPROC1307D43FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLATTACHSHADERPROC1307D43FFunc PFNGLATTACHSHADERPROC - -func (x PFNGLBINDATTRIBLOCATIONPROC) PassRef() (ref *C.PFNGLBINDATTRIBLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDATTRIBLOCATIONPROCF8B91C30Func == nil { - pFNGLBINDATTRIBLOCATIONPROCF8B91C30Func = x - } - return (*C.PFNGLBINDATTRIBLOCATIONPROC)(C.PFNGLBINDATTRIBLOCATIONPROC_f8b91c30), nil -} - -func (x PFNGLBINDATTRIBLOCATIONPROC) PassValue() (ref C.PFNGLBINDATTRIBLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDATTRIBLOCATIONPROCF8B91C30Func == nil { - pFNGLBINDATTRIBLOCATIONPROCF8B91C30Func = x - } - return (C.PFNGLBINDATTRIBLOCATIONPROC)(C.PFNGLBINDATTRIBLOCATIONPROC_f8b91c30), nil -} - -func NewPFNGLBINDATTRIBLOCATIONPROCRef(ref unsafe.Pointer) *PFNGLBINDATTRIBLOCATIONPROC { - return (*PFNGLBINDATTRIBLOCATIONPROC)(ref) -} - -//export PFNGLBINDATTRIBLOCATIONPROCF8B91C30 -func PFNGLBINDATTRIBLOCATIONPROCF8B91C30() { - if pFNGLBINDATTRIBLOCATIONPROCF8B91C30Func != nil { - pFNGLBINDATTRIBLOCATIONPROCF8B91C30Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDATTRIBLOCATIONPROCF8B91C30Func PFNGLBINDATTRIBLOCATIONPROC - -func (x PFNGLBINDBUFFERPROC) PassRef() (ref *C.PFNGLBINDBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDBUFFERPROCD94C7932Func == nil { - pFNGLBINDBUFFERPROCD94C7932Func = x - } - return (*C.PFNGLBINDBUFFERPROC)(C.PFNGLBINDBUFFERPROC_d94c7932), nil -} - -func (x PFNGLBINDBUFFERPROC) PassValue() (ref C.PFNGLBINDBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDBUFFERPROCD94C7932Func == nil { - pFNGLBINDBUFFERPROCD94C7932Func = x - } - return (C.PFNGLBINDBUFFERPROC)(C.PFNGLBINDBUFFERPROC_d94c7932), nil -} - -func NewPFNGLBINDBUFFERPROCRef(ref unsafe.Pointer) *PFNGLBINDBUFFERPROC { - return (*PFNGLBINDBUFFERPROC)(ref) -} - -//export PFNGLBINDBUFFERPROCD94C7932 -func PFNGLBINDBUFFERPROCD94C7932() { - if pFNGLBINDBUFFERPROCD94C7932Func != nil { - pFNGLBINDBUFFERPROCD94C7932Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDBUFFERPROCD94C7932Func PFNGLBINDBUFFERPROC - -func (x PFNGLBINDFRAMEBUFFERPROC) PassRef() (ref *C.PFNGLBINDFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDFRAMEBUFFERPROC6DAB872FFunc == nil { - pFNGLBINDFRAMEBUFFERPROC6DAB872FFunc = x - } - return (*C.PFNGLBINDFRAMEBUFFERPROC)(C.PFNGLBINDFRAMEBUFFERPROC_6dab872f), nil -} - -func (x PFNGLBINDFRAMEBUFFERPROC) PassValue() (ref C.PFNGLBINDFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDFRAMEBUFFERPROC6DAB872FFunc == nil { - pFNGLBINDFRAMEBUFFERPROC6DAB872FFunc = x - } - return (C.PFNGLBINDFRAMEBUFFERPROC)(C.PFNGLBINDFRAMEBUFFERPROC_6dab872f), nil -} - -func NewPFNGLBINDFRAMEBUFFERPROCRef(ref unsafe.Pointer) *PFNGLBINDFRAMEBUFFERPROC { - return (*PFNGLBINDFRAMEBUFFERPROC)(ref) -} - -//export PFNGLBINDFRAMEBUFFERPROC6DAB872F -func PFNGLBINDFRAMEBUFFERPROC6DAB872F() { - if pFNGLBINDFRAMEBUFFERPROC6DAB872FFunc != nil { - pFNGLBINDFRAMEBUFFERPROC6DAB872FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDFRAMEBUFFERPROC6DAB872FFunc PFNGLBINDFRAMEBUFFERPROC - -func (x PFNGLBINDRENDERBUFFERPROC) PassRef() (ref *C.PFNGLBINDRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDRENDERBUFFERPROC3F834DFAFunc == nil { - pFNGLBINDRENDERBUFFERPROC3F834DFAFunc = x - } - return (*C.PFNGLBINDRENDERBUFFERPROC)(C.PFNGLBINDRENDERBUFFERPROC_3f834dfa), nil -} - -func (x PFNGLBINDRENDERBUFFERPROC) PassValue() (ref C.PFNGLBINDRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDRENDERBUFFERPROC3F834DFAFunc == nil { - pFNGLBINDRENDERBUFFERPROC3F834DFAFunc = x - } - return (C.PFNGLBINDRENDERBUFFERPROC)(C.PFNGLBINDRENDERBUFFERPROC_3f834dfa), nil -} - -func NewPFNGLBINDRENDERBUFFERPROCRef(ref unsafe.Pointer) *PFNGLBINDRENDERBUFFERPROC { - return (*PFNGLBINDRENDERBUFFERPROC)(ref) -} - -//export PFNGLBINDRENDERBUFFERPROC3F834DFA -func PFNGLBINDRENDERBUFFERPROC3F834DFA() { - if pFNGLBINDRENDERBUFFERPROC3F834DFAFunc != nil { - pFNGLBINDRENDERBUFFERPROC3F834DFAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDRENDERBUFFERPROC3F834DFAFunc PFNGLBINDRENDERBUFFERPROC - -func (x PFNGLBINDTEXTUREPROC) PassRef() (ref *C.PFNGLBINDTEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDTEXTUREPROC8ED8EC9DFunc == nil { - pFNGLBINDTEXTUREPROC8ED8EC9DFunc = x - } - return (*C.PFNGLBINDTEXTUREPROC)(C.PFNGLBINDTEXTUREPROC_8ed8ec9d), nil -} - -func (x PFNGLBINDTEXTUREPROC) PassValue() (ref C.PFNGLBINDTEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDTEXTUREPROC8ED8EC9DFunc == nil { - pFNGLBINDTEXTUREPROC8ED8EC9DFunc = x - } - return (C.PFNGLBINDTEXTUREPROC)(C.PFNGLBINDTEXTUREPROC_8ed8ec9d), nil -} - -func NewPFNGLBINDTEXTUREPROCRef(ref unsafe.Pointer) *PFNGLBINDTEXTUREPROC { - return (*PFNGLBINDTEXTUREPROC)(ref) -} - -//export PFNGLBINDTEXTUREPROC8ED8EC9D -func PFNGLBINDTEXTUREPROC8ED8EC9D() { - if pFNGLBINDTEXTUREPROC8ED8EC9DFunc != nil { - pFNGLBINDTEXTUREPROC8ED8EC9DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDTEXTUREPROC8ED8EC9DFunc PFNGLBINDTEXTUREPROC - -func (x PFNGLBLENDCOLORPROC) PassRef() (ref *C.PFNGLBLENDCOLORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDCOLORPROCC3166A72Func == nil { - pFNGLBLENDCOLORPROCC3166A72Func = x - } - return (*C.PFNGLBLENDCOLORPROC)(C.PFNGLBLENDCOLORPROC_c3166a72), nil -} - -func (x PFNGLBLENDCOLORPROC) PassValue() (ref C.PFNGLBLENDCOLORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDCOLORPROCC3166A72Func == nil { - pFNGLBLENDCOLORPROCC3166A72Func = x - } - return (C.PFNGLBLENDCOLORPROC)(C.PFNGLBLENDCOLORPROC_c3166a72), nil -} - -func NewPFNGLBLENDCOLORPROCRef(ref unsafe.Pointer) *PFNGLBLENDCOLORPROC { - return (*PFNGLBLENDCOLORPROC)(ref) -} - -//export PFNGLBLENDCOLORPROCC3166A72 -func PFNGLBLENDCOLORPROCC3166A72() { - if pFNGLBLENDCOLORPROCC3166A72Func != nil { - pFNGLBLENDCOLORPROCC3166A72Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDCOLORPROCC3166A72Func PFNGLBLENDCOLORPROC - -func (x PFNGLBLENDEQUATIONPROC) PassRef() (ref *C.PFNGLBLENDEQUATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDEQUATIONPROC69096E8BFunc == nil { - pFNGLBLENDEQUATIONPROC69096E8BFunc = x - } - return (*C.PFNGLBLENDEQUATIONPROC)(C.PFNGLBLENDEQUATIONPROC_69096e8b), nil -} - -func (x PFNGLBLENDEQUATIONPROC) PassValue() (ref C.PFNGLBLENDEQUATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDEQUATIONPROC69096E8BFunc == nil { - pFNGLBLENDEQUATIONPROC69096E8BFunc = x - } - return (C.PFNGLBLENDEQUATIONPROC)(C.PFNGLBLENDEQUATIONPROC_69096e8b), nil -} - -func NewPFNGLBLENDEQUATIONPROCRef(ref unsafe.Pointer) *PFNGLBLENDEQUATIONPROC { - return (*PFNGLBLENDEQUATIONPROC)(ref) -} - -//export PFNGLBLENDEQUATIONPROC69096E8B -func PFNGLBLENDEQUATIONPROC69096E8B() { - if pFNGLBLENDEQUATIONPROC69096E8BFunc != nil { - pFNGLBLENDEQUATIONPROC69096E8BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDEQUATIONPROC69096E8BFunc PFNGLBLENDEQUATIONPROC - -func (x PFNGLBLENDEQUATIONSEPARATEPROC) PassRef() (ref *C.PFNGLBLENDEQUATIONSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26Func == nil { - pFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26Func = x - } - return (*C.PFNGLBLENDEQUATIONSEPARATEPROC)(C.PFNGLBLENDEQUATIONSEPARATEPROC_eaf8dd26), nil -} - -func (x PFNGLBLENDEQUATIONSEPARATEPROC) PassValue() (ref C.PFNGLBLENDEQUATIONSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26Func == nil { - pFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26Func = x - } - return (C.PFNGLBLENDEQUATIONSEPARATEPROC)(C.PFNGLBLENDEQUATIONSEPARATEPROC_eaf8dd26), nil -} - -func NewPFNGLBLENDEQUATIONSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLBLENDEQUATIONSEPARATEPROC { - return (*PFNGLBLENDEQUATIONSEPARATEPROC)(ref) -} - -//export PFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26 -func PFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26() { - if pFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26Func != nil { - pFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDEQUATIONSEPARATEPROCEAF8DD26Func PFNGLBLENDEQUATIONSEPARATEPROC - -func (x PFNGLBLENDFUNCPROC) PassRef() (ref *C.PFNGLBLENDFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDFUNCPROC9C82DF9AFunc == nil { - pFNGLBLENDFUNCPROC9C82DF9AFunc = x - } - return (*C.PFNGLBLENDFUNCPROC)(C.PFNGLBLENDFUNCPROC_9c82df9a), nil -} - -func (x PFNGLBLENDFUNCPROC) PassValue() (ref C.PFNGLBLENDFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDFUNCPROC9C82DF9AFunc == nil { - pFNGLBLENDFUNCPROC9C82DF9AFunc = x - } - return (C.PFNGLBLENDFUNCPROC)(C.PFNGLBLENDFUNCPROC_9c82df9a), nil -} - -func NewPFNGLBLENDFUNCPROCRef(ref unsafe.Pointer) *PFNGLBLENDFUNCPROC { - return (*PFNGLBLENDFUNCPROC)(ref) -} - -//export PFNGLBLENDFUNCPROC9C82DF9A -func PFNGLBLENDFUNCPROC9C82DF9A() { - if pFNGLBLENDFUNCPROC9C82DF9AFunc != nil { - pFNGLBLENDFUNCPROC9C82DF9AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDFUNCPROC9C82DF9AFunc PFNGLBLENDFUNCPROC - -func (x PFNGLBLENDFUNCSEPARATEPROC) PassRef() (ref *C.PFNGLBLENDFUNCSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDFUNCSEPARATEPROC8F247F05Func == nil { - pFNGLBLENDFUNCSEPARATEPROC8F247F05Func = x - } - return (*C.PFNGLBLENDFUNCSEPARATEPROC)(C.PFNGLBLENDFUNCSEPARATEPROC_8f247f05), nil -} - -func (x PFNGLBLENDFUNCSEPARATEPROC) PassValue() (ref C.PFNGLBLENDFUNCSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDFUNCSEPARATEPROC8F247F05Func == nil { - pFNGLBLENDFUNCSEPARATEPROC8F247F05Func = x - } - return (C.PFNGLBLENDFUNCSEPARATEPROC)(C.PFNGLBLENDFUNCSEPARATEPROC_8f247f05), nil -} - -func NewPFNGLBLENDFUNCSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLBLENDFUNCSEPARATEPROC { - return (*PFNGLBLENDFUNCSEPARATEPROC)(ref) -} - -//export PFNGLBLENDFUNCSEPARATEPROC8F247F05 -func PFNGLBLENDFUNCSEPARATEPROC8F247F05() { - if pFNGLBLENDFUNCSEPARATEPROC8F247F05Func != nil { - pFNGLBLENDFUNCSEPARATEPROC8F247F05Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDFUNCSEPARATEPROC8F247F05Func PFNGLBLENDFUNCSEPARATEPROC - -func (x PFNGLBUFFERDATAPROC) PassRef() (ref *C.PFNGLBUFFERDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBUFFERDATAPROC108A8F9AFunc == nil { - pFNGLBUFFERDATAPROC108A8F9AFunc = x - } - return (*C.PFNGLBUFFERDATAPROC)(C.PFNGLBUFFERDATAPROC_108a8f9a), nil -} - -func (x PFNGLBUFFERDATAPROC) PassValue() (ref C.PFNGLBUFFERDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBUFFERDATAPROC108A8F9AFunc == nil { - pFNGLBUFFERDATAPROC108A8F9AFunc = x - } - return (C.PFNGLBUFFERDATAPROC)(C.PFNGLBUFFERDATAPROC_108a8f9a), nil -} - -func NewPFNGLBUFFERDATAPROCRef(ref unsafe.Pointer) *PFNGLBUFFERDATAPROC { - return (*PFNGLBUFFERDATAPROC)(ref) -} - -//export PFNGLBUFFERDATAPROC108A8F9A -func PFNGLBUFFERDATAPROC108A8F9A() { - if pFNGLBUFFERDATAPROC108A8F9AFunc != nil { - pFNGLBUFFERDATAPROC108A8F9AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBUFFERDATAPROC108A8F9AFunc PFNGLBUFFERDATAPROC - -func (x PFNGLBUFFERSUBDATAPROC) PassRef() (ref *C.PFNGLBUFFERSUBDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBUFFERSUBDATAPROCA57A5D10Func == nil { - pFNGLBUFFERSUBDATAPROCA57A5D10Func = x - } - return (*C.PFNGLBUFFERSUBDATAPROC)(C.PFNGLBUFFERSUBDATAPROC_a57a5d10), nil -} - -func (x PFNGLBUFFERSUBDATAPROC) PassValue() (ref C.PFNGLBUFFERSUBDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBUFFERSUBDATAPROCA57A5D10Func == nil { - pFNGLBUFFERSUBDATAPROCA57A5D10Func = x - } - return (C.PFNGLBUFFERSUBDATAPROC)(C.PFNGLBUFFERSUBDATAPROC_a57a5d10), nil -} - -func NewPFNGLBUFFERSUBDATAPROCRef(ref unsafe.Pointer) *PFNGLBUFFERSUBDATAPROC { - return (*PFNGLBUFFERSUBDATAPROC)(ref) -} - -//export PFNGLBUFFERSUBDATAPROCA57A5D10 -func PFNGLBUFFERSUBDATAPROCA57A5D10() { - if pFNGLBUFFERSUBDATAPROCA57A5D10Func != nil { - pFNGLBUFFERSUBDATAPROCA57A5D10Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBUFFERSUBDATAPROCA57A5D10Func PFNGLBUFFERSUBDATAPROC - -func (x PFNGLCHECKFRAMEBUFFERSTATUSPROC) PassRef() (ref *C.PFNGLCHECKFRAMEBUFFERSTATUSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02ADFunc == nil { - pFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02ADFunc = x - } - return (*C.PFNGLCHECKFRAMEBUFFERSTATUSPROC)(C.PFNGLCHECKFRAMEBUFFERSTATUSPROC_c70b02ad), nil -} - -func (x PFNGLCHECKFRAMEBUFFERSTATUSPROC) PassValue() (ref C.PFNGLCHECKFRAMEBUFFERSTATUSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02ADFunc == nil { - pFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02ADFunc = x - } - return (C.PFNGLCHECKFRAMEBUFFERSTATUSPROC)(C.PFNGLCHECKFRAMEBUFFERSTATUSPROC_c70b02ad), nil -} - -func NewPFNGLCHECKFRAMEBUFFERSTATUSPROCRef(ref unsafe.Pointer) *PFNGLCHECKFRAMEBUFFERSTATUSPROC { - return (*PFNGLCHECKFRAMEBUFFERSTATUSPROC)(ref) -} - -//export PFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02AD -func PFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02AD() { - if pFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02ADFunc != nil { - pFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02ADFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCHECKFRAMEBUFFERSTATUSPROCC70B02ADFunc PFNGLCHECKFRAMEBUFFERSTATUSPROC - -func (x PFNGLCLEARCOLORPROC) PassRef() (ref *C.PFNGLCLEARCOLORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARCOLORPROCBBF95DD3Func == nil { - pFNGLCLEARCOLORPROCBBF95DD3Func = x - } - return (*C.PFNGLCLEARCOLORPROC)(C.PFNGLCLEARCOLORPROC_bbf95dd3), nil -} - -func (x PFNGLCLEARCOLORPROC) PassValue() (ref C.PFNGLCLEARCOLORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARCOLORPROCBBF95DD3Func == nil { - pFNGLCLEARCOLORPROCBBF95DD3Func = x - } - return (C.PFNGLCLEARCOLORPROC)(C.PFNGLCLEARCOLORPROC_bbf95dd3), nil -} - -func NewPFNGLCLEARCOLORPROCRef(ref unsafe.Pointer) *PFNGLCLEARCOLORPROC { - return (*PFNGLCLEARCOLORPROC)(ref) -} - -//export PFNGLCLEARCOLORPROCBBF95DD3 -func PFNGLCLEARCOLORPROCBBF95DD3() { - if pFNGLCLEARCOLORPROCBBF95DD3Func != nil { - pFNGLCLEARCOLORPROCBBF95DD3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARCOLORPROCBBF95DD3Func PFNGLCLEARCOLORPROC - -func (x PFNGLCLEARDEPTHFPROC) PassRef() (ref *C.PFNGLCLEARDEPTHFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARDEPTHFPROC0393FF33Func == nil { - pFNGLCLEARDEPTHFPROC0393FF33Func = x - } - return (*C.PFNGLCLEARDEPTHFPROC)(C.PFNGLCLEARDEPTHFPROC_0393ff33), nil -} - -func (x PFNGLCLEARDEPTHFPROC) PassValue() (ref C.PFNGLCLEARDEPTHFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARDEPTHFPROC0393FF33Func == nil { - pFNGLCLEARDEPTHFPROC0393FF33Func = x - } - return (C.PFNGLCLEARDEPTHFPROC)(C.PFNGLCLEARDEPTHFPROC_0393ff33), nil -} - -func NewPFNGLCLEARDEPTHFPROCRef(ref unsafe.Pointer) *PFNGLCLEARDEPTHFPROC { - return (*PFNGLCLEARDEPTHFPROC)(ref) -} - -//export PFNGLCLEARDEPTHFPROC0393FF33 -func PFNGLCLEARDEPTHFPROC0393FF33() { - if pFNGLCLEARDEPTHFPROC0393FF33Func != nil { - pFNGLCLEARDEPTHFPROC0393FF33Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARDEPTHFPROC0393FF33Func PFNGLCLEARDEPTHFPROC - -func (x PFNGLCLEARPROC) PassRef() (ref *C.PFNGLCLEARPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARPROC5C505A01Func == nil { - pFNGLCLEARPROC5C505A01Func = x - } - return (*C.PFNGLCLEARPROC)(C.PFNGLCLEARPROC_5c505a01), nil -} - -func (x PFNGLCLEARPROC) PassValue() (ref C.PFNGLCLEARPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARPROC5C505A01Func == nil { - pFNGLCLEARPROC5C505A01Func = x - } - return (C.PFNGLCLEARPROC)(C.PFNGLCLEARPROC_5c505a01), nil -} - -func NewPFNGLCLEARPROCRef(ref unsafe.Pointer) *PFNGLCLEARPROC { - return (*PFNGLCLEARPROC)(ref) -} - -//export PFNGLCLEARPROC5C505A01 -func PFNGLCLEARPROC5C505A01() { - if pFNGLCLEARPROC5C505A01Func != nil { - pFNGLCLEARPROC5C505A01Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARPROC5C505A01Func PFNGLCLEARPROC - -func (x PFNGLCLEARSTENCILPROC) PassRef() (ref *C.PFNGLCLEARSTENCILPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARSTENCILPROC294E6113Func == nil { - pFNGLCLEARSTENCILPROC294E6113Func = x - } - return (*C.PFNGLCLEARSTENCILPROC)(C.PFNGLCLEARSTENCILPROC_294e6113), nil -} - -func (x PFNGLCLEARSTENCILPROC) PassValue() (ref C.PFNGLCLEARSTENCILPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARSTENCILPROC294E6113Func == nil { - pFNGLCLEARSTENCILPROC294E6113Func = x - } - return (C.PFNGLCLEARSTENCILPROC)(C.PFNGLCLEARSTENCILPROC_294e6113), nil -} - -func NewPFNGLCLEARSTENCILPROCRef(ref unsafe.Pointer) *PFNGLCLEARSTENCILPROC { - return (*PFNGLCLEARSTENCILPROC)(ref) -} - -//export PFNGLCLEARSTENCILPROC294E6113 -func PFNGLCLEARSTENCILPROC294E6113() { - if pFNGLCLEARSTENCILPROC294E6113Func != nil { - pFNGLCLEARSTENCILPROC294E6113Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARSTENCILPROC294E6113Func PFNGLCLEARSTENCILPROC - -func (x PFNGLCOLORMASKPROC) PassRef() (ref *C.PFNGLCOLORMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOLORMASKPROCC9E06898Func == nil { - pFNGLCOLORMASKPROCC9E06898Func = x - } - return (*C.PFNGLCOLORMASKPROC)(C.PFNGLCOLORMASKPROC_c9e06898), nil -} - -func (x PFNGLCOLORMASKPROC) PassValue() (ref C.PFNGLCOLORMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOLORMASKPROCC9E06898Func == nil { - pFNGLCOLORMASKPROCC9E06898Func = x - } - return (C.PFNGLCOLORMASKPROC)(C.PFNGLCOLORMASKPROC_c9e06898), nil -} - -func NewPFNGLCOLORMASKPROCRef(ref unsafe.Pointer) *PFNGLCOLORMASKPROC { - return (*PFNGLCOLORMASKPROC)(ref) -} - -//export PFNGLCOLORMASKPROCC9E06898 -func PFNGLCOLORMASKPROCC9E06898() { - if pFNGLCOLORMASKPROCC9E06898Func != nil { - pFNGLCOLORMASKPROCC9E06898Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOLORMASKPROCC9E06898Func PFNGLCOLORMASKPROC - -func (x PFNGLCOMPILESHADERPROC) PassRef() (ref *C.PFNGLCOMPILESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPILESHADERPROCFA71632CFunc == nil { - pFNGLCOMPILESHADERPROCFA71632CFunc = x - } - return (*C.PFNGLCOMPILESHADERPROC)(C.PFNGLCOMPILESHADERPROC_fa71632c), nil -} - -func (x PFNGLCOMPILESHADERPROC) PassValue() (ref C.PFNGLCOMPILESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPILESHADERPROCFA71632CFunc == nil { - pFNGLCOMPILESHADERPROCFA71632CFunc = x - } - return (C.PFNGLCOMPILESHADERPROC)(C.PFNGLCOMPILESHADERPROC_fa71632c), nil -} - -func NewPFNGLCOMPILESHADERPROCRef(ref unsafe.Pointer) *PFNGLCOMPILESHADERPROC { - return (*PFNGLCOMPILESHADERPROC)(ref) -} - -//export PFNGLCOMPILESHADERPROCFA71632C -func PFNGLCOMPILESHADERPROCFA71632C() { - if pFNGLCOMPILESHADERPROCFA71632CFunc != nil { - pFNGLCOMPILESHADERPROCFA71632CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOMPILESHADERPROCFA71632CFunc PFNGLCOMPILESHADERPROC - -func (x PFNGLCOMPRESSEDTEXIMAGE2DPROC) PassRef() (ref *C.PFNGLCOMPRESSEDTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9DFunc == nil { - pFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9DFunc = x - } - return (*C.PFNGLCOMPRESSEDTEXIMAGE2DPROC)(C.PFNGLCOMPRESSEDTEXIMAGE2DPROC_25c09a9d), nil -} - -func (x PFNGLCOMPRESSEDTEXIMAGE2DPROC) PassValue() (ref C.PFNGLCOMPRESSEDTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9DFunc == nil { - pFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9DFunc = x - } - return (C.PFNGLCOMPRESSEDTEXIMAGE2DPROC)(C.PFNGLCOMPRESSEDTEXIMAGE2DPROC_25c09a9d), nil -} - -func NewPFNGLCOMPRESSEDTEXIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLCOMPRESSEDTEXIMAGE2DPROC { - return (*PFNGLCOMPRESSEDTEXIMAGE2DPROC)(ref) -} - -//export PFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9D -func PFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9D() { - if pFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9DFunc != nil { - pFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOMPRESSEDTEXIMAGE2DPROC25C09A9DFunc PFNGLCOMPRESSEDTEXIMAGE2DPROC - -func (x PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) PassRef() (ref *C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169Func == nil { - pFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169Func = x - } - return (*C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_cd1f0169), nil -} - -func (x PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) PassValue() (ref C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169Func == nil { - pFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169Func = x - } - return (C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_cd1f0169), nil -} - -func NewPFNGLCOMPRESSEDTEXSUBIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC { - return (*PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(ref) -} - -//export PFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169 -func PFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169() { - if pFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169Func != nil { - pFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOMPRESSEDTEXSUBIMAGE2DPROCCD1F0169Func PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC - -func (x PFNGLCOPYTEXIMAGE2DPROC) PassRef() (ref *C.PFNGLCOPYTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXIMAGE2DPROC362CB2C6Func == nil { - pFNGLCOPYTEXIMAGE2DPROC362CB2C6Func = x - } - return (*C.PFNGLCOPYTEXIMAGE2DPROC)(C.PFNGLCOPYTEXIMAGE2DPROC_362cb2c6), nil -} - -func (x PFNGLCOPYTEXIMAGE2DPROC) PassValue() (ref C.PFNGLCOPYTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXIMAGE2DPROC362CB2C6Func == nil { - pFNGLCOPYTEXIMAGE2DPROC362CB2C6Func = x - } - return (C.PFNGLCOPYTEXIMAGE2DPROC)(C.PFNGLCOPYTEXIMAGE2DPROC_362cb2c6), nil -} - -func NewPFNGLCOPYTEXIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLCOPYTEXIMAGE2DPROC { - return (*PFNGLCOPYTEXIMAGE2DPROC)(ref) -} - -//export PFNGLCOPYTEXIMAGE2DPROC362CB2C6 -func PFNGLCOPYTEXIMAGE2DPROC362CB2C6() { - if pFNGLCOPYTEXIMAGE2DPROC362CB2C6Func != nil { - pFNGLCOPYTEXIMAGE2DPROC362CB2C6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOPYTEXIMAGE2DPROC362CB2C6Func PFNGLCOPYTEXIMAGE2DPROC - -func (x PFNGLCOPYTEXSUBIMAGE2DPROC) PassRef() (ref *C.PFNGLCOPYTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4Func == nil { - pFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4Func = x - } - return (*C.PFNGLCOPYTEXSUBIMAGE2DPROC)(C.PFNGLCOPYTEXSUBIMAGE2DPROC_f084f8e4), nil -} - -func (x PFNGLCOPYTEXSUBIMAGE2DPROC) PassValue() (ref C.PFNGLCOPYTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4Func == nil { - pFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4Func = x - } - return (C.PFNGLCOPYTEXSUBIMAGE2DPROC)(C.PFNGLCOPYTEXSUBIMAGE2DPROC_f084f8e4), nil -} - -func NewPFNGLCOPYTEXSUBIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLCOPYTEXSUBIMAGE2DPROC { - return (*PFNGLCOPYTEXSUBIMAGE2DPROC)(ref) -} - -//export PFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4 -func PFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4() { - if pFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4Func != nil { - pFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOPYTEXSUBIMAGE2DPROCF084F8E4Func PFNGLCOPYTEXSUBIMAGE2DPROC - -func (x PFNGLCREATEPROGRAMPROC) PassRef() (ref *C.PFNGLCREATEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCREATEPROGRAMPROCB7320E79Func == nil { - pFNGLCREATEPROGRAMPROCB7320E79Func = x - } - return (*C.PFNGLCREATEPROGRAMPROC)(C.PFNGLCREATEPROGRAMPROC_b7320e79), nil -} - -func (x PFNGLCREATEPROGRAMPROC) PassValue() (ref C.PFNGLCREATEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCREATEPROGRAMPROCB7320E79Func == nil { - pFNGLCREATEPROGRAMPROCB7320E79Func = x - } - return (C.PFNGLCREATEPROGRAMPROC)(C.PFNGLCREATEPROGRAMPROC_b7320e79), nil -} - -func NewPFNGLCREATEPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLCREATEPROGRAMPROC { - return (*PFNGLCREATEPROGRAMPROC)(ref) -} - -//export PFNGLCREATEPROGRAMPROCB7320E79 -func PFNGLCREATEPROGRAMPROCB7320E79() { - if pFNGLCREATEPROGRAMPROCB7320E79Func != nil { - pFNGLCREATEPROGRAMPROCB7320E79Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCREATEPROGRAMPROCB7320E79Func PFNGLCREATEPROGRAMPROC - -func (x PFNGLCREATESHADERPROC) PassRef() (ref *C.PFNGLCREATESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCREATESHADERPROC90286FEBFunc == nil { - pFNGLCREATESHADERPROC90286FEBFunc = x - } - return (*C.PFNGLCREATESHADERPROC)(C.PFNGLCREATESHADERPROC_90286feb), nil -} - -func (x PFNGLCREATESHADERPROC) PassValue() (ref C.PFNGLCREATESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCREATESHADERPROC90286FEBFunc == nil { - pFNGLCREATESHADERPROC90286FEBFunc = x - } - return (C.PFNGLCREATESHADERPROC)(C.PFNGLCREATESHADERPROC_90286feb), nil -} - -func NewPFNGLCREATESHADERPROCRef(ref unsafe.Pointer) *PFNGLCREATESHADERPROC { - return (*PFNGLCREATESHADERPROC)(ref) -} - -//export PFNGLCREATESHADERPROC90286FEB -func PFNGLCREATESHADERPROC90286FEB() { - if pFNGLCREATESHADERPROC90286FEBFunc != nil { - pFNGLCREATESHADERPROC90286FEBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCREATESHADERPROC90286FEBFunc PFNGLCREATESHADERPROC - -func (x PFNGLCULLFACEPROC) PassRef() (ref *C.PFNGLCULLFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCULLFACEPROCFDD0B6ABFunc == nil { - pFNGLCULLFACEPROCFDD0B6ABFunc = x - } - return (*C.PFNGLCULLFACEPROC)(C.PFNGLCULLFACEPROC_fdd0b6ab), nil -} - -func (x PFNGLCULLFACEPROC) PassValue() (ref C.PFNGLCULLFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCULLFACEPROCFDD0B6ABFunc == nil { - pFNGLCULLFACEPROCFDD0B6ABFunc = x - } - return (C.PFNGLCULLFACEPROC)(C.PFNGLCULLFACEPROC_fdd0b6ab), nil -} - -func NewPFNGLCULLFACEPROCRef(ref unsafe.Pointer) *PFNGLCULLFACEPROC { - return (*PFNGLCULLFACEPROC)(ref) -} - -//export PFNGLCULLFACEPROCFDD0B6AB -func PFNGLCULLFACEPROCFDD0B6AB() { - if pFNGLCULLFACEPROCFDD0B6ABFunc != nil { - pFNGLCULLFACEPROCFDD0B6ABFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCULLFACEPROCFDD0B6ABFunc PFNGLCULLFACEPROC - -func (x PFNGLDELETEBUFFERSPROC) PassRef() (ref *C.PFNGLDELETEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEBUFFERSPROC71945243Func == nil { - pFNGLDELETEBUFFERSPROC71945243Func = x - } - return (*C.PFNGLDELETEBUFFERSPROC)(C.PFNGLDELETEBUFFERSPROC_71945243), nil -} - -func (x PFNGLDELETEBUFFERSPROC) PassValue() (ref C.PFNGLDELETEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEBUFFERSPROC71945243Func == nil { - pFNGLDELETEBUFFERSPROC71945243Func = x - } - return (C.PFNGLDELETEBUFFERSPROC)(C.PFNGLDELETEBUFFERSPROC_71945243), nil -} - -func NewPFNGLDELETEBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLDELETEBUFFERSPROC { - return (*PFNGLDELETEBUFFERSPROC)(ref) -} - -//export PFNGLDELETEBUFFERSPROC71945243 -func PFNGLDELETEBUFFERSPROC71945243() { - if pFNGLDELETEBUFFERSPROC71945243Func != nil { - pFNGLDELETEBUFFERSPROC71945243Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETEBUFFERSPROC71945243Func PFNGLDELETEBUFFERSPROC - -func (x PFNGLDELETEFRAMEBUFFERSPROC) PassRef() (ref *C.PFNGLDELETEFRAMEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEFRAMEBUFFERSPROCE82EA5E7Func == nil { - pFNGLDELETEFRAMEBUFFERSPROCE82EA5E7Func = x - } - return (*C.PFNGLDELETEFRAMEBUFFERSPROC)(C.PFNGLDELETEFRAMEBUFFERSPROC_e82ea5e7), nil -} - -func (x PFNGLDELETEFRAMEBUFFERSPROC) PassValue() (ref C.PFNGLDELETEFRAMEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEFRAMEBUFFERSPROCE82EA5E7Func == nil { - pFNGLDELETEFRAMEBUFFERSPROCE82EA5E7Func = x - } - return (C.PFNGLDELETEFRAMEBUFFERSPROC)(C.PFNGLDELETEFRAMEBUFFERSPROC_e82ea5e7), nil -} - -func NewPFNGLDELETEFRAMEBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLDELETEFRAMEBUFFERSPROC { - return (*PFNGLDELETEFRAMEBUFFERSPROC)(ref) -} - -//export PFNGLDELETEFRAMEBUFFERSPROCE82EA5E7 -func PFNGLDELETEFRAMEBUFFERSPROCE82EA5E7() { - if pFNGLDELETEFRAMEBUFFERSPROCE82EA5E7Func != nil { - pFNGLDELETEFRAMEBUFFERSPROCE82EA5E7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETEFRAMEBUFFERSPROCE82EA5E7Func PFNGLDELETEFRAMEBUFFERSPROC - -func (x PFNGLDELETEPROGRAMPROC) PassRef() (ref *C.PFNGLDELETEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEPROGRAMPROC980D924FFunc == nil { - pFNGLDELETEPROGRAMPROC980D924FFunc = x - } - return (*C.PFNGLDELETEPROGRAMPROC)(C.PFNGLDELETEPROGRAMPROC_980d924f), nil -} - -func (x PFNGLDELETEPROGRAMPROC) PassValue() (ref C.PFNGLDELETEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEPROGRAMPROC980D924FFunc == nil { - pFNGLDELETEPROGRAMPROC980D924FFunc = x - } - return (C.PFNGLDELETEPROGRAMPROC)(C.PFNGLDELETEPROGRAMPROC_980d924f), nil -} - -func NewPFNGLDELETEPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLDELETEPROGRAMPROC { - return (*PFNGLDELETEPROGRAMPROC)(ref) -} - -//export PFNGLDELETEPROGRAMPROC980D924F -func PFNGLDELETEPROGRAMPROC980D924F() { - if pFNGLDELETEPROGRAMPROC980D924FFunc != nil { - pFNGLDELETEPROGRAMPROC980D924FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETEPROGRAMPROC980D924FFunc PFNGLDELETEPROGRAMPROC - -func (x PFNGLDELETERENDERBUFFERSPROC) PassRef() (ref *C.PFNGLDELETERENDERBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETERENDERBUFFERSPROC578E77FBFunc == nil { - pFNGLDELETERENDERBUFFERSPROC578E77FBFunc = x - } - return (*C.PFNGLDELETERENDERBUFFERSPROC)(C.PFNGLDELETERENDERBUFFERSPROC_578e77fb), nil -} - -func (x PFNGLDELETERENDERBUFFERSPROC) PassValue() (ref C.PFNGLDELETERENDERBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETERENDERBUFFERSPROC578E77FBFunc == nil { - pFNGLDELETERENDERBUFFERSPROC578E77FBFunc = x - } - return (C.PFNGLDELETERENDERBUFFERSPROC)(C.PFNGLDELETERENDERBUFFERSPROC_578e77fb), nil -} - -func NewPFNGLDELETERENDERBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLDELETERENDERBUFFERSPROC { - return (*PFNGLDELETERENDERBUFFERSPROC)(ref) -} - -//export PFNGLDELETERENDERBUFFERSPROC578E77FB -func PFNGLDELETERENDERBUFFERSPROC578E77FB() { - if pFNGLDELETERENDERBUFFERSPROC578E77FBFunc != nil { - pFNGLDELETERENDERBUFFERSPROC578E77FBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETERENDERBUFFERSPROC578E77FBFunc PFNGLDELETERENDERBUFFERSPROC - -func (x PFNGLDELETESHADERPROC) PassRef() (ref *C.PFNGLDELETESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETESHADERPROC71A112DFFunc == nil { - pFNGLDELETESHADERPROC71A112DFFunc = x - } - return (*C.PFNGLDELETESHADERPROC)(C.PFNGLDELETESHADERPROC_71a112df), nil -} - -func (x PFNGLDELETESHADERPROC) PassValue() (ref C.PFNGLDELETESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETESHADERPROC71A112DFFunc == nil { - pFNGLDELETESHADERPROC71A112DFFunc = x - } - return (C.PFNGLDELETESHADERPROC)(C.PFNGLDELETESHADERPROC_71a112df), nil -} - -func NewPFNGLDELETESHADERPROCRef(ref unsafe.Pointer) *PFNGLDELETESHADERPROC { - return (*PFNGLDELETESHADERPROC)(ref) -} - -//export PFNGLDELETESHADERPROC71A112DF -func PFNGLDELETESHADERPROC71A112DF() { - if pFNGLDELETESHADERPROC71A112DFFunc != nil { - pFNGLDELETESHADERPROC71A112DFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETESHADERPROC71A112DFFunc PFNGLDELETESHADERPROC - -func (x PFNGLDELETETEXTURESPROC) PassRef() (ref *C.PFNGLDELETETEXTURESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETETEXTURESPROCB1F8E327Func == nil { - pFNGLDELETETEXTURESPROCB1F8E327Func = x - } - return (*C.PFNGLDELETETEXTURESPROC)(C.PFNGLDELETETEXTURESPROC_b1f8e327), nil -} - -func (x PFNGLDELETETEXTURESPROC) PassValue() (ref C.PFNGLDELETETEXTURESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETETEXTURESPROCB1F8E327Func == nil { - pFNGLDELETETEXTURESPROCB1F8E327Func = x - } - return (C.PFNGLDELETETEXTURESPROC)(C.PFNGLDELETETEXTURESPROC_b1f8e327), nil -} - -func NewPFNGLDELETETEXTURESPROCRef(ref unsafe.Pointer) *PFNGLDELETETEXTURESPROC { - return (*PFNGLDELETETEXTURESPROC)(ref) -} - -//export PFNGLDELETETEXTURESPROCB1F8E327 -func PFNGLDELETETEXTURESPROCB1F8E327() { - if pFNGLDELETETEXTURESPROCB1F8E327Func != nil { - pFNGLDELETETEXTURESPROCB1F8E327Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETETEXTURESPROCB1F8E327Func PFNGLDELETETEXTURESPROC - -func (x PFNGLDEPTHFUNCPROC) PassRef() (ref *C.PFNGLDEPTHFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHFUNCPROC14649A7BFunc == nil { - pFNGLDEPTHFUNCPROC14649A7BFunc = x - } - return (*C.PFNGLDEPTHFUNCPROC)(C.PFNGLDEPTHFUNCPROC_14649a7b), nil -} - -func (x PFNGLDEPTHFUNCPROC) PassValue() (ref C.PFNGLDEPTHFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHFUNCPROC14649A7BFunc == nil { - pFNGLDEPTHFUNCPROC14649A7BFunc = x - } - return (C.PFNGLDEPTHFUNCPROC)(C.PFNGLDEPTHFUNCPROC_14649a7b), nil -} - -func NewPFNGLDEPTHFUNCPROCRef(ref unsafe.Pointer) *PFNGLDEPTHFUNCPROC { - return (*PFNGLDEPTHFUNCPROC)(ref) -} - -//export PFNGLDEPTHFUNCPROC14649A7B -func PFNGLDEPTHFUNCPROC14649A7B() { - if pFNGLDEPTHFUNCPROC14649A7BFunc != nil { - pFNGLDEPTHFUNCPROC14649A7BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDEPTHFUNCPROC14649A7BFunc PFNGLDEPTHFUNCPROC - -func (x PFNGLDEPTHMASKPROC) PassRef() (ref *C.PFNGLDEPTHMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHMASKPROCEAE207EFFunc == nil { - pFNGLDEPTHMASKPROCEAE207EFFunc = x - } - return (*C.PFNGLDEPTHMASKPROC)(C.PFNGLDEPTHMASKPROC_eae207ef), nil -} - -func (x PFNGLDEPTHMASKPROC) PassValue() (ref C.PFNGLDEPTHMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHMASKPROCEAE207EFFunc == nil { - pFNGLDEPTHMASKPROCEAE207EFFunc = x - } - return (C.PFNGLDEPTHMASKPROC)(C.PFNGLDEPTHMASKPROC_eae207ef), nil -} - -func NewPFNGLDEPTHMASKPROCRef(ref unsafe.Pointer) *PFNGLDEPTHMASKPROC { - return (*PFNGLDEPTHMASKPROC)(ref) -} - -//export PFNGLDEPTHMASKPROCEAE207EF -func PFNGLDEPTHMASKPROCEAE207EF() { - if pFNGLDEPTHMASKPROCEAE207EFFunc != nil { - pFNGLDEPTHMASKPROCEAE207EFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDEPTHMASKPROCEAE207EFFunc PFNGLDEPTHMASKPROC - -func (x PFNGLDEPTHRANGEFPROC) PassRef() (ref *C.PFNGLDEPTHRANGEFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHRANGEFPROCDF1D7C44Func == nil { - pFNGLDEPTHRANGEFPROCDF1D7C44Func = x - } - return (*C.PFNGLDEPTHRANGEFPROC)(C.PFNGLDEPTHRANGEFPROC_df1d7c44), nil -} - -func (x PFNGLDEPTHRANGEFPROC) PassValue() (ref C.PFNGLDEPTHRANGEFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHRANGEFPROCDF1D7C44Func == nil { - pFNGLDEPTHRANGEFPROCDF1D7C44Func = x - } - return (C.PFNGLDEPTHRANGEFPROC)(C.PFNGLDEPTHRANGEFPROC_df1d7c44), nil -} - -func NewPFNGLDEPTHRANGEFPROCRef(ref unsafe.Pointer) *PFNGLDEPTHRANGEFPROC { - return (*PFNGLDEPTHRANGEFPROC)(ref) -} - -//export PFNGLDEPTHRANGEFPROCDF1D7C44 -func PFNGLDEPTHRANGEFPROCDF1D7C44() { - if pFNGLDEPTHRANGEFPROCDF1D7C44Func != nil { - pFNGLDEPTHRANGEFPROCDF1D7C44Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDEPTHRANGEFPROCDF1D7C44Func PFNGLDEPTHRANGEFPROC - -func (x PFNGLDETACHSHADERPROC) PassRef() (ref *C.PFNGLDETACHSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDETACHSHADERPROCCB02FA06Func == nil { - pFNGLDETACHSHADERPROCCB02FA06Func = x - } - return (*C.PFNGLDETACHSHADERPROC)(C.PFNGLDETACHSHADERPROC_cb02fa06), nil -} - -func (x PFNGLDETACHSHADERPROC) PassValue() (ref C.PFNGLDETACHSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDETACHSHADERPROCCB02FA06Func == nil { - pFNGLDETACHSHADERPROCCB02FA06Func = x - } - return (C.PFNGLDETACHSHADERPROC)(C.PFNGLDETACHSHADERPROC_cb02fa06), nil -} - -func NewPFNGLDETACHSHADERPROCRef(ref unsafe.Pointer) *PFNGLDETACHSHADERPROC { - return (*PFNGLDETACHSHADERPROC)(ref) -} - -//export PFNGLDETACHSHADERPROCCB02FA06 -func PFNGLDETACHSHADERPROCCB02FA06() { - if pFNGLDETACHSHADERPROCCB02FA06Func != nil { - pFNGLDETACHSHADERPROCCB02FA06Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDETACHSHADERPROCCB02FA06Func PFNGLDETACHSHADERPROC - -func (x PFNGLDISABLEPROC) PassRef() (ref *C.PFNGLDISABLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDISABLEPROC09C452ACFunc == nil { - pFNGLDISABLEPROC09C452ACFunc = x - } - return (*C.PFNGLDISABLEPROC)(C.PFNGLDISABLEPROC_09c452ac), nil -} - -func (x PFNGLDISABLEPROC) PassValue() (ref C.PFNGLDISABLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDISABLEPROC09C452ACFunc == nil { - pFNGLDISABLEPROC09C452ACFunc = x - } - return (C.PFNGLDISABLEPROC)(C.PFNGLDISABLEPROC_09c452ac), nil -} - -func NewPFNGLDISABLEPROCRef(ref unsafe.Pointer) *PFNGLDISABLEPROC { - return (*PFNGLDISABLEPROC)(ref) -} - -//export PFNGLDISABLEPROC09C452AC -func PFNGLDISABLEPROC09C452AC() { - if pFNGLDISABLEPROC09C452ACFunc != nil { - pFNGLDISABLEPROC09C452ACFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDISABLEPROC09C452ACFunc PFNGLDISABLEPROC - -func (x PFNGLDISABLEVERTEXATTRIBARRAYPROC) PassRef() (ref *C.PFNGLDISABLEVERTEXATTRIBARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6Func == nil { - pFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6Func = x - } - return (*C.PFNGLDISABLEVERTEXATTRIBARRAYPROC)(C.PFNGLDISABLEVERTEXATTRIBARRAYPROC_55dee1b6), nil -} - -func (x PFNGLDISABLEVERTEXATTRIBARRAYPROC) PassValue() (ref C.PFNGLDISABLEVERTEXATTRIBARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6Func == nil { - pFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6Func = x - } - return (C.PFNGLDISABLEVERTEXATTRIBARRAYPROC)(C.PFNGLDISABLEVERTEXATTRIBARRAYPROC_55dee1b6), nil -} - -func NewPFNGLDISABLEVERTEXATTRIBARRAYPROCRef(ref unsafe.Pointer) *PFNGLDISABLEVERTEXATTRIBARRAYPROC { - return (*PFNGLDISABLEVERTEXATTRIBARRAYPROC)(ref) -} - -//export PFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6 -func PFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6() { - if pFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6Func != nil { - pFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDISABLEVERTEXATTRIBARRAYPROC55DEE1B6Func PFNGLDISABLEVERTEXATTRIBARRAYPROC - -func (x PFNGLDRAWARRAYSPROC) PassRef() (ref *C.PFNGLDRAWARRAYSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWARRAYSPROCEE5DE7F9Func == nil { - pFNGLDRAWARRAYSPROCEE5DE7F9Func = x - } - return (*C.PFNGLDRAWARRAYSPROC)(C.PFNGLDRAWARRAYSPROC_ee5de7f9), nil -} - -func (x PFNGLDRAWARRAYSPROC) PassValue() (ref C.PFNGLDRAWARRAYSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWARRAYSPROCEE5DE7F9Func == nil { - pFNGLDRAWARRAYSPROCEE5DE7F9Func = x - } - return (C.PFNGLDRAWARRAYSPROC)(C.PFNGLDRAWARRAYSPROC_ee5de7f9), nil -} - -func NewPFNGLDRAWARRAYSPROCRef(ref unsafe.Pointer) *PFNGLDRAWARRAYSPROC { - return (*PFNGLDRAWARRAYSPROC)(ref) -} - -//export PFNGLDRAWARRAYSPROCEE5DE7F9 -func PFNGLDRAWARRAYSPROCEE5DE7F9() { - if pFNGLDRAWARRAYSPROCEE5DE7F9Func != nil { - pFNGLDRAWARRAYSPROCEE5DE7F9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDRAWARRAYSPROCEE5DE7F9Func PFNGLDRAWARRAYSPROC - -func (x PFNGLDRAWELEMENTSPROC) PassRef() (ref *C.PFNGLDRAWELEMENTSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWELEMENTSPROC5CC630D9Func == nil { - pFNGLDRAWELEMENTSPROC5CC630D9Func = x - } - return (*C.PFNGLDRAWELEMENTSPROC)(C.PFNGLDRAWELEMENTSPROC_5cc630d9), nil -} - -func (x PFNGLDRAWELEMENTSPROC) PassValue() (ref C.PFNGLDRAWELEMENTSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWELEMENTSPROC5CC630D9Func == nil { - pFNGLDRAWELEMENTSPROC5CC630D9Func = x - } - return (C.PFNGLDRAWELEMENTSPROC)(C.PFNGLDRAWELEMENTSPROC_5cc630d9), nil -} - -func NewPFNGLDRAWELEMENTSPROCRef(ref unsafe.Pointer) *PFNGLDRAWELEMENTSPROC { - return (*PFNGLDRAWELEMENTSPROC)(ref) -} - -//export PFNGLDRAWELEMENTSPROC5CC630D9 -func PFNGLDRAWELEMENTSPROC5CC630D9() { - if pFNGLDRAWELEMENTSPROC5CC630D9Func != nil { - pFNGLDRAWELEMENTSPROC5CC630D9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDRAWELEMENTSPROC5CC630D9Func PFNGLDRAWELEMENTSPROC - -func (x PFNGLENABLEPROC) PassRef() (ref *C.PFNGLENABLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENABLEPROCBD9EEC48Func == nil { - pFNGLENABLEPROCBD9EEC48Func = x - } - return (*C.PFNGLENABLEPROC)(C.PFNGLENABLEPROC_bd9eec48), nil -} - -func (x PFNGLENABLEPROC) PassValue() (ref C.PFNGLENABLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENABLEPROCBD9EEC48Func == nil { - pFNGLENABLEPROCBD9EEC48Func = x - } - return (C.PFNGLENABLEPROC)(C.PFNGLENABLEPROC_bd9eec48), nil -} - -func NewPFNGLENABLEPROCRef(ref unsafe.Pointer) *PFNGLENABLEPROC { - return (*PFNGLENABLEPROC)(ref) -} - -//export PFNGLENABLEPROCBD9EEC48 -func PFNGLENABLEPROCBD9EEC48() { - if pFNGLENABLEPROCBD9EEC48Func != nil { - pFNGLENABLEPROCBD9EEC48Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLENABLEPROCBD9EEC48Func PFNGLENABLEPROC - -func (x PFNGLENABLEVERTEXATTRIBARRAYPROC) PassRef() (ref *C.PFNGLENABLEVERTEXATTRIBARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBBFunc == nil { - pFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBBFunc = x - } - return (*C.PFNGLENABLEVERTEXATTRIBARRAYPROC)(C.PFNGLENABLEVERTEXATTRIBARRAYPROC_5fa65ebb), nil -} - -func (x PFNGLENABLEVERTEXATTRIBARRAYPROC) PassValue() (ref C.PFNGLENABLEVERTEXATTRIBARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBBFunc == nil { - pFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBBFunc = x - } - return (C.PFNGLENABLEVERTEXATTRIBARRAYPROC)(C.PFNGLENABLEVERTEXATTRIBARRAYPROC_5fa65ebb), nil -} - -func NewPFNGLENABLEVERTEXATTRIBARRAYPROCRef(ref unsafe.Pointer) *PFNGLENABLEVERTEXATTRIBARRAYPROC { - return (*PFNGLENABLEVERTEXATTRIBARRAYPROC)(ref) -} - -//export PFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBB -func PFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBB() { - if pFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBBFunc != nil { - pFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLENABLEVERTEXATTRIBARRAYPROC5FA65EBBFunc PFNGLENABLEVERTEXATTRIBARRAYPROC - -func (x PFNGLFINISHPROC) PassRef() (ref *C.PFNGLFINISHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFINISHPROC89486D93Func == nil { - pFNGLFINISHPROC89486D93Func = x - } - return (*C.PFNGLFINISHPROC)(C.PFNGLFINISHPROC_89486d93), nil -} - -func (x PFNGLFINISHPROC) PassValue() (ref C.PFNGLFINISHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFINISHPROC89486D93Func == nil { - pFNGLFINISHPROC89486D93Func = x - } - return (C.PFNGLFINISHPROC)(C.PFNGLFINISHPROC_89486d93), nil -} - -func NewPFNGLFINISHPROCRef(ref unsafe.Pointer) *PFNGLFINISHPROC { - return (*PFNGLFINISHPROC)(ref) -} - -//export PFNGLFINISHPROC89486D93 -func PFNGLFINISHPROC89486D93() { - if pFNGLFINISHPROC89486D93Func != nil { - pFNGLFINISHPROC89486D93Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFINISHPROC89486D93Func PFNGLFINISHPROC - -func (x PFNGLFLUSHPROC) PassRef() (ref *C.PFNGLFLUSHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFLUSHPROC5A17FA98Func == nil { - pFNGLFLUSHPROC5A17FA98Func = x - } - return (*C.PFNGLFLUSHPROC)(C.PFNGLFLUSHPROC_5a17fa98), nil -} - -func (x PFNGLFLUSHPROC) PassValue() (ref C.PFNGLFLUSHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFLUSHPROC5A17FA98Func == nil { - pFNGLFLUSHPROC5A17FA98Func = x - } - return (C.PFNGLFLUSHPROC)(C.PFNGLFLUSHPROC_5a17fa98), nil -} - -func NewPFNGLFLUSHPROCRef(ref unsafe.Pointer) *PFNGLFLUSHPROC { - return (*PFNGLFLUSHPROC)(ref) -} - -//export PFNGLFLUSHPROC5A17FA98 -func PFNGLFLUSHPROC5A17FA98() { - if pFNGLFLUSHPROC5A17FA98Func != nil { - pFNGLFLUSHPROC5A17FA98Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFLUSHPROC5A17FA98Func PFNGLFLUSHPROC - -func (x PFNGLFRAMEBUFFERRENDERBUFFERPROC) PassRef() (ref *C.PFNGLFRAMEBUFFERRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7DFunc == nil { - pFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7DFunc = x - } - return (*C.PFNGLFRAMEBUFFERRENDERBUFFERPROC)(C.PFNGLFRAMEBUFFERRENDERBUFFERPROC_4a3a1f7d), nil -} - -func (x PFNGLFRAMEBUFFERRENDERBUFFERPROC) PassValue() (ref C.PFNGLFRAMEBUFFERRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7DFunc == nil { - pFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7DFunc = x - } - return (C.PFNGLFRAMEBUFFERRENDERBUFFERPROC)(C.PFNGLFRAMEBUFFERRENDERBUFFERPROC_4a3a1f7d), nil -} - -func NewPFNGLFRAMEBUFFERRENDERBUFFERPROCRef(ref unsafe.Pointer) *PFNGLFRAMEBUFFERRENDERBUFFERPROC { - return (*PFNGLFRAMEBUFFERRENDERBUFFERPROC)(ref) -} - -//export PFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7D -func PFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7D() { - if pFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7DFunc != nil { - pFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFRAMEBUFFERRENDERBUFFERPROC4A3A1F7DFunc PFNGLFRAMEBUFFERRENDERBUFFERPROC - -func (x PFNGLFRAMEBUFFERTEXTURE2DPROC) PassRef() (ref *C.PFNGLFRAMEBUFFERTEXTURE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9Func == nil { - pFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9Func = x - } - return (*C.PFNGLFRAMEBUFFERTEXTURE2DPROC)(C.PFNGLFRAMEBUFFERTEXTURE2DPROC_947c34c9), nil -} - -func (x PFNGLFRAMEBUFFERTEXTURE2DPROC) PassValue() (ref C.PFNGLFRAMEBUFFERTEXTURE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9Func == nil { - pFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9Func = x - } - return (C.PFNGLFRAMEBUFFERTEXTURE2DPROC)(C.PFNGLFRAMEBUFFERTEXTURE2DPROC_947c34c9), nil -} - -func NewPFNGLFRAMEBUFFERTEXTURE2DPROCRef(ref unsafe.Pointer) *PFNGLFRAMEBUFFERTEXTURE2DPROC { - return (*PFNGLFRAMEBUFFERTEXTURE2DPROC)(ref) -} - -//export PFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9 -func PFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9() { - if pFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9Func != nil { - pFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFRAMEBUFFERTEXTURE2DPROC947C34C9Func PFNGLFRAMEBUFFERTEXTURE2DPROC - -func (x PFNGLFRONTFACEPROC) PassRef() (ref *C.PFNGLFRONTFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRONTFACEPROCBB965009Func == nil { - pFNGLFRONTFACEPROCBB965009Func = x - } - return (*C.PFNGLFRONTFACEPROC)(C.PFNGLFRONTFACEPROC_bb965009), nil -} - -func (x PFNGLFRONTFACEPROC) PassValue() (ref C.PFNGLFRONTFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRONTFACEPROCBB965009Func == nil { - pFNGLFRONTFACEPROCBB965009Func = x - } - return (C.PFNGLFRONTFACEPROC)(C.PFNGLFRONTFACEPROC_bb965009), nil -} - -func NewPFNGLFRONTFACEPROCRef(ref unsafe.Pointer) *PFNGLFRONTFACEPROC { - return (*PFNGLFRONTFACEPROC)(ref) -} - -//export PFNGLFRONTFACEPROCBB965009 -func PFNGLFRONTFACEPROCBB965009() { - if pFNGLFRONTFACEPROCBB965009Func != nil { - pFNGLFRONTFACEPROCBB965009Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFRONTFACEPROCBB965009Func PFNGLFRONTFACEPROC - -func (x PFNGLGENBUFFERSPROC) PassRef() (ref *C.PFNGLGENBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENBUFFERSPROCFE169F7FFunc == nil { - pFNGLGENBUFFERSPROCFE169F7FFunc = x - } - return (*C.PFNGLGENBUFFERSPROC)(C.PFNGLGENBUFFERSPROC_fe169f7f), nil -} - -func (x PFNGLGENBUFFERSPROC) PassValue() (ref C.PFNGLGENBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENBUFFERSPROCFE169F7FFunc == nil { - pFNGLGENBUFFERSPROCFE169F7FFunc = x - } - return (C.PFNGLGENBUFFERSPROC)(C.PFNGLGENBUFFERSPROC_fe169f7f), nil -} - -func NewPFNGLGENBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLGENBUFFERSPROC { - return (*PFNGLGENBUFFERSPROC)(ref) -} - -//export PFNGLGENBUFFERSPROCFE169F7F -func PFNGLGENBUFFERSPROCFE169F7F() { - if pFNGLGENBUFFERSPROCFE169F7FFunc != nil { - pFNGLGENBUFFERSPROCFE169F7FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENBUFFERSPROCFE169F7FFunc PFNGLGENBUFFERSPROC - -func (x PFNGLGENERATEMIPMAPPROC) PassRef() (ref *C.PFNGLGENERATEMIPMAPPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENERATEMIPMAPPROC16259DF9Func == nil { - pFNGLGENERATEMIPMAPPROC16259DF9Func = x - } - return (*C.PFNGLGENERATEMIPMAPPROC)(C.PFNGLGENERATEMIPMAPPROC_16259df9), nil -} - -func (x PFNGLGENERATEMIPMAPPROC) PassValue() (ref C.PFNGLGENERATEMIPMAPPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENERATEMIPMAPPROC16259DF9Func == nil { - pFNGLGENERATEMIPMAPPROC16259DF9Func = x - } - return (C.PFNGLGENERATEMIPMAPPROC)(C.PFNGLGENERATEMIPMAPPROC_16259df9), nil -} - -func NewPFNGLGENERATEMIPMAPPROCRef(ref unsafe.Pointer) *PFNGLGENERATEMIPMAPPROC { - return (*PFNGLGENERATEMIPMAPPROC)(ref) -} - -//export PFNGLGENERATEMIPMAPPROC16259DF9 -func PFNGLGENERATEMIPMAPPROC16259DF9() { - if pFNGLGENERATEMIPMAPPROC16259DF9Func != nil { - pFNGLGENERATEMIPMAPPROC16259DF9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENERATEMIPMAPPROC16259DF9Func PFNGLGENERATEMIPMAPPROC - -func (x PFNGLGENFRAMEBUFFERSPROC) PassRef() (ref *C.PFNGLGENFRAMEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENFRAMEBUFFERSPROC17A91B18Func == nil { - pFNGLGENFRAMEBUFFERSPROC17A91B18Func = x - } - return (*C.PFNGLGENFRAMEBUFFERSPROC)(C.PFNGLGENFRAMEBUFFERSPROC_17a91b18), nil -} - -func (x PFNGLGENFRAMEBUFFERSPROC) PassValue() (ref C.PFNGLGENFRAMEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENFRAMEBUFFERSPROC17A91B18Func == nil { - pFNGLGENFRAMEBUFFERSPROC17A91B18Func = x - } - return (C.PFNGLGENFRAMEBUFFERSPROC)(C.PFNGLGENFRAMEBUFFERSPROC_17a91b18), nil -} - -func NewPFNGLGENFRAMEBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLGENFRAMEBUFFERSPROC { - return (*PFNGLGENFRAMEBUFFERSPROC)(ref) -} - -//export PFNGLGENFRAMEBUFFERSPROC17A91B18 -func PFNGLGENFRAMEBUFFERSPROC17A91B18() { - if pFNGLGENFRAMEBUFFERSPROC17A91B18Func != nil { - pFNGLGENFRAMEBUFFERSPROC17A91B18Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENFRAMEBUFFERSPROC17A91B18Func PFNGLGENFRAMEBUFFERSPROC - -func (x PFNGLGENRENDERBUFFERSPROC) PassRef() (ref *C.PFNGLGENRENDERBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENRENDERBUFFERSPROCE58B8074Func == nil { - pFNGLGENRENDERBUFFERSPROCE58B8074Func = x - } - return (*C.PFNGLGENRENDERBUFFERSPROC)(C.PFNGLGENRENDERBUFFERSPROC_e58b8074), nil -} - -func (x PFNGLGENRENDERBUFFERSPROC) PassValue() (ref C.PFNGLGENRENDERBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENRENDERBUFFERSPROCE58B8074Func == nil { - pFNGLGENRENDERBUFFERSPROCE58B8074Func = x - } - return (C.PFNGLGENRENDERBUFFERSPROC)(C.PFNGLGENRENDERBUFFERSPROC_e58b8074), nil -} - -func NewPFNGLGENRENDERBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLGENRENDERBUFFERSPROC { - return (*PFNGLGENRENDERBUFFERSPROC)(ref) -} - -//export PFNGLGENRENDERBUFFERSPROCE58B8074 -func PFNGLGENRENDERBUFFERSPROCE58B8074() { - if pFNGLGENRENDERBUFFERSPROCE58B8074Func != nil { - pFNGLGENRENDERBUFFERSPROCE58B8074Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENRENDERBUFFERSPROCE58B8074Func PFNGLGENRENDERBUFFERSPROC - -func (x PFNGLGENTEXTURESPROC) PassRef() (ref *C.PFNGLGENTEXTURESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENTEXTURESPROC984E35D5Func == nil { - pFNGLGENTEXTURESPROC984E35D5Func = x - } - return (*C.PFNGLGENTEXTURESPROC)(C.PFNGLGENTEXTURESPROC_984e35d5), nil -} - -func (x PFNGLGENTEXTURESPROC) PassValue() (ref C.PFNGLGENTEXTURESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENTEXTURESPROC984E35D5Func == nil { - pFNGLGENTEXTURESPROC984E35D5Func = x - } - return (C.PFNGLGENTEXTURESPROC)(C.PFNGLGENTEXTURESPROC_984e35d5), nil -} - -func NewPFNGLGENTEXTURESPROCRef(ref unsafe.Pointer) *PFNGLGENTEXTURESPROC { - return (*PFNGLGENTEXTURESPROC)(ref) -} - -//export PFNGLGENTEXTURESPROC984E35D5 -func PFNGLGENTEXTURESPROC984E35D5() { - if pFNGLGENTEXTURESPROC984E35D5Func != nil { - pFNGLGENTEXTURESPROC984E35D5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENTEXTURESPROC984E35D5Func PFNGLGENTEXTURESPROC - -func (x PFNGLGETACTIVEATTRIBPROC) PassRef() (ref *C.PFNGLGETACTIVEATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEATTRIBPROC671BE206Func == nil { - pFNGLGETACTIVEATTRIBPROC671BE206Func = x - } - return (*C.PFNGLGETACTIVEATTRIBPROC)(C.PFNGLGETACTIVEATTRIBPROC_671be206), nil -} - -func (x PFNGLGETACTIVEATTRIBPROC) PassValue() (ref C.PFNGLGETACTIVEATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEATTRIBPROC671BE206Func == nil { - pFNGLGETACTIVEATTRIBPROC671BE206Func = x - } - return (C.PFNGLGETACTIVEATTRIBPROC)(C.PFNGLGETACTIVEATTRIBPROC_671be206), nil -} - -func NewPFNGLGETACTIVEATTRIBPROCRef(ref unsafe.Pointer) *PFNGLGETACTIVEATTRIBPROC { - return (*PFNGLGETACTIVEATTRIBPROC)(ref) -} - -//export PFNGLGETACTIVEATTRIBPROC671BE206 -func PFNGLGETACTIVEATTRIBPROC671BE206() { - if pFNGLGETACTIVEATTRIBPROC671BE206Func != nil { - pFNGLGETACTIVEATTRIBPROC671BE206Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETACTIVEATTRIBPROC671BE206Func PFNGLGETACTIVEATTRIBPROC - -func (x PFNGLGETACTIVEUNIFORMPROC) PassRef() (ref *C.PFNGLGETACTIVEUNIFORMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMPROCB54D7DB5Func == nil { - pFNGLGETACTIVEUNIFORMPROCB54D7DB5Func = x - } - return (*C.PFNGLGETACTIVEUNIFORMPROC)(C.PFNGLGETACTIVEUNIFORMPROC_b54d7db5), nil -} - -func (x PFNGLGETACTIVEUNIFORMPROC) PassValue() (ref C.PFNGLGETACTIVEUNIFORMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMPROCB54D7DB5Func == nil { - pFNGLGETACTIVEUNIFORMPROCB54D7DB5Func = x - } - return (C.PFNGLGETACTIVEUNIFORMPROC)(C.PFNGLGETACTIVEUNIFORMPROC_b54d7db5), nil -} - -func NewPFNGLGETACTIVEUNIFORMPROCRef(ref unsafe.Pointer) *PFNGLGETACTIVEUNIFORMPROC { - return (*PFNGLGETACTIVEUNIFORMPROC)(ref) -} - -//export PFNGLGETACTIVEUNIFORMPROCB54D7DB5 -func PFNGLGETACTIVEUNIFORMPROCB54D7DB5() { - if pFNGLGETACTIVEUNIFORMPROCB54D7DB5Func != nil { - pFNGLGETACTIVEUNIFORMPROCB54D7DB5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETACTIVEUNIFORMPROCB54D7DB5Func PFNGLGETACTIVEUNIFORMPROC - -func (x PFNGLGETATTACHEDSHADERSPROC) PassRef() (ref *C.PFNGLGETATTACHEDSHADERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETATTACHEDSHADERSPROC37F31C4EFunc == nil { - pFNGLGETATTACHEDSHADERSPROC37F31C4EFunc = x - } - return (*C.PFNGLGETATTACHEDSHADERSPROC)(C.PFNGLGETATTACHEDSHADERSPROC_37f31c4e), nil -} - -func (x PFNGLGETATTACHEDSHADERSPROC) PassValue() (ref C.PFNGLGETATTACHEDSHADERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETATTACHEDSHADERSPROC37F31C4EFunc == nil { - pFNGLGETATTACHEDSHADERSPROC37F31C4EFunc = x - } - return (C.PFNGLGETATTACHEDSHADERSPROC)(C.PFNGLGETATTACHEDSHADERSPROC_37f31c4e), nil -} - -func NewPFNGLGETATTACHEDSHADERSPROCRef(ref unsafe.Pointer) *PFNGLGETATTACHEDSHADERSPROC { - return (*PFNGLGETATTACHEDSHADERSPROC)(ref) -} - -//export PFNGLGETATTACHEDSHADERSPROC37F31C4E -func PFNGLGETATTACHEDSHADERSPROC37F31C4E() { - if pFNGLGETATTACHEDSHADERSPROC37F31C4EFunc != nil { - pFNGLGETATTACHEDSHADERSPROC37F31C4EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETATTACHEDSHADERSPROC37F31C4EFunc PFNGLGETATTACHEDSHADERSPROC - -func (x PFNGLGETATTRIBLOCATIONPROC) PassRef() (ref *C.PFNGLGETATTRIBLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETATTRIBLOCATIONPROCEEE07211Func == nil { - pFNGLGETATTRIBLOCATIONPROCEEE07211Func = x - } - return (*C.PFNGLGETATTRIBLOCATIONPROC)(C.PFNGLGETATTRIBLOCATIONPROC_eee07211), nil -} - -func (x PFNGLGETATTRIBLOCATIONPROC) PassValue() (ref C.PFNGLGETATTRIBLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETATTRIBLOCATIONPROCEEE07211Func == nil { - pFNGLGETATTRIBLOCATIONPROCEEE07211Func = x - } - return (C.PFNGLGETATTRIBLOCATIONPROC)(C.PFNGLGETATTRIBLOCATIONPROC_eee07211), nil -} - -func NewPFNGLGETATTRIBLOCATIONPROCRef(ref unsafe.Pointer) *PFNGLGETATTRIBLOCATIONPROC { - return (*PFNGLGETATTRIBLOCATIONPROC)(ref) -} - -//export PFNGLGETATTRIBLOCATIONPROCEEE07211 -func PFNGLGETATTRIBLOCATIONPROCEEE07211() { - if pFNGLGETATTRIBLOCATIONPROCEEE07211Func != nil { - pFNGLGETATTRIBLOCATIONPROCEEE07211Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETATTRIBLOCATIONPROCEEE07211Func PFNGLGETATTRIBLOCATIONPROC - -func (x PFNGLGETBOOLEANVPROC) PassRef() (ref *C.PFNGLGETBOOLEANVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBOOLEANVPROC28E602F0Func == nil { - pFNGLGETBOOLEANVPROC28E602F0Func = x - } - return (*C.PFNGLGETBOOLEANVPROC)(C.PFNGLGETBOOLEANVPROC_28e602f0), nil -} - -func (x PFNGLGETBOOLEANVPROC) PassValue() (ref C.PFNGLGETBOOLEANVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBOOLEANVPROC28E602F0Func == nil { - pFNGLGETBOOLEANVPROC28E602F0Func = x - } - return (C.PFNGLGETBOOLEANVPROC)(C.PFNGLGETBOOLEANVPROC_28e602f0), nil -} - -func NewPFNGLGETBOOLEANVPROCRef(ref unsafe.Pointer) *PFNGLGETBOOLEANVPROC { - return (*PFNGLGETBOOLEANVPROC)(ref) -} - -//export PFNGLGETBOOLEANVPROC28E602F0 -func PFNGLGETBOOLEANVPROC28E602F0() { - if pFNGLGETBOOLEANVPROC28E602F0Func != nil { - pFNGLGETBOOLEANVPROC28E602F0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETBOOLEANVPROC28E602F0Func PFNGLGETBOOLEANVPROC - -func (x PFNGLGETBUFFERPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETBUFFERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBUFFERPARAMETERIVPROC42B6D73EFunc == nil { - pFNGLGETBUFFERPARAMETERIVPROC42B6D73EFunc = x - } - return (*C.PFNGLGETBUFFERPARAMETERIVPROC)(C.PFNGLGETBUFFERPARAMETERIVPROC_42b6d73e), nil -} - -func (x PFNGLGETBUFFERPARAMETERIVPROC) PassValue() (ref C.PFNGLGETBUFFERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBUFFERPARAMETERIVPROC42B6D73EFunc == nil { - pFNGLGETBUFFERPARAMETERIVPROC42B6D73EFunc = x - } - return (C.PFNGLGETBUFFERPARAMETERIVPROC)(C.PFNGLGETBUFFERPARAMETERIVPROC_42b6d73e), nil -} - -func NewPFNGLGETBUFFERPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETBUFFERPARAMETERIVPROC { - return (*PFNGLGETBUFFERPARAMETERIVPROC)(ref) -} - -//export PFNGLGETBUFFERPARAMETERIVPROC42B6D73E -func PFNGLGETBUFFERPARAMETERIVPROC42B6D73E() { - if pFNGLGETBUFFERPARAMETERIVPROC42B6D73EFunc != nil { - pFNGLGETBUFFERPARAMETERIVPROC42B6D73EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETBUFFERPARAMETERIVPROC42B6D73EFunc PFNGLGETBUFFERPARAMETERIVPROC - -func (x PFNGLGETERRORPROC) PassRef() (ref *C.PFNGLGETERRORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETERRORPROC493C4FA3Func == nil { - pFNGLGETERRORPROC493C4FA3Func = x - } - return (*C.PFNGLGETERRORPROC)(C.PFNGLGETERRORPROC_493c4fa3), nil -} - -func (x PFNGLGETERRORPROC) PassValue() (ref C.PFNGLGETERRORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETERRORPROC493C4FA3Func == nil { - pFNGLGETERRORPROC493C4FA3Func = x - } - return (C.PFNGLGETERRORPROC)(C.PFNGLGETERRORPROC_493c4fa3), nil -} - -func NewPFNGLGETERRORPROCRef(ref unsafe.Pointer) *PFNGLGETERRORPROC { - return (*PFNGLGETERRORPROC)(ref) -} - -//export PFNGLGETERRORPROC493C4FA3 -func PFNGLGETERRORPROC493C4FA3() { - if pFNGLGETERRORPROC493C4FA3Func != nil { - pFNGLGETERRORPROC493C4FA3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETERRORPROC493C4FA3Func PFNGLGETERRORPROC - -func (x PFNGLGETFLOATVPROC) PassRef() (ref *C.PFNGLGETFLOATVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFLOATVPROC2B7C40DBFunc == nil { - pFNGLGETFLOATVPROC2B7C40DBFunc = x - } - return (*C.PFNGLGETFLOATVPROC)(C.PFNGLGETFLOATVPROC_2b7c40db), nil -} - -func (x PFNGLGETFLOATVPROC) PassValue() (ref C.PFNGLGETFLOATVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFLOATVPROC2B7C40DBFunc == nil { - pFNGLGETFLOATVPROC2B7C40DBFunc = x - } - return (C.PFNGLGETFLOATVPROC)(C.PFNGLGETFLOATVPROC_2b7c40db), nil -} - -func NewPFNGLGETFLOATVPROCRef(ref unsafe.Pointer) *PFNGLGETFLOATVPROC { - return (*PFNGLGETFLOATVPROC)(ref) -} - -//export PFNGLGETFLOATVPROC2B7C40DB -func PFNGLGETFLOATVPROC2B7C40DB() { - if pFNGLGETFLOATVPROC2B7C40DBFunc != nil { - pFNGLGETFLOATVPROC2B7C40DBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETFLOATVPROC2B7C40DBFunc PFNGLGETFLOATVPROC - -func (x PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0Func == nil { - pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0Func = x - } - return (*C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_a7dee7a0), nil -} - -func (x PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) PassValue() (ref C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0Func == nil { - pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0Func = x - } - return (C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_a7dee7a0), nil -} - -func NewPFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC { - return (*PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(ref) -} - -//export PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0 -func PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0() { - if pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0Func != nil { - pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCA7DEE7A0Func PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC - -func (x PFNGLGETINTEGERVPROC) PassRef() (ref *C.PFNGLGETINTEGERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGERVPROCD1B0BE4BFunc == nil { - pFNGLGETINTEGERVPROCD1B0BE4BFunc = x - } - return (*C.PFNGLGETINTEGERVPROC)(C.PFNGLGETINTEGERVPROC_d1b0be4b), nil -} - -func (x PFNGLGETINTEGERVPROC) PassValue() (ref C.PFNGLGETINTEGERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGERVPROCD1B0BE4BFunc == nil { - pFNGLGETINTEGERVPROCD1B0BE4BFunc = x - } - return (C.PFNGLGETINTEGERVPROC)(C.PFNGLGETINTEGERVPROC_d1b0be4b), nil -} - -func NewPFNGLGETINTEGERVPROCRef(ref unsafe.Pointer) *PFNGLGETINTEGERVPROC { - return (*PFNGLGETINTEGERVPROC)(ref) -} - -//export PFNGLGETINTEGERVPROCD1B0BE4B -func PFNGLGETINTEGERVPROCD1B0BE4B() { - if pFNGLGETINTEGERVPROCD1B0BE4BFunc != nil { - pFNGLGETINTEGERVPROCD1B0BE4BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETINTEGERVPROCD1B0BE4BFunc PFNGLGETINTEGERVPROC - -func (x PFNGLGETPROGRAMINFOLOGPROC) PassRef() (ref *C.PFNGLGETPROGRAMINFOLOGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMINFOLOGPROCAA65E8FBFunc == nil { - pFNGLGETPROGRAMINFOLOGPROCAA65E8FBFunc = x - } - return (*C.PFNGLGETPROGRAMINFOLOGPROC)(C.PFNGLGETPROGRAMINFOLOGPROC_aa65e8fb), nil -} - -func (x PFNGLGETPROGRAMINFOLOGPROC) PassValue() (ref C.PFNGLGETPROGRAMINFOLOGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMINFOLOGPROCAA65E8FBFunc == nil { - pFNGLGETPROGRAMINFOLOGPROCAA65E8FBFunc = x - } - return (C.PFNGLGETPROGRAMINFOLOGPROC)(C.PFNGLGETPROGRAMINFOLOGPROC_aa65e8fb), nil -} - -func NewPFNGLGETPROGRAMINFOLOGPROCRef(ref unsafe.Pointer) *PFNGLGETPROGRAMINFOLOGPROC { - return (*PFNGLGETPROGRAMINFOLOGPROC)(ref) -} - -//export PFNGLGETPROGRAMINFOLOGPROCAA65E8FB -func PFNGLGETPROGRAMINFOLOGPROCAA65E8FB() { - if pFNGLGETPROGRAMINFOLOGPROCAA65E8FBFunc != nil { - pFNGLGETPROGRAMINFOLOGPROCAA65E8FBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETPROGRAMINFOLOGPROCAA65E8FBFunc PFNGLGETPROGRAMINFOLOGPROC - -func (x PFNGLGETPROGRAMIVPROC) PassRef() (ref *C.PFNGLGETPROGRAMIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMIVPROC77D8DEA3Func == nil { - pFNGLGETPROGRAMIVPROC77D8DEA3Func = x - } - return (*C.PFNGLGETPROGRAMIVPROC)(C.PFNGLGETPROGRAMIVPROC_77d8dea3), nil -} - -func (x PFNGLGETPROGRAMIVPROC) PassValue() (ref C.PFNGLGETPROGRAMIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMIVPROC77D8DEA3Func == nil { - pFNGLGETPROGRAMIVPROC77D8DEA3Func = x - } - return (C.PFNGLGETPROGRAMIVPROC)(C.PFNGLGETPROGRAMIVPROC_77d8dea3), nil -} - -func NewPFNGLGETPROGRAMIVPROCRef(ref unsafe.Pointer) *PFNGLGETPROGRAMIVPROC { - return (*PFNGLGETPROGRAMIVPROC)(ref) -} - -//export PFNGLGETPROGRAMIVPROC77D8DEA3 -func PFNGLGETPROGRAMIVPROC77D8DEA3() { - if pFNGLGETPROGRAMIVPROC77D8DEA3Func != nil { - pFNGLGETPROGRAMIVPROC77D8DEA3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETPROGRAMIVPROC77D8DEA3Func PFNGLGETPROGRAMIVPROC - -func (x PFNGLGETRENDERBUFFERPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETRENDERBUFFERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6Func == nil { - pFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6Func = x - } - return (*C.PFNGLGETRENDERBUFFERPARAMETERIVPROC)(C.PFNGLGETRENDERBUFFERPARAMETERIVPROC_433873d6), nil -} - -func (x PFNGLGETRENDERBUFFERPARAMETERIVPROC) PassValue() (ref C.PFNGLGETRENDERBUFFERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6Func == nil { - pFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6Func = x - } - return (C.PFNGLGETRENDERBUFFERPARAMETERIVPROC)(C.PFNGLGETRENDERBUFFERPARAMETERIVPROC_433873d6), nil -} - -func NewPFNGLGETRENDERBUFFERPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETRENDERBUFFERPARAMETERIVPROC { - return (*PFNGLGETRENDERBUFFERPARAMETERIVPROC)(ref) -} - -//export PFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6 -func PFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6() { - if pFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6Func != nil { - pFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETRENDERBUFFERPARAMETERIVPROC433873D6Func PFNGLGETRENDERBUFFERPARAMETERIVPROC - -func (x PFNGLGETSHADERINFOLOGPROC) PassRef() (ref *C.PFNGLGETSHADERINFOLOGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERINFOLOGPROC0230EF81Func == nil { - pFNGLGETSHADERINFOLOGPROC0230EF81Func = x - } - return (*C.PFNGLGETSHADERINFOLOGPROC)(C.PFNGLGETSHADERINFOLOGPROC_0230ef81), nil -} - -func (x PFNGLGETSHADERINFOLOGPROC) PassValue() (ref C.PFNGLGETSHADERINFOLOGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERINFOLOGPROC0230EF81Func == nil { - pFNGLGETSHADERINFOLOGPROC0230EF81Func = x - } - return (C.PFNGLGETSHADERINFOLOGPROC)(C.PFNGLGETSHADERINFOLOGPROC_0230ef81), nil -} - -func NewPFNGLGETSHADERINFOLOGPROCRef(ref unsafe.Pointer) *PFNGLGETSHADERINFOLOGPROC { - return (*PFNGLGETSHADERINFOLOGPROC)(ref) -} - -//export PFNGLGETSHADERINFOLOGPROC0230EF81 -func PFNGLGETSHADERINFOLOGPROC0230EF81() { - if pFNGLGETSHADERINFOLOGPROC0230EF81Func != nil { - pFNGLGETSHADERINFOLOGPROC0230EF81Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSHADERINFOLOGPROC0230EF81Func PFNGLGETSHADERINFOLOGPROC - -func (x PFNGLGETSHADERIVPROC) PassRef() (ref *C.PFNGLGETSHADERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERIVPROC9F6BF31DFunc == nil { - pFNGLGETSHADERIVPROC9F6BF31DFunc = x - } - return (*C.PFNGLGETSHADERIVPROC)(C.PFNGLGETSHADERIVPROC_9f6bf31d), nil -} - -func (x PFNGLGETSHADERIVPROC) PassValue() (ref C.PFNGLGETSHADERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERIVPROC9F6BF31DFunc == nil { - pFNGLGETSHADERIVPROC9F6BF31DFunc = x - } - return (C.PFNGLGETSHADERIVPROC)(C.PFNGLGETSHADERIVPROC_9f6bf31d), nil -} - -func NewPFNGLGETSHADERIVPROCRef(ref unsafe.Pointer) *PFNGLGETSHADERIVPROC { - return (*PFNGLGETSHADERIVPROC)(ref) -} - -//export PFNGLGETSHADERIVPROC9F6BF31D -func PFNGLGETSHADERIVPROC9F6BF31D() { - if pFNGLGETSHADERIVPROC9F6BF31DFunc != nil { - pFNGLGETSHADERIVPROC9F6BF31DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSHADERIVPROC9F6BF31DFunc PFNGLGETSHADERIVPROC - -func (x PFNGLGETSHADERPRECISIONFORMATPROC) PassRef() (ref *C.PFNGLGETSHADERPRECISIONFORMATPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERPRECISIONFORMATPROC802A8E22Func == nil { - pFNGLGETSHADERPRECISIONFORMATPROC802A8E22Func = x - } - return (*C.PFNGLGETSHADERPRECISIONFORMATPROC)(C.PFNGLGETSHADERPRECISIONFORMATPROC_802a8e22), nil -} - -func (x PFNGLGETSHADERPRECISIONFORMATPROC) PassValue() (ref C.PFNGLGETSHADERPRECISIONFORMATPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERPRECISIONFORMATPROC802A8E22Func == nil { - pFNGLGETSHADERPRECISIONFORMATPROC802A8E22Func = x - } - return (C.PFNGLGETSHADERPRECISIONFORMATPROC)(C.PFNGLGETSHADERPRECISIONFORMATPROC_802a8e22), nil -} - -func NewPFNGLGETSHADERPRECISIONFORMATPROCRef(ref unsafe.Pointer) *PFNGLGETSHADERPRECISIONFORMATPROC { - return (*PFNGLGETSHADERPRECISIONFORMATPROC)(ref) -} - -//export PFNGLGETSHADERPRECISIONFORMATPROC802A8E22 -func PFNGLGETSHADERPRECISIONFORMATPROC802A8E22() { - if pFNGLGETSHADERPRECISIONFORMATPROC802A8E22Func != nil { - pFNGLGETSHADERPRECISIONFORMATPROC802A8E22Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSHADERPRECISIONFORMATPROC802A8E22Func PFNGLGETSHADERPRECISIONFORMATPROC - -func (x PFNGLGETSHADERSOURCEPROC) PassRef() (ref *C.PFNGLGETSHADERSOURCEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERSOURCEPROC720CFC89Func == nil { - pFNGLGETSHADERSOURCEPROC720CFC89Func = x - } - return (*C.PFNGLGETSHADERSOURCEPROC)(C.PFNGLGETSHADERSOURCEPROC_720cfc89), nil -} - -func (x PFNGLGETSHADERSOURCEPROC) PassValue() (ref C.PFNGLGETSHADERSOURCEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERSOURCEPROC720CFC89Func == nil { - pFNGLGETSHADERSOURCEPROC720CFC89Func = x - } - return (C.PFNGLGETSHADERSOURCEPROC)(C.PFNGLGETSHADERSOURCEPROC_720cfc89), nil -} - -func NewPFNGLGETSHADERSOURCEPROCRef(ref unsafe.Pointer) *PFNGLGETSHADERSOURCEPROC { - return (*PFNGLGETSHADERSOURCEPROC)(ref) -} - -//export PFNGLGETSHADERSOURCEPROC720CFC89 -func PFNGLGETSHADERSOURCEPROC720CFC89() { - if pFNGLGETSHADERSOURCEPROC720CFC89Func != nil { - pFNGLGETSHADERSOURCEPROC720CFC89Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSHADERSOURCEPROC720CFC89Func PFNGLGETSHADERSOURCEPROC - -func (x PFNGLGETSTRINGPROC) PassRef() (ref *C.PFNGLGETSTRINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSTRINGPROCA27C496AFunc == nil { - pFNGLGETSTRINGPROCA27C496AFunc = x - } - return (*C.PFNGLGETSTRINGPROC)(C.PFNGLGETSTRINGPROC_a27c496a), nil -} - -func (x PFNGLGETSTRINGPROC) PassValue() (ref C.PFNGLGETSTRINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSTRINGPROCA27C496AFunc == nil { - pFNGLGETSTRINGPROCA27C496AFunc = x - } - return (C.PFNGLGETSTRINGPROC)(C.PFNGLGETSTRINGPROC_a27c496a), nil -} - -func NewPFNGLGETSTRINGPROCRef(ref unsafe.Pointer) *PFNGLGETSTRINGPROC { - return (*PFNGLGETSTRINGPROC)(ref) -} - -//export PFNGLGETSTRINGPROCA27C496A -func PFNGLGETSTRINGPROCA27C496A() { - if pFNGLGETSTRINGPROCA27C496AFunc != nil { - pFNGLGETSTRINGPROCA27C496AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSTRINGPROCA27C496AFunc PFNGLGETSTRINGPROC - -func (x PFNGLGETTEXPARAMETERFVPROC) PassRef() (ref *C.PFNGLGETTEXPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTEXPARAMETERFVPROC4E2E2B7EFunc == nil { - pFNGLGETTEXPARAMETERFVPROC4E2E2B7EFunc = x - } - return (*C.PFNGLGETTEXPARAMETERFVPROC)(C.PFNGLGETTEXPARAMETERFVPROC_4e2e2b7e), nil -} - -func (x PFNGLGETTEXPARAMETERFVPROC) PassValue() (ref C.PFNGLGETTEXPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTEXPARAMETERFVPROC4E2E2B7EFunc == nil { - pFNGLGETTEXPARAMETERFVPROC4E2E2B7EFunc = x - } - return (C.PFNGLGETTEXPARAMETERFVPROC)(C.PFNGLGETTEXPARAMETERFVPROC_4e2e2b7e), nil -} - -func NewPFNGLGETTEXPARAMETERFVPROCRef(ref unsafe.Pointer) *PFNGLGETTEXPARAMETERFVPROC { - return (*PFNGLGETTEXPARAMETERFVPROC)(ref) -} - -//export PFNGLGETTEXPARAMETERFVPROC4E2E2B7E -func PFNGLGETTEXPARAMETERFVPROC4E2E2B7E() { - if pFNGLGETTEXPARAMETERFVPROC4E2E2B7EFunc != nil { - pFNGLGETTEXPARAMETERFVPROC4E2E2B7EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETTEXPARAMETERFVPROC4E2E2B7EFunc PFNGLGETTEXPARAMETERFVPROC - -func (x PFNGLGETTEXPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETTEXPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTEXPARAMETERIVPROCD102AB47Func == nil { - pFNGLGETTEXPARAMETERIVPROCD102AB47Func = x - } - return (*C.PFNGLGETTEXPARAMETERIVPROC)(C.PFNGLGETTEXPARAMETERIVPROC_d102ab47), nil -} - -func (x PFNGLGETTEXPARAMETERIVPROC) PassValue() (ref C.PFNGLGETTEXPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTEXPARAMETERIVPROCD102AB47Func == nil { - pFNGLGETTEXPARAMETERIVPROCD102AB47Func = x - } - return (C.PFNGLGETTEXPARAMETERIVPROC)(C.PFNGLGETTEXPARAMETERIVPROC_d102ab47), nil -} - -func NewPFNGLGETTEXPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETTEXPARAMETERIVPROC { - return (*PFNGLGETTEXPARAMETERIVPROC)(ref) -} - -//export PFNGLGETTEXPARAMETERIVPROCD102AB47 -func PFNGLGETTEXPARAMETERIVPROCD102AB47() { - if pFNGLGETTEXPARAMETERIVPROCD102AB47Func != nil { - pFNGLGETTEXPARAMETERIVPROCD102AB47Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETTEXPARAMETERIVPROCD102AB47Func PFNGLGETTEXPARAMETERIVPROC - -func (x PFNGLGETUNIFORMFVPROC) PassRef() (ref *C.PFNGLGETUNIFORMFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMFVPROC224F0554Func == nil { - pFNGLGETUNIFORMFVPROC224F0554Func = x - } - return (*C.PFNGLGETUNIFORMFVPROC)(C.PFNGLGETUNIFORMFVPROC_224f0554), nil -} - -func (x PFNGLGETUNIFORMFVPROC) PassValue() (ref C.PFNGLGETUNIFORMFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMFVPROC224F0554Func == nil { - pFNGLGETUNIFORMFVPROC224F0554Func = x - } - return (C.PFNGLGETUNIFORMFVPROC)(C.PFNGLGETUNIFORMFVPROC_224f0554), nil -} - -func NewPFNGLGETUNIFORMFVPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMFVPROC { - return (*PFNGLGETUNIFORMFVPROC)(ref) -} - -//export PFNGLGETUNIFORMFVPROC224F0554 -func PFNGLGETUNIFORMFVPROC224F0554() { - if pFNGLGETUNIFORMFVPROC224F0554Func != nil { - pFNGLGETUNIFORMFVPROC224F0554Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMFVPROC224F0554Func PFNGLGETUNIFORMFVPROC - -func (x PFNGLGETUNIFORMIVPROC) PassRef() (ref *C.PFNGLGETUNIFORMIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMIVPROC7AC2FEAAFunc == nil { - pFNGLGETUNIFORMIVPROC7AC2FEAAFunc = x - } - return (*C.PFNGLGETUNIFORMIVPROC)(C.PFNGLGETUNIFORMIVPROC_7ac2feaa), nil -} - -func (x PFNGLGETUNIFORMIVPROC) PassValue() (ref C.PFNGLGETUNIFORMIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMIVPROC7AC2FEAAFunc == nil { - pFNGLGETUNIFORMIVPROC7AC2FEAAFunc = x - } - return (C.PFNGLGETUNIFORMIVPROC)(C.PFNGLGETUNIFORMIVPROC_7ac2feaa), nil -} - -func NewPFNGLGETUNIFORMIVPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMIVPROC { - return (*PFNGLGETUNIFORMIVPROC)(ref) -} - -//export PFNGLGETUNIFORMIVPROC7AC2FEAA -func PFNGLGETUNIFORMIVPROC7AC2FEAA() { - if pFNGLGETUNIFORMIVPROC7AC2FEAAFunc != nil { - pFNGLGETUNIFORMIVPROC7AC2FEAAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMIVPROC7AC2FEAAFunc PFNGLGETUNIFORMIVPROC - -func (x PFNGLGETUNIFORMLOCATIONPROC) PassRef() (ref *C.PFNGLGETUNIFORMLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMLOCATIONPROCF7C84F68Func == nil { - pFNGLGETUNIFORMLOCATIONPROCF7C84F68Func = x - } - return (*C.PFNGLGETUNIFORMLOCATIONPROC)(C.PFNGLGETUNIFORMLOCATIONPROC_f7c84f68), nil -} - -func (x PFNGLGETUNIFORMLOCATIONPROC) PassValue() (ref C.PFNGLGETUNIFORMLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMLOCATIONPROCF7C84F68Func == nil { - pFNGLGETUNIFORMLOCATIONPROCF7C84F68Func = x - } - return (C.PFNGLGETUNIFORMLOCATIONPROC)(C.PFNGLGETUNIFORMLOCATIONPROC_f7c84f68), nil -} - -func NewPFNGLGETUNIFORMLOCATIONPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMLOCATIONPROC { - return (*PFNGLGETUNIFORMLOCATIONPROC)(ref) -} - -//export PFNGLGETUNIFORMLOCATIONPROCF7C84F68 -func PFNGLGETUNIFORMLOCATIONPROCF7C84F68() { - if pFNGLGETUNIFORMLOCATIONPROCF7C84F68Func != nil { - pFNGLGETUNIFORMLOCATIONPROCF7C84F68Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMLOCATIONPROCF7C84F68Func PFNGLGETUNIFORMLOCATIONPROC - -func (x PFNGLGETVERTEXATTRIBFVPROC) PassRef() (ref *C.PFNGLGETVERTEXATTRIBFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBFVPROCFE79A986Func == nil { - pFNGLGETVERTEXATTRIBFVPROCFE79A986Func = x - } - return (*C.PFNGLGETVERTEXATTRIBFVPROC)(C.PFNGLGETVERTEXATTRIBFVPROC_fe79a986), nil -} - -func (x PFNGLGETVERTEXATTRIBFVPROC) PassValue() (ref C.PFNGLGETVERTEXATTRIBFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBFVPROCFE79A986Func == nil { - pFNGLGETVERTEXATTRIBFVPROCFE79A986Func = x - } - return (C.PFNGLGETVERTEXATTRIBFVPROC)(C.PFNGLGETVERTEXATTRIBFVPROC_fe79a986), nil -} - -func NewPFNGLGETVERTEXATTRIBFVPROCRef(ref unsafe.Pointer) *PFNGLGETVERTEXATTRIBFVPROC { - return (*PFNGLGETVERTEXATTRIBFVPROC)(ref) -} - -//export PFNGLGETVERTEXATTRIBFVPROCFE79A986 -func PFNGLGETVERTEXATTRIBFVPROCFE79A986() { - if pFNGLGETVERTEXATTRIBFVPROCFE79A986Func != nil { - pFNGLGETVERTEXATTRIBFVPROCFE79A986Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETVERTEXATTRIBFVPROCFE79A986Func PFNGLGETVERTEXATTRIBFVPROC - -func (x PFNGLGETVERTEXATTRIBIVPROC) PassRef() (ref *C.PFNGLGETVERTEXATTRIBIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBIVPROC60C239B0Func == nil { - pFNGLGETVERTEXATTRIBIVPROC60C239B0Func = x - } - return (*C.PFNGLGETVERTEXATTRIBIVPROC)(C.PFNGLGETVERTEXATTRIBIVPROC_60c239b0), nil -} - -func (x PFNGLGETVERTEXATTRIBIVPROC) PassValue() (ref C.PFNGLGETVERTEXATTRIBIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBIVPROC60C239B0Func == nil { - pFNGLGETVERTEXATTRIBIVPROC60C239B0Func = x - } - return (C.PFNGLGETVERTEXATTRIBIVPROC)(C.PFNGLGETVERTEXATTRIBIVPROC_60c239b0), nil -} - -func NewPFNGLGETVERTEXATTRIBIVPROCRef(ref unsafe.Pointer) *PFNGLGETVERTEXATTRIBIVPROC { - return (*PFNGLGETVERTEXATTRIBIVPROC)(ref) -} - -//export PFNGLGETVERTEXATTRIBIVPROC60C239B0 -func PFNGLGETVERTEXATTRIBIVPROC60C239B0() { - if pFNGLGETVERTEXATTRIBIVPROC60C239B0Func != nil { - pFNGLGETVERTEXATTRIBIVPROC60C239B0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETVERTEXATTRIBIVPROC60C239B0Func PFNGLGETVERTEXATTRIBIVPROC - -func (x PFNGLGETVERTEXATTRIBPOINTERVPROC) PassRef() (ref *C.PFNGLGETVERTEXATTRIBPOINTERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9Func == nil { - pFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9Func = x - } - return (*C.PFNGLGETVERTEXATTRIBPOINTERVPROC)(C.PFNGLGETVERTEXATTRIBPOINTERVPROC_3cd0d0c9), nil -} - -func (x PFNGLGETVERTEXATTRIBPOINTERVPROC) PassValue() (ref C.PFNGLGETVERTEXATTRIBPOINTERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9Func == nil { - pFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9Func = x - } - return (C.PFNGLGETVERTEXATTRIBPOINTERVPROC)(C.PFNGLGETVERTEXATTRIBPOINTERVPROC_3cd0d0c9), nil -} - -func NewPFNGLGETVERTEXATTRIBPOINTERVPROCRef(ref unsafe.Pointer) *PFNGLGETVERTEXATTRIBPOINTERVPROC { - return (*PFNGLGETVERTEXATTRIBPOINTERVPROC)(ref) -} - -//export PFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9 -func PFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9() { - if pFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9Func != nil { - pFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETVERTEXATTRIBPOINTERVPROC3CD0D0C9Func PFNGLGETVERTEXATTRIBPOINTERVPROC - -func (x PFNGLHINTPROC) PassRef() (ref *C.PFNGLHINTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLHINTPROCFB1B468CFunc == nil { - pFNGLHINTPROCFB1B468CFunc = x - } - return (*C.PFNGLHINTPROC)(C.PFNGLHINTPROC_fb1b468c), nil -} - -func (x PFNGLHINTPROC) PassValue() (ref C.PFNGLHINTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLHINTPROCFB1B468CFunc == nil { - pFNGLHINTPROCFB1B468CFunc = x - } - return (C.PFNGLHINTPROC)(C.PFNGLHINTPROC_fb1b468c), nil -} - -func NewPFNGLHINTPROCRef(ref unsafe.Pointer) *PFNGLHINTPROC { - return (*PFNGLHINTPROC)(ref) -} - -//export PFNGLHINTPROCFB1B468C -func PFNGLHINTPROCFB1B468C() { - if pFNGLHINTPROCFB1B468CFunc != nil { - pFNGLHINTPROCFB1B468CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLHINTPROCFB1B468CFunc PFNGLHINTPROC - -func (x PFNGLISBUFFERPROC) PassRef() (ref *C.PFNGLISBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISBUFFERPROCEC676601Func == nil { - pFNGLISBUFFERPROCEC676601Func = x - } - return (*C.PFNGLISBUFFERPROC)(C.PFNGLISBUFFERPROC_ec676601), nil -} - -func (x PFNGLISBUFFERPROC) PassValue() (ref C.PFNGLISBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISBUFFERPROCEC676601Func == nil { - pFNGLISBUFFERPROCEC676601Func = x - } - return (C.PFNGLISBUFFERPROC)(C.PFNGLISBUFFERPROC_ec676601), nil -} - -func NewPFNGLISBUFFERPROCRef(ref unsafe.Pointer) *PFNGLISBUFFERPROC { - return (*PFNGLISBUFFERPROC)(ref) -} - -//export PFNGLISBUFFERPROCEC676601 -func PFNGLISBUFFERPROCEC676601() { - if pFNGLISBUFFERPROCEC676601Func != nil { - pFNGLISBUFFERPROCEC676601Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISBUFFERPROCEC676601Func PFNGLISBUFFERPROC - -func (x PFNGLISENABLEDPROC) PassRef() (ref *C.PFNGLISENABLEDPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISENABLEDPROC5F3A913BFunc == nil { - pFNGLISENABLEDPROC5F3A913BFunc = x - } - return (*C.PFNGLISENABLEDPROC)(C.PFNGLISENABLEDPROC_5f3a913b), nil -} - -func (x PFNGLISENABLEDPROC) PassValue() (ref C.PFNGLISENABLEDPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISENABLEDPROC5F3A913BFunc == nil { - pFNGLISENABLEDPROC5F3A913BFunc = x - } - return (C.PFNGLISENABLEDPROC)(C.PFNGLISENABLEDPROC_5f3a913b), nil -} - -func NewPFNGLISENABLEDPROCRef(ref unsafe.Pointer) *PFNGLISENABLEDPROC { - return (*PFNGLISENABLEDPROC)(ref) -} - -//export PFNGLISENABLEDPROC5F3A913B -func PFNGLISENABLEDPROC5F3A913B() { - if pFNGLISENABLEDPROC5F3A913BFunc != nil { - pFNGLISENABLEDPROC5F3A913BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISENABLEDPROC5F3A913BFunc PFNGLISENABLEDPROC - -func (x PFNGLISFRAMEBUFFERPROC) PassRef() (ref *C.PFNGLISFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISFRAMEBUFFERPROC09EC8734Func == nil { - pFNGLISFRAMEBUFFERPROC09EC8734Func = x - } - return (*C.PFNGLISFRAMEBUFFERPROC)(C.PFNGLISFRAMEBUFFERPROC_09ec8734), nil -} - -func (x PFNGLISFRAMEBUFFERPROC) PassValue() (ref C.PFNGLISFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISFRAMEBUFFERPROC09EC8734Func == nil { - pFNGLISFRAMEBUFFERPROC09EC8734Func = x - } - return (C.PFNGLISFRAMEBUFFERPROC)(C.PFNGLISFRAMEBUFFERPROC_09ec8734), nil -} - -func NewPFNGLISFRAMEBUFFERPROCRef(ref unsafe.Pointer) *PFNGLISFRAMEBUFFERPROC { - return (*PFNGLISFRAMEBUFFERPROC)(ref) -} - -//export PFNGLISFRAMEBUFFERPROC09EC8734 -func PFNGLISFRAMEBUFFERPROC09EC8734() { - if pFNGLISFRAMEBUFFERPROC09EC8734Func != nil { - pFNGLISFRAMEBUFFERPROC09EC8734Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISFRAMEBUFFERPROC09EC8734Func PFNGLISFRAMEBUFFERPROC - -func (x PFNGLISPROGRAMPROC) PassRef() (ref *C.PFNGLISPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISPROGRAMPROC4B2BE4BCFunc == nil { - pFNGLISPROGRAMPROC4B2BE4BCFunc = x - } - return (*C.PFNGLISPROGRAMPROC)(C.PFNGLISPROGRAMPROC_4b2be4bc), nil -} - -func (x PFNGLISPROGRAMPROC) PassValue() (ref C.PFNGLISPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISPROGRAMPROC4B2BE4BCFunc == nil { - pFNGLISPROGRAMPROC4B2BE4BCFunc = x - } - return (C.PFNGLISPROGRAMPROC)(C.PFNGLISPROGRAMPROC_4b2be4bc), nil -} - -func NewPFNGLISPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLISPROGRAMPROC { - return (*PFNGLISPROGRAMPROC)(ref) -} - -//export PFNGLISPROGRAMPROC4B2BE4BC -func PFNGLISPROGRAMPROC4B2BE4BC() { - if pFNGLISPROGRAMPROC4B2BE4BCFunc != nil { - pFNGLISPROGRAMPROC4B2BE4BCFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISPROGRAMPROC4B2BE4BCFunc PFNGLISPROGRAMPROC - -func (x PFNGLISRENDERBUFFERPROC) PassRef() (ref *C.PFNGLISRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISRENDERBUFFERPROC9125A0C4Func == nil { - pFNGLISRENDERBUFFERPROC9125A0C4Func = x - } - return (*C.PFNGLISRENDERBUFFERPROC)(C.PFNGLISRENDERBUFFERPROC_9125a0c4), nil -} - -func (x PFNGLISRENDERBUFFERPROC) PassValue() (ref C.PFNGLISRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISRENDERBUFFERPROC9125A0C4Func == nil { - pFNGLISRENDERBUFFERPROC9125A0C4Func = x - } - return (C.PFNGLISRENDERBUFFERPROC)(C.PFNGLISRENDERBUFFERPROC_9125a0c4), nil -} - -func NewPFNGLISRENDERBUFFERPROCRef(ref unsafe.Pointer) *PFNGLISRENDERBUFFERPROC { - return (*PFNGLISRENDERBUFFERPROC)(ref) -} - -//export PFNGLISRENDERBUFFERPROC9125A0C4 -func PFNGLISRENDERBUFFERPROC9125A0C4() { - if pFNGLISRENDERBUFFERPROC9125A0C4Func != nil { - pFNGLISRENDERBUFFERPROC9125A0C4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISRENDERBUFFERPROC9125A0C4Func PFNGLISRENDERBUFFERPROC - -func (x PFNGLISSHADERPROC) PassRef() (ref *C.PFNGLISSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISSHADERPROCF4EE4C55Func == nil { - pFNGLISSHADERPROCF4EE4C55Func = x - } - return (*C.PFNGLISSHADERPROC)(C.PFNGLISSHADERPROC_f4ee4c55), nil -} - -func (x PFNGLISSHADERPROC) PassValue() (ref C.PFNGLISSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISSHADERPROCF4EE4C55Func == nil { - pFNGLISSHADERPROCF4EE4C55Func = x - } - return (C.PFNGLISSHADERPROC)(C.PFNGLISSHADERPROC_f4ee4c55), nil -} - -func NewPFNGLISSHADERPROCRef(ref unsafe.Pointer) *PFNGLISSHADERPROC { - return (*PFNGLISSHADERPROC)(ref) -} - -//export PFNGLISSHADERPROCF4EE4C55 -func PFNGLISSHADERPROCF4EE4C55() { - if pFNGLISSHADERPROCF4EE4C55Func != nil { - pFNGLISSHADERPROCF4EE4C55Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISSHADERPROCF4EE4C55Func PFNGLISSHADERPROC - -func (x PFNGLISTEXTUREPROC) PassRef() (ref *C.PFNGLISTEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISTEXTUREPROCB34E7E73Func == nil { - pFNGLISTEXTUREPROCB34E7E73Func = x - } - return (*C.PFNGLISTEXTUREPROC)(C.PFNGLISTEXTUREPROC_b34e7e73), nil -} - -func (x PFNGLISTEXTUREPROC) PassValue() (ref C.PFNGLISTEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISTEXTUREPROCB34E7E73Func == nil { - pFNGLISTEXTUREPROCB34E7E73Func = x - } - return (C.PFNGLISTEXTUREPROC)(C.PFNGLISTEXTUREPROC_b34e7e73), nil -} - -func NewPFNGLISTEXTUREPROCRef(ref unsafe.Pointer) *PFNGLISTEXTUREPROC { - return (*PFNGLISTEXTUREPROC)(ref) -} - -//export PFNGLISTEXTUREPROCB34E7E73 -func PFNGLISTEXTUREPROCB34E7E73() { - if pFNGLISTEXTUREPROCB34E7E73Func != nil { - pFNGLISTEXTUREPROCB34E7E73Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISTEXTUREPROCB34E7E73Func PFNGLISTEXTUREPROC - -func (x PFNGLLINEWIDTHPROC) PassRef() (ref *C.PFNGLLINEWIDTHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLLINEWIDTHPROC31406C60Func == nil { - pFNGLLINEWIDTHPROC31406C60Func = x - } - return (*C.PFNGLLINEWIDTHPROC)(C.PFNGLLINEWIDTHPROC_31406c60), nil -} - -func (x PFNGLLINEWIDTHPROC) PassValue() (ref C.PFNGLLINEWIDTHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLLINEWIDTHPROC31406C60Func == nil { - pFNGLLINEWIDTHPROC31406C60Func = x - } - return (C.PFNGLLINEWIDTHPROC)(C.PFNGLLINEWIDTHPROC_31406c60), nil -} - -func NewPFNGLLINEWIDTHPROCRef(ref unsafe.Pointer) *PFNGLLINEWIDTHPROC { - return (*PFNGLLINEWIDTHPROC)(ref) -} - -//export PFNGLLINEWIDTHPROC31406C60 -func PFNGLLINEWIDTHPROC31406C60() { - if pFNGLLINEWIDTHPROC31406C60Func != nil { - pFNGLLINEWIDTHPROC31406C60Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLLINEWIDTHPROC31406C60Func PFNGLLINEWIDTHPROC - -func (x PFNGLLINKPROGRAMPROC) PassRef() (ref *C.PFNGLLINKPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLLINKPROGRAMPROC07D669C8Func == nil { - pFNGLLINKPROGRAMPROC07D669C8Func = x - } - return (*C.PFNGLLINKPROGRAMPROC)(C.PFNGLLINKPROGRAMPROC_07d669c8), nil -} - -func (x PFNGLLINKPROGRAMPROC) PassValue() (ref C.PFNGLLINKPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLLINKPROGRAMPROC07D669C8Func == nil { - pFNGLLINKPROGRAMPROC07D669C8Func = x - } - return (C.PFNGLLINKPROGRAMPROC)(C.PFNGLLINKPROGRAMPROC_07d669c8), nil -} - -func NewPFNGLLINKPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLLINKPROGRAMPROC { - return (*PFNGLLINKPROGRAMPROC)(ref) -} - -//export PFNGLLINKPROGRAMPROC07D669C8 -func PFNGLLINKPROGRAMPROC07D669C8() { - if pFNGLLINKPROGRAMPROC07D669C8Func != nil { - pFNGLLINKPROGRAMPROC07D669C8Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLLINKPROGRAMPROC07D669C8Func PFNGLLINKPROGRAMPROC - -func (x PFNGLPIXELSTOREIPROC) PassRef() (ref *C.PFNGLPIXELSTOREIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPIXELSTOREIPROCC91A89BDFunc == nil { - pFNGLPIXELSTOREIPROCC91A89BDFunc = x - } - return (*C.PFNGLPIXELSTOREIPROC)(C.PFNGLPIXELSTOREIPROC_c91a89bd), nil -} - -func (x PFNGLPIXELSTOREIPROC) PassValue() (ref C.PFNGLPIXELSTOREIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPIXELSTOREIPROCC91A89BDFunc == nil { - pFNGLPIXELSTOREIPROCC91A89BDFunc = x - } - return (C.PFNGLPIXELSTOREIPROC)(C.PFNGLPIXELSTOREIPROC_c91a89bd), nil -} - -func NewPFNGLPIXELSTOREIPROCRef(ref unsafe.Pointer) *PFNGLPIXELSTOREIPROC { - return (*PFNGLPIXELSTOREIPROC)(ref) -} - -//export PFNGLPIXELSTOREIPROCC91A89BD -func PFNGLPIXELSTOREIPROCC91A89BD() { - if pFNGLPIXELSTOREIPROCC91A89BDFunc != nil { - pFNGLPIXELSTOREIPROCC91A89BDFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLPIXELSTOREIPROCC91A89BDFunc PFNGLPIXELSTOREIPROC - -func (x PFNGLPOLYGONOFFSETPROC) PassRef() (ref *C.PFNGLPOLYGONOFFSETPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPOLYGONOFFSETPROC5B26D329Func == nil { - pFNGLPOLYGONOFFSETPROC5B26D329Func = x - } - return (*C.PFNGLPOLYGONOFFSETPROC)(C.PFNGLPOLYGONOFFSETPROC_5b26d329), nil -} - -func (x PFNGLPOLYGONOFFSETPROC) PassValue() (ref C.PFNGLPOLYGONOFFSETPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPOLYGONOFFSETPROC5B26D329Func == nil { - pFNGLPOLYGONOFFSETPROC5B26D329Func = x - } - return (C.PFNGLPOLYGONOFFSETPROC)(C.PFNGLPOLYGONOFFSETPROC_5b26d329), nil -} - -func NewPFNGLPOLYGONOFFSETPROCRef(ref unsafe.Pointer) *PFNGLPOLYGONOFFSETPROC { - return (*PFNGLPOLYGONOFFSETPROC)(ref) -} - -//export PFNGLPOLYGONOFFSETPROC5B26D329 -func PFNGLPOLYGONOFFSETPROC5B26D329() { - if pFNGLPOLYGONOFFSETPROC5B26D329Func != nil { - pFNGLPOLYGONOFFSETPROC5B26D329Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLPOLYGONOFFSETPROC5B26D329Func PFNGLPOLYGONOFFSETPROC - -func (x PFNGLREADPIXELSPROC) PassRef() (ref *C.PFNGLREADPIXELSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLREADPIXELSPROC82FE6500Func == nil { - pFNGLREADPIXELSPROC82FE6500Func = x - } - return (*C.PFNGLREADPIXELSPROC)(C.PFNGLREADPIXELSPROC_82fe6500), nil -} - -func (x PFNGLREADPIXELSPROC) PassValue() (ref C.PFNGLREADPIXELSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLREADPIXELSPROC82FE6500Func == nil { - pFNGLREADPIXELSPROC82FE6500Func = x - } - return (C.PFNGLREADPIXELSPROC)(C.PFNGLREADPIXELSPROC_82fe6500), nil -} - -func NewPFNGLREADPIXELSPROCRef(ref unsafe.Pointer) *PFNGLREADPIXELSPROC { - return (*PFNGLREADPIXELSPROC)(ref) -} - -//export PFNGLREADPIXELSPROC82FE6500 -func PFNGLREADPIXELSPROC82FE6500() { - if pFNGLREADPIXELSPROC82FE6500Func != nil { - pFNGLREADPIXELSPROC82FE6500Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLREADPIXELSPROC82FE6500Func PFNGLREADPIXELSPROC - -func (x PFNGLRELEASESHADERCOMPILERPROC) PassRef() (ref *C.PFNGLRELEASESHADERCOMPILERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRELEASESHADERCOMPILERPROC5C6BF9F9Func == nil { - pFNGLRELEASESHADERCOMPILERPROC5C6BF9F9Func = x - } - return (*C.PFNGLRELEASESHADERCOMPILERPROC)(C.PFNGLRELEASESHADERCOMPILERPROC_5c6bf9f9), nil -} - -func (x PFNGLRELEASESHADERCOMPILERPROC) PassValue() (ref C.PFNGLRELEASESHADERCOMPILERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRELEASESHADERCOMPILERPROC5C6BF9F9Func == nil { - pFNGLRELEASESHADERCOMPILERPROC5C6BF9F9Func = x - } - return (C.PFNGLRELEASESHADERCOMPILERPROC)(C.PFNGLRELEASESHADERCOMPILERPROC_5c6bf9f9), nil -} - -func NewPFNGLRELEASESHADERCOMPILERPROCRef(ref unsafe.Pointer) *PFNGLRELEASESHADERCOMPILERPROC { - return (*PFNGLRELEASESHADERCOMPILERPROC)(ref) -} - -//export PFNGLRELEASESHADERCOMPILERPROC5C6BF9F9 -func PFNGLRELEASESHADERCOMPILERPROC5C6BF9F9() { - if pFNGLRELEASESHADERCOMPILERPROC5C6BF9F9Func != nil { - pFNGLRELEASESHADERCOMPILERPROC5C6BF9F9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLRELEASESHADERCOMPILERPROC5C6BF9F9Func PFNGLRELEASESHADERCOMPILERPROC - -func (x PFNGLRENDERBUFFERSTORAGEPROC) PassRef() (ref *C.PFNGLRENDERBUFFERSTORAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRENDERBUFFERSTORAGEPROCFD7B7A1BFunc == nil { - pFNGLRENDERBUFFERSTORAGEPROCFD7B7A1BFunc = x - } - return (*C.PFNGLRENDERBUFFERSTORAGEPROC)(C.PFNGLRENDERBUFFERSTORAGEPROC_fd7b7a1b), nil -} - -func (x PFNGLRENDERBUFFERSTORAGEPROC) PassValue() (ref C.PFNGLRENDERBUFFERSTORAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRENDERBUFFERSTORAGEPROCFD7B7A1BFunc == nil { - pFNGLRENDERBUFFERSTORAGEPROCFD7B7A1BFunc = x - } - return (C.PFNGLRENDERBUFFERSTORAGEPROC)(C.PFNGLRENDERBUFFERSTORAGEPROC_fd7b7a1b), nil -} - -func NewPFNGLRENDERBUFFERSTORAGEPROCRef(ref unsafe.Pointer) *PFNGLRENDERBUFFERSTORAGEPROC { - return (*PFNGLRENDERBUFFERSTORAGEPROC)(ref) -} - -//export PFNGLRENDERBUFFERSTORAGEPROCFD7B7A1B -func PFNGLRENDERBUFFERSTORAGEPROCFD7B7A1B() { - if pFNGLRENDERBUFFERSTORAGEPROCFD7B7A1BFunc != nil { - pFNGLRENDERBUFFERSTORAGEPROCFD7B7A1BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLRENDERBUFFERSTORAGEPROCFD7B7A1BFunc PFNGLRENDERBUFFERSTORAGEPROC - -func (x PFNGLSAMPLECOVERAGEPROC) PassRef() (ref *C.PFNGLSAMPLECOVERAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLECOVERAGEPROCB5636CBAFunc == nil { - pFNGLSAMPLECOVERAGEPROCB5636CBAFunc = x - } - return (*C.PFNGLSAMPLECOVERAGEPROC)(C.PFNGLSAMPLECOVERAGEPROC_b5636cba), nil -} - -func (x PFNGLSAMPLECOVERAGEPROC) PassValue() (ref C.PFNGLSAMPLECOVERAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLECOVERAGEPROCB5636CBAFunc == nil { - pFNGLSAMPLECOVERAGEPROCB5636CBAFunc = x - } - return (C.PFNGLSAMPLECOVERAGEPROC)(C.PFNGLSAMPLECOVERAGEPROC_b5636cba), nil -} - -func NewPFNGLSAMPLECOVERAGEPROCRef(ref unsafe.Pointer) *PFNGLSAMPLECOVERAGEPROC { - return (*PFNGLSAMPLECOVERAGEPROC)(ref) -} - -//export PFNGLSAMPLECOVERAGEPROCB5636CBA -func PFNGLSAMPLECOVERAGEPROCB5636CBA() { - if pFNGLSAMPLECOVERAGEPROCB5636CBAFunc != nil { - pFNGLSAMPLECOVERAGEPROCB5636CBAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSAMPLECOVERAGEPROCB5636CBAFunc PFNGLSAMPLECOVERAGEPROC - -func (x PFNGLSCISSORPROC) PassRef() (ref *C.PFNGLSCISSORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSCISSORPROC382195DBFunc == nil { - pFNGLSCISSORPROC382195DBFunc = x - } - return (*C.PFNGLSCISSORPROC)(C.PFNGLSCISSORPROC_382195db), nil -} - -func (x PFNGLSCISSORPROC) PassValue() (ref C.PFNGLSCISSORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSCISSORPROC382195DBFunc == nil { - pFNGLSCISSORPROC382195DBFunc = x - } - return (C.PFNGLSCISSORPROC)(C.PFNGLSCISSORPROC_382195db), nil -} - -func NewPFNGLSCISSORPROCRef(ref unsafe.Pointer) *PFNGLSCISSORPROC { - return (*PFNGLSCISSORPROC)(ref) -} - -//export PFNGLSCISSORPROC382195DB -func PFNGLSCISSORPROC382195DB() { - if pFNGLSCISSORPROC382195DBFunc != nil { - pFNGLSCISSORPROC382195DBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSCISSORPROC382195DBFunc PFNGLSCISSORPROC - -func (x PFNGLSHADERBINARYPROC) PassRef() (ref *C.PFNGLSHADERBINARYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSHADERBINARYPROCCF214E0AFunc == nil { - pFNGLSHADERBINARYPROCCF214E0AFunc = x - } - return (*C.PFNGLSHADERBINARYPROC)(C.PFNGLSHADERBINARYPROC_cf214e0a), nil -} - -func (x PFNGLSHADERBINARYPROC) PassValue() (ref C.PFNGLSHADERBINARYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSHADERBINARYPROCCF214E0AFunc == nil { - pFNGLSHADERBINARYPROCCF214E0AFunc = x - } - return (C.PFNGLSHADERBINARYPROC)(C.PFNGLSHADERBINARYPROC_cf214e0a), nil -} - -func NewPFNGLSHADERBINARYPROCRef(ref unsafe.Pointer) *PFNGLSHADERBINARYPROC { - return (*PFNGLSHADERBINARYPROC)(ref) -} - -//export PFNGLSHADERBINARYPROCCF214E0A -func PFNGLSHADERBINARYPROCCF214E0A() { - if pFNGLSHADERBINARYPROCCF214E0AFunc != nil { - pFNGLSHADERBINARYPROCCF214E0AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSHADERBINARYPROCCF214E0AFunc PFNGLSHADERBINARYPROC - -func (x PFNGLSHADERSOURCEPROC) PassRef() (ref *C.PFNGLSHADERSOURCEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSHADERSOURCEPROC320F676DFunc == nil { - pFNGLSHADERSOURCEPROC320F676DFunc = x - } - return (*C.PFNGLSHADERSOURCEPROC)(C.PFNGLSHADERSOURCEPROC_320f676d), nil -} - -func (x PFNGLSHADERSOURCEPROC) PassValue() (ref C.PFNGLSHADERSOURCEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSHADERSOURCEPROC320F676DFunc == nil { - pFNGLSHADERSOURCEPROC320F676DFunc = x - } - return (C.PFNGLSHADERSOURCEPROC)(C.PFNGLSHADERSOURCEPROC_320f676d), nil -} - -func NewPFNGLSHADERSOURCEPROCRef(ref unsafe.Pointer) *PFNGLSHADERSOURCEPROC { - return (*PFNGLSHADERSOURCEPROC)(ref) -} - -//export PFNGLSHADERSOURCEPROC320F676D -func PFNGLSHADERSOURCEPROC320F676D() { - if pFNGLSHADERSOURCEPROC320F676DFunc != nil { - pFNGLSHADERSOURCEPROC320F676DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSHADERSOURCEPROC320F676DFunc PFNGLSHADERSOURCEPROC - -func (x PFNGLSTENCILFUNCPROC) PassRef() (ref *C.PFNGLSTENCILFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILFUNCPROC3234CF9BFunc == nil { - pFNGLSTENCILFUNCPROC3234CF9BFunc = x - } - return (*C.PFNGLSTENCILFUNCPROC)(C.PFNGLSTENCILFUNCPROC_3234cf9b), nil -} - -func (x PFNGLSTENCILFUNCPROC) PassValue() (ref C.PFNGLSTENCILFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILFUNCPROC3234CF9BFunc == nil { - pFNGLSTENCILFUNCPROC3234CF9BFunc = x - } - return (C.PFNGLSTENCILFUNCPROC)(C.PFNGLSTENCILFUNCPROC_3234cf9b), nil -} - -func NewPFNGLSTENCILFUNCPROCRef(ref unsafe.Pointer) *PFNGLSTENCILFUNCPROC { - return (*PFNGLSTENCILFUNCPROC)(ref) -} - -//export PFNGLSTENCILFUNCPROC3234CF9B -func PFNGLSTENCILFUNCPROC3234CF9B() { - if pFNGLSTENCILFUNCPROC3234CF9BFunc != nil { - pFNGLSTENCILFUNCPROC3234CF9BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILFUNCPROC3234CF9BFunc PFNGLSTENCILFUNCPROC - -func (x PFNGLSTENCILFUNCSEPARATEPROC) PassRef() (ref *C.PFNGLSTENCILFUNCSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILFUNCSEPARATEPROC8236808DFunc == nil { - pFNGLSTENCILFUNCSEPARATEPROC8236808DFunc = x - } - return (*C.PFNGLSTENCILFUNCSEPARATEPROC)(C.PFNGLSTENCILFUNCSEPARATEPROC_8236808d), nil -} - -func (x PFNGLSTENCILFUNCSEPARATEPROC) PassValue() (ref C.PFNGLSTENCILFUNCSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILFUNCSEPARATEPROC8236808DFunc == nil { - pFNGLSTENCILFUNCSEPARATEPROC8236808DFunc = x - } - return (C.PFNGLSTENCILFUNCSEPARATEPROC)(C.PFNGLSTENCILFUNCSEPARATEPROC_8236808d), nil -} - -func NewPFNGLSTENCILFUNCSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLSTENCILFUNCSEPARATEPROC { - return (*PFNGLSTENCILFUNCSEPARATEPROC)(ref) -} - -//export PFNGLSTENCILFUNCSEPARATEPROC8236808D -func PFNGLSTENCILFUNCSEPARATEPROC8236808D() { - if pFNGLSTENCILFUNCSEPARATEPROC8236808DFunc != nil { - pFNGLSTENCILFUNCSEPARATEPROC8236808DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILFUNCSEPARATEPROC8236808DFunc PFNGLSTENCILFUNCSEPARATEPROC - -func (x PFNGLSTENCILMASKPROC) PassRef() (ref *C.PFNGLSTENCILMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILMASKPROCE85990DEFunc == nil { - pFNGLSTENCILMASKPROCE85990DEFunc = x - } - return (*C.PFNGLSTENCILMASKPROC)(C.PFNGLSTENCILMASKPROC_e85990de), nil -} - -func (x PFNGLSTENCILMASKPROC) PassValue() (ref C.PFNGLSTENCILMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILMASKPROCE85990DEFunc == nil { - pFNGLSTENCILMASKPROCE85990DEFunc = x - } - return (C.PFNGLSTENCILMASKPROC)(C.PFNGLSTENCILMASKPROC_e85990de), nil -} - -func NewPFNGLSTENCILMASKPROCRef(ref unsafe.Pointer) *PFNGLSTENCILMASKPROC { - return (*PFNGLSTENCILMASKPROC)(ref) -} - -//export PFNGLSTENCILMASKPROCE85990DE -func PFNGLSTENCILMASKPROCE85990DE() { - if pFNGLSTENCILMASKPROCE85990DEFunc != nil { - pFNGLSTENCILMASKPROCE85990DEFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILMASKPROCE85990DEFunc PFNGLSTENCILMASKPROC - -func (x PFNGLSTENCILMASKSEPARATEPROC) PassRef() (ref *C.PFNGLSTENCILMASKSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILMASKSEPARATEPROC41F6598DFunc == nil { - pFNGLSTENCILMASKSEPARATEPROC41F6598DFunc = x - } - return (*C.PFNGLSTENCILMASKSEPARATEPROC)(C.PFNGLSTENCILMASKSEPARATEPROC_41f6598d), nil -} - -func (x PFNGLSTENCILMASKSEPARATEPROC) PassValue() (ref C.PFNGLSTENCILMASKSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILMASKSEPARATEPROC41F6598DFunc == nil { - pFNGLSTENCILMASKSEPARATEPROC41F6598DFunc = x - } - return (C.PFNGLSTENCILMASKSEPARATEPROC)(C.PFNGLSTENCILMASKSEPARATEPROC_41f6598d), nil -} - -func NewPFNGLSTENCILMASKSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLSTENCILMASKSEPARATEPROC { - return (*PFNGLSTENCILMASKSEPARATEPROC)(ref) -} - -//export PFNGLSTENCILMASKSEPARATEPROC41F6598D -func PFNGLSTENCILMASKSEPARATEPROC41F6598D() { - if pFNGLSTENCILMASKSEPARATEPROC41F6598DFunc != nil { - pFNGLSTENCILMASKSEPARATEPROC41F6598DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILMASKSEPARATEPROC41F6598DFunc PFNGLSTENCILMASKSEPARATEPROC - -func (x PFNGLSTENCILOPPROC) PassRef() (ref *C.PFNGLSTENCILOPPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILOPPROC1011FEDAFunc == nil { - pFNGLSTENCILOPPROC1011FEDAFunc = x - } - return (*C.PFNGLSTENCILOPPROC)(C.PFNGLSTENCILOPPROC_1011feda), nil -} - -func (x PFNGLSTENCILOPPROC) PassValue() (ref C.PFNGLSTENCILOPPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILOPPROC1011FEDAFunc == nil { - pFNGLSTENCILOPPROC1011FEDAFunc = x - } - return (C.PFNGLSTENCILOPPROC)(C.PFNGLSTENCILOPPROC_1011feda), nil -} - -func NewPFNGLSTENCILOPPROCRef(ref unsafe.Pointer) *PFNGLSTENCILOPPROC { - return (*PFNGLSTENCILOPPROC)(ref) -} - -//export PFNGLSTENCILOPPROC1011FEDA -func PFNGLSTENCILOPPROC1011FEDA() { - if pFNGLSTENCILOPPROC1011FEDAFunc != nil { - pFNGLSTENCILOPPROC1011FEDAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILOPPROC1011FEDAFunc PFNGLSTENCILOPPROC - -func (x PFNGLSTENCILOPSEPARATEPROC) PassRef() (ref *C.PFNGLSTENCILOPSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILOPSEPARATEPROCD4B6CDEFFunc == nil { - pFNGLSTENCILOPSEPARATEPROCD4B6CDEFFunc = x - } - return (*C.PFNGLSTENCILOPSEPARATEPROC)(C.PFNGLSTENCILOPSEPARATEPROC_d4b6cdef), nil -} - -func (x PFNGLSTENCILOPSEPARATEPROC) PassValue() (ref C.PFNGLSTENCILOPSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILOPSEPARATEPROCD4B6CDEFFunc == nil { - pFNGLSTENCILOPSEPARATEPROCD4B6CDEFFunc = x - } - return (C.PFNGLSTENCILOPSEPARATEPROC)(C.PFNGLSTENCILOPSEPARATEPROC_d4b6cdef), nil -} - -func NewPFNGLSTENCILOPSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLSTENCILOPSEPARATEPROC { - return (*PFNGLSTENCILOPSEPARATEPROC)(ref) -} - -//export PFNGLSTENCILOPSEPARATEPROCD4B6CDEF -func PFNGLSTENCILOPSEPARATEPROCD4B6CDEF() { - if pFNGLSTENCILOPSEPARATEPROCD4B6CDEFFunc != nil { - pFNGLSTENCILOPSEPARATEPROCD4B6CDEFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILOPSEPARATEPROCD4B6CDEFFunc PFNGLSTENCILOPSEPARATEPROC - -func (x PFNGLTEXIMAGE2DPROC) PassRef() (ref *C.PFNGLTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXIMAGE2DPROC7DB9B341Func == nil { - pFNGLTEXIMAGE2DPROC7DB9B341Func = x - } - return (*C.PFNGLTEXIMAGE2DPROC)(C.PFNGLTEXIMAGE2DPROC_7db9b341), nil -} - -func (x PFNGLTEXIMAGE2DPROC) PassValue() (ref C.PFNGLTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXIMAGE2DPROC7DB9B341Func == nil { - pFNGLTEXIMAGE2DPROC7DB9B341Func = x - } - return (C.PFNGLTEXIMAGE2DPROC)(C.PFNGLTEXIMAGE2DPROC_7db9b341), nil -} - -func NewPFNGLTEXIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLTEXIMAGE2DPROC { - return (*PFNGLTEXIMAGE2DPROC)(ref) -} - -//export PFNGLTEXIMAGE2DPROC7DB9B341 -func PFNGLTEXIMAGE2DPROC7DB9B341() { - if pFNGLTEXIMAGE2DPROC7DB9B341Func != nil { - pFNGLTEXIMAGE2DPROC7DB9B341Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXIMAGE2DPROC7DB9B341Func PFNGLTEXIMAGE2DPROC - -func (x PFNGLTEXPARAMETERFPROC) PassRef() (ref *C.PFNGLTEXPARAMETERFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERFPROC49C04FC7Func == nil { - pFNGLTEXPARAMETERFPROC49C04FC7Func = x - } - return (*C.PFNGLTEXPARAMETERFPROC)(C.PFNGLTEXPARAMETERFPROC_49c04fc7), nil -} - -func (x PFNGLTEXPARAMETERFPROC) PassValue() (ref C.PFNGLTEXPARAMETERFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERFPROC49C04FC7Func == nil { - pFNGLTEXPARAMETERFPROC49C04FC7Func = x - } - return (C.PFNGLTEXPARAMETERFPROC)(C.PFNGLTEXPARAMETERFPROC_49c04fc7), nil -} - -func NewPFNGLTEXPARAMETERFPROCRef(ref unsafe.Pointer) *PFNGLTEXPARAMETERFPROC { - return (*PFNGLTEXPARAMETERFPROC)(ref) -} - -//export PFNGLTEXPARAMETERFPROC49C04FC7 -func PFNGLTEXPARAMETERFPROC49C04FC7() { - if pFNGLTEXPARAMETERFPROC49C04FC7Func != nil { - pFNGLTEXPARAMETERFPROC49C04FC7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXPARAMETERFPROC49C04FC7Func PFNGLTEXPARAMETERFPROC - -func (x PFNGLTEXPARAMETERFVPROC) PassRef() (ref *C.PFNGLTEXPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERFVPROC9CA30911Func == nil { - pFNGLTEXPARAMETERFVPROC9CA30911Func = x - } - return (*C.PFNGLTEXPARAMETERFVPROC)(C.PFNGLTEXPARAMETERFVPROC_9ca30911), nil -} - -func (x PFNGLTEXPARAMETERFVPROC) PassValue() (ref C.PFNGLTEXPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERFVPROC9CA30911Func == nil { - pFNGLTEXPARAMETERFVPROC9CA30911Func = x - } - return (C.PFNGLTEXPARAMETERFVPROC)(C.PFNGLTEXPARAMETERFVPROC_9ca30911), nil -} - -func NewPFNGLTEXPARAMETERFVPROCRef(ref unsafe.Pointer) *PFNGLTEXPARAMETERFVPROC { - return (*PFNGLTEXPARAMETERFVPROC)(ref) -} - -//export PFNGLTEXPARAMETERFVPROC9CA30911 -func PFNGLTEXPARAMETERFVPROC9CA30911() { - if pFNGLTEXPARAMETERFVPROC9CA30911Func != nil { - pFNGLTEXPARAMETERFVPROC9CA30911Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXPARAMETERFVPROC9CA30911Func PFNGLTEXPARAMETERFVPROC - -func (x PFNGLTEXPARAMETERIPROC) PassRef() (ref *C.PFNGLTEXPARAMETERIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERIPROCBF81A7AFFunc == nil { - pFNGLTEXPARAMETERIPROCBF81A7AFFunc = x - } - return (*C.PFNGLTEXPARAMETERIPROC)(C.PFNGLTEXPARAMETERIPROC_bf81a7af), nil -} - -func (x PFNGLTEXPARAMETERIPROC) PassValue() (ref C.PFNGLTEXPARAMETERIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERIPROCBF81A7AFFunc == nil { - pFNGLTEXPARAMETERIPROCBF81A7AFFunc = x - } - return (C.PFNGLTEXPARAMETERIPROC)(C.PFNGLTEXPARAMETERIPROC_bf81a7af), nil -} - -func NewPFNGLTEXPARAMETERIPROCRef(ref unsafe.Pointer) *PFNGLTEXPARAMETERIPROC { - return (*PFNGLTEXPARAMETERIPROC)(ref) -} - -//export PFNGLTEXPARAMETERIPROCBF81A7AF -func PFNGLTEXPARAMETERIPROCBF81A7AF() { - if pFNGLTEXPARAMETERIPROCBF81A7AFFunc != nil { - pFNGLTEXPARAMETERIPROCBF81A7AFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXPARAMETERIPROCBF81A7AFFunc PFNGLTEXPARAMETERIPROC - -func (x PFNGLTEXPARAMETERIVPROC) PassRef() (ref *C.PFNGLTEXPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERIVPROCEFA19E2EFunc == nil { - pFNGLTEXPARAMETERIVPROCEFA19E2EFunc = x - } - return (*C.PFNGLTEXPARAMETERIVPROC)(C.PFNGLTEXPARAMETERIVPROC_efa19e2e), nil -} - -func (x PFNGLTEXPARAMETERIVPROC) PassValue() (ref C.PFNGLTEXPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERIVPROCEFA19E2EFunc == nil { - pFNGLTEXPARAMETERIVPROCEFA19E2EFunc = x - } - return (C.PFNGLTEXPARAMETERIVPROC)(C.PFNGLTEXPARAMETERIVPROC_efa19e2e), nil -} - -func NewPFNGLTEXPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLTEXPARAMETERIVPROC { - return (*PFNGLTEXPARAMETERIVPROC)(ref) -} - -//export PFNGLTEXPARAMETERIVPROCEFA19E2E -func PFNGLTEXPARAMETERIVPROCEFA19E2E() { - if pFNGLTEXPARAMETERIVPROCEFA19E2EFunc != nil { - pFNGLTEXPARAMETERIVPROCEFA19E2EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXPARAMETERIVPROCEFA19E2EFunc PFNGLTEXPARAMETERIVPROC - -func (x PFNGLTEXSUBIMAGE2DPROC) PassRef() (ref *C.PFNGLTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSUBIMAGE2DPROCE0159593Func == nil { - pFNGLTEXSUBIMAGE2DPROCE0159593Func = x - } - return (*C.PFNGLTEXSUBIMAGE2DPROC)(C.PFNGLTEXSUBIMAGE2DPROC_e0159593), nil -} - -func (x PFNGLTEXSUBIMAGE2DPROC) PassValue() (ref C.PFNGLTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSUBIMAGE2DPROCE0159593Func == nil { - pFNGLTEXSUBIMAGE2DPROCE0159593Func = x - } - return (C.PFNGLTEXSUBIMAGE2DPROC)(C.PFNGLTEXSUBIMAGE2DPROC_e0159593), nil -} - -func NewPFNGLTEXSUBIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLTEXSUBIMAGE2DPROC { - return (*PFNGLTEXSUBIMAGE2DPROC)(ref) -} - -//export PFNGLTEXSUBIMAGE2DPROCE0159593 -func PFNGLTEXSUBIMAGE2DPROCE0159593() { - if pFNGLTEXSUBIMAGE2DPROCE0159593Func != nil { - pFNGLTEXSUBIMAGE2DPROCE0159593Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXSUBIMAGE2DPROCE0159593Func PFNGLTEXSUBIMAGE2DPROC - -func (x PFNGLUNIFORM1FPROC) PassRef() (ref *C.PFNGLUNIFORM1FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1FPROC0BFF5170Func == nil { - pFNGLUNIFORM1FPROC0BFF5170Func = x - } - return (*C.PFNGLUNIFORM1FPROC)(C.PFNGLUNIFORM1FPROC_0bff5170), nil -} - -func (x PFNGLUNIFORM1FPROC) PassValue() (ref C.PFNGLUNIFORM1FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1FPROC0BFF5170Func == nil { - pFNGLUNIFORM1FPROC0BFF5170Func = x - } - return (C.PFNGLUNIFORM1FPROC)(C.PFNGLUNIFORM1FPROC_0bff5170), nil -} - -func NewPFNGLUNIFORM1FPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1FPROC { - return (*PFNGLUNIFORM1FPROC)(ref) -} - -//export PFNGLUNIFORM1FPROC0BFF5170 -func PFNGLUNIFORM1FPROC0BFF5170() { - if pFNGLUNIFORM1FPROC0BFF5170Func != nil { - pFNGLUNIFORM1FPROC0BFF5170Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1FPROC0BFF5170Func PFNGLUNIFORM1FPROC - -func (x PFNGLUNIFORM1FVPROC) PassRef() (ref *C.PFNGLUNIFORM1FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1FVPROCEEAD7014Func == nil { - pFNGLUNIFORM1FVPROCEEAD7014Func = x - } - return (*C.PFNGLUNIFORM1FVPROC)(C.PFNGLUNIFORM1FVPROC_eead7014), nil -} - -func (x PFNGLUNIFORM1FVPROC) PassValue() (ref C.PFNGLUNIFORM1FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1FVPROCEEAD7014Func == nil { - pFNGLUNIFORM1FVPROCEEAD7014Func = x - } - return (C.PFNGLUNIFORM1FVPROC)(C.PFNGLUNIFORM1FVPROC_eead7014), nil -} - -func NewPFNGLUNIFORM1FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1FVPROC { - return (*PFNGLUNIFORM1FVPROC)(ref) -} - -//export PFNGLUNIFORM1FVPROCEEAD7014 -func PFNGLUNIFORM1FVPROCEEAD7014() { - if pFNGLUNIFORM1FVPROCEEAD7014Func != nil { - pFNGLUNIFORM1FVPROCEEAD7014Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1FVPROCEEAD7014Func PFNGLUNIFORM1FVPROC - -func (x PFNGLUNIFORM1IPROC) PassRef() (ref *C.PFNGLUNIFORM1IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1IPROC214D6EFFFunc == nil { - pFNGLUNIFORM1IPROC214D6EFFFunc = x - } - return (*C.PFNGLUNIFORM1IPROC)(C.PFNGLUNIFORM1IPROC_214d6eff), nil -} - -func (x PFNGLUNIFORM1IPROC) PassValue() (ref C.PFNGLUNIFORM1IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1IPROC214D6EFFFunc == nil { - pFNGLUNIFORM1IPROC214D6EFFFunc = x - } - return (C.PFNGLUNIFORM1IPROC)(C.PFNGLUNIFORM1IPROC_214d6eff), nil -} - -func NewPFNGLUNIFORM1IPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1IPROC { - return (*PFNGLUNIFORM1IPROC)(ref) -} - -//export PFNGLUNIFORM1IPROC214D6EFF -func PFNGLUNIFORM1IPROC214D6EFF() { - if pFNGLUNIFORM1IPROC214D6EFFFunc != nil { - pFNGLUNIFORM1IPROC214D6EFFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1IPROC214D6EFFFunc PFNGLUNIFORM1IPROC - -func (x PFNGLUNIFORM1IVPROC) PassRef() (ref *C.PFNGLUNIFORM1IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1IVPROC53B272C6Func == nil { - pFNGLUNIFORM1IVPROC53B272C6Func = x - } - return (*C.PFNGLUNIFORM1IVPROC)(C.PFNGLUNIFORM1IVPROC_53b272c6), nil -} - -func (x PFNGLUNIFORM1IVPROC) PassValue() (ref C.PFNGLUNIFORM1IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1IVPROC53B272C6Func == nil { - pFNGLUNIFORM1IVPROC53B272C6Func = x - } - return (C.PFNGLUNIFORM1IVPROC)(C.PFNGLUNIFORM1IVPROC_53b272c6), nil -} - -func NewPFNGLUNIFORM1IVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1IVPROC { - return (*PFNGLUNIFORM1IVPROC)(ref) -} - -//export PFNGLUNIFORM1IVPROC53B272C6 -func PFNGLUNIFORM1IVPROC53B272C6() { - if pFNGLUNIFORM1IVPROC53B272C6Func != nil { - pFNGLUNIFORM1IVPROC53B272C6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1IVPROC53B272C6Func PFNGLUNIFORM1IVPROC - -func (x PFNGLUNIFORM2FPROC) PassRef() (ref *C.PFNGLUNIFORM2FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2FPROCABD0FE87Func == nil { - pFNGLUNIFORM2FPROCABD0FE87Func = x - } - return (*C.PFNGLUNIFORM2FPROC)(C.PFNGLUNIFORM2FPROC_abd0fe87), nil -} - -func (x PFNGLUNIFORM2FPROC) PassValue() (ref C.PFNGLUNIFORM2FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2FPROCABD0FE87Func == nil { - pFNGLUNIFORM2FPROCABD0FE87Func = x - } - return (C.PFNGLUNIFORM2FPROC)(C.PFNGLUNIFORM2FPROC_abd0fe87), nil -} - -func NewPFNGLUNIFORM2FPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2FPROC { - return (*PFNGLUNIFORM2FPROC)(ref) -} - -//export PFNGLUNIFORM2FPROCABD0FE87 -func PFNGLUNIFORM2FPROCABD0FE87() { - if pFNGLUNIFORM2FPROCABD0FE87Func != nil { - pFNGLUNIFORM2FPROCABD0FE87Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2FPROCABD0FE87Func PFNGLUNIFORM2FPROC - -func (x PFNGLUNIFORM2FVPROC) PassRef() (ref *C.PFNGLUNIFORM2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2FVPROC43206E9AFunc == nil { - pFNGLUNIFORM2FVPROC43206E9AFunc = x - } - return (*C.PFNGLUNIFORM2FVPROC)(C.PFNGLUNIFORM2FVPROC_43206e9a), nil -} - -func (x PFNGLUNIFORM2FVPROC) PassValue() (ref C.PFNGLUNIFORM2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2FVPROC43206E9AFunc == nil { - pFNGLUNIFORM2FVPROC43206E9AFunc = x - } - return (C.PFNGLUNIFORM2FVPROC)(C.PFNGLUNIFORM2FVPROC_43206e9a), nil -} - -func NewPFNGLUNIFORM2FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2FVPROC { - return (*PFNGLUNIFORM2FVPROC)(ref) -} - -//export PFNGLUNIFORM2FVPROC43206E9A -func PFNGLUNIFORM2FVPROC43206E9A() { - if pFNGLUNIFORM2FVPROC43206E9AFunc != nil { - pFNGLUNIFORM2FVPROC43206E9AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2FVPROC43206E9AFunc PFNGLUNIFORM2FVPROC - -func (x PFNGLUNIFORM2IPROC) PassRef() (ref *C.PFNGLUNIFORM2IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2IPROC4A80CBCFFunc == nil { - pFNGLUNIFORM2IPROC4A80CBCFFunc = x - } - return (*C.PFNGLUNIFORM2IPROC)(C.PFNGLUNIFORM2IPROC_4a80cbcf), nil -} - -func (x PFNGLUNIFORM2IPROC) PassValue() (ref C.PFNGLUNIFORM2IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2IPROC4A80CBCFFunc == nil { - pFNGLUNIFORM2IPROC4A80CBCFFunc = x - } - return (C.PFNGLUNIFORM2IPROC)(C.PFNGLUNIFORM2IPROC_4a80cbcf), nil -} - -func NewPFNGLUNIFORM2IPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2IPROC { - return (*PFNGLUNIFORM2IPROC)(ref) -} - -//export PFNGLUNIFORM2IPROC4A80CBCF -func PFNGLUNIFORM2IPROC4A80CBCF() { - if pFNGLUNIFORM2IPROC4A80CBCFFunc != nil { - pFNGLUNIFORM2IPROC4A80CBCFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2IPROC4A80CBCFFunc PFNGLUNIFORM2IPROC - -func (x PFNGLUNIFORM2IVPROC) PassRef() (ref *C.PFNGLUNIFORM2IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2IVPROC7AB23664Func == nil { - pFNGLUNIFORM2IVPROC7AB23664Func = x - } - return (*C.PFNGLUNIFORM2IVPROC)(C.PFNGLUNIFORM2IVPROC_7ab23664), nil -} - -func (x PFNGLUNIFORM2IVPROC) PassValue() (ref C.PFNGLUNIFORM2IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2IVPROC7AB23664Func == nil { - pFNGLUNIFORM2IVPROC7AB23664Func = x - } - return (C.PFNGLUNIFORM2IVPROC)(C.PFNGLUNIFORM2IVPROC_7ab23664), nil -} - -func NewPFNGLUNIFORM2IVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2IVPROC { - return (*PFNGLUNIFORM2IVPROC)(ref) -} - -//export PFNGLUNIFORM2IVPROC7AB23664 -func PFNGLUNIFORM2IVPROC7AB23664() { - if pFNGLUNIFORM2IVPROC7AB23664Func != nil { - pFNGLUNIFORM2IVPROC7AB23664Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2IVPROC7AB23664Func PFNGLUNIFORM2IVPROC - -func (x PFNGLUNIFORM3FPROC) PassRef() (ref *C.PFNGLUNIFORM3FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3FPROC75E6607FFunc == nil { - pFNGLUNIFORM3FPROC75E6607FFunc = x - } - return (*C.PFNGLUNIFORM3FPROC)(C.PFNGLUNIFORM3FPROC_75e6607f), nil -} - -func (x PFNGLUNIFORM3FPROC) PassValue() (ref C.PFNGLUNIFORM3FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3FPROC75E6607FFunc == nil { - pFNGLUNIFORM3FPROC75E6607FFunc = x - } - return (C.PFNGLUNIFORM3FPROC)(C.PFNGLUNIFORM3FPROC_75e6607f), nil -} - -func NewPFNGLUNIFORM3FPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3FPROC { - return (*PFNGLUNIFORM3FPROC)(ref) -} - -//export PFNGLUNIFORM3FPROC75E6607F -func PFNGLUNIFORM3FPROC75E6607F() { - if pFNGLUNIFORM3FPROC75E6607FFunc != nil { - pFNGLUNIFORM3FPROC75E6607FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3FPROC75E6607FFunc PFNGLUNIFORM3FPROC - -func (x PFNGLUNIFORM3FVPROC) PassRef() (ref *C.PFNGLUNIFORM3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3FVPROC7AE5143EFunc == nil { - pFNGLUNIFORM3FVPROC7AE5143EFunc = x - } - return (*C.PFNGLUNIFORM3FVPROC)(C.PFNGLUNIFORM3FVPROC_7ae5143e), nil -} - -func (x PFNGLUNIFORM3FVPROC) PassValue() (ref C.PFNGLUNIFORM3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3FVPROC7AE5143EFunc == nil { - pFNGLUNIFORM3FVPROC7AE5143EFunc = x - } - return (C.PFNGLUNIFORM3FVPROC)(C.PFNGLUNIFORM3FVPROC_7ae5143e), nil -} - -func NewPFNGLUNIFORM3FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3FVPROC { - return (*PFNGLUNIFORM3FVPROC)(ref) -} - -//export PFNGLUNIFORM3FVPROC7AE5143E -func PFNGLUNIFORM3FVPROC7AE5143E() { - if pFNGLUNIFORM3FVPROC7AE5143EFunc != nil { - pFNGLUNIFORM3FVPROC7AE5143EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3FVPROC7AE5143EFunc PFNGLUNIFORM3FVPROC - -func (x PFNGLUNIFORM3IPROC) PassRef() (ref *C.PFNGLUNIFORM3IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3IPROC1E02DF35Func == nil { - pFNGLUNIFORM3IPROC1E02DF35Func = x - } - return (*C.PFNGLUNIFORM3IPROC)(C.PFNGLUNIFORM3IPROC_1e02df35), nil -} - -func (x PFNGLUNIFORM3IPROC) PassValue() (ref C.PFNGLUNIFORM3IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3IPROC1E02DF35Func == nil { - pFNGLUNIFORM3IPROC1E02DF35Func = x - } - return (C.PFNGLUNIFORM3IPROC)(C.PFNGLUNIFORM3IPROC_1e02df35), nil -} - -func NewPFNGLUNIFORM3IPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3IPROC { - return (*PFNGLUNIFORM3IPROC)(ref) -} - -//export PFNGLUNIFORM3IPROC1E02DF35 -func PFNGLUNIFORM3IPROC1E02DF35() { - if pFNGLUNIFORM3IPROC1E02DF35Func != nil { - pFNGLUNIFORM3IPROC1E02DF35Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3IPROC1E02DF35Func PFNGLUNIFORM3IPROC - -func (x PFNGLUNIFORM3IVPROC) PassRef() (ref *C.PFNGLUNIFORM3IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3IVPROC7A54FF33Func == nil { - pFNGLUNIFORM3IVPROC7A54FF33Func = x - } - return (*C.PFNGLUNIFORM3IVPROC)(C.PFNGLUNIFORM3IVPROC_7a54ff33), nil -} - -func (x PFNGLUNIFORM3IVPROC) PassValue() (ref C.PFNGLUNIFORM3IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3IVPROC7A54FF33Func == nil { - pFNGLUNIFORM3IVPROC7A54FF33Func = x - } - return (C.PFNGLUNIFORM3IVPROC)(C.PFNGLUNIFORM3IVPROC_7a54ff33), nil -} - -func NewPFNGLUNIFORM3IVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3IVPROC { - return (*PFNGLUNIFORM3IVPROC)(ref) -} - -//export PFNGLUNIFORM3IVPROC7A54FF33 -func PFNGLUNIFORM3IVPROC7A54FF33() { - if pFNGLUNIFORM3IVPROC7A54FF33Func != nil { - pFNGLUNIFORM3IVPROC7A54FF33Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3IVPROC7A54FF33Func PFNGLUNIFORM3IVPROC - -func (x PFNGLUNIFORM4FPROC) PassRef() (ref *C.PFNGLUNIFORM4FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4FPROC32347CB5Func == nil { - pFNGLUNIFORM4FPROC32347CB5Func = x - } - return (*C.PFNGLUNIFORM4FPROC)(C.PFNGLUNIFORM4FPROC_32347cb5), nil -} - -func (x PFNGLUNIFORM4FPROC) PassValue() (ref C.PFNGLUNIFORM4FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4FPROC32347CB5Func == nil { - pFNGLUNIFORM4FPROC32347CB5Func = x - } - return (C.PFNGLUNIFORM4FPROC)(C.PFNGLUNIFORM4FPROC_32347cb5), nil -} - -func NewPFNGLUNIFORM4FPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4FPROC { - return (*PFNGLUNIFORM4FPROC)(ref) -} - -//export PFNGLUNIFORM4FPROC32347CB5 -func PFNGLUNIFORM4FPROC32347CB5() { - if pFNGLUNIFORM4FPROC32347CB5Func != nil { - pFNGLUNIFORM4FPROC32347CB5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4FPROC32347CB5Func PFNGLUNIFORM4FPROC - -func (x PFNGLUNIFORM4FVPROC) PassRef() (ref *C.PFNGLUNIFORM4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4FVPROCE695CFD9Func == nil { - pFNGLUNIFORM4FVPROCE695CFD9Func = x - } - return (*C.PFNGLUNIFORM4FVPROC)(C.PFNGLUNIFORM4FVPROC_e695cfd9), nil -} - -func (x PFNGLUNIFORM4FVPROC) PassValue() (ref C.PFNGLUNIFORM4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4FVPROCE695CFD9Func == nil { - pFNGLUNIFORM4FVPROCE695CFD9Func = x - } - return (C.PFNGLUNIFORM4FVPROC)(C.PFNGLUNIFORM4FVPROC_e695cfd9), nil -} - -func NewPFNGLUNIFORM4FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4FVPROC { - return (*PFNGLUNIFORM4FVPROC)(ref) -} - -//export PFNGLUNIFORM4FVPROCE695CFD9 -func PFNGLUNIFORM4FVPROCE695CFD9() { - if pFNGLUNIFORM4FVPROCE695CFD9Func != nil { - pFNGLUNIFORM4FVPROCE695CFD9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4FVPROCE695CFD9Func PFNGLUNIFORM4FVPROC - -func (x PFNGLUNIFORM4IPROC) PassRef() (ref *C.PFNGLUNIFORM4IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4IPROCCA68800BFunc == nil { - pFNGLUNIFORM4IPROCCA68800BFunc = x - } - return (*C.PFNGLUNIFORM4IPROC)(C.PFNGLUNIFORM4IPROC_ca68800b), nil -} - -func (x PFNGLUNIFORM4IPROC) PassValue() (ref C.PFNGLUNIFORM4IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4IPROCCA68800BFunc == nil { - pFNGLUNIFORM4IPROCCA68800BFunc = x - } - return (C.PFNGLUNIFORM4IPROC)(C.PFNGLUNIFORM4IPROC_ca68800b), nil -} - -func NewPFNGLUNIFORM4IPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4IPROC { - return (*PFNGLUNIFORM4IPROC)(ref) -} - -//export PFNGLUNIFORM4IPROCCA68800B -func PFNGLUNIFORM4IPROCCA68800B() { - if pFNGLUNIFORM4IPROCCA68800BFunc != nil { - pFNGLUNIFORM4IPROCCA68800BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4IPROCCA68800BFunc PFNGLUNIFORM4IPROC - -func (x PFNGLUNIFORM4IVPROC) PassRef() (ref *C.PFNGLUNIFORM4IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4IVPROC2630316CFunc == nil { - pFNGLUNIFORM4IVPROC2630316CFunc = x - } - return (*C.PFNGLUNIFORM4IVPROC)(C.PFNGLUNIFORM4IVPROC_2630316c), nil -} - -func (x PFNGLUNIFORM4IVPROC) PassValue() (ref C.PFNGLUNIFORM4IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4IVPROC2630316CFunc == nil { - pFNGLUNIFORM4IVPROC2630316CFunc = x - } - return (C.PFNGLUNIFORM4IVPROC)(C.PFNGLUNIFORM4IVPROC_2630316c), nil -} - -func NewPFNGLUNIFORM4IVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4IVPROC { - return (*PFNGLUNIFORM4IVPROC)(ref) -} - -//export PFNGLUNIFORM4IVPROC2630316C -func PFNGLUNIFORM4IVPROC2630316C() { - if pFNGLUNIFORM4IVPROC2630316CFunc != nil { - pFNGLUNIFORM4IVPROC2630316CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4IVPROC2630316CFunc PFNGLUNIFORM4IVPROC - -func (x PFNGLUNIFORMMATRIX2FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX2FVPROCF82B6C3BFunc == nil { - pFNGLUNIFORMMATRIX2FVPROCF82B6C3BFunc = x - } - return (*C.PFNGLUNIFORMMATRIX2FVPROC)(C.PFNGLUNIFORMMATRIX2FVPROC_f82b6c3b), nil -} - -func (x PFNGLUNIFORMMATRIX2FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX2FVPROCF82B6C3BFunc == nil { - pFNGLUNIFORMMATRIX2FVPROCF82B6C3BFunc = x - } - return (C.PFNGLUNIFORMMATRIX2FVPROC)(C.PFNGLUNIFORMMATRIX2FVPROC_f82b6c3b), nil -} - -func NewPFNGLUNIFORMMATRIX2FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX2FVPROC { - return (*PFNGLUNIFORMMATRIX2FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX2FVPROCF82B6C3B -func PFNGLUNIFORMMATRIX2FVPROCF82B6C3B() { - if pFNGLUNIFORMMATRIX2FVPROCF82B6C3BFunc != nil { - pFNGLUNIFORMMATRIX2FVPROCF82B6C3BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX2FVPROCF82B6C3BFunc PFNGLUNIFORMMATRIX2FVPROC - -func (x PFNGLUNIFORMMATRIX3FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX3FVPROCCA3FE2F1Func == nil { - pFNGLUNIFORMMATRIX3FVPROCCA3FE2F1Func = x - } - return (*C.PFNGLUNIFORMMATRIX3FVPROC)(C.PFNGLUNIFORMMATRIX3FVPROC_ca3fe2f1), nil -} - -func (x PFNGLUNIFORMMATRIX3FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX3FVPROCCA3FE2F1Func == nil { - pFNGLUNIFORMMATRIX3FVPROCCA3FE2F1Func = x - } - return (C.PFNGLUNIFORMMATRIX3FVPROC)(C.PFNGLUNIFORMMATRIX3FVPROC_ca3fe2f1), nil -} - -func NewPFNGLUNIFORMMATRIX3FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX3FVPROC { - return (*PFNGLUNIFORMMATRIX3FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX3FVPROCCA3FE2F1 -func PFNGLUNIFORMMATRIX3FVPROCCA3FE2F1() { - if pFNGLUNIFORMMATRIX3FVPROCCA3FE2F1Func != nil { - pFNGLUNIFORMMATRIX3FVPROCCA3FE2F1Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX3FVPROCCA3FE2F1Func PFNGLUNIFORMMATRIX3FVPROC - -func (x PFNGLUNIFORMMATRIX4FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX4FVPROC840D6A5DFunc == nil { - pFNGLUNIFORMMATRIX4FVPROC840D6A5DFunc = x - } - return (*C.PFNGLUNIFORMMATRIX4FVPROC)(C.PFNGLUNIFORMMATRIX4FVPROC_840d6a5d), nil -} - -func (x PFNGLUNIFORMMATRIX4FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX4FVPROC840D6A5DFunc == nil { - pFNGLUNIFORMMATRIX4FVPROC840D6A5DFunc = x - } - return (C.PFNGLUNIFORMMATRIX4FVPROC)(C.PFNGLUNIFORMMATRIX4FVPROC_840d6a5d), nil -} - -func NewPFNGLUNIFORMMATRIX4FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX4FVPROC { - return (*PFNGLUNIFORMMATRIX4FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX4FVPROC840D6A5D -func PFNGLUNIFORMMATRIX4FVPROC840D6A5D() { - if pFNGLUNIFORMMATRIX4FVPROC840D6A5DFunc != nil { - pFNGLUNIFORMMATRIX4FVPROC840D6A5DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX4FVPROC840D6A5DFunc PFNGLUNIFORMMATRIX4FVPROC - -func (x PFNGLUSEPROGRAMPROC) PassRef() (ref *C.PFNGLUSEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUSEPROGRAMPROCD49A8D40Func == nil { - pFNGLUSEPROGRAMPROCD49A8D40Func = x - } - return (*C.PFNGLUSEPROGRAMPROC)(C.PFNGLUSEPROGRAMPROC_d49a8d40), nil -} - -func (x PFNGLUSEPROGRAMPROC) PassValue() (ref C.PFNGLUSEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUSEPROGRAMPROCD49A8D40Func == nil { - pFNGLUSEPROGRAMPROCD49A8D40Func = x - } - return (C.PFNGLUSEPROGRAMPROC)(C.PFNGLUSEPROGRAMPROC_d49a8d40), nil -} - -func NewPFNGLUSEPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLUSEPROGRAMPROC { - return (*PFNGLUSEPROGRAMPROC)(ref) -} - -//export PFNGLUSEPROGRAMPROCD49A8D40 -func PFNGLUSEPROGRAMPROCD49A8D40() { - if pFNGLUSEPROGRAMPROCD49A8D40Func != nil { - pFNGLUSEPROGRAMPROCD49A8D40Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUSEPROGRAMPROCD49A8D40Func PFNGLUSEPROGRAMPROC - -func (x PFNGLVALIDATEPROGRAMPROC) PassRef() (ref *C.PFNGLVALIDATEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVALIDATEPROGRAMPROCEBAB0036Func == nil { - pFNGLVALIDATEPROGRAMPROCEBAB0036Func = x - } - return (*C.PFNGLVALIDATEPROGRAMPROC)(C.PFNGLVALIDATEPROGRAMPROC_ebab0036), nil -} - -func (x PFNGLVALIDATEPROGRAMPROC) PassValue() (ref C.PFNGLVALIDATEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVALIDATEPROGRAMPROCEBAB0036Func == nil { - pFNGLVALIDATEPROGRAMPROCEBAB0036Func = x - } - return (C.PFNGLVALIDATEPROGRAMPROC)(C.PFNGLVALIDATEPROGRAMPROC_ebab0036), nil -} - -func NewPFNGLVALIDATEPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLVALIDATEPROGRAMPROC { - return (*PFNGLVALIDATEPROGRAMPROC)(ref) -} - -//export PFNGLVALIDATEPROGRAMPROCEBAB0036 -func PFNGLVALIDATEPROGRAMPROCEBAB0036() { - if pFNGLVALIDATEPROGRAMPROCEBAB0036Func != nil { - pFNGLVALIDATEPROGRAMPROCEBAB0036Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVALIDATEPROGRAMPROCEBAB0036Func PFNGLVALIDATEPROGRAMPROC - -func (x PFNGLVERTEXATTRIB1FPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB1FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB1FPROC07978665Func == nil { - pFNGLVERTEXATTRIB1FPROC07978665Func = x - } - return (*C.PFNGLVERTEXATTRIB1FPROC)(C.PFNGLVERTEXATTRIB1FPROC_07978665), nil -} - -func (x PFNGLVERTEXATTRIB1FPROC) PassValue() (ref C.PFNGLVERTEXATTRIB1FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB1FPROC07978665Func == nil { - pFNGLVERTEXATTRIB1FPROC07978665Func = x - } - return (C.PFNGLVERTEXATTRIB1FPROC)(C.PFNGLVERTEXATTRIB1FPROC_07978665), nil -} - -func NewPFNGLVERTEXATTRIB1FPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB1FPROC { - return (*PFNGLVERTEXATTRIB1FPROC)(ref) -} - -//export PFNGLVERTEXATTRIB1FPROC07978665 -func PFNGLVERTEXATTRIB1FPROC07978665() { - if pFNGLVERTEXATTRIB1FPROC07978665Func != nil { - pFNGLVERTEXATTRIB1FPROC07978665Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB1FPROC07978665Func PFNGLVERTEXATTRIB1FPROC - -func (x PFNGLVERTEXATTRIB1FVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB1FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB1FVPROC9551E9A2Func == nil { - pFNGLVERTEXATTRIB1FVPROC9551E9A2Func = x - } - return (*C.PFNGLVERTEXATTRIB1FVPROC)(C.PFNGLVERTEXATTRIB1FVPROC_9551e9a2), nil -} - -func (x PFNGLVERTEXATTRIB1FVPROC) PassValue() (ref C.PFNGLVERTEXATTRIB1FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB1FVPROC9551E9A2Func == nil { - pFNGLVERTEXATTRIB1FVPROC9551E9A2Func = x - } - return (C.PFNGLVERTEXATTRIB1FVPROC)(C.PFNGLVERTEXATTRIB1FVPROC_9551e9a2), nil -} - -func NewPFNGLVERTEXATTRIB1FVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB1FVPROC { - return (*PFNGLVERTEXATTRIB1FVPROC)(ref) -} - -//export PFNGLVERTEXATTRIB1FVPROC9551E9A2 -func PFNGLVERTEXATTRIB1FVPROC9551E9A2() { - if pFNGLVERTEXATTRIB1FVPROC9551E9A2Func != nil { - pFNGLVERTEXATTRIB1FVPROC9551E9A2Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB1FVPROC9551E9A2Func PFNGLVERTEXATTRIB1FVPROC - -func (x PFNGLVERTEXATTRIB2FPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB2FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB2FPROCDABE4EEFFunc == nil { - pFNGLVERTEXATTRIB2FPROCDABE4EEFFunc = x - } - return (*C.PFNGLVERTEXATTRIB2FPROC)(C.PFNGLVERTEXATTRIB2FPROC_dabe4eef), nil -} - -func (x PFNGLVERTEXATTRIB2FPROC) PassValue() (ref C.PFNGLVERTEXATTRIB2FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB2FPROCDABE4EEFFunc == nil { - pFNGLVERTEXATTRIB2FPROCDABE4EEFFunc = x - } - return (C.PFNGLVERTEXATTRIB2FPROC)(C.PFNGLVERTEXATTRIB2FPROC_dabe4eef), nil -} - -func NewPFNGLVERTEXATTRIB2FPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB2FPROC { - return (*PFNGLVERTEXATTRIB2FPROC)(ref) -} - -//export PFNGLVERTEXATTRIB2FPROCDABE4EEF -func PFNGLVERTEXATTRIB2FPROCDABE4EEF() { - if pFNGLVERTEXATTRIB2FPROCDABE4EEFFunc != nil { - pFNGLVERTEXATTRIB2FPROCDABE4EEFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB2FPROCDABE4EEFFunc PFNGLVERTEXATTRIB2FPROC - -func (x PFNGLVERTEXATTRIB2FVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB2FVPROC63CAEE6DFunc == nil { - pFNGLVERTEXATTRIB2FVPROC63CAEE6DFunc = x - } - return (*C.PFNGLVERTEXATTRIB2FVPROC)(C.PFNGLVERTEXATTRIB2FVPROC_63caee6d), nil -} - -func (x PFNGLVERTEXATTRIB2FVPROC) PassValue() (ref C.PFNGLVERTEXATTRIB2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB2FVPROC63CAEE6DFunc == nil { - pFNGLVERTEXATTRIB2FVPROC63CAEE6DFunc = x - } - return (C.PFNGLVERTEXATTRIB2FVPROC)(C.PFNGLVERTEXATTRIB2FVPROC_63caee6d), nil -} - -func NewPFNGLVERTEXATTRIB2FVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB2FVPROC { - return (*PFNGLVERTEXATTRIB2FVPROC)(ref) -} - -//export PFNGLVERTEXATTRIB2FVPROC63CAEE6D -func PFNGLVERTEXATTRIB2FVPROC63CAEE6D() { - if pFNGLVERTEXATTRIB2FVPROC63CAEE6DFunc != nil { - pFNGLVERTEXATTRIB2FVPROC63CAEE6DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB2FVPROC63CAEE6DFunc PFNGLVERTEXATTRIB2FVPROC - -func (x PFNGLVERTEXATTRIB3FPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB3FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB3FPROC96116A2FFunc == nil { - pFNGLVERTEXATTRIB3FPROC96116A2FFunc = x - } - return (*C.PFNGLVERTEXATTRIB3FPROC)(C.PFNGLVERTEXATTRIB3FPROC_96116a2f), nil -} - -func (x PFNGLVERTEXATTRIB3FPROC) PassValue() (ref C.PFNGLVERTEXATTRIB3FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB3FPROC96116A2FFunc == nil { - pFNGLVERTEXATTRIB3FPROC96116A2FFunc = x - } - return (C.PFNGLVERTEXATTRIB3FPROC)(C.PFNGLVERTEXATTRIB3FPROC_96116a2f), nil -} - -func NewPFNGLVERTEXATTRIB3FPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB3FPROC { - return (*PFNGLVERTEXATTRIB3FPROC)(ref) -} - -//export PFNGLVERTEXATTRIB3FPROC96116A2F -func PFNGLVERTEXATTRIB3FPROC96116A2F() { - if pFNGLVERTEXATTRIB3FPROC96116A2FFunc != nil { - pFNGLVERTEXATTRIB3FPROC96116A2FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB3FPROC96116A2FFunc PFNGLVERTEXATTRIB3FPROC - -func (x PFNGLVERTEXATTRIB3FVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB3FVPROCED21DE77Func == nil { - pFNGLVERTEXATTRIB3FVPROCED21DE77Func = x - } - return (*C.PFNGLVERTEXATTRIB3FVPROC)(C.PFNGLVERTEXATTRIB3FVPROC_ed21de77), nil -} - -func (x PFNGLVERTEXATTRIB3FVPROC) PassValue() (ref C.PFNGLVERTEXATTRIB3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB3FVPROCED21DE77Func == nil { - pFNGLVERTEXATTRIB3FVPROCED21DE77Func = x - } - return (C.PFNGLVERTEXATTRIB3FVPROC)(C.PFNGLVERTEXATTRIB3FVPROC_ed21de77), nil -} - -func NewPFNGLVERTEXATTRIB3FVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB3FVPROC { - return (*PFNGLVERTEXATTRIB3FVPROC)(ref) -} - -//export PFNGLVERTEXATTRIB3FVPROCED21DE77 -func PFNGLVERTEXATTRIB3FVPROCED21DE77() { - if pFNGLVERTEXATTRIB3FVPROCED21DE77Func != nil { - pFNGLVERTEXATTRIB3FVPROCED21DE77Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB3FVPROCED21DE77Func PFNGLVERTEXATTRIB3FVPROC - -func (x PFNGLVERTEXATTRIB4FPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB4FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB4FPROCB1F64CA3Func == nil { - pFNGLVERTEXATTRIB4FPROCB1F64CA3Func = x - } - return (*C.PFNGLVERTEXATTRIB4FPROC)(C.PFNGLVERTEXATTRIB4FPROC_b1f64ca3), nil -} - -func (x PFNGLVERTEXATTRIB4FPROC) PassValue() (ref C.PFNGLVERTEXATTRIB4FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB4FPROCB1F64CA3Func == nil { - pFNGLVERTEXATTRIB4FPROCB1F64CA3Func = x - } - return (C.PFNGLVERTEXATTRIB4FPROC)(C.PFNGLVERTEXATTRIB4FPROC_b1f64ca3), nil -} - -func NewPFNGLVERTEXATTRIB4FPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB4FPROC { - return (*PFNGLVERTEXATTRIB4FPROC)(ref) -} - -//export PFNGLVERTEXATTRIB4FPROCB1F64CA3 -func PFNGLVERTEXATTRIB4FPROCB1F64CA3() { - if pFNGLVERTEXATTRIB4FPROCB1F64CA3Func != nil { - pFNGLVERTEXATTRIB4FPROCB1F64CA3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB4FPROCB1F64CA3Func PFNGLVERTEXATTRIB4FPROC - -func (x PFNGLVERTEXATTRIB4FVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB4FVPROCAE71B07DFunc == nil { - pFNGLVERTEXATTRIB4FVPROCAE71B07DFunc = x - } - return (*C.PFNGLVERTEXATTRIB4FVPROC)(C.PFNGLVERTEXATTRIB4FVPROC_ae71b07d), nil -} - -func (x PFNGLVERTEXATTRIB4FVPROC) PassValue() (ref C.PFNGLVERTEXATTRIB4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB4FVPROCAE71B07DFunc == nil { - pFNGLVERTEXATTRIB4FVPROCAE71B07DFunc = x - } - return (C.PFNGLVERTEXATTRIB4FVPROC)(C.PFNGLVERTEXATTRIB4FVPROC_ae71b07d), nil -} - -func NewPFNGLVERTEXATTRIB4FVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB4FVPROC { - return (*PFNGLVERTEXATTRIB4FVPROC)(ref) -} - -//export PFNGLVERTEXATTRIB4FVPROCAE71B07D -func PFNGLVERTEXATTRIB4FVPROCAE71B07D() { - if pFNGLVERTEXATTRIB4FVPROCAE71B07DFunc != nil { - pFNGLVERTEXATTRIB4FVPROCAE71B07DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB4FVPROCAE71B07DFunc PFNGLVERTEXATTRIB4FVPROC - -func (x PFNGLVERTEXATTRIBPOINTERPROC) PassRef() (ref *C.PFNGLVERTEXATTRIBPOINTERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBPOINTERPROC6B507F2CFunc == nil { - pFNGLVERTEXATTRIBPOINTERPROC6B507F2CFunc = x - } - return (*C.PFNGLVERTEXATTRIBPOINTERPROC)(C.PFNGLVERTEXATTRIBPOINTERPROC_6b507f2c), nil -} - -func (x PFNGLVERTEXATTRIBPOINTERPROC) PassValue() (ref C.PFNGLVERTEXATTRIBPOINTERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBPOINTERPROC6B507F2CFunc == nil { - pFNGLVERTEXATTRIBPOINTERPROC6B507F2CFunc = x - } - return (C.PFNGLVERTEXATTRIBPOINTERPROC)(C.PFNGLVERTEXATTRIBPOINTERPROC_6b507f2c), nil -} - -func NewPFNGLVERTEXATTRIBPOINTERPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIBPOINTERPROC { - return (*PFNGLVERTEXATTRIBPOINTERPROC)(ref) -} - -//export PFNGLVERTEXATTRIBPOINTERPROC6B507F2C -func PFNGLVERTEXATTRIBPOINTERPROC6B507F2C() { - if pFNGLVERTEXATTRIBPOINTERPROC6B507F2CFunc != nil { - pFNGLVERTEXATTRIBPOINTERPROC6B507F2CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIBPOINTERPROC6B507F2CFunc PFNGLVERTEXATTRIBPOINTERPROC - -func (x PFNGLVIEWPORTPROC) PassRef() (ref *C.PFNGLVIEWPORTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVIEWPORTPROC9AF8044AFunc == nil { - pFNGLVIEWPORTPROC9AF8044AFunc = x - } - return (*C.PFNGLVIEWPORTPROC)(C.PFNGLVIEWPORTPROC_9af8044a), nil -} - -func (x PFNGLVIEWPORTPROC) PassValue() (ref C.PFNGLVIEWPORTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVIEWPORTPROC9AF8044AFunc == nil { - pFNGLVIEWPORTPROC9AF8044AFunc = x - } - return (C.PFNGLVIEWPORTPROC)(C.PFNGLVIEWPORTPROC_9af8044a), nil -} - -func NewPFNGLVIEWPORTPROCRef(ref unsafe.Pointer) *PFNGLVIEWPORTPROC { - return (*PFNGLVIEWPORTPROC)(ref) -} - -//export PFNGLVIEWPORTPROC9AF8044A -func PFNGLVIEWPORTPROC9AF8044A() { - if pFNGLVIEWPORTPROC9AF8044AFunc != nil { - pFNGLVIEWPORTPROC9AF8044AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVIEWPORTPROC9AF8044AFunc PFNGLVIEWPORTPROC diff --git a/capi/gles2/cgo_helpers.h b/capi/gles2/cgo_helpers.h deleted file mode 100644 index d8f9099..0000000 --- a/capi/gles2/cgo_helpers.h +++ /dev/null @@ -1,435 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "GLES2/gl2.h" -#include "GLES2/gl2ext.h" -#include -#pragma once - -#define __CGOGEN 1 - -// PFNGLACTIVETEXTUREPROC_6e47c869 is a proxy for callback PFNGLACTIVETEXTUREPROC. -void PFNGLACTIVETEXTUREPROC_6e47c869(); - -// PFNGLATTACHSHADERPROC_1307d43f is a proxy for callback PFNGLATTACHSHADERPROC. -void PFNGLATTACHSHADERPROC_1307d43f(); - -// PFNGLBINDATTRIBLOCATIONPROC_f8b91c30 is a proxy for callback PFNGLBINDATTRIBLOCATIONPROC. -void PFNGLBINDATTRIBLOCATIONPROC_f8b91c30(); - -// PFNGLBINDBUFFERPROC_d94c7932 is a proxy for callback PFNGLBINDBUFFERPROC. -void PFNGLBINDBUFFERPROC_d94c7932(); - -// PFNGLBINDFRAMEBUFFERPROC_6dab872f is a proxy for callback PFNGLBINDFRAMEBUFFERPROC. -void PFNGLBINDFRAMEBUFFERPROC_6dab872f(); - -// PFNGLBINDRENDERBUFFERPROC_3f834dfa is a proxy for callback PFNGLBINDRENDERBUFFERPROC. -void PFNGLBINDRENDERBUFFERPROC_3f834dfa(); - -// PFNGLBINDTEXTUREPROC_8ed8ec9d is a proxy for callback PFNGLBINDTEXTUREPROC. -void PFNGLBINDTEXTUREPROC_8ed8ec9d(); - -// PFNGLBLENDCOLORPROC_c3166a72 is a proxy for callback PFNGLBLENDCOLORPROC. -void PFNGLBLENDCOLORPROC_c3166a72(); - -// PFNGLBLENDEQUATIONPROC_69096e8b is a proxy for callback PFNGLBLENDEQUATIONPROC. -void PFNGLBLENDEQUATIONPROC_69096e8b(); - -// PFNGLBLENDEQUATIONSEPARATEPROC_eaf8dd26 is a proxy for callback PFNGLBLENDEQUATIONSEPARATEPROC. -void PFNGLBLENDEQUATIONSEPARATEPROC_eaf8dd26(); - -// PFNGLBLENDFUNCPROC_9c82df9a is a proxy for callback PFNGLBLENDFUNCPROC. -void PFNGLBLENDFUNCPROC_9c82df9a(); - -// PFNGLBLENDFUNCSEPARATEPROC_8f247f05 is a proxy for callback PFNGLBLENDFUNCSEPARATEPROC. -void PFNGLBLENDFUNCSEPARATEPROC_8f247f05(); - -// PFNGLBUFFERDATAPROC_108a8f9a is a proxy for callback PFNGLBUFFERDATAPROC. -void PFNGLBUFFERDATAPROC_108a8f9a(); - -// PFNGLBUFFERSUBDATAPROC_a57a5d10 is a proxy for callback PFNGLBUFFERSUBDATAPROC. -void PFNGLBUFFERSUBDATAPROC_a57a5d10(); - -// PFNGLCHECKFRAMEBUFFERSTATUSPROC_c70b02ad is a proxy for callback PFNGLCHECKFRAMEBUFFERSTATUSPROC. -void PFNGLCHECKFRAMEBUFFERSTATUSPROC_c70b02ad(); - -// PFNGLCLEARCOLORPROC_bbf95dd3 is a proxy for callback PFNGLCLEARCOLORPROC. -void PFNGLCLEARCOLORPROC_bbf95dd3(); - -// PFNGLCLEARDEPTHFPROC_0393ff33 is a proxy for callback PFNGLCLEARDEPTHFPROC. -void PFNGLCLEARDEPTHFPROC_0393ff33(); - -// PFNGLCLEARPROC_5c505a01 is a proxy for callback PFNGLCLEARPROC. -void PFNGLCLEARPROC_5c505a01(); - -// PFNGLCLEARSTENCILPROC_294e6113 is a proxy for callback PFNGLCLEARSTENCILPROC. -void PFNGLCLEARSTENCILPROC_294e6113(); - -// PFNGLCOLORMASKPROC_c9e06898 is a proxy for callback PFNGLCOLORMASKPROC. -void PFNGLCOLORMASKPROC_c9e06898(); - -// PFNGLCOMPILESHADERPROC_fa71632c is a proxy for callback PFNGLCOMPILESHADERPROC. -void PFNGLCOMPILESHADERPROC_fa71632c(); - -// PFNGLCOMPRESSEDTEXIMAGE2DPROC_25c09a9d is a proxy for callback PFNGLCOMPRESSEDTEXIMAGE2DPROC. -void PFNGLCOMPRESSEDTEXIMAGE2DPROC_25c09a9d(); - -// PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_cd1f0169 is a proxy for callback PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC. -void PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_cd1f0169(); - -// PFNGLCOPYTEXIMAGE2DPROC_362cb2c6 is a proxy for callback PFNGLCOPYTEXIMAGE2DPROC. -void PFNGLCOPYTEXIMAGE2DPROC_362cb2c6(); - -// PFNGLCOPYTEXSUBIMAGE2DPROC_f084f8e4 is a proxy for callback PFNGLCOPYTEXSUBIMAGE2DPROC. -void PFNGLCOPYTEXSUBIMAGE2DPROC_f084f8e4(); - -// PFNGLCREATEPROGRAMPROC_b7320e79 is a proxy for callback PFNGLCREATEPROGRAMPROC. -void PFNGLCREATEPROGRAMPROC_b7320e79(); - -// PFNGLCREATESHADERPROC_90286feb is a proxy for callback PFNGLCREATESHADERPROC. -void PFNGLCREATESHADERPROC_90286feb(); - -// PFNGLCULLFACEPROC_fdd0b6ab is a proxy for callback PFNGLCULLFACEPROC. -void PFNGLCULLFACEPROC_fdd0b6ab(); - -// PFNGLDELETEBUFFERSPROC_71945243 is a proxy for callback PFNGLDELETEBUFFERSPROC. -void PFNGLDELETEBUFFERSPROC_71945243(); - -// PFNGLDELETEFRAMEBUFFERSPROC_e82ea5e7 is a proxy for callback PFNGLDELETEFRAMEBUFFERSPROC. -void PFNGLDELETEFRAMEBUFFERSPROC_e82ea5e7(); - -// PFNGLDELETEPROGRAMPROC_980d924f is a proxy for callback PFNGLDELETEPROGRAMPROC. -void PFNGLDELETEPROGRAMPROC_980d924f(); - -// PFNGLDELETERENDERBUFFERSPROC_578e77fb is a proxy for callback PFNGLDELETERENDERBUFFERSPROC. -void PFNGLDELETERENDERBUFFERSPROC_578e77fb(); - -// PFNGLDELETESHADERPROC_71a112df is a proxy for callback PFNGLDELETESHADERPROC. -void PFNGLDELETESHADERPROC_71a112df(); - -// PFNGLDELETETEXTURESPROC_b1f8e327 is a proxy for callback PFNGLDELETETEXTURESPROC. -void PFNGLDELETETEXTURESPROC_b1f8e327(); - -// PFNGLDEPTHFUNCPROC_14649a7b is a proxy for callback PFNGLDEPTHFUNCPROC. -void PFNGLDEPTHFUNCPROC_14649a7b(); - -// PFNGLDEPTHMASKPROC_eae207ef is a proxy for callback PFNGLDEPTHMASKPROC. -void PFNGLDEPTHMASKPROC_eae207ef(); - -// PFNGLDEPTHRANGEFPROC_df1d7c44 is a proxy for callback PFNGLDEPTHRANGEFPROC. -void PFNGLDEPTHRANGEFPROC_df1d7c44(); - -// PFNGLDETACHSHADERPROC_cb02fa06 is a proxy for callback PFNGLDETACHSHADERPROC. -void PFNGLDETACHSHADERPROC_cb02fa06(); - -// PFNGLDISABLEPROC_09c452ac is a proxy for callback PFNGLDISABLEPROC. -void PFNGLDISABLEPROC_09c452ac(); - -// PFNGLDISABLEVERTEXATTRIBARRAYPROC_55dee1b6 is a proxy for callback PFNGLDISABLEVERTEXATTRIBARRAYPROC. -void PFNGLDISABLEVERTEXATTRIBARRAYPROC_55dee1b6(); - -// PFNGLDRAWARRAYSPROC_ee5de7f9 is a proxy for callback PFNGLDRAWARRAYSPROC. -void PFNGLDRAWARRAYSPROC_ee5de7f9(); - -// PFNGLDRAWELEMENTSPROC_5cc630d9 is a proxy for callback PFNGLDRAWELEMENTSPROC. -void PFNGLDRAWELEMENTSPROC_5cc630d9(); - -// PFNGLENABLEPROC_bd9eec48 is a proxy for callback PFNGLENABLEPROC. -void PFNGLENABLEPROC_bd9eec48(); - -// PFNGLENABLEVERTEXATTRIBARRAYPROC_5fa65ebb is a proxy for callback PFNGLENABLEVERTEXATTRIBARRAYPROC. -void PFNGLENABLEVERTEXATTRIBARRAYPROC_5fa65ebb(); - -// PFNGLFINISHPROC_89486d93 is a proxy for callback PFNGLFINISHPROC. -void PFNGLFINISHPROC_89486d93(); - -// PFNGLFLUSHPROC_5a17fa98 is a proxy for callback PFNGLFLUSHPROC. -void PFNGLFLUSHPROC_5a17fa98(); - -// PFNGLFRAMEBUFFERRENDERBUFFERPROC_4a3a1f7d is a proxy for callback PFNGLFRAMEBUFFERRENDERBUFFERPROC. -void PFNGLFRAMEBUFFERRENDERBUFFERPROC_4a3a1f7d(); - -// PFNGLFRAMEBUFFERTEXTURE2DPROC_947c34c9 is a proxy for callback PFNGLFRAMEBUFFERTEXTURE2DPROC. -void PFNGLFRAMEBUFFERTEXTURE2DPROC_947c34c9(); - -// PFNGLFRONTFACEPROC_bb965009 is a proxy for callback PFNGLFRONTFACEPROC. -void PFNGLFRONTFACEPROC_bb965009(); - -// PFNGLGENBUFFERSPROC_fe169f7f is a proxy for callback PFNGLGENBUFFERSPROC. -void PFNGLGENBUFFERSPROC_fe169f7f(); - -// PFNGLGENERATEMIPMAPPROC_16259df9 is a proxy for callback PFNGLGENERATEMIPMAPPROC. -void PFNGLGENERATEMIPMAPPROC_16259df9(); - -// PFNGLGENFRAMEBUFFERSPROC_17a91b18 is a proxy for callback PFNGLGENFRAMEBUFFERSPROC. -void PFNGLGENFRAMEBUFFERSPROC_17a91b18(); - -// PFNGLGENRENDERBUFFERSPROC_e58b8074 is a proxy for callback PFNGLGENRENDERBUFFERSPROC. -void PFNGLGENRENDERBUFFERSPROC_e58b8074(); - -// PFNGLGENTEXTURESPROC_984e35d5 is a proxy for callback PFNGLGENTEXTURESPROC. -void PFNGLGENTEXTURESPROC_984e35d5(); - -// PFNGLGETACTIVEATTRIBPROC_671be206 is a proxy for callback PFNGLGETACTIVEATTRIBPROC. -void PFNGLGETACTIVEATTRIBPROC_671be206(); - -// PFNGLGETACTIVEUNIFORMPROC_b54d7db5 is a proxy for callback PFNGLGETACTIVEUNIFORMPROC. -void PFNGLGETACTIVEUNIFORMPROC_b54d7db5(); - -// PFNGLGETATTACHEDSHADERSPROC_37f31c4e is a proxy for callback PFNGLGETATTACHEDSHADERSPROC. -void PFNGLGETATTACHEDSHADERSPROC_37f31c4e(); - -// PFNGLGETATTRIBLOCATIONPROC_eee07211 is a proxy for callback PFNGLGETATTRIBLOCATIONPROC. -void PFNGLGETATTRIBLOCATIONPROC_eee07211(); - -// PFNGLGETBOOLEANVPROC_28e602f0 is a proxy for callback PFNGLGETBOOLEANVPROC. -void PFNGLGETBOOLEANVPROC_28e602f0(); - -// PFNGLGETBUFFERPARAMETERIVPROC_42b6d73e is a proxy for callback PFNGLGETBUFFERPARAMETERIVPROC. -void PFNGLGETBUFFERPARAMETERIVPROC_42b6d73e(); - -// PFNGLGETERRORPROC_493c4fa3 is a proxy for callback PFNGLGETERRORPROC. -void PFNGLGETERRORPROC_493c4fa3(); - -// PFNGLGETFLOATVPROC_2b7c40db is a proxy for callback PFNGLGETFLOATVPROC. -void PFNGLGETFLOATVPROC_2b7c40db(); - -// PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_a7dee7a0 is a proxy for callback PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC. -void PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_a7dee7a0(); - -// PFNGLGETINTEGERVPROC_d1b0be4b is a proxy for callback PFNGLGETINTEGERVPROC. -void PFNGLGETINTEGERVPROC_d1b0be4b(); - -// PFNGLGETPROGRAMINFOLOGPROC_aa65e8fb is a proxy for callback PFNGLGETPROGRAMINFOLOGPROC. -void PFNGLGETPROGRAMINFOLOGPROC_aa65e8fb(); - -// PFNGLGETPROGRAMIVPROC_77d8dea3 is a proxy for callback PFNGLGETPROGRAMIVPROC. -void PFNGLGETPROGRAMIVPROC_77d8dea3(); - -// PFNGLGETRENDERBUFFERPARAMETERIVPROC_433873d6 is a proxy for callback PFNGLGETRENDERBUFFERPARAMETERIVPROC. -void PFNGLGETRENDERBUFFERPARAMETERIVPROC_433873d6(); - -// PFNGLGETSHADERINFOLOGPROC_0230ef81 is a proxy for callback PFNGLGETSHADERINFOLOGPROC. -void PFNGLGETSHADERINFOLOGPROC_0230ef81(); - -// PFNGLGETSHADERIVPROC_9f6bf31d is a proxy for callback PFNGLGETSHADERIVPROC. -void PFNGLGETSHADERIVPROC_9f6bf31d(); - -// PFNGLGETSHADERPRECISIONFORMATPROC_802a8e22 is a proxy for callback PFNGLGETSHADERPRECISIONFORMATPROC. -void PFNGLGETSHADERPRECISIONFORMATPROC_802a8e22(); - -// PFNGLGETSHADERSOURCEPROC_720cfc89 is a proxy for callback PFNGLGETSHADERSOURCEPROC. -void PFNGLGETSHADERSOURCEPROC_720cfc89(); - -// PFNGLGETSTRINGPROC_a27c496a is a proxy for callback PFNGLGETSTRINGPROC. -void PFNGLGETSTRINGPROC_a27c496a(); - -// PFNGLGETTEXPARAMETERFVPROC_4e2e2b7e is a proxy for callback PFNGLGETTEXPARAMETERFVPROC. -void PFNGLGETTEXPARAMETERFVPROC_4e2e2b7e(); - -// PFNGLGETTEXPARAMETERIVPROC_d102ab47 is a proxy for callback PFNGLGETTEXPARAMETERIVPROC. -void PFNGLGETTEXPARAMETERIVPROC_d102ab47(); - -// PFNGLGETUNIFORMFVPROC_224f0554 is a proxy for callback PFNGLGETUNIFORMFVPROC. -void PFNGLGETUNIFORMFVPROC_224f0554(); - -// PFNGLGETUNIFORMIVPROC_7ac2feaa is a proxy for callback PFNGLGETUNIFORMIVPROC. -void PFNGLGETUNIFORMIVPROC_7ac2feaa(); - -// PFNGLGETUNIFORMLOCATIONPROC_f7c84f68 is a proxy for callback PFNGLGETUNIFORMLOCATIONPROC. -void PFNGLGETUNIFORMLOCATIONPROC_f7c84f68(); - -// PFNGLGETVERTEXATTRIBFVPROC_fe79a986 is a proxy for callback PFNGLGETVERTEXATTRIBFVPROC. -void PFNGLGETVERTEXATTRIBFVPROC_fe79a986(); - -// PFNGLGETVERTEXATTRIBIVPROC_60c239b0 is a proxy for callback PFNGLGETVERTEXATTRIBIVPROC. -void PFNGLGETVERTEXATTRIBIVPROC_60c239b0(); - -// PFNGLGETVERTEXATTRIBPOINTERVPROC_3cd0d0c9 is a proxy for callback PFNGLGETVERTEXATTRIBPOINTERVPROC. -void PFNGLGETVERTEXATTRIBPOINTERVPROC_3cd0d0c9(); - -// PFNGLHINTPROC_fb1b468c is a proxy for callback PFNGLHINTPROC. -void PFNGLHINTPROC_fb1b468c(); - -// PFNGLISBUFFERPROC_ec676601 is a proxy for callback PFNGLISBUFFERPROC. -void PFNGLISBUFFERPROC_ec676601(); - -// PFNGLISENABLEDPROC_5f3a913b is a proxy for callback PFNGLISENABLEDPROC. -void PFNGLISENABLEDPROC_5f3a913b(); - -// PFNGLISFRAMEBUFFERPROC_09ec8734 is a proxy for callback PFNGLISFRAMEBUFFERPROC. -void PFNGLISFRAMEBUFFERPROC_09ec8734(); - -// PFNGLISPROGRAMPROC_4b2be4bc is a proxy for callback PFNGLISPROGRAMPROC. -void PFNGLISPROGRAMPROC_4b2be4bc(); - -// PFNGLISRENDERBUFFERPROC_9125a0c4 is a proxy for callback PFNGLISRENDERBUFFERPROC. -void PFNGLISRENDERBUFFERPROC_9125a0c4(); - -// PFNGLISSHADERPROC_f4ee4c55 is a proxy for callback PFNGLISSHADERPROC. -void PFNGLISSHADERPROC_f4ee4c55(); - -// PFNGLISTEXTUREPROC_b34e7e73 is a proxy for callback PFNGLISTEXTUREPROC. -void PFNGLISTEXTUREPROC_b34e7e73(); - -// PFNGLLINEWIDTHPROC_31406c60 is a proxy for callback PFNGLLINEWIDTHPROC. -void PFNGLLINEWIDTHPROC_31406c60(); - -// PFNGLLINKPROGRAMPROC_07d669c8 is a proxy for callback PFNGLLINKPROGRAMPROC. -void PFNGLLINKPROGRAMPROC_07d669c8(); - -// PFNGLPIXELSTOREIPROC_c91a89bd is a proxy for callback PFNGLPIXELSTOREIPROC. -void PFNGLPIXELSTOREIPROC_c91a89bd(); - -// PFNGLPOLYGONOFFSETPROC_5b26d329 is a proxy for callback PFNGLPOLYGONOFFSETPROC. -void PFNGLPOLYGONOFFSETPROC_5b26d329(); - -// PFNGLREADPIXELSPROC_82fe6500 is a proxy for callback PFNGLREADPIXELSPROC. -void PFNGLREADPIXELSPROC_82fe6500(); - -// PFNGLRELEASESHADERCOMPILERPROC_5c6bf9f9 is a proxy for callback PFNGLRELEASESHADERCOMPILERPROC. -void PFNGLRELEASESHADERCOMPILERPROC_5c6bf9f9(); - -// PFNGLRENDERBUFFERSTORAGEPROC_fd7b7a1b is a proxy for callback PFNGLRENDERBUFFERSTORAGEPROC. -void PFNGLRENDERBUFFERSTORAGEPROC_fd7b7a1b(); - -// PFNGLSAMPLECOVERAGEPROC_b5636cba is a proxy for callback PFNGLSAMPLECOVERAGEPROC. -void PFNGLSAMPLECOVERAGEPROC_b5636cba(); - -// PFNGLSCISSORPROC_382195db is a proxy for callback PFNGLSCISSORPROC. -void PFNGLSCISSORPROC_382195db(); - -// PFNGLSHADERBINARYPROC_cf214e0a is a proxy for callback PFNGLSHADERBINARYPROC. -void PFNGLSHADERBINARYPROC_cf214e0a(); - -// PFNGLSHADERSOURCEPROC_320f676d is a proxy for callback PFNGLSHADERSOURCEPROC. -void PFNGLSHADERSOURCEPROC_320f676d(); - -// PFNGLSTENCILFUNCPROC_3234cf9b is a proxy for callback PFNGLSTENCILFUNCPROC. -void PFNGLSTENCILFUNCPROC_3234cf9b(); - -// PFNGLSTENCILFUNCSEPARATEPROC_8236808d is a proxy for callback PFNGLSTENCILFUNCSEPARATEPROC. -void PFNGLSTENCILFUNCSEPARATEPROC_8236808d(); - -// PFNGLSTENCILMASKPROC_e85990de is a proxy for callback PFNGLSTENCILMASKPROC. -void PFNGLSTENCILMASKPROC_e85990de(); - -// PFNGLSTENCILMASKSEPARATEPROC_41f6598d is a proxy for callback PFNGLSTENCILMASKSEPARATEPROC. -void PFNGLSTENCILMASKSEPARATEPROC_41f6598d(); - -// PFNGLSTENCILOPPROC_1011feda is a proxy for callback PFNGLSTENCILOPPROC. -void PFNGLSTENCILOPPROC_1011feda(); - -// PFNGLSTENCILOPSEPARATEPROC_d4b6cdef is a proxy for callback PFNGLSTENCILOPSEPARATEPROC. -void PFNGLSTENCILOPSEPARATEPROC_d4b6cdef(); - -// PFNGLTEXIMAGE2DPROC_7db9b341 is a proxy for callback PFNGLTEXIMAGE2DPROC. -void PFNGLTEXIMAGE2DPROC_7db9b341(); - -// PFNGLTEXPARAMETERFPROC_49c04fc7 is a proxy for callback PFNGLTEXPARAMETERFPROC. -void PFNGLTEXPARAMETERFPROC_49c04fc7(); - -// PFNGLTEXPARAMETERFVPROC_9ca30911 is a proxy for callback PFNGLTEXPARAMETERFVPROC. -void PFNGLTEXPARAMETERFVPROC_9ca30911(); - -// PFNGLTEXPARAMETERIPROC_bf81a7af is a proxy for callback PFNGLTEXPARAMETERIPROC. -void PFNGLTEXPARAMETERIPROC_bf81a7af(); - -// PFNGLTEXPARAMETERIVPROC_efa19e2e is a proxy for callback PFNGLTEXPARAMETERIVPROC. -void PFNGLTEXPARAMETERIVPROC_efa19e2e(); - -// PFNGLTEXSUBIMAGE2DPROC_e0159593 is a proxy for callback PFNGLTEXSUBIMAGE2DPROC. -void PFNGLTEXSUBIMAGE2DPROC_e0159593(); - -// PFNGLUNIFORM1FPROC_0bff5170 is a proxy for callback PFNGLUNIFORM1FPROC. -void PFNGLUNIFORM1FPROC_0bff5170(); - -// PFNGLUNIFORM1FVPROC_eead7014 is a proxy for callback PFNGLUNIFORM1FVPROC. -void PFNGLUNIFORM1FVPROC_eead7014(); - -// PFNGLUNIFORM1IPROC_214d6eff is a proxy for callback PFNGLUNIFORM1IPROC. -void PFNGLUNIFORM1IPROC_214d6eff(); - -// PFNGLUNIFORM1IVPROC_53b272c6 is a proxy for callback PFNGLUNIFORM1IVPROC. -void PFNGLUNIFORM1IVPROC_53b272c6(); - -// PFNGLUNIFORM2FPROC_abd0fe87 is a proxy for callback PFNGLUNIFORM2FPROC. -void PFNGLUNIFORM2FPROC_abd0fe87(); - -// PFNGLUNIFORM2FVPROC_43206e9a is a proxy for callback PFNGLUNIFORM2FVPROC. -void PFNGLUNIFORM2FVPROC_43206e9a(); - -// PFNGLUNIFORM2IPROC_4a80cbcf is a proxy for callback PFNGLUNIFORM2IPROC. -void PFNGLUNIFORM2IPROC_4a80cbcf(); - -// PFNGLUNIFORM2IVPROC_7ab23664 is a proxy for callback PFNGLUNIFORM2IVPROC. -void PFNGLUNIFORM2IVPROC_7ab23664(); - -// PFNGLUNIFORM3FPROC_75e6607f is a proxy for callback PFNGLUNIFORM3FPROC. -void PFNGLUNIFORM3FPROC_75e6607f(); - -// PFNGLUNIFORM3FVPROC_7ae5143e is a proxy for callback PFNGLUNIFORM3FVPROC. -void PFNGLUNIFORM3FVPROC_7ae5143e(); - -// PFNGLUNIFORM3IPROC_1e02df35 is a proxy for callback PFNGLUNIFORM3IPROC. -void PFNGLUNIFORM3IPROC_1e02df35(); - -// PFNGLUNIFORM3IVPROC_7a54ff33 is a proxy for callback PFNGLUNIFORM3IVPROC. -void PFNGLUNIFORM3IVPROC_7a54ff33(); - -// PFNGLUNIFORM4FPROC_32347cb5 is a proxy for callback PFNGLUNIFORM4FPROC. -void PFNGLUNIFORM4FPROC_32347cb5(); - -// PFNGLUNIFORM4FVPROC_e695cfd9 is a proxy for callback PFNGLUNIFORM4FVPROC. -void PFNGLUNIFORM4FVPROC_e695cfd9(); - -// PFNGLUNIFORM4IPROC_ca68800b is a proxy for callback PFNGLUNIFORM4IPROC. -void PFNGLUNIFORM4IPROC_ca68800b(); - -// PFNGLUNIFORM4IVPROC_2630316c is a proxy for callback PFNGLUNIFORM4IVPROC. -void PFNGLUNIFORM4IVPROC_2630316c(); - -// PFNGLUNIFORMMATRIX2FVPROC_f82b6c3b is a proxy for callback PFNGLUNIFORMMATRIX2FVPROC. -void PFNGLUNIFORMMATRIX2FVPROC_f82b6c3b(); - -// PFNGLUNIFORMMATRIX3FVPROC_ca3fe2f1 is a proxy for callback PFNGLUNIFORMMATRIX3FVPROC. -void PFNGLUNIFORMMATRIX3FVPROC_ca3fe2f1(); - -// PFNGLUNIFORMMATRIX4FVPROC_840d6a5d is a proxy for callback PFNGLUNIFORMMATRIX4FVPROC. -void PFNGLUNIFORMMATRIX4FVPROC_840d6a5d(); - -// PFNGLUSEPROGRAMPROC_d49a8d40 is a proxy for callback PFNGLUSEPROGRAMPROC. -void PFNGLUSEPROGRAMPROC_d49a8d40(); - -// PFNGLVALIDATEPROGRAMPROC_ebab0036 is a proxy for callback PFNGLVALIDATEPROGRAMPROC. -void PFNGLVALIDATEPROGRAMPROC_ebab0036(); - -// PFNGLVERTEXATTRIB1FPROC_07978665 is a proxy for callback PFNGLVERTEXATTRIB1FPROC. -void PFNGLVERTEXATTRIB1FPROC_07978665(); - -// PFNGLVERTEXATTRIB1FVPROC_9551e9a2 is a proxy for callback PFNGLVERTEXATTRIB1FVPROC. -void PFNGLVERTEXATTRIB1FVPROC_9551e9a2(); - -// PFNGLVERTEXATTRIB2FPROC_dabe4eef is a proxy for callback PFNGLVERTEXATTRIB2FPROC. -void PFNGLVERTEXATTRIB2FPROC_dabe4eef(); - -// PFNGLVERTEXATTRIB2FVPROC_63caee6d is a proxy for callback PFNGLVERTEXATTRIB2FVPROC. -void PFNGLVERTEXATTRIB2FVPROC_63caee6d(); - -// PFNGLVERTEXATTRIB3FPROC_96116a2f is a proxy for callback PFNGLVERTEXATTRIB3FPROC. -void PFNGLVERTEXATTRIB3FPROC_96116a2f(); - -// PFNGLVERTEXATTRIB3FVPROC_ed21de77 is a proxy for callback PFNGLVERTEXATTRIB3FVPROC. -void PFNGLVERTEXATTRIB3FVPROC_ed21de77(); - -// PFNGLVERTEXATTRIB4FPROC_b1f64ca3 is a proxy for callback PFNGLVERTEXATTRIB4FPROC. -void PFNGLVERTEXATTRIB4FPROC_b1f64ca3(); - -// PFNGLVERTEXATTRIB4FVPROC_ae71b07d is a proxy for callback PFNGLVERTEXATTRIB4FVPROC. -void PFNGLVERTEXATTRIB4FVPROC_ae71b07d(); - -// PFNGLVERTEXATTRIBPOINTERPROC_6b507f2c is a proxy for callback PFNGLVERTEXATTRIBPOINTERPROC. -void PFNGLVERTEXATTRIBPOINTERPROC_6b507f2c(); - -// PFNGLVIEWPORTPROC_9af8044a is a proxy for callback PFNGLVIEWPORTPROC. -void PFNGLVIEWPORTPROC_9af8044a(); - diff --git a/capi/gles2/const.go b/capi/gles2/const.go deleted file mode 100644 index f5c280c..0000000 --- a/capi/gles2/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package gles2 diff --git a/capi/gles2/doc.go b/capi/gles2/doc.go deleted file mode 100644 index 39c46eb..0000000 --- a/capi/gles2/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for OpenGL ES 2.0 -*/ -package gles2 diff --git a/capi/gles2/gles2.go b/capi/gles2/gles2.go deleted file mode 100644 index 901c4aa..0000000 --- a/capi/gles2/gles2.go +++ /dev/null @@ -1,1415 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package gles2 - -/* -#cgo LDFLAGS: -lGLESv2 -#include "GLES2/gl2.h" -#include "GLES2/gl2ext.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func GlActiveTexture(texture GLenum) { - ctexture, ctextureAllocMap := (C.GLenum)(texture), cgoAllocsUnknown - C.glActiveTexture(ctexture) - runtime.KeepAlive(ctextureAllocMap) -} - -func GlAttachShader(program GLuint, shader GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - C.glAttachShader(cprogram, cshader) - runtime.KeepAlive(cshaderAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlBindAttribLocation(program GLuint, index GLuint, name *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - C.glBindAttribLocation(cprogram, cindex, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlBindBuffer(target GLenum, buffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (C.GLuint)(buffer), cgoAllocsUnknown - C.glBindBuffer(ctarget, cbuffer) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindFramebuffer(target GLenum, framebuffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cframebuffer, cframebufferAllocMap := (C.GLuint)(framebuffer), cgoAllocsUnknown - C.glBindFramebuffer(ctarget, cframebuffer) - runtime.KeepAlive(cframebufferAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindRenderbuffer(target GLenum, renderbuffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - crenderbuffer, crenderbufferAllocMap := (C.GLuint)(renderbuffer), cgoAllocsUnknown - C.glBindRenderbuffer(ctarget, crenderbuffer) - runtime.KeepAlive(crenderbufferAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindTexture(target GLenum, texture GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - ctexture, ctextureAllocMap := (C.GLuint)(texture), cgoAllocsUnknown - C.glBindTexture(ctarget, ctexture) - runtime.KeepAlive(ctextureAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBlendColor(red GLfloat, green GLfloat, blue GLfloat, alpha GLfloat) { - cred, credAllocMap := (C.GLfloat)(red), cgoAllocsUnknown - cgreen, cgreenAllocMap := (C.GLfloat)(green), cgoAllocsUnknown - cblue, cblueAllocMap := (C.GLfloat)(blue), cgoAllocsUnknown - calpha, calphaAllocMap := (C.GLfloat)(alpha), cgoAllocsUnknown - C.glBlendColor(cred, cgreen, cblue, calpha) - runtime.KeepAlive(calphaAllocMap) - runtime.KeepAlive(cblueAllocMap) - runtime.KeepAlive(cgreenAllocMap) - runtime.KeepAlive(credAllocMap) -} - -func GlBlendEquation(mode GLenum) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - C.glBlendEquation(cmode) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlBlendEquationSeparate(modeRGB GLenum, modeAlpha GLenum) { - cmodeRGB, cmodeRGBAllocMap := (C.GLenum)(modeRGB), cgoAllocsUnknown - cmodeAlpha, cmodeAlphaAllocMap := (C.GLenum)(modeAlpha), cgoAllocsUnknown - C.glBlendEquationSeparate(cmodeRGB, cmodeAlpha) - runtime.KeepAlive(cmodeAlphaAllocMap) - runtime.KeepAlive(cmodeRGBAllocMap) -} - -func GlBlendFunc(sfactor GLenum, dfactor GLenum) { - csfactor, csfactorAllocMap := (C.GLenum)(sfactor), cgoAllocsUnknown - cdfactor, cdfactorAllocMap := (C.GLenum)(dfactor), cgoAllocsUnknown - C.glBlendFunc(csfactor, cdfactor) - runtime.KeepAlive(cdfactorAllocMap) - runtime.KeepAlive(csfactorAllocMap) -} - -func GlBlendFuncSeparate(sfactorRGB GLenum, dfactorRGB GLenum, sfactorAlpha GLenum, dfactorAlpha GLenum) { - csfactorRGB, csfactorRGBAllocMap := (C.GLenum)(sfactorRGB), cgoAllocsUnknown - cdfactorRGB, cdfactorRGBAllocMap := (C.GLenum)(dfactorRGB), cgoAllocsUnknown - csfactorAlpha, csfactorAlphaAllocMap := (C.GLenum)(sfactorAlpha), cgoAllocsUnknown - cdfactorAlpha, cdfactorAlphaAllocMap := (C.GLenum)(dfactorAlpha), cgoAllocsUnknown - C.glBlendFuncSeparate(csfactorRGB, cdfactorRGB, csfactorAlpha, cdfactorAlpha) - runtime.KeepAlive(cdfactorAlphaAllocMap) - runtime.KeepAlive(csfactorAlphaAllocMap) - runtime.KeepAlive(cdfactorRGBAllocMap) - runtime.KeepAlive(csfactorRGBAllocMap) -} - -func GlBufferData(target GLenum, size GLsizeiptr, data unsafe.Pointer, usage GLenum) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLsizeiptr)(size), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - cusage, cusageAllocMap := (C.GLenum)(usage), cgoAllocsUnknown - C.glBufferData(ctarget, csize, cdata, cusage) - runtime.KeepAlive(cusageAllocMap) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBufferSubData(target GLenum, offset GLintptr, size GLsizeiptr, data unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.GLintptr)(offset), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLsizeiptr)(size), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.glBufferSubData(ctarget, coffset, csize, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCheckFramebufferStatus(target GLenum) GLenum { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - __ret := C.glCheckFramebufferStatus(ctarget) - runtime.KeepAlive(ctargetAllocMap) - __v := (GLenum)(__ret) - return __v -} - -func GlClear(mask GLbitfield) { - cmask, cmaskAllocMap := (C.GLbitfield)(mask), cgoAllocsUnknown - C.glClear(cmask) - runtime.KeepAlive(cmaskAllocMap) -} - -func GlClearColor(red GLfloat, green GLfloat, blue GLfloat, alpha GLfloat) { - cred, credAllocMap := (C.GLfloat)(red), cgoAllocsUnknown - cgreen, cgreenAllocMap := (C.GLfloat)(green), cgoAllocsUnknown - cblue, cblueAllocMap := (C.GLfloat)(blue), cgoAllocsUnknown - calpha, calphaAllocMap := (C.GLfloat)(alpha), cgoAllocsUnknown - C.glClearColor(cred, cgreen, cblue, calpha) - runtime.KeepAlive(calphaAllocMap) - runtime.KeepAlive(cblueAllocMap) - runtime.KeepAlive(cgreenAllocMap) - runtime.KeepAlive(credAllocMap) -} - -func GlClearDepthf(d GLfloat) { - cd, cdAllocMap := (C.GLfloat)(d), cgoAllocsUnknown - C.glClearDepthf(cd) - runtime.KeepAlive(cdAllocMap) -} - -func GlClearStencil(s GLint) { - cs, csAllocMap := (C.GLint)(s), cgoAllocsUnknown - C.glClearStencil(cs) - runtime.KeepAlive(csAllocMap) -} - -func GlColorMask(red GLboolean, green GLboolean, blue GLboolean, alpha GLboolean) { - cred, credAllocMap := (C.GLboolean)(red), cgoAllocsUnknown - cgreen, cgreenAllocMap := (C.GLboolean)(green), cgoAllocsUnknown - cblue, cblueAllocMap := (C.GLboolean)(blue), cgoAllocsUnknown - calpha, calphaAllocMap := (C.GLboolean)(alpha), cgoAllocsUnknown - C.glColorMask(cred, cgreen, cblue, calpha) - runtime.KeepAlive(calphaAllocMap) - runtime.KeepAlive(cblueAllocMap) - runtime.KeepAlive(cgreenAllocMap) - runtime.KeepAlive(credAllocMap) -} - -func GlCompileShader(shader GLuint) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - C.glCompileShader(cshader) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlCompressedTexImage2D(target GLenum, level GLint, internalformat GLenum, width GLsizei, height GLsizei, border GLint, imageSize GLsizei, data unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cborder, cborderAllocMap := (C.GLint)(border), cgoAllocsUnknown - cimageSize, cimageSizeAllocMap := (C.GLsizei)(imageSize), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.glCompressedTexImage2D(ctarget, clevel, cinternalformat, cwidth, cheight, cborder, cimageSize, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cimageSizeAllocMap) - runtime.KeepAlive(cborderAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCompressedTexSubImage2D(target GLenum, level GLint, xoffset GLint, yoffset GLint, width GLsizei, height GLsizei, format GLenum, imageSize GLsizei, data unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - cimageSize, cimageSizeAllocMap := (C.GLsizei)(imageSize), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.glCompressedTexSubImage2D(ctarget, clevel, cxoffset, cyoffset, cwidth, cheight, cformat, cimageSize, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cimageSizeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCopyTexImage2D(target GLenum, level GLint, internalformat GLenum, x GLint, y GLint, width GLsizei, height GLsizei, border GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cborder, cborderAllocMap := (C.GLint)(border), cgoAllocsUnknown - C.glCopyTexImage2D(ctarget, clevel, cinternalformat, cx, cy, cwidth, cheight, cborder) - runtime.KeepAlive(cborderAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCopyTexSubImage2D(target GLenum, level GLint, xoffset GLint, yoffset GLint, x GLint, y GLint, width GLsizei, height GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glCopyTexSubImage2D(ctarget, clevel, cxoffset, cyoffset, cx, cy, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCreateProgram() GLuint { - __ret := C.glCreateProgram() - __v := (GLuint)(__ret) - return __v -} - -func GlCreateShader(_type GLenum) GLuint { - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - __ret := C.glCreateShader(c_type) - runtime.KeepAlive(c_typeAllocMap) - __v := (GLuint)(__ret) - return __v -} - -func GlCullFace(mode GLenum) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - C.glCullFace(cmode) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlDeleteBuffers(n GLsizei, buffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cbuffers, cbuffersAllocMap := (*C.GLuint)(unsafe.Pointer(buffers)), cgoAllocsUnknown - C.glDeleteBuffers(cn, cbuffers) - runtime.KeepAlive(cbuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteFramebuffers(n GLsizei, framebuffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cframebuffers, cframebuffersAllocMap := (*C.GLuint)(unsafe.Pointer(framebuffers)), cgoAllocsUnknown - C.glDeleteFramebuffers(cn, cframebuffers) - runtime.KeepAlive(cframebuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteProgram(program GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - C.glDeleteProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlDeleteRenderbuffers(n GLsizei, renderbuffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - crenderbuffers, crenderbuffersAllocMap := (*C.GLuint)(unsafe.Pointer(renderbuffers)), cgoAllocsUnknown - C.glDeleteRenderbuffers(cn, crenderbuffers) - runtime.KeepAlive(crenderbuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteShader(shader GLuint) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - C.glDeleteShader(cshader) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlDeleteTextures(n GLsizei, textures *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - ctextures, ctexturesAllocMap := (*C.GLuint)(unsafe.Pointer(textures)), cgoAllocsUnknown - C.glDeleteTextures(cn, ctextures) - runtime.KeepAlive(ctexturesAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDepthFunc(_func GLenum) { - c_func, c_funcAllocMap := (C.GLenum)(_func), cgoAllocsUnknown - C.glDepthFunc(c_func) - runtime.KeepAlive(c_funcAllocMap) -} - -func GlDepthMask(flag GLboolean) { - cflag, cflagAllocMap := (C.GLboolean)(flag), cgoAllocsUnknown - C.glDepthMask(cflag) - runtime.KeepAlive(cflagAllocMap) -} - -func GlDepthRangef(n GLfloat, f GLfloat) { - cn, cnAllocMap := (C.GLfloat)(n), cgoAllocsUnknown - cf, cfAllocMap := (C.GLfloat)(f), cgoAllocsUnknown - C.glDepthRangef(cn, cf) - runtime.KeepAlive(cfAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDetachShader(program GLuint, shader GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - C.glDetachShader(cprogram, cshader) - runtime.KeepAlive(cshaderAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlDisable(cap GLenum) { - ccap, ccapAllocMap := (C.GLenum)(cap), cgoAllocsUnknown - C.glDisable(ccap) - runtime.KeepAlive(ccapAllocMap) -} - -func GlDisableVertexAttribArray(index GLuint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - C.glDisableVertexAttribArray(cindex) - runtime.KeepAlive(cindexAllocMap) -} - -func GlDrawArrays(mode GLenum, first GLint, count GLsizei) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - cfirst, cfirstAllocMap := (C.GLint)(first), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - C.glDrawArrays(cmode, cfirst, ccount) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cfirstAllocMap) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlDrawElements(mode GLenum, count GLsizei, _type GLenum, indices unsafe.Pointer) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cindices, cindicesAllocMap := indices, cgoAllocsUnknown - C.glDrawElements(cmode, ccount, c_type, cindices) - runtime.KeepAlive(cindicesAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlEnable(cap GLenum) { - ccap, ccapAllocMap := (C.GLenum)(cap), cgoAllocsUnknown - C.glEnable(ccap) - runtime.KeepAlive(ccapAllocMap) -} - -func GlEnableVertexAttribArray(index GLuint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - C.glEnableVertexAttribArray(cindex) - runtime.KeepAlive(cindexAllocMap) -} - -func GlFinish() { - C.glFinish() -} - -func GlFlush() { - C.glFlush() -} - -func GlFramebufferRenderbuffer(target GLenum, attachment GLenum, renderbuffertarget GLenum, renderbuffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cattachment, cattachmentAllocMap := (C.GLenum)(attachment), cgoAllocsUnknown - crenderbuffertarget, crenderbuffertargetAllocMap := (C.GLenum)(renderbuffertarget), cgoAllocsUnknown - crenderbuffer, crenderbufferAllocMap := (C.GLuint)(renderbuffer), cgoAllocsUnknown - C.glFramebufferRenderbuffer(ctarget, cattachment, crenderbuffertarget, crenderbuffer) - runtime.KeepAlive(crenderbufferAllocMap) - runtime.KeepAlive(crenderbuffertargetAllocMap) - runtime.KeepAlive(cattachmentAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlFramebufferTexture2D(target GLenum, attachment GLenum, textarget GLenum, texture GLuint, level GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cattachment, cattachmentAllocMap := (C.GLenum)(attachment), cgoAllocsUnknown - ctextarget, ctextargetAllocMap := (C.GLenum)(textarget), cgoAllocsUnknown - ctexture, ctextureAllocMap := (C.GLuint)(texture), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - C.glFramebufferTexture2D(ctarget, cattachment, ctextarget, ctexture, clevel) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctextureAllocMap) - runtime.KeepAlive(ctextargetAllocMap) - runtime.KeepAlive(cattachmentAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlFrontFace(mode GLenum) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - C.glFrontFace(cmode) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlGenBuffers(n GLsizei, buffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cbuffers, cbuffersAllocMap := (*C.GLuint)(unsafe.Pointer(buffers)), cgoAllocsUnknown - C.glGenBuffers(cn, cbuffers) - runtime.KeepAlive(cbuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenFramebuffers(n GLsizei, framebuffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cframebuffers, cframebuffersAllocMap := (*C.GLuint)(unsafe.Pointer(framebuffers)), cgoAllocsUnknown - C.glGenFramebuffers(cn, cframebuffers) - runtime.KeepAlive(cframebuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenRenderbuffers(n GLsizei, renderbuffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - crenderbuffers, crenderbuffersAllocMap := (*C.GLuint)(unsafe.Pointer(renderbuffers)), cgoAllocsUnknown - C.glGenRenderbuffers(cn, crenderbuffers) - runtime.KeepAlive(crenderbuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenTextures(n GLsizei, textures *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - ctextures, ctexturesAllocMap := (*C.GLuint)(unsafe.Pointer(textures)), cgoAllocsUnknown - C.glGenTextures(cn, ctextures) - runtime.KeepAlive(ctexturesAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenerateMipmap(target GLenum) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - C.glGenerateMipmap(ctarget) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetActiveAttrib(program GLuint, index GLuint, bufSize GLsizei, length *GLsizei, size *GLint, _type *GLenum, name *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - csize, csizeAllocMap := (*C.GLint)(unsafe.Pointer(size)), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.GLenum)(unsafe.Pointer(_type)), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - C.glGetActiveAttrib(cprogram, cindex, cbufSize, clength, csize, c_type, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetActiveUniform(program GLuint, index GLuint, bufSize GLsizei, length *GLsizei, size *GLint, _type *GLenum, name *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - csize, csizeAllocMap := (*C.GLint)(unsafe.Pointer(size)), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.GLenum)(unsafe.Pointer(_type)), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - C.glGetActiveUniform(cprogram, cindex, cbufSize, clength, csize, c_type, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetAttachedShaders(program GLuint, maxCount GLsizei, count *GLsizei, shaders *GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cmaxCount, cmaxCountAllocMap := (C.GLsizei)(maxCount), cgoAllocsUnknown - ccount, ccountAllocMap := (*C.GLsizei)(unsafe.Pointer(count)), cgoAllocsUnknown - cshaders, cshadersAllocMap := (*C.GLuint)(unsafe.Pointer(shaders)), cgoAllocsUnknown - C.glGetAttachedShaders(cprogram, cmaxCount, ccount, cshaders) - runtime.KeepAlive(cshadersAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cmaxCountAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetAttribLocation(program GLuint, name *GLchar) GLint { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - __ret := C.glGetAttribLocation(cprogram, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cprogramAllocMap) - __v := (GLint)(__ret) - return __v -} - -func GlGetBooleanv(pname GLenum, data *GLboolean) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLboolean)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetBooleanv(cpname, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlGetBufferParameteriv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetBufferParameteriv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetError() GLenum { - __ret := C.glGetError() - __v := (GLenum)(__ret) - return __v -} - -func GlGetFloatv(pname GLenum, data *GLfloat) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLfloat)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetFloatv(cpname, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlGetFramebufferAttachmentParameteriv(target GLenum, attachment GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cattachment, cattachmentAllocMap := (C.GLenum)(attachment), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetFramebufferAttachmentParameteriv(ctarget, cattachment, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cattachmentAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetIntegerv(pname GLenum, data *GLint) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLint)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetIntegerv(cpname, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlGetProgramInfoLog(program GLuint, bufSize GLsizei, length *GLsizei, infoLog *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - cinfoLog, cinfoLogAllocMap := (*C.GLchar)(unsafe.Pointer(infoLog)), cgoAllocsUnknown - C.glGetProgramInfoLog(cprogram, cbufSize, clength, cinfoLog) - runtime.KeepAlive(cinfoLogAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetProgramiv(program GLuint, pname GLenum, params *GLint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetProgramiv(cprogram, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetRenderbufferParameteriv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetRenderbufferParameteriv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetShaderInfoLog(shader GLuint, bufSize GLsizei, length *GLsizei, infoLog *GLchar) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - cinfoLog, cinfoLogAllocMap := (*C.GLchar)(unsafe.Pointer(infoLog)), cgoAllocsUnknown - C.glGetShaderInfoLog(cshader, cbufSize, clength, cinfoLog) - runtime.KeepAlive(cinfoLogAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlGetShaderPrecisionFormat(shadertype GLenum, precisiontype GLenum, _range *GLint, precision *GLint) { - cshadertype, cshadertypeAllocMap := (C.GLenum)(shadertype), cgoAllocsUnknown - cprecisiontype, cprecisiontypeAllocMap := (C.GLenum)(precisiontype), cgoAllocsUnknown - c_range, c_rangeAllocMap := (*C.GLint)(unsafe.Pointer(_range)), cgoAllocsUnknown - cprecision, cprecisionAllocMap := (*C.GLint)(unsafe.Pointer(precision)), cgoAllocsUnknown - C.glGetShaderPrecisionFormat(cshadertype, cprecisiontype, c_range, cprecision) - runtime.KeepAlive(cprecisionAllocMap) - runtime.KeepAlive(c_rangeAllocMap) - runtime.KeepAlive(cprecisiontypeAllocMap) - runtime.KeepAlive(cshadertypeAllocMap) -} - -func GlGetShaderSource(shader GLuint, bufSize GLsizei, length *GLsizei, source *GLchar) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - csource, csourceAllocMap := (*C.GLchar)(unsafe.Pointer(source)), cgoAllocsUnknown - C.glGetShaderSource(cshader, cbufSize, clength, csource) - runtime.KeepAlive(csourceAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlGetShaderiv(shader GLuint, pname GLenum, params *GLint) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetShaderiv(cshader, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlGetString(name GLenum) *GLubyte { - cname, cnameAllocMap := (C.GLenum)(name), cgoAllocsUnknown - __ret := C.glGetString(cname) - runtime.KeepAlive(cnameAllocMap) - __v := (*GLubyte)(unsafe.Pointer(__ret)) - return __v -} - -func GlGetTexParameterfv(target GLenum, pname GLenum, params *GLfloat) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetTexParameterfv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetTexParameteriv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetTexParameteriv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetUniformLocation(program GLuint, name *GLchar) GLint { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - __ret := C.glGetUniformLocation(cprogram, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cprogramAllocMap) - __v := (GLint)(__ret) - return __v -} - -func GlGetUniformfv(program GLuint, location GLint, params *GLfloat) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetUniformfv(cprogram, clocation, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(clocationAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetUniformiv(program GLuint, location GLint, params *GLint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetUniformiv(cprogram, clocation, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(clocationAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetVertexAttribPointerv(index GLuint, pname GLenum, pointer *unsafe.Pointer) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cpointer, cpointerAllocMap := pointer, cgoAllocsUnknown - C.glGetVertexAttribPointerv(cindex, cpname, cpointer) - runtime.KeepAlive(cpointerAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlGetVertexAttribfv(index GLuint, pname GLenum, params *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetVertexAttribfv(cindex, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlGetVertexAttribiv(index GLuint, pname GLenum, params *GLint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetVertexAttribiv(cindex, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlHint(target GLenum, mode GLenum) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - C.glHint(ctarget, cmode) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlIsBuffer(buffer GLuint) GLboolean { - cbuffer, cbufferAllocMap := (C.GLuint)(buffer), cgoAllocsUnknown - __ret := C.glIsBuffer(cbuffer) - runtime.KeepAlive(cbufferAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsEnabled(cap GLenum) GLboolean { - ccap, ccapAllocMap := (C.GLenum)(cap), cgoAllocsUnknown - __ret := C.glIsEnabled(ccap) - runtime.KeepAlive(ccapAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsFramebuffer(framebuffer GLuint) GLboolean { - cframebuffer, cframebufferAllocMap := (C.GLuint)(framebuffer), cgoAllocsUnknown - __ret := C.glIsFramebuffer(cframebuffer) - runtime.KeepAlive(cframebufferAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsProgram(program GLuint) GLboolean { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - __ret := C.glIsProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsRenderbuffer(renderbuffer GLuint) GLboolean { - crenderbuffer, crenderbufferAllocMap := (C.GLuint)(renderbuffer), cgoAllocsUnknown - __ret := C.glIsRenderbuffer(crenderbuffer) - runtime.KeepAlive(crenderbufferAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsShader(shader GLuint) GLboolean { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - __ret := C.glIsShader(cshader) - runtime.KeepAlive(cshaderAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsTexture(texture GLuint) GLboolean { - ctexture, ctextureAllocMap := (C.GLuint)(texture), cgoAllocsUnknown - __ret := C.glIsTexture(ctexture) - runtime.KeepAlive(ctextureAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlLineWidth(width GLfloat) { - cwidth, cwidthAllocMap := (C.GLfloat)(width), cgoAllocsUnknown - C.glLineWidth(cwidth) - runtime.KeepAlive(cwidthAllocMap) -} - -func GlLinkProgram(program GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - C.glLinkProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlPixelStorei(pname GLenum, param GLint) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (C.GLint)(param), cgoAllocsUnknown - C.glPixelStorei(cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlPolygonOffset(factor GLfloat, units GLfloat) { - cfactor, cfactorAllocMap := (C.GLfloat)(factor), cgoAllocsUnknown - cunits, cunitsAllocMap := (C.GLfloat)(units), cgoAllocsUnknown - C.glPolygonOffset(cfactor, cunits) - runtime.KeepAlive(cunitsAllocMap) - runtime.KeepAlive(cfactorAllocMap) -} - -func GlReadPixels(x GLint, y GLint, width GLsizei, height GLsizei, format GLenum, _type GLenum, pixels unsafe.Pointer) { - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - C.glReadPixels(cx, cy, cwidth, cheight, cformat, c_type, cpixels) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) -} - -func GlReleaseShaderCompiler() { - C.glReleaseShaderCompiler() -} - -func GlRenderbufferStorage(target GLenum, internalformat GLenum, width GLsizei, height GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glRenderbufferStorage(ctarget, cinternalformat, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlSampleCoverage(value GLfloat, invert GLboolean) { - cvalue, cvalueAllocMap := (C.GLfloat)(value), cgoAllocsUnknown - cinvert, cinvertAllocMap := (C.GLboolean)(invert), cgoAllocsUnknown - C.glSampleCoverage(cvalue, cinvert) - runtime.KeepAlive(cinvertAllocMap) - runtime.KeepAlive(cvalueAllocMap) -} - -func GlScissor(x GLint, y GLint, width GLsizei, height GLsizei) { - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glScissor(cx, cy, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) -} - -func GlShaderBinary(count GLsizei, shaders *GLuint, binaryformat GLenum, binary unsafe.Pointer, length GLsizei) { - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cshaders, cshadersAllocMap := (*C.GLuint)(unsafe.Pointer(shaders)), cgoAllocsUnknown - cbinaryformat, cbinaryformatAllocMap := (C.GLenum)(binaryformat), cgoAllocsUnknown - cbinary, cbinaryAllocMap := binary, cgoAllocsUnknown - clength, clengthAllocMap := (C.GLsizei)(length), cgoAllocsUnknown - C.glShaderBinary(ccount, cshaders, cbinaryformat, cbinary, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbinaryAllocMap) - runtime.KeepAlive(cbinaryformatAllocMap) - runtime.KeepAlive(cshadersAllocMap) - runtime.KeepAlive(ccountAllocMap) -} - -func GlShaderSource(shader GLuint, count GLsizei, _string **GLchar, length *GLint) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - c_string, c_stringAllocMap := (**C.GLchar)(unsafe.Pointer(_string)), cgoAllocsUnknown - var pinnerc_string runtime.Pinner - pinnerc_string.Pin(_string) - if _string != nil { - pinnerc_string.Pin(unsafe.Pointer(*_string)) - } - defer pinnerc_string.Unpin() - clength, clengthAllocMap := (*C.GLint)(unsafe.Pointer(length)), cgoAllocsUnknown - C.glShaderSource(cshader, ccount, c_string, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(c_stringAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlStencilFunc(_func GLenum, ref GLint, mask GLuint) { - c_func, c_funcAllocMap := (C.GLenum)(_func), cgoAllocsUnknown - cref, crefAllocMap := (C.GLint)(ref), cgoAllocsUnknown - cmask, cmaskAllocMap := (C.GLuint)(mask), cgoAllocsUnknown - C.glStencilFunc(c_func, cref, cmask) - runtime.KeepAlive(cmaskAllocMap) - runtime.KeepAlive(crefAllocMap) - runtime.KeepAlive(c_funcAllocMap) -} - -func GlStencilFuncSeparate(face GLenum, _func GLenum, ref GLint, mask GLuint) { - cface, cfaceAllocMap := (C.GLenum)(face), cgoAllocsUnknown - c_func, c_funcAllocMap := (C.GLenum)(_func), cgoAllocsUnknown - cref, crefAllocMap := (C.GLint)(ref), cgoAllocsUnknown - cmask, cmaskAllocMap := (C.GLuint)(mask), cgoAllocsUnknown - C.glStencilFuncSeparate(cface, c_func, cref, cmask) - runtime.KeepAlive(cmaskAllocMap) - runtime.KeepAlive(crefAllocMap) - runtime.KeepAlive(c_funcAllocMap) - runtime.KeepAlive(cfaceAllocMap) -} - -func GlStencilMask(mask GLuint) { - cmask, cmaskAllocMap := (C.GLuint)(mask), cgoAllocsUnknown - C.glStencilMask(cmask) - runtime.KeepAlive(cmaskAllocMap) -} - -func GlStencilMaskSeparate(face GLenum, mask GLuint) { - cface, cfaceAllocMap := (C.GLenum)(face), cgoAllocsUnknown - cmask, cmaskAllocMap := (C.GLuint)(mask), cgoAllocsUnknown - C.glStencilMaskSeparate(cface, cmask) - runtime.KeepAlive(cmaskAllocMap) - runtime.KeepAlive(cfaceAllocMap) -} - -func GlStencilOp(fail GLenum, zfail GLenum, zpass GLenum) { - cfail, cfailAllocMap := (C.GLenum)(fail), cgoAllocsUnknown - czfail, czfailAllocMap := (C.GLenum)(zfail), cgoAllocsUnknown - czpass, czpassAllocMap := (C.GLenum)(zpass), cgoAllocsUnknown - C.glStencilOp(cfail, czfail, czpass) - runtime.KeepAlive(czpassAllocMap) - runtime.KeepAlive(czfailAllocMap) - runtime.KeepAlive(cfailAllocMap) -} - -func GlStencilOpSeparate(face GLenum, sfail GLenum, dpfail GLenum, dppass GLenum) { - cface, cfaceAllocMap := (C.GLenum)(face), cgoAllocsUnknown - csfail, csfailAllocMap := (C.GLenum)(sfail), cgoAllocsUnknown - cdpfail, cdpfailAllocMap := (C.GLenum)(dpfail), cgoAllocsUnknown - cdppass, cdppassAllocMap := (C.GLenum)(dppass), cgoAllocsUnknown - C.glStencilOpSeparate(cface, csfail, cdpfail, cdppass) - runtime.KeepAlive(cdppassAllocMap) - runtime.KeepAlive(cdpfailAllocMap) - runtime.KeepAlive(csfailAllocMap) - runtime.KeepAlive(cfaceAllocMap) -} - -func GlTexImage2D(target GLenum, level GLint, internalformat GLint, width GLsizei, height GLsizei, border GLint, format GLenum, _type GLenum, pixels unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLint)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cborder, cborderAllocMap := (C.GLint)(border), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - C.glTexImage2D(ctarget, clevel, cinternalformat, cwidth, cheight, cborder, cformat, c_type, cpixels) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cborderAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexParameterf(target GLenum, pname GLenum, param GLfloat) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (C.GLfloat)(param), cgoAllocsUnknown - C.glTexParameterf(ctarget, cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexParameterfv(target GLenum, pname GLenum, params *GLfloat) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glTexParameterfv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexParameteri(target GLenum, pname GLenum, param GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (C.GLint)(param), cgoAllocsUnknown - C.glTexParameteri(ctarget, cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexParameteriv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glTexParameteriv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexSubImage2D(target GLenum, level GLint, xoffset GLint, yoffset GLint, width GLsizei, height GLsizei, format GLenum, _type GLenum, pixels unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - C.glTexSubImage2D(ctarget, clevel, cxoffset, cyoffset, cwidth, cheight, cformat, c_type, cpixels) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlUniform1f(location GLint, v0 GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLfloat)(v0), cgoAllocsUnknown - C.glUniform1f(clocation, cv0) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform1fv(location GLint, count GLsizei, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform1fv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform1i(location GLint, v0 GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLint)(v0), cgoAllocsUnknown - C.glUniform1i(clocation, cv0) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform1iv(location GLint, count GLsizei, value *GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform1iv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2f(location GLint, v0 GLfloat, v1 GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLfloat)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLfloat)(v1), cgoAllocsUnknown - C.glUniform2f(clocation, cv0, cv1) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2fv(location GLint, count GLsizei, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform2fv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2i(location GLint, v0 GLint, v1 GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLint)(v1), cgoAllocsUnknown - C.glUniform2i(clocation, cv0, cv1) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2iv(location GLint, count GLsizei, value *GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform2iv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3f(location GLint, v0 GLfloat, v1 GLfloat, v2 GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLfloat)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLfloat)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLfloat)(v2), cgoAllocsUnknown - C.glUniform3f(clocation, cv0, cv1, cv2) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3fv(location GLint, count GLsizei, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform3fv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3i(location GLint, v0 GLint, v1 GLint, v2 GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLint)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLint)(v2), cgoAllocsUnknown - C.glUniform3i(clocation, cv0, cv1, cv2) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3iv(location GLint, count GLsizei, value *GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform3iv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4f(location GLint, v0 GLfloat, v1 GLfloat, v2 GLfloat, v3 GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLfloat)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLfloat)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLfloat)(v2), cgoAllocsUnknown - cv3, cv3AllocMap := (C.GLfloat)(v3), cgoAllocsUnknown - C.glUniform4f(clocation, cv0, cv1, cv2, cv3) - runtime.KeepAlive(cv3AllocMap) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4fv(location GLint, count GLsizei, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform4fv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4i(location GLint, v0 GLint, v1 GLint, v2 GLint, v3 GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLint)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLint)(v2), cgoAllocsUnknown - cv3, cv3AllocMap := (C.GLint)(v3), cgoAllocsUnknown - C.glUniform4i(clocation, cv0, cv1, cv2, cv3) - runtime.KeepAlive(cv3AllocMap) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4iv(location GLint, count GLsizei, value *GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform4iv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix2fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix2fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix3fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix3fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix4fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix4fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUseProgram(program GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - C.glUseProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlValidateProgram(program GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - C.glValidateProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlVertexAttrib1f(index GLuint, x GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLfloat)(x), cgoAllocsUnknown - C.glVertexAttrib1f(cindex, cx) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib1fv(index GLuint, v *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLfloat)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttrib1fv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib2f(index GLuint, x GLfloat, y GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLfloat)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLfloat)(y), cgoAllocsUnknown - C.glVertexAttrib2f(cindex, cx, cy) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib2fv(index GLuint, v *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLfloat)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttrib2fv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib3f(index GLuint, x GLfloat, y GLfloat, z GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLfloat)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLfloat)(y), cgoAllocsUnknown - cz, czAllocMap := (C.GLfloat)(z), cgoAllocsUnknown - C.glVertexAttrib3f(cindex, cx, cy, cz) - runtime.KeepAlive(czAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib3fv(index GLuint, v *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLfloat)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttrib3fv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib4f(index GLuint, x GLfloat, y GLfloat, z GLfloat, w GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLfloat)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLfloat)(y), cgoAllocsUnknown - cz, czAllocMap := (C.GLfloat)(z), cgoAllocsUnknown - cw, cwAllocMap := (C.GLfloat)(w), cgoAllocsUnknown - C.glVertexAttrib4f(cindex, cx, cy, cz, cw) - runtime.KeepAlive(cwAllocMap) - runtime.KeepAlive(czAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib4fv(index GLuint, v *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLfloat)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttrib4fv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttribPointer(index GLuint, size GLint, _type GLenum, normalized GLboolean, stride GLsizei, pointer unsafe.Pointer) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLint)(size), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cnormalized, cnormalizedAllocMap := (C.GLboolean)(normalized), cgoAllocsUnknown - cstride, cstrideAllocMap := (C.GLsizei)(stride), cgoAllocsUnknown - cpointer, cpointerAllocMap := pointer, cgoAllocsUnknown - C.glVertexAttribPointer(cindex, csize, c_type, cnormalized, cstride, cpointer) - runtime.KeepAlive(cpointerAllocMap) - runtime.KeepAlive(cstrideAllocMap) - runtime.KeepAlive(cnormalizedAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlViewport(x GLint, y GLint, width GLsizei, height GLsizei) { - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glViewport(cx, cy, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) -} diff --git a/capi/gles2/types.go b/capi/gles2/types.go deleted file mode 100644 index b161c74..0000000 --- a/capi/gles2/types.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package gles2 - -/* -#cgo LDFLAGS: -lGLESv2 -#include "GLES2/gl2.h" -#include "GLES2/gl2ext.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type GLbitfield uint32 - -type GLboolean uint8 - -type GLbyte C.GLbyte - -type GLchar int8 - -type GLclampf C.GLclampf - -type GLdouble float64 - -type GLeglClientBufferEXT unsafe.Pointer - -type GLeglImageOES unsafe.Pointer - -type GLenum uint32 - -type GLfixed C.GLfixed - -type GLfloat C.GLfloat - -type GLint int32 - -type GLint64 C.GLint64 - -type GLintptr C.GLintptr - -type GLshort int16 - -type GLsizei int32 - -type GLsizeiptr C.GLsizeiptr - -type GLsync C.GLsync - -type GLubyte C.GLubyte - -type GLuint uint32 - -type GLuint64 C.GLuint64 - -type GLushort uint16 - -type PFNGLACTIVETEXTUREPROC func() - -type PFNGLATTACHSHADERPROC func() - -type PFNGLBINDATTRIBLOCATIONPROC func() - -type PFNGLBINDBUFFERPROC func() - -type PFNGLBINDFRAMEBUFFERPROC func() - -type PFNGLBINDRENDERBUFFERPROC func() - -type PFNGLBINDTEXTUREPROC func() - -type PFNGLBLENDCOLORPROC func() - -type PFNGLBLENDEQUATIONPROC func() - -type PFNGLBLENDEQUATIONSEPARATEPROC func() - -type PFNGLBLENDFUNCPROC func() - -type PFNGLBLENDFUNCSEPARATEPROC func() - -type PFNGLBUFFERDATAPROC func() - -type PFNGLBUFFERSUBDATAPROC func() - -type PFNGLCHECKFRAMEBUFFERSTATUSPROC func() - -type PFNGLCLEARCOLORPROC func() - -type PFNGLCLEARDEPTHFPROC func() - -type PFNGLCLEARPROC func() - -type PFNGLCLEARSTENCILPROC func() - -type PFNGLCOLORMASKPROC func() - -type PFNGLCOMPILESHADERPROC func() - -type PFNGLCOMPRESSEDTEXIMAGE2DPROC func() - -type PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC func() - -type PFNGLCOPYTEXIMAGE2DPROC func() - -type PFNGLCOPYTEXSUBIMAGE2DPROC func() - -type PFNGLCREATEPROGRAMPROC func() - -type PFNGLCREATESHADERPROC func() - -type PFNGLCULLFACEPROC func() - -type PFNGLDELETEBUFFERSPROC func() - -type PFNGLDELETEFRAMEBUFFERSPROC func() - -type PFNGLDELETEPROGRAMPROC func() - -type PFNGLDELETERENDERBUFFERSPROC func() - -type PFNGLDELETESHADERPROC func() - -type PFNGLDELETETEXTURESPROC func() - -type PFNGLDEPTHFUNCPROC func() - -type PFNGLDEPTHMASKPROC func() - -type PFNGLDEPTHRANGEFPROC func() - -type PFNGLDETACHSHADERPROC func() - -type PFNGLDISABLEPROC func() - -type PFNGLDISABLEVERTEXATTRIBARRAYPROC func() - -type PFNGLDRAWARRAYSPROC func() - -type PFNGLDRAWELEMENTSPROC func() - -type PFNGLENABLEPROC func() - -type PFNGLENABLEVERTEXATTRIBARRAYPROC func() - -type PFNGLFINISHPROC func() - -type PFNGLFLUSHPROC func() - -type PFNGLFRAMEBUFFERRENDERBUFFERPROC func() - -type PFNGLFRAMEBUFFERTEXTURE2DPROC func() - -type PFNGLFRONTFACEPROC func() - -type PFNGLGENBUFFERSPROC func() - -type PFNGLGENERATEMIPMAPPROC func() - -type PFNGLGENFRAMEBUFFERSPROC func() - -type PFNGLGENRENDERBUFFERSPROC func() - -type PFNGLGENTEXTURESPROC func() - -type PFNGLGETACTIVEATTRIBPROC func() - -type PFNGLGETACTIVEUNIFORMPROC func() - -type PFNGLGETATTACHEDSHADERSPROC func() - -type PFNGLGETATTRIBLOCATIONPROC func() - -type PFNGLGETBOOLEANVPROC func() - -type PFNGLGETBUFFERPARAMETERIVPROC func() - -type PFNGLGETERRORPROC func() - -type PFNGLGETFLOATVPROC func() - -type PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC func() - -type PFNGLGETINTEGERVPROC func() - -type PFNGLGETPROGRAMINFOLOGPROC func() - -type PFNGLGETPROGRAMIVPROC func() - -type PFNGLGETRENDERBUFFERPARAMETERIVPROC func() - -type PFNGLGETSHADERINFOLOGPROC func() - -type PFNGLGETSHADERIVPROC func() - -type PFNGLGETSHADERPRECISIONFORMATPROC func() - -type PFNGLGETSHADERSOURCEPROC func() - -type PFNGLGETSTRINGPROC func() - -type PFNGLGETTEXPARAMETERFVPROC func() - -type PFNGLGETTEXPARAMETERIVPROC func() - -type PFNGLGETUNIFORMFVPROC func() - -type PFNGLGETUNIFORMIVPROC func() - -type PFNGLGETUNIFORMLOCATIONPROC func() - -type PFNGLGETVERTEXATTRIBFVPROC func() - -type PFNGLGETVERTEXATTRIBIVPROC func() - -type PFNGLGETVERTEXATTRIBPOINTERVPROC func() - -type PFNGLHINTPROC func() - -type PFNGLISBUFFERPROC func() - -type PFNGLISENABLEDPROC func() - -type PFNGLISFRAMEBUFFERPROC func() - -type PFNGLISPROGRAMPROC func() - -type PFNGLISRENDERBUFFERPROC func() - -type PFNGLISSHADERPROC func() - -type PFNGLISTEXTUREPROC func() - -type PFNGLLINEWIDTHPROC func() - -type PFNGLLINKPROGRAMPROC func() - -type PFNGLPIXELSTOREIPROC func() - -type PFNGLPOLYGONOFFSETPROC func() - -type PFNGLREADPIXELSPROC func() - -type PFNGLRELEASESHADERCOMPILERPROC func() - -type PFNGLRENDERBUFFERSTORAGEPROC func() - -type PFNGLSAMPLECOVERAGEPROC func() - -type PFNGLSCISSORPROC func() - -type PFNGLSHADERBINARYPROC func() - -type PFNGLSHADERSOURCEPROC func() - -type PFNGLSTENCILFUNCPROC func() - -type PFNGLSTENCILFUNCSEPARATEPROC func() - -type PFNGLSTENCILMASKPROC func() - -type PFNGLSTENCILMASKSEPARATEPROC func() - -type PFNGLSTENCILOPPROC func() - -type PFNGLSTENCILOPSEPARATEPROC func() - -type PFNGLTEXIMAGE2DPROC func() - -type PFNGLTEXPARAMETERFPROC func() - -type PFNGLTEXPARAMETERFVPROC func() - -type PFNGLTEXPARAMETERIPROC func() - -type PFNGLTEXPARAMETERIVPROC func() - -type PFNGLTEXSUBIMAGE2DPROC func() - -type PFNGLUNIFORM1FPROC func() - -type PFNGLUNIFORM1FVPROC func() - -type PFNGLUNIFORM1IPROC func() - -type PFNGLUNIFORM1IVPROC func() - -type PFNGLUNIFORM2FPROC func() - -type PFNGLUNIFORM2FVPROC func() - -type PFNGLUNIFORM2IPROC func() - -type PFNGLUNIFORM2IVPROC func() - -type PFNGLUNIFORM3FPROC func() - -type PFNGLUNIFORM3FVPROC func() - -type PFNGLUNIFORM3IPROC func() - -type PFNGLUNIFORM3IVPROC func() - -type PFNGLUNIFORM4FPROC func() - -type PFNGLUNIFORM4FVPROC func() - -type PFNGLUNIFORM4IPROC func() - -type PFNGLUNIFORM4IVPROC func() - -type PFNGLUNIFORMMATRIX2FVPROC func() - -type PFNGLUNIFORMMATRIX3FVPROC func() - -type PFNGLUNIFORMMATRIX4FVPROC func() - -type PFNGLUSEPROGRAMPROC func() - -type PFNGLVALIDATEPROGRAMPROC func() - -type PFNGLVERTEXATTRIB1FPROC func() - -type PFNGLVERTEXATTRIB1FVPROC func() - -type PFNGLVERTEXATTRIB2FPROC func() - -type PFNGLVERTEXATTRIB2FVPROC func() - -type PFNGLVERTEXATTRIB3FPROC func() - -type PFNGLVERTEXATTRIB3FVPROC func() - -type PFNGLVERTEXATTRIB4FPROC func() - -type PFNGLVERTEXATTRIB4FVPROC func() - -type PFNGLVERTEXATTRIBPOINTERPROC func() - -type PFNGLVIEWPORTPROC func() diff --git a/capi/gles3/cgo_helpers.c b/capi/gles3/cgo_helpers.c deleted file mode 100644 index 26269c9..0000000 --- a/capi/gles3/cgo_helpers.c +++ /dev/null @@ -1,988 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void PFNGLACTIVETEXTUREPROC_6c604afe() { - PFNGLACTIVETEXTUREPROC6C604AFE(); -} - -void PFNGLATTACHSHADERPROC_6a111311() { - PFNGLATTACHSHADERPROC6A111311(); -} - -void PFNGLBEGINQUERYPROC_b91e6474() { - PFNGLBEGINQUERYPROCB91E6474(); -} - -void PFNGLBEGINTRANSFORMFEEDBACKPROC_32028bbd() { - PFNGLBEGINTRANSFORMFEEDBACKPROC32028BBD(); -} - -void PFNGLBINDATTRIBLOCATIONPROC_e517bc2a() { - PFNGLBINDATTRIBLOCATIONPROCE517BC2A(); -} - -void PFNGLBINDBUFFERBASEPROC_8814d1eb() { - PFNGLBINDBUFFERBASEPROC8814D1EB(); -} - -void PFNGLBINDBUFFERPROC_58e32b5e() { - PFNGLBINDBUFFERPROC58E32B5E(); -} - -void PFNGLBINDBUFFERRANGEPROC_af325a80() { - PFNGLBINDBUFFERRANGEPROCAF325A80(); -} - -void PFNGLBINDFRAMEBUFFERPROC_0666f584() { - PFNGLBINDFRAMEBUFFERPROC0666F584(); -} - -void PFNGLBINDRENDERBUFFERPROC_189e9b1a() { - PFNGLBINDRENDERBUFFERPROC189E9B1A(); -} - -void PFNGLBINDSAMPLERPROC_f58b5f0f() { - PFNGLBINDSAMPLERPROCF58B5F0F(); -} - -void PFNGLBINDTEXTUREPROC_5bc8f391() { - PFNGLBINDTEXTUREPROC5BC8F391(); -} - -void PFNGLBINDTRANSFORMFEEDBACKPROC_274eb341() { - PFNGLBINDTRANSFORMFEEDBACKPROC274EB341(); -} - -void PFNGLBINDVERTEXARRAYPROC_5799c92d() { - PFNGLBINDVERTEXARRAYPROC5799C92D(); -} - -void PFNGLBLENDCOLORPROC_8b6d9550() { - PFNGLBLENDCOLORPROC8B6D9550(); -} - -void PFNGLBLENDEQUATIONPROC_b2d89c63() { - PFNGLBLENDEQUATIONPROCB2D89C63(); -} - -void PFNGLBLENDEQUATIONSEPARATEPROC_3f74a9e6() { - PFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6(); -} - -void PFNGLBLENDFUNCPROC_6b072d27() { - PFNGLBLENDFUNCPROC6B072D27(); -} - -void PFNGLBLENDFUNCSEPARATEPROC_cb3fa4b0() { - PFNGLBLENDFUNCSEPARATEPROCCB3FA4B0(); -} - -void PFNGLBLITFRAMEBUFFERPROC_fedd3a33() { - PFNGLBLITFRAMEBUFFERPROCFEDD3A33(); -} - -void PFNGLBUFFERDATAPROC_83900d72() { - PFNGLBUFFERDATAPROC83900D72(); -} - -void PFNGLBUFFERSUBDATAPROC_cd04a508() { - PFNGLBUFFERSUBDATAPROCCD04A508(); -} - -void PFNGLCHECKFRAMEBUFFERSTATUSPROC_97292a5a() { - PFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5A(); -} - -void PFNGLCLEARBUFFERFIPROC_200129a8() { - PFNGLCLEARBUFFERFIPROC200129A8(); -} - -void PFNGLCLEARBUFFERFVPROC_cf4c8e8f() { - PFNGLCLEARBUFFERFVPROCCF4C8E8F(); -} - -void PFNGLCLEARBUFFERIVPROC_5cccb667() { - PFNGLCLEARBUFFERIVPROC5CCCB667(); -} - -void PFNGLCLEARBUFFERUIVPROC_21b2b9c0() { - PFNGLCLEARBUFFERUIVPROC21B2B9C0(); -} - -void PFNGLCLEARCOLORPROC_4b2c18b9() { - PFNGLCLEARCOLORPROC4B2C18B9(); -} - -void PFNGLCLEARDEPTHFPROC_473d2fca() { - PFNGLCLEARDEPTHFPROC473D2FCA(); -} - -void PFNGLCLEARPROC_81796bd7() { - PFNGLCLEARPROC81796BD7(); -} - -void PFNGLCLEARSTENCILPROC_860e5897() { - PFNGLCLEARSTENCILPROC860E5897(); -} - -void PFNGLCLIENTWAITSYNCPROC_334598fd() { - PFNGLCLIENTWAITSYNCPROC334598FD(); -} - -void PFNGLCOLORMASKPROC_4ae7db24() { - PFNGLCOLORMASKPROC4AE7DB24(); -} - -void PFNGLCOMPILESHADERPROC_f3cc75e5() { - PFNGLCOMPILESHADERPROCF3CC75E5(); -} - -void PFNGLCOMPRESSEDTEXIMAGE2DPROC_11b9df71() { - PFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71(); -} - -void PFNGLCOMPRESSEDTEXIMAGE3DPROC_77f8d9bd() { - PFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BD(); -} - -void PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_0f7a8b98() { - PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98(); -} - -void PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC_beb8cf69() { - PFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69(); -} - -void PFNGLCOPYBUFFERSUBDATAPROC_4f2ebb80() { - PFNGLCOPYBUFFERSUBDATAPROC4F2EBB80(); -} - -void PFNGLCOPYTEXIMAGE2DPROC_d952ff06() { - PFNGLCOPYTEXIMAGE2DPROCD952FF06(); -} - -void PFNGLCOPYTEXSUBIMAGE2DPROC_99d0f6f9() { - PFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9(); -} - -void PFNGLCOPYTEXSUBIMAGE3DPROC_cbbaa8a1() { - PFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1(); -} - -void PFNGLCREATEPROGRAMPROC_fba42bd7() { - PFNGLCREATEPROGRAMPROCFBA42BD7(); -} - -void PFNGLCREATESHADERPROC_5f191f08() { - PFNGLCREATESHADERPROC5F191F08(); -} - -void PFNGLCULLFACEPROC_89da9a67() { - PFNGLCULLFACEPROC89DA9A67(); -} - -void PFNGLDELETEBUFFERSPROC_cb1c16cd() { - PFNGLDELETEBUFFERSPROCCB1C16CD(); -} - -void PFNGLDELETEFRAMEBUFFERSPROC_28ed84d7() { - PFNGLDELETEFRAMEBUFFERSPROC28ED84D7(); -} - -void PFNGLDELETEPROGRAMPROC_f9af89b0() { - PFNGLDELETEPROGRAMPROCF9AF89B0(); -} - -void PFNGLDELETEQUERIESPROC_ba0b7b84() { - PFNGLDELETEQUERIESPROCBA0B7B84(); -} - -void PFNGLDELETERENDERBUFFERSPROC_8e10b4c0() { - PFNGLDELETERENDERBUFFERSPROC8E10B4C0(); -} - -void PFNGLDELETESAMPLERSPROC_70f19e4a() { - PFNGLDELETESAMPLERSPROC70F19E4A(); -} - -void PFNGLDELETESHADERPROC_37948131() { - PFNGLDELETESHADERPROC37948131(); -} - -void PFNGLDELETESYNCPROC_5184c34e() { - PFNGLDELETESYNCPROC5184C34E(); -} - -void PFNGLDELETETEXTURESPROC_6b199e47() { - PFNGLDELETETEXTURESPROC6B199E47(); -} - -void PFNGLDELETETRANSFORMFEEDBACKSPROC_c63fe37d() { - PFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37D(); -} - -void PFNGLDELETEVERTEXARRAYSPROC_95b8b72a() { - PFNGLDELETEVERTEXARRAYSPROC95B8B72A(); -} - -void PFNGLDEPTHFUNCPROC_465da9ed() { - PFNGLDEPTHFUNCPROC465DA9ED(); -} - -void PFNGLDEPTHMASKPROC_31a797a3() { - PFNGLDEPTHMASKPROC31A797A3(); -} - -void PFNGLDEPTHRANGEFPROC_899f0d08() { - PFNGLDEPTHRANGEFPROC899F0D08(); -} - -void PFNGLDETACHSHADERPROC_cf86dfea() { - PFNGLDETACHSHADERPROCCF86DFEA(); -} - -void PFNGLDISABLEPROC_2349a992() { - PFNGLDISABLEPROC2349A992(); -} - -void PFNGLDISABLEVERTEXATTRIBARRAYPROC_7a86dd23() { - PFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23(); -} - -void PFNGLDRAWARRAYSINSTANCEDPROC_0f4fbca3() { - PFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3(); -} - -void PFNGLDRAWARRAYSPROC_d5c7ac18() { - PFNGLDRAWARRAYSPROCD5C7AC18(); -} - -void PFNGLDRAWBUFFERSPROC_dbcc9007() { - PFNGLDRAWBUFFERSPROCDBCC9007(); -} - -void PFNGLDRAWELEMENTSINSTANCEDPROC_7b7ceb7e() { - PFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7E(); -} - -void PFNGLDRAWELEMENTSPROC_13247097() { - PFNGLDRAWELEMENTSPROC13247097(); -} - -void PFNGLDRAWRANGEELEMENTSPROC_b12188b5() { - PFNGLDRAWRANGEELEMENTSPROCB12188B5(); -} - -void PFNGLENABLEPROC_c545119a() { - PFNGLENABLEPROCC545119A(); -} - -void PFNGLENABLEVERTEXATTRIBARRAYPROC_af1424a2() { - PFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2(); -} - -void PFNGLENDQUERYPROC_198bf2b2() { - PFNGLENDQUERYPROC198BF2B2(); -} - -void PFNGLENDTRANSFORMFEEDBACKPROC_38335e93() { - PFNGLENDTRANSFORMFEEDBACKPROC38335E93(); -} - -void PFNGLFENCESYNCPROC_497552b6() { - PFNGLFENCESYNCPROC497552B6(); -} - -void PFNGLFINISHPROC_0be044d4() { - PFNGLFINISHPROC0BE044D4(); -} - -void PFNGLFLUSHMAPPEDBUFFERRANGEPROC_0023bfde() { - PFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDE(); -} - -void PFNGLFLUSHPROC_fe2e0200() { - PFNGLFLUSHPROCFE2E0200(); -} - -void PFNGLFRAMEBUFFERRENDERBUFFERPROC_931cd714() { - PFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714(); -} - -void PFNGLFRAMEBUFFERTEXTURE2DPROC_f9765a33() { - PFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33(); -} - -void PFNGLFRAMEBUFFERTEXTURELAYERPROC_fe303df6() { - PFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6(); -} - -void PFNGLFRONTFACEPROC_b2ff6969() { - PFNGLFRONTFACEPROCB2FF6969(); -} - -void PFNGLGENBUFFERSPROC_552efb23() { - PFNGLGENBUFFERSPROC552EFB23(); -} - -void PFNGLGENERATEMIPMAPPROC_f27998e1() { - PFNGLGENERATEMIPMAPPROCF27998E1(); -} - -void PFNGLGENFRAMEBUFFERSPROC_5d476bc5() { - PFNGLGENFRAMEBUFFERSPROC5D476BC5(); -} - -void PFNGLGENQUERIESPROC_8ebe6c09() { - PFNGLGENQUERIESPROC8EBE6C09(); -} - -void PFNGLGENRENDERBUFFERSPROC_2a770542() { - PFNGLGENRENDERBUFFERSPROC2A770542(); -} - -void PFNGLGENSAMPLERSPROC_f03d9955() { - PFNGLGENSAMPLERSPROCF03D9955(); -} - -void PFNGLGENTEXTURESPROC_42d92669() { - PFNGLGENTEXTURESPROC42D92669(); -} - -void PFNGLGENTRANSFORMFEEDBACKSPROC_ae39d84b() { - PFNGLGENTRANSFORMFEEDBACKSPROCAE39D84B(); -} - -void PFNGLGENVERTEXARRAYSPROC_b6b2d522() { - PFNGLGENVERTEXARRAYSPROCB6B2D522(); -} - -void PFNGLGETACTIVEATTRIBPROC_d343cf3b() { - PFNGLGETACTIVEATTRIBPROCD343CF3B(); -} - -void PFNGLGETACTIVEUNIFORMBLOCKIVPROC_b4be84e5() { - PFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5(); -} - -void PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC_e2c8c8e7() { - PFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7(); -} - -void PFNGLGETACTIVEUNIFORMPROC_557d1389() { - PFNGLGETACTIVEUNIFORMPROC557D1389(); -} - -void PFNGLGETACTIVEUNIFORMSIVPROC_d8bbe80a() { - PFNGLGETACTIVEUNIFORMSIVPROCD8BBE80A(); -} - -void PFNGLGETATTACHEDSHADERSPROC_26d002c5() { - PFNGLGETATTACHEDSHADERSPROC26D002C5(); -} - -void PFNGLGETATTRIBLOCATIONPROC_5de605a0() { - PFNGLGETATTRIBLOCATIONPROC5DE605A0(); -} - -void PFNGLGETBOOLEANVPROC_28ccc4b8() { - PFNGLGETBOOLEANVPROC28CCC4B8(); -} - -void PFNGLGETBUFFERPARAMETERI64VPROC_c241e392() { - PFNGLGETBUFFERPARAMETERI64VPROCC241E392(); -} - -void PFNGLGETBUFFERPARAMETERIVPROC_763d4976() { - PFNGLGETBUFFERPARAMETERIVPROC763D4976(); -} - -void PFNGLGETBUFFERPOINTERVPROC_59db26b7() { - PFNGLGETBUFFERPOINTERVPROC59DB26B7(); -} - -void PFNGLGETERRORPROC_4ee43bb4() { - PFNGLGETERRORPROC4EE43BB4(); -} - -void PFNGLGETFLOATVPROC_26cedba1() { - PFNGLGETFLOATVPROC26CEDBA1(); -} - -void PFNGLGETFRAGDATALOCATIONPROC_3f23c060() { - PFNGLGETFRAGDATALOCATIONPROC3F23C060(); -} - -void PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_d90cb190() { - PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190(); -} - -void PFNGLGETINTEGER64I_VPROC_242cd442() { - PFNGLGETINTEGER64I_VPROC242CD442(); -} - -void PFNGLGETINTEGER64VPROC_1af2d58f() { - PFNGLGETINTEGER64VPROC1AF2D58F(); -} - -void PFNGLGETINTEGERI_VPROC_918a3aba() { - PFNGLGETINTEGERI_VPROC918A3ABA(); -} - -void PFNGLGETINTEGERVPROC_a20307b0() { - PFNGLGETINTEGERVPROCA20307B0(); -} - -void PFNGLGETINTERNALFORMATIVPROC_a1b94b3c() { - PFNGLGETINTERNALFORMATIVPROCA1B94B3C(); -} - -void PFNGLGETPROGRAMBINARYPROC_2beb64a5() { - PFNGLGETPROGRAMBINARYPROC2BEB64A5(); -} - -void PFNGLGETPROGRAMINFOLOGPROC_561acfae() { - PFNGLGETPROGRAMINFOLOGPROC561ACFAE(); -} - -void PFNGLGETPROGRAMIVPROC_f21b4e1c() { - PFNGLGETPROGRAMIVPROCF21B4E1C(); -} - -void PFNGLGETQUERYIVPROC_d2b5e550() { - PFNGLGETQUERYIVPROCD2B5E550(); -} - -void PFNGLGETQUERYOBJECTUIVPROC_a736af9b() { - PFNGLGETQUERYOBJECTUIVPROCA736AF9B(); -} - -void PFNGLGETRENDERBUFFERPARAMETERIVPROC_012dfb45() { - PFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45(); -} - -void PFNGLGETSAMPLERPARAMETERFVPROC_7884a5fe() { - PFNGLGETSAMPLERPARAMETERFVPROC7884A5FE(); -} - -void PFNGLGETSAMPLERPARAMETERIVPROC_a6b2561a() { - PFNGLGETSAMPLERPARAMETERIVPROCA6B2561A(); -} - -void PFNGLGETSHADERINFOLOGPROC_6c2312e1() { - PFNGLGETSHADERINFOLOGPROC6C2312E1(); -} - -void PFNGLGETSHADERIVPROC_181fc959() { - PFNGLGETSHADERIVPROC181FC959(); -} - -void PFNGLGETSHADERPRECISIONFORMATPROC_ba71b795() { - PFNGLGETSHADERPRECISIONFORMATPROCBA71B795(); -} - -void PFNGLGETSHADERSOURCEPROC_29961e3e() { - PFNGLGETSHADERSOURCEPROC29961E3E(); -} - -void PFNGLGETSTRINGIPROC_b4181478() { - PFNGLGETSTRINGIPROCB4181478(); -} - -void PFNGLGETSTRINGPROC_9056842e() { - PFNGLGETSTRINGPROC9056842E(); -} - -void PFNGLGETSYNCIVPROC_b687ee19() { - PFNGLGETSYNCIVPROCB687EE19(); -} - -void PFNGLGETTEXPARAMETERFVPROC_fbbac33a() { - PFNGLGETTEXPARAMETERFVPROCFBBAC33A(); -} - -void PFNGLGETTEXPARAMETERIVPROC_88ce5347() { - PFNGLGETTEXPARAMETERIVPROC88CE5347(); -} - -void PFNGLGETTRANSFORMFEEDBACKVARYINGPROC_bad38b4d() { - PFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4D(); -} - -void PFNGLGETUNIFORMBLOCKINDEXPROC_cb5218b1() { - PFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1(); -} - -void PFNGLGETUNIFORMFVPROC_1ccb78ca() { - PFNGLGETUNIFORMFVPROC1CCB78CA(); -} - -void PFNGLGETUNIFORMINDICESPROC_548e5e58() { - PFNGLGETUNIFORMINDICESPROC548E5E58(); -} - -void PFNGLGETUNIFORMIVPROC_37e3a17a() { - PFNGLGETUNIFORMIVPROC37E3A17A(); -} - -void PFNGLGETUNIFORMLOCATIONPROC_6be9913d() { - PFNGLGETUNIFORMLOCATIONPROC6BE9913D(); -} - -void PFNGLGETUNIFORMUIVPROC_fdfa8264() { - PFNGLGETUNIFORMUIVPROCFDFA8264(); -} - -void PFNGLGETVERTEXATTRIBFVPROC_2c991e8d() { - PFNGLGETVERTEXATTRIBFVPROC2C991E8D(); -} - -void PFNGLGETVERTEXATTRIBIIVPROC_497cc5ff() { - PFNGLGETVERTEXATTRIBIIVPROC497CC5FF(); -} - -void PFNGLGETVERTEXATTRIBIUIVPROC_96b22535() { - PFNGLGETVERTEXATTRIBIUIVPROC96B22535(); -} - -void PFNGLGETVERTEXATTRIBIVPROC_8af8ed90() { - PFNGLGETVERTEXATTRIBIVPROC8AF8ED90(); -} - -void PFNGLGETVERTEXATTRIBPOINTERVPROC_bbb72eda() { - PFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDA(); -} - -void PFNGLHINTPROC_9615d875() { - PFNGLHINTPROC9615D875(); -} - -void PFNGLINVALIDATEFRAMEBUFFERPROC_8a44ae58() { - PFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58(); -} - -void PFNGLINVALIDATESUBFRAMEBUFFERPROC_87763868() { - PFNGLINVALIDATESUBFRAMEBUFFERPROC87763868(); -} - -void PFNGLISBUFFERPROC_1205a0eb() { - PFNGLISBUFFERPROC1205A0EB(); -} - -void PFNGLISENABLEDPROC_3cfdab2a() { - PFNGLISENABLEDPROC3CFDAB2A(); -} - -void PFNGLISFRAMEBUFFERPROC_6a0eb102() { - PFNGLISFRAMEBUFFERPROC6A0EB102(); -} - -void PFNGLISPROGRAMPROC_69d4d96f() { - PFNGLISPROGRAMPROC69D4D96F(); -} - -void PFNGLISQUERYPROC_8bd23752() { - PFNGLISQUERYPROC8BD23752(); -} - -void PFNGLISRENDERBUFFERPROC_4113416b() { - PFNGLISRENDERBUFFERPROC4113416B(); -} - -void PFNGLISSAMPLERPROC_38170421() { - PFNGLISSAMPLERPROC38170421(); -} - -void PFNGLISSHADERPROC_abbfff54() { - PFNGLISSHADERPROCABBFFF54(); -} - -void PFNGLISSYNCPROC_8e68ebbb() { - PFNGLISSYNCPROC8E68EBBB(); -} - -void PFNGLISTEXTUREPROC_775b4fd4() { - PFNGLISTEXTUREPROC775B4FD4(); -} - -void PFNGLISTRANSFORMFEEDBACKPROC_fcd30ea1() { - PFNGLISTRANSFORMFEEDBACKPROCFCD30EA1(); -} - -void PFNGLISVERTEXARRAYPROC_736d5edb() { - PFNGLISVERTEXARRAYPROC736D5EDB(); -} - -void PFNGLLINEWIDTHPROC_ba5950e5() { - PFNGLLINEWIDTHPROCBA5950E5(); -} - -void PFNGLLINKPROGRAMPROC_161a12a7() { - PFNGLLINKPROGRAMPROC161A12A7(); -} - -void PFNGLMAPBUFFERRANGEPROC_627ea2f5() { - PFNGLMAPBUFFERRANGEPROC627EA2F5(); -} - -void PFNGLPAUSETRANSFORMFEEDBACKPROC_9de9d6d1() { - PFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1(); -} - -void PFNGLPIXELSTOREIPROC_7a0339f7() { - PFNGLPIXELSTOREIPROC7A0339F7(); -} - -void PFNGLPOLYGONOFFSETPROC_c431f0c7() { - PFNGLPOLYGONOFFSETPROCC431F0C7(); -} - -void PFNGLPROGRAMBINARYPROC_21944aec() { - PFNGLPROGRAMBINARYPROC21944AEC(); -} - -void PFNGLPROGRAMPARAMETERIPROC_a171055f() { - PFNGLPROGRAMPARAMETERIPROCA171055F(); -} - -void PFNGLREADBUFFERPROC_11385d22() { - PFNGLREADBUFFERPROC11385D22(); -} - -void PFNGLREADPIXELSPROC_97c2ff0f() { - PFNGLREADPIXELSPROC97C2FF0F(); -} - -void PFNGLRELEASESHADERCOMPILERPROC_fd48183d() { - PFNGLRELEASESHADERCOMPILERPROCFD48183D(); -} - -void PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC_76ccd59c() { - PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59C(); -} - -void PFNGLRENDERBUFFERSTORAGEPROC_7a4ec204() { - PFNGLRENDERBUFFERSTORAGEPROC7A4EC204(); -} - -void PFNGLRESUMETRANSFORMFEEDBACKPROC_85f458d6() { - PFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6(); -} - -void PFNGLSAMPLECOVERAGEPROC_7a0d5034() { - PFNGLSAMPLECOVERAGEPROC7A0D5034(); -} - -void PFNGLSAMPLERPARAMETERFPROC_bd904a68() { - PFNGLSAMPLERPARAMETERFPROCBD904A68(); -} - -void PFNGLSAMPLERPARAMETERFVPROC_0dc22a41() { - PFNGLSAMPLERPARAMETERFVPROC0DC22A41(); -} - -void PFNGLSAMPLERPARAMETERIPROC_a43d84c8() { - PFNGLSAMPLERPARAMETERIPROCA43D84C8(); -} - -void PFNGLSAMPLERPARAMETERIVPROC_7d65b105() { - PFNGLSAMPLERPARAMETERIVPROC7D65B105(); -} - -void PFNGLSCISSORPROC_882c96cc() { - PFNGLSCISSORPROC882C96CC(); -} - -void PFNGLSHADERBINARYPROC_eb973fb2() { - PFNGLSHADERBINARYPROCEB973FB2(); -} - -void PFNGLSHADERSOURCEPROC_7ffe3e77() { - PFNGLSHADERSOURCEPROC7FFE3E77(); -} - -void PFNGLSTENCILFUNCPROC_ca625f61() { - PFNGLSTENCILFUNCPROCCA625F61(); -} - -void PFNGLSTENCILFUNCSEPARATEPROC_91a002dc() { - PFNGLSTENCILFUNCSEPARATEPROC91A002DC(); -} - -void PFNGLSTENCILMASKPROC_2fcda6ac() { - PFNGLSTENCILMASKPROC2FCDA6AC(); -} - -void PFNGLSTENCILMASKSEPARATEPROC_470e1c05() { - PFNGLSTENCILMASKSEPARATEPROC470E1C05(); -} - -void PFNGLSTENCILOPPROC_6bfd6244() { - PFNGLSTENCILOPPROC6BFD6244(); -} - -void PFNGLSTENCILOPSEPARATEPROC_34d4afbe() { - PFNGLSTENCILOPSEPARATEPROC34D4AFBE(); -} - -void PFNGLTEXIMAGE2DPROC_5118e801() { - PFNGLTEXIMAGE2DPROC5118E801(); -} - -void PFNGLTEXIMAGE3DPROC_36a4932a() { - PFNGLTEXIMAGE3DPROC36A4932A(); -} - -void PFNGLTEXPARAMETERFPROC_1d38fabb() { - PFNGLTEXPARAMETERFPROC1D38FABB(); -} - -void PFNGLTEXPARAMETERFVPROC_0b118e13() { - PFNGLTEXPARAMETERFVPROC0B118E13(); -} - -void PFNGLTEXPARAMETERIPROC_3f03378a() { - PFNGLTEXPARAMETERIPROC3F03378A(); -} - -void PFNGLTEXPARAMETERIVPROC_7337f38e() { - PFNGLTEXPARAMETERIVPROC7337F38E(); -} - -void PFNGLTEXSTORAGE2DPROC_408b7c7c() { - PFNGLTEXSTORAGE2DPROC408B7C7C(); -} - -void PFNGLTEXSTORAGE3DPROC_ccdc130d() { - PFNGLTEXSTORAGE3DPROCCCDC130D(); -} - -void PFNGLTEXSUBIMAGE2DPROC_accd8326() { - PFNGLTEXSUBIMAGE2DPROCACCD8326(); -} - -void PFNGLTEXSUBIMAGE3DPROC_65f790a0() { - PFNGLTEXSUBIMAGE3DPROC65F790A0(); -} - -void PFNGLTRANSFORMFEEDBACKVARYINGSPROC_1095cbc2() { - PFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2(); -} - -void PFNGLUNIFORM1FPROC_59f5a391() { - PFNGLUNIFORM1FPROC59F5A391(); -} - -void PFNGLUNIFORM1FVPROC_51063184() { - PFNGLUNIFORM1FVPROC51063184(); -} - -void PFNGLUNIFORM1IPROC_9956b5f5() { - PFNGLUNIFORM1IPROC9956B5F5(); -} - -void PFNGLUNIFORM1IVPROC_e056147c() { - PFNGLUNIFORM1IVPROCE056147C(); -} - -void PFNGLUNIFORM1UIPROC_81070bcb() { - PFNGLUNIFORM1UIPROC81070BCB(); -} - -void PFNGLUNIFORM1UIVPROC_9eebd3ec() { - PFNGLUNIFORM1UIVPROC9EEBD3EC(); -} - -void PFNGLUNIFORM2FPROC_4a2bebbf() { - PFNGLUNIFORM2FPROC4A2BEBBF(); -} - -void PFNGLUNIFORM2FVPROC_791c53e7() { - PFNGLUNIFORM2FVPROC791C53E7(); -} - -void PFNGLUNIFORM2IPROC_b9a237a7() { - PFNGLUNIFORM2IPROCB9A237A7(); -} - -void PFNGLUNIFORM2IVPROC_88812862() { - PFNGLUNIFORM2IVPROC88812862(); -} - -void PFNGLUNIFORM2UIPROC_fbbdbaea() { - PFNGLUNIFORM2UIPROCFBBDBAEA(); -} - -void PFNGLUNIFORM2UIVPROC_acd33cba() { - PFNGLUNIFORM2UIVPROCACD33CBA(); -} - -void PFNGLUNIFORM3FPROC_bef7aa61() { - PFNGLUNIFORM3FPROCBEF7AA61(); -} - -void PFNGLUNIFORM3FVPROC_93b9acfb() { - PFNGLUNIFORM3FVPROC93B9ACFB(); -} - -void PFNGLUNIFORM3IPROC_1e304eda() { - PFNGLUNIFORM3IPROC1E304EDA(); -} - -void PFNGLUNIFORM3IVPROC_e98100d4() { - PFNGLUNIFORM3IVPROCE98100D4(); -} - -void PFNGLUNIFORM3UIPROC_bdc65300() { - PFNGLUNIFORM3UIPROCBDC65300(); -} - -void PFNGLUNIFORM3UIVPROC_206d6b43() { - PFNGLUNIFORM3UIVPROC206D6B43(); -} - -void PFNGLUNIFORM4FPROC_b064ba73() { - PFNGLUNIFORM4FPROCB064BA73(); -} - -void PFNGLUNIFORM4FVPROC_a45ea02f() { - PFNGLUNIFORM4FVPROCA45EA02F(); -} - -void PFNGLUNIFORM4IPROC_0ef851c5() { - PFNGLUNIFORM4IPROC0EF851C5(); -} - -void PFNGLUNIFORM4IVPROC_af39c73d() { - PFNGLUNIFORM4IVPROCAF39C73D(); -} - -void PFNGLUNIFORM4UIPROC_b5f68357() { - PFNGLUNIFORM4UIPROCB5F68357(); -} - -void PFNGLUNIFORM4UIVPROC_f6962598() { - PFNGLUNIFORM4UIVPROCF6962598(); -} - -void PFNGLUNIFORMBLOCKBINDINGPROC_7ae350b0() { - PFNGLUNIFORMBLOCKBINDINGPROC7AE350B0(); -} - -void PFNGLUNIFORMMATRIX2FVPROC_65c33403() { - PFNGLUNIFORMMATRIX2FVPROC65C33403(); -} - -void PFNGLUNIFORMMATRIX2X3FVPROC_e42ba878() { - PFNGLUNIFORMMATRIX2X3FVPROCE42BA878(); -} - -void PFNGLUNIFORMMATRIX2X4FVPROC_0b76e4a2() { - PFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2(); -} - -void PFNGLUNIFORMMATRIX3FVPROC_2d08e9c6() { - PFNGLUNIFORMMATRIX3FVPROC2D08E9C6(); -} - -void PFNGLUNIFORMMATRIX3X2FVPROC_a409db19() { - PFNGLUNIFORMMATRIX3X2FVPROCA409DB19(); -} - -void PFNGLUNIFORMMATRIX3X4FVPROC_97dd1a67() { - PFNGLUNIFORMMATRIX3X4FVPROC97DD1A67(); -} - -void PFNGLUNIFORMMATRIX4FVPROC_9b24359d() { - PFNGLUNIFORMMATRIX4FVPROC9B24359D(); -} - -void PFNGLUNIFORMMATRIX4X2FVPROC_bf8c50e9() { - PFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9(); -} - -void PFNGLUNIFORMMATRIX4X3FVPROC_dd54cd1f() { - PFNGLUNIFORMMATRIX4X3FVPROCDD54CD1F(); -} - -void PFNGLUNMAPBUFFERPROC_cdda11f6() { - PFNGLUNMAPBUFFERPROCCDDA11F6(); -} - -void PFNGLUSEPROGRAMPROC_ca4e8162() { - PFNGLUSEPROGRAMPROCCA4E8162(); -} - -void PFNGLVALIDATEPROGRAMPROC_d5a5ec0a() { - PFNGLVALIDATEPROGRAMPROCD5A5EC0A(); -} - -void PFNGLVERTEXATTRIB1FPROC_a73ce5b3() { - PFNGLVERTEXATTRIB1FPROCA73CE5B3(); -} - -void PFNGLVERTEXATTRIB1FVPROC_79cc789c() { - PFNGLVERTEXATTRIB1FVPROC79CC789C(); -} - -void PFNGLVERTEXATTRIB2FPROC_1bd2201b() { - PFNGLVERTEXATTRIB2FPROC1BD2201B(); -} - -void PFNGLVERTEXATTRIB2FVPROC_c7d14a1a() { - PFNGLVERTEXATTRIB2FVPROCC7D14A1A(); -} - -void PFNGLVERTEXATTRIB3FPROC_422f4c14() { - PFNGLVERTEXATTRIB3FPROC422F4C14(); -} - -void PFNGLVERTEXATTRIB3FVPROC_b47b0707() { - PFNGLVERTEXATTRIB3FVPROCB47B0707(); -} - -void PFNGLVERTEXATTRIB4FPROC_be466156() { - PFNGLVERTEXATTRIB4FPROCBE466156(); -} - -void PFNGLVERTEXATTRIB4FVPROC_0049c127() { - PFNGLVERTEXATTRIB4FVPROC0049C127(); -} - -void PFNGLVERTEXATTRIBDIVISORPROC_be125e6e() { - PFNGLVERTEXATTRIBDIVISORPROCBE125E6E(); -} - -void PFNGLVERTEXATTRIBI4IPROC_c76eb9a3() { - PFNGLVERTEXATTRIBI4IPROCC76EB9A3(); -} - -void PFNGLVERTEXATTRIBI4IVPROC_568d8487() { - PFNGLVERTEXATTRIBI4IVPROC568D8487(); -} - -void PFNGLVERTEXATTRIBI4UIPROC_6821c9de() { - PFNGLVERTEXATTRIBI4UIPROC6821C9DE(); -} - -void PFNGLVERTEXATTRIBI4UIVPROC_88245792() { - PFNGLVERTEXATTRIBI4UIVPROC88245792(); -} - -void PFNGLVERTEXATTRIBIPOINTERPROC_48e37dfc() { - PFNGLVERTEXATTRIBIPOINTERPROC48E37DFC(); -} - -void PFNGLVERTEXATTRIBPOINTERPROC_f18d3b5e() { - PFNGLVERTEXATTRIBPOINTERPROCF18D3B5E(); -} - -void PFNGLVIEWPORTPROC_bc565588() { - PFNGLVIEWPORTPROCBC565588(); -} - -void PFNGLWAITSYNCPROC_c9b9a615() { - PFNGLWAITSYNCPROCC9B9A615(); -} - diff --git a/capi/gles3/cgo_helpers.go b/capi/gles3/cgo_helpers.go deleted file mode 100644 index 09887ac..0000000 --- a/capi/gles3/cgo_helpers.go +++ /dev/null @@ -1,8681 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package gles3 - -/* -#cgo LDFLAGS: -lGLESv3 -#include "GLES3/gl3.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x PFNGLACTIVETEXTUREPROC) PassRef() (ref *C.PFNGLACTIVETEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLACTIVETEXTUREPROC6C604AFEFunc == nil { - pFNGLACTIVETEXTUREPROC6C604AFEFunc = x - } - return (*C.PFNGLACTIVETEXTUREPROC)(C.PFNGLACTIVETEXTUREPROC_6c604afe), nil -} - -func (x PFNGLACTIVETEXTUREPROC) PassValue() (ref C.PFNGLACTIVETEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLACTIVETEXTUREPROC6C604AFEFunc == nil { - pFNGLACTIVETEXTUREPROC6C604AFEFunc = x - } - return (C.PFNGLACTIVETEXTUREPROC)(C.PFNGLACTIVETEXTUREPROC_6c604afe), nil -} - -func NewPFNGLACTIVETEXTUREPROCRef(ref unsafe.Pointer) *PFNGLACTIVETEXTUREPROC { - return (*PFNGLACTIVETEXTUREPROC)(ref) -} - -//export PFNGLACTIVETEXTUREPROC6C604AFE -func PFNGLACTIVETEXTUREPROC6C604AFE() { - if pFNGLACTIVETEXTUREPROC6C604AFEFunc != nil { - pFNGLACTIVETEXTUREPROC6C604AFEFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLACTIVETEXTUREPROC6C604AFEFunc PFNGLACTIVETEXTUREPROC - -func (x PFNGLATTACHSHADERPROC) PassRef() (ref *C.PFNGLATTACHSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLATTACHSHADERPROC6A111311Func == nil { - pFNGLATTACHSHADERPROC6A111311Func = x - } - return (*C.PFNGLATTACHSHADERPROC)(C.PFNGLATTACHSHADERPROC_6a111311), nil -} - -func (x PFNGLATTACHSHADERPROC) PassValue() (ref C.PFNGLATTACHSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLATTACHSHADERPROC6A111311Func == nil { - pFNGLATTACHSHADERPROC6A111311Func = x - } - return (C.PFNGLATTACHSHADERPROC)(C.PFNGLATTACHSHADERPROC_6a111311), nil -} - -func NewPFNGLATTACHSHADERPROCRef(ref unsafe.Pointer) *PFNGLATTACHSHADERPROC { - return (*PFNGLATTACHSHADERPROC)(ref) -} - -//export PFNGLATTACHSHADERPROC6A111311 -func PFNGLATTACHSHADERPROC6A111311() { - if pFNGLATTACHSHADERPROC6A111311Func != nil { - pFNGLATTACHSHADERPROC6A111311Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLATTACHSHADERPROC6A111311Func PFNGLATTACHSHADERPROC - -func (x PFNGLBEGINQUERYPROC) PassRef() (ref *C.PFNGLBEGINQUERYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBEGINQUERYPROCB91E6474Func == nil { - pFNGLBEGINQUERYPROCB91E6474Func = x - } - return (*C.PFNGLBEGINQUERYPROC)(C.PFNGLBEGINQUERYPROC_b91e6474), nil -} - -func (x PFNGLBEGINQUERYPROC) PassValue() (ref C.PFNGLBEGINQUERYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBEGINQUERYPROCB91E6474Func == nil { - pFNGLBEGINQUERYPROCB91E6474Func = x - } - return (C.PFNGLBEGINQUERYPROC)(C.PFNGLBEGINQUERYPROC_b91e6474), nil -} - -func NewPFNGLBEGINQUERYPROCRef(ref unsafe.Pointer) *PFNGLBEGINQUERYPROC { - return (*PFNGLBEGINQUERYPROC)(ref) -} - -//export PFNGLBEGINQUERYPROCB91E6474 -func PFNGLBEGINQUERYPROCB91E6474() { - if pFNGLBEGINQUERYPROCB91E6474Func != nil { - pFNGLBEGINQUERYPROCB91E6474Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBEGINQUERYPROCB91E6474Func PFNGLBEGINQUERYPROC - -func (x PFNGLBEGINTRANSFORMFEEDBACKPROC) PassRef() (ref *C.PFNGLBEGINTRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBEGINTRANSFORMFEEDBACKPROC32028BBDFunc == nil { - pFNGLBEGINTRANSFORMFEEDBACKPROC32028BBDFunc = x - } - return (*C.PFNGLBEGINTRANSFORMFEEDBACKPROC)(C.PFNGLBEGINTRANSFORMFEEDBACKPROC_32028bbd), nil -} - -func (x PFNGLBEGINTRANSFORMFEEDBACKPROC) PassValue() (ref C.PFNGLBEGINTRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBEGINTRANSFORMFEEDBACKPROC32028BBDFunc == nil { - pFNGLBEGINTRANSFORMFEEDBACKPROC32028BBDFunc = x - } - return (C.PFNGLBEGINTRANSFORMFEEDBACKPROC)(C.PFNGLBEGINTRANSFORMFEEDBACKPROC_32028bbd), nil -} - -func NewPFNGLBEGINTRANSFORMFEEDBACKPROCRef(ref unsafe.Pointer) *PFNGLBEGINTRANSFORMFEEDBACKPROC { - return (*PFNGLBEGINTRANSFORMFEEDBACKPROC)(ref) -} - -//export PFNGLBEGINTRANSFORMFEEDBACKPROC32028BBD -func PFNGLBEGINTRANSFORMFEEDBACKPROC32028BBD() { - if pFNGLBEGINTRANSFORMFEEDBACKPROC32028BBDFunc != nil { - pFNGLBEGINTRANSFORMFEEDBACKPROC32028BBDFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBEGINTRANSFORMFEEDBACKPROC32028BBDFunc PFNGLBEGINTRANSFORMFEEDBACKPROC - -func (x PFNGLBINDATTRIBLOCATIONPROC) PassRef() (ref *C.PFNGLBINDATTRIBLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDATTRIBLOCATIONPROCE517BC2AFunc == nil { - pFNGLBINDATTRIBLOCATIONPROCE517BC2AFunc = x - } - return (*C.PFNGLBINDATTRIBLOCATIONPROC)(C.PFNGLBINDATTRIBLOCATIONPROC_e517bc2a), nil -} - -func (x PFNGLBINDATTRIBLOCATIONPROC) PassValue() (ref C.PFNGLBINDATTRIBLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDATTRIBLOCATIONPROCE517BC2AFunc == nil { - pFNGLBINDATTRIBLOCATIONPROCE517BC2AFunc = x - } - return (C.PFNGLBINDATTRIBLOCATIONPROC)(C.PFNGLBINDATTRIBLOCATIONPROC_e517bc2a), nil -} - -func NewPFNGLBINDATTRIBLOCATIONPROCRef(ref unsafe.Pointer) *PFNGLBINDATTRIBLOCATIONPROC { - return (*PFNGLBINDATTRIBLOCATIONPROC)(ref) -} - -//export PFNGLBINDATTRIBLOCATIONPROCE517BC2A -func PFNGLBINDATTRIBLOCATIONPROCE517BC2A() { - if pFNGLBINDATTRIBLOCATIONPROCE517BC2AFunc != nil { - pFNGLBINDATTRIBLOCATIONPROCE517BC2AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDATTRIBLOCATIONPROCE517BC2AFunc PFNGLBINDATTRIBLOCATIONPROC - -func (x PFNGLBINDBUFFERBASEPROC) PassRef() (ref *C.PFNGLBINDBUFFERBASEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDBUFFERBASEPROC8814D1EBFunc == nil { - pFNGLBINDBUFFERBASEPROC8814D1EBFunc = x - } - return (*C.PFNGLBINDBUFFERBASEPROC)(C.PFNGLBINDBUFFERBASEPROC_8814d1eb), nil -} - -func (x PFNGLBINDBUFFERBASEPROC) PassValue() (ref C.PFNGLBINDBUFFERBASEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDBUFFERBASEPROC8814D1EBFunc == nil { - pFNGLBINDBUFFERBASEPROC8814D1EBFunc = x - } - return (C.PFNGLBINDBUFFERBASEPROC)(C.PFNGLBINDBUFFERBASEPROC_8814d1eb), nil -} - -func NewPFNGLBINDBUFFERBASEPROCRef(ref unsafe.Pointer) *PFNGLBINDBUFFERBASEPROC { - return (*PFNGLBINDBUFFERBASEPROC)(ref) -} - -//export PFNGLBINDBUFFERBASEPROC8814D1EB -func PFNGLBINDBUFFERBASEPROC8814D1EB() { - if pFNGLBINDBUFFERBASEPROC8814D1EBFunc != nil { - pFNGLBINDBUFFERBASEPROC8814D1EBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDBUFFERBASEPROC8814D1EBFunc PFNGLBINDBUFFERBASEPROC - -func (x PFNGLBINDBUFFERPROC) PassRef() (ref *C.PFNGLBINDBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDBUFFERPROC58E32B5EFunc == nil { - pFNGLBINDBUFFERPROC58E32B5EFunc = x - } - return (*C.PFNGLBINDBUFFERPROC)(C.PFNGLBINDBUFFERPROC_58e32b5e), nil -} - -func (x PFNGLBINDBUFFERPROC) PassValue() (ref C.PFNGLBINDBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDBUFFERPROC58E32B5EFunc == nil { - pFNGLBINDBUFFERPROC58E32B5EFunc = x - } - return (C.PFNGLBINDBUFFERPROC)(C.PFNGLBINDBUFFERPROC_58e32b5e), nil -} - -func NewPFNGLBINDBUFFERPROCRef(ref unsafe.Pointer) *PFNGLBINDBUFFERPROC { - return (*PFNGLBINDBUFFERPROC)(ref) -} - -//export PFNGLBINDBUFFERPROC58E32B5E -func PFNGLBINDBUFFERPROC58E32B5E() { - if pFNGLBINDBUFFERPROC58E32B5EFunc != nil { - pFNGLBINDBUFFERPROC58E32B5EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDBUFFERPROC58E32B5EFunc PFNGLBINDBUFFERPROC - -func (x PFNGLBINDBUFFERRANGEPROC) PassRef() (ref *C.PFNGLBINDBUFFERRANGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDBUFFERRANGEPROCAF325A80Func == nil { - pFNGLBINDBUFFERRANGEPROCAF325A80Func = x - } - return (*C.PFNGLBINDBUFFERRANGEPROC)(C.PFNGLBINDBUFFERRANGEPROC_af325a80), nil -} - -func (x PFNGLBINDBUFFERRANGEPROC) PassValue() (ref C.PFNGLBINDBUFFERRANGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDBUFFERRANGEPROCAF325A80Func == nil { - pFNGLBINDBUFFERRANGEPROCAF325A80Func = x - } - return (C.PFNGLBINDBUFFERRANGEPROC)(C.PFNGLBINDBUFFERRANGEPROC_af325a80), nil -} - -func NewPFNGLBINDBUFFERRANGEPROCRef(ref unsafe.Pointer) *PFNGLBINDBUFFERRANGEPROC { - return (*PFNGLBINDBUFFERRANGEPROC)(ref) -} - -//export PFNGLBINDBUFFERRANGEPROCAF325A80 -func PFNGLBINDBUFFERRANGEPROCAF325A80() { - if pFNGLBINDBUFFERRANGEPROCAF325A80Func != nil { - pFNGLBINDBUFFERRANGEPROCAF325A80Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDBUFFERRANGEPROCAF325A80Func PFNGLBINDBUFFERRANGEPROC - -func (x PFNGLBINDFRAMEBUFFERPROC) PassRef() (ref *C.PFNGLBINDFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDFRAMEBUFFERPROC0666F584Func == nil { - pFNGLBINDFRAMEBUFFERPROC0666F584Func = x - } - return (*C.PFNGLBINDFRAMEBUFFERPROC)(C.PFNGLBINDFRAMEBUFFERPROC_0666f584), nil -} - -func (x PFNGLBINDFRAMEBUFFERPROC) PassValue() (ref C.PFNGLBINDFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDFRAMEBUFFERPROC0666F584Func == nil { - pFNGLBINDFRAMEBUFFERPROC0666F584Func = x - } - return (C.PFNGLBINDFRAMEBUFFERPROC)(C.PFNGLBINDFRAMEBUFFERPROC_0666f584), nil -} - -func NewPFNGLBINDFRAMEBUFFERPROCRef(ref unsafe.Pointer) *PFNGLBINDFRAMEBUFFERPROC { - return (*PFNGLBINDFRAMEBUFFERPROC)(ref) -} - -//export PFNGLBINDFRAMEBUFFERPROC0666F584 -func PFNGLBINDFRAMEBUFFERPROC0666F584() { - if pFNGLBINDFRAMEBUFFERPROC0666F584Func != nil { - pFNGLBINDFRAMEBUFFERPROC0666F584Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDFRAMEBUFFERPROC0666F584Func PFNGLBINDFRAMEBUFFERPROC - -func (x PFNGLBINDRENDERBUFFERPROC) PassRef() (ref *C.PFNGLBINDRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDRENDERBUFFERPROC189E9B1AFunc == nil { - pFNGLBINDRENDERBUFFERPROC189E9B1AFunc = x - } - return (*C.PFNGLBINDRENDERBUFFERPROC)(C.PFNGLBINDRENDERBUFFERPROC_189e9b1a), nil -} - -func (x PFNGLBINDRENDERBUFFERPROC) PassValue() (ref C.PFNGLBINDRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDRENDERBUFFERPROC189E9B1AFunc == nil { - pFNGLBINDRENDERBUFFERPROC189E9B1AFunc = x - } - return (C.PFNGLBINDRENDERBUFFERPROC)(C.PFNGLBINDRENDERBUFFERPROC_189e9b1a), nil -} - -func NewPFNGLBINDRENDERBUFFERPROCRef(ref unsafe.Pointer) *PFNGLBINDRENDERBUFFERPROC { - return (*PFNGLBINDRENDERBUFFERPROC)(ref) -} - -//export PFNGLBINDRENDERBUFFERPROC189E9B1A -func PFNGLBINDRENDERBUFFERPROC189E9B1A() { - if pFNGLBINDRENDERBUFFERPROC189E9B1AFunc != nil { - pFNGLBINDRENDERBUFFERPROC189E9B1AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDRENDERBUFFERPROC189E9B1AFunc PFNGLBINDRENDERBUFFERPROC - -func (x PFNGLBINDSAMPLERPROC) PassRef() (ref *C.PFNGLBINDSAMPLERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDSAMPLERPROCF58B5F0FFunc == nil { - pFNGLBINDSAMPLERPROCF58B5F0FFunc = x - } - return (*C.PFNGLBINDSAMPLERPROC)(C.PFNGLBINDSAMPLERPROC_f58b5f0f), nil -} - -func (x PFNGLBINDSAMPLERPROC) PassValue() (ref C.PFNGLBINDSAMPLERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDSAMPLERPROCF58B5F0FFunc == nil { - pFNGLBINDSAMPLERPROCF58B5F0FFunc = x - } - return (C.PFNGLBINDSAMPLERPROC)(C.PFNGLBINDSAMPLERPROC_f58b5f0f), nil -} - -func NewPFNGLBINDSAMPLERPROCRef(ref unsafe.Pointer) *PFNGLBINDSAMPLERPROC { - return (*PFNGLBINDSAMPLERPROC)(ref) -} - -//export PFNGLBINDSAMPLERPROCF58B5F0F -func PFNGLBINDSAMPLERPROCF58B5F0F() { - if pFNGLBINDSAMPLERPROCF58B5F0FFunc != nil { - pFNGLBINDSAMPLERPROCF58B5F0FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDSAMPLERPROCF58B5F0FFunc PFNGLBINDSAMPLERPROC - -func (x PFNGLBINDTEXTUREPROC) PassRef() (ref *C.PFNGLBINDTEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDTEXTUREPROC5BC8F391Func == nil { - pFNGLBINDTEXTUREPROC5BC8F391Func = x - } - return (*C.PFNGLBINDTEXTUREPROC)(C.PFNGLBINDTEXTUREPROC_5bc8f391), nil -} - -func (x PFNGLBINDTEXTUREPROC) PassValue() (ref C.PFNGLBINDTEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDTEXTUREPROC5BC8F391Func == nil { - pFNGLBINDTEXTUREPROC5BC8F391Func = x - } - return (C.PFNGLBINDTEXTUREPROC)(C.PFNGLBINDTEXTUREPROC_5bc8f391), nil -} - -func NewPFNGLBINDTEXTUREPROCRef(ref unsafe.Pointer) *PFNGLBINDTEXTUREPROC { - return (*PFNGLBINDTEXTUREPROC)(ref) -} - -//export PFNGLBINDTEXTUREPROC5BC8F391 -func PFNGLBINDTEXTUREPROC5BC8F391() { - if pFNGLBINDTEXTUREPROC5BC8F391Func != nil { - pFNGLBINDTEXTUREPROC5BC8F391Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDTEXTUREPROC5BC8F391Func PFNGLBINDTEXTUREPROC - -func (x PFNGLBINDTRANSFORMFEEDBACKPROC) PassRef() (ref *C.PFNGLBINDTRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDTRANSFORMFEEDBACKPROC274EB341Func == nil { - pFNGLBINDTRANSFORMFEEDBACKPROC274EB341Func = x - } - return (*C.PFNGLBINDTRANSFORMFEEDBACKPROC)(C.PFNGLBINDTRANSFORMFEEDBACKPROC_274eb341), nil -} - -func (x PFNGLBINDTRANSFORMFEEDBACKPROC) PassValue() (ref C.PFNGLBINDTRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDTRANSFORMFEEDBACKPROC274EB341Func == nil { - pFNGLBINDTRANSFORMFEEDBACKPROC274EB341Func = x - } - return (C.PFNGLBINDTRANSFORMFEEDBACKPROC)(C.PFNGLBINDTRANSFORMFEEDBACKPROC_274eb341), nil -} - -func NewPFNGLBINDTRANSFORMFEEDBACKPROCRef(ref unsafe.Pointer) *PFNGLBINDTRANSFORMFEEDBACKPROC { - return (*PFNGLBINDTRANSFORMFEEDBACKPROC)(ref) -} - -//export PFNGLBINDTRANSFORMFEEDBACKPROC274EB341 -func PFNGLBINDTRANSFORMFEEDBACKPROC274EB341() { - if pFNGLBINDTRANSFORMFEEDBACKPROC274EB341Func != nil { - pFNGLBINDTRANSFORMFEEDBACKPROC274EB341Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDTRANSFORMFEEDBACKPROC274EB341Func PFNGLBINDTRANSFORMFEEDBACKPROC - -func (x PFNGLBINDVERTEXARRAYPROC) PassRef() (ref *C.PFNGLBINDVERTEXARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDVERTEXARRAYPROC5799C92DFunc == nil { - pFNGLBINDVERTEXARRAYPROC5799C92DFunc = x - } - return (*C.PFNGLBINDVERTEXARRAYPROC)(C.PFNGLBINDVERTEXARRAYPROC_5799c92d), nil -} - -func (x PFNGLBINDVERTEXARRAYPROC) PassValue() (ref C.PFNGLBINDVERTEXARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBINDVERTEXARRAYPROC5799C92DFunc == nil { - pFNGLBINDVERTEXARRAYPROC5799C92DFunc = x - } - return (C.PFNGLBINDVERTEXARRAYPROC)(C.PFNGLBINDVERTEXARRAYPROC_5799c92d), nil -} - -func NewPFNGLBINDVERTEXARRAYPROCRef(ref unsafe.Pointer) *PFNGLBINDVERTEXARRAYPROC { - return (*PFNGLBINDVERTEXARRAYPROC)(ref) -} - -//export PFNGLBINDVERTEXARRAYPROC5799C92D -func PFNGLBINDVERTEXARRAYPROC5799C92D() { - if pFNGLBINDVERTEXARRAYPROC5799C92DFunc != nil { - pFNGLBINDVERTEXARRAYPROC5799C92DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBINDVERTEXARRAYPROC5799C92DFunc PFNGLBINDVERTEXARRAYPROC - -func (x PFNGLBLENDCOLORPROC) PassRef() (ref *C.PFNGLBLENDCOLORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDCOLORPROC8B6D9550Func == nil { - pFNGLBLENDCOLORPROC8B6D9550Func = x - } - return (*C.PFNGLBLENDCOLORPROC)(C.PFNGLBLENDCOLORPROC_8b6d9550), nil -} - -func (x PFNGLBLENDCOLORPROC) PassValue() (ref C.PFNGLBLENDCOLORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDCOLORPROC8B6D9550Func == nil { - pFNGLBLENDCOLORPROC8B6D9550Func = x - } - return (C.PFNGLBLENDCOLORPROC)(C.PFNGLBLENDCOLORPROC_8b6d9550), nil -} - -func NewPFNGLBLENDCOLORPROCRef(ref unsafe.Pointer) *PFNGLBLENDCOLORPROC { - return (*PFNGLBLENDCOLORPROC)(ref) -} - -//export PFNGLBLENDCOLORPROC8B6D9550 -func PFNGLBLENDCOLORPROC8B6D9550() { - if pFNGLBLENDCOLORPROC8B6D9550Func != nil { - pFNGLBLENDCOLORPROC8B6D9550Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDCOLORPROC8B6D9550Func PFNGLBLENDCOLORPROC - -func (x PFNGLBLENDEQUATIONPROC) PassRef() (ref *C.PFNGLBLENDEQUATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDEQUATIONPROCB2D89C63Func == nil { - pFNGLBLENDEQUATIONPROCB2D89C63Func = x - } - return (*C.PFNGLBLENDEQUATIONPROC)(C.PFNGLBLENDEQUATIONPROC_b2d89c63), nil -} - -func (x PFNGLBLENDEQUATIONPROC) PassValue() (ref C.PFNGLBLENDEQUATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDEQUATIONPROCB2D89C63Func == nil { - pFNGLBLENDEQUATIONPROCB2D89C63Func = x - } - return (C.PFNGLBLENDEQUATIONPROC)(C.PFNGLBLENDEQUATIONPROC_b2d89c63), nil -} - -func NewPFNGLBLENDEQUATIONPROCRef(ref unsafe.Pointer) *PFNGLBLENDEQUATIONPROC { - return (*PFNGLBLENDEQUATIONPROC)(ref) -} - -//export PFNGLBLENDEQUATIONPROCB2D89C63 -func PFNGLBLENDEQUATIONPROCB2D89C63() { - if pFNGLBLENDEQUATIONPROCB2D89C63Func != nil { - pFNGLBLENDEQUATIONPROCB2D89C63Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDEQUATIONPROCB2D89C63Func PFNGLBLENDEQUATIONPROC - -func (x PFNGLBLENDEQUATIONSEPARATEPROC) PassRef() (ref *C.PFNGLBLENDEQUATIONSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6Func == nil { - pFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6Func = x - } - return (*C.PFNGLBLENDEQUATIONSEPARATEPROC)(C.PFNGLBLENDEQUATIONSEPARATEPROC_3f74a9e6), nil -} - -func (x PFNGLBLENDEQUATIONSEPARATEPROC) PassValue() (ref C.PFNGLBLENDEQUATIONSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6Func == nil { - pFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6Func = x - } - return (C.PFNGLBLENDEQUATIONSEPARATEPROC)(C.PFNGLBLENDEQUATIONSEPARATEPROC_3f74a9e6), nil -} - -func NewPFNGLBLENDEQUATIONSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLBLENDEQUATIONSEPARATEPROC { - return (*PFNGLBLENDEQUATIONSEPARATEPROC)(ref) -} - -//export PFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6 -func PFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6() { - if pFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6Func != nil { - pFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDEQUATIONSEPARATEPROC3F74A9E6Func PFNGLBLENDEQUATIONSEPARATEPROC - -func (x PFNGLBLENDFUNCPROC) PassRef() (ref *C.PFNGLBLENDFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDFUNCPROC6B072D27Func == nil { - pFNGLBLENDFUNCPROC6B072D27Func = x - } - return (*C.PFNGLBLENDFUNCPROC)(C.PFNGLBLENDFUNCPROC_6b072d27), nil -} - -func (x PFNGLBLENDFUNCPROC) PassValue() (ref C.PFNGLBLENDFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDFUNCPROC6B072D27Func == nil { - pFNGLBLENDFUNCPROC6B072D27Func = x - } - return (C.PFNGLBLENDFUNCPROC)(C.PFNGLBLENDFUNCPROC_6b072d27), nil -} - -func NewPFNGLBLENDFUNCPROCRef(ref unsafe.Pointer) *PFNGLBLENDFUNCPROC { - return (*PFNGLBLENDFUNCPROC)(ref) -} - -//export PFNGLBLENDFUNCPROC6B072D27 -func PFNGLBLENDFUNCPROC6B072D27() { - if pFNGLBLENDFUNCPROC6B072D27Func != nil { - pFNGLBLENDFUNCPROC6B072D27Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDFUNCPROC6B072D27Func PFNGLBLENDFUNCPROC - -func (x PFNGLBLENDFUNCSEPARATEPROC) PassRef() (ref *C.PFNGLBLENDFUNCSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDFUNCSEPARATEPROCCB3FA4B0Func == nil { - pFNGLBLENDFUNCSEPARATEPROCCB3FA4B0Func = x - } - return (*C.PFNGLBLENDFUNCSEPARATEPROC)(C.PFNGLBLENDFUNCSEPARATEPROC_cb3fa4b0), nil -} - -func (x PFNGLBLENDFUNCSEPARATEPROC) PassValue() (ref C.PFNGLBLENDFUNCSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLENDFUNCSEPARATEPROCCB3FA4B0Func == nil { - pFNGLBLENDFUNCSEPARATEPROCCB3FA4B0Func = x - } - return (C.PFNGLBLENDFUNCSEPARATEPROC)(C.PFNGLBLENDFUNCSEPARATEPROC_cb3fa4b0), nil -} - -func NewPFNGLBLENDFUNCSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLBLENDFUNCSEPARATEPROC { - return (*PFNGLBLENDFUNCSEPARATEPROC)(ref) -} - -//export PFNGLBLENDFUNCSEPARATEPROCCB3FA4B0 -func PFNGLBLENDFUNCSEPARATEPROCCB3FA4B0() { - if pFNGLBLENDFUNCSEPARATEPROCCB3FA4B0Func != nil { - pFNGLBLENDFUNCSEPARATEPROCCB3FA4B0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLENDFUNCSEPARATEPROCCB3FA4B0Func PFNGLBLENDFUNCSEPARATEPROC - -func (x PFNGLBLITFRAMEBUFFERPROC) PassRef() (ref *C.PFNGLBLITFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLITFRAMEBUFFERPROCFEDD3A33Func == nil { - pFNGLBLITFRAMEBUFFERPROCFEDD3A33Func = x - } - return (*C.PFNGLBLITFRAMEBUFFERPROC)(C.PFNGLBLITFRAMEBUFFERPROC_fedd3a33), nil -} - -func (x PFNGLBLITFRAMEBUFFERPROC) PassValue() (ref C.PFNGLBLITFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBLITFRAMEBUFFERPROCFEDD3A33Func == nil { - pFNGLBLITFRAMEBUFFERPROCFEDD3A33Func = x - } - return (C.PFNGLBLITFRAMEBUFFERPROC)(C.PFNGLBLITFRAMEBUFFERPROC_fedd3a33), nil -} - -func NewPFNGLBLITFRAMEBUFFERPROCRef(ref unsafe.Pointer) *PFNGLBLITFRAMEBUFFERPROC { - return (*PFNGLBLITFRAMEBUFFERPROC)(ref) -} - -//export PFNGLBLITFRAMEBUFFERPROCFEDD3A33 -func PFNGLBLITFRAMEBUFFERPROCFEDD3A33() { - if pFNGLBLITFRAMEBUFFERPROCFEDD3A33Func != nil { - pFNGLBLITFRAMEBUFFERPROCFEDD3A33Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBLITFRAMEBUFFERPROCFEDD3A33Func PFNGLBLITFRAMEBUFFERPROC - -func (x PFNGLBUFFERDATAPROC) PassRef() (ref *C.PFNGLBUFFERDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBUFFERDATAPROC83900D72Func == nil { - pFNGLBUFFERDATAPROC83900D72Func = x - } - return (*C.PFNGLBUFFERDATAPROC)(C.PFNGLBUFFERDATAPROC_83900d72), nil -} - -func (x PFNGLBUFFERDATAPROC) PassValue() (ref C.PFNGLBUFFERDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBUFFERDATAPROC83900D72Func == nil { - pFNGLBUFFERDATAPROC83900D72Func = x - } - return (C.PFNGLBUFFERDATAPROC)(C.PFNGLBUFFERDATAPROC_83900d72), nil -} - -func NewPFNGLBUFFERDATAPROCRef(ref unsafe.Pointer) *PFNGLBUFFERDATAPROC { - return (*PFNGLBUFFERDATAPROC)(ref) -} - -//export PFNGLBUFFERDATAPROC83900D72 -func PFNGLBUFFERDATAPROC83900D72() { - if pFNGLBUFFERDATAPROC83900D72Func != nil { - pFNGLBUFFERDATAPROC83900D72Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBUFFERDATAPROC83900D72Func PFNGLBUFFERDATAPROC - -func (x PFNGLBUFFERSUBDATAPROC) PassRef() (ref *C.PFNGLBUFFERSUBDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBUFFERSUBDATAPROCCD04A508Func == nil { - pFNGLBUFFERSUBDATAPROCCD04A508Func = x - } - return (*C.PFNGLBUFFERSUBDATAPROC)(C.PFNGLBUFFERSUBDATAPROC_cd04a508), nil -} - -func (x PFNGLBUFFERSUBDATAPROC) PassValue() (ref C.PFNGLBUFFERSUBDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLBUFFERSUBDATAPROCCD04A508Func == nil { - pFNGLBUFFERSUBDATAPROCCD04A508Func = x - } - return (C.PFNGLBUFFERSUBDATAPROC)(C.PFNGLBUFFERSUBDATAPROC_cd04a508), nil -} - -func NewPFNGLBUFFERSUBDATAPROCRef(ref unsafe.Pointer) *PFNGLBUFFERSUBDATAPROC { - return (*PFNGLBUFFERSUBDATAPROC)(ref) -} - -//export PFNGLBUFFERSUBDATAPROCCD04A508 -func PFNGLBUFFERSUBDATAPROCCD04A508() { - if pFNGLBUFFERSUBDATAPROCCD04A508Func != nil { - pFNGLBUFFERSUBDATAPROCCD04A508Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLBUFFERSUBDATAPROCCD04A508Func PFNGLBUFFERSUBDATAPROC - -func (x PFNGLCHECKFRAMEBUFFERSTATUSPROC) PassRef() (ref *C.PFNGLCHECKFRAMEBUFFERSTATUSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5AFunc == nil { - pFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5AFunc = x - } - return (*C.PFNGLCHECKFRAMEBUFFERSTATUSPROC)(C.PFNGLCHECKFRAMEBUFFERSTATUSPROC_97292a5a), nil -} - -func (x PFNGLCHECKFRAMEBUFFERSTATUSPROC) PassValue() (ref C.PFNGLCHECKFRAMEBUFFERSTATUSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5AFunc == nil { - pFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5AFunc = x - } - return (C.PFNGLCHECKFRAMEBUFFERSTATUSPROC)(C.PFNGLCHECKFRAMEBUFFERSTATUSPROC_97292a5a), nil -} - -func NewPFNGLCHECKFRAMEBUFFERSTATUSPROCRef(ref unsafe.Pointer) *PFNGLCHECKFRAMEBUFFERSTATUSPROC { - return (*PFNGLCHECKFRAMEBUFFERSTATUSPROC)(ref) -} - -//export PFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5A -func PFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5A() { - if pFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5AFunc != nil { - pFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCHECKFRAMEBUFFERSTATUSPROC97292A5AFunc PFNGLCHECKFRAMEBUFFERSTATUSPROC - -func (x PFNGLCLEARBUFFERFIPROC) PassRef() (ref *C.PFNGLCLEARBUFFERFIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARBUFFERFIPROC200129A8Func == nil { - pFNGLCLEARBUFFERFIPROC200129A8Func = x - } - return (*C.PFNGLCLEARBUFFERFIPROC)(C.PFNGLCLEARBUFFERFIPROC_200129a8), nil -} - -func (x PFNGLCLEARBUFFERFIPROC) PassValue() (ref C.PFNGLCLEARBUFFERFIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARBUFFERFIPROC200129A8Func == nil { - pFNGLCLEARBUFFERFIPROC200129A8Func = x - } - return (C.PFNGLCLEARBUFFERFIPROC)(C.PFNGLCLEARBUFFERFIPROC_200129a8), nil -} - -func NewPFNGLCLEARBUFFERFIPROCRef(ref unsafe.Pointer) *PFNGLCLEARBUFFERFIPROC { - return (*PFNGLCLEARBUFFERFIPROC)(ref) -} - -//export PFNGLCLEARBUFFERFIPROC200129A8 -func PFNGLCLEARBUFFERFIPROC200129A8() { - if pFNGLCLEARBUFFERFIPROC200129A8Func != nil { - pFNGLCLEARBUFFERFIPROC200129A8Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARBUFFERFIPROC200129A8Func PFNGLCLEARBUFFERFIPROC - -func (x PFNGLCLEARBUFFERFVPROC) PassRef() (ref *C.PFNGLCLEARBUFFERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARBUFFERFVPROCCF4C8E8FFunc == nil { - pFNGLCLEARBUFFERFVPROCCF4C8E8FFunc = x - } - return (*C.PFNGLCLEARBUFFERFVPROC)(C.PFNGLCLEARBUFFERFVPROC_cf4c8e8f), nil -} - -func (x PFNGLCLEARBUFFERFVPROC) PassValue() (ref C.PFNGLCLEARBUFFERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARBUFFERFVPROCCF4C8E8FFunc == nil { - pFNGLCLEARBUFFERFVPROCCF4C8E8FFunc = x - } - return (C.PFNGLCLEARBUFFERFVPROC)(C.PFNGLCLEARBUFFERFVPROC_cf4c8e8f), nil -} - -func NewPFNGLCLEARBUFFERFVPROCRef(ref unsafe.Pointer) *PFNGLCLEARBUFFERFVPROC { - return (*PFNGLCLEARBUFFERFVPROC)(ref) -} - -//export PFNGLCLEARBUFFERFVPROCCF4C8E8F -func PFNGLCLEARBUFFERFVPROCCF4C8E8F() { - if pFNGLCLEARBUFFERFVPROCCF4C8E8FFunc != nil { - pFNGLCLEARBUFFERFVPROCCF4C8E8FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARBUFFERFVPROCCF4C8E8FFunc PFNGLCLEARBUFFERFVPROC - -func (x PFNGLCLEARBUFFERIVPROC) PassRef() (ref *C.PFNGLCLEARBUFFERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARBUFFERIVPROC5CCCB667Func == nil { - pFNGLCLEARBUFFERIVPROC5CCCB667Func = x - } - return (*C.PFNGLCLEARBUFFERIVPROC)(C.PFNGLCLEARBUFFERIVPROC_5cccb667), nil -} - -func (x PFNGLCLEARBUFFERIVPROC) PassValue() (ref C.PFNGLCLEARBUFFERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARBUFFERIVPROC5CCCB667Func == nil { - pFNGLCLEARBUFFERIVPROC5CCCB667Func = x - } - return (C.PFNGLCLEARBUFFERIVPROC)(C.PFNGLCLEARBUFFERIVPROC_5cccb667), nil -} - -func NewPFNGLCLEARBUFFERIVPROCRef(ref unsafe.Pointer) *PFNGLCLEARBUFFERIVPROC { - return (*PFNGLCLEARBUFFERIVPROC)(ref) -} - -//export PFNGLCLEARBUFFERIVPROC5CCCB667 -func PFNGLCLEARBUFFERIVPROC5CCCB667() { - if pFNGLCLEARBUFFERIVPROC5CCCB667Func != nil { - pFNGLCLEARBUFFERIVPROC5CCCB667Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARBUFFERIVPROC5CCCB667Func PFNGLCLEARBUFFERIVPROC - -func (x PFNGLCLEARBUFFERUIVPROC) PassRef() (ref *C.PFNGLCLEARBUFFERUIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARBUFFERUIVPROC21B2B9C0Func == nil { - pFNGLCLEARBUFFERUIVPROC21B2B9C0Func = x - } - return (*C.PFNGLCLEARBUFFERUIVPROC)(C.PFNGLCLEARBUFFERUIVPROC_21b2b9c0), nil -} - -func (x PFNGLCLEARBUFFERUIVPROC) PassValue() (ref C.PFNGLCLEARBUFFERUIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARBUFFERUIVPROC21B2B9C0Func == nil { - pFNGLCLEARBUFFERUIVPROC21B2B9C0Func = x - } - return (C.PFNGLCLEARBUFFERUIVPROC)(C.PFNGLCLEARBUFFERUIVPROC_21b2b9c0), nil -} - -func NewPFNGLCLEARBUFFERUIVPROCRef(ref unsafe.Pointer) *PFNGLCLEARBUFFERUIVPROC { - return (*PFNGLCLEARBUFFERUIVPROC)(ref) -} - -//export PFNGLCLEARBUFFERUIVPROC21B2B9C0 -func PFNGLCLEARBUFFERUIVPROC21B2B9C0() { - if pFNGLCLEARBUFFERUIVPROC21B2B9C0Func != nil { - pFNGLCLEARBUFFERUIVPROC21B2B9C0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARBUFFERUIVPROC21B2B9C0Func PFNGLCLEARBUFFERUIVPROC - -func (x PFNGLCLEARCOLORPROC) PassRef() (ref *C.PFNGLCLEARCOLORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARCOLORPROC4B2C18B9Func == nil { - pFNGLCLEARCOLORPROC4B2C18B9Func = x - } - return (*C.PFNGLCLEARCOLORPROC)(C.PFNGLCLEARCOLORPROC_4b2c18b9), nil -} - -func (x PFNGLCLEARCOLORPROC) PassValue() (ref C.PFNGLCLEARCOLORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARCOLORPROC4B2C18B9Func == nil { - pFNGLCLEARCOLORPROC4B2C18B9Func = x - } - return (C.PFNGLCLEARCOLORPROC)(C.PFNGLCLEARCOLORPROC_4b2c18b9), nil -} - -func NewPFNGLCLEARCOLORPROCRef(ref unsafe.Pointer) *PFNGLCLEARCOLORPROC { - return (*PFNGLCLEARCOLORPROC)(ref) -} - -//export PFNGLCLEARCOLORPROC4B2C18B9 -func PFNGLCLEARCOLORPROC4B2C18B9() { - if pFNGLCLEARCOLORPROC4B2C18B9Func != nil { - pFNGLCLEARCOLORPROC4B2C18B9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARCOLORPROC4B2C18B9Func PFNGLCLEARCOLORPROC - -func (x PFNGLCLEARDEPTHFPROC) PassRef() (ref *C.PFNGLCLEARDEPTHFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARDEPTHFPROC473D2FCAFunc == nil { - pFNGLCLEARDEPTHFPROC473D2FCAFunc = x - } - return (*C.PFNGLCLEARDEPTHFPROC)(C.PFNGLCLEARDEPTHFPROC_473d2fca), nil -} - -func (x PFNGLCLEARDEPTHFPROC) PassValue() (ref C.PFNGLCLEARDEPTHFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARDEPTHFPROC473D2FCAFunc == nil { - pFNGLCLEARDEPTHFPROC473D2FCAFunc = x - } - return (C.PFNGLCLEARDEPTHFPROC)(C.PFNGLCLEARDEPTHFPROC_473d2fca), nil -} - -func NewPFNGLCLEARDEPTHFPROCRef(ref unsafe.Pointer) *PFNGLCLEARDEPTHFPROC { - return (*PFNGLCLEARDEPTHFPROC)(ref) -} - -//export PFNGLCLEARDEPTHFPROC473D2FCA -func PFNGLCLEARDEPTHFPROC473D2FCA() { - if pFNGLCLEARDEPTHFPROC473D2FCAFunc != nil { - pFNGLCLEARDEPTHFPROC473D2FCAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARDEPTHFPROC473D2FCAFunc PFNGLCLEARDEPTHFPROC - -func (x PFNGLCLEARPROC) PassRef() (ref *C.PFNGLCLEARPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARPROC81796BD7Func == nil { - pFNGLCLEARPROC81796BD7Func = x - } - return (*C.PFNGLCLEARPROC)(C.PFNGLCLEARPROC_81796bd7), nil -} - -func (x PFNGLCLEARPROC) PassValue() (ref C.PFNGLCLEARPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARPROC81796BD7Func == nil { - pFNGLCLEARPROC81796BD7Func = x - } - return (C.PFNGLCLEARPROC)(C.PFNGLCLEARPROC_81796bd7), nil -} - -func NewPFNGLCLEARPROCRef(ref unsafe.Pointer) *PFNGLCLEARPROC { - return (*PFNGLCLEARPROC)(ref) -} - -//export PFNGLCLEARPROC81796BD7 -func PFNGLCLEARPROC81796BD7() { - if pFNGLCLEARPROC81796BD7Func != nil { - pFNGLCLEARPROC81796BD7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARPROC81796BD7Func PFNGLCLEARPROC - -func (x PFNGLCLEARSTENCILPROC) PassRef() (ref *C.PFNGLCLEARSTENCILPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARSTENCILPROC860E5897Func == nil { - pFNGLCLEARSTENCILPROC860E5897Func = x - } - return (*C.PFNGLCLEARSTENCILPROC)(C.PFNGLCLEARSTENCILPROC_860e5897), nil -} - -func (x PFNGLCLEARSTENCILPROC) PassValue() (ref C.PFNGLCLEARSTENCILPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLEARSTENCILPROC860E5897Func == nil { - pFNGLCLEARSTENCILPROC860E5897Func = x - } - return (C.PFNGLCLEARSTENCILPROC)(C.PFNGLCLEARSTENCILPROC_860e5897), nil -} - -func NewPFNGLCLEARSTENCILPROCRef(ref unsafe.Pointer) *PFNGLCLEARSTENCILPROC { - return (*PFNGLCLEARSTENCILPROC)(ref) -} - -//export PFNGLCLEARSTENCILPROC860E5897 -func PFNGLCLEARSTENCILPROC860E5897() { - if pFNGLCLEARSTENCILPROC860E5897Func != nil { - pFNGLCLEARSTENCILPROC860E5897Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLEARSTENCILPROC860E5897Func PFNGLCLEARSTENCILPROC - -func (x PFNGLCLIENTWAITSYNCPROC) PassRef() (ref *C.PFNGLCLIENTWAITSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLIENTWAITSYNCPROC334598FDFunc == nil { - pFNGLCLIENTWAITSYNCPROC334598FDFunc = x - } - return (*C.PFNGLCLIENTWAITSYNCPROC)(C.PFNGLCLIENTWAITSYNCPROC_334598fd), nil -} - -func (x PFNGLCLIENTWAITSYNCPROC) PassValue() (ref C.PFNGLCLIENTWAITSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCLIENTWAITSYNCPROC334598FDFunc == nil { - pFNGLCLIENTWAITSYNCPROC334598FDFunc = x - } - return (C.PFNGLCLIENTWAITSYNCPROC)(C.PFNGLCLIENTWAITSYNCPROC_334598fd), nil -} - -func NewPFNGLCLIENTWAITSYNCPROCRef(ref unsafe.Pointer) *PFNGLCLIENTWAITSYNCPROC { - return (*PFNGLCLIENTWAITSYNCPROC)(ref) -} - -//export PFNGLCLIENTWAITSYNCPROC334598FD -func PFNGLCLIENTWAITSYNCPROC334598FD() { - if pFNGLCLIENTWAITSYNCPROC334598FDFunc != nil { - pFNGLCLIENTWAITSYNCPROC334598FDFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCLIENTWAITSYNCPROC334598FDFunc PFNGLCLIENTWAITSYNCPROC - -func (x PFNGLCOLORMASKPROC) PassRef() (ref *C.PFNGLCOLORMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOLORMASKPROC4AE7DB24Func == nil { - pFNGLCOLORMASKPROC4AE7DB24Func = x - } - return (*C.PFNGLCOLORMASKPROC)(C.PFNGLCOLORMASKPROC_4ae7db24), nil -} - -func (x PFNGLCOLORMASKPROC) PassValue() (ref C.PFNGLCOLORMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOLORMASKPROC4AE7DB24Func == nil { - pFNGLCOLORMASKPROC4AE7DB24Func = x - } - return (C.PFNGLCOLORMASKPROC)(C.PFNGLCOLORMASKPROC_4ae7db24), nil -} - -func NewPFNGLCOLORMASKPROCRef(ref unsafe.Pointer) *PFNGLCOLORMASKPROC { - return (*PFNGLCOLORMASKPROC)(ref) -} - -//export PFNGLCOLORMASKPROC4AE7DB24 -func PFNGLCOLORMASKPROC4AE7DB24() { - if pFNGLCOLORMASKPROC4AE7DB24Func != nil { - pFNGLCOLORMASKPROC4AE7DB24Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOLORMASKPROC4AE7DB24Func PFNGLCOLORMASKPROC - -func (x PFNGLCOMPILESHADERPROC) PassRef() (ref *C.PFNGLCOMPILESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPILESHADERPROCF3CC75E5Func == nil { - pFNGLCOMPILESHADERPROCF3CC75E5Func = x - } - return (*C.PFNGLCOMPILESHADERPROC)(C.PFNGLCOMPILESHADERPROC_f3cc75e5), nil -} - -func (x PFNGLCOMPILESHADERPROC) PassValue() (ref C.PFNGLCOMPILESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPILESHADERPROCF3CC75E5Func == nil { - pFNGLCOMPILESHADERPROCF3CC75E5Func = x - } - return (C.PFNGLCOMPILESHADERPROC)(C.PFNGLCOMPILESHADERPROC_f3cc75e5), nil -} - -func NewPFNGLCOMPILESHADERPROCRef(ref unsafe.Pointer) *PFNGLCOMPILESHADERPROC { - return (*PFNGLCOMPILESHADERPROC)(ref) -} - -//export PFNGLCOMPILESHADERPROCF3CC75E5 -func PFNGLCOMPILESHADERPROCF3CC75E5() { - if pFNGLCOMPILESHADERPROCF3CC75E5Func != nil { - pFNGLCOMPILESHADERPROCF3CC75E5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOMPILESHADERPROCF3CC75E5Func PFNGLCOMPILESHADERPROC - -func (x PFNGLCOMPRESSEDTEXIMAGE2DPROC) PassRef() (ref *C.PFNGLCOMPRESSEDTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71Func == nil { - pFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71Func = x - } - return (*C.PFNGLCOMPRESSEDTEXIMAGE2DPROC)(C.PFNGLCOMPRESSEDTEXIMAGE2DPROC_11b9df71), nil -} - -func (x PFNGLCOMPRESSEDTEXIMAGE2DPROC) PassValue() (ref C.PFNGLCOMPRESSEDTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71Func == nil { - pFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71Func = x - } - return (C.PFNGLCOMPRESSEDTEXIMAGE2DPROC)(C.PFNGLCOMPRESSEDTEXIMAGE2DPROC_11b9df71), nil -} - -func NewPFNGLCOMPRESSEDTEXIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLCOMPRESSEDTEXIMAGE2DPROC { - return (*PFNGLCOMPRESSEDTEXIMAGE2DPROC)(ref) -} - -//export PFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71 -func PFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71() { - if pFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71Func != nil { - pFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOMPRESSEDTEXIMAGE2DPROC11B9DF71Func PFNGLCOMPRESSEDTEXIMAGE2DPROC - -func (x PFNGLCOMPRESSEDTEXIMAGE3DPROC) PassRef() (ref *C.PFNGLCOMPRESSEDTEXIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BDFunc == nil { - pFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BDFunc = x - } - return (*C.PFNGLCOMPRESSEDTEXIMAGE3DPROC)(C.PFNGLCOMPRESSEDTEXIMAGE3DPROC_77f8d9bd), nil -} - -func (x PFNGLCOMPRESSEDTEXIMAGE3DPROC) PassValue() (ref C.PFNGLCOMPRESSEDTEXIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BDFunc == nil { - pFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BDFunc = x - } - return (C.PFNGLCOMPRESSEDTEXIMAGE3DPROC)(C.PFNGLCOMPRESSEDTEXIMAGE3DPROC_77f8d9bd), nil -} - -func NewPFNGLCOMPRESSEDTEXIMAGE3DPROCRef(ref unsafe.Pointer) *PFNGLCOMPRESSEDTEXIMAGE3DPROC { - return (*PFNGLCOMPRESSEDTEXIMAGE3DPROC)(ref) -} - -//export PFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BD -func PFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BD() { - if pFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BDFunc != nil { - pFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BDFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOMPRESSEDTEXIMAGE3DPROC77F8D9BDFunc PFNGLCOMPRESSEDTEXIMAGE3DPROC - -func (x PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) PassRef() (ref *C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98Func == nil { - pFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98Func = x - } - return (*C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_0f7a8b98), nil -} - -func (x PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) PassValue() (ref C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98Func == nil { - pFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98Func = x - } - return (C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(C.PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_0f7a8b98), nil -} - -func NewPFNGLCOMPRESSEDTEXSUBIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC { - return (*PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(ref) -} - -//export PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98 -func PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98() { - if pFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98Func != nil { - pFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOMPRESSEDTEXSUBIMAGE2DPROC0F7A8B98Func PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC - -func (x PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) PassRef() (ref *C.PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69Func == nil { - pFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69Func = x - } - return (*C.PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(C.PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC_beb8cf69), nil -} - -func (x PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) PassValue() (ref C.PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69Func == nil { - pFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69Func = x - } - return (C.PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(C.PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC_beb8cf69), nil -} - -func NewPFNGLCOMPRESSEDTEXSUBIMAGE3DPROCRef(ref unsafe.Pointer) *PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC { - return (*PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(ref) -} - -//export PFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69 -func PFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69() { - if pFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69Func != nil { - pFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOMPRESSEDTEXSUBIMAGE3DPROCBEB8CF69Func PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC - -func (x PFNGLCOPYBUFFERSUBDATAPROC) PassRef() (ref *C.PFNGLCOPYBUFFERSUBDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYBUFFERSUBDATAPROC4F2EBB80Func == nil { - pFNGLCOPYBUFFERSUBDATAPROC4F2EBB80Func = x - } - return (*C.PFNGLCOPYBUFFERSUBDATAPROC)(C.PFNGLCOPYBUFFERSUBDATAPROC_4f2ebb80), nil -} - -func (x PFNGLCOPYBUFFERSUBDATAPROC) PassValue() (ref C.PFNGLCOPYBUFFERSUBDATAPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYBUFFERSUBDATAPROC4F2EBB80Func == nil { - pFNGLCOPYBUFFERSUBDATAPROC4F2EBB80Func = x - } - return (C.PFNGLCOPYBUFFERSUBDATAPROC)(C.PFNGLCOPYBUFFERSUBDATAPROC_4f2ebb80), nil -} - -func NewPFNGLCOPYBUFFERSUBDATAPROCRef(ref unsafe.Pointer) *PFNGLCOPYBUFFERSUBDATAPROC { - return (*PFNGLCOPYBUFFERSUBDATAPROC)(ref) -} - -//export PFNGLCOPYBUFFERSUBDATAPROC4F2EBB80 -func PFNGLCOPYBUFFERSUBDATAPROC4F2EBB80() { - if pFNGLCOPYBUFFERSUBDATAPROC4F2EBB80Func != nil { - pFNGLCOPYBUFFERSUBDATAPROC4F2EBB80Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOPYBUFFERSUBDATAPROC4F2EBB80Func PFNGLCOPYBUFFERSUBDATAPROC - -func (x PFNGLCOPYTEXIMAGE2DPROC) PassRef() (ref *C.PFNGLCOPYTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXIMAGE2DPROCD952FF06Func == nil { - pFNGLCOPYTEXIMAGE2DPROCD952FF06Func = x - } - return (*C.PFNGLCOPYTEXIMAGE2DPROC)(C.PFNGLCOPYTEXIMAGE2DPROC_d952ff06), nil -} - -func (x PFNGLCOPYTEXIMAGE2DPROC) PassValue() (ref C.PFNGLCOPYTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXIMAGE2DPROCD952FF06Func == nil { - pFNGLCOPYTEXIMAGE2DPROCD952FF06Func = x - } - return (C.PFNGLCOPYTEXIMAGE2DPROC)(C.PFNGLCOPYTEXIMAGE2DPROC_d952ff06), nil -} - -func NewPFNGLCOPYTEXIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLCOPYTEXIMAGE2DPROC { - return (*PFNGLCOPYTEXIMAGE2DPROC)(ref) -} - -//export PFNGLCOPYTEXIMAGE2DPROCD952FF06 -func PFNGLCOPYTEXIMAGE2DPROCD952FF06() { - if pFNGLCOPYTEXIMAGE2DPROCD952FF06Func != nil { - pFNGLCOPYTEXIMAGE2DPROCD952FF06Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOPYTEXIMAGE2DPROCD952FF06Func PFNGLCOPYTEXIMAGE2DPROC - -func (x PFNGLCOPYTEXSUBIMAGE2DPROC) PassRef() (ref *C.PFNGLCOPYTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9Func == nil { - pFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9Func = x - } - return (*C.PFNGLCOPYTEXSUBIMAGE2DPROC)(C.PFNGLCOPYTEXSUBIMAGE2DPROC_99d0f6f9), nil -} - -func (x PFNGLCOPYTEXSUBIMAGE2DPROC) PassValue() (ref C.PFNGLCOPYTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9Func == nil { - pFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9Func = x - } - return (C.PFNGLCOPYTEXSUBIMAGE2DPROC)(C.PFNGLCOPYTEXSUBIMAGE2DPROC_99d0f6f9), nil -} - -func NewPFNGLCOPYTEXSUBIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLCOPYTEXSUBIMAGE2DPROC { - return (*PFNGLCOPYTEXSUBIMAGE2DPROC)(ref) -} - -//export PFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9 -func PFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9() { - if pFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9Func != nil { - pFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOPYTEXSUBIMAGE2DPROC99D0F6F9Func PFNGLCOPYTEXSUBIMAGE2DPROC - -func (x PFNGLCOPYTEXSUBIMAGE3DPROC) PassRef() (ref *C.PFNGLCOPYTEXSUBIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1Func == nil { - pFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1Func = x - } - return (*C.PFNGLCOPYTEXSUBIMAGE3DPROC)(C.PFNGLCOPYTEXSUBIMAGE3DPROC_cbbaa8a1), nil -} - -func (x PFNGLCOPYTEXSUBIMAGE3DPROC) PassValue() (ref C.PFNGLCOPYTEXSUBIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1Func == nil { - pFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1Func = x - } - return (C.PFNGLCOPYTEXSUBIMAGE3DPROC)(C.PFNGLCOPYTEXSUBIMAGE3DPROC_cbbaa8a1), nil -} - -func NewPFNGLCOPYTEXSUBIMAGE3DPROCRef(ref unsafe.Pointer) *PFNGLCOPYTEXSUBIMAGE3DPROC { - return (*PFNGLCOPYTEXSUBIMAGE3DPROC)(ref) -} - -//export PFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1 -func PFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1() { - if pFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1Func != nil { - pFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCOPYTEXSUBIMAGE3DPROCCBBAA8A1Func PFNGLCOPYTEXSUBIMAGE3DPROC - -func (x PFNGLCREATEPROGRAMPROC) PassRef() (ref *C.PFNGLCREATEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCREATEPROGRAMPROCFBA42BD7Func == nil { - pFNGLCREATEPROGRAMPROCFBA42BD7Func = x - } - return (*C.PFNGLCREATEPROGRAMPROC)(C.PFNGLCREATEPROGRAMPROC_fba42bd7), nil -} - -func (x PFNGLCREATEPROGRAMPROC) PassValue() (ref C.PFNGLCREATEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCREATEPROGRAMPROCFBA42BD7Func == nil { - pFNGLCREATEPROGRAMPROCFBA42BD7Func = x - } - return (C.PFNGLCREATEPROGRAMPROC)(C.PFNGLCREATEPROGRAMPROC_fba42bd7), nil -} - -func NewPFNGLCREATEPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLCREATEPROGRAMPROC { - return (*PFNGLCREATEPROGRAMPROC)(ref) -} - -//export PFNGLCREATEPROGRAMPROCFBA42BD7 -func PFNGLCREATEPROGRAMPROCFBA42BD7() { - if pFNGLCREATEPROGRAMPROCFBA42BD7Func != nil { - pFNGLCREATEPROGRAMPROCFBA42BD7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCREATEPROGRAMPROCFBA42BD7Func PFNGLCREATEPROGRAMPROC - -func (x PFNGLCREATESHADERPROC) PassRef() (ref *C.PFNGLCREATESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCREATESHADERPROC5F191F08Func == nil { - pFNGLCREATESHADERPROC5F191F08Func = x - } - return (*C.PFNGLCREATESHADERPROC)(C.PFNGLCREATESHADERPROC_5f191f08), nil -} - -func (x PFNGLCREATESHADERPROC) PassValue() (ref C.PFNGLCREATESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCREATESHADERPROC5F191F08Func == nil { - pFNGLCREATESHADERPROC5F191F08Func = x - } - return (C.PFNGLCREATESHADERPROC)(C.PFNGLCREATESHADERPROC_5f191f08), nil -} - -func NewPFNGLCREATESHADERPROCRef(ref unsafe.Pointer) *PFNGLCREATESHADERPROC { - return (*PFNGLCREATESHADERPROC)(ref) -} - -//export PFNGLCREATESHADERPROC5F191F08 -func PFNGLCREATESHADERPROC5F191F08() { - if pFNGLCREATESHADERPROC5F191F08Func != nil { - pFNGLCREATESHADERPROC5F191F08Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCREATESHADERPROC5F191F08Func PFNGLCREATESHADERPROC - -func (x PFNGLCULLFACEPROC) PassRef() (ref *C.PFNGLCULLFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCULLFACEPROC89DA9A67Func == nil { - pFNGLCULLFACEPROC89DA9A67Func = x - } - return (*C.PFNGLCULLFACEPROC)(C.PFNGLCULLFACEPROC_89da9a67), nil -} - -func (x PFNGLCULLFACEPROC) PassValue() (ref C.PFNGLCULLFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLCULLFACEPROC89DA9A67Func == nil { - pFNGLCULLFACEPROC89DA9A67Func = x - } - return (C.PFNGLCULLFACEPROC)(C.PFNGLCULLFACEPROC_89da9a67), nil -} - -func NewPFNGLCULLFACEPROCRef(ref unsafe.Pointer) *PFNGLCULLFACEPROC { - return (*PFNGLCULLFACEPROC)(ref) -} - -//export PFNGLCULLFACEPROC89DA9A67 -func PFNGLCULLFACEPROC89DA9A67() { - if pFNGLCULLFACEPROC89DA9A67Func != nil { - pFNGLCULLFACEPROC89DA9A67Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLCULLFACEPROC89DA9A67Func PFNGLCULLFACEPROC - -func (x PFNGLDELETEBUFFERSPROC) PassRef() (ref *C.PFNGLDELETEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEBUFFERSPROCCB1C16CDFunc == nil { - pFNGLDELETEBUFFERSPROCCB1C16CDFunc = x - } - return (*C.PFNGLDELETEBUFFERSPROC)(C.PFNGLDELETEBUFFERSPROC_cb1c16cd), nil -} - -func (x PFNGLDELETEBUFFERSPROC) PassValue() (ref C.PFNGLDELETEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEBUFFERSPROCCB1C16CDFunc == nil { - pFNGLDELETEBUFFERSPROCCB1C16CDFunc = x - } - return (C.PFNGLDELETEBUFFERSPROC)(C.PFNGLDELETEBUFFERSPROC_cb1c16cd), nil -} - -func NewPFNGLDELETEBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLDELETEBUFFERSPROC { - return (*PFNGLDELETEBUFFERSPROC)(ref) -} - -//export PFNGLDELETEBUFFERSPROCCB1C16CD -func PFNGLDELETEBUFFERSPROCCB1C16CD() { - if pFNGLDELETEBUFFERSPROCCB1C16CDFunc != nil { - pFNGLDELETEBUFFERSPROCCB1C16CDFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETEBUFFERSPROCCB1C16CDFunc PFNGLDELETEBUFFERSPROC - -func (x PFNGLDELETEFRAMEBUFFERSPROC) PassRef() (ref *C.PFNGLDELETEFRAMEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEFRAMEBUFFERSPROC28ED84D7Func == nil { - pFNGLDELETEFRAMEBUFFERSPROC28ED84D7Func = x - } - return (*C.PFNGLDELETEFRAMEBUFFERSPROC)(C.PFNGLDELETEFRAMEBUFFERSPROC_28ed84d7), nil -} - -func (x PFNGLDELETEFRAMEBUFFERSPROC) PassValue() (ref C.PFNGLDELETEFRAMEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEFRAMEBUFFERSPROC28ED84D7Func == nil { - pFNGLDELETEFRAMEBUFFERSPROC28ED84D7Func = x - } - return (C.PFNGLDELETEFRAMEBUFFERSPROC)(C.PFNGLDELETEFRAMEBUFFERSPROC_28ed84d7), nil -} - -func NewPFNGLDELETEFRAMEBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLDELETEFRAMEBUFFERSPROC { - return (*PFNGLDELETEFRAMEBUFFERSPROC)(ref) -} - -//export PFNGLDELETEFRAMEBUFFERSPROC28ED84D7 -func PFNGLDELETEFRAMEBUFFERSPROC28ED84D7() { - if pFNGLDELETEFRAMEBUFFERSPROC28ED84D7Func != nil { - pFNGLDELETEFRAMEBUFFERSPROC28ED84D7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETEFRAMEBUFFERSPROC28ED84D7Func PFNGLDELETEFRAMEBUFFERSPROC - -func (x PFNGLDELETEPROGRAMPROC) PassRef() (ref *C.PFNGLDELETEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEPROGRAMPROCF9AF89B0Func == nil { - pFNGLDELETEPROGRAMPROCF9AF89B0Func = x - } - return (*C.PFNGLDELETEPROGRAMPROC)(C.PFNGLDELETEPROGRAMPROC_f9af89b0), nil -} - -func (x PFNGLDELETEPROGRAMPROC) PassValue() (ref C.PFNGLDELETEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEPROGRAMPROCF9AF89B0Func == nil { - pFNGLDELETEPROGRAMPROCF9AF89B0Func = x - } - return (C.PFNGLDELETEPROGRAMPROC)(C.PFNGLDELETEPROGRAMPROC_f9af89b0), nil -} - -func NewPFNGLDELETEPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLDELETEPROGRAMPROC { - return (*PFNGLDELETEPROGRAMPROC)(ref) -} - -//export PFNGLDELETEPROGRAMPROCF9AF89B0 -func PFNGLDELETEPROGRAMPROCF9AF89B0() { - if pFNGLDELETEPROGRAMPROCF9AF89B0Func != nil { - pFNGLDELETEPROGRAMPROCF9AF89B0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETEPROGRAMPROCF9AF89B0Func PFNGLDELETEPROGRAMPROC - -func (x PFNGLDELETEQUERIESPROC) PassRef() (ref *C.PFNGLDELETEQUERIESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEQUERIESPROCBA0B7B84Func == nil { - pFNGLDELETEQUERIESPROCBA0B7B84Func = x - } - return (*C.PFNGLDELETEQUERIESPROC)(C.PFNGLDELETEQUERIESPROC_ba0b7b84), nil -} - -func (x PFNGLDELETEQUERIESPROC) PassValue() (ref C.PFNGLDELETEQUERIESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEQUERIESPROCBA0B7B84Func == nil { - pFNGLDELETEQUERIESPROCBA0B7B84Func = x - } - return (C.PFNGLDELETEQUERIESPROC)(C.PFNGLDELETEQUERIESPROC_ba0b7b84), nil -} - -func NewPFNGLDELETEQUERIESPROCRef(ref unsafe.Pointer) *PFNGLDELETEQUERIESPROC { - return (*PFNGLDELETEQUERIESPROC)(ref) -} - -//export PFNGLDELETEQUERIESPROCBA0B7B84 -func PFNGLDELETEQUERIESPROCBA0B7B84() { - if pFNGLDELETEQUERIESPROCBA0B7B84Func != nil { - pFNGLDELETEQUERIESPROCBA0B7B84Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETEQUERIESPROCBA0B7B84Func PFNGLDELETEQUERIESPROC - -func (x PFNGLDELETERENDERBUFFERSPROC) PassRef() (ref *C.PFNGLDELETERENDERBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETERENDERBUFFERSPROC8E10B4C0Func == nil { - pFNGLDELETERENDERBUFFERSPROC8E10B4C0Func = x - } - return (*C.PFNGLDELETERENDERBUFFERSPROC)(C.PFNGLDELETERENDERBUFFERSPROC_8e10b4c0), nil -} - -func (x PFNGLDELETERENDERBUFFERSPROC) PassValue() (ref C.PFNGLDELETERENDERBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETERENDERBUFFERSPROC8E10B4C0Func == nil { - pFNGLDELETERENDERBUFFERSPROC8E10B4C0Func = x - } - return (C.PFNGLDELETERENDERBUFFERSPROC)(C.PFNGLDELETERENDERBUFFERSPROC_8e10b4c0), nil -} - -func NewPFNGLDELETERENDERBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLDELETERENDERBUFFERSPROC { - return (*PFNGLDELETERENDERBUFFERSPROC)(ref) -} - -//export PFNGLDELETERENDERBUFFERSPROC8E10B4C0 -func PFNGLDELETERENDERBUFFERSPROC8E10B4C0() { - if pFNGLDELETERENDERBUFFERSPROC8E10B4C0Func != nil { - pFNGLDELETERENDERBUFFERSPROC8E10B4C0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETERENDERBUFFERSPROC8E10B4C0Func PFNGLDELETERENDERBUFFERSPROC - -func (x PFNGLDELETESAMPLERSPROC) PassRef() (ref *C.PFNGLDELETESAMPLERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETESAMPLERSPROC70F19E4AFunc == nil { - pFNGLDELETESAMPLERSPROC70F19E4AFunc = x - } - return (*C.PFNGLDELETESAMPLERSPROC)(C.PFNGLDELETESAMPLERSPROC_70f19e4a), nil -} - -func (x PFNGLDELETESAMPLERSPROC) PassValue() (ref C.PFNGLDELETESAMPLERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETESAMPLERSPROC70F19E4AFunc == nil { - pFNGLDELETESAMPLERSPROC70F19E4AFunc = x - } - return (C.PFNGLDELETESAMPLERSPROC)(C.PFNGLDELETESAMPLERSPROC_70f19e4a), nil -} - -func NewPFNGLDELETESAMPLERSPROCRef(ref unsafe.Pointer) *PFNGLDELETESAMPLERSPROC { - return (*PFNGLDELETESAMPLERSPROC)(ref) -} - -//export PFNGLDELETESAMPLERSPROC70F19E4A -func PFNGLDELETESAMPLERSPROC70F19E4A() { - if pFNGLDELETESAMPLERSPROC70F19E4AFunc != nil { - pFNGLDELETESAMPLERSPROC70F19E4AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETESAMPLERSPROC70F19E4AFunc PFNGLDELETESAMPLERSPROC - -func (x PFNGLDELETESHADERPROC) PassRef() (ref *C.PFNGLDELETESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETESHADERPROC37948131Func == nil { - pFNGLDELETESHADERPROC37948131Func = x - } - return (*C.PFNGLDELETESHADERPROC)(C.PFNGLDELETESHADERPROC_37948131), nil -} - -func (x PFNGLDELETESHADERPROC) PassValue() (ref C.PFNGLDELETESHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETESHADERPROC37948131Func == nil { - pFNGLDELETESHADERPROC37948131Func = x - } - return (C.PFNGLDELETESHADERPROC)(C.PFNGLDELETESHADERPROC_37948131), nil -} - -func NewPFNGLDELETESHADERPROCRef(ref unsafe.Pointer) *PFNGLDELETESHADERPROC { - return (*PFNGLDELETESHADERPROC)(ref) -} - -//export PFNGLDELETESHADERPROC37948131 -func PFNGLDELETESHADERPROC37948131() { - if pFNGLDELETESHADERPROC37948131Func != nil { - pFNGLDELETESHADERPROC37948131Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETESHADERPROC37948131Func PFNGLDELETESHADERPROC - -func (x PFNGLDELETESYNCPROC) PassRef() (ref *C.PFNGLDELETESYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETESYNCPROC5184C34EFunc == nil { - pFNGLDELETESYNCPROC5184C34EFunc = x - } - return (*C.PFNGLDELETESYNCPROC)(C.PFNGLDELETESYNCPROC_5184c34e), nil -} - -func (x PFNGLDELETESYNCPROC) PassValue() (ref C.PFNGLDELETESYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETESYNCPROC5184C34EFunc == nil { - pFNGLDELETESYNCPROC5184C34EFunc = x - } - return (C.PFNGLDELETESYNCPROC)(C.PFNGLDELETESYNCPROC_5184c34e), nil -} - -func NewPFNGLDELETESYNCPROCRef(ref unsafe.Pointer) *PFNGLDELETESYNCPROC { - return (*PFNGLDELETESYNCPROC)(ref) -} - -//export PFNGLDELETESYNCPROC5184C34E -func PFNGLDELETESYNCPROC5184C34E() { - if pFNGLDELETESYNCPROC5184C34EFunc != nil { - pFNGLDELETESYNCPROC5184C34EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETESYNCPROC5184C34EFunc PFNGLDELETESYNCPROC - -func (x PFNGLDELETETEXTURESPROC) PassRef() (ref *C.PFNGLDELETETEXTURESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETETEXTURESPROC6B199E47Func == nil { - pFNGLDELETETEXTURESPROC6B199E47Func = x - } - return (*C.PFNGLDELETETEXTURESPROC)(C.PFNGLDELETETEXTURESPROC_6b199e47), nil -} - -func (x PFNGLDELETETEXTURESPROC) PassValue() (ref C.PFNGLDELETETEXTURESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETETEXTURESPROC6B199E47Func == nil { - pFNGLDELETETEXTURESPROC6B199E47Func = x - } - return (C.PFNGLDELETETEXTURESPROC)(C.PFNGLDELETETEXTURESPROC_6b199e47), nil -} - -func NewPFNGLDELETETEXTURESPROCRef(ref unsafe.Pointer) *PFNGLDELETETEXTURESPROC { - return (*PFNGLDELETETEXTURESPROC)(ref) -} - -//export PFNGLDELETETEXTURESPROC6B199E47 -func PFNGLDELETETEXTURESPROC6B199E47() { - if pFNGLDELETETEXTURESPROC6B199E47Func != nil { - pFNGLDELETETEXTURESPROC6B199E47Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETETEXTURESPROC6B199E47Func PFNGLDELETETEXTURESPROC - -func (x PFNGLDELETETRANSFORMFEEDBACKSPROC) PassRef() (ref *C.PFNGLDELETETRANSFORMFEEDBACKSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37DFunc == nil { - pFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37DFunc = x - } - return (*C.PFNGLDELETETRANSFORMFEEDBACKSPROC)(C.PFNGLDELETETRANSFORMFEEDBACKSPROC_c63fe37d), nil -} - -func (x PFNGLDELETETRANSFORMFEEDBACKSPROC) PassValue() (ref C.PFNGLDELETETRANSFORMFEEDBACKSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37DFunc == nil { - pFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37DFunc = x - } - return (C.PFNGLDELETETRANSFORMFEEDBACKSPROC)(C.PFNGLDELETETRANSFORMFEEDBACKSPROC_c63fe37d), nil -} - -func NewPFNGLDELETETRANSFORMFEEDBACKSPROCRef(ref unsafe.Pointer) *PFNGLDELETETRANSFORMFEEDBACKSPROC { - return (*PFNGLDELETETRANSFORMFEEDBACKSPROC)(ref) -} - -//export PFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37D -func PFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37D() { - if pFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37DFunc != nil { - pFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETETRANSFORMFEEDBACKSPROCC63FE37DFunc PFNGLDELETETRANSFORMFEEDBACKSPROC - -func (x PFNGLDELETEVERTEXARRAYSPROC) PassRef() (ref *C.PFNGLDELETEVERTEXARRAYSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEVERTEXARRAYSPROC95B8B72AFunc == nil { - pFNGLDELETEVERTEXARRAYSPROC95B8B72AFunc = x - } - return (*C.PFNGLDELETEVERTEXARRAYSPROC)(C.PFNGLDELETEVERTEXARRAYSPROC_95b8b72a), nil -} - -func (x PFNGLDELETEVERTEXARRAYSPROC) PassValue() (ref C.PFNGLDELETEVERTEXARRAYSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDELETEVERTEXARRAYSPROC95B8B72AFunc == nil { - pFNGLDELETEVERTEXARRAYSPROC95B8B72AFunc = x - } - return (C.PFNGLDELETEVERTEXARRAYSPROC)(C.PFNGLDELETEVERTEXARRAYSPROC_95b8b72a), nil -} - -func NewPFNGLDELETEVERTEXARRAYSPROCRef(ref unsafe.Pointer) *PFNGLDELETEVERTEXARRAYSPROC { - return (*PFNGLDELETEVERTEXARRAYSPROC)(ref) -} - -//export PFNGLDELETEVERTEXARRAYSPROC95B8B72A -func PFNGLDELETEVERTEXARRAYSPROC95B8B72A() { - if pFNGLDELETEVERTEXARRAYSPROC95B8B72AFunc != nil { - pFNGLDELETEVERTEXARRAYSPROC95B8B72AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDELETEVERTEXARRAYSPROC95B8B72AFunc PFNGLDELETEVERTEXARRAYSPROC - -func (x PFNGLDEPTHFUNCPROC) PassRef() (ref *C.PFNGLDEPTHFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHFUNCPROC465DA9EDFunc == nil { - pFNGLDEPTHFUNCPROC465DA9EDFunc = x - } - return (*C.PFNGLDEPTHFUNCPROC)(C.PFNGLDEPTHFUNCPROC_465da9ed), nil -} - -func (x PFNGLDEPTHFUNCPROC) PassValue() (ref C.PFNGLDEPTHFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHFUNCPROC465DA9EDFunc == nil { - pFNGLDEPTHFUNCPROC465DA9EDFunc = x - } - return (C.PFNGLDEPTHFUNCPROC)(C.PFNGLDEPTHFUNCPROC_465da9ed), nil -} - -func NewPFNGLDEPTHFUNCPROCRef(ref unsafe.Pointer) *PFNGLDEPTHFUNCPROC { - return (*PFNGLDEPTHFUNCPROC)(ref) -} - -//export PFNGLDEPTHFUNCPROC465DA9ED -func PFNGLDEPTHFUNCPROC465DA9ED() { - if pFNGLDEPTHFUNCPROC465DA9EDFunc != nil { - pFNGLDEPTHFUNCPROC465DA9EDFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDEPTHFUNCPROC465DA9EDFunc PFNGLDEPTHFUNCPROC - -func (x PFNGLDEPTHMASKPROC) PassRef() (ref *C.PFNGLDEPTHMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHMASKPROC31A797A3Func == nil { - pFNGLDEPTHMASKPROC31A797A3Func = x - } - return (*C.PFNGLDEPTHMASKPROC)(C.PFNGLDEPTHMASKPROC_31a797a3), nil -} - -func (x PFNGLDEPTHMASKPROC) PassValue() (ref C.PFNGLDEPTHMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHMASKPROC31A797A3Func == nil { - pFNGLDEPTHMASKPROC31A797A3Func = x - } - return (C.PFNGLDEPTHMASKPROC)(C.PFNGLDEPTHMASKPROC_31a797a3), nil -} - -func NewPFNGLDEPTHMASKPROCRef(ref unsafe.Pointer) *PFNGLDEPTHMASKPROC { - return (*PFNGLDEPTHMASKPROC)(ref) -} - -//export PFNGLDEPTHMASKPROC31A797A3 -func PFNGLDEPTHMASKPROC31A797A3() { - if pFNGLDEPTHMASKPROC31A797A3Func != nil { - pFNGLDEPTHMASKPROC31A797A3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDEPTHMASKPROC31A797A3Func PFNGLDEPTHMASKPROC - -func (x PFNGLDEPTHRANGEFPROC) PassRef() (ref *C.PFNGLDEPTHRANGEFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHRANGEFPROC899F0D08Func == nil { - pFNGLDEPTHRANGEFPROC899F0D08Func = x - } - return (*C.PFNGLDEPTHRANGEFPROC)(C.PFNGLDEPTHRANGEFPROC_899f0d08), nil -} - -func (x PFNGLDEPTHRANGEFPROC) PassValue() (ref C.PFNGLDEPTHRANGEFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDEPTHRANGEFPROC899F0D08Func == nil { - pFNGLDEPTHRANGEFPROC899F0D08Func = x - } - return (C.PFNGLDEPTHRANGEFPROC)(C.PFNGLDEPTHRANGEFPROC_899f0d08), nil -} - -func NewPFNGLDEPTHRANGEFPROCRef(ref unsafe.Pointer) *PFNGLDEPTHRANGEFPROC { - return (*PFNGLDEPTHRANGEFPROC)(ref) -} - -//export PFNGLDEPTHRANGEFPROC899F0D08 -func PFNGLDEPTHRANGEFPROC899F0D08() { - if pFNGLDEPTHRANGEFPROC899F0D08Func != nil { - pFNGLDEPTHRANGEFPROC899F0D08Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDEPTHRANGEFPROC899F0D08Func PFNGLDEPTHRANGEFPROC - -func (x PFNGLDETACHSHADERPROC) PassRef() (ref *C.PFNGLDETACHSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDETACHSHADERPROCCF86DFEAFunc == nil { - pFNGLDETACHSHADERPROCCF86DFEAFunc = x - } - return (*C.PFNGLDETACHSHADERPROC)(C.PFNGLDETACHSHADERPROC_cf86dfea), nil -} - -func (x PFNGLDETACHSHADERPROC) PassValue() (ref C.PFNGLDETACHSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDETACHSHADERPROCCF86DFEAFunc == nil { - pFNGLDETACHSHADERPROCCF86DFEAFunc = x - } - return (C.PFNGLDETACHSHADERPROC)(C.PFNGLDETACHSHADERPROC_cf86dfea), nil -} - -func NewPFNGLDETACHSHADERPROCRef(ref unsafe.Pointer) *PFNGLDETACHSHADERPROC { - return (*PFNGLDETACHSHADERPROC)(ref) -} - -//export PFNGLDETACHSHADERPROCCF86DFEA -func PFNGLDETACHSHADERPROCCF86DFEA() { - if pFNGLDETACHSHADERPROCCF86DFEAFunc != nil { - pFNGLDETACHSHADERPROCCF86DFEAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDETACHSHADERPROCCF86DFEAFunc PFNGLDETACHSHADERPROC - -func (x PFNGLDISABLEPROC) PassRef() (ref *C.PFNGLDISABLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDISABLEPROC2349A992Func == nil { - pFNGLDISABLEPROC2349A992Func = x - } - return (*C.PFNGLDISABLEPROC)(C.PFNGLDISABLEPROC_2349a992), nil -} - -func (x PFNGLDISABLEPROC) PassValue() (ref C.PFNGLDISABLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDISABLEPROC2349A992Func == nil { - pFNGLDISABLEPROC2349A992Func = x - } - return (C.PFNGLDISABLEPROC)(C.PFNGLDISABLEPROC_2349a992), nil -} - -func NewPFNGLDISABLEPROCRef(ref unsafe.Pointer) *PFNGLDISABLEPROC { - return (*PFNGLDISABLEPROC)(ref) -} - -//export PFNGLDISABLEPROC2349A992 -func PFNGLDISABLEPROC2349A992() { - if pFNGLDISABLEPROC2349A992Func != nil { - pFNGLDISABLEPROC2349A992Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDISABLEPROC2349A992Func PFNGLDISABLEPROC - -func (x PFNGLDISABLEVERTEXATTRIBARRAYPROC) PassRef() (ref *C.PFNGLDISABLEVERTEXATTRIBARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23Func == nil { - pFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23Func = x - } - return (*C.PFNGLDISABLEVERTEXATTRIBARRAYPROC)(C.PFNGLDISABLEVERTEXATTRIBARRAYPROC_7a86dd23), nil -} - -func (x PFNGLDISABLEVERTEXATTRIBARRAYPROC) PassValue() (ref C.PFNGLDISABLEVERTEXATTRIBARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23Func == nil { - pFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23Func = x - } - return (C.PFNGLDISABLEVERTEXATTRIBARRAYPROC)(C.PFNGLDISABLEVERTEXATTRIBARRAYPROC_7a86dd23), nil -} - -func NewPFNGLDISABLEVERTEXATTRIBARRAYPROCRef(ref unsafe.Pointer) *PFNGLDISABLEVERTEXATTRIBARRAYPROC { - return (*PFNGLDISABLEVERTEXATTRIBARRAYPROC)(ref) -} - -//export PFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23 -func PFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23() { - if pFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23Func != nil { - pFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDISABLEVERTEXATTRIBARRAYPROC7A86DD23Func PFNGLDISABLEVERTEXATTRIBARRAYPROC - -func (x PFNGLDRAWARRAYSINSTANCEDPROC) PassRef() (ref *C.PFNGLDRAWARRAYSINSTANCEDPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3Func == nil { - pFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3Func = x - } - return (*C.PFNGLDRAWARRAYSINSTANCEDPROC)(C.PFNGLDRAWARRAYSINSTANCEDPROC_0f4fbca3), nil -} - -func (x PFNGLDRAWARRAYSINSTANCEDPROC) PassValue() (ref C.PFNGLDRAWARRAYSINSTANCEDPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3Func == nil { - pFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3Func = x - } - return (C.PFNGLDRAWARRAYSINSTANCEDPROC)(C.PFNGLDRAWARRAYSINSTANCEDPROC_0f4fbca3), nil -} - -func NewPFNGLDRAWARRAYSINSTANCEDPROCRef(ref unsafe.Pointer) *PFNGLDRAWARRAYSINSTANCEDPROC { - return (*PFNGLDRAWARRAYSINSTANCEDPROC)(ref) -} - -//export PFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3 -func PFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3() { - if pFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3Func != nil { - pFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDRAWARRAYSINSTANCEDPROC0F4FBCA3Func PFNGLDRAWARRAYSINSTANCEDPROC - -func (x PFNGLDRAWARRAYSPROC) PassRef() (ref *C.PFNGLDRAWARRAYSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWARRAYSPROCD5C7AC18Func == nil { - pFNGLDRAWARRAYSPROCD5C7AC18Func = x - } - return (*C.PFNGLDRAWARRAYSPROC)(C.PFNGLDRAWARRAYSPROC_d5c7ac18), nil -} - -func (x PFNGLDRAWARRAYSPROC) PassValue() (ref C.PFNGLDRAWARRAYSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWARRAYSPROCD5C7AC18Func == nil { - pFNGLDRAWARRAYSPROCD5C7AC18Func = x - } - return (C.PFNGLDRAWARRAYSPROC)(C.PFNGLDRAWARRAYSPROC_d5c7ac18), nil -} - -func NewPFNGLDRAWARRAYSPROCRef(ref unsafe.Pointer) *PFNGLDRAWARRAYSPROC { - return (*PFNGLDRAWARRAYSPROC)(ref) -} - -//export PFNGLDRAWARRAYSPROCD5C7AC18 -func PFNGLDRAWARRAYSPROCD5C7AC18() { - if pFNGLDRAWARRAYSPROCD5C7AC18Func != nil { - pFNGLDRAWARRAYSPROCD5C7AC18Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDRAWARRAYSPROCD5C7AC18Func PFNGLDRAWARRAYSPROC - -func (x PFNGLDRAWBUFFERSPROC) PassRef() (ref *C.PFNGLDRAWBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWBUFFERSPROCDBCC9007Func == nil { - pFNGLDRAWBUFFERSPROCDBCC9007Func = x - } - return (*C.PFNGLDRAWBUFFERSPROC)(C.PFNGLDRAWBUFFERSPROC_dbcc9007), nil -} - -func (x PFNGLDRAWBUFFERSPROC) PassValue() (ref C.PFNGLDRAWBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWBUFFERSPROCDBCC9007Func == nil { - pFNGLDRAWBUFFERSPROCDBCC9007Func = x - } - return (C.PFNGLDRAWBUFFERSPROC)(C.PFNGLDRAWBUFFERSPROC_dbcc9007), nil -} - -func NewPFNGLDRAWBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLDRAWBUFFERSPROC { - return (*PFNGLDRAWBUFFERSPROC)(ref) -} - -//export PFNGLDRAWBUFFERSPROCDBCC9007 -func PFNGLDRAWBUFFERSPROCDBCC9007() { - if pFNGLDRAWBUFFERSPROCDBCC9007Func != nil { - pFNGLDRAWBUFFERSPROCDBCC9007Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDRAWBUFFERSPROCDBCC9007Func PFNGLDRAWBUFFERSPROC - -func (x PFNGLDRAWELEMENTSINSTANCEDPROC) PassRef() (ref *C.PFNGLDRAWELEMENTSINSTANCEDPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7EFunc == nil { - pFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7EFunc = x - } - return (*C.PFNGLDRAWELEMENTSINSTANCEDPROC)(C.PFNGLDRAWELEMENTSINSTANCEDPROC_7b7ceb7e), nil -} - -func (x PFNGLDRAWELEMENTSINSTANCEDPROC) PassValue() (ref C.PFNGLDRAWELEMENTSINSTANCEDPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7EFunc == nil { - pFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7EFunc = x - } - return (C.PFNGLDRAWELEMENTSINSTANCEDPROC)(C.PFNGLDRAWELEMENTSINSTANCEDPROC_7b7ceb7e), nil -} - -func NewPFNGLDRAWELEMENTSINSTANCEDPROCRef(ref unsafe.Pointer) *PFNGLDRAWELEMENTSINSTANCEDPROC { - return (*PFNGLDRAWELEMENTSINSTANCEDPROC)(ref) -} - -//export PFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7E -func PFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7E() { - if pFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7EFunc != nil { - pFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDRAWELEMENTSINSTANCEDPROC7B7CEB7EFunc PFNGLDRAWELEMENTSINSTANCEDPROC - -func (x PFNGLDRAWELEMENTSPROC) PassRef() (ref *C.PFNGLDRAWELEMENTSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWELEMENTSPROC13247097Func == nil { - pFNGLDRAWELEMENTSPROC13247097Func = x - } - return (*C.PFNGLDRAWELEMENTSPROC)(C.PFNGLDRAWELEMENTSPROC_13247097), nil -} - -func (x PFNGLDRAWELEMENTSPROC) PassValue() (ref C.PFNGLDRAWELEMENTSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWELEMENTSPROC13247097Func == nil { - pFNGLDRAWELEMENTSPROC13247097Func = x - } - return (C.PFNGLDRAWELEMENTSPROC)(C.PFNGLDRAWELEMENTSPROC_13247097), nil -} - -func NewPFNGLDRAWELEMENTSPROCRef(ref unsafe.Pointer) *PFNGLDRAWELEMENTSPROC { - return (*PFNGLDRAWELEMENTSPROC)(ref) -} - -//export PFNGLDRAWELEMENTSPROC13247097 -func PFNGLDRAWELEMENTSPROC13247097() { - if pFNGLDRAWELEMENTSPROC13247097Func != nil { - pFNGLDRAWELEMENTSPROC13247097Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDRAWELEMENTSPROC13247097Func PFNGLDRAWELEMENTSPROC - -func (x PFNGLDRAWRANGEELEMENTSPROC) PassRef() (ref *C.PFNGLDRAWRANGEELEMENTSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWRANGEELEMENTSPROCB12188B5Func == nil { - pFNGLDRAWRANGEELEMENTSPROCB12188B5Func = x - } - return (*C.PFNGLDRAWRANGEELEMENTSPROC)(C.PFNGLDRAWRANGEELEMENTSPROC_b12188b5), nil -} - -func (x PFNGLDRAWRANGEELEMENTSPROC) PassValue() (ref C.PFNGLDRAWRANGEELEMENTSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLDRAWRANGEELEMENTSPROCB12188B5Func == nil { - pFNGLDRAWRANGEELEMENTSPROCB12188B5Func = x - } - return (C.PFNGLDRAWRANGEELEMENTSPROC)(C.PFNGLDRAWRANGEELEMENTSPROC_b12188b5), nil -} - -func NewPFNGLDRAWRANGEELEMENTSPROCRef(ref unsafe.Pointer) *PFNGLDRAWRANGEELEMENTSPROC { - return (*PFNGLDRAWRANGEELEMENTSPROC)(ref) -} - -//export PFNGLDRAWRANGEELEMENTSPROCB12188B5 -func PFNGLDRAWRANGEELEMENTSPROCB12188B5() { - if pFNGLDRAWRANGEELEMENTSPROCB12188B5Func != nil { - pFNGLDRAWRANGEELEMENTSPROCB12188B5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLDRAWRANGEELEMENTSPROCB12188B5Func PFNGLDRAWRANGEELEMENTSPROC - -func (x PFNGLENABLEPROC) PassRef() (ref *C.PFNGLENABLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENABLEPROCC545119AFunc == nil { - pFNGLENABLEPROCC545119AFunc = x - } - return (*C.PFNGLENABLEPROC)(C.PFNGLENABLEPROC_c545119a), nil -} - -func (x PFNGLENABLEPROC) PassValue() (ref C.PFNGLENABLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENABLEPROCC545119AFunc == nil { - pFNGLENABLEPROCC545119AFunc = x - } - return (C.PFNGLENABLEPROC)(C.PFNGLENABLEPROC_c545119a), nil -} - -func NewPFNGLENABLEPROCRef(ref unsafe.Pointer) *PFNGLENABLEPROC { - return (*PFNGLENABLEPROC)(ref) -} - -//export PFNGLENABLEPROCC545119A -func PFNGLENABLEPROCC545119A() { - if pFNGLENABLEPROCC545119AFunc != nil { - pFNGLENABLEPROCC545119AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLENABLEPROCC545119AFunc PFNGLENABLEPROC - -func (x PFNGLENABLEVERTEXATTRIBARRAYPROC) PassRef() (ref *C.PFNGLENABLEVERTEXATTRIBARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2Func == nil { - pFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2Func = x - } - return (*C.PFNGLENABLEVERTEXATTRIBARRAYPROC)(C.PFNGLENABLEVERTEXATTRIBARRAYPROC_af1424a2), nil -} - -func (x PFNGLENABLEVERTEXATTRIBARRAYPROC) PassValue() (ref C.PFNGLENABLEVERTEXATTRIBARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2Func == nil { - pFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2Func = x - } - return (C.PFNGLENABLEVERTEXATTRIBARRAYPROC)(C.PFNGLENABLEVERTEXATTRIBARRAYPROC_af1424a2), nil -} - -func NewPFNGLENABLEVERTEXATTRIBARRAYPROCRef(ref unsafe.Pointer) *PFNGLENABLEVERTEXATTRIBARRAYPROC { - return (*PFNGLENABLEVERTEXATTRIBARRAYPROC)(ref) -} - -//export PFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2 -func PFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2() { - if pFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2Func != nil { - pFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLENABLEVERTEXATTRIBARRAYPROCAF1424A2Func PFNGLENABLEVERTEXATTRIBARRAYPROC - -func (x PFNGLENDQUERYPROC) PassRef() (ref *C.PFNGLENDQUERYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENDQUERYPROC198BF2B2Func == nil { - pFNGLENDQUERYPROC198BF2B2Func = x - } - return (*C.PFNGLENDQUERYPROC)(C.PFNGLENDQUERYPROC_198bf2b2), nil -} - -func (x PFNGLENDQUERYPROC) PassValue() (ref C.PFNGLENDQUERYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENDQUERYPROC198BF2B2Func == nil { - pFNGLENDQUERYPROC198BF2B2Func = x - } - return (C.PFNGLENDQUERYPROC)(C.PFNGLENDQUERYPROC_198bf2b2), nil -} - -func NewPFNGLENDQUERYPROCRef(ref unsafe.Pointer) *PFNGLENDQUERYPROC { - return (*PFNGLENDQUERYPROC)(ref) -} - -//export PFNGLENDQUERYPROC198BF2B2 -func PFNGLENDQUERYPROC198BF2B2() { - if pFNGLENDQUERYPROC198BF2B2Func != nil { - pFNGLENDQUERYPROC198BF2B2Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLENDQUERYPROC198BF2B2Func PFNGLENDQUERYPROC - -func (x PFNGLENDTRANSFORMFEEDBACKPROC) PassRef() (ref *C.PFNGLENDTRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENDTRANSFORMFEEDBACKPROC38335E93Func == nil { - pFNGLENDTRANSFORMFEEDBACKPROC38335E93Func = x - } - return (*C.PFNGLENDTRANSFORMFEEDBACKPROC)(C.PFNGLENDTRANSFORMFEEDBACKPROC_38335e93), nil -} - -func (x PFNGLENDTRANSFORMFEEDBACKPROC) PassValue() (ref C.PFNGLENDTRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLENDTRANSFORMFEEDBACKPROC38335E93Func == nil { - pFNGLENDTRANSFORMFEEDBACKPROC38335E93Func = x - } - return (C.PFNGLENDTRANSFORMFEEDBACKPROC)(C.PFNGLENDTRANSFORMFEEDBACKPROC_38335e93), nil -} - -func NewPFNGLENDTRANSFORMFEEDBACKPROCRef(ref unsafe.Pointer) *PFNGLENDTRANSFORMFEEDBACKPROC { - return (*PFNGLENDTRANSFORMFEEDBACKPROC)(ref) -} - -//export PFNGLENDTRANSFORMFEEDBACKPROC38335E93 -func PFNGLENDTRANSFORMFEEDBACKPROC38335E93() { - if pFNGLENDTRANSFORMFEEDBACKPROC38335E93Func != nil { - pFNGLENDTRANSFORMFEEDBACKPROC38335E93Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLENDTRANSFORMFEEDBACKPROC38335E93Func PFNGLENDTRANSFORMFEEDBACKPROC - -func (x PFNGLFENCESYNCPROC) PassRef() (ref *C.PFNGLFENCESYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFENCESYNCPROC497552B6Func == nil { - pFNGLFENCESYNCPROC497552B6Func = x - } - return (*C.PFNGLFENCESYNCPROC)(C.PFNGLFENCESYNCPROC_497552b6), nil -} - -func (x PFNGLFENCESYNCPROC) PassValue() (ref C.PFNGLFENCESYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFENCESYNCPROC497552B6Func == nil { - pFNGLFENCESYNCPROC497552B6Func = x - } - return (C.PFNGLFENCESYNCPROC)(C.PFNGLFENCESYNCPROC_497552b6), nil -} - -func NewPFNGLFENCESYNCPROCRef(ref unsafe.Pointer) *PFNGLFENCESYNCPROC { - return (*PFNGLFENCESYNCPROC)(ref) -} - -//export PFNGLFENCESYNCPROC497552B6 -func PFNGLFENCESYNCPROC497552B6() { - if pFNGLFENCESYNCPROC497552B6Func != nil { - pFNGLFENCESYNCPROC497552B6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFENCESYNCPROC497552B6Func PFNGLFENCESYNCPROC - -func (x PFNGLFINISHPROC) PassRef() (ref *C.PFNGLFINISHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFINISHPROC0BE044D4Func == nil { - pFNGLFINISHPROC0BE044D4Func = x - } - return (*C.PFNGLFINISHPROC)(C.PFNGLFINISHPROC_0be044d4), nil -} - -func (x PFNGLFINISHPROC) PassValue() (ref C.PFNGLFINISHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFINISHPROC0BE044D4Func == nil { - pFNGLFINISHPROC0BE044D4Func = x - } - return (C.PFNGLFINISHPROC)(C.PFNGLFINISHPROC_0be044d4), nil -} - -func NewPFNGLFINISHPROCRef(ref unsafe.Pointer) *PFNGLFINISHPROC { - return (*PFNGLFINISHPROC)(ref) -} - -//export PFNGLFINISHPROC0BE044D4 -func PFNGLFINISHPROC0BE044D4() { - if pFNGLFINISHPROC0BE044D4Func != nil { - pFNGLFINISHPROC0BE044D4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFINISHPROC0BE044D4Func PFNGLFINISHPROC - -func (x PFNGLFLUSHMAPPEDBUFFERRANGEPROC) PassRef() (ref *C.PFNGLFLUSHMAPPEDBUFFERRANGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDEFunc == nil { - pFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDEFunc = x - } - return (*C.PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(C.PFNGLFLUSHMAPPEDBUFFERRANGEPROC_0023bfde), nil -} - -func (x PFNGLFLUSHMAPPEDBUFFERRANGEPROC) PassValue() (ref C.PFNGLFLUSHMAPPEDBUFFERRANGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDEFunc == nil { - pFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDEFunc = x - } - return (C.PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(C.PFNGLFLUSHMAPPEDBUFFERRANGEPROC_0023bfde), nil -} - -func NewPFNGLFLUSHMAPPEDBUFFERRANGEPROCRef(ref unsafe.Pointer) *PFNGLFLUSHMAPPEDBUFFERRANGEPROC { - return (*PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(ref) -} - -//export PFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDE -func PFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDE() { - if pFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDEFunc != nil { - pFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDEFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFLUSHMAPPEDBUFFERRANGEPROC0023BFDEFunc PFNGLFLUSHMAPPEDBUFFERRANGEPROC - -func (x PFNGLFLUSHPROC) PassRef() (ref *C.PFNGLFLUSHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFLUSHPROCFE2E0200Func == nil { - pFNGLFLUSHPROCFE2E0200Func = x - } - return (*C.PFNGLFLUSHPROC)(C.PFNGLFLUSHPROC_fe2e0200), nil -} - -func (x PFNGLFLUSHPROC) PassValue() (ref C.PFNGLFLUSHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFLUSHPROCFE2E0200Func == nil { - pFNGLFLUSHPROCFE2E0200Func = x - } - return (C.PFNGLFLUSHPROC)(C.PFNGLFLUSHPROC_fe2e0200), nil -} - -func NewPFNGLFLUSHPROCRef(ref unsafe.Pointer) *PFNGLFLUSHPROC { - return (*PFNGLFLUSHPROC)(ref) -} - -//export PFNGLFLUSHPROCFE2E0200 -func PFNGLFLUSHPROCFE2E0200() { - if pFNGLFLUSHPROCFE2E0200Func != nil { - pFNGLFLUSHPROCFE2E0200Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFLUSHPROCFE2E0200Func PFNGLFLUSHPROC - -func (x PFNGLFRAMEBUFFERRENDERBUFFERPROC) PassRef() (ref *C.PFNGLFRAMEBUFFERRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714Func == nil { - pFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714Func = x - } - return (*C.PFNGLFRAMEBUFFERRENDERBUFFERPROC)(C.PFNGLFRAMEBUFFERRENDERBUFFERPROC_931cd714), nil -} - -func (x PFNGLFRAMEBUFFERRENDERBUFFERPROC) PassValue() (ref C.PFNGLFRAMEBUFFERRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714Func == nil { - pFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714Func = x - } - return (C.PFNGLFRAMEBUFFERRENDERBUFFERPROC)(C.PFNGLFRAMEBUFFERRENDERBUFFERPROC_931cd714), nil -} - -func NewPFNGLFRAMEBUFFERRENDERBUFFERPROCRef(ref unsafe.Pointer) *PFNGLFRAMEBUFFERRENDERBUFFERPROC { - return (*PFNGLFRAMEBUFFERRENDERBUFFERPROC)(ref) -} - -//export PFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714 -func PFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714() { - if pFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714Func != nil { - pFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFRAMEBUFFERRENDERBUFFERPROC931CD714Func PFNGLFRAMEBUFFERRENDERBUFFERPROC - -func (x PFNGLFRAMEBUFFERTEXTURE2DPROC) PassRef() (ref *C.PFNGLFRAMEBUFFERTEXTURE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33Func == nil { - pFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33Func = x - } - return (*C.PFNGLFRAMEBUFFERTEXTURE2DPROC)(C.PFNGLFRAMEBUFFERTEXTURE2DPROC_f9765a33), nil -} - -func (x PFNGLFRAMEBUFFERTEXTURE2DPROC) PassValue() (ref C.PFNGLFRAMEBUFFERTEXTURE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33Func == nil { - pFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33Func = x - } - return (C.PFNGLFRAMEBUFFERTEXTURE2DPROC)(C.PFNGLFRAMEBUFFERTEXTURE2DPROC_f9765a33), nil -} - -func NewPFNGLFRAMEBUFFERTEXTURE2DPROCRef(ref unsafe.Pointer) *PFNGLFRAMEBUFFERTEXTURE2DPROC { - return (*PFNGLFRAMEBUFFERTEXTURE2DPROC)(ref) -} - -//export PFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33 -func PFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33() { - if pFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33Func != nil { - pFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFRAMEBUFFERTEXTURE2DPROCF9765A33Func PFNGLFRAMEBUFFERTEXTURE2DPROC - -func (x PFNGLFRAMEBUFFERTEXTURELAYERPROC) PassRef() (ref *C.PFNGLFRAMEBUFFERTEXTURELAYERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6Func == nil { - pFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6Func = x - } - return (*C.PFNGLFRAMEBUFFERTEXTURELAYERPROC)(C.PFNGLFRAMEBUFFERTEXTURELAYERPROC_fe303df6), nil -} - -func (x PFNGLFRAMEBUFFERTEXTURELAYERPROC) PassValue() (ref C.PFNGLFRAMEBUFFERTEXTURELAYERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6Func == nil { - pFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6Func = x - } - return (C.PFNGLFRAMEBUFFERTEXTURELAYERPROC)(C.PFNGLFRAMEBUFFERTEXTURELAYERPROC_fe303df6), nil -} - -func NewPFNGLFRAMEBUFFERTEXTURELAYERPROCRef(ref unsafe.Pointer) *PFNGLFRAMEBUFFERTEXTURELAYERPROC { - return (*PFNGLFRAMEBUFFERTEXTURELAYERPROC)(ref) -} - -//export PFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6 -func PFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6() { - if pFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6Func != nil { - pFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFRAMEBUFFERTEXTURELAYERPROCFE303DF6Func PFNGLFRAMEBUFFERTEXTURELAYERPROC - -func (x PFNGLFRONTFACEPROC) PassRef() (ref *C.PFNGLFRONTFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRONTFACEPROCB2FF6969Func == nil { - pFNGLFRONTFACEPROCB2FF6969Func = x - } - return (*C.PFNGLFRONTFACEPROC)(C.PFNGLFRONTFACEPROC_b2ff6969), nil -} - -func (x PFNGLFRONTFACEPROC) PassValue() (ref C.PFNGLFRONTFACEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLFRONTFACEPROCB2FF6969Func == nil { - pFNGLFRONTFACEPROCB2FF6969Func = x - } - return (C.PFNGLFRONTFACEPROC)(C.PFNGLFRONTFACEPROC_b2ff6969), nil -} - -func NewPFNGLFRONTFACEPROCRef(ref unsafe.Pointer) *PFNGLFRONTFACEPROC { - return (*PFNGLFRONTFACEPROC)(ref) -} - -//export PFNGLFRONTFACEPROCB2FF6969 -func PFNGLFRONTFACEPROCB2FF6969() { - if pFNGLFRONTFACEPROCB2FF6969Func != nil { - pFNGLFRONTFACEPROCB2FF6969Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLFRONTFACEPROCB2FF6969Func PFNGLFRONTFACEPROC - -func (x PFNGLGENBUFFERSPROC) PassRef() (ref *C.PFNGLGENBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENBUFFERSPROC552EFB23Func == nil { - pFNGLGENBUFFERSPROC552EFB23Func = x - } - return (*C.PFNGLGENBUFFERSPROC)(C.PFNGLGENBUFFERSPROC_552efb23), nil -} - -func (x PFNGLGENBUFFERSPROC) PassValue() (ref C.PFNGLGENBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENBUFFERSPROC552EFB23Func == nil { - pFNGLGENBUFFERSPROC552EFB23Func = x - } - return (C.PFNGLGENBUFFERSPROC)(C.PFNGLGENBUFFERSPROC_552efb23), nil -} - -func NewPFNGLGENBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLGENBUFFERSPROC { - return (*PFNGLGENBUFFERSPROC)(ref) -} - -//export PFNGLGENBUFFERSPROC552EFB23 -func PFNGLGENBUFFERSPROC552EFB23() { - if pFNGLGENBUFFERSPROC552EFB23Func != nil { - pFNGLGENBUFFERSPROC552EFB23Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENBUFFERSPROC552EFB23Func PFNGLGENBUFFERSPROC - -func (x PFNGLGENERATEMIPMAPPROC) PassRef() (ref *C.PFNGLGENERATEMIPMAPPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENERATEMIPMAPPROCF27998E1Func == nil { - pFNGLGENERATEMIPMAPPROCF27998E1Func = x - } - return (*C.PFNGLGENERATEMIPMAPPROC)(C.PFNGLGENERATEMIPMAPPROC_f27998e1), nil -} - -func (x PFNGLGENERATEMIPMAPPROC) PassValue() (ref C.PFNGLGENERATEMIPMAPPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENERATEMIPMAPPROCF27998E1Func == nil { - pFNGLGENERATEMIPMAPPROCF27998E1Func = x - } - return (C.PFNGLGENERATEMIPMAPPROC)(C.PFNGLGENERATEMIPMAPPROC_f27998e1), nil -} - -func NewPFNGLGENERATEMIPMAPPROCRef(ref unsafe.Pointer) *PFNGLGENERATEMIPMAPPROC { - return (*PFNGLGENERATEMIPMAPPROC)(ref) -} - -//export PFNGLGENERATEMIPMAPPROCF27998E1 -func PFNGLGENERATEMIPMAPPROCF27998E1() { - if pFNGLGENERATEMIPMAPPROCF27998E1Func != nil { - pFNGLGENERATEMIPMAPPROCF27998E1Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENERATEMIPMAPPROCF27998E1Func PFNGLGENERATEMIPMAPPROC - -func (x PFNGLGENFRAMEBUFFERSPROC) PassRef() (ref *C.PFNGLGENFRAMEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENFRAMEBUFFERSPROC5D476BC5Func == nil { - pFNGLGENFRAMEBUFFERSPROC5D476BC5Func = x - } - return (*C.PFNGLGENFRAMEBUFFERSPROC)(C.PFNGLGENFRAMEBUFFERSPROC_5d476bc5), nil -} - -func (x PFNGLGENFRAMEBUFFERSPROC) PassValue() (ref C.PFNGLGENFRAMEBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENFRAMEBUFFERSPROC5D476BC5Func == nil { - pFNGLGENFRAMEBUFFERSPROC5D476BC5Func = x - } - return (C.PFNGLGENFRAMEBUFFERSPROC)(C.PFNGLGENFRAMEBUFFERSPROC_5d476bc5), nil -} - -func NewPFNGLGENFRAMEBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLGENFRAMEBUFFERSPROC { - return (*PFNGLGENFRAMEBUFFERSPROC)(ref) -} - -//export PFNGLGENFRAMEBUFFERSPROC5D476BC5 -func PFNGLGENFRAMEBUFFERSPROC5D476BC5() { - if pFNGLGENFRAMEBUFFERSPROC5D476BC5Func != nil { - pFNGLGENFRAMEBUFFERSPROC5D476BC5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENFRAMEBUFFERSPROC5D476BC5Func PFNGLGENFRAMEBUFFERSPROC - -func (x PFNGLGENQUERIESPROC) PassRef() (ref *C.PFNGLGENQUERIESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENQUERIESPROC8EBE6C09Func == nil { - pFNGLGENQUERIESPROC8EBE6C09Func = x - } - return (*C.PFNGLGENQUERIESPROC)(C.PFNGLGENQUERIESPROC_8ebe6c09), nil -} - -func (x PFNGLGENQUERIESPROC) PassValue() (ref C.PFNGLGENQUERIESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENQUERIESPROC8EBE6C09Func == nil { - pFNGLGENQUERIESPROC8EBE6C09Func = x - } - return (C.PFNGLGENQUERIESPROC)(C.PFNGLGENQUERIESPROC_8ebe6c09), nil -} - -func NewPFNGLGENQUERIESPROCRef(ref unsafe.Pointer) *PFNGLGENQUERIESPROC { - return (*PFNGLGENQUERIESPROC)(ref) -} - -//export PFNGLGENQUERIESPROC8EBE6C09 -func PFNGLGENQUERIESPROC8EBE6C09() { - if pFNGLGENQUERIESPROC8EBE6C09Func != nil { - pFNGLGENQUERIESPROC8EBE6C09Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENQUERIESPROC8EBE6C09Func PFNGLGENQUERIESPROC - -func (x PFNGLGENRENDERBUFFERSPROC) PassRef() (ref *C.PFNGLGENRENDERBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENRENDERBUFFERSPROC2A770542Func == nil { - pFNGLGENRENDERBUFFERSPROC2A770542Func = x - } - return (*C.PFNGLGENRENDERBUFFERSPROC)(C.PFNGLGENRENDERBUFFERSPROC_2a770542), nil -} - -func (x PFNGLGENRENDERBUFFERSPROC) PassValue() (ref C.PFNGLGENRENDERBUFFERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENRENDERBUFFERSPROC2A770542Func == nil { - pFNGLGENRENDERBUFFERSPROC2A770542Func = x - } - return (C.PFNGLGENRENDERBUFFERSPROC)(C.PFNGLGENRENDERBUFFERSPROC_2a770542), nil -} - -func NewPFNGLGENRENDERBUFFERSPROCRef(ref unsafe.Pointer) *PFNGLGENRENDERBUFFERSPROC { - return (*PFNGLGENRENDERBUFFERSPROC)(ref) -} - -//export PFNGLGENRENDERBUFFERSPROC2A770542 -func PFNGLGENRENDERBUFFERSPROC2A770542() { - if pFNGLGENRENDERBUFFERSPROC2A770542Func != nil { - pFNGLGENRENDERBUFFERSPROC2A770542Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENRENDERBUFFERSPROC2A770542Func PFNGLGENRENDERBUFFERSPROC - -func (x PFNGLGENSAMPLERSPROC) PassRef() (ref *C.PFNGLGENSAMPLERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENSAMPLERSPROCF03D9955Func == nil { - pFNGLGENSAMPLERSPROCF03D9955Func = x - } - return (*C.PFNGLGENSAMPLERSPROC)(C.PFNGLGENSAMPLERSPROC_f03d9955), nil -} - -func (x PFNGLGENSAMPLERSPROC) PassValue() (ref C.PFNGLGENSAMPLERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENSAMPLERSPROCF03D9955Func == nil { - pFNGLGENSAMPLERSPROCF03D9955Func = x - } - return (C.PFNGLGENSAMPLERSPROC)(C.PFNGLGENSAMPLERSPROC_f03d9955), nil -} - -func NewPFNGLGENSAMPLERSPROCRef(ref unsafe.Pointer) *PFNGLGENSAMPLERSPROC { - return (*PFNGLGENSAMPLERSPROC)(ref) -} - -//export PFNGLGENSAMPLERSPROCF03D9955 -func PFNGLGENSAMPLERSPROCF03D9955() { - if pFNGLGENSAMPLERSPROCF03D9955Func != nil { - pFNGLGENSAMPLERSPROCF03D9955Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENSAMPLERSPROCF03D9955Func PFNGLGENSAMPLERSPROC - -func (x PFNGLGENTEXTURESPROC) PassRef() (ref *C.PFNGLGENTEXTURESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENTEXTURESPROC42D92669Func == nil { - pFNGLGENTEXTURESPROC42D92669Func = x - } - return (*C.PFNGLGENTEXTURESPROC)(C.PFNGLGENTEXTURESPROC_42d92669), nil -} - -func (x PFNGLGENTEXTURESPROC) PassValue() (ref C.PFNGLGENTEXTURESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENTEXTURESPROC42D92669Func == nil { - pFNGLGENTEXTURESPROC42D92669Func = x - } - return (C.PFNGLGENTEXTURESPROC)(C.PFNGLGENTEXTURESPROC_42d92669), nil -} - -func NewPFNGLGENTEXTURESPROCRef(ref unsafe.Pointer) *PFNGLGENTEXTURESPROC { - return (*PFNGLGENTEXTURESPROC)(ref) -} - -//export PFNGLGENTEXTURESPROC42D92669 -func PFNGLGENTEXTURESPROC42D92669() { - if pFNGLGENTEXTURESPROC42D92669Func != nil { - pFNGLGENTEXTURESPROC42D92669Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENTEXTURESPROC42D92669Func PFNGLGENTEXTURESPROC - -func (x PFNGLGENTRANSFORMFEEDBACKSPROC) PassRef() (ref *C.PFNGLGENTRANSFORMFEEDBACKSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENTRANSFORMFEEDBACKSPROCAE39D84BFunc == nil { - pFNGLGENTRANSFORMFEEDBACKSPROCAE39D84BFunc = x - } - return (*C.PFNGLGENTRANSFORMFEEDBACKSPROC)(C.PFNGLGENTRANSFORMFEEDBACKSPROC_ae39d84b), nil -} - -func (x PFNGLGENTRANSFORMFEEDBACKSPROC) PassValue() (ref C.PFNGLGENTRANSFORMFEEDBACKSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENTRANSFORMFEEDBACKSPROCAE39D84BFunc == nil { - pFNGLGENTRANSFORMFEEDBACKSPROCAE39D84BFunc = x - } - return (C.PFNGLGENTRANSFORMFEEDBACKSPROC)(C.PFNGLGENTRANSFORMFEEDBACKSPROC_ae39d84b), nil -} - -func NewPFNGLGENTRANSFORMFEEDBACKSPROCRef(ref unsafe.Pointer) *PFNGLGENTRANSFORMFEEDBACKSPROC { - return (*PFNGLGENTRANSFORMFEEDBACKSPROC)(ref) -} - -//export PFNGLGENTRANSFORMFEEDBACKSPROCAE39D84B -func PFNGLGENTRANSFORMFEEDBACKSPROCAE39D84B() { - if pFNGLGENTRANSFORMFEEDBACKSPROCAE39D84BFunc != nil { - pFNGLGENTRANSFORMFEEDBACKSPROCAE39D84BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENTRANSFORMFEEDBACKSPROCAE39D84BFunc PFNGLGENTRANSFORMFEEDBACKSPROC - -func (x PFNGLGENVERTEXARRAYSPROC) PassRef() (ref *C.PFNGLGENVERTEXARRAYSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENVERTEXARRAYSPROCB6B2D522Func == nil { - pFNGLGENVERTEXARRAYSPROCB6B2D522Func = x - } - return (*C.PFNGLGENVERTEXARRAYSPROC)(C.PFNGLGENVERTEXARRAYSPROC_b6b2d522), nil -} - -func (x PFNGLGENVERTEXARRAYSPROC) PassValue() (ref C.PFNGLGENVERTEXARRAYSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGENVERTEXARRAYSPROCB6B2D522Func == nil { - pFNGLGENVERTEXARRAYSPROCB6B2D522Func = x - } - return (C.PFNGLGENVERTEXARRAYSPROC)(C.PFNGLGENVERTEXARRAYSPROC_b6b2d522), nil -} - -func NewPFNGLGENVERTEXARRAYSPROCRef(ref unsafe.Pointer) *PFNGLGENVERTEXARRAYSPROC { - return (*PFNGLGENVERTEXARRAYSPROC)(ref) -} - -//export PFNGLGENVERTEXARRAYSPROCB6B2D522 -func PFNGLGENVERTEXARRAYSPROCB6B2D522() { - if pFNGLGENVERTEXARRAYSPROCB6B2D522Func != nil { - pFNGLGENVERTEXARRAYSPROCB6B2D522Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGENVERTEXARRAYSPROCB6B2D522Func PFNGLGENVERTEXARRAYSPROC - -func (x PFNGLGETACTIVEATTRIBPROC) PassRef() (ref *C.PFNGLGETACTIVEATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEATTRIBPROCD343CF3BFunc == nil { - pFNGLGETACTIVEATTRIBPROCD343CF3BFunc = x - } - return (*C.PFNGLGETACTIVEATTRIBPROC)(C.PFNGLGETACTIVEATTRIBPROC_d343cf3b), nil -} - -func (x PFNGLGETACTIVEATTRIBPROC) PassValue() (ref C.PFNGLGETACTIVEATTRIBPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEATTRIBPROCD343CF3BFunc == nil { - pFNGLGETACTIVEATTRIBPROCD343CF3BFunc = x - } - return (C.PFNGLGETACTIVEATTRIBPROC)(C.PFNGLGETACTIVEATTRIBPROC_d343cf3b), nil -} - -func NewPFNGLGETACTIVEATTRIBPROCRef(ref unsafe.Pointer) *PFNGLGETACTIVEATTRIBPROC { - return (*PFNGLGETACTIVEATTRIBPROC)(ref) -} - -//export PFNGLGETACTIVEATTRIBPROCD343CF3B -func PFNGLGETACTIVEATTRIBPROCD343CF3B() { - if pFNGLGETACTIVEATTRIBPROCD343CF3BFunc != nil { - pFNGLGETACTIVEATTRIBPROCD343CF3BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETACTIVEATTRIBPROCD343CF3BFunc PFNGLGETACTIVEATTRIBPROC - -func (x PFNGLGETACTIVEUNIFORMBLOCKIVPROC) PassRef() (ref *C.PFNGLGETACTIVEUNIFORMBLOCKIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5Func == nil { - pFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5Func = x - } - return (*C.PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(C.PFNGLGETACTIVEUNIFORMBLOCKIVPROC_b4be84e5), nil -} - -func (x PFNGLGETACTIVEUNIFORMBLOCKIVPROC) PassValue() (ref C.PFNGLGETACTIVEUNIFORMBLOCKIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5Func == nil { - pFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5Func = x - } - return (C.PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(C.PFNGLGETACTIVEUNIFORMBLOCKIVPROC_b4be84e5), nil -} - -func NewPFNGLGETACTIVEUNIFORMBLOCKIVPROCRef(ref unsafe.Pointer) *PFNGLGETACTIVEUNIFORMBLOCKIVPROC { - return (*PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(ref) -} - -//export PFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5 -func PFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5() { - if pFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5Func != nil { - pFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETACTIVEUNIFORMBLOCKIVPROCB4BE84E5Func PFNGLGETACTIVEUNIFORMBLOCKIVPROC - -func (x PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) PassRef() (ref *C.PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7Func == nil { - pFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7Func = x - } - return (*C.PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(C.PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC_e2c8c8e7), nil -} - -func (x PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) PassValue() (ref C.PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7Func == nil { - pFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7Func = x - } - return (C.PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(C.PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC_e2c8c8e7), nil -} - -func NewPFNGLGETACTIVEUNIFORMBLOCKNAMEPROCRef(ref unsafe.Pointer) *PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC { - return (*PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(ref) -} - -//export PFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7 -func PFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7() { - if pFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7Func != nil { - pFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETACTIVEUNIFORMBLOCKNAMEPROCE2C8C8E7Func PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC - -func (x PFNGLGETACTIVEUNIFORMPROC) PassRef() (ref *C.PFNGLGETACTIVEUNIFORMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMPROC557D1389Func == nil { - pFNGLGETACTIVEUNIFORMPROC557D1389Func = x - } - return (*C.PFNGLGETACTIVEUNIFORMPROC)(C.PFNGLGETACTIVEUNIFORMPROC_557d1389), nil -} - -func (x PFNGLGETACTIVEUNIFORMPROC) PassValue() (ref C.PFNGLGETACTIVEUNIFORMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMPROC557D1389Func == nil { - pFNGLGETACTIVEUNIFORMPROC557D1389Func = x - } - return (C.PFNGLGETACTIVEUNIFORMPROC)(C.PFNGLGETACTIVEUNIFORMPROC_557d1389), nil -} - -func NewPFNGLGETACTIVEUNIFORMPROCRef(ref unsafe.Pointer) *PFNGLGETACTIVEUNIFORMPROC { - return (*PFNGLGETACTIVEUNIFORMPROC)(ref) -} - -//export PFNGLGETACTIVEUNIFORMPROC557D1389 -func PFNGLGETACTIVEUNIFORMPROC557D1389() { - if pFNGLGETACTIVEUNIFORMPROC557D1389Func != nil { - pFNGLGETACTIVEUNIFORMPROC557D1389Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETACTIVEUNIFORMPROC557D1389Func PFNGLGETACTIVEUNIFORMPROC - -func (x PFNGLGETACTIVEUNIFORMSIVPROC) PassRef() (ref *C.PFNGLGETACTIVEUNIFORMSIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMSIVPROCD8BBE80AFunc == nil { - pFNGLGETACTIVEUNIFORMSIVPROCD8BBE80AFunc = x - } - return (*C.PFNGLGETACTIVEUNIFORMSIVPROC)(C.PFNGLGETACTIVEUNIFORMSIVPROC_d8bbe80a), nil -} - -func (x PFNGLGETACTIVEUNIFORMSIVPROC) PassValue() (ref C.PFNGLGETACTIVEUNIFORMSIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETACTIVEUNIFORMSIVPROCD8BBE80AFunc == nil { - pFNGLGETACTIVEUNIFORMSIVPROCD8BBE80AFunc = x - } - return (C.PFNGLGETACTIVEUNIFORMSIVPROC)(C.PFNGLGETACTIVEUNIFORMSIVPROC_d8bbe80a), nil -} - -func NewPFNGLGETACTIVEUNIFORMSIVPROCRef(ref unsafe.Pointer) *PFNGLGETACTIVEUNIFORMSIVPROC { - return (*PFNGLGETACTIVEUNIFORMSIVPROC)(ref) -} - -//export PFNGLGETACTIVEUNIFORMSIVPROCD8BBE80A -func PFNGLGETACTIVEUNIFORMSIVPROCD8BBE80A() { - if pFNGLGETACTIVEUNIFORMSIVPROCD8BBE80AFunc != nil { - pFNGLGETACTIVEUNIFORMSIVPROCD8BBE80AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETACTIVEUNIFORMSIVPROCD8BBE80AFunc PFNGLGETACTIVEUNIFORMSIVPROC - -func (x PFNGLGETATTACHEDSHADERSPROC) PassRef() (ref *C.PFNGLGETATTACHEDSHADERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETATTACHEDSHADERSPROC26D002C5Func == nil { - pFNGLGETATTACHEDSHADERSPROC26D002C5Func = x - } - return (*C.PFNGLGETATTACHEDSHADERSPROC)(C.PFNGLGETATTACHEDSHADERSPROC_26d002c5), nil -} - -func (x PFNGLGETATTACHEDSHADERSPROC) PassValue() (ref C.PFNGLGETATTACHEDSHADERSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETATTACHEDSHADERSPROC26D002C5Func == nil { - pFNGLGETATTACHEDSHADERSPROC26D002C5Func = x - } - return (C.PFNGLGETATTACHEDSHADERSPROC)(C.PFNGLGETATTACHEDSHADERSPROC_26d002c5), nil -} - -func NewPFNGLGETATTACHEDSHADERSPROCRef(ref unsafe.Pointer) *PFNGLGETATTACHEDSHADERSPROC { - return (*PFNGLGETATTACHEDSHADERSPROC)(ref) -} - -//export PFNGLGETATTACHEDSHADERSPROC26D002C5 -func PFNGLGETATTACHEDSHADERSPROC26D002C5() { - if pFNGLGETATTACHEDSHADERSPROC26D002C5Func != nil { - pFNGLGETATTACHEDSHADERSPROC26D002C5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETATTACHEDSHADERSPROC26D002C5Func PFNGLGETATTACHEDSHADERSPROC - -func (x PFNGLGETATTRIBLOCATIONPROC) PassRef() (ref *C.PFNGLGETATTRIBLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETATTRIBLOCATIONPROC5DE605A0Func == nil { - pFNGLGETATTRIBLOCATIONPROC5DE605A0Func = x - } - return (*C.PFNGLGETATTRIBLOCATIONPROC)(C.PFNGLGETATTRIBLOCATIONPROC_5de605a0), nil -} - -func (x PFNGLGETATTRIBLOCATIONPROC) PassValue() (ref C.PFNGLGETATTRIBLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETATTRIBLOCATIONPROC5DE605A0Func == nil { - pFNGLGETATTRIBLOCATIONPROC5DE605A0Func = x - } - return (C.PFNGLGETATTRIBLOCATIONPROC)(C.PFNGLGETATTRIBLOCATIONPROC_5de605a0), nil -} - -func NewPFNGLGETATTRIBLOCATIONPROCRef(ref unsafe.Pointer) *PFNGLGETATTRIBLOCATIONPROC { - return (*PFNGLGETATTRIBLOCATIONPROC)(ref) -} - -//export PFNGLGETATTRIBLOCATIONPROC5DE605A0 -func PFNGLGETATTRIBLOCATIONPROC5DE605A0() { - if pFNGLGETATTRIBLOCATIONPROC5DE605A0Func != nil { - pFNGLGETATTRIBLOCATIONPROC5DE605A0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETATTRIBLOCATIONPROC5DE605A0Func PFNGLGETATTRIBLOCATIONPROC - -func (x PFNGLGETBOOLEANVPROC) PassRef() (ref *C.PFNGLGETBOOLEANVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBOOLEANVPROC28CCC4B8Func == nil { - pFNGLGETBOOLEANVPROC28CCC4B8Func = x - } - return (*C.PFNGLGETBOOLEANVPROC)(C.PFNGLGETBOOLEANVPROC_28ccc4b8), nil -} - -func (x PFNGLGETBOOLEANVPROC) PassValue() (ref C.PFNGLGETBOOLEANVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBOOLEANVPROC28CCC4B8Func == nil { - pFNGLGETBOOLEANVPROC28CCC4B8Func = x - } - return (C.PFNGLGETBOOLEANVPROC)(C.PFNGLGETBOOLEANVPROC_28ccc4b8), nil -} - -func NewPFNGLGETBOOLEANVPROCRef(ref unsafe.Pointer) *PFNGLGETBOOLEANVPROC { - return (*PFNGLGETBOOLEANVPROC)(ref) -} - -//export PFNGLGETBOOLEANVPROC28CCC4B8 -func PFNGLGETBOOLEANVPROC28CCC4B8() { - if pFNGLGETBOOLEANVPROC28CCC4B8Func != nil { - pFNGLGETBOOLEANVPROC28CCC4B8Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETBOOLEANVPROC28CCC4B8Func PFNGLGETBOOLEANVPROC - -func (x PFNGLGETBUFFERPARAMETERI64VPROC) PassRef() (ref *C.PFNGLGETBUFFERPARAMETERI64VPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBUFFERPARAMETERI64VPROCC241E392Func == nil { - pFNGLGETBUFFERPARAMETERI64VPROCC241E392Func = x - } - return (*C.PFNGLGETBUFFERPARAMETERI64VPROC)(C.PFNGLGETBUFFERPARAMETERI64VPROC_c241e392), nil -} - -func (x PFNGLGETBUFFERPARAMETERI64VPROC) PassValue() (ref C.PFNGLGETBUFFERPARAMETERI64VPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBUFFERPARAMETERI64VPROCC241E392Func == nil { - pFNGLGETBUFFERPARAMETERI64VPROCC241E392Func = x - } - return (C.PFNGLGETBUFFERPARAMETERI64VPROC)(C.PFNGLGETBUFFERPARAMETERI64VPROC_c241e392), nil -} - -func NewPFNGLGETBUFFERPARAMETERI64VPROCRef(ref unsafe.Pointer) *PFNGLGETBUFFERPARAMETERI64VPROC { - return (*PFNGLGETBUFFERPARAMETERI64VPROC)(ref) -} - -//export PFNGLGETBUFFERPARAMETERI64VPROCC241E392 -func PFNGLGETBUFFERPARAMETERI64VPROCC241E392() { - if pFNGLGETBUFFERPARAMETERI64VPROCC241E392Func != nil { - pFNGLGETBUFFERPARAMETERI64VPROCC241E392Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETBUFFERPARAMETERI64VPROCC241E392Func PFNGLGETBUFFERPARAMETERI64VPROC - -func (x PFNGLGETBUFFERPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETBUFFERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBUFFERPARAMETERIVPROC763D4976Func == nil { - pFNGLGETBUFFERPARAMETERIVPROC763D4976Func = x - } - return (*C.PFNGLGETBUFFERPARAMETERIVPROC)(C.PFNGLGETBUFFERPARAMETERIVPROC_763d4976), nil -} - -func (x PFNGLGETBUFFERPARAMETERIVPROC) PassValue() (ref C.PFNGLGETBUFFERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBUFFERPARAMETERIVPROC763D4976Func == nil { - pFNGLGETBUFFERPARAMETERIVPROC763D4976Func = x - } - return (C.PFNGLGETBUFFERPARAMETERIVPROC)(C.PFNGLGETBUFFERPARAMETERIVPROC_763d4976), nil -} - -func NewPFNGLGETBUFFERPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETBUFFERPARAMETERIVPROC { - return (*PFNGLGETBUFFERPARAMETERIVPROC)(ref) -} - -//export PFNGLGETBUFFERPARAMETERIVPROC763D4976 -func PFNGLGETBUFFERPARAMETERIVPROC763D4976() { - if pFNGLGETBUFFERPARAMETERIVPROC763D4976Func != nil { - pFNGLGETBUFFERPARAMETERIVPROC763D4976Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETBUFFERPARAMETERIVPROC763D4976Func PFNGLGETBUFFERPARAMETERIVPROC - -func (x PFNGLGETBUFFERPOINTERVPROC) PassRef() (ref *C.PFNGLGETBUFFERPOINTERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBUFFERPOINTERVPROC59DB26B7Func == nil { - pFNGLGETBUFFERPOINTERVPROC59DB26B7Func = x - } - return (*C.PFNGLGETBUFFERPOINTERVPROC)(C.PFNGLGETBUFFERPOINTERVPROC_59db26b7), nil -} - -func (x PFNGLGETBUFFERPOINTERVPROC) PassValue() (ref C.PFNGLGETBUFFERPOINTERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETBUFFERPOINTERVPROC59DB26B7Func == nil { - pFNGLGETBUFFERPOINTERVPROC59DB26B7Func = x - } - return (C.PFNGLGETBUFFERPOINTERVPROC)(C.PFNGLGETBUFFERPOINTERVPROC_59db26b7), nil -} - -func NewPFNGLGETBUFFERPOINTERVPROCRef(ref unsafe.Pointer) *PFNGLGETBUFFERPOINTERVPROC { - return (*PFNGLGETBUFFERPOINTERVPROC)(ref) -} - -//export PFNGLGETBUFFERPOINTERVPROC59DB26B7 -func PFNGLGETBUFFERPOINTERVPROC59DB26B7() { - if pFNGLGETBUFFERPOINTERVPROC59DB26B7Func != nil { - pFNGLGETBUFFERPOINTERVPROC59DB26B7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETBUFFERPOINTERVPROC59DB26B7Func PFNGLGETBUFFERPOINTERVPROC - -func (x PFNGLGETERRORPROC) PassRef() (ref *C.PFNGLGETERRORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETERRORPROC4EE43BB4Func == nil { - pFNGLGETERRORPROC4EE43BB4Func = x - } - return (*C.PFNGLGETERRORPROC)(C.PFNGLGETERRORPROC_4ee43bb4), nil -} - -func (x PFNGLGETERRORPROC) PassValue() (ref C.PFNGLGETERRORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETERRORPROC4EE43BB4Func == nil { - pFNGLGETERRORPROC4EE43BB4Func = x - } - return (C.PFNGLGETERRORPROC)(C.PFNGLGETERRORPROC_4ee43bb4), nil -} - -func NewPFNGLGETERRORPROCRef(ref unsafe.Pointer) *PFNGLGETERRORPROC { - return (*PFNGLGETERRORPROC)(ref) -} - -//export PFNGLGETERRORPROC4EE43BB4 -func PFNGLGETERRORPROC4EE43BB4() { - if pFNGLGETERRORPROC4EE43BB4Func != nil { - pFNGLGETERRORPROC4EE43BB4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETERRORPROC4EE43BB4Func PFNGLGETERRORPROC - -func (x PFNGLGETFLOATVPROC) PassRef() (ref *C.PFNGLGETFLOATVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFLOATVPROC26CEDBA1Func == nil { - pFNGLGETFLOATVPROC26CEDBA1Func = x - } - return (*C.PFNGLGETFLOATVPROC)(C.PFNGLGETFLOATVPROC_26cedba1), nil -} - -func (x PFNGLGETFLOATVPROC) PassValue() (ref C.PFNGLGETFLOATVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFLOATVPROC26CEDBA1Func == nil { - pFNGLGETFLOATVPROC26CEDBA1Func = x - } - return (C.PFNGLGETFLOATVPROC)(C.PFNGLGETFLOATVPROC_26cedba1), nil -} - -func NewPFNGLGETFLOATVPROCRef(ref unsafe.Pointer) *PFNGLGETFLOATVPROC { - return (*PFNGLGETFLOATVPROC)(ref) -} - -//export PFNGLGETFLOATVPROC26CEDBA1 -func PFNGLGETFLOATVPROC26CEDBA1() { - if pFNGLGETFLOATVPROC26CEDBA1Func != nil { - pFNGLGETFLOATVPROC26CEDBA1Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETFLOATVPROC26CEDBA1Func PFNGLGETFLOATVPROC - -func (x PFNGLGETFRAGDATALOCATIONPROC) PassRef() (ref *C.PFNGLGETFRAGDATALOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFRAGDATALOCATIONPROC3F23C060Func == nil { - pFNGLGETFRAGDATALOCATIONPROC3F23C060Func = x - } - return (*C.PFNGLGETFRAGDATALOCATIONPROC)(C.PFNGLGETFRAGDATALOCATIONPROC_3f23c060), nil -} - -func (x PFNGLGETFRAGDATALOCATIONPROC) PassValue() (ref C.PFNGLGETFRAGDATALOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFRAGDATALOCATIONPROC3F23C060Func == nil { - pFNGLGETFRAGDATALOCATIONPROC3F23C060Func = x - } - return (C.PFNGLGETFRAGDATALOCATIONPROC)(C.PFNGLGETFRAGDATALOCATIONPROC_3f23c060), nil -} - -func NewPFNGLGETFRAGDATALOCATIONPROCRef(ref unsafe.Pointer) *PFNGLGETFRAGDATALOCATIONPROC { - return (*PFNGLGETFRAGDATALOCATIONPROC)(ref) -} - -//export PFNGLGETFRAGDATALOCATIONPROC3F23C060 -func PFNGLGETFRAGDATALOCATIONPROC3F23C060() { - if pFNGLGETFRAGDATALOCATIONPROC3F23C060Func != nil { - pFNGLGETFRAGDATALOCATIONPROC3F23C060Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETFRAGDATALOCATIONPROC3F23C060Func PFNGLGETFRAGDATALOCATIONPROC - -func (x PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190Func == nil { - pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190Func = x - } - return (*C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_d90cb190), nil -} - -func (x PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) PassValue() (ref C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190Func == nil { - pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190Func = x - } - return (C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(C.PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_d90cb190), nil -} - -func NewPFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC { - return (*PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(ref) -} - -//export PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190 -func PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190() { - if pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190Func != nil { - pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROCD90CB190Func PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC - -func (x PFNGLGETINTEGER64I_VPROC) PassRef() (ref *C.PFNGLGETINTEGER64I_VPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGER64I_VPROC242CD442Func == nil { - pFNGLGETINTEGER64I_VPROC242CD442Func = x - } - return (*C.PFNGLGETINTEGER64I_VPROC)(C.PFNGLGETINTEGER64I_VPROC_242cd442), nil -} - -func (x PFNGLGETINTEGER64I_VPROC) PassValue() (ref C.PFNGLGETINTEGER64I_VPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGER64I_VPROC242CD442Func == nil { - pFNGLGETINTEGER64I_VPROC242CD442Func = x - } - return (C.PFNGLGETINTEGER64I_VPROC)(C.PFNGLGETINTEGER64I_VPROC_242cd442), nil -} - -func NewPFNGLGETINTEGER64I_VPROCRef(ref unsafe.Pointer) *PFNGLGETINTEGER64I_VPROC { - return (*PFNGLGETINTEGER64I_VPROC)(ref) -} - -//export PFNGLGETINTEGER64I_VPROC242CD442 -func PFNGLGETINTEGER64I_VPROC242CD442() { - if pFNGLGETINTEGER64I_VPROC242CD442Func != nil { - pFNGLGETINTEGER64I_VPROC242CD442Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETINTEGER64I_VPROC242CD442Func PFNGLGETINTEGER64I_VPROC - -func (x PFNGLGETINTEGER64VPROC) PassRef() (ref *C.PFNGLGETINTEGER64VPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGER64VPROC1AF2D58FFunc == nil { - pFNGLGETINTEGER64VPROC1AF2D58FFunc = x - } - return (*C.PFNGLGETINTEGER64VPROC)(C.PFNGLGETINTEGER64VPROC_1af2d58f), nil -} - -func (x PFNGLGETINTEGER64VPROC) PassValue() (ref C.PFNGLGETINTEGER64VPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGER64VPROC1AF2D58FFunc == nil { - pFNGLGETINTEGER64VPROC1AF2D58FFunc = x - } - return (C.PFNGLGETINTEGER64VPROC)(C.PFNGLGETINTEGER64VPROC_1af2d58f), nil -} - -func NewPFNGLGETINTEGER64VPROCRef(ref unsafe.Pointer) *PFNGLGETINTEGER64VPROC { - return (*PFNGLGETINTEGER64VPROC)(ref) -} - -//export PFNGLGETINTEGER64VPROC1AF2D58F -func PFNGLGETINTEGER64VPROC1AF2D58F() { - if pFNGLGETINTEGER64VPROC1AF2D58FFunc != nil { - pFNGLGETINTEGER64VPROC1AF2D58FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETINTEGER64VPROC1AF2D58FFunc PFNGLGETINTEGER64VPROC - -func (x PFNGLGETINTEGERI_VPROC) PassRef() (ref *C.PFNGLGETINTEGERI_VPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGERI_VPROC918A3ABAFunc == nil { - pFNGLGETINTEGERI_VPROC918A3ABAFunc = x - } - return (*C.PFNGLGETINTEGERI_VPROC)(C.PFNGLGETINTEGERI_VPROC_918a3aba), nil -} - -func (x PFNGLGETINTEGERI_VPROC) PassValue() (ref C.PFNGLGETINTEGERI_VPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGERI_VPROC918A3ABAFunc == nil { - pFNGLGETINTEGERI_VPROC918A3ABAFunc = x - } - return (C.PFNGLGETINTEGERI_VPROC)(C.PFNGLGETINTEGERI_VPROC_918a3aba), nil -} - -func NewPFNGLGETINTEGERI_VPROCRef(ref unsafe.Pointer) *PFNGLGETINTEGERI_VPROC { - return (*PFNGLGETINTEGERI_VPROC)(ref) -} - -//export PFNGLGETINTEGERI_VPROC918A3ABA -func PFNGLGETINTEGERI_VPROC918A3ABA() { - if pFNGLGETINTEGERI_VPROC918A3ABAFunc != nil { - pFNGLGETINTEGERI_VPROC918A3ABAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETINTEGERI_VPROC918A3ABAFunc PFNGLGETINTEGERI_VPROC - -func (x PFNGLGETINTEGERVPROC) PassRef() (ref *C.PFNGLGETINTEGERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGERVPROCA20307B0Func == nil { - pFNGLGETINTEGERVPROCA20307B0Func = x - } - return (*C.PFNGLGETINTEGERVPROC)(C.PFNGLGETINTEGERVPROC_a20307b0), nil -} - -func (x PFNGLGETINTEGERVPROC) PassValue() (ref C.PFNGLGETINTEGERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTEGERVPROCA20307B0Func == nil { - pFNGLGETINTEGERVPROCA20307B0Func = x - } - return (C.PFNGLGETINTEGERVPROC)(C.PFNGLGETINTEGERVPROC_a20307b0), nil -} - -func NewPFNGLGETINTEGERVPROCRef(ref unsafe.Pointer) *PFNGLGETINTEGERVPROC { - return (*PFNGLGETINTEGERVPROC)(ref) -} - -//export PFNGLGETINTEGERVPROCA20307B0 -func PFNGLGETINTEGERVPROCA20307B0() { - if pFNGLGETINTEGERVPROCA20307B0Func != nil { - pFNGLGETINTEGERVPROCA20307B0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETINTEGERVPROCA20307B0Func PFNGLGETINTEGERVPROC - -func (x PFNGLGETINTERNALFORMATIVPROC) PassRef() (ref *C.PFNGLGETINTERNALFORMATIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTERNALFORMATIVPROCA1B94B3CFunc == nil { - pFNGLGETINTERNALFORMATIVPROCA1B94B3CFunc = x - } - return (*C.PFNGLGETINTERNALFORMATIVPROC)(C.PFNGLGETINTERNALFORMATIVPROC_a1b94b3c), nil -} - -func (x PFNGLGETINTERNALFORMATIVPROC) PassValue() (ref C.PFNGLGETINTERNALFORMATIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETINTERNALFORMATIVPROCA1B94B3CFunc == nil { - pFNGLGETINTERNALFORMATIVPROCA1B94B3CFunc = x - } - return (C.PFNGLGETINTERNALFORMATIVPROC)(C.PFNGLGETINTERNALFORMATIVPROC_a1b94b3c), nil -} - -func NewPFNGLGETINTERNALFORMATIVPROCRef(ref unsafe.Pointer) *PFNGLGETINTERNALFORMATIVPROC { - return (*PFNGLGETINTERNALFORMATIVPROC)(ref) -} - -//export PFNGLGETINTERNALFORMATIVPROCA1B94B3C -func PFNGLGETINTERNALFORMATIVPROCA1B94B3C() { - if pFNGLGETINTERNALFORMATIVPROCA1B94B3CFunc != nil { - pFNGLGETINTERNALFORMATIVPROCA1B94B3CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETINTERNALFORMATIVPROCA1B94B3CFunc PFNGLGETINTERNALFORMATIVPROC - -func (x PFNGLGETPROGRAMBINARYPROC) PassRef() (ref *C.PFNGLGETPROGRAMBINARYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMBINARYPROC2BEB64A5Func == nil { - pFNGLGETPROGRAMBINARYPROC2BEB64A5Func = x - } - return (*C.PFNGLGETPROGRAMBINARYPROC)(C.PFNGLGETPROGRAMBINARYPROC_2beb64a5), nil -} - -func (x PFNGLGETPROGRAMBINARYPROC) PassValue() (ref C.PFNGLGETPROGRAMBINARYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMBINARYPROC2BEB64A5Func == nil { - pFNGLGETPROGRAMBINARYPROC2BEB64A5Func = x - } - return (C.PFNGLGETPROGRAMBINARYPROC)(C.PFNGLGETPROGRAMBINARYPROC_2beb64a5), nil -} - -func NewPFNGLGETPROGRAMBINARYPROCRef(ref unsafe.Pointer) *PFNGLGETPROGRAMBINARYPROC { - return (*PFNGLGETPROGRAMBINARYPROC)(ref) -} - -//export PFNGLGETPROGRAMBINARYPROC2BEB64A5 -func PFNGLGETPROGRAMBINARYPROC2BEB64A5() { - if pFNGLGETPROGRAMBINARYPROC2BEB64A5Func != nil { - pFNGLGETPROGRAMBINARYPROC2BEB64A5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETPROGRAMBINARYPROC2BEB64A5Func PFNGLGETPROGRAMBINARYPROC - -func (x PFNGLGETPROGRAMINFOLOGPROC) PassRef() (ref *C.PFNGLGETPROGRAMINFOLOGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMINFOLOGPROC561ACFAEFunc == nil { - pFNGLGETPROGRAMINFOLOGPROC561ACFAEFunc = x - } - return (*C.PFNGLGETPROGRAMINFOLOGPROC)(C.PFNGLGETPROGRAMINFOLOGPROC_561acfae), nil -} - -func (x PFNGLGETPROGRAMINFOLOGPROC) PassValue() (ref C.PFNGLGETPROGRAMINFOLOGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMINFOLOGPROC561ACFAEFunc == nil { - pFNGLGETPROGRAMINFOLOGPROC561ACFAEFunc = x - } - return (C.PFNGLGETPROGRAMINFOLOGPROC)(C.PFNGLGETPROGRAMINFOLOGPROC_561acfae), nil -} - -func NewPFNGLGETPROGRAMINFOLOGPROCRef(ref unsafe.Pointer) *PFNGLGETPROGRAMINFOLOGPROC { - return (*PFNGLGETPROGRAMINFOLOGPROC)(ref) -} - -//export PFNGLGETPROGRAMINFOLOGPROC561ACFAE -func PFNGLGETPROGRAMINFOLOGPROC561ACFAE() { - if pFNGLGETPROGRAMINFOLOGPROC561ACFAEFunc != nil { - pFNGLGETPROGRAMINFOLOGPROC561ACFAEFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETPROGRAMINFOLOGPROC561ACFAEFunc PFNGLGETPROGRAMINFOLOGPROC - -func (x PFNGLGETPROGRAMIVPROC) PassRef() (ref *C.PFNGLGETPROGRAMIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMIVPROCF21B4E1CFunc == nil { - pFNGLGETPROGRAMIVPROCF21B4E1CFunc = x - } - return (*C.PFNGLGETPROGRAMIVPROC)(C.PFNGLGETPROGRAMIVPROC_f21b4e1c), nil -} - -func (x PFNGLGETPROGRAMIVPROC) PassValue() (ref C.PFNGLGETPROGRAMIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETPROGRAMIVPROCF21B4E1CFunc == nil { - pFNGLGETPROGRAMIVPROCF21B4E1CFunc = x - } - return (C.PFNGLGETPROGRAMIVPROC)(C.PFNGLGETPROGRAMIVPROC_f21b4e1c), nil -} - -func NewPFNGLGETPROGRAMIVPROCRef(ref unsafe.Pointer) *PFNGLGETPROGRAMIVPROC { - return (*PFNGLGETPROGRAMIVPROC)(ref) -} - -//export PFNGLGETPROGRAMIVPROCF21B4E1C -func PFNGLGETPROGRAMIVPROCF21B4E1C() { - if pFNGLGETPROGRAMIVPROCF21B4E1CFunc != nil { - pFNGLGETPROGRAMIVPROCF21B4E1CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETPROGRAMIVPROCF21B4E1CFunc PFNGLGETPROGRAMIVPROC - -func (x PFNGLGETQUERYIVPROC) PassRef() (ref *C.PFNGLGETQUERYIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETQUERYIVPROCD2B5E550Func == nil { - pFNGLGETQUERYIVPROCD2B5E550Func = x - } - return (*C.PFNGLGETQUERYIVPROC)(C.PFNGLGETQUERYIVPROC_d2b5e550), nil -} - -func (x PFNGLGETQUERYIVPROC) PassValue() (ref C.PFNGLGETQUERYIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETQUERYIVPROCD2B5E550Func == nil { - pFNGLGETQUERYIVPROCD2B5E550Func = x - } - return (C.PFNGLGETQUERYIVPROC)(C.PFNGLGETQUERYIVPROC_d2b5e550), nil -} - -func NewPFNGLGETQUERYIVPROCRef(ref unsafe.Pointer) *PFNGLGETQUERYIVPROC { - return (*PFNGLGETQUERYIVPROC)(ref) -} - -//export PFNGLGETQUERYIVPROCD2B5E550 -func PFNGLGETQUERYIVPROCD2B5E550() { - if pFNGLGETQUERYIVPROCD2B5E550Func != nil { - pFNGLGETQUERYIVPROCD2B5E550Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETQUERYIVPROCD2B5E550Func PFNGLGETQUERYIVPROC - -func (x PFNGLGETQUERYOBJECTUIVPROC) PassRef() (ref *C.PFNGLGETQUERYOBJECTUIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETQUERYOBJECTUIVPROCA736AF9BFunc == nil { - pFNGLGETQUERYOBJECTUIVPROCA736AF9BFunc = x - } - return (*C.PFNGLGETQUERYOBJECTUIVPROC)(C.PFNGLGETQUERYOBJECTUIVPROC_a736af9b), nil -} - -func (x PFNGLGETQUERYOBJECTUIVPROC) PassValue() (ref C.PFNGLGETQUERYOBJECTUIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETQUERYOBJECTUIVPROCA736AF9BFunc == nil { - pFNGLGETQUERYOBJECTUIVPROCA736AF9BFunc = x - } - return (C.PFNGLGETQUERYOBJECTUIVPROC)(C.PFNGLGETQUERYOBJECTUIVPROC_a736af9b), nil -} - -func NewPFNGLGETQUERYOBJECTUIVPROCRef(ref unsafe.Pointer) *PFNGLGETQUERYOBJECTUIVPROC { - return (*PFNGLGETQUERYOBJECTUIVPROC)(ref) -} - -//export PFNGLGETQUERYOBJECTUIVPROCA736AF9B -func PFNGLGETQUERYOBJECTUIVPROCA736AF9B() { - if pFNGLGETQUERYOBJECTUIVPROCA736AF9BFunc != nil { - pFNGLGETQUERYOBJECTUIVPROCA736AF9BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETQUERYOBJECTUIVPROCA736AF9BFunc PFNGLGETQUERYOBJECTUIVPROC - -func (x PFNGLGETRENDERBUFFERPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETRENDERBUFFERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45Func == nil { - pFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45Func = x - } - return (*C.PFNGLGETRENDERBUFFERPARAMETERIVPROC)(C.PFNGLGETRENDERBUFFERPARAMETERIVPROC_012dfb45), nil -} - -func (x PFNGLGETRENDERBUFFERPARAMETERIVPROC) PassValue() (ref C.PFNGLGETRENDERBUFFERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45Func == nil { - pFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45Func = x - } - return (C.PFNGLGETRENDERBUFFERPARAMETERIVPROC)(C.PFNGLGETRENDERBUFFERPARAMETERIVPROC_012dfb45), nil -} - -func NewPFNGLGETRENDERBUFFERPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETRENDERBUFFERPARAMETERIVPROC { - return (*PFNGLGETRENDERBUFFERPARAMETERIVPROC)(ref) -} - -//export PFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45 -func PFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45() { - if pFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45Func != nil { - pFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETRENDERBUFFERPARAMETERIVPROC012DFB45Func PFNGLGETRENDERBUFFERPARAMETERIVPROC - -func (x PFNGLGETSAMPLERPARAMETERFVPROC) PassRef() (ref *C.PFNGLGETSAMPLERPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSAMPLERPARAMETERFVPROC7884A5FEFunc == nil { - pFNGLGETSAMPLERPARAMETERFVPROC7884A5FEFunc = x - } - return (*C.PFNGLGETSAMPLERPARAMETERFVPROC)(C.PFNGLGETSAMPLERPARAMETERFVPROC_7884a5fe), nil -} - -func (x PFNGLGETSAMPLERPARAMETERFVPROC) PassValue() (ref C.PFNGLGETSAMPLERPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSAMPLERPARAMETERFVPROC7884A5FEFunc == nil { - pFNGLGETSAMPLERPARAMETERFVPROC7884A5FEFunc = x - } - return (C.PFNGLGETSAMPLERPARAMETERFVPROC)(C.PFNGLGETSAMPLERPARAMETERFVPROC_7884a5fe), nil -} - -func NewPFNGLGETSAMPLERPARAMETERFVPROCRef(ref unsafe.Pointer) *PFNGLGETSAMPLERPARAMETERFVPROC { - return (*PFNGLGETSAMPLERPARAMETERFVPROC)(ref) -} - -//export PFNGLGETSAMPLERPARAMETERFVPROC7884A5FE -func PFNGLGETSAMPLERPARAMETERFVPROC7884A5FE() { - if pFNGLGETSAMPLERPARAMETERFVPROC7884A5FEFunc != nil { - pFNGLGETSAMPLERPARAMETERFVPROC7884A5FEFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSAMPLERPARAMETERFVPROC7884A5FEFunc PFNGLGETSAMPLERPARAMETERFVPROC - -func (x PFNGLGETSAMPLERPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETSAMPLERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSAMPLERPARAMETERIVPROCA6B2561AFunc == nil { - pFNGLGETSAMPLERPARAMETERIVPROCA6B2561AFunc = x - } - return (*C.PFNGLGETSAMPLERPARAMETERIVPROC)(C.PFNGLGETSAMPLERPARAMETERIVPROC_a6b2561a), nil -} - -func (x PFNGLGETSAMPLERPARAMETERIVPROC) PassValue() (ref C.PFNGLGETSAMPLERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSAMPLERPARAMETERIVPROCA6B2561AFunc == nil { - pFNGLGETSAMPLERPARAMETERIVPROCA6B2561AFunc = x - } - return (C.PFNGLGETSAMPLERPARAMETERIVPROC)(C.PFNGLGETSAMPLERPARAMETERIVPROC_a6b2561a), nil -} - -func NewPFNGLGETSAMPLERPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETSAMPLERPARAMETERIVPROC { - return (*PFNGLGETSAMPLERPARAMETERIVPROC)(ref) -} - -//export PFNGLGETSAMPLERPARAMETERIVPROCA6B2561A -func PFNGLGETSAMPLERPARAMETERIVPROCA6B2561A() { - if pFNGLGETSAMPLERPARAMETERIVPROCA6B2561AFunc != nil { - pFNGLGETSAMPLERPARAMETERIVPROCA6B2561AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSAMPLERPARAMETERIVPROCA6B2561AFunc PFNGLGETSAMPLERPARAMETERIVPROC - -func (x PFNGLGETSHADERINFOLOGPROC) PassRef() (ref *C.PFNGLGETSHADERINFOLOGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERINFOLOGPROC6C2312E1Func == nil { - pFNGLGETSHADERINFOLOGPROC6C2312E1Func = x - } - return (*C.PFNGLGETSHADERINFOLOGPROC)(C.PFNGLGETSHADERINFOLOGPROC_6c2312e1), nil -} - -func (x PFNGLGETSHADERINFOLOGPROC) PassValue() (ref C.PFNGLGETSHADERINFOLOGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERINFOLOGPROC6C2312E1Func == nil { - pFNGLGETSHADERINFOLOGPROC6C2312E1Func = x - } - return (C.PFNGLGETSHADERINFOLOGPROC)(C.PFNGLGETSHADERINFOLOGPROC_6c2312e1), nil -} - -func NewPFNGLGETSHADERINFOLOGPROCRef(ref unsafe.Pointer) *PFNGLGETSHADERINFOLOGPROC { - return (*PFNGLGETSHADERINFOLOGPROC)(ref) -} - -//export PFNGLGETSHADERINFOLOGPROC6C2312E1 -func PFNGLGETSHADERINFOLOGPROC6C2312E1() { - if pFNGLGETSHADERINFOLOGPROC6C2312E1Func != nil { - pFNGLGETSHADERINFOLOGPROC6C2312E1Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSHADERINFOLOGPROC6C2312E1Func PFNGLGETSHADERINFOLOGPROC - -func (x PFNGLGETSHADERIVPROC) PassRef() (ref *C.PFNGLGETSHADERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERIVPROC181FC959Func == nil { - pFNGLGETSHADERIVPROC181FC959Func = x - } - return (*C.PFNGLGETSHADERIVPROC)(C.PFNGLGETSHADERIVPROC_181fc959), nil -} - -func (x PFNGLGETSHADERIVPROC) PassValue() (ref C.PFNGLGETSHADERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERIVPROC181FC959Func == nil { - pFNGLGETSHADERIVPROC181FC959Func = x - } - return (C.PFNGLGETSHADERIVPROC)(C.PFNGLGETSHADERIVPROC_181fc959), nil -} - -func NewPFNGLGETSHADERIVPROCRef(ref unsafe.Pointer) *PFNGLGETSHADERIVPROC { - return (*PFNGLGETSHADERIVPROC)(ref) -} - -//export PFNGLGETSHADERIVPROC181FC959 -func PFNGLGETSHADERIVPROC181FC959() { - if pFNGLGETSHADERIVPROC181FC959Func != nil { - pFNGLGETSHADERIVPROC181FC959Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSHADERIVPROC181FC959Func PFNGLGETSHADERIVPROC - -func (x PFNGLGETSHADERPRECISIONFORMATPROC) PassRef() (ref *C.PFNGLGETSHADERPRECISIONFORMATPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERPRECISIONFORMATPROCBA71B795Func == nil { - pFNGLGETSHADERPRECISIONFORMATPROCBA71B795Func = x - } - return (*C.PFNGLGETSHADERPRECISIONFORMATPROC)(C.PFNGLGETSHADERPRECISIONFORMATPROC_ba71b795), nil -} - -func (x PFNGLGETSHADERPRECISIONFORMATPROC) PassValue() (ref C.PFNGLGETSHADERPRECISIONFORMATPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERPRECISIONFORMATPROCBA71B795Func == nil { - pFNGLGETSHADERPRECISIONFORMATPROCBA71B795Func = x - } - return (C.PFNGLGETSHADERPRECISIONFORMATPROC)(C.PFNGLGETSHADERPRECISIONFORMATPROC_ba71b795), nil -} - -func NewPFNGLGETSHADERPRECISIONFORMATPROCRef(ref unsafe.Pointer) *PFNGLGETSHADERPRECISIONFORMATPROC { - return (*PFNGLGETSHADERPRECISIONFORMATPROC)(ref) -} - -//export PFNGLGETSHADERPRECISIONFORMATPROCBA71B795 -func PFNGLGETSHADERPRECISIONFORMATPROCBA71B795() { - if pFNGLGETSHADERPRECISIONFORMATPROCBA71B795Func != nil { - pFNGLGETSHADERPRECISIONFORMATPROCBA71B795Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSHADERPRECISIONFORMATPROCBA71B795Func PFNGLGETSHADERPRECISIONFORMATPROC - -func (x PFNGLGETSHADERSOURCEPROC) PassRef() (ref *C.PFNGLGETSHADERSOURCEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERSOURCEPROC29961E3EFunc == nil { - pFNGLGETSHADERSOURCEPROC29961E3EFunc = x - } - return (*C.PFNGLGETSHADERSOURCEPROC)(C.PFNGLGETSHADERSOURCEPROC_29961e3e), nil -} - -func (x PFNGLGETSHADERSOURCEPROC) PassValue() (ref C.PFNGLGETSHADERSOURCEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSHADERSOURCEPROC29961E3EFunc == nil { - pFNGLGETSHADERSOURCEPROC29961E3EFunc = x - } - return (C.PFNGLGETSHADERSOURCEPROC)(C.PFNGLGETSHADERSOURCEPROC_29961e3e), nil -} - -func NewPFNGLGETSHADERSOURCEPROCRef(ref unsafe.Pointer) *PFNGLGETSHADERSOURCEPROC { - return (*PFNGLGETSHADERSOURCEPROC)(ref) -} - -//export PFNGLGETSHADERSOURCEPROC29961E3E -func PFNGLGETSHADERSOURCEPROC29961E3E() { - if pFNGLGETSHADERSOURCEPROC29961E3EFunc != nil { - pFNGLGETSHADERSOURCEPROC29961E3EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSHADERSOURCEPROC29961E3EFunc PFNGLGETSHADERSOURCEPROC - -func (x PFNGLGETSTRINGIPROC) PassRef() (ref *C.PFNGLGETSTRINGIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSTRINGIPROCB4181478Func == nil { - pFNGLGETSTRINGIPROCB4181478Func = x - } - return (*C.PFNGLGETSTRINGIPROC)(C.PFNGLGETSTRINGIPROC_b4181478), nil -} - -func (x PFNGLGETSTRINGIPROC) PassValue() (ref C.PFNGLGETSTRINGIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSTRINGIPROCB4181478Func == nil { - pFNGLGETSTRINGIPROCB4181478Func = x - } - return (C.PFNGLGETSTRINGIPROC)(C.PFNGLGETSTRINGIPROC_b4181478), nil -} - -func NewPFNGLGETSTRINGIPROCRef(ref unsafe.Pointer) *PFNGLGETSTRINGIPROC { - return (*PFNGLGETSTRINGIPROC)(ref) -} - -//export PFNGLGETSTRINGIPROCB4181478 -func PFNGLGETSTRINGIPROCB4181478() { - if pFNGLGETSTRINGIPROCB4181478Func != nil { - pFNGLGETSTRINGIPROCB4181478Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSTRINGIPROCB4181478Func PFNGLGETSTRINGIPROC - -func (x PFNGLGETSTRINGPROC) PassRef() (ref *C.PFNGLGETSTRINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSTRINGPROC9056842EFunc == nil { - pFNGLGETSTRINGPROC9056842EFunc = x - } - return (*C.PFNGLGETSTRINGPROC)(C.PFNGLGETSTRINGPROC_9056842e), nil -} - -func (x PFNGLGETSTRINGPROC) PassValue() (ref C.PFNGLGETSTRINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSTRINGPROC9056842EFunc == nil { - pFNGLGETSTRINGPROC9056842EFunc = x - } - return (C.PFNGLGETSTRINGPROC)(C.PFNGLGETSTRINGPROC_9056842e), nil -} - -func NewPFNGLGETSTRINGPROCRef(ref unsafe.Pointer) *PFNGLGETSTRINGPROC { - return (*PFNGLGETSTRINGPROC)(ref) -} - -//export PFNGLGETSTRINGPROC9056842E -func PFNGLGETSTRINGPROC9056842E() { - if pFNGLGETSTRINGPROC9056842EFunc != nil { - pFNGLGETSTRINGPROC9056842EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSTRINGPROC9056842EFunc PFNGLGETSTRINGPROC - -func (x PFNGLGETSYNCIVPROC) PassRef() (ref *C.PFNGLGETSYNCIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSYNCIVPROCB687EE19Func == nil { - pFNGLGETSYNCIVPROCB687EE19Func = x - } - return (*C.PFNGLGETSYNCIVPROC)(C.PFNGLGETSYNCIVPROC_b687ee19), nil -} - -func (x PFNGLGETSYNCIVPROC) PassValue() (ref C.PFNGLGETSYNCIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETSYNCIVPROCB687EE19Func == nil { - pFNGLGETSYNCIVPROCB687EE19Func = x - } - return (C.PFNGLGETSYNCIVPROC)(C.PFNGLGETSYNCIVPROC_b687ee19), nil -} - -func NewPFNGLGETSYNCIVPROCRef(ref unsafe.Pointer) *PFNGLGETSYNCIVPROC { - return (*PFNGLGETSYNCIVPROC)(ref) -} - -//export PFNGLGETSYNCIVPROCB687EE19 -func PFNGLGETSYNCIVPROCB687EE19() { - if pFNGLGETSYNCIVPROCB687EE19Func != nil { - pFNGLGETSYNCIVPROCB687EE19Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETSYNCIVPROCB687EE19Func PFNGLGETSYNCIVPROC - -func (x PFNGLGETTEXPARAMETERFVPROC) PassRef() (ref *C.PFNGLGETTEXPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTEXPARAMETERFVPROCFBBAC33AFunc == nil { - pFNGLGETTEXPARAMETERFVPROCFBBAC33AFunc = x - } - return (*C.PFNGLGETTEXPARAMETERFVPROC)(C.PFNGLGETTEXPARAMETERFVPROC_fbbac33a), nil -} - -func (x PFNGLGETTEXPARAMETERFVPROC) PassValue() (ref C.PFNGLGETTEXPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTEXPARAMETERFVPROCFBBAC33AFunc == nil { - pFNGLGETTEXPARAMETERFVPROCFBBAC33AFunc = x - } - return (C.PFNGLGETTEXPARAMETERFVPROC)(C.PFNGLGETTEXPARAMETERFVPROC_fbbac33a), nil -} - -func NewPFNGLGETTEXPARAMETERFVPROCRef(ref unsafe.Pointer) *PFNGLGETTEXPARAMETERFVPROC { - return (*PFNGLGETTEXPARAMETERFVPROC)(ref) -} - -//export PFNGLGETTEXPARAMETERFVPROCFBBAC33A -func PFNGLGETTEXPARAMETERFVPROCFBBAC33A() { - if pFNGLGETTEXPARAMETERFVPROCFBBAC33AFunc != nil { - pFNGLGETTEXPARAMETERFVPROCFBBAC33AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETTEXPARAMETERFVPROCFBBAC33AFunc PFNGLGETTEXPARAMETERFVPROC - -func (x PFNGLGETTEXPARAMETERIVPROC) PassRef() (ref *C.PFNGLGETTEXPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTEXPARAMETERIVPROC88CE5347Func == nil { - pFNGLGETTEXPARAMETERIVPROC88CE5347Func = x - } - return (*C.PFNGLGETTEXPARAMETERIVPROC)(C.PFNGLGETTEXPARAMETERIVPROC_88ce5347), nil -} - -func (x PFNGLGETTEXPARAMETERIVPROC) PassValue() (ref C.PFNGLGETTEXPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTEXPARAMETERIVPROC88CE5347Func == nil { - pFNGLGETTEXPARAMETERIVPROC88CE5347Func = x - } - return (C.PFNGLGETTEXPARAMETERIVPROC)(C.PFNGLGETTEXPARAMETERIVPROC_88ce5347), nil -} - -func NewPFNGLGETTEXPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLGETTEXPARAMETERIVPROC { - return (*PFNGLGETTEXPARAMETERIVPROC)(ref) -} - -//export PFNGLGETTEXPARAMETERIVPROC88CE5347 -func PFNGLGETTEXPARAMETERIVPROC88CE5347() { - if pFNGLGETTEXPARAMETERIVPROC88CE5347Func != nil { - pFNGLGETTEXPARAMETERIVPROC88CE5347Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETTEXPARAMETERIVPROC88CE5347Func PFNGLGETTEXPARAMETERIVPROC - -func (x PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) PassRef() (ref *C.PFNGLGETTRANSFORMFEEDBACKVARYINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4DFunc == nil { - pFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4DFunc = x - } - return (*C.PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(C.PFNGLGETTRANSFORMFEEDBACKVARYINGPROC_bad38b4d), nil -} - -func (x PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) PassValue() (ref C.PFNGLGETTRANSFORMFEEDBACKVARYINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4DFunc == nil { - pFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4DFunc = x - } - return (C.PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(C.PFNGLGETTRANSFORMFEEDBACKVARYINGPROC_bad38b4d), nil -} - -func NewPFNGLGETTRANSFORMFEEDBACKVARYINGPROCRef(ref unsafe.Pointer) *PFNGLGETTRANSFORMFEEDBACKVARYINGPROC { - return (*PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(ref) -} - -//export PFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4D -func PFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4D() { - if pFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4DFunc != nil { - pFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETTRANSFORMFEEDBACKVARYINGPROCBAD38B4DFunc PFNGLGETTRANSFORMFEEDBACKVARYINGPROC - -func (x PFNGLGETUNIFORMBLOCKINDEXPROC) PassRef() (ref *C.PFNGLGETUNIFORMBLOCKINDEXPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1Func == nil { - pFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1Func = x - } - return (*C.PFNGLGETUNIFORMBLOCKINDEXPROC)(C.PFNGLGETUNIFORMBLOCKINDEXPROC_cb5218b1), nil -} - -func (x PFNGLGETUNIFORMBLOCKINDEXPROC) PassValue() (ref C.PFNGLGETUNIFORMBLOCKINDEXPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1Func == nil { - pFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1Func = x - } - return (C.PFNGLGETUNIFORMBLOCKINDEXPROC)(C.PFNGLGETUNIFORMBLOCKINDEXPROC_cb5218b1), nil -} - -func NewPFNGLGETUNIFORMBLOCKINDEXPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMBLOCKINDEXPROC { - return (*PFNGLGETUNIFORMBLOCKINDEXPROC)(ref) -} - -//export PFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1 -func PFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1() { - if pFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1Func != nil { - pFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMBLOCKINDEXPROCCB5218B1Func PFNGLGETUNIFORMBLOCKINDEXPROC - -func (x PFNGLGETUNIFORMFVPROC) PassRef() (ref *C.PFNGLGETUNIFORMFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMFVPROC1CCB78CAFunc == nil { - pFNGLGETUNIFORMFVPROC1CCB78CAFunc = x - } - return (*C.PFNGLGETUNIFORMFVPROC)(C.PFNGLGETUNIFORMFVPROC_1ccb78ca), nil -} - -func (x PFNGLGETUNIFORMFVPROC) PassValue() (ref C.PFNGLGETUNIFORMFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMFVPROC1CCB78CAFunc == nil { - pFNGLGETUNIFORMFVPROC1CCB78CAFunc = x - } - return (C.PFNGLGETUNIFORMFVPROC)(C.PFNGLGETUNIFORMFVPROC_1ccb78ca), nil -} - -func NewPFNGLGETUNIFORMFVPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMFVPROC { - return (*PFNGLGETUNIFORMFVPROC)(ref) -} - -//export PFNGLGETUNIFORMFVPROC1CCB78CA -func PFNGLGETUNIFORMFVPROC1CCB78CA() { - if pFNGLGETUNIFORMFVPROC1CCB78CAFunc != nil { - pFNGLGETUNIFORMFVPROC1CCB78CAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMFVPROC1CCB78CAFunc PFNGLGETUNIFORMFVPROC - -func (x PFNGLGETUNIFORMINDICESPROC) PassRef() (ref *C.PFNGLGETUNIFORMINDICESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMINDICESPROC548E5E58Func == nil { - pFNGLGETUNIFORMINDICESPROC548E5E58Func = x - } - return (*C.PFNGLGETUNIFORMINDICESPROC)(C.PFNGLGETUNIFORMINDICESPROC_548e5e58), nil -} - -func (x PFNGLGETUNIFORMINDICESPROC) PassValue() (ref C.PFNGLGETUNIFORMINDICESPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMINDICESPROC548E5E58Func == nil { - pFNGLGETUNIFORMINDICESPROC548E5E58Func = x - } - return (C.PFNGLGETUNIFORMINDICESPROC)(C.PFNGLGETUNIFORMINDICESPROC_548e5e58), nil -} - -func NewPFNGLGETUNIFORMINDICESPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMINDICESPROC { - return (*PFNGLGETUNIFORMINDICESPROC)(ref) -} - -//export PFNGLGETUNIFORMINDICESPROC548E5E58 -func PFNGLGETUNIFORMINDICESPROC548E5E58() { - if pFNGLGETUNIFORMINDICESPROC548E5E58Func != nil { - pFNGLGETUNIFORMINDICESPROC548E5E58Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMINDICESPROC548E5E58Func PFNGLGETUNIFORMINDICESPROC - -func (x PFNGLGETUNIFORMIVPROC) PassRef() (ref *C.PFNGLGETUNIFORMIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMIVPROC37E3A17AFunc == nil { - pFNGLGETUNIFORMIVPROC37E3A17AFunc = x - } - return (*C.PFNGLGETUNIFORMIVPROC)(C.PFNGLGETUNIFORMIVPROC_37e3a17a), nil -} - -func (x PFNGLGETUNIFORMIVPROC) PassValue() (ref C.PFNGLGETUNIFORMIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMIVPROC37E3A17AFunc == nil { - pFNGLGETUNIFORMIVPROC37E3A17AFunc = x - } - return (C.PFNGLGETUNIFORMIVPROC)(C.PFNGLGETUNIFORMIVPROC_37e3a17a), nil -} - -func NewPFNGLGETUNIFORMIVPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMIVPROC { - return (*PFNGLGETUNIFORMIVPROC)(ref) -} - -//export PFNGLGETUNIFORMIVPROC37E3A17A -func PFNGLGETUNIFORMIVPROC37E3A17A() { - if pFNGLGETUNIFORMIVPROC37E3A17AFunc != nil { - pFNGLGETUNIFORMIVPROC37E3A17AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMIVPROC37E3A17AFunc PFNGLGETUNIFORMIVPROC - -func (x PFNGLGETUNIFORMLOCATIONPROC) PassRef() (ref *C.PFNGLGETUNIFORMLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMLOCATIONPROC6BE9913DFunc == nil { - pFNGLGETUNIFORMLOCATIONPROC6BE9913DFunc = x - } - return (*C.PFNGLGETUNIFORMLOCATIONPROC)(C.PFNGLGETUNIFORMLOCATIONPROC_6be9913d), nil -} - -func (x PFNGLGETUNIFORMLOCATIONPROC) PassValue() (ref C.PFNGLGETUNIFORMLOCATIONPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMLOCATIONPROC6BE9913DFunc == nil { - pFNGLGETUNIFORMLOCATIONPROC6BE9913DFunc = x - } - return (C.PFNGLGETUNIFORMLOCATIONPROC)(C.PFNGLGETUNIFORMLOCATIONPROC_6be9913d), nil -} - -func NewPFNGLGETUNIFORMLOCATIONPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMLOCATIONPROC { - return (*PFNGLGETUNIFORMLOCATIONPROC)(ref) -} - -//export PFNGLGETUNIFORMLOCATIONPROC6BE9913D -func PFNGLGETUNIFORMLOCATIONPROC6BE9913D() { - if pFNGLGETUNIFORMLOCATIONPROC6BE9913DFunc != nil { - pFNGLGETUNIFORMLOCATIONPROC6BE9913DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMLOCATIONPROC6BE9913DFunc PFNGLGETUNIFORMLOCATIONPROC - -func (x PFNGLGETUNIFORMUIVPROC) PassRef() (ref *C.PFNGLGETUNIFORMUIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMUIVPROCFDFA8264Func == nil { - pFNGLGETUNIFORMUIVPROCFDFA8264Func = x - } - return (*C.PFNGLGETUNIFORMUIVPROC)(C.PFNGLGETUNIFORMUIVPROC_fdfa8264), nil -} - -func (x PFNGLGETUNIFORMUIVPROC) PassValue() (ref C.PFNGLGETUNIFORMUIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETUNIFORMUIVPROCFDFA8264Func == nil { - pFNGLGETUNIFORMUIVPROCFDFA8264Func = x - } - return (C.PFNGLGETUNIFORMUIVPROC)(C.PFNGLGETUNIFORMUIVPROC_fdfa8264), nil -} - -func NewPFNGLGETUNIFORMUIVPROCRef(ref unsafe.Pointer) *PFNGLGETUNIFORMUIVPROC { - return (*PFNGLGETUNIFORMUIVPROC)(ref) -} - -//export PFNGLGETUNIFORMUIVPROCFDFA8264 -func PFNGLGETUNIFORMUIVPROCFDFA8264() { - if pFNGLGETUNIFORMUIVPROCFDFA8264Func != nil { - pFNGLGETUNIFORMUIVPROCFDFA8264Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETUNIFORMUIVPROCFDFA8264Func PFNGLGETUNIFORMUIVPROC - -func (x PFNGLGETVERTEXATTRIBFVPROC) PassRef() (ref *C.PFNGLGETVERTEXATTRIBFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBFVPROC2C991E8DFunc == nil { - pFNGLGETVERTEXATTRIBFVPROC2C991E8DFunc = x - } - return (*C.PFNGLGETVERTEXATTRIBFVPROC)(C.PFNGLGETVERTEXATTRIBFVPROC_2c991e8d), nil -} - -func (x PFNGLGETVERTEXATTRIBFVPROC) PassValue() (ref C.PFNGLGETVERTEXATTRIBFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBFVPROC2C991E8DFunc == nil { - pFNGLGETVERTEXATTRIBFVPROC2C991E8DFunc = x - } - return (C.PFNGLGETVERTEXATTRIBFVPROC)(C.PFNGLGETVERTEXATTRIBFVPROC_2c991e8d), nil -} - -func NewPFNGLGETVERTEXATTRIBFVPROCRef(ref unsafe.Pointer) *PFNGLGETVERTEXATTRIBFVPROC { - return (*PFNGLGETVERTEXATTRIBFVPROC)(ref) -} - -//export PFNGLGETVERTEXATTRIBFVPROC2C991E8D -func PFNGLGETVERTEXATTRIBFVPROC2C991E8D() { - if pFNGLGETVERTEXATTRIBFVPROC2C991E8DFunc != nil { - pFNGLGETVERTEXATTRIBFVPROC2C991E8DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETVERTEXATTRIBFVPROC2C991E8DFunc PFNGLGETVERTEXATTRIBFVPROC - -func (x PFNGLGETVERTEXATTRIBIIVPROC) PassRef() (ref *C.PFNGLGETVERTEXATTRIBIIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBIIVPROC497CC5FFFunc == nil { - pFNGLGETVERTEXATTRIBIIVPROC497CC5FFFunc = x - } - return (*C.PFNGLGETVERTEXATTRIBIIVPROC)(C.PFNGLGETVERTEXATTRIBIIVPROC_497cc5ff), nil -} - -func (x PFNGLGETVERTEXATTRIBIIVPROC) PassValue() (ref C.PFNGLGETVERTEXATTRIBIIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBIIVPROC497CC5FFFunc == nil { - pFNGLGETVERTEXATTRIBIIVPROC497CC5FFFunc = x - } - return (C.PFNGLGETVERTEXATTRIBIIVPROC)(C.PFNGLGETVERTEXATTRIBIIVPROC_497cc5ff), nil -} - -func NewPFNGLGETVERTEXATTRIBIIVPROCRef(ref unsafe.Pointer) *PFNGLGETVERTEXATTRIBIIVPROC { - return (*PFNGLGETVERTEXATTRIBIIVPROC)(ref) -} - -//export PFNGLGETVERTEXATTRIBIIVPROC497CC5FF -func PFNGLGETVERTEXATTRIBIIVPROC497CC5FF() { - if pFNGLGETVERTEXATTRIBIIVPROC497CC5FFFunc != nil { - pFNGLGETVERTEXATTRIBIIVPROC497CC5FFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETVERTEXATTRIBIIVPROC497CC5FFFunc PFNGLGETVERTEXATTRIBIIVPROC - -func (x PFNGLGETVERTEXATTRIBIUIVPROC) PassRef() (ref *C.PFNGLGETVERTEXATTRIBIUIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBIUIVPROC96B22535Func == nil { - pFNGLGETVERTEXATTRIBIUIVPROC96B22535Func = x - } - return (*C.PFNGLGETVERTEXATTRIBIUIVPROC)(C.PFNGLGETVERTEXATTRIBIUIVPROC_96b22535), nil -} - -func (x PFNGLGETVERTEXATTRIBIUIVPROC) PassValue() (ref C.PFNGLGETVERTEXATTRIBIUIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBIUIVPROC96B22535Func == nil { - pFNGLGETVERTEXATTRIBIUIVPROC96B22535Func = x - } - return (C.PFNGLGETVERTEXATTRIBIUIVPROC)(C.PFNGLGETVERTEXATTRIBIUIVPROC_96b22535), nil -} - -func NewPFNGLGETVERTEXATTRIBIUIVPROCRef(ref unsafe.Pointer) *PFNGLGETVERTEXATTRIBIUIVPROC { - return (*PFNGLGETVERTEXATTRIBIUIVPROC)(ref) -} - -//export PFNGLGETVERTEXATTRIBIUIVPROC96B22535 -func PFNGLGETVERTEXATTRIBIUIVPROC96B22535() { - if pFNGLGETVERTEXATTRIBIUIVPROC96B22535Func != nil { - pFNGLGETVERTEXATTRIBIUIVPROC96B22535Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETVERTEXATTRIBIUIVPROC96B22535Func PFNGLGETVERTEXATTRIBIUIVPROC - -func (x PFNGLGETVERTEXATTRIBIVPROC) PassRef() (ref *C.PFNGLGETVERTEXATTRIBIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBIVPROC8AF8ED90Func == nil { - pFNGLGETVERTEXATTRIBIVPROC8AF8ED90Func = x - } - return (*C.PFNGLGETVERTEXATTRIBIVPROC)(C.PFNGLGETVERTEXATTRIBIVPROC_8af8ed90), nil -} - -func (x PFNGLGETVERTEXATTRIBIVPROC) PassValue() (ref C.PFNGLGETVERTEXATTRIBIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBIVPROC8AF8ED90Func == nil { - pFNGLGETVERTEXATTRIBIVPROC8AF8ED90Func = x - } - return (C.PFNGLGETVERTEXATTRIBIVPROC)(C.PFNGLGETVERTEXATTRIBIVPROC_8af8ed90), nil -} - -func NewPFNGLGETVERTEXATTRIBIVPROCRef(ref unsafe.Pointer) *PFNGLGETVERTEXATTRIBIVPROC { - return (*PFNGLGETVERTEXATTRIBIVPROC)(ref) -} - -//export PFNGLGETVERTEXATTRIBIVPROC8AF8ED90 -func PFNGLGETVERTEXATTRIBIVPROC8AF8ED90() { - if pFNGLGETVERTEXATTRIBIVPROC8AF8ED90Func != nil { - pFNGLGETVERTEXATTRIBIVPROC8AF8ED90Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETVERTEXATTRIBIVPROC8AF8ED90Func PFNGLGETVERTEXATTRIBIVPROC - -func (x PFNGLGETVERTEXATTRIBPOINTERVPROC) PassRef() (ref *C.PFNGLGETVERTEXATTRIBPOINTERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDAFunc == nil { - pFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDAFunc = x - } - return (*C.PFNGLGETVERTEXATTRIBPOINTERVPROC)(C.PFNGLGETVERTEXATTRIBPOINTERVPROC_bbb72eda), nil -} - -func (x PFNGLGETVERTEXATTRIBPOINTERVPROC) PassValue() (ref C.PFNGLGETVERTEXATTRIBPOINTERVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDAFunc == nil { - pFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDAFunc = x - } - return (C.PFNGLGETVERTEXATTRIBPOINTERVPROC)(C.PFNGLGETVERTEXATTRIBPOINTERVPROC_bbb72eda), nil -} - -func NewPFNGLGETVERTEXATTRIBPOINTERVPROCRef(ref unsafe.Pointer) *PFNGLGETVERTEXATTRIBPOINTERVPROC { - return (*PFNGLGETVERTEXATTRIBPOINTERVPROC)(ref) -} - -//export PFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDA -func PFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDA() { - if pFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDAFunc != nil { - pFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLGETVERTEXATTRIBPOINTERVPROCBBB72EDAFunc PFNGLGETVERTEXATTRIBPOINTERVPROC - -func (x PFNGLHINTPROC) PassRef() (ref *C.PFNGLHINTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLHINTPROC9615D875Func == nil { - pFNGLHINTPROC9615D875Func = x - } - return (*C.PFNGLHINTPROC)(C.PFNGLHINTPROC_9615d875), nil -} - -func (x PFNGLHINTPROC) PassValue() (ref C.PFNGLHINTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLHINTPROC9615D875Func == nil { - pFNGLHINTPROC9615D875Func = x - } - return (C.PFNGLHINTPROC)(C.PFNGLHINTPROC_9615d875), nil -} - -func NewPFNGLHINTPROCRef(ref unsafe.Pointer) *PFNGLHINTPROC { - return (*PFNGLHINTPROC)(ref) -} - -//export PFNGLHINTPROC9615D875 -func PFNGLHINTPROC9615D875() { - if pFNGLHINTPROC9615D875Func != nil { - pFNGLHINTPROC9615D875Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLHINTPROC9615D875Func PFNGLHINTPROC - -func (x PFNGLINVALIDATEFRAMEBUFFERPROC) PassRef() (ref *C.PFNGLINVALIDATEFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58Func == nil { - pFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58Func = x - } - return (*C.PFNGLINVALIDATEFRAMEBUFFERPROC)(C.PFNGLINVALIDATEFRAMEBUFFERPROC_8a44ae58), nil -} - -func (x PFNGLINVALIDATEFRAMEBUFFERPROC) PassValue() (ref C.PFNGLINVALIDATEFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58Func == nil { - pFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58Func = x - } - return (C.PFNGLINVALIDATEFRAMEBUFFERPROC)(C.PFNGLINVALIDATEFRAMEBUFFERPROC_8a44ae58), nil -} - -func NewPFNGLINVALIDATEFRAMEBUFFERPROCRef(ref unsafe.Pointer) *PFNGLINVALIDATEFRAMEBUFFERPROC { - return (*PFNGLINVALIDATEFRAMEBUFFERPROC)(ref) -} - -//export PFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58 -func PFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58() { - if pFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58Func != nil { - pFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLINVALIDATEFRAMEBUFFERPROC8A44AE58Func PFNGLINVALIDATEFRAMEBUFFERPROC - -func (x PFNGLINVALIDATESUBFRAMEBUFFERPROC) PassRef() (ref *C.PFNGLINVALIDATESUBFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLINVALIDATESUBFRAMEBUFFERPROC87763868Func == nil { - pFNGLINVALIDATESUBFRAMEBUFFERPROC87763868Func = x - } - return (*C.PFNGLINVALIDATESUBFRAMEBUFFERPROC)(C.PFNGLINVALIDATESUBFRAMEBUFFERPROC_87763868), nil -} - -func (x PFNGLINVALIDATESUBFRAMEBUFFERPROC) PassValue() (ref C.PFNGLINVALIDATESUBFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLINVALIDATESUBFRAMEBUFFERPROC87763868Func == nil { - pFNGLINVALIDATESUBFRAMEBUFFERPROC87763868Func = x - } - return (C.PFNGLINVALIDATESUBFRAMEBUFFERPROC)(C.PFNGLINVALIDATESUBFRAMEBUFFERPROC_87763868), nil -} - -func NewPFNGLINVALIDATESUBFRAMEBUFFERPROCRef(ref unsafe.Pointer) *PFNGLINVALIDATESUBFRAMEBUFFERPROC { - return (*PFNGLINVALIDATESUBFRAMEBUFFERPROC)(ref) -} - -//export PFNGLINVALIDATESUBFRAMEBUFFERPROC87763868 -func PFNGLINVALIDATESUBFRAMEBUFFERPROC87763868() { - if pFNGLINVALIDATESUBFRAMEBUFFERPROC87763868Func != nil { - pFNGLINVALIDATESUBFRAMEBUFFERPROC87763868Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLINVALIDATESUBFRAMEBUFFERPROC87763868Func PFNGLINVALIDATESUBFRAMEBUFFERPROC - -func (x PFNGLISBUFFERPROC) PassRef() (ref *C.PFNGLISBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISBUFFERPROC1205A0EBFunc == nil { - pFNGLISBUFFERPROC1205A0EBFunc = x - } - return (*C.PFNGLISBUFFERPROC)(C.PFNGLISBUFFERPROC_1205a0eb), nil -} - -func (x PFNGLISBUFFERPROC) PassValue() (ref C.PFNGLISBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISBUFFERPROC1205A0EBFunc == nil { - pFNGLISBUFFERPROC1205A0EBFunc = x - } - return (C.PFNGLISBUFFERPROC)(C.PFNGLISBUFFERPROC_1205a0eb), nil -} - -func NewPFNGLISBUFFERPROCRef(ref unsafe.Pointer) *PFNGLISBUFFERPROC { - return (*PFNGLISBUFFERPROC)(ref) -} - -//export PFNGLISBUFFERPROC1205A0EB -func PFNGLISBUFFERPROC1205A0EB() { - if pFNGLISBUFFERPROC1205A0EBFunc != nil { - pFNGLISBUFFERPROC1205A0EBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISBUFFERPROC1205A0EBFunc PFNGLISBUFFERPROC - -func (x PFNGLISENABLEDPROC) PassRef() (ref *C.PFNGLISENABLEDPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISENABLEDPROC3CFDAB2AFunc == nil { - pFNGLISENABLEDPROC3CFDAB2AFunc = x - } - return (*C.PFNGLISENABLEDPROC)(C.PFNGLISENABLEDPROC_3cfdab2a), nil -} - -func (x PFNGLISENABLEDPROC) PassValue() (ref C.PFNGLISENABLEDPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISENABLEDPROC3CFDAB2AFunc == nil { - pFNGLISENABLEDPROC3CFDAB2AFunc = x - } - return (C.PFNGLISENABLEDPROC)(C.PFNGLISENABLEDPROC_3cfdab2a), nil -} - -func NewPFNGLISENABLEDPROCRef(ref unsafe.Pointer) *PFNGLISENABLEDPROC { - return (*PFNGLISENABLEDPROC)(ref) -} - -//export PFNGLISENABLEDPROC3CFDAB2A -func PFNGLISENABLEDPROC3CFDAB2A() { - if pFNGLISENABLEDPROC3CFDAB2AFunc != nil { - pFNGLISENABLEDPROC3CFDAB2AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISENABLEDPROC3CFDAB2AFunc PFNGLISENABLEDPROC - -func (x PFNGLISFRAMEBUFFERPROC) PassRef() (ref *C.PFNGLISFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISFRAMEBUFFERPROC6A0EB102Func == nil { - pFNGLISFRAMEBUFFERPROC6A0EB102Func = x - } - return (*C.PFNGLISFRAMEBUFFERPROC)(C.PFNGLISFRAMEBUFFERPROC_6a0eb102), nil -} - -func (x PFNGLISFRAMEBUFFERPROC) PassValue() (ref C.PFNGLISFRAMEBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISFRAMEBUFFERPROC6A0EB102Func == nil { - pFNGLISFRAMEBUFFERPROC6A0EB102Func = x - } - return (C.PFNGLISFRAMEBUFFERPROC)(C.PFNGLISFRAMEBUFFERPROC_6a0eb102), nil -} - -func NewPFNGLISFRAMEBUFFERPROCRef(ref unsafe.Pointer) *PFNGLISFRAMEBUFFERPROC { - return (*PFNGLISFRAMEBUFFERPROC)(ref) -} - -//export PFNGLISFRAMEBUFFERPROC6A0EB102 -func PFNGLISFRAMEBUFFERPROC6A0EB102() { - if pFNGLISFRAMEBUFFERPROC6A0EB102Func != nil { - pFNGLISFRAMEBUFFERPROC6A0EB102Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISFRAMEBUFFERPROC6A0EB102Func PFNGLISFRAMEBUFFERPROC - -func (x PFNGLISPROGRAMPROC) PassRef() (ref *C.PFNGLISPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISPROGRAMPROC69D4D96FFunc == nil { - pFNGLISPROGRAMPROC69D4D96FFunc = x - } - return (*C.PFNGLISPROGRAMPROC)(C.PFNGLISPROGRAMPROC_69d4d96f), nil -} - -func (x PFNGLISPROGRAMPROC) PassValue() (ref C.PFNGLISPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISPROGRAMPROC69D4D96FFunc == nil { - pFNGLISPROGRAMPROC69D4D96FFunc = x - } - return (C.PFNGLISPROGRAMPROC)(C.PFNGLISPROGRAMPROC_69d4d96f), nil -} - -func NewPFNGLISPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLISPROGRAMPROC { - return (*PFNGLISPROGRAMPROC)(ref) -} - -//export PFNGLISPROGRAMPROC69D4D96F -func PFNGLISPROGRAMPROC69D4D96F() { - if pFNGLISPROGRAMPROC69D4D96FFunc != nil { - pFNGLISPROGRAMPROC69D4D96FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISPROGRAMPROC69D4D96FFunc PFNGLISPROGRAMPROC - -func (x PFNGLISQUERYPROC) PassRef() (ref *C.PFNGLISQUERYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISQUERYPROC8BD23752Func == nil { - pFNGLISQUERYPROC8BD23752Func = x - } - return (*C.PFNGLISQUERYPROC)(C.PFNGLISQUERYPROC_8bd23752), nil -} - -func (x PFNGLISQUERYPROC) PassValue() (ref C.PFNGLISQUERYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISQUERYPROC8BD23752Func == nil { - pFNGLISQUERYPROC8BD23752Func = x - } - return (C.PFNGLISQUERYPROC)(C.PFNGLISQUERYPROC_8bd23752), nil -} - -func NewPFNGLISQUERYPROCRef(ref unsafe.Pointer) *PFNGLISQUERYPROC { - return (*PFNGLISQUERYPROC)(ref) -} - -//export PFNGLISQUERYPROC8BD23752 -func PFNGLISQUERYPROC8BD23752() { - if pFNGLISQUERYPROC8BD23752Func != nil { - pFNGLISQUERYPROC8BD23752Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISQUERYPROC8BD23752Func PFNGLISQUERYPROC - -func (x PFNGLISRENDERBUFFERPROC) PassRef() (ref *C.PFNGLISRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISRENDERBUFFERPROC4113416BFunc == nil { - pFNGLISRENDERBUFFERPROC4113416BFunc = x - } - return (*C.PFNGLISRENDERBUFFERPROC)(C.PFNGLISRENDERBUFFERPROC_4113416b), nil -} - -func (x PFNGLISRENDERBUFFERPROC) PassValue() (ref C.PFNGLISRENDERBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISRENDERBUFFERPROC4113416BFunc == nil { - pFNGLISRENDERBUFFERPROC4113416BFunc = x - } - return (C.PFNGLISRENDERBUFFERPROC)(C.PFNGLISRENDERBUFFERPROC_4113416b), nil -} - -func NewPFNGLISRENDERBUFFERPROCRef(ref unsafe.Pointer) *PFNGLISRENDERBUFFERPROC { - return (*PFNGLISRENDERBUFFERPROC)(ref) -} - -//export PFNGLISRENDERBUFFERPROC4113416B -func PFNGLISRENDERBUFFERPROC4113416B() { - if pFNGLISRENDERBUFFERPROC4113416BFunc != nil { - pFNGLISRENDERBUFFERPROC4113416BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISRENDERBUFFERPROC4113416BFunc PFNGLISRENDERBUFFERPROC - -func (x PFNGLISSAMPLERPROC) PassRef() (ref *C.PFNGLISSAMPLERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISSAMPLERPROC38170421Func == nil { - pFNGLISSAMPLERPROC38170421Func = x - } - return (*C.PFNGLISSAMPLERPROC)(C.PFNGLISSAMPLERPROC_38170421), nil -} - -func (x PFNGLISSAMPLERPROC) PassValue() (ref C.PFNGLISSAMPLERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISSAMPLERPROC38170421Func == nil { - pFNGLISSAMPLERPROC38170421Func = x - } - return (C.PFNGLISSAMPLERPROC)(C.PFNGLISSAMPLERPROC_38170421), nil -} - -func NewPFNGLISSAMPLERPROCRef(ref unsafe.Pointer) *PFNGLISSAMPLERPROC { - return (*PFNGLISSAMPLERPROC)(ref) -} - -//export PFNGLISSAMPLERPROC38170421 -func PFNGLISSAMPLERPROC38170421() { - if pFNGLISSAMPLERPROC38170421Func != nil { - pFNGLISSAMPLERPROC38170421Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISSAMPLERPROC38170421Func PFNGLISSAMPLERPROC - -func (x PFNGLISSHADERPROC) PassRef() (ref *C.PFNGLISSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISSHADERPROCABBFFF54Func == nil { - pFNGLISSHADERPROCABBFFF54Func = x - } - return (*C.PFNGLISSHADERPROC)(C.PFNGLISSHADERPROC_abbfff54), nil -} - -func (x PFNGLISSHADERPROC) PassValue() (ref C.PFNGLISSHADERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISSHADERPROCABBFFF54Func == nil { - pFNGLISSHADERPROCABBFFF54Func = x - } - return (C.PFNGLISSHADERPROC)(C.PFNGLISSHADERPROC_abbfff54), nil -} - -func NewPFNGLISSHADERPROCRef(ref unsafe.Pointer) *PFNGLISSHADERPROC { - return (*PFNGLISSHADERPROC)(ref) -} - -//export PFNGLISSHADERPROCABBFFF54 -func PFNGLISSHADERPROCABBFFF54() { - if pFNGLISSHADERPROCABBFFF54Func != nil { - pFNGLISSHADERPROCABBFFF54Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISSHADERPROCABBFFF54Func PFNGLISSHADERPROC - -func (x PFNGLISSYNCPROC) PassRef() (ref *C.PFNGLISSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISSYNCPROC8E68EBBBFunc == nil { - pFNGLISSYNCPROC8E68EBBBFunc = x - } - return (*C.PFNGLISSYNCPROC)(C.PFNGLISSYNCPROC_8e68ebbb), nil -} - -func (x PFNGLISSYNCPROC) PassValue() (ref C.PFNGLISSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISSYNCPROC8E68EBBBFunc == nil { - pFNGLISSYNCPROC8E68EBBBFunc = x - } - return (C.PFNGLISSYNCPROC)(C.PFNGLISSYNCPROC_8e68ebbb), nil -} - -func NewPFNGLISSYNCPROCRef(ref unsafe.Pointer) *PFNGLISSYNCPROC { - return (*PFNGLISSYNCPROC)(ref) -} - -//export PFNGLISSYNCPROC8E68EBBB -func PFNGLISSYNCPROC8E68EBBB() { - if pFNGLISSYNCPROC8E68EBBBFunc != nil { - pFNGLISSYNCPROC8E68EBBBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISSYNCPROC8E68EBBBFunc PFNGLISSYNCPROC - -func (x PFNGLISTEXTUREPROC) PassRef() (ref *C.PFNGLISTEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISTEXTUREPROC775B4FD4Func == nil { - pFNGLISTEXTUREPROC775B4FD4Func = x - } - return (*C.PFNGLISTEXTUREPROC)(C.PFNGLISTEXTUREPROC_775b4fd4), nil -} - -func (x PFNGLISTEXTUREPROC) PassValue() (ref C.PFNGLISTEXTUREPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISTEXTUREPROC775B4FD4Func == nil { - pFNGLISTEXTUREPROC775B4FD4Func = x - } - return (C.PFNGLISTEXTUREPROC)(C.PFNGLISTEXTUREPROC_775b4fd4), nil -} - -func NewPFNGLISTEXTUREPROCRef(ref unsafe.Pointer) *PFNGLISTEXTUREPROC { - return (*PFNGLISTEXTUREPROC)(ref) -} - -//export PFNGLISTEXTUREPROC775B4FD4 -func PFNGLISTEXTUREPROC775B4FD4() { - if pFNGLISTEXTUREPROC775B4FD4Func != nil { - pFNGLISTEXTUREPROC775B4FD4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISTEXTUREPROC775B4FD4Func PFNGLISTEXTUREPROC - -func (x PFNGLISTRANSFORMFEEDBACKPROC) PassRef() (ref *C.PFNGLISTRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISTRANSFORMFEEDBACKPROCFCD30EA1Func == nil { - pFNGLISTRANSFORMFEEDBACKPROCFCD30EA1Func = x - } - return (*C.PFNGLISTRANSFORMFEEDBACKPROC)(C.PFNGLISTRANSFORMFEEDBACKPROC_fcd30ea1), nil -} - -func (x PFNGLISTRANSFORMFEEDBACKPROC) PassValue() (ref C.PFNGLISTRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISTRANSFORMFEEDBACKPROCFCD30EA1Func == nil { - pFNGLISTRANSFORMFEEDBACKPROCFCD30EA1Func = x - } - return (C.PFNGLISTRANSFORMFEEDBACKPROC)(C.PFNGLISTRANSFORMFEEDBACKPROC_fcd30ea1), nil -} - -func NewPFNGLISTRANSFORMFEEDBACKPROCRef(ref unsafe.Pointer) *PFNGLISTRANSFORMFEEDBACKPROC { - return (*PFNGLISTRANSFORMFEEDBACKPROC)(ref) -} - -//export PFNGLISTRANSFORMFEEDBACKPROCFCD30EA1 -func PFNGLISTRANSFORMFEEDBACKPROCFCD30EA1() { - if pFNGLISTRANSFORMFEEDBACKPROCFCD30EA1Func != nil { - pFNGLISTRANSFORMFEEDBACKPROCFCD30EA1Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISTRANSFORMFEEDBACKPROCFCD30EA1Func PFNGLISTRANSFORMFEEDBACKPROC - -func (x PFNGLISVERTEXARRAYPROC) PassRef() (ref *C.PFNGLISVERTEXARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISVERTEXARRAYPROC736D5EDBFunc == nil { - pFNGLISVERTEXARRAYPROC736D5EDBFunc = x - } - return (*C.PFNGLISVERTEXARRAYPROC)(C.PFNGLISVERTEXARRAYPROC_736d5edb), nil -} - -func (x PFNGLISVERTEXARRAYPROC) PassValue() (ref C.PFNGLISVERTEXARRAYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLISVERTEXARRAYPROC736D5EDBFunc == nil { - pFNGLISVERTEXARRAYPROC736D5EDBFunc = x - } - return (C.PFNGLISVERTEXARRAYPROC)(C.PFNGLISVERTEXARRAYPROC_736d5edb), nil -} - -func NewPFNGLISVERTEXARRAYPROCRef(ref unsafe.Pointer) *PFNGLISVERTEXARRAYPROC { - return (*PFNGLISVERTEXARRAYPROC)(ref) -} - -//export PFNGLISVERTEXARRAYPROC736D5EDB -func PFNGLISVERTEXARRAYPROC736D5EDB() { - if pFNGLISVERTEXARRAYPROC736D5EDBFunc != nil { - pFNGLISVERTEXARRAYPROC736D5EDBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLISVERTEXARRAYPROC736D5EDBFunc PFNGLISVERTEXARRAYPROC - -func (x PFNGLLINEWIDTHPROC) PassRef() (ref *C.PFNGLLINEWIDTHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLLINEWIDTHPROCBA5950E5Func == nil { - pFNGLLINEWIDTHPROCBA5950E5Func = x - } - return (*C.PFNGLLINEWIDTHPROC)(C.PFNGLLINEWIDTHPROC_ba5950e5), nil -} - -func (x PFNGLLINEWIDTHPROC) PassValue() (ref C.PFNGLLINEWIDTHPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLLINEWIDTHPROCBA5950E5Func == nil { - pFNGLLINEWIDTHPROCBA5950E5Func = x - } - return (C.PFNGLLINEWIDTHPROC)(C.PFNGLLINEWIDTHPROC_ba5950e5), nil -} - -func NewPFNGLLINEWIDTHPROCRef(ref unsafe.Pointer) *PFNGLLINEWIDTHPROC { - return (*PFNGLLINEWIDTHPROC)(ref) -} - -//export PFNGLLINEWIDTHPROCBA5950E5 -func PFNGLLINEWIDTHPROCBA5950E5() { - if pFNGLLINEWIDTHPROCBA5950E5Func != nil { - pFNGLLINEWIDTHPROCBA5950E5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLLINEWIDTHPROCBA5950E5Func PFNGLLINEWIDTHPROC - -func (x PFNGLLINKPROGRAMPROC) PassRef() (ref *C.PFNGLLINKPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLLINKPROGRAMPROC161A12A7Func == nil { - pFNGLLINKPROGRAMPROC161A12A7Func = x - } - return (*C.PFNGLLINKPROGRAMPROC)(C.PFNGLLINKPROGRAMPROC_161a12a7), nil -} - -func (x PFNGLLINKPROGRAMPROC) PassValue() (ref C.PFNGLLINKPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLLINKPROGRAMPROC161A12A7Func == nil { - pFNGLLINKPROGRAMPROC161A12A7Func = x - } - return (C.PFNGLLINKPROGRAMPROC)(C.PFNGLLINKPROGRAMPROC_161a12a7), nil -} - -func NewPFNGLLINKPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLLINKPROGRAMPROC { - return (*PFNGLLINKPROGRAMPROC)(ref) -} - -//export PFNGLLINKPROGRAMPROC161A12A7 -func PFNGLLINKPROGRAMPROC161A12A7() { - if pFNGLLINKPROGRAMPROC161A12A7Func != nil { - pFNGLLINKPROGRAMPROC161A12A7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLLINKPROGRAMPROC161A12A7Func PFNGLLINKPROGRAMPROC - -func (x PFNGLMAPBUFFERRANGEPROC) PassRef() (ref *C.PFNGLMAPBUFFERRANGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLMAPBUFFERRANGEPROC627EA2F5Func == nil { - pFNGLMAPBUFFERRANGEPROC627EA2F5Func = x - } - return (*C.PFNGLMAPBUFFERRANGEPROC)(C.PFNGLMAPBUFFERRANGEPROC_627ea2f5), nil -} - -func (x PFNGLMAPBUFFERRANGEPROC) PassValue() (ref C.PFNGLMAPBUFFERRANGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLMAPBUFFERRANGEPROC627EA2F5Func == nil { - pFNGLMAPBUFFERRANGEPROC627EA2F5Func = x - } - return (C.PFNGLMAPBUFFERRANGEPROC)(C.PFNGLMAPBUFFERRANGEPROC_627ea2f5), nil -} - -func NewPFNGLMAPBUFFERRANGEPROCRef(ref unsafe.Pointer) *PFNGLMAPBUFFERRANGEPROC { - return (*PFNGLMAPBUFFERRANGEPROC)(ref) -} - -//export PFNGLMAPBUFFERRANGEPROC627EA2F5 -func PFNGLMAPBUFFERRANGEPROC627EA2F5() { - if pFNGLMAPBUFFERRANGEPROC627EA2F5Func != nil { - pFNGLMAPBUFFERRANGEPROC627EA2F5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLMAPBUFFERRANGEPROC627EA2F5Func PFNGLMAPBUFFERRANGEPROC - -func (x PFNGLPAUSETRANSFORMFEEDBACKPROC) PassRef() (ref *C.PFNGLPAUSETRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1Func == nil { - pFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1Func = x - } - return (*C.PFNGLPAUSETRANSFORMFEEDBACKPROC)(C.PFNGLPAUSETRANSFORMFEEDBACKPROC_9de9d6d1), nil -} - -func (x PFNGLPAUSETRANSFORMFEEDBACKPROC) PassValue() (ref C.PFNGLPAUSETRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1Func == nil { - pFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1Func = x - } - return (C.PFNGLPAUSETRANSFORMFEEDBACKPROC)(C.PFNGLPAUSETRANSFORMFEEDBACKPROC_9de9d6d1), nil -} - -func NewPFNGLPAUSETRANSFORMFEEDBACKPROCRef(ref unsafe.Pointer) *PFNGLPAUSETRANSFORMFEEDBACKPROC { - return (*PFNGLPAUSETRANSFORMFEEDBACKPROC)(ref) -} - -//export PFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1 -func PFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1() { - if pFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1Func != nil { - pFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLPAUSETRANSFORMFEEDBACKPROC9DE9D6D1Func PFNGLPAUSETRANSFORMFEEDBACKPROC - -func (x PFNGLPIXELSTOREIPROC) PassRef() (ref *C.PFNGLPIXELSTOREIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPIXELSTOREIPROC7A0339F7Func == nil { - pFNGLPIXELSTOREIPROC7A0339F7Func = x - } - return (*C.PFNGLPIXELSTOREIPROC)(C.PFNGLPIXELSTOREIPROC_7a0339f7), nil -} - -func (x PFNGLPIXELSTOREIPROC) PassValue() (ref C.PFNGLPIXELSTOREIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPIXELSTOREIPROC7A0339F7Func == nil { - pFNGLPIXELSTOREIPROC7A0339F7Func = x - } - return (C.PFNGLPIXELSTOREIPROC)(C.PFNGLPIXELSTOREIPROC_7a0339f7), nil -} - -func NewPFNGLPIXELSTOREIPROCRef(ref unsafe.Pointer) *PFNGLPIXELSTOREIPROC { - return (*PFNGLPIXELSTOREIPROC)(ref) -} - -//export PFNGLPIXELSTOREIPROC7A0339F7 -func PFNGLPIXELSTOREIPROC7A0339F7() { - if pFNGLPIXELSTOREIPROC7A0339F7Func != nil { - pFNGLPIXELSTOREIPROC7A0339F7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLPIXELSTOREIPROC7A0339F7Func PFNGLPIXELSTOREIPROC - -func (x PFNGLPOLYGONOFFSETPROC) PassRef() (ref *C.PFNGLPOLYGONOFFSETPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPOLYGONOFFSETPROCC431F0C7Func == nil { - pFNGLPOLYGONOFFSETPROCC431F0C7Func = x - } - return (*C.PFNGLPOLYGONOFFSETPROC)(C.PFNGLPOLYGONOFFSETPROC_c431f0c7), nil -} - -func (x PFNGLPOLYGONOFFSETPROC) PassValue() (ref C.PFNGLPOLYGONOFFSETPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPOLYGONOFFSETPROCC431F0C7Func == nil { - pFNGLPOLYGONOFFSETPROCC431F0C7Func = x - } - return (C.PFNGLPOLYGONOFFSETPROC)(C.PFNGLPOLYGONOFFSETPROC_c431f0c7), nil -} - -func NewPFNGLPOLYGONOFFSETPROCRef(ref unsafe.Pointer) *PFNGLPOLYGONOFFSETPROC { - return (*PFNGLPOLYGONOFFSETPROC)(ref) -} - -//export PFNGLPOLYGONOFFSETPROCC431F0C7 -func PFNGLPOLYGONOFFSETPROCC431F0C7() { - if pFNGLPOLYGONOFFSETPROCC431F0C7Func != nil { - pFNGLPOLYGONOFFSETPROCC431F0C7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLPOLYGONOFFSETPROCC431F0C7Func PFNGLPOLYGONOFFSETPROC - -func (x PFNGLPROGRAMBINARYPROC) PassRef() (ref *C.PFNGLPROGRAMBINARYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPROGRAMBINARYPROC21944AECFunc == nil { - pFNGLPROGRAMBINARYPROC21944AECFunc = x - } - return (*C.PFNGLPROGRAMBINARYPROC)(C.PFNGLPROGRAMBINARYPROC_21944aec), nil -} - -func (x PFNGLPROGRAMBINARYPROC) PassValue() (ref C.PFNGLPROGRAMBINARYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPROGRAMBINARYPROC21944AECFunc == nil { - pFNGLPROGRAMBINARYPROC21944AECFunc = x - } - return (C.PFNGLPROGRAMBINARYPROC)(C.PFNGLPROGRAMBINARYPROC_21944aec), nil -} - -func NewPFNGLPROGRAMBINARYPROCRef(ref unsafe.Pointer) *PFNGLPROGRAMBINARYPROC { - return (*PFNGLPROGRAMBINARYPROC)(ref) -} - -//export PFNGLPROGRAMBINARYPROC21944AEC -func PFNGLPROGRAMBINARYPROC21944AEC() { - if pFNGLPROGRAMBINARYPROC21944AECFunc != nil { - pFNGLPROGRAMBINARYPROC21944AECFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLPROGRAMBINARYPROC21944AECFunc PFNGLPROGRAMBINARYPROC - -func (x PFNGLPROGRAMPARAMETERIPROC) PassRef() (ref *C.PFNGLPROGRAMPARAMETERIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPROGRAMPARAMETERIPROCA171055FFunc == nil { - pFNGLPROGRAMPARAMETERIPROCA171055FFunc = x - } - return (*C.PFNGLPROGRAMPARAMETERIPROC)(C.PFNGLPROGRAMPARAMETERIPROC_a171055f), nil -} - -func (x PFNGLPROGRAMPARAMETERIPROC) PassValue() (ref C.PFNGLPROGRAMPARAMETERIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLPROGRAMPARAMETERIPROCA171055FFunc == nil { - pFNGLPROGRAMPARAMETERIPROCA171055FFunc = x - } - return (C.PFNGLPROGRAMPARAMETERIPROC)(C.PFNGLPROGRAMPARAMETERIPROC_a171055f), nil -} - -func NewPFNGLPROGRAMPARAMETERIPROCRef(ref unsafe.Pointer) *PFNGLPROGRAMPARAMETERIPROC { - return (*PFNGLPROGRAMPARAMETERIPROC)(ref) -} - -//export PFNGLPROGRAMPARAMETERIPROCA171055F -func PFNGLPROGRAMPARAMETERIPROCA171055F() { - if pFNGLPROGRAMPARAMETERIPROCA171055FFunc != nil { - pFNGLPROGRAMPARAMETERIPROCA171055FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLPROGRAMPARAMETERIPROCA171055FFunc PFNGLPROGRAMPARAMETERIPROC - -func (x PFNGLREADBUFFERPROC) PassRef() (ref *C.PFNGLREADBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLREADBUFFERPROC11385D22Func == nil { - pFNGLREADBUFFERPROC11385D22Func = x - } - return (*C.PFNGLREADBUFFERPROC)(C.PFNGLREADBUFFERPROC_11385d22), nil -} - -func (x PFNGLREADBUFFERPROC) PassValue() (ref C.PFNGLREADBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLREADBUFFERPROC11385D22Func == nil { - pFNGLREADBUFFERPROC11385D22Func = x - } - return (C.PFNGLREADBUFFERPROC)(C.PFNGLREADBUFFERPROC_11385d22), nil -} - -func NewPFNGLREADBUFFERPROCRef(ref unsafe.Pointer) *PFNGLREADBUFFERPROC { - return (*PFNGLREADBUFFERPROC)(ref) -} - -//export PFNGLREADBUFFERPROC11385D22 -func PFNGLREADBUFFERPROC11385D22() { - if pFNGLREADBUFFERPROC11385D22Func != nil { - pFNGLREADBUFFERPROC11385D22Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLREADBUFFERPROC11385D22Func PFNGLREADBUFFERPROC - -func (x PFNGLREADPIXELSPROC) PassRef() (ref *C.PFNGLREADPIXELSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLREADPIXELSPROC97C2FF0FFunc == nil { - pFNGLREADPIXELSPROC97C2FF0FFunc = x - } - return (*C.PFNGLREADPIXELSPROC)(C.PFNGLREADPIXELSPROC_97c2ff0f), nil -} - -func (x PFNGLREADPIXELSPROC) PassValue() (ref C.PFNGLREADPIXELSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLREADPIXELSPROC97C2FF0FFunc == nil { - pFNGLREADPIXELSPROC97C2FF0FFunc = x - } - return (C.PFNGLREADPIXELSPROC)(C.PFNGLREADPIXELSPROC_97c2ff0f), nil -} - -func NewPFNGLREADPIXELSPROCRef(ref unsafe.Pointer) *PFNGLREADPIXELSPROC { - return (*PFNGLREADPIXELSPROC)(ref) -} - -//export PFNGLREADPIXELSPROC97C2FF0F -func PFNGLREADPIXELSPROC97C2FF0F() { - if pFNGLREADPIXELSPROC97C2FF0FFunc != nil { - pFNGLREADPIXELSPROC97C2FF0FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLREADPIXELSPROC97C2FF0FFunc PFNGLREADPIXELSPROC - -func (x PFNGLRELEASESHADERCOMPILERPROC) PassRef() (ref *C.PFNGLRELEASESHADERCOMPILERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRELEASESHADERCOMPILERPROCFD48183DFunc == nil { - pFNGLRELEASESHADERCOMPILERPROCFD48183DFunc = x - } - return (*C.PFNGLRELEASESHADERCOMPILERPROC)(C.PFNGLRELEASESHADERCOMPILERPROC_fd48183d), nil -} - -func (x PFNGLRELEASESHADERCOMPILERPROC) PassValue() (ref C.PFNGLRELEASESHADERCOMPILERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRELEASESHADERCOMPILERPROCFD48183DFunc == nil { - pFNGLRELEASESHADERCOMPILERPROCFD48183DFunc = x - } - return (C.PFNGLRELEASESHADERCOMPILERPROC)(C.PFNGLRELEASESHADERCOMPILERPROC_fd48183d), nil -} - -func NewPFNGLRELEASESHADERCOMPILERPROCRef(ref unsafe.Pointer) *PFNGLRELEASESHADERCOMPILERPROC { - return (*PFNGLRELEASESHADERCOMPILERPROC)(ref) -} - -//export PFNGLRELEASESHADERCOMPILERPROCFD48183D -func PFNGLRELEASESHADERCOMPILERPROCFD48183D() { - if pFNGLRELEASESHADERCOMPILERPROCFD48183DFunc != nil { - pFNGLRELEASESHADERCOMPILERPROCFD48183DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLRELEASESHADERCOMPILERPROCFD48183DFunc PFNGLRELEASESHADERCOMPILERPROC - -func (x PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) PassRef() (ref *C.PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59CFunc == nil { - pFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59CFunc = x - } - return (*C.PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(C.PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC_76ccd59c), nil -} - -func (x PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) PassValue() (ref C.PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59CFunc == nil { - pFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59CFunc = x - } - return (C.PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(C.PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC_76ccd59c), nil -} - -func NewPFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROCRef(ref unsafe.Pointer) *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC { - return (*PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(ref) -} - -//export PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59C -func PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59C() { - if pFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59CFunc != nil { - pFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC76CCD59CFunc PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC - -func (x PFNGLRENDERBUFFERSTORAGEPROC) PassRef() (ref *C.PFNGLRENDERBUFFERSTORAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRENDERBUFFERSTORAGEPROC7A4EC204Func == nil { - pFNGLRENDERBUFFERSTORAGEPROC7A4EC204Func = x - } - return (*C.PFNGLRENDERBUFFERSTORAGEPROC)(C.PFNGLRENDERBUFFERSTORAGEPROC_7a4ec204), nil -} - -func (x PFNGLRENDERBUFFERSTORAGEPROC) PassValue() (ref C.PFNGLRENDERBUFFERSTORAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRENDERBUFFERSTORAGEPROC7A4EC204Func == nil { - pFNGLRENDERBUFFERSTORAGEPROC7A4EC204Func = x - } - return (C.PFNGLRENDERBUFFERSTORAGEPROC)(C.PFNGLRENDERBUFFERSTORAGEPROC_7a4ec204), nil -} - -func NewPFNGLRENDERBUFFERSTORAGEPROCRef(ref unsafe.Pointer) *PFNGLRENDERBUFFERSTORAGEPROC { - return (*PFNGLRENDERBUFFERSTORAGEPROC)(ref) -} - -//export PFNGLRENDERBUFFERSTORAGEPROC7A4EC204 -func PFNGLRENDERBUFFERSTORAGEPROC7A4EC204() { - if pFNGLRENDERBUFFERSTORAGEPROC7A4EC204Func != nil { - pFNGLRENDERBUFFERSTORAGEPROC7A4EC204Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLRENDERBUFFERSTORAGEPROC7A4EC204Func PFNGLRENDERBUFFERSTORAGEPROC - -func (x PFNGLRESUMETRANSFORMFEEDBACKPROC) PassRef() (ref *C.PFNGLRESUMETRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6Func == nil { - pFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6Func = x - } - return (*C.PFNGLRESUMETRANSFORMFEEDBACKPROC)(C.PFNGLRESUMETRANSFORMFEEDBACKPROC_85f458d6), nil -} - -func (x PFNGLRESUMETRANSFORMFEEDBACKPROC) PassValue() (ref C.PFNGLRESUMETRANSFORMFEEDBACKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6Func == nil { - pFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6Func = x - } - return (C.PFNGLRESUMETRANSFORMFEEDBACKPROC)(C.PFNGLRESUMETRANSFORMFEEDBACKPROC_85f458d6), nil -} - -func NewPFNGLRESUMETRANSFORMFEEDBACKPROCRef(ref unsafe.Pointer) *PFNGLRESUMETRANSFORMFEEDBACKPROC { - return (*PFNGLRESUMETRANSFORMFEEDBACKPROC)(ref) -} - -//export PFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6 -func PFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6() { - if pFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6Func != nil { - pFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLRESUMETRANSFORMFEEDBACKPROC85F458D6Func PFNGLRESUMETRANSFORMFEEDBACKPROC - -func (x PFNGLSAMPLECOVERAGEPROC) PassRef() (ref *C.PFNGLSAMPLECOVERAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLECOVERAGEPROC7A0D5034Func == nil { - pFNGLSAMPLECOVERAGEPROC7A0D5034Func = x - } - return (*C.PFNGLSAMPLECOVERAGEPROC)(C.PFNGLSAMPLECOVERAGEPROC_7a0d5034), nil -} - -func (x PFNGLSAMPLECOVERAGEPROC) PassValue() (ref C.PFNGLSAMPLECOVERAGEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLECOVERAGEPROC7A0D5034Func == nil { - pFNGLSAMPLECOVERAGEPROC7A0D5034Func = x - } - return (C.PFNGLSAMPLECOVERAGEPROC)(C.PFNGLSAMPLECOVERAGEPROC_7a0d5034), nil -} - -func NewPFNGLSAMPLECOVERAGEPROCRef(ref unsafe.Pointer) *PFNGLSAMPLECOVERAGEPROC { - return (*PFNGLSAMPLECOVERAGEPROC)(ref) -} - -//export PFNGLSAMPLECOVERAGEPROC7A0D5034 -func PFNGLSAMPLECOVERAGEPROC7A0D5034() { - if pFNGLSAMPLECOVERAGEPROC7A0D5034Func != nil { - pFNGLSAMPLECOVERAGEPROC7A0D5034Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSAMPLECOVERAGEPROC7A0D5034Func PFNGLSAMPLECOVERAGEPROC - -func (x PFNGLSAMPLERPARAMETERFPROC) PassRef() (ref *C.PFNGLSAMPLERPARAMETERFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLERPARAMETERFPROCBD904A68Func == nil { - pFNGLSAMPLERPARAMETERFPROCBD904A68Func = x - } - return (*C.PFNGLSAMPLERPARAMETERFPROC)(C.PFNGLSAMPLERPARAMETERFPROC_bd904a68), nil -} - -func (x PFNGLSAMPLERPARAMETERFPROC) PassValue() (ref C.PFNGLSAMPLERPARAMETERFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLERPARAMETERFPROCBD904A68Func == nil { - pFNGLSAMPLERPARAMETERFPROCBD904A68Func = x - } - return (C.PFNGLSAMPLERPARAMETERFPROC)(C.PFNGLSAMPLERPARAMETERFPROC_bd904a68), nil -} - -func NewPFNGLSAMPLERPARAMETERFPROCRef(ref unsafe.Pointer) *PFNGLSAMPLERPARAMETERFPROC { - return (*PFNGLSAMPLERPARAMETERFPROC)(ref) -} - -//export PFNGLSAMPLERPARAMETERFPROCBD904A68 -func PFNGLSAMPLERPARAMETERFPROCBD904A68() { - if pFNGLSAMPLERPARAMETERFPROCBD904A68Func != nil { - pFNGLSAMPLERPARAMETERFPROCBD904A68Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSAMPLERPARAMETERFPROCBD904A68Func PFNGLSAMPLERPARAMETERFPROC - -func (x PFNGLSAMPLERPARAMETERFVPROC) PassRef() (ref *C.PFNGLSAMPLERPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLERPARAMETERFVPROC0DC22A41Func == nil { - pFNGLSAMPLERPARAMETERFVPROC0DC22A41Func = x - } - return (*C.PFNGLSAMPLERPARAMETERFVPROC)(C.PFNGLSAMPLERPARAMETERFVPROC_0dc22a41), nil -} - -func (x PFNGLSAMPLERPARAMETERFVPROC) PassValue() (ref C.PFNGLSAMPLERPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLERPARAMETERFVPROC0DC22A41Func == nil { - pFNGLSAMPLERPARAMETERFVPROC0DC22A41Func = x - } - return (C.PFNGLSAMPLERPARAMETERFVPROC)(C.PFNGLSAMPLERPARAMETERFVPROC_0dc22a41), nil -} - -func NewPFNGLSAMPLERPARAMETERFVPROCRef(ref unsafe.Pointer) *PFNGLSAMPLERPARAMETERFVPROC { - return (*PFNGLSAMPLERPARAMETERFVPROC)(ref) -} - -//export PFNGLSAMPLERPARAMETERFVPROC0DC22A41 -func PFNGLSAMPLERPARAMETERFVPROC0DC22A41() { - if pFNGLSAMPLERPARAMETERFVPROC0DC22A41Func != nil { - pFNGLSAMPLERPARAMETERFVPROC0DC22A41Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSAMPLERPARAMETERFVPROC0DC22A41Func PFNGLSAMPLERPARAMETERFVPROC - -func (x PFNGLSAMPLERPARAMETERIPROC) PassRef() (ref *C.PFNGLSAMPLERPARAMETERIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLERPARAMETERIPROCA43D84C8Func == nil { - pFNGLSAMPLERPARAMETERIPROCA43D84C8Func = x - } - return (*C.PFNGLSAMPLERPARAMETERIPROC)(C.PFNGLSAMPLERPARAMETERIPROC_a43d84c8), nil -} - -func (x PFNGLSAMPLERPARAMETERIPROC) PassValue() (ref C.PFNGLSAMPLERPARAMETERIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLERPARAMETERIPROCA43D84C8Func == nil { - pFNGLSAMPLERPARAMETERIPROCA43D84C8Func = x - } - return (C.PFNGLSAMPLERPARAMETERIPROC)(C.PFNGLSAMPLERPARAMETERIPROC_a43d84c8), nil -} - -func NewPFNGLSAMPLERPARAMETERIPROCRef(ref unsafe.Pointer) *PFNGLSAMPLERPARAMETERIPROC { - return (*PFNGLSAMPLERPARAMETERIPROC)(ref) -} - -//export PFNGLSAMPLERPARAMETERIPROCA43D84C8 -func PFNGLSAMPLERPARAMETERIPROCA43D84C8() { - if pFNGLSAMPLERPARAMETERIPROCA43D84C8Func != nil { - pFNGLSAMPLERPARAMETERIPROCA43D84C8Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSAMPLERPARAMETERIPROCA43D84C8Func PFNGLSAMPLERPARAMETERIPROC - -func (x PFNGLSAMPLERPARAMETERIVPROC) PassRef() (ref *C.PFNGLSAMPLERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLERPARAMETERIVPROC7D65B105Func == nil { - pFNGLSAMPLERPARAMETERIVPROC7D65B105Func = x - } - return (*C.PFNGLSAMPLERPARAMETERIVPROC)(C.PFNGLSAMPLERPARAMETERIVPROC_7d65b105), nil -} - -func (x PFNGLSAMPLERPARAMETERIVPROC) PassValue() (ref C.PFNGLSAMPLERPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSAMPLERPARAMETERIVPROC7D65B105Func == nil { - pFNGLSAMPLERPARAMETERIVPROC7D65B105Func = x - } - return (C.PFNGLSAMPLERPARAMETERIVPROC)(C.PFNGLSAMPLERPARAMETERIVPROC_7d65b105), nil -} - -func NewPFNGLSAMPLERPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLSAMPLERPARAMETERIVPROC { - return (*PFNGLSAMPLERPARAMETERIVPROC)(ref) -} - -//export PFNGLSAMPLERPARAMETERIVPROC7D65B105 -func PFNGLSAMPLERPARAMETERIVPROC7D65B105() { - if pFNGLSAMPLERPARAMETERIVPROC7D65B105Func != nil { - pFNGLSAMPLERPARAMETERIVPROC7D65B105Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSAMPLERPARAMETERIVPROC7D65B105Func PFNGLSAMPLERPARAMETERIVPROC - -func (x PFNGLSCISSORPROC) PassRef() (ref *C.PFNGLSCISSORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSCISSORPROC882C96CCFunc == nil { - pFNGLSCISSORPROC882C96CCFunc = x - } - return (*C.PFNGLSCISSORPROC)(C.PFNGLSCISSORPROC_882c96cc), nil -} - -func (x PFNGLSCISSORPROC) PassValue() (ref C.PFNGLSCISSORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSCISSORPROC882C96CCFunc == nil { - pFNGLSCISSORPROC882C96CCFunc = x - } - return (C.PFNGLSCISSORPROC)(C.PFNGLSCISSORPROC_882c96cc), nil -} - -func NewPFNGLSCISSORPROCRef(ref unsafe.Pointer) *PFNGLSCISSORPROC { - return (*PFNGLSCISSORPROC)(ref) -} - -//export PFNGLSCISSORPROC882C96CC -func PFNGLSCISSORPROC882C96CC() { - if pFNGLSCISSORPROC882C96CCFunc != nil { - pFNGLSCISSORPROC882C96CCFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSCISSORPROC882C96CCFunc PFNGLSCISSORPROC - -func (x PFNGLSHADERBINARYPROC) PassRef() (ref *C.PFNGLSHADERBINARYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSHADERBINARYPROCEB973FB2Func == nil { - pFNGLSHADERBINARYPROCEB973FB2Func = x - } - return (*C.PFNGLSHADERBINARYPROC)(C.PFNGLSHADERBINARYPROC_eb973fb2), nil -} - -func (x PFNGLSHADERBINARYPROC) PassValue() (ref C.PFNGLSHADERBINARYPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSHADERBINARYPROCEB973FB2Func == nil { - pFNGLSHADERBINARYPROCEB973FB2Func = x - } - return (C.PFNGLSHADERBINARYPROC)(C.PFNGLSHADERBINARYPROC_eb973fb2), nil -} - -func NewPFNGLSHADERBINARYPROCRef(ref unsafe.Pointer) *PFNGLSHADERBINARYPROC { - return (*PFNGLSHADERBINARYPROC)(ref) -} - -//export PFNGLSHADERBINARYPROCEB973FB2 -func PFNGLSHADERBINARYPROCEB973FB2() { - if pFNGLSHADERBINARYPROCEB973FB2Func != nil { - pFNGLSHADERBINARYPROCEB973FB2Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSHADERBINARYPROCEB973FB2Func PFNGLSHADERBINARYPROC - -func (x PFNGLSHADERSOURCEPROC) PassRef() (ref *C.PFNGLSHADERSOURCEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSHADERSOURCEPROC7FFE3E77Func == nil { - pFNGLSHADERSOURCEPROC7FFE3E77Func = x - } - return (*C.PFNGLSHADERSOURCEPROC)(C.PFNGLSHADERSOURCEPROC_7ffe3e77), nil -} - -func (x PFNGLSHADERSOURCEPROC) PassValue() (ref C.PFNGLSHADERSOURCEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSHADERSOURCEPROC7FFE3E77Func == nil { - pFNGLSHADERSOURCEPROC7FFE3E77Func = x - } - return (C.PFNGLSHADERSOURCEPROC)(C.PFNGLSHADERSOURCEPROC_7ffe3e77), nil -} - -func NewPFNGLSHADERSOURCEPROCRef(ref unsafe.Pointer) *PFNGLSHADERSOURCEPROC { - return (*PFNGLSHADERSOURCEPROC)(ref) -} - -//export PFNGLSHADERSOURCEPROC7FFE3E77 -func PFNGLSHADERSOURCEPROC7FFE3E77() { - if pFNGLSHADERSOURCEPROC7FFE3E77Func != nil { - pFNGLSHADERSOURCEPROC7FFE3E77Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSHADERSOURCEPROC7FFE3E77Func PFNGLSHADERSOURCEPROC - -func (x PFNGLSTENCILFUNCPROC) PassRef() (ref *C.PFNGLSTENCILFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILFUNCPROCCA625F61Func == nil { - pFNGLSTENCILFUNCPROCCA625F61Func = x - } - return (*C.PFNGLSTENCILFUNCPROC)(C.PFNGLSTENCILFUNCPROC_ca625f61), nil -} - -func (x PFNGLSTENCILFUNCPROC) PassValue() (ref C.PFNGLSTENCILFUNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILFUNCPROCCA625F61Func == nil { - pFNGLSTENCILFUNCPROCCA625F61Func = x - } - return (C.PFNGLSTENCILFUNCPROC)(C.PFNGLSTENCILFUNCPROC_ca625f61), nil -} - -func NewPFNGLSTENCILFUNCPROCRef(ref unsafe.Pointer) *PFNGLSTENCILFUNCPROC { - return (*PFNGLSTENCILFUNCPROC)(ref) -} - -//export PFNGLSTENCILFUNCPROCCA625F61 -func PFNGLSTENCILFUNCPROCCA625F61() { - if pFNGLSTENCILFUNCPROCCA625F61Func != nil { - pFNGLSTENCILFUNCPROCCA625F61Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILFUNCPROCCA625F61Func PFNGLSTENCILFUNCPROC - -func (x PFNGLSTENCILFUNCSEPARATEPROC) PassRef() (ref *C.PFNGLSTENCILFUNCSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILFUNCSEPARATEPROC91A002DCFunc == nil { - pFNGLSTENCILFUNCSEPARATEPROC91A002DCFunc = x - } - return (*C.PFNGLSTENCILFUNCSEPARATEPROC)(C.PFNGLSTENCILFUNCSEPARATEPROC_91a002dc), nil -} - -func (x PFNGLSTENCILFUNCSEPARATEPROC) PassValue() (ref C.PFNGLSTENCILFUNCSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILFUNCSEPARATEPROC91A002DCFunc == nil { - pFNGLSTENCILFUNCSEPARATEPROC91A002DCFunc = x - } - return (C.PFNGLSTENCILFUNCSEPARATEPROC)(C.PFNGLSTENCILFUNCSEPARATEPROC_91a002dc), nil -} - -func NewPFNGLSTENCILFUNCSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLSTENCILFUNCSEPARATEPROC { - return (*PFNGLSTENCILFUNCSEPARATEPROC)(ref) -} - -//export PFNGLSTENCILFUNCSEPARATEPROC91A002DC -func PFNGLSTENCILFUNCSEPARATEPROC91A002DC() { - if pFNGLSTENCILFUNCSEPARATEPROC91A002DCFunc != nil { - pFNGLSTENCILFUNCSEPARATEPROC91A002DCFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILFUNCSEPARATEPROC91A002DCFunc PFNGLSTENCILFUNCSEPARATEPROC - -func (x PFNGLSTENCILMASKPROC) PassRef() (ref *C.PFNGLSTENCILMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILMASKPROC2FCDA6ACFunc == nil { - pFNGLSTENCILMASKPROC2FCDA6ACFunc = x - } - return (*C.PFNGLSTENCILMASKPROC)(C.PFNGLSTENCILMASKPROC_2fcda6ac), nil -} - -func (x PFNGLSTENCILMASKPROC) PassValue() (ref C.PFNGLSTENCILMASKPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILMASKPROC2FCDA6ACFunc == nil { - pFNGLSTENCILMASKPROC2FCDA6ACFunc = x - } - return (C.PFNGLSTENCILMASKPROC)(C.PFNGLSTENCILMASKPROC_2fcda6ac), nil -} - -func NewPFNGLSTENCILMASKPROCRef(ref unsafe.Pointer) *PFNGLSTENCILMASKPROC { - return (*PFNGLSTENCILMASKPROC)(ref) -} - -//export PFNGLSTENCILMASKPROC2FCDA6AC -func PFNGLSTENCILMASKPROC2FCDA6AC() { - if pFNGLSTENCILMASKPROC2FCDA6ACFunc != nil { - pFNGLSTENCILMASKPROC2FCDA6ACFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILMASKPROC2FCDA6ACFunc PFNGLSTENCILMASKPROC - -func (x PFNGLSTENCILMASKSEPARATEPROC) PassRef() (ref *C.PFNGLSTENCILMASKSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILMASKSEPARATEPROC470E1C05Func == nil { - pFNGLSTENCILMASKSEPARATEPROC470E1C05Func = x - } - return (*C.PFNGLSTENCILMASKSEPARATEPROC)(C.PFNGLSTENCILMASKSEPARATEPROC_470e1c05), nil -} - -func (x PFNGLSTENCILMASKSEPARATEPROC) PassValue() (ref C.PFNGLSTENCILMASKSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILMASKSEPARATEPROC470E1C05Func == nil { - pFNGLSTENCILMASKSEPARATEPROC470E1C05Func = x - } - return (C.PFNGLSTENCILMASKSEPARATEPROC)(C.PFNGLSTENCILMASKSEPARATEPROC_470e1c05), nil -} - -func NewPFNGLSTENCILMASKSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLSTENCILMASKSEPARATEPROC { - return (*PFNGLSTENCILMASKSEPARATEPROC)(ref) -} - -//export PFNGLSTENCILMASKSEPARATEPROC470E1C05 -func PFNGLSTENCILMASKSEPARATEPROC470E1C05() { - if pFNGLSTENCILMASKSEPARATEPROC470E1C05Func != nil { - pFNGLSTENCILMASKSEPARATEPROC470E1C05Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILMASKSEPARATEPROC470E1C05Func PFNGLSTENCILMASKSEPARATEPROC - -func (x PFNGLSTENCILOPPROC) PassRef() (ref *C.PFNGLSTENCILOPPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILOPPROC6BFD6244Func == nil { - pFNGLSTENCILOPPROC6BFD6244Func = x - } - return (*C.PFNGLSTENCILOPPROC)(C.PFNGLSTENCILOPPROC_6bfd6244), nil -} - -func (x PFNGLSTENCILOPPROC) PassValue() (ref C.PFNGLSTENCILOPPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILOPPROC6BFD6244Func == nil { - pFNGLSTENCILOPPROC6BFD6244Func = x - } - return (C.PFNGLSTENCILOPPROC)(C.PFNGLSTENCILOPPROC_6bfd6244), nil -} - -func NewPFNGLSTENCILOPPROCRef(ref unsafe.Pointer) *PFNGLSTENCILOPPROC { - return (*PFNGLSTENCILOPPROC)(ref) -} - -//export PFNGLSTENCILOPPROC6BFD6244 -func PFNGLSTENCILOPPROC6BFD6244() { - if pFNGLSTENCILOPPROC6BFD6244Func != nil { - pFNGLSTENCILOPPROC6BFD6244Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILOPPROC6BFD6244Func PFNGLSTENCILOPPROC - -func (x PFNGLSTENCILOPSEPARATEPROC) PassRef() (ref *C.PFNGLSTENCILOPSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILOPSEPARATEPROC34D4AFBEFunc == nil { - pFNGLSTENCILOPSEPARATEPROC34D4AFBEFunc = x - } - return (*C.PFNGLSTENCILOPSEPARATEPROC)(C.PFNGLSTENCILOPSEPARATEPROC_34d4afbe), nil -} - -func (x PFNGLSTENCILOPSEPARATEPROC) PassValue() (ref C.PFNGLSTENCILOPSEPARATEPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLSTENCILOPSEPARATEPROC34D4AFBEFunc == nil { - pFNGLSTENCILOPSEPARATEPROC34D4AFBEFunc = x - } - return (C.PFNGLSTENCILOPSEPARATEPROC)(C.PFNGLSTENCILOPSEPARATEPROC_34d4afbe), nil -} - -func NewPFNGLSTENCILOPSEPARATEPROCRef(ref unsafe.Pointer) *PFNGLSTENCILOPSEPARATEPROC { - return (*PFNGLSTENCILOPSEPARATEPROC)(ref) -} - -//export PFNGLSTENCILOPSEPARATEPROC34D4AFBE -func PFNGLSTENCILOPSEPARATEPROC34D4AFBE() { - if pFNGLSTENCILOPSEPARATEPROC34D4AFBEFunc != nil { - pFNGLSTENCILOPSEPARATEPROC34D4AFBEFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLSTENCILOPSEPARATEPROC34D4AFBEFunc PFNGLSTENCILOPSEPARATEPROC - -func (x PFNGLTEXIMAGE2DPROC) PassRef() (ref *C.PFNGLTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXIMAGE2DPROC5118E801Func == nil { - pFNGLTEXIMAGE2DPROC5118E801Func = x - } - return (*C.PFNGLTEXIMAGE2DPROC)(C.PFNGLTEXIMAGE2DPROC_5118e801), nil -} - -func (x PFNGLTEXIMAGE2DPROC) PassValue() (ref C.PFNGLTEXIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXIMAGE2DPROC5118E801Func == nil { - pFNGLTEXIMAGE2DPROC5118E801Func = x - } - return (C.PFNGLTEXIMAGE2DPROC)(C.PFNGLTEXIMAGE2DPROC_5118e801), nil -} - -func NewPFNGLTEXIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLTEXIMAGE2DPROC { - return (*PFNGLTEXIMAGE2DPROC)(ref) -} - -//export PFNGLTEXIMAGE2DPROC5118E801 -func PFNGLTEXIMAGE2DPROC5118E801() { - if pFNGLTEXIMAGE2DPROC5118E801Func != nil { - pFNGLTEXIMAGE2DPROC5118E801Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXIMAGE2DPROC5118E801Func PFNGLTEXIMAGE2DPROC - -func (x PFNGLTEXIMAGE3DPROC) PassRef() (ref *C.PFNGLTEXIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXIMAGE3DPROC36A4932AFunc == nil { - pFNGLTEXIMAGE3DPROC36A4932AFunc = x - } - return (*C.PFNGLTEXIMAGE3DPROC)(C.PFNGLTEXIMAGE3DPROC_36a4932a), nil -} - -func (x PFNGLTEXIMAGE3DPROC) PassValue() (ref C.PFNGLTEXIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXIMAGE3DPROC36A4932AFunc == nil { - pFNGLTEXIMAGE3DPROC36A4932AFunc = x - } - return (C.PFNGLTEXIMAGE3DPROC)(C.PFNGLTEXIMAGE3DPROC_36a4932a), nil -} - -func NewPFNGLTEXIMAGE3DPROCRef(ref unsafe.Pointer) *PFNGLTEXIMAGE3DPROC { - return (*PFNGLTEXIMAGE3DPROC)(ref) -} - -//export PFNGLTEXIMAGE3DPROC36A4932A -func PFNGLTEXIMAGE3DPROC36A4932A() { - if pFNGLTEXIMAGE3DPROC36A4932AFunc != nil { - pFNGLTEXIMAGE3DPROC36A4932AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXIMAGE3DPROC36A4932AFunc PFNGLTEXIMAGE3DPROC - -func (x PFNGLTEXPARAMETERFPROC) PassRef() (ref *C.PFNGLTEXPARAMETERFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERFPROC1D38FABBFunc == nil { - pFNGLTEXPARAMETERFPROC1D38FABBFunc = x - } - return (*C.PFNGLTEXPARAMETERFPROC)(C.PFNGLTEXPARAMETERFPROC_1d38fabb), nil -} - -func (x PFNGLTEXPARAMETERFPROC) PassValue() (ref C.PFNGLTEXPARAMETERFPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERFPROC1D38FABBFunc == nil { - pFNGLTEXPARAMETERFPROC1D38FABBFunc = x - } - return (C.PFNGLTEXPARAMETERFPROC)(C.PFNGLTEXPARAMETERFPROC_1d38fabb), nil -} - -func NewPFNGLTEXPARAMETERFPROCRef(ref unsafe.Pointer) *PFNGLTEXPARAMETERFPROC { - return (*PFNGLTEXPARAMETERFPROC)(ref) -} - -//export PFNGLTEXPARAMETERFPROC1D38FABB -func PFNGLTEXPARAMETERFPROC1D38FABB() { - if pFNGLTEXPARAMETERFPROC1D38FABBFunc != nil { - pFNGLTEXPARAMETERFPROC1D38FABBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXPARAMETERFPROC1D38FABBFunc PFNGLTEXPARAMETERFPROC - -func (x PFNGLTEXPARAMETERFVPROC) PassRef() (ref *C.PFNGLTEXPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERFVPROC0B118E13Func == nil { - pFNGLTEXPARAMETERFVPROC0B118E13Func = x - } - return (*C.PFNGLTEXPARAMETERFVPROC)(C.PFNGLTEXPARAMETERFVPROC_0b118e13), nil -} - -func (x PFNGLTEXPARAMETERFVPROC) PassValue() (ref C.PFNGLTEXPARAMETERFVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERFVPROC0B118E13Func == nil { - pFNGLTEXPARAMETERFVPROC0B118E13Func = x - } - return (C.PFNGLTEXPARAMETERFVPROC)(C.PFNGLTEXPARAMETERFVPROC_0b118e13), nil -} - -func NewPFNGLTEXPARAMETERFVPROCRef(ref unsafe.Pointer) *PFNGLTEXPARAMETERFVPROC { - return (*PFNGLTEXPARAMETERFVPROC)(ref) -} - -//export PFNGLTEXPARAMETERFVPROC0B118E13 -func PFNGLTEXPARAMETERFVPROC0B118E13() { - if pFNGLTEXPARAMETERFVPROC0B118E13Func != nil { - pFNGLTEXPARAMETERFVPROC0B118E13Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXPARAMETERFVPROC0B118E13Func PFNGLTEXPARAMETERFVPROC - -func (x PFNGLTEXPARAMETERIPROC) PassRef() (ref *C.PFNGLTEXPARAMETERIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERIPROC3F03378AFunc == nil { - pFNGLTEXPARAMETERIPROC3F03378AFunc = x - } - return (*C.PFNGLTEXPARAMETERIPROC)(C.PFNGLTEXPARAMETERIPROC_3f03378a), nil -} - -func (x PFNGLTEXPARAMETERIPROC) PassValue() (ref C.PFNGLTEXPARAMETERIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERIPROC3F03378AFunc == nil { - pFNGLTEXPARAMETERIPROC3F03378AFunc = x - } - return (C.PFNGLTEXPARAMETERIPROC)(C.PFNGLTEXPARAMETERIPROC_3f03378a), nil -} - -func NewPFNGLTEXPARAMETERIPROCRef(ref unsafe.Pointer) *PFNGLTEXPARAMETERIPROC { - return (*PFNGLTEXPARAMETERIPROC)(ref) -} - -//export PFNGLTEXPARAMETERIPROC3F03378A -func PFNGLTEXPARAMETERIPROC3F03378A() { - if pFNGLTEXPARAMETERIPROC3F03378AFunc != nil { - pFNGLTEXPARAMETERIPROC3F03378AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXPARAMETERIPROC3F03378AFunc PFNGLTEXPARAMETERIPROC - -func (x PFNGLTEXPARAMETERIVPROC) PassRef() (ref *C.PFNGLTEXPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERIVPROC7337F38EFunc == nil { - pFNGLTEXPARAMETERIVPROC7337F38EFunc = x - } - return (*C.PFNGLTEXPARAMETERIVPROC)(C.PFNGLTEXPARAMETERIVPROC_7337f38e), nil -} - -func (x PFNGLTEXPARAMETERIVPROC) PassValue() (ref C.PFNGLTEXPARAMETERIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXPARAMETERIVPROC7337F38EFunc == nil { - pFNGLTEXPARAMETERIVPROC7337F38EFunc = x - } - return (C.PFNGLTEXPARAMETERIVPROC)(C.PFNGLTEXPARAMETERIVPROC_7337f38e), nil -} - -func NewPFNGLTEXPARAMETERIVPROCRef(ref unsafe.Pointer) *PFNGLTEXPARAMETERIVPROC { - return (*PFNGLTEXPARAMETERIVPROC)(ref) -} - -//export PFNGLTEXPARAMETERIVPROC7337F38E -func PFNGLTEXPARAMETERIVPROC7337F38E() { - if pFNGLTEXPARAMETERIVPROC7337F38EFunc != nil { - pFNGLTEXPARAMETERIVPROC7337F38EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXPARAMETERIVPROC7337F38EFunc PFNGLTEXPARAMETERIVPROC - -func (x PFNGLTEXSTORAGE2DPROC) PassRef() (ref *C.PFNGLTEXSTORAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSTORAGE2DPROC408B7C7CFunc == nil { - pFNGLTEXSTORAGE2DPROC408B7C7CFunc = x - } - return (*C.PFNGLTEXSTORAGE2DPROC)(C.PFNGLTEXSTORAGE2DPROC_408b7c7c), nil -} - -func (x PFNGLTEXSTORAGE2DPROC) PassValue() (ref C.PFNGLTEXSTORAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSTORAGE2DPROC408B7C7CFunc == nil { - pFNGLTEXSTORAGE2DPROC408B7C7CFunc = x - } - return (C.PFNGLTEXSTORAGE2DPROC)(C.PFNGLTEXSTORAGE2DPROC_408b7c7c), nil -} - -func NewPFNGLTEXSTORAGE2DPROCRef(ref unsafe.Pointer) *PFNGLTEXSTORAGE2DPROC { - return (*PFNGLTEXSTORAGE2DPROC)(ref) -} - -//export PFNGLTEXSTORAGE2DPROC408B7C7C -func PFNGLTEXSTORAGE2DPROC408B7C7C() { - if pFNGLTEXSTORAGE2DPROC408B7C7CFunc != nil { - pFNGLTEXSTORAGE2DPROC408B7C7CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXSTORAGE2DPROC408B7C7CFunc PFNGLTEXSTORAGE2DPROC - -func (x PFNGLTEXSTORAGE3DPROC) PassRef() (ref *C.PFNGLTEXSTORAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSTORAGE3DPROCCCDC130DFunc == nil { - pFNGLTEXSTORAGE3DPROCCCDC130DFunc = x - } - return (*C.PFNGLTEXSTORAGE3DPROC)(C.PFNGLTEXSTORAGE3DPROC_ccdc130d), nil -} - -func (x PFNGLTEXSTORAGE3DPROC) PassValue() (ref C.PFNGLTEXSTORAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSTORAGE3DPROCCCDC130DFunc == nil { - pFNGLTEXSTORAGE3DPROCCCDC130DFunc = x - } - return (C.PFNGLTEXSTORAGE3DPROC)(C.PFNGLTEXSTORAGE3DPROC_ccdc130d), nil -} - -func NewPFNGLTEXSTORAGE3DPROCRef(ref unsafe.Pointer) *PFNGLTEXSTORAGE3DPROC { - return (*PFNGLTEXSTORAGE3DPROC)(ref) -} - -//export PFNGLTEXSTORAGE3DPROCCCDC130D -func PFNGLTEXSTORAGE3DPROCCCDC130D() { - if pFNGLTEXSTORAGE3DPROCCCDC130DFunc != nil { - pFNGLTEXSTORAGE3DPROCCCDC130DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXSTORAGE3DPROCCCDC130DFunc PFNGLTEXSTORAGE3DPROC - -func (x PFNGLTEXSUBIMAGE2DPROC) PassRef() (ref *C.PFNGLTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSUBIMAGE2DPROCACCD8326Func == nil { - pFNGLTEXSUBIMAGE2DPROCACCD8326Func = x - } - return (*C.PFNGLTEXSUBIMAGE2DPROC)(C.PFNGLTEXSUBIMAGE2DPROC_accd8326), nil -} - -func (x PFNGLTEXSUBIMAGE2DPROC) PassValue() (ref C.PFNGLTEXSUBIMAGE2DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSUBIMAGE2DPROCACCD8326Func == nil { - pFNGLTEXSUBIMAGE2DPROCACCD8326Func = x - } - return (C.PFNGLTEXSUBIMAGE2DPROC)(C.PFNGLTEXSUBIMAGE2DPROC_accd8326), nil -} - -func NewPFNGLTEXSUBIMAGE2DPROCRef(ref unsafe.Pointer) *PFNGLTEXSUBIMAGE2DPROC { - return (*PFNGLTEXSUBIMAGE2DPROC)(ref) -} - -//export PFNGLTEXSUBIMAGE2DPROCACCD8326 -func PFNGLTEXSUBIMAGE2DPROCACCD8326() { - if pFNGLTEXSUBIMAGE2DPROCACCD8326Func != nil { - pFNGLTEXSUBIMAGE2DPROCACCD8326Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXSUBIMAGE2DPROCACCD8326Func PFNGLTEXSUBIMAGE2DPROC - -func (x PFNGLTEXSUBIMAGE3DPROC) PassRef() (ref *C.PFNGLTEXSUBIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSUBIMAGE3DPROC65F790A0Func == nil { - pFNGLTEXSUBIMAGE3DPROC65F790A0Func = x - } - return (*C.PFNGLTEXSUBIMAGE3DPROC)(C.PFNGLTEXSUBIMAGE3DPROC_65f790a0), nil -} - -func (x PFNGLTEXSUBIMAGE3DPROC) PassValue() (ref C.PFNGLTEXSUBIMAGE3DPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTEXSUBIMAGE3DPROC65F790A0Func == nil { - pFNGLTEXSUBIMAGE3DPROC65F790A0Func = x - } - return (C.PFNGLTEXSUBIMAGE3DPROC)(C.PFNGLTEXSUBIMAGE3DPROC_65f790a0), nil -} - -func NewPFNGLTEXSUBIMAGE3DPROCRef(ref unsafe.Pointer) *PFNGLTEXSUBIMAGE3DPROC { - return (*PFNGLTEXSUBIMAGE3DPROC)(ref) -} - -//export PFNGLTEXSUBIMAGE3DPROC65F790A0 -func PFNGLTEXSUBIMAGE3DPROC65F790A0() { - if pFNGLTEXSUBIMAGE3DPROC65F790A0Func != nil { - pFNGLTEXSUBIMAGE3DPROC65F790A0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTEXSUBIMAGE3DPROC65F790A0Func PFNGLTEXSUBIMAGE3DPROC - -func (x PFNGLTRANSFORMFEEDBACKVARYINGSPROC) PassRef() (ref *C.PFNGLTRANSFORMFEEDBACKVARYINGSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2Func == nil { - pFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2Func = x - } - return (*C.PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(C.PFNGLTRANSFORMFEEDBACKVARYINGSPROC_1095cbc2), nil -} - -func (x PFNGLTRANSFORMFEEDBACKVARYINGSPROC) PassValue() (ref C.PFNGLTRANSFORMFEEDBACKVARYINGSPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2Func == nil { - pFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2Func = x - } - return (C.PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(C.PFNGLTRANSFORMFEEDBACKVARYINGSPROC_1095cbc2), nil -} - -func NewPFNGLTRANSFORMFEEDBACKVARYINGSPROCRef(ref unsafe.Pointer) *PFNGLTRANSFORMFEEDBACKVARYINGSPROC { - return (*PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(ref) -} - -//export PFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2 -func PFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2() { - if pFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2Func != nil { - pFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLTRANSFORMFEEDBACKVARYINGSPROC1095CBC2Func PFNGLTRANSFORMFEEDBACKVARYINGSPROC - -func (x PFNGLUNIFORM1FPROC) PassRef() (ref *C.PFNGLUNIFORM1FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1FPROC59F5A391Func == nil { - pFNGLUNIFORM1FPROC59F5A391Func = x - } - return (*C.PFNGLUNIFORM1FPROC)(C.PFNGLUNIFORM1FPROC_59f5a391), nil -} - -func (x PFNGLUNIFORM1FPROC) PassValue() (ref C.PFNGLUNIFORM1FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1FPROC59F5A391Func == nil { - pFNGLUNIFORM1FPROC59F5A391Func = x - } - return (C.PFNGLUNIFORM1FPROC)(C.PFNGLUNIFORM1FPROC_59f5a391), nil -} - -func NewPFNGLUNIFORM1FPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1FPROC { - return (*PFNGLUNIFORM1FPROC)(ref) -} - -//export PFNGLUNIFORM1FPROC59F5A391 -func PFNGLUNIFORM1FPROC59F5A391() { - if pFNGLUNIFORM1FPROC59F5A391Func != nil { - pFNGLUNIFORM1FPROC59F5A391Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1FPROC59F5A391Func PFNGLUNIFORM1FPROC - -func (x PFNGLUNIFORM1FVPROC) PassRef() (ref *C.PFNGLUNIFORM1FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1FVPROC51063184Func == nil { - pFNGLUNIFORM1FVPROC51063184Func = x - } - return (*C.PFNGLUNIFORM1FVPROC)(C.PFNGLUNIFORM1FVPROC_51063184), nil -} - -func (x PFNGLUNIFORM1FVPROC) PassValue() (ref C.PFNGLUNIFORM1FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1FVPROC51063184Func == nil { - pFNGLUNIFORM1FVPROC51063184Func = x - } - return (C.PFNGLUNIFORM1FVPROC)(C.PFNGLUNIFORM1FVPROC_51063184), nil -} - -func NewPFNGLUNIFORM1FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1FVPROC { - return (*PFNGLUNIFORM1FVPROC)(ref) -} - -//export PFNGLUNIFORM1FVPROC51063184 -func PFNGLUNIFORM1FVPROC51063184() { - if pFNGLUNIFORM1FVPROC51063184Func != nil { - pFNGLUNIFORM1FVPROC51063184Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1FVPROC51063184Func PFNGLUNIFORM1FVPROC - -func (x PFNGLUNIFORM1IPROC) PassRef() (ref *C.PFNGLUNIFORM1IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1IPROC9956B5F5Func == nil { - pFNGLUNIFORM1IPROC9956B5F5Func = x - } - return (*C.PFNGLUNIFORM1IPROC)(C.PFNGLUNIFORM1IPROC_9956b5f5), nil -} - -func (x PFNGLUNIFORM1IPROC) PassValue() (ref C.PFNGLUNIFORM1IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1IPROC9956B5F5Func == nil { - pFNGLUNIFORM1IPROC9956B5F5Func = x - } - return (C.PFNGLUNIFORM1IPROC)(C.PFNGLUNIFORM1IPROC_9956b5f5), nil -} - -func NewPFNGLUNIFORM1IPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1IPROC { - return (*PFNGLUNIFORM1IPROC)(ref) -} - -//export PFNGLUNIFORM1IPROC9956B5F5 -func PFNGLUNIFORM1IPROC9956B5F5() { - if pFNGLUNIFORM1IPROC9956B5F5Func != nil { - pFNGLUNIFORM1IPROC9956B5F5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1IPROC9956B5F5Func PFNGLUNIFORM1IPROC - -func (x PFNGLUNIFORM1IVPROC) PassRef() (ref *C.PFNGLUNIFORM1IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1IVPROCE056147CFunc == nil { - pFNGLUNIFORM1IVPROCE056147CFunc = x - } - return (*C.PFNGLUNIFORM1IVPROC)(C.PFNGLUNIFORM1IVPROC_e056147c), nil -} - -func (x PFNGLUNIFORM1IVPROC) PassValue() (ref C.PFNGLUNIFORM1IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1IVPROCE056147CFunc == nil { - pFNGLUNIFORM1IVPROCE056147CFunc = x - } - return (C.PFNGLUNIFORM1IVPROC)(C.PFNGLUNIFORM1IVPROC_e056147c), nil -} - -func NewPFNGLUNIFORM1IVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1IVPROC { - return (*PFNGLUNIFORM1IVPROC)(ref) -} - -//export PFNGLUNIFORM1IVPROCE056147C -func PFNGLUNIFORM1IVPROCE056147C() { - if pFNGLUNIFORM1IVPROCE056147CFunc != nil { - pFNGLUNIFORM1IVPROCE056147CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1IVPROCE056147CFunc PFNGLUNIFORM1IVPROC - -func (x PFNGLUNIFORM1UIPROC) PassRef() (ref *C.PFNGLUNIFORM1UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1UIPROC81070BCBFunc == nil { - pFNGLUNIFORM1UIPROC81070BCBFunc = x - } - return (*C.PFNGLUNIFORM1UIPROC)(C.PFNGLUNIFORM1UIPROC_81070bcb), nil -} - -func (x PFNGLUNIFORM1UIPROC) PassValue() (ref C.PFNGLUNIFORM1UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1UIPROC81070BCBFunc == nil { - pFNGLUNIFORM1UIPROC81070BCBFunc = x - } - return (C.PFNGLUNIFORM1UIPROC)(C.PFNGLUNIFORM1UIPROC_81070bcb), nil -} - -func NewPFNGLUNIFORM1UIPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1UIPROC { - return (*PFNGLUNIFORM1UIPROC)(ref) -} - -//export PFNGLUNIFORM1UIPROC81070BCB -func PFNGLUNIFORM1UIPROC81070BCB() { - if pFNGLUNIFORM1UIPROC81070BCBFunc != nil { - pFNGLUNIFORM1UIPROC81070BCBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1UIPROC81070BCBFunc PFNGLUNIFORM1UIPROC - -func (x PFNGLUNIFORM1UIVPROC) PassRef() (ref *C.PFNGLUNIFORM1UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1UIVPROC9EEBD3ECFunc == nil { - pFNGLUNIFORM1UIVPROC9EEBD3ECFunc = x - } - return (*C.PFNGLUNIFORM1UIVPROC)(C.PFNGLUNIFORM1UIVPROC_9eebd3ec), nil -} - -func (x PFNGLUNIFORM1UIVPROC) PassValue() (ref C.PFNGLUNIFORM1UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM1UIVPROC9EEBD3ECFunc == nil { - pFNGLUNIFORM1UIVPROC9EEBD3ECFunc = x - } - return (C.PFNGLUNIFORM1UIVPROC)(C.PFNGLUNIFORM1UIVPROC_9eebd3ec), nil -} - -func NewPFNGLUNIFORM1UIVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM1UIVPROC { - return (*PFNGLUNIFORM1UIVPROC)(ref) -} - -//export PFNGLUNIFORM1UIVPROC9EEBD3EC -func PFNGLUNIFORM1UIVPROC9EEBD3EC() { - if pFNGLUNIFORM1UIVPROC9EEBD3ECFunc != nil { - pFNGLUNIFORM1UIVPROC9EEBD3ECFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM1UIVPROC9EEBD3ECFunc PFNGLUNIFORM1UIVPROC - -func (x PFNGLUNIFORM2FPROC) PassRef() (ref *C.PFNGLUNIFORM2FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2FPROC4A2BEBBFFunc == nil { - pFNGLUNIFORM2FPROC4A2BEBBFFunc = x - } - return (*C.PFNGLUNIFORM2FPROC)(C.PFNGLUNIFORM2FPROC_4a2bebbf), nil -} - -func (x PFNGLUNIFORM2FPROC) PassValue() (ref C.PFNGLUNIFORM2FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2FPROC4A2BEBBFFunc == nil { - pFNGLUNIFORM2FPROC4A2BEBBFFunc = x - } - return (C.PFNGLUNIFORM2FPROC)(C.PFNGLUNIFORM2FPROC_4a2bebbf), nil -} - -func NewPFNGLUNIFORM2FPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2FPROC { - return (*PFNGLUNIFORM2FPROC)(ref) -} - -//export PFNGLUNIFORM2FPROC4A2BEBBF -func PFNGLUNIFORM2FPROC4A2BEBBF() { - if pFNGLUNIFORM2FPROC4A2BEBBFFunc != nil { - pFNGLUNIFORM2FPROC4A2BEBBFFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2FPROC4A2BEBBFFunc PFNGLUNIFORM2FPROC - -func (x PFNGLUNIFORM2FVPROC) PassRef() (ref *C.PFNGLUNIFORM2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2FVPROC791C53E7Func == nil { - pFNGLUNIFORM2FVPROC791C53E7Func = x - } - return (*C.PFNGLUNIFORM2FVPROC)(C.PFNGLUNIFORM2FVPROC_791c53e7), nil -} - -func (x PFNGLUNIFORM2FVPROC) PassValue() (ref C.PFNGLUNIFORM2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2FVPROC791C53E7Func == nil { - pFNGLUNIFORM2FVPROC791C53E7Func = x - } - return (C.PFNGLUNIFORM2FVPROC)(C.PFNGLUNIFORM2FVPROC_791c53e7), nil -} - -func NewPFNGLUNIFORM2FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2FVPROC { - return (*PFNGLUNIFORM2FVPROC)(ref) -} - -//export PFNGLUNIFORM2FVPROC791C53E7 -func PFNGLUNIFORM2FVPROC791C53E7() { - if pFNGLUNIFORM2FVPROC791C53E7Func != nil { - pFNGLUNIFORM2FVPROC791C53E7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2FVPROC791C53E7Func PFNGLUNIFORM2FVPROC - -func (x PFNGLUNIFORM2IPROC) PassRef() (ref *C.PFNGLUNIFORM2IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2IPROCB9A237A7Func == nil { - pFNGLUNIFORM2IPROCB9A237A7Func = x - } - return (*C.PFNGLUNIFORM2IPROC)(C.PFNGLUNIFORM2IPROC_b9a237a7), nil -} - -func (x PFNGLUNIFORM2IPROC) PassValue() (ref C.PFNGLUNIFORM2IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2IPROCB9A237A7Func == nil { - pFNGLUNIFORM2IPROCB9A237A7Func = x - } - return (C.PFNGLUNIFORM2IPROC)(C.PFNGLUNIFORM2IPROC_b9a237a7), nil -} - -func NewPFNGLUNIFORM2IPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2IPROC { - return (*PFNGLUNIFORM2IPROC)(ref) -} - -//export PFNGLUNIFORM2IPROCB9A237A7 -func PFNGLUNIFORM2IPROCB9A237A7() { - if pFNGLUNIFORM2IPROCB9A237A7Func != nil { - pFNGLUNIFORM2IPROCB9A237A7Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2IPROCB9A237A7Func PFNGLUNIFORM2IPROC - -func (x PFNGLUNIFORM2IVPROC) PassRef() (ref *C.PFNGLUNIFORM2IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2IVPROC88812862Func == nil { - pFNGLUNIFORM2IVPROC88812862Func = x - } - return (*C.PFNGLUNIFORM2IVPROC)(C.PFNGLUNIFORM2IVPROC_88812862), nil -} - -func (x PFNGLUNIFORM2IVPROC) PassValue() (ref C.PFNGLUNIFORM2IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2IVPROC88812862Func == nil { - pFNGLUNIFORM2IVPROC88812862Func = x - } - return (C.PFNGLUNIFORM2IVPROC)(C.PFNGLUNIFORM2IVPROC_88812862), nil -} - -func NewPFNGLUNIFORM2IVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2IVPROC { - return (*PFNGLUNIFORM2IVPROC)(ref) -} - -//export PFNGLUNIFORM2IVPROC88812862 -func PFNGLUNIFORM2IVPROC88812862() { - if pFNGLUNIFORM2IVPROC88812862Func != nil { - pFNGLUNIFORM2IVPROC88812862Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2IVPROC88812862Func PFNGLUNIFORM2IVPROC - -func (x PFNGLUNIFORM2UIPROC) PassRef() (ref *C.PFNGLUNIFORM2UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2UIPROCFBBDBAEAFunc == nil { - pFNGLUNIFORM2UIPROCFBBDBAEAFunc = x - } - return (*C.PFNGLUNIFORM2UIPROC)(C.PFNGLUNIFORM2UIPROC_fbbdbaea), nil -} - -func (x PFNGLUNIFORM2UIPROC) PassValue() (ref C.PFNGLUNIFORM2UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2UIPROCFBBDBAEAFunc == nil { - pFNGLUNIFORM2UIPROCFBBDBAEAFunc = x - } - return (C.PFNGLUNIFORM2UIPROC)(C.PFNGLUNIFORM2UIPROC_fbbdbaea), nil -} - -func NewPFNGLUNIFORM2UIPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2UIPROC { - return (*PFNGLUNIFORM2UIPROC)(ref) -} - -//export PFNGLUNIFORM2UIPROCFBBDBAEA -func PFNGLUNIFORM2UIPROCFBBDBAEA() { - if pFNGLUNIFORM2UIPROCFBBDBAEAFunc != nil { - pFNGLUNIFORM2UIPROCFBBDBAEAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2UIPROCFBBDBAEAFunc PFNGLUNIFORM2UIPROC - -func (x PFNGLUNIFORM2UIVPROC) PassRef() (ref *C.PFNGLUNIFORM2UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2UIVPROCACD33CBAFunc == nil { - pFNGLUNIFORM2UIVPROCACD33CBAFunc = x - } - return (*C.PFNGLUNIFORM2UIVPROC)(C.PFNGLUNIFORM2UIVPROC_acd33cba), nil -} - -func (x PFNGLUNIFORM2UIVPROC) PassValue() (ref C.PFNGLUNIFORM2UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM2UIVPROCACD33CBAFunc == nil { - pFNGLUNIFORM2UIVPROCACD33CBAFunc = x - } - return (C.PFNGLUNIFORM2UIVPROC)(C.PFNGLUNIFORM2UIVPROC_acd33cba), nil -} - -func NewPFNGLUNIFORM2UIVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM2UIVPROC { - return (*PFNGLUNIFORM2UIVPROC)(ref) -} - -//export PFNGLUNIFORM2UIVPROCACD33CBA -func PFNGLUNIFORM2UIVPROCACD33CBA() { - if pFNGLUNIFORM2UIVPROCACD33CBAFunc != nil { - pFNGLUNIFORM2UIVPROCACD33CBAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM2UIVPROCACD33CBAFunc PFNGLUNIFORM2UIVPROC - -func (x PFNGLUNIFORM3FPROC) PassRef() (ref *C.PFNGLUNIFORM3FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3FPROCBEF7AA61Func == nil { - pFNGLUNIFORM3FPROCBEF7AA61Func = x - } - return (*C.PFNGLUNIFORM3FPROC)(C.PFNGLUNIFORM3FPROC_bef7aa61), nil -} - -func (x PFNGLUNIFORM3FPROC) PassValue() (ref C.PFNGLUNIFORM3FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3FPROCBEF7AA61Func == nil { - pFNGLUNIFORM3FPROCBEF7AA61Func = x - } - return (C.PFNGLUNIFORM3FPROC)(C.PFNGLUNIFORM3FPROC_bef7aa61), nil -} - -func NewPFNGLUNIFORM3FPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3FPROC { - return (*PFNGLUNIFORM3FPROC)(ref) -} - -//export PFNGLUNIFORM3FPROCBEF7AA61 -func PFNGLUNIFORM3FPROCBEF7AA61() { - if pFNGLUNIFORM3FPROCBEF7AA61Func != nil { - pFNGLUNIFORM3FPROCBEF7AA61Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3FPROCBEF7AA61Func PFNGLUNIFORM3FPROC - -func (x PFNGLUNIFORM3FVPROC) PassRef() (ref *C.PFNGLUNIFORM3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3FVPROC93B9ACFBFunc == nil { - pFNGLUNIFORM3FVPROC93B9ACFBFunc = x - } - return (*C.PFNGLUNIFORM3FVPROC)(C.PFNGLUNIFORM3FVPROC_93b9acfb), nil -} - -func (x PFNGLUNIFORM3FVPROC) PassValue() (ref C.PFNGLUNIFORM3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3FVPROC93B9ACFBFunc == nil { - pFNGLUNIFORM3FVPROC93B9ACFBFunc = x - } - return (C.PFNGLUNIFORM3FVPROC)(C.PFNGLUNIFORM3FVPROC_93b9acfb), nil -} - -func NewPFNGLUNIFORM3FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3FVPROC { - return (*PFNGLUNIFORM3FVPROC)(ref) -} - -//export PFNGLUNIFORM3FVPROC93B9ACFB -func PFNGLUNIFORM3FVPROC93B9ACFB() { - if pFNGLUNIFORM3FVPROC93B9ACFBFunc != nil { - pFNGLUNIFORM3FVPROC93B9ACFBFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3FVPROC93B9ACFBFunc PFNGLUNIFORM3FVPROC - -func (x PFNGLUNIFORM3IPROC) PassRef() (ref *C.PFNGLUNIFORM3IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3IPROC1E304EDAFunc == nil { - pFNGLUNIFORM3IPROC1E304EDAFunc = x - } - return (*C.PFNGLUNIFORM3IPROC)(C.PFNGLUNIFORM3IPROC_1e304eda), nil -} - -func (x PFNGLUNIFORM3IPROC) PassValue() (ref C.PFNGLUNIFORM3IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3IPROC1E304EDAFunc == nil { - pFNGLUNIFORM3IPROC1E304EDAFunc = x - } - return (C.PFNGLUNIFORM3IPROC)(C.PFNGLUNIFORM3IPROC_1e304eda), nil -} - -func NewPFNGLUNIFORM3IPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3IPROC { - return (*PFNGLUNIFORM3IPROC)(ref) -} - -//export PFNGLUNIFORM3IPROC1E304EDA -func PFNGLUNIFORM3IPROC1E304EDA() { - if pFNGLUNIFORM3IPROC1E304EDAFunc != nil { - pFNGLUNIFORM3IPROC1E304EDAFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3IPROC1E304EDAFunc PFNGLUNIFORM3IPROC - -func (x PFNGLUNIFORM3IVPROC) PassRef() (ref *C.PFNGLUNIFORM3IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3IVPROCE98100D4Func == nil { - pFNGLUNIFORM3IVPROCE98100D4Func = x - } - return (*C.PFNGLUNIFORM3IVPROC)(C.PFNGLUNIFORM3IVPROC_e98100d4), nil -} - -func (x PFNGLUNIFORM3IVPROC) PassValue() (ref C.PFNGLUNIFORM3IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3IVPROCE98100D4Func == nil { - pFNGLUNIFORM3IVPROCE98100D4Func = x - } - return (C.PFNGLUNIFORM3IVPROC)(C.PFNGLUNIFORM3IVPROC_e98100d4), nil -} - -func NewPFNGLUNIFORM3IVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3IVPROC { - return (*PFNGLUNIFORM3IVPROC)(ref) -} - -//export PFNGLUNIFORM3IVPROCE98100D4 -func PFNGLUNIFORM3IVPROCE98100D4() { - if pFNGLUNIFORM3IVPROCE98100D4Func != nil { - pFNGLUNIFORM3IVPROCE98100D4Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3IVPROCE98100D4Func PFNGLUNIFORM3IVPROC - -func (x PFNGLUNIFORM3UIPROC) PassRef() (ref *C.PFNGLUNIFORM3UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3UIPROCBDC65300Func == nil { - pFNGLUNIFORM3UIPROCBDC65300Func = x - } - return (*C.PFNGLUNIFORM3UIPROC)(C.PFNGLUNIFORM3UIPROC_bdc65300), nil -} - -func (x PFNGLUNIFORM3UIPROC) PassValue() (ref C.PFNGLUNIFORM3UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3UIPROCBDC65300Func == nil { - pFNGLUNIFORM3UIPROCBDC65300Func = x - } - return (C.PFNGLUNIFORM3UIPROC)(C.PFNGLUNIFORM3UIPROC_bdc65300), nil -} - -func NewPFNGLUNIFORM3UIPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3UIPROC { - return (*PFNGLUNIFORM3UIPROC)(ref) -} - -//export PFNGLUNIFORM3UIPROCBDC65300 -func PFNGLUNIFORM3UIPROCBDC65300() { - if pFNGLUNIFORM3UIPROCBDC65300Func != nil { - pFNGLUNIFORM3UIPROCBDC65300Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3UIPROCBDC65300Func PFNGLUNIFORM3UIPROC - -func (x PFNGLUNIFORM3UIVPROC) PassRef() (ref *C.PFNGLUNIFORM3UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3UIVPROC206D6B43Func == nil { - pFNGLUNIFORM3UIVPROC206D6B43Func = x - } - return (*C.PFNGLUNIFORM3UIVPROC)(C.PFNGLUNIFORM3UIVPROC_206d6b43), nil -} - -func (x PFNGLUNIFORM3UIVPROC) PassValue() (ref C.PFNGLUNIFORM3UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM3UIVPROC206D6B43Func == nil { - pFNGLUNIFORM3UIVPROC206D6B43Func = x - } - return (C.PFNGLUNIFORM3UIVPROC)(C.PFNGLUNIFORM3UIVPROC_206d6b43), nil -} - -func NewPFNGLUNIFORM3UIVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM3UIVPROC { - return (*PFNGLUNIFORM3UIVPROC)(ref) -} - -//export PFNGLUNIFORM3UIVPROC206D6B43 -func PFNGLUNIFORM3UIVPROC206D6B43() { - if pFNGLUNIFORM3UIVPROC206D6B43Func != nil { - pFNGLUNIFORM3UIVPROC206D6B43Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM3UIVPROC206D6B43Func PFNGLUNIFORM3UIVPROC - -func (x PFNGLUNIFORM4FPROC) PassRef() (ref *C.PFNGLUNIFORM4FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4FPROCB064BA73Func == nil { - pFNGLUNIFORM4FPROCB064BA73Func = x - } - return (*C.PFNGLUNIFORM4FPROC)(C.PFNGLUNIFORM4FPROC_b064ba73), nil -} - -func (x PFNGLUNIFORM4FPROC) PassValue() (ref C.PFNGLUNIFORM4FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4FPROCB064BA73Func == nil { - pFNGLUNIFORM4FPROCB064BA73Func = x - } - return (C.PFNGLUNIFORM4FPROC)(C.PFNGLUNIFORM4FPROC_b064ba73), nil -} - -func NewPFNGLUNIFORM4FPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4FPROC { - return (*PFNGLUNIFORM4FPROC)(ref) -} - -//export PFNGLUNIFORM4FPROCB064BA73 -func PFNGLUNIFORM4FPROCB064BA73() { - if pFNGLUNIFORM4FPROCB064BA73Func != nil { - pFNGLUNIFORM4FPROCB064BA73Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4FPROCB064BA73Func PFNGLUNIFORM4FPROC - -func (x PFNGLUNIFORM4FVPROC) PassRef() (ref *C.PFNGLUNIFORM4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4FVPROCA45EA02FFunc == nil { - pFNGLUNIFORM4FVPROCA45EA02FFunc = x - } - return (*C.PFNGLUNIFORM4FVPROC)(C.PFNGLUNIFORM4FVPROC_a45ea02f), nil -} - -func (x PFNGLUNIFORM4FVPROC) PassValue() (ref C.PFNGLUNIFORM4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4FVPROCA45EA02FFunc == nil { - pFNGLUNIFORM4FVPROCA45EA02FFunc = x - } - return (C.PFNGLUNIFORM4FVPROC)(C.PFNGLUNIFORM4FVPROC_a45ea02f), nil -} - -func NewPFNGLUNIFORM4FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4FVPROC { - return (*PFNGLUNIFORM4FVPROC)(ref) -} - -//export PFNGLUNIFORM4FVPROCA45EA02F -func PFNGLUNIFORM4FVPROCA45EA02F() { - if pFNGLUNIFORM4FVPROCA45EA02FFunc != nil { - pFNGLUNIFORM4FVPROCA45EA02FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4FVPROCA45EA02FFunc PFNGLUNIFORM4FVPROC - -func (x PFNGLUNIFORM4IPROC) PassRef() (ref *C.PFNGLUNIFORM4IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4IPROC0EF851C5Func == nil { - pFNGLUNIFORM4IPROC0EF851C5Func = x - } - return (*C.PFNGLUNIFORM4IPROC)(C.PFNGLUNIFORM4IPROC_0ef851c5), nil -} - -func (x PFNGLUNIFORM4IPROC) PassValue() (ref C.PFNGLUNIFORM4IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4IPROC0EF851C5Func == nil { - pFNGLUNIFORM4IPROC0EF851C5Func = x - } - return (C.PFNGLUNIFORM4IPROC)(C.PFNGLUNIFORM4IPROC_0ef851c5), nil -} - -func NewPFNGLUNIFORM4IPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4IPROC { - return (*PFNGLUNIFORM4IPROC)(ref) -} - -//export PFNGLUNIFORM4IPROC0EF851C5 -func PFNGLUNIFORM4IPROC0EF851C5() { - if pFNGLUNIFORM4IPROC0EF851C5Func != nil { - pFNGLUNIFORM4IPROC0EF851C5Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4IPROC0EF851C5Func PFNGLUNIFORM4IPROC - -func (x PFNGLUNIFORM4IVPROC) PassRef() (ref *C.PFNGLUNIFORM4IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4IVPROCAF39C73DFunc == nil { - pFNGLUNIFORM4IVPROCAF39C73DFunc = x - } - return (*C.PFNGLUNIFORM4IVPROC)(C.PFNGLUNIFORM4IVPROC_af39c73d), nil -} - -func (x PFNGLUNIFORM4IVPROC) PassValue() (ref C.PFNGLUNIFORM4IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4IVPROCAF39C73DFunc == nil { - pFNGLUNIFORM4IVPROCAF39C73DFunc = x - } - return (C.PFNGLUNIFORM4IVPROC)(C.PFNGLUNIFORM4IVPROC_af39c73d), nil -} - -func NewPFNGLUNIFORM4IVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4IVPROC { - return (*PFNGLUNIFORM4IVPROC)(ref) -} - -//export PFNGLUNIFORM4IVPROCAF39C73D -func PFNGLUNIFORM4IVPROCAF39C73D() { - if pFNGLUNIFORM4IVPROCAF39C73DFunc != nil { - pFNGLUNIFORM4IVPROCAF39C73DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4IVPROCAF39C73DFunc PFNGLUNIFORM4IVPROC - -func (x PFNGLUNIFORM4UIPROC) PassRef() (ref *C.PFNGLUNIFORM4UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4UIPROCB5F68357Func == nil { - pFNGLUNIFORM4UIPROCB5F68357Func = x - } - return (*C.PFNGLUNIFORM4UIPROC)(C.PFNGLUNIFORM4UIPROC_b5f68357), nil -} - -func (x PFNGLUNIFORM4UIPROC) PassValue() (ref C.PFNGLUNIFORM4UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4UIPROCB5F68357Func == nil { - pFNGLUNIFORM4UIPROCB5F68357Func = x - } - return (C.PFNGLUNIFORM4UIPROC)(C.PFNGLUNIFORM4UIPROC_b5f68357), nil -} - -func NewPFNGLUNIFORM4UIPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4UIPROC { - return (*PFNGLUNIFORM4UIPROC)(ref) -} - -//export PFNGLUNIFORM4UIPROCB5F68357 -func PFNGLUNIFORM4UIPROCB5F68357() { - if pFNGLUNIFORM4UIPROCB5F68357Func != nil { - pFNGLUNIFORM4UIPROCB5F68357Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4UIPROCB5F68357Func PFNGLUNIFORM4UIPROC - -func (x PFNGLUNIFORM4UIVPROC) PassRef() (ref *C.PFNGLUNIFORM4UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4UIVPROCF6962598Func == nil { - pFNGLUNIFORM4UIVPROCF6962598Func = x - } - return (*C.PFNGLUNIFORM4UIVPROC)(C.PFNGLUNIFORM4UIVPROC_f6962598), nil -} - -func (x PFNGLUNIFORM4UIVPROC) PassValue() (ref C.PFNGLUNIFORM4UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORM4UIVPROCF6962598Func == nil { - pFNGLUNIFORM4UIVPROCF6962598Func = x - } - return (C.PFNGLUNIFORM4UIVPROC)(C.PFNGLUNIFORM4UIVPROC_f6962598), nil -} - -func NewPFNGLUNIFORM4UIVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORM4UIVPROC { - return (*PFNGLUNIFORM4UIVPROC)(ref) -} - -//export PFNGLUNIFORM4UIVPROCF6962598 -func PFNGLUNIFORM4UIVPROCF6962598() { - if pFNGLUNIFORM4UIVPROCF6962598Func != nil { - pFNGLUNIFORM4UIVPROCF6962598Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORM4UIVPROCF6962598Func PFNGLUNIFORM4UIVPROC - -func (x PFNGLUNIFORMBLOCKBINDINGPROC) PassRef() (ref *C.PFNGLUNIFORMBLOCKBINDINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMBLOCKBINDINGPROC7AE350B0Func == nil { - pFNGLUNIFORMBLOCKBINDINGPROC7AE350B0Func = x - } - return (*C.PFNGLUNIFORMBLOCKBINDINGPROC)(C.PFNGLUNIFORMBLOCKBINDINGPROC_7ae350b0), nil -} - -func (x PFNGLUNIFORMBLOCKBINDINGPROC) PassValue() (ref C.PFNGLUNIFORMBLOCKBINDINGPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMBLOCKBINDINGPROC7AE350B0Func == nil { - pFNGLUNIFORMBLOCKBINDINGPROC7AE350B0Func = x - } - return (C.PFNGLUNIFORMBLOCKBINDINGPROC)(C.PFNGLUNIFORMBLOCKBINDINGPROC_7ae350b0), nil -} - -func NewPFNGLUNIFORMBLOCKBINDINGPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMBLOCKBINDINGPROC { - return (*PFNGLUNIFORMBLOCKBINDINGPROC)(ref) -} - -//export PFNGLUNIFORMBLOCKBINDINGPROC7AE350B0 -func PFNGLUNIFORMBLOCKBINDINGPROC7AE350B0() { - if pFNGLUNIFORMBLOCKBINDINGPROC7AE350B0Func != nil { - pFNGLUNIFORMBLOCKBINDINGPROC7AE350B0Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMBLOCKBINDINGPROC7AE350B0Func PFNGLUNIFORMBLOCKBINDINGPROC - -func (x PFNGLUNIFORMMATRIX2FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX2FVPROC65C33403Func == nil { - pFNGLUNIFORMMATRIX2FVPROC65C33403Func = x - } - return (*C.PFNGLUNIFORMMATRIX2FVPROC)(C.PFNGLUNIFORMMATRIX2FVPROC_65c33403), nil -} - -func (x PFNGLUNIFORMMATRIX2FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX2FVPROC65C33403Func == nil { - pFNGLUNIFORMMATRIX2FVPROC65C33403Func = x - } - return (C.PFNGLUNIFORMMATRIX2FVPROC)(C.PFNGLUNIFORMMATRIX2FVPROC_65c33403), nil -} - -func NewPFNGLUNIFORMMATRIX2FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX2FVPROC { - return (*PFNGLUNIFORMMATRIX2FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX2FVPROC65C33403 -func PFNGLUNIFORMMATRIX2FVPROC65C33403() { - if pFNGLUNIFORMMATRIX2FVPROC65C33403Func != nil { - pFNGLUNIFORMMATRIX2FVPROC65C33403Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX2FVPROC65C33403Func PFNGLUNIFORMMATRIX2FVPROC - -func (x PFNGLUNIFORMMATRIX2X3FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX2X3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX2X3FVPROCE42BA878Func == nil { - pFNGLUNIFORMMATRIX2X3FVPROCE42BA878Func = x - } - return (*C.PFNGLUNIFORMMATRIX2X3FVPROC)(C.PFNGLUNIFORMMATRIX2X3FVPROC_e42ba878), nil -} - -func (x PFNGLUNIFORMMATRIX2X3FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX2X3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX2X3FVPROCE42BA878Func == nil { - pFNGLUNIFORMMATRIX2X3FVPROCE42BA878Func = x - } - return (C.PFNGLUNIFORMMATRIX2X3FVPROC)(C.PFNGLUNIFORMMATRIX2X3FVPROC_e42ba878), nil -} - -func NewPFNGLUNIFORMMATRIX2X3FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX2X3FVPROC { - return (*PFNGLUNIFORMMATRIX2X3FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX2X3FVPROCE42BA878 -func PFNGLUNIFORMMATRIX2X3FVPROCE42BA878() { - if pFNGLUNIFORMMATRIX2X3FVPROCE42BA878Func != nil { - pFNGLUNIFORMMATRIX2X3FVPROCE42BA878Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX2X3FVPROCE42BA878Func PFNGLUNIFORMMATRIX2X3FVPROC - -func (x PFNGLUNIFORMMATRIX2X4FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX2X4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2Func == nil { - pFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2Func = x - } - return (*C.PFNGLUNIFORMMATRIX2X4FVPROC)(C.PFNGLUNIFORMMATRIX2X4FVPROC_0b76e4a2), nil -} - -func (x PFNGLUNIFORMMATRIX2X4FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX2X4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2Func == nil { - pFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2Func = x - } - return (C.PFNGLUNIFORMMATRIX2X4FVPROC)(C.PFNGLUNIFORMMATRIX2X4FVPROC_0b76e4a2), nil -} - -func NewPFNGLUNIFORMMATRIX2X4FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX2X4FVPROC { - return (*PFNGLUNIFORMMATRIX2X4FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2 -func PFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2() { - if pFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2Func != nil { - pFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX2X4FVPROC0B76E4A2Func PFNGLUNIFORMMATRIX2X4FVPROC - -func (x PFNGLUNIFORMMATRIX3FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX3FVPROC2D08E9C6Func == nil { - pFNGLUNIFORMMATRIX3FVPROC2D08E9C6Func = x - } - return (*C.PFNGLUNIFORMMATRIX3FVPROC)(C.PFNGLUNIFORMMATRIX3FVPROC_2d08e9c6), nil -} - -func (x PFNGLUNIFORMMATRIX3FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX3FVPROC2D08E9C6Func == nil { - pFNGLUNIFORMMATRIX3FVPROC2D08E9C6Func = x - } - return (C.PFNGLUNIFORMMATRIX3FVPROC)(C.PFNGLUNIFORMMATRIX3FVPROC_2d08e9c6), nil -} - -func NewPFNGLUNIFORMMATRIX3FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX3FVPROC { - return (*PFNGLUNIFORMMATRIX3FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX3FVPROC2D08E9C6 -func PFNGLUNIFORMMATRIX3FVPROC2D08E9C6() { - if pFNGLUNIFORMMATRIX3FVPROC2D08E9C6Func != nil { - pFNGLUNIFORMMATRIX3FVPROC2D08E9C6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX3FVPROC2D08E9C6Func PFNGLUNIFORMMATRIX3FVPROC - -func (x PFNGLUNIFORMMATRIX3X2FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX3X2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX3X2FVPROCA409DB19Func == nil { - pFNGLUNIFORMMATRIX3X2FVPROCA409DB19Func = x - } - return (*C.PFNGLUNIFORMMATRIX3X2FVPROC)(C.PFNGLUNIFORMMATRIX3X2FVPROC_a409db19), nil -} - -func (x PFNGLUNIFORMMATRIX3X2FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX3X2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX3X2FVPROCA409DB19Func == nil { - pFNGLUNIFORMMATRIX3X2FVPROCA409DB19Func = x - } - return (C.PFNGLUNIFORMMATRIX3X2FVPROC)(C.PFNGLUNIFORMMATRIX3X2FVPROC_a409db19), nil -} - -func NewPFNGLUNIFORMMATRIX3X2FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX3X2FVPROC { - return (*PFNGLUNIFORMMATRIX3X2FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX3X2FVPROCA409DB19 -func PFNGLUNIFORMMATRIX3X2FVPROCA409DB19() { - if pFNGLUNIFORMMATRIX3X2FVPROCA409DB19Func != nil { - pFNGLUNIFORMMATRIX3X2FVPROCA409DB19Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX3X2FVPROCA409DB19Func PFNGLUNIFORMMATRIX3X2FVPROC - -func (x PFNGLUNIFORMMATRIX3X4FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX3X4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX3X4FVPROC97DD1A67Func == nil { - pFNGLUNIFORMMATRIX3X4FVPROC97DD1A67Func = x - } - return (*C.PFNGLUNIFORMMATRIX3X4FVPROC)(C.PFNGLUNIFORMMATRIX3X4FVPROC_97dd1a67), nil -} - -func (x PFNGLUNIFORMMATRIX3X4FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX3X4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX3X4FVPROC97DD1A67Func == nil { - pFNGLUNIFORMMATRIX3X4FVPROC97DD1A67Func = x - } - return (C.PFNGLUNIFORMMATRIX3X4FVPROC)(C.PFNGLUNIFORMMATRIX3X4FVPROC_97dd1a67), nil -} - -func NewPFNGLUNIFORMMATRIX3X4FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX3X4FVPROC { - return (*PFNGLUNIFORMMATRIX3X4FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX3X4FVPROC97DD1A67 -func PFNGLUNIFORMMATRIX3X4FVPROC97DD1A67() { - if pFNGLUNIFORMMATRIX3X4FVPROC97DD1A67Func != nil { - pFNGLUNIFORMMATRIX3X4FVPROC97DD1A67Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX3X4FVPROC97DD1A67Func PFNGLUNIFORMMATRIX3X4FVPROC - -func (x PFNGLUNIFORMMATRIX4FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX4FVPROC9B24359DFunc == nil { - pFNGLUNIFORMMATRIX4FVPROC9B24359DFunc = x - } - return (*C.PFNGLUNIFORMMATRIX4FVPROC)(C.PFNGLUNIFORMMATRIX4FVPROC_9b24359d), nil -} - -func (x PFNGLUNIFORMMATRIX4FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX4FVPROC9B24359DFunc == nil { - pFNGLUNIFORMMATRIX4FVPROC9B24359DFunc = x - } - return (C.PFNGLUNIFORMMATRIX4FVPROC)(C.PFNGLUNIFORMMATRIX4FVPROC_9b24359d), nil -} - -func NewPFNGLUNIFORMMATRIX4FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX4FVPROC { - return (*PFNGLUNIFORMMATRIX4FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX4FVPROC9B24359D -func PFNGLUNIFORMMATRIX4FVPROC9B24359D() { - if pFNGLUNIFORMMATRIX4FVPROC9B24359DFunc != nil { - pFNGLUNIFORMMATRIX4FVPROC9B24359DFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX4FVPROC9B24359DFunc PFNGLUNIFORMMATRIX4FVPROC - -func (x PFNGLUNIFORMMATRIX4X2FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX4X2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9Func == nil { - pFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9Func = x - } - return (*C.PFNGLUNIFORMMATRIX4X2FVPROC)(C.PFNGLUNIFORMMATRIX4X2FVPROC_bf8c50e9), nil -} - -func (x PFNGLUNIFORMMATRIX4X2FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX4X2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9Func == nil { - pFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9Func = x - } - return (C.PFNGLUNIFORMMATRIX4X2FVPROC)(C.PFNGLUNIFORMMATRIX4X2FVPROC_bf8c50e9), nil -} - -func NewPFNGLUNIFORMMATRIX4X2FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX4X2FVPROC { - return (*PFNGLUNIFORMMATRIX4X2FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9 -func PFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9() { - if pFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9Func != nil { - pFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX4X2FVPROCBF8C50E9Func PFNGLUNIFORMMATRIX4X2FVPROC - -func (x PFNGLUNIFORMMATRIX4X3FVPROC) PassRef() (ref *C.PFNGLUNIFORMMATRIX4X3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX4X3FVPROCDD54CD1FFunc == nil { - pFNGLUNIFORMMATRIX4X3FVPROCDD54CD1FFunc = x - } - return (*C.PFNGLUNIFORMMATRIX4X3FVPROC)(C.PFNGLUNIFORMMATRIX4X3FVPROC_dd54cd1f), nil -} - -func (x PFNGLUNIFORMMATRIX4X3FVPROC) PassValue() (ref C.PFNGLUNIFORMMATRIX4X3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNIFORMMATRIX4X3FVPROCDD54CD1FFunc == nil { - pFNGLUNIFORMMATRIX4X3FVPROCDD54CD1FFunc = x - } - return (C.PFNGLUNIFORMMATRIX4X3FVPROC)(C.PFNGLUNIFORMMATRIX4X3FVPROC_dd54cd1f), nil -} - -func NewPFNGLUNIFORMMATRIX4X3FVPROCRef(ref unsafe.Pointer) *PFNGLUNIFORMMATRIX4X3FVPROC { - return (*PFNGLUNIFORMMATRIX4X3FVPROC)(ref) -} - -//export PFNGLUNIFORMMATRIX4X3FVPROCDD54CD1F -func PFNGLUNIFORMMATRIX4X3FVPROCDD54CD1F() { - if pFNGLUNIFORMMATRIX4X3FVPROCDD54CD1FFunc != nil { - pFNGLUNIFORMMATRIX4X3FVPROCDD54CD1FFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNIFORMMATRIX4X3FVPROCDD54CD1FFunc PFNGLUNIFORMMATRIX4X3FVPROC - -func (x PFNGLUNMAPBUFFERPROC) PassRef() (ref *C.PFNGLUNMAPBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNMAPBUFFERPROCCDDA11F6Func == nil { - pFNGLUNMAPBUFFERPROCCDDA11F6Func = x - } - return (*C.PFNGLUNMAPBUFFERPROC)(C.PFNGLUNMAPBUFFERPROC_cdda11f6), nil -} - -func (x PFNGLUNMAPBUFFERPROC) PassValue() (ref C.PFNGLUNMAPBUFFERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUNMAPBUFFERPROCCDDA11F6Func == nil { - pFNGLUNMAPBUFFERPROCCDDA11F6Func = x - } - return (C.PFNGLUNMAPBUFFERPROC)(C.PFNGLUNMAPBUFFERPROC_cdda11f6), nil -} - -func NewPFNGLUNMAPBUFFERPROCRef(ref unsafe.Pointer) *PFNGLUNMAPBUFFERPROC { - return (*PFNGLUNMAPBUFFERPROC)(ref) -} - -//export PFNGLUNMAPBUFFERPROCCDDA11F6 -func PFNGLUNMAPBUFFERPROCCDDA11F6() { - if pFNGLUNMAPBUFFERPROCCDDA11F6Func != nil { - pFNGLUNMAPBUFFERPROCCDDA11F6Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUNMAPBUFFERPROCCDDA11F6Func PFNGLUNMAPBUFFERPROC - -func (x PFNGLUSEPROGRAMPROC) PassRef() (ref *C.PFNGLUSEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUSEPROGRAMPROCCA4E8162Func == nil { - pFNGLUSEPROGRAMPROCCA4E8162Func = x - } - return (*C.PFNGLUSEPROGRAMPROC)(C.PFNGLUSEPROGRAMPROC_ca4e8162), nil -} - -func (x PFNGLUSEPROGRAMPROC) PassValue() (ref C.PFNGLUSEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLUSEPROGRAMPROCCA4E8162Func == nil { - pFNGLUSEPROGRAMPROCCA4E8162Func = x - } - return (C.PFNGLUSEPROGRAMPROC)(C.PFNGLUSEPROGRAMPROC_ca4e8162), nil -} - -func NewPFNGLUSEPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLUSEPROGRAMPROC { - return (*PFNGLUSEPROGRAMPROC)(ref) -} - -//export PFNGLUSEPROGRAMPROCCA4E8162 -func PFNGLUSEPROGRAMPROCCA4E8162() { - if pFNGLUSEPROGRAMPROCCA4E8162Func != nil { - pFNGLUSEPROGRAMPROCCA4E8162Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLUSEPROGRAMPROCCA4E8162Func PFNGLUSEPROGRAMPROC - -func (x PFNGLVALIDATEPROGRAMPROC) PassRef() (ref *C.PFNGLVALIDATEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVALIDATEPROGRAMPROCD5A5EC0AFunc == nil { - pFNGLVALIDATEPROGRAMPROCD5A5EC0AFunc = x - } - return (*C.PFNGLVALIDATEPROGRAMPROC)(C.PFNGLVALIDATEPROGRAMPROC_d5a5ec0a), nil -} - -func (x PFNGLVALIDATEPROGRAMPROC) PassValue() (ref C.PFNGLVALIDATEPROGRAMPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVALIDATEPROGRAMPROCD5A5EC0AFunc == nil { - pFNGLVALIDATEPROGRAMPROCD5A5EC0AFunc = x - } - return (C.PFNGLVALIDATEPROGRAMPROC)(C.PFNGLVALIDATEPROGRAMPROC_d5a5ec0a), nil -} - -func NewPFNGLVALIDATEPROGRAMPROCRef(ref unsafe.Pointer) *PFNGLVALIDATEPROGRAMPROC { - return (*PFNGLVALIDATEPROGRAMPROC)(ref) -} - -//export PFNGLVALIDATEPROGRAMPROCD5A5EC0A -func PFNGLVALIDATEPROGRAMPROCD5A5EC0A() { - if pFNGLVALIDATEPROGRAMPROCD5A5EC0AFunc != nil { - pFNGLVALIDATEPROGRAMPROCD5A5EC0AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVALIDATEPROGRAMPROCD5A5EC0AFunc PFNGLVALIDATEPROGRAMPROC - -func (x PFNGLVERTEXATTRIB1FPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB1FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB1FPROCA73CE5B3Func == nil { - pFNGLVERTEXATTRIB1FPROCA73CE5B3Func = x - } - return (*C.PFNGLVERTEXATTRIB1FPROC)(C.PFNGLVERTEXATTRIB1FPROC_a73ce5b3), nil -} - -func (x PFNGLVERTEXATTRIB1FPROC) PassValue() (ref C.PFNGLVERTEXATTRIB1FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB1FPROCA73CE5B3Func == nil { - pFNGLVERTEXATTRIB1FPROCA73CE5B3Func = x - } - return (C.PFNGLVERTEXATTRIB1FPROC)(C.PFNGLVERTEXATTRIB1FPROC_a73ce5b3), nil -} - -func NewPFNGLVERTEXATTRIB1FPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB1FPROC { - return (*PFNGLVERTEXATTRIB1FPROC)(ref) -} - -//export PFNGLVERTEXATTRIB1FPROCA73CE5B3 -func PFNGLVERTEXATTRIB1FPROCA73CE5B3() { - if pFNGLVERTEXATTRIB1FPROCA73CE5B3Func != nil { - pFNGLVERTEXATTRIB1FPROCA73CE5B3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB1FPROCA73CE5B3Func PFNGLVERTEXATTRIB1FPROC - -func (x PFNGLVERTEXATTRIB1FVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB1FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB1FVPROC79CC789CFunc == nil { - pFNGLVERTEXATTRIB1FVPROC79CC789CFunc = x - } - return (*C.PFNGLVERTEXATTRIB1FVPROC)(C.PFNGLVERTEXATTRIB1FVPROC_79cc789c), nil -} - -func (x PFNGLVERTEXATTRIB1FVPROC) PassValue() (ref C.PFNGLVERTEXATTRIB1FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB1FVPROC79CC789CFunc == nil { - pFNGLVERTEXATTRIB1FVPROC79CC789CFunc = x - } - return (C.PFNGLVERTEXATTRIB1FVPROC)(C.PFNGLVERTEXATTRIB1FVPROC_79cc789c), nil -} - -func NewPFNGLVERTEXATTRIB1FVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB1FVPROC { - return (*PFNGLVERTEXATTRIB1FVPROC)(ref) -} - -//export PFNGLVERTEXATTRIB1FVPROC79CC789C -func PFNGLVERTEXATTRIB1FVPROC79CC789C() { - if pFNGLVERTEXATTRIB1FVPROC79CC789CFunc != nil { - pFNGLVERTEXATTRIB1FVPROC79CC789CFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB1FVPROC79CC789CFunc PFNGLVERTEXATTRIB1FVPROC - -func (x PFNGLVERTEXATTRIB2FPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB2FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB2FPROC1BD2201BFunc == nil { - pFNGLVERTEXATTRIB2FPROC1BD2201BFunc = x - } - return (*C.PFNGLVERTEXATTRIB2FPROC)(C.PFNGLVERTEXATTRIB2FPROC_1bd2201b), nil -} - -func (x PFNGLVERTEXATTRIB2FPROC) PassValue() (ref C.PFNGLVERTEXATTRIB2FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB2FPROC1BD2201BFunc == nil { - pFNGLVERTEXATTRIB2FPROC1BD2201BFunc = x - } - return (C.PFNGLVERTEXATTRIB2FPROC)(C.PFNGLVERTEXATTRIB2FPROC_1bd2201b), nil -} - -func NewPFNGLVERTEXATTRIB2FPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB2FPROC { - return (*PFNGLVERTEXATTRIB2FPROC)(ref) -} - -//export PFNGLVERTEXATTRIB2FPROC1BD2201B -func PFNGLVERTEXATTRIB2FPROC1BD2201B() { - if pFNGLVERTEXATTRIB2FPROC1BD2201BFunc != nil { - pFNGLVERTEXATTRIB2FPROC1BD2201BFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB2FPROC1BD2201BFunc PFNGLVERTEXATTRIB2FPROC - -func (x PFNGLVERTEXATTRIB2FVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB2FVPROCC7D14A1AFunc == nil { - pFNGLVERTEXATTRIB2FVPROCC7D14A1AFunc = x - } - return (*C.PFNGLVERTEXATTRIB2FVPROC)(C.PFNGLVERTEXATTRIB2FVPROC_c7d14a1a), nil -} - -func (x PFNGLVERTEXATTRIB2FVPROC) PassValue() (ref C.PFNGLVERTEXATTRIB2FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB2FVPROCC7D14A1AFunc == nil { - pFNGLVERTEXATTRIB2FVPROCC7D14A1AFunc = x - } - return (C.PFNGLVERTEXATTRIB2FVPROC)(C.PFNGLVERTEXATTRIB2FVPROC_c7d14a1a), nil -} - -func NewPFNGLVERTEXATTRIB2FVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB2FVPROC { - return (*PFNGLVERTEXATTRIB2FVPROC)(ref) -} - -//export PFNGLVERTEXATTRIB2FVPROCC7D14A1A -func PFNGLVERTEXATTRIB2FVPROCC7D14A1A() { - if pFNGLVERTEXATTRIB2FVPROCC7D14A1AFunc != nil { - pFNGLVERTEXATTRIB2FVPROCC7D14A1AFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB2FVPROCC7D14A1AFunc PFNGLVERTEXATTRIB2FVPROC - -func (x PFNGLVERTEXATTRIB3FPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB3FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB3FPROC422F4C14Func == nil { - pFNGLVERTEXATTRIB3FPROC422F4C14Func = x - } - return (*C.PFNGLVERTEXATTRIB3FPROC)(C.PFNGLVERTEXATTRIB3FPROC_422f4c14), nil -} - -func (x PFNGLVERTEXATTRIB3FPROC) PassValue() (ref C.PFNGLVERTEXATTRIB3FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB3FPROC422F4C14Func == nil { - pFNGLVERTEXATTRIB3FPROC422F4C14Func = x - } - return (C.PFNGLVERTEXATTRIB3FPROC)(C.PFNGLVERTEXATTRIB3FPROC_422f4c14), nil -} - -func NewPFNGLVERTEXATTRIB3FPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB3FPROC { - return (*PFNGLVERTEXATTRIB3FPROC)(ref) -} - -//export PFNGLVERTEXATTRIB3FPROC422F4C14 -func PFNGLVERTEXATTRIB3FPROC422F4C14() { - if pFNGLVERTEXATTRIB3FPROC422F4C14Func != nil { - pFNGLVERTEXATTRIB3FPROC422F4C14Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB3FPROC422F4C14Func PFNGLVERTEXATTRIB3FPROC - -func (x PFNGLVERTEXATTRIB3FVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB3FVPROCB47B0707Func == nil { - pFNGLVERTEXATTRIB3FVPROCB47B0707Func = x - } - return (*C.PFNGLVERTEXATTRIB3FVPROC)(C.PFNGLVERTEXATTRIB3FVPROC_b47b0707), nil -} - -func (x PFNGLVERTEXATTRIB3FVPROC) PassValue() (ref C.PFNGLVERTEXATTRIB3FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB3FVPROCB47B0707Func == nil { - pFNGLVERTEXATTRIB3FVPROCB47B0707Func = x - } - return (C.PFNGLVERTEXATTRIB3FVPROC)(C.PFNGLVERTEXATTRIB3FVPROC_b47b0707), nil -} - -func NewPFNGLVERTEXATTRIB3FVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB3FVPROC { - return (*PFNGLVERTEXATTRIB3FVPROC)(ref) -} - -//export PFNGLVERTEXATTRIB3FVPROCB47B0707 -func PFNGLVERTEXATTRIB3FVPROCB47B0707() { - if pFNGLVERTEXATTRIB3FVPROCB47B0707Func != nil { - pFNGLVERTEXATTRIB3FVPROCB47B0707Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB3FVPROCB47B0707Func PFNGLVERTEXATTRIB3FVPROC - -func (x PFNGLVERTEXATTRIB4FPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB4FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB4FPROCBE466156Func == nil { - pFNGLVERTEXATTRIB4FPROCBE466156Func = x - } - return (*C.PFNGLVERTEXATTRIB4FPROC)(C.PFNGLVERTEXATTRIB4FPROC_be466156), nil -} - -func (x PFNGLVERTEXATTRIB4FPROC) PassValue() (ref C.PFNGLVERTEXATTRIB4FPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB4FPROCBE466156Func == nil { - pFNGLVERTEXATTRIB4FPROCBE466156Func = x - } - return (C.PFNGLVERTEXATTRIB4FPROC)(C.PFNGLVERTEXATTRIB4FPROC_be466156), nil -} - -func NewPFNGLVERTEXATTRIB4FPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB4FPROC { - return (*PFNGLVERTEXATTRIB4FPROC)(ref) -} - -//export PFNGLVERTEXATTRIB4FPROCBE466156 -func PFNGLVERTEXATTRIB4FPROCBE466156() { - if pFNGLVERTEXATTRIB4FPROCBE466156Func != nil { - pFNGLVERTEXATTRIB4FPROCBE466156Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB4FPROCBE466156Func PFNGLVERTEXATTRIB4FPROC - -func (x PFNGLVERTEXATTRIB4FVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIB4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB4FVPROC0049C127Func == nil { - pFNGLVERTEXATTRIB4FVPROC0049C127Func = x - } - return (*C.PFNGLVERTEXATTRIB4FVPROC)(C.PFNGLVERTEXATTRIB4FVPROC_0049c127), nil -} - -func (x PFNGLVERTEXATTRIB4FVPROC) PassValue() (ref C.PFNGLVERTEXATTRIB4FVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIB4FVPROC0049C127Func == nil { - pFNGLVERTEXATTRIB4FVPROC0049C127Func = x - } - return (C.PFNGLVERTEXATTRIB4FVPROC)(C.PFNGLVERTEXATTRIB4FVPROC_0049c127), nil -} - -func NewPFNGLVERTEXATTRIB4FVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIB4FVPROC { - return (*PFNGLVERTEXATTRIB4FVPROC)(ref) -} - -//export PFNGLVERTEXATTRIB4FVPROC0049C127 -func PFNGLVERTEXATTRIB4FVPROC0049C127() { - if pFNGLVERTEXATTRIB4FVPROC0049C127Func != nil { - pFNGLVERTEXATTRIB4FVPROC0049C127Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIB4FVPROC0049C127Func PFNGLVERTEXATTRIB4FVPROC - -func (x PFNGLVERTEXATTRIBDIVISORPROC) PassRef() (ref *C.PFNGLVERTEXATTRIBDIVISORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBDIVISORPROCBE125E6EFunc == nil { - pFNGLVERTEXATTRIBDIVISORPROCBE125E6EFunc = x - } - return (*C.PFNGLVERTEXATTRIBDIVISORPROC)(C.PFNGLVERTEXATTRIBDIVISORPROC_be125e6e), nil -} - -func (x PFNGLVERTEXATTRIBDIVISORPROC) PassValue() (ref C.PFNGLVERTEXATTRIBDIVISORPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBDIVISORPROCBE125E6EFunc == nil { - pFNGLVERTEXATTRIBDIVISORPROCBE125E6EFunc = x - } - return (C.PFNGLVERTEXATTRIBDIVISORPROC)(C.PFNGLVERTEXATTRIBDIVISORPROC_be125e6e), nil -} - -func NewPFNGLVERTEXATTRIBDIVISORPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIBDIVISORPROC { - return (*PFNGLVERTEXATTRIBDIVISORPROC)(ref) -} - -//export PFNGLVERTEXATTRIBDIVISORPROCBE125E6E -func PFNGLVERTEXATTRIBDIVISORPROCBE125E6E() { - if pFNGLVERTEXATTRIBDIVISORPROCBE125E6EFunc != nil { - pFNGLVERTEXATTRIBDIVISORPROCBE125E6EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIBDIVISORPROCBE125E6EFunc PFNGLVERTEXATTRIBDIVISORPROC - -func (x PFNGLVERTEXATTRIBI4IPROC) PassRef() (ref *C.PFNGLVERTEXATTRIBI4IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBI4IPROCC76EB9A3Func == nil { - pFNGLVERTEXATTRIBI4IPROCC76EB9A3Func = x - } - return (*C.PFNGLVERTEXATTRIBI4IPROC)(C.PFNGLVERTEXATTRIBI4IPROC_c76eb9a3), nil -} - -func (x PFNGLVERTEXATTRIBI4IPROC) PassValue() (ref C.PFNGLVERTEXATTRIBI4IPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBI4IPROCC76EB9A3Func == nil { - pFNGLVERTEXATTRIBI4IPROCC76EB9A3Func = x - } - return (C.PFNGLVERTEXATTRIBI4IPROC)(C.PFNGLVERTEXATTRIBI4IPROC_c76eb9a3), nil -} - -func NewPFNGLVERTEXATTRIBI4IPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIBI4IPROC { - return (*PFNGLVERTEXATTRIBI4IPROC)(ref) -} - -//export PFNGLVERTEXATTRIBI4IPROCC76EB9A3 -func PFNGLVERTEXATTRIBI4IPROCC76EB9A3() { - if pFNGLVERTEXATTRIBI4IPROCC76EB9A3Func != nil { - pFNGLVERTEXATTRIBI4IPROCC76EB9A3Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIBI4IPROCC76EB9A3Func PFNGLVERTEXATTRIBI4IPROC - -func (x PFNGLVERTEXATTRIBI4IVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIBI4IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBI4IVPROC568D8487Func == nil { - pFNGLVERTEXATTRIBI4IVPROC568D8487Func = x - } - return (*C.PFNGLVERTEXATTRIBI4IVPROC)(C.PFNGLVERTEXATTRIBI4IVPROC_568d8487), nil -} - -func (x PFNGLVERTEXATTRIBI4IVPROC) PassValue() (ref C.PFNGLVERTEXATTRIBI4IVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBI4IVPROC568D8487Func == nil { - pFNGLVERTEXATTRIBI4IVPROC568D8487Func = x - } - return (C.PFNGLVERTEXATTRIBI4IVPROC)(C.PFNGLVERTEXATTRIBI4IVPROC_568d8487), nil -} - -func NewPFNGLVERTEXATTRIBI4IVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIBI4IVPROC { - return (*PFNGLVERTEXATTRIBI4IVPROC)(ref) -} - -//export PFNGLVERTEXATTRIBI4IVPROC568D8487 -func PFNGLVERTEXATTRIBI4IVPROC568D8487() { - if pFNGLVERTEXATTRIBI4IVPROC568D8487Func != nil { - pFNGLVERTEXATTRIBI4IVPROC568D8487Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIBI4IVPROC568D8487Func PFNGLVERTEXATTRIBI4IVPROC - -func (x PFNGLVERTEXATTRIBI4UIPROC) PassRef() (ref *C.PFNGLVERTEXATTRIBI4UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBI4UIPROC6821C9DEFunc == nil { - pFNGLVERTEXATTRIBI4UIPROC6821C9DEFunc = x - } - return (*C.PFNGLVERTEXATTRIBI4UIPROC)(C.PFNGLVERTEXATTRIBI4UIPROC_6821c9de), nil -} - -func (x PFNGLVERTEXATTRIBI4UIPROC) PassValue() (ref C.PFNGLVERTEXATTRIBI4UIPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBI4UIPROC6821C9DEFunc == nil { - pFNGLVERTEXATTRIBI4UIPROC6821C9DEFunc = x - } - return (C.PFNGLVERTEXATTRIBI4UIPROC)(C.PFNGLVERTEXATTRIBI4UIPROC_6821c9de), nil -} - -func NewPFNGLVERTEXATTRIBI4UIPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIBI4UIPROC { - return (*PFNGLVERTEXATTRIBI4UIPROC)(ref) -} - -//export PFNGLVERTEXATTRIBI4UIPROC6821C9DE -func PFNGLVERTEXATTRIBI4UIPROC6821C9DE() { - if pFNGLVERTEXATTRIBI4UIPROC6821C9DEFunc != nil { - pFNGLVERTEXATTRIBI4UIPROC6821C9DEFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIBI4UIPROC6821C9DEFunc PFNGLVERTEXATTRIBI4UIPROC - -func (x PFNGLVERTEXATTRIBI4UIVPROC) PassRef() (ref *C.PFNGLVERTEXATTRIBI4UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBI4UIVPROC88245792Func == nil { - pFNGLVERTEXATTRIBI4UIVPROC88245792Func = x - } - return (*C.PFNGLVERTEXATTRIBI4UIVPROC)(C.PFNGLVERTEXATTRIBI4UIVPROC_88245792), nil -} - -func (x PFNGLVERTEXATTRIBI4UIVPROC) PassValue() (ref C.PFNGLVERTEXATTRIBI4UIVPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBI4UIVPROC88245792Func == nil { - pFNGLVERTEXATTRIBI4UIVPROC88245792Func = x - } - return (C.PFNGLVERTEXATTRIBI4UIVPROC)(C.PFNGLVERTEXATTRIBI4UIVPROC_88245792), nil -} - -func NewPFNGLVERTEXATTRIBI4UIVPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIBI4UIVPROC { - return (*PFNGLVERTEXATTRIBI4UIVPROC)(ref) -} - -//export PFNGLVERTEXATTRIBI4UIVPROC88245792 -func PFNGLVERTEXATTRIBI4UIVPROC88245792() { - if pFNGLVERTEXATTRIBI4UIVPROC88245792Func != nil { - pFNGLVERTEXATTRIBI4UIVPROC88245792Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIBI4UIVPROC88245792Func PFNGLVERTEXATTRIBI4UIVPROC - -func (x PFNGLVERTEXATTRIBIPOINTERPROC) PassRef() (ref *C.PFNGLVERTEXATTRIBIPOINTERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBIPOINTERPROC48E37DFCFunc == nil { - pFNGLVERTEXATTRIBIPOINTERPROC48E37DFCFunc = x - } - return (*C.PFNGLVERTEXATTRIBIPOINTERPROC)(C.PFNGLVERTEXATTRIBIPOINTERPROC_48e37dfc), nil -} - -func (x PFNGLVERTEXATTRIBIPOINTERPROC) PassValue() (ref C.PFNGLVERTEXATTRIBIPOINTERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBIPOINTERPROC48E37DFCFunc == nil { - pFNGLVERTEXATTRIBIPOINTERPROC48E37DFCFunc = x - } - return (C.PFNGLVERTEXATTRIBIPOINTERPROC)(C.PFNGLVERTEXATTRIBIPOINTERPROC_48e37dfc), nil -} - -func NewPFNGLVERTEXATTRIBIPOINTERPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIBIPOINTERPROC { - return (*PFNGLVERTEXATTRIBIPOINTERPROC)(ref) -} - -//export PFNGLVERTEXATTRIBIPOINTERPROC48E37DFC -func PFNGLVERTEXATTRIBIPOINTERPROC48E37DFC() { - if pFNGLVERTEXATTRIBIPOINTERPROC48E37DFCFunc != nil { - pFNGLVERTEXATTRIBIPOINTERPROC48E37DFCFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIBIPOINTERPROC48E37DFCFunc PFNGLVERTEXATTRIBIPOINTERPROC - -func (x PFNGLVERTEXATTRIBPOINTERPROC) PassRef() (ref *C.PFNGLVERTEXATTRIBPOINTERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBPOINTERPROCF18D3B5EFunc == nil { - pFNGLVERTEXATTRIBPOINTERPROCF18D3B5EFunc = x - } - return (*C.PFNGLVERTEXATTRIBPOINTERPROC)(C.PFNGLVERTEXATTRIBPOINTERPROC_f18d3b5e), nil -} - -func (x PFNGLVERTEXATTRIBPOINTERPROC) PassValue() (ref C.PFNGLVERTEXATTRIBPOINTERPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVERTEXATTRIBPOINTERPROCF18D3B5EFunc == nil { - pFNGLVERTEXATTRIBPOINTERPROCF18D3B5EFunc = x - } - return (C.PFNGLVERTEXATTRIBPOINTERPROC)(C.PFNGLVERTEXATTRIBPOINTERPROC_f18d3b5e), nil -} - -func NewPFNGLVERTEXATTRIBPOINTERPROCRef(ref unsafe.Pointer) *PFNGLVERTEXATTRIBPOINTERPROC { - return (*PFNGLVERTEXATTRIBPOINTERPROC)(ref) -} - -//export PFNGLVERTEXATTRIBPOINTERPROCF18D3B5E -func PFNGLVERTEXATTRIBPOINTERPROCF18D3B5E() { - if pFNGLVERTEXATTRIBPOINTERPROCF18D3B5EFunc != nil { - pFNGLVERTEXATTRIBPOINTERPROCF18D3B5EFunc() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVERTEXATTRIBPOINTERPROCF18D3B5EFunc PFNGLVERTEXATTRIBPOINTERPROC - -func (x PFNGLVIEWPORTPROC) PassRef() (ref *C.PFNGLVIEWPORTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVIEWPORTPROCBC565588Func == nil { - pFNGLVIEWPORTPROCBC565588Func = x - } - return (*C.PFNGLVIEWPORTPROC)(C.PFNGLVIEWPORTPROC_bc565588), nil -} - -func (x PFNGLVIEWPORTPROC) PassValue() (ref C.PFNGLVIEWPORTPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLVIEWPORTPROCBC565588Func == nil { - pFNGLVIEWPORTPROCBC565588Func = x - } - return (C.PFNGLVIEWPORTPROC)(C.PFNGLVIEWPORTPROC_bc565588), nil -} - -func NewPFNGLVIEWPORTPROCRef(ref unsafe.Pointer) *PFNGLVIEWPORTPROC { - return (*PFNGLVIEWPORTPROC)(ref) -} - -//export PFNGLVIEWPORTPROCBC565588 -func PFNGLVIEWPORTPROCBC565588() { - if pFNGLVIEWPORTPROCBC565588Func != nil { - pFNGLVIEWPORTPROCBC565588Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLVIEWPORTPROCBC565588Func PFNGLVIEWPORTPROC - -func (x PFNGLWAITSYNCPROC) PassRef() (ref *C.PFNGLWAITSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLWAITSYNCPROCC9B9A615Func == nil { - pFNGLWAITSYNCPROCC9B9A615Func = x - } - return (*C.PFNGLWAITSYNCPROC)(C.PFNGLWAITSYNCPROC_c9b9a615), nil -} - -func (x PFNGLWAITSYNCPROC) PassValue() (ref C.PFNGLWAITSYNCPROC, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if pFNGLWAITSYNCPROCC9B9A615Func == nil { - pFNGLWAITSYNCPROCC9B9A615Func = x - } - return (C.PFNGLWAITSYNCPROC)(C.PFNGLWAITSYNCPROC_c9b9a615), nil -} - -func NewPFNGLWAITSYNCPROCRef(ref unsafe.Pointer) *PFNGLWAITSYNCPROC { - return (*PFNGLWAITSYNCPROC)(ref) -} - -//export PFNGLWAITSYNCPROCC9B9A615 -func PFNGLWAITSYNCPROCC9B9A615() { - if pFNGLWAITSYNCPROCC9B9A615Func != nil { - pFNGLWAITSYNCPROCC9B9A615Func() - return - } - panic("callback func has not been set (race?)") -} - -var pFNGLWAITSYNCPROCC9B9A615Func PFNGLWAITSYNCPROC diff --git a/capi/gles3/cgo_helpers.h b/capi/gles3/cgo_helpers.h deleted file mode 100644 index 7531d6a..0000000 --- a/capi/gles3/cgo_helpers.h +++ /dev/null @@ -1,746 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "GLES3/gl3.h" -#include -#pragma once - -#define __CGOGEN 1 - -// PFNGLACTIVETEXTUREPROC_6c604afe is a proxy for callback PFNGLACTIVETEXTUREPROC. -void PFNGLACTIVETEXTUREPROC_6c604afe(); - -// PFNGLATTACHSHADERPROC_6a111311 is a proxy for callback PFNGLATTACHSHADERPROC. -void PFNGLATTACHSHADERPROC_6a111311(); - -// PFNGLBEGINQUERYPROC_b91e6474 is a proxy for callback PFNGLBEGINQUERYPROC. -void PFNGLBEGINQUERYPROC_b91e6474(); - -// PFNGLBEGINTRANSFORMFEEDBACKPROC_32028bbd is a proxy for callback PFNGLBEGINTRANSFORMFEEDBACKPROC. -void PFNGLBEGINTRANSFORMFEEDBACKPROC_32028bbd(); - -// PFNGLBINDATTRIBLOCATIONPROC_e517bc2a is a proxy for callback PFNGLBINDATTRIBLOCATIONPROC. -void PFNGLBINDATTRIBLOCATIONPROC_e517bc2a(); - -// PFNGLBINDBUFFERBASEPROC_8814d1eb is a proxy for callback PFNGLBINDBUFFERBASEPROC. -void PFNGLBINDBUFFERBASEPROC_8814d1eb(); - -// PFNGLBINDBUFFERPROC_58e32b5e is a proxy for callback PFNGLBINDBUFFERPROC. -void PFNGLBINDBUFFERPROC_58e32b5e(); - -// PFNGLBINDBUFFERRANGEPROC_af325a80 is a proxy for callback PFNGLBINDBUFFERRANGEPROC. -void PFNGLBINDBUFFERRANGEPROC_af325a80(); - -// PFNGLBINDFRAMEBUFFERPROC_0666f584 is a proxy for callback PFNGLBINDFRAMEBUFFERPROC. -void PFNGLBINDFRAMEBUFFERPROC_0666f584(); - -// PFNGLBINDRENDERBUFFERPROC_189e9b1a is a proxy for callback PFNGLBINDRENDERBUFFERPROC. -void PFNGLBINDRENDERBUFFERPROC_189e9b1a(); - -// PFNGLBINDSAMPLERPROC_f58b5f0f is a proxy for callback PFNGLBINDSAMPLERPROC. -void PFNGLBINDSAMPLERPROC_f58b5f0f(); - -// PFNGLBINDTEXTUREPROC_5bc8f391 is a proxy for callback PFNGLBINDTEXTUREPROC. -void PFNGLBINDTEXTUREPROC_5bc8f391(); - -// PFNGLBINDTRANSFORMFEEDBACKPROC_274eb341 is a proxy for callback PFNGLBINDTRANSFORMFEEDBACKPROC. -void PFNGLBINDTRANSFORMFEEDBACKPROC_274eb341(); - -// PFNGLBINDVERTEXARRAYPROC_5799c92d is a proxy for callback PFNGLBINDVERTEXARRAYPROC. -void PFNGLBINDVERTEXARRAYPROC_5799c92d(); - -// PFNGLBLENDCOLORPROC_8b6d9550 is a proxy for callback PFNGLBLENDCOLORPROC. -void PFNGLBLENDCOLORPROC_8b6d9550(); - -// PFNGLBLENDEQUATIONPROC_b2d89c63 is a proxy for callback PFNGLBLENDEQUATIONPROC. -void PFNGLBLENDEQUATIONPROC_b2d89c63(); - -// PFNGLBLENDEQUATIONSEPARATEPROC_3f74a9e6 is a proxy for callback PFNGLBLENDEQUATIONSEPARATEPROC. -void PFNGLBLENDEQUATIONSEPARATEPROC_3f74a9e6(); - -// PFNGLBLENDFUNCPROC_6b072d27 is a proxy for callback PFNGLBLENDFUNCPROC. -void PFNGLBLENDFUNCPROC_6b072d27(); - -// PFNGLBLENDFUNCSEPARATEPROC_cb3fa4b0 is a proxy for callback PFNGLBLENDFUNCSEPARATEPROC. -void PFNGLBLENDFUNCSEPARATEPROC_cb3fa4b0(); - -// PFNGLBLITFRAMEBUFFERPROC_fedd3a33 is a proxy for callback PFNGLBLITFRAMEBUFFERPROC. -void PFNGLBLITFRAMEBUFFERPROC_fedd3a33(); - -// PFNGLBUFFERDATAPROC_83900d72 is a proxy for callback PFNGLBUFFERDATAPROC. -void PFNGLBUFFERDATAPROC_83900d72(); - -// PFNGLBUFFERSUBDATAPROC_cd04a508 is a proxy for callback PFNGLBUFFERSUBDATAPROC. -void PFNGLBUFFERSUBDATAPROC_cd04a508(); - -// PFNGLCHECKFRAMEBUFFERSTATUSPROC_97292a5a is a proxy for callback PFNGLCHECKFRAMEBUFFERSTATUSPROC. -void PFNGLCHECKFRAMEBUFFERSTATUSPROC_97292a5a(); - -// PFNGLCLEARBUFFERFIPROC_200129a8 is a proxy for callback PFNGLCLEARBUFFERFIPROC. -void PFNGLCLEARBUFFERFIPROC_200129a8(); - -// PFNGLCLEARBUFFERFVPROC_cf4c8e8f is a proxy for callback PFNGLCLEARBUFFERFVPROC. -void PFNGLCLEARBUFFERFVPROC_cf4c8e8f(); - -// PFNGLCLEARBUFFERIVPROC_5cccb667 is a proxy for callback PFNGLCLEARBUFFERIVPROC. -void PFNGLCLEARBUFFERIVPROC_5cccb667(); - -// PFNGLCLEARBUFFERUIVPROC_21b2b9c0 is a proxy for callback PFNGLCLEARBUFFERUIVPROC. -void PFNGLCLEARBUFFERUIVPROC_21b2b9c0(); - -// PFNGLCLEARCOLORPROC_4b2c18b9 is a proxy for callback PFNGLCLEARCOLORPROC. -void PFNGLCLEARCOLORPROC_4b2c18b9(); - -// PFNGLCLEARDEPTHFPROC_473d2fca is a proxy for callback PFNGLCLEARDEPTHFPROC. -void PFNGLCLEARDEPTHFPROC_473d2fca(); - -// PFNGLCLEARPROC_81796bd7 is a proxy for callback PFNGLCLEARPROC. -void PFNGLCLEARPROC_81796bd7(); - -// PFNGLCLEARSTENCILPROC_860e5897 is a proxy for callback PFNGLCLEARSTENCILPROC. -void PFNGLCLEARSTENCILPROC_860e5897(); - -// PFNGLCLIENTWAITSYNCPROC_334598fd is a proxy for callback PFNGLCLIENTWAITSYNCPROC. -void PFNGLCLIENTWAITSYNCPROC_334598fd(); - -// PFNGLCOLORMASKPROC_4ae7db24 is a proxy for callback PFNGLCOLORMASKPROC. -void PFNGLCOLORMASKPROC_4ae7db24(); - -// PFNGLCOMPILESHADERPROC_f3cc75e5 is a proxy for callback PFNGLCOMPILESHADERPROC. -void PFNGLCOMPILESHADERPROC_f3cc75e5(); - -// PFNGLCOMPRESSEDTEXIMAGE2DPROC_11b9df71 is a proxy for callback PFNGLCOMPRESSEDTEXIMAGE2DPROC. -void PFNGLCOMPRESSEDTEXIMAGE2DPROC_11b9df71(); - -// PFNGLCOMPRESSEDTEXIMAGE3DPROC_77f8d9bd is a proxy for callback PFNGLCOMPRESSEDTEXIMAGE3DPROC. -void PFNGLCOMPRESSEDTEXIMAGE3DPROC_77f8d9bd(); - -// PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_0f7a8b98 is a proxy for callback PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC. -void PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC_0f7a8b98(); - -// PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC_beb8cf69 is a proxy for callback PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC. -void PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC_beb8cf69(); - -// PFNGLCOPYBUFFERSUBDATAPROC_4f2ebb80 is a proxy for callback PFNGLCOPYBUFFERSUBDATAPROC. -void PFNGLCOPYBUFFERSUBDATAPROC_4f2ebb80(); - -// PFNGLCOPYTEXIMAGE2DPROC_d952ff06 is a proxy for callback PFNGLCOPYTEXIMAGE2DPROC. -void PFNGLCOPYTEXIMAGE2DPROC_d952ff06(); - -// PFNGLCOPYTEXSUBIMAGE2DPROC_99d0f6f9 is a proxy for callback PFNGLCOPYTEXSUBIMAGE2DPROC. -void PFNGLCOPYTEXSUBIMAGE2DPROC_99d0f6f9(); - -// PFNGLCOPYTEXSUBIMAGE3DPROC_cbbaa8a1 is a proxy for callback PFNGLCOPYTEXSUBIMAGE3DPROC. -void PFNGLCOPYTEXSUBIMAGE3DPROC_cbbaa8a1(); - -// PFNGLCREATEPROGRAMPROC_fba42bd7 is a proxy for callback PFNGLCREATEPROGRAMPROC. -void PFNGLCREATEPROGRAMPROC_fba42bd7(); - -// PFNGLCREATESHADERPROC_5f191f08 is a proxy for callback PFNGLCREATESHADERPROC. -void PFNGLCREATESHADERPROC_5f191f08(); - -// PFNGLCULLFACEPROC_89da9a67 is a proxy for callback PFNGLCULLFACEPROC. -void PFNGLCULLFACEPROC_89da9a67(); - -// PFNGLDELETEBUFFERSPROC_cb1c16cd is a proxy for callback PFNGLDELETEBUFFERSPROC. -void PFNGLDELETEBUFFERSPROC_cb1c16cd(); - -// PFNGLDELETEFRAMEBUFFERSPROC_28ed84d7 is a proxy for callback PFNGLDELETEFRAMEBUFFERSPROC. -void PFNGLDELETEFRAMEBUFFERSPROC_28ed84d7(); - -// PFNGLDELETEPROGRAMPROC_f9af89b0 is a proxy for callback PFNGLDELETEPROGRAMPROC. -void PFNGLDELETEPROGRAMPROC_f9af89b0(); - -// PFNGLDELETEQUERIESPROC_ba0b7b84 is a proxy for callback PFNGLDELETEQUERIESPROC. -void PFNGLDELETEQUERIESPROC_ba0b7b84(); - -// PFNGLDELETERENDERBUFFERSPROC_8e10b4c0 is a proxy for callback PFNGLDELETERENDERBUFFERSPROC. -void PFNGLDELETERENDERBUFFERSPROC_8e10b4c0(); - -// PFNGLDELETESAMPLERSPROC_70f19e4a is a proxy for callback PFNGLDELETESAMPLERSPROC. -void PFNGLDELETESAMPLERSPROC_70f19e4a(); - -// PFNGLDELETESHADERPROC_37948131 is a proxy for callback PFNGLDELETESHADERPROC. -void PFNGLDELETESHADERPROC_37948131(); - -// PFNGLDELETESYNCPROC_5184c34e is a proxy for callback PFNGLDELETESYNCPROC. -void PFNGLDELETESYNCPROC_5184c34e(); - -// PFNGLDELETETEXTURESPROC_6b199e47 is a proxy for callback PFNGLDELETETEXTURESPROC. -void PFNGLDELETETEXTURESPROC_6b199e47(); - -// PFNGLDELETETRANSFORMFEEDBACKSPROC_c63fe37d is a proxy for callback PFNGLDELETETRANSFORMFEEDBACKSPROC. -void PFNGLDELETETRANSFORMFEEDBACKSPROC_c63fe37d(); - -// PFNGLDELETEVERTEXARRAYSPROC_95b8b72a is a proxy for callback PFNGLDELETEVERTEXARRAYSPROC. -void PFNGLDELETEVERTEXARRAYSPROC_95b8b72a(); - -// PFNGLDEPTHFUNCPROC_465da9ed is a proxy for callback PFNGLDEPTHFUNCPROC. -void PFNGLDEPTHFUNCPROC_465da9ed(); - -// PFNGLDEPTHMASKPROC_31a797a3 is a proxy for callback PFNGLDEPTHMASKPROC. -void PFNGLDEPTHMASKPROC_31a797a3(); - -// PFNGLDEPTHRANGEFPROC_899f0d08 is a proxy for callback PFNGLDEPTHRANGEFPROC. -void PFNGLDEPTHRANGEFPROC_899f0d08(); - -// PFNGLDETACHSHADERPROC_cf86dfea is a proxy for callback PFNGLDETACHSHADERPROC. -void PFNGLDETACHSHADERPROC_cf86dfea(); - -// PFNGLDISABLEPROC_2349a992 is a proxy for callback PFNGLDISABLEPROC. -void PFNGLDISABLEPROC_2349a992(); - -// PFNGLDISABLEVERTEXATTRIBARRAYPROC_7a86dd23 is a proxy for callback PFNGLDISABLEVERTEXATTRIBARRAYPROC. -void PFNGLDISABLEVERTEXATTRIBARRAYPROC_7a86dd23(); - -// PFNGLDRAWARRAYSINSTANCEDPROC_0f4fbca3 is a proxy for callback PFNGLDRAWARRAYSINSTANCEDPROC. -void PFNGLDRAWARRAYSINSTANCEDPROC_0f4fbca3(); - -// PFNGLDRAWARRAYSPROC_d5c7ac18 is a proxy for callback PFNGLDRAWARRAYSPROC. -void PFNGLDRAWARRAYSPROC_d5c7ac18(); - -// PFNGLDRAWBUFFERSPROC_dbcc9007 is a proxy for callback PFNGLDRAWBUFFERSPROC. -void PFNGLDRAWBUFFERSPROC_dbcc9007(); - -// PFNGLDRAWELEMENTSINSTANCEDPROC_7b7ceb7e is a proxy for callback PFNGLDRAWELEMENTSINSTANCEDPROC. -void PFNGLDRAWELEMENTSINSTANCEDPROC_7b7ceb7e(); - -// PFNGLDRAWELEMENTSPROC_13247097 is a proxy for callback PFNGLDRAWELEMENTSPROC. -void PFNGLDRAWELEMENTSPROC_13247097(); - -// PFNGLDRAWRANGEELEMENTSPROC_b12188b5 is a proxy for callback PFNGLDRAWRANGEELEMENTSPROC. -void PFNGLDRAWRANGEELEMENTSPROC_b12188b5(); - -// PFNGLENABLEPROC_c545119a is a proxy for callback PFNGLENABLEPROC. -void PFNGLENABLEPROC_c545119a(); - -// PFNGLENABLEVERTEXATTRIBARRAYPROC_af1424a2 is a proxy for callback PFNGLENABLEVERTEXATTRIBARRAYPROC. -void PFNGLENABLEVERTEXATTRIBARRAYPROC_af1424a2(); - -// PFNGLENDQUERYPROC_198bf2b2 is a proxy for callback PFNGLENDQUERYPROC. -void PFNGLENDQUERYPROC_198bf2b2(); - -// PFNGLENDTRANSFORMFEEDBACKPROC_38335e93 is a proxy for callback PFNGLENDTRANSFORMFEEDBACKPROC. -void PFNGLENDTRANSFORMFEEDBACKPROC_38335e93(); - -// PFNGLFENCESYNCPROC_497552b6 is a proxy for callback PFNGLFENCESYNCPROC. -void PFNGLFENCESYNCPROC_497552b6(); - -// PFNGLFINISHPROC_0be044d4 is a proxy for callback PFNGLFINISHPROC. -void PFNGLFINISHPROC_0be044d4(); - -// PFNGLFLUSHMAPPEDBUFFERRANGEPROC_0023bfde is a proxy for callback PFNGLFLUSHMAPPEDBUFFERRANGEPROC. -void PFNGLFLUSHMAPPEDBUFFERRANGEPROC_0023bfde(); - -// PFNGLFLUSHPROC_fe2e0200 is a proxy for callback PFNGLFLUSHPROC. -void PFNGLFLUSHPROC_fe2e0200(); - -// PFNGLFRAMEBUFFERRENDERBUFFERPROC_931cd714 is a proxy for callback PFNGLFRAMEBUFFERRENDERBUFFERPROC. -void PFNGLFRAMEBUFFERRENDERBUFFERPROC_931cd714(); - -// PFNGLFRAMEBUFFERTEXTURE2DPROC_f9765a33 is a proxy for callback PFNGLFRAMEBUFFERTEXTURE2DPROC. -void PFNGLFRAMEBUFFERTEXTURE2DPROC_f9765a33(); - -// PFNGLFRAMEBUFFERTEXTURELAYERPROC_fe303df6 is a proxy for callback PFNGLFRAMEBUFFERTEXTURELAYERPROC. -void PFNGLFRAMEBUFFERTEXTURELAYERPROC_fe303df6(); - -// PFNGLFRONTFACEPROC_b2ff6969 is a proxy for callback PFNGLFRONTFACEPROC. -void PFNGLFRONTFACEPROC_b2ff6969(); - -// PFNGLGENBUFFERSPROC_552efb23 is a proxy for callback PFNGLGENBUFFERSPROC. -void PFNGLGENBUFFERSPROC_552efb23(); - -// PFNGLGENERATEMIPMAPPROC_f27998e1 is a proxy for callback PFNGLGENERATEMIPMAPPROC. -void PFNGLGENERATEMIPMAPPROC_f27998e1(); - -// PFNGLGENFRAMEBUFFERSPROC_5d476bc5 is a proxy for callback PFNGLGENFRAMEBUFFERSPROC. -void PFNGLGENFRAMEBUFFERSPROC_5d476bc5(); - -// PFNGLGENQUERIESPROC_8ebe6c09 is a proxy for callback PFNGLGENQUERIESPROC. -void PFNGLGENQUERIESPROC_8ebe6c09(); - -// PFNGLGENRENDERBUFFERSPROC_2a770542 is a proxy for callback PFNGLGENRENDERBUFFERSPROC. -void PFNGLGENRENDERBUFFERSPROC_2a770542(); - -// PFNGLGENSAMPLERSPROC_f03d9955 is a proxy for callback PFNGLGENSAMPLERSPROC. -void PFNGLGENSAMPLERSPROC_f03d9955(); - -// PFNGLGENTEXTURESPROC_42d92669 is a proxy for callback PFNGLGENTEXTURESPROC. -void PFNGLGENTEXTURESPROC_42d92669(); - -// PFNGLGENTRANSFORMFEEDBACKSPROC_ae39d84b is a proxy for callback PFNGLGENTRANSFORMFEEDBACKSPROC. -void PFNGLGENTRANSFORMFEEDBACKSPROC_ae39d84b(); - -// PFNGLGENVERTEXARRAYSPROC_b6b2d522 is a proxy for callback PFNGLGENVERTEXARRAYSPROC. -void PFNGLGENVERTEXARRAYSPROC_b6b2d522(); - -// PFNGLGETACTIVEATTRIBPROC_d343cf3b is a proxy for callback PFNGLGETACTIVEATTRIBPROC. -void PFNGLGETACTIVEATTRIBPROC_d343cf3b(); - -// PFNGLGETACTIVEUNIFORMBLOCKIVPROC_b4be84e5 is a proxy for callback PFNGLGETACTIVEUNIFORMBLOCKIVPROC. -void PFNGLGETACTIVEUNIFORMBLOCKIVPROC_b4be84e5(); - -// PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC_e2c8c8e7 is a proxy for callback PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC. -void PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC_e2c8c8e7(); - -// PFNGLGETACTIVEUNIFORMPROC_557d1389 is a proxy for callback PFNGLGETACTIVEUNIFORMPROC. -void PFNGLGETACTIVEUNIFORMPROC_557d1389(); - -// PFNGLGETACTIVEUNIFORMSIVPROC_d8bbe80a is a proxy for callback PFNGLGETACTIVEUNIFORMSIVPROC. -void PFNGLGETACTIVEUNIFORMSIVPROC_d8bbe80a(); - -// PFNGLGETATTACHEDSHADERSPROC_26d002c5 is a proxy for callback PFNGLGETATTACHEDSHADERSPROC. -void PFNGLGETATTACHEDSHADERSPROC_26d002c5(); - -// PFNGLGETATTRIBLOCATIONPROC_5de605a0 is a proxy for callback PFNGLGETATTRIBLOCATIONPROC. -void PFNGLGETATTRIBLOCATIONPROC_5de605a0(); - -// PFNGLGETBOOLEANVPROC_28ccc4b8 is a proxy for callback PFNGLGETBOOLEANVPROC. -void PFNGLGETBOOLEANVPROC_28ccc4b8(); - -// PFNGLGETBUFFERPARAMETERI64VPROC_c241e392 is a proxy for callback PFNGLGETBUFFERPARAMETERI64VPROC. -void PFNGLGETBUFFERPARAMETERI64VPROC_c241e392(); - -// PFNGLGETBUFFERPARAMETERIVPROC_763d4976 is a proxy for callback PFNGLGETBUFFERPARAMETERIVPROC. -void PFNGLGETBUFFERPARAMETERIVPROC_763d4976(); - -// PFNGLGETBUFFERPOINTERVPROC_59db26b7 is a proxy for callback PFNGLGETBUFFERPOINTERVPROC. -void PFNGLGETBUFFERPOINTERVPROC_59db26b7(); - -// PFNGLGETERRORPROC_4ee43bb4 is a proxy for callback PFNGLGETERRORPROC. -void PFNGLGETERRORPROC_4ee43bb4(); - -// PFNGLGETFLOATVPROC_26cedba1 is a proxy for callback PFNGLGETFLOATVPROC. -void PFNGLGETFLOATVPROC_26cedba1(); - -// PFNGLGETFRAGDATALOCATIONPROC_3f23c060 is a proxy for callback PFNGLGETFRAGDATALOCATIONPROC. -void PFNGLGETFRAGDATALOCATIONPROC_3f23c060(); - -// PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_d90cb190 is a proxy for callback PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC. -void PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC_d90cb190(); - -// PFNGLGETINTEGER64I_VPROC_242cd442 is a proxy for callback PFNGLGETINTEGER64I_VPROC. -void PFNGLGETINTEGER64I_VPROC_242cd442(); - -// PFNGLGETINTEGER64VPROC_1af2d58f is a proxy for callback PFNGLGETINTEGER64VPROC. -void PFNGLGETINTEGER64VPROC_1af2d58f(); - -// PFNGLGETINTEGERI_VPROC_918a3aba is a proxy for callback PFNGLGETINTEGERI_VPROC. -void PFNGLGETINTEGERI_VPROC_918a3aba(); - -// PFNGLGETINTEGERVPROC_a20307b0 is a proxy for callback PFNGLGETINTEGERVPROC. -void PFNGLGETINTEGERVPROC_a20307b0(); - -// PFNGLGETINTERNALFORMATIVPROC_a1b94b3c is a proxy for callback PFNGLGETINTERNALFORMATIVPROC. -void PFNGLGETINTERNALFORMATIVPROC_a1b94b3c(); - -// PFNGLGETPROGRAMBINARYPROC_2beb64a5 is a proxy for callback PFNGLGETPROGRAMBINARYPROC. -void PFNGLGETPROGRAMBINARYPROC_2beb64a5(); - -// PFNGLGETPROGRAMINFOLOGPROC_561acfae is a proxy for callback PFNGLGETPROGRAMINFOLOGPROC. -void PFNGLGETPROGRAMINFOLOGPROC_561acfae(); - -// PFNGLGETPROGRAMIVPROC_f21b4e1c is a proxy for callback PFNGLGETPROGRAMIVPROC. -void PFNGLGETPROGRAMIVPROC_f21b4e1c(); - -// PFNGLGETQUERYIVPROC_d2b5e550 is a proxy for callback PFNGLGETQUERYIVPROC. -void PFNGLGETQUERYIVPROC_d2b5e550(); - -// PFNGLGETQUERYOBJECTUIVPROC_a736af9b is a proxy for callback PFNGLGETQUERYOBJECTUIVPROC. -void PFNGLGETQUERYOBJECTUIVPROC_a736af9b(); - -// PFNGLGETRENDERBUFFERPARAMETERIVPROC_012dfb45 is a proxy for callback PFNGLGETRENDERBUFFERPARAMETERIVPROC. -void PFNGLGETRENDERBUFFERPARAMETERIVPROC_012dfb45(); - -// PFNGLGETSAMPLERPARAMETERFVPROC_7884a5fe is a proxy for callback PFNGLGETSAMPLERPARAMETERFVPROC. -void PFNGLGETSAMPLERPARAMETERFVPROC_7884a5fe(); - -// PFNGLGETSAMPLERPARAMETERIVPROC_a6b2561a is a proxy for callback PFNGLGETSAMPLERPARAMETERIVPROC. -void PFNGLGETSAMPLERPARAMETERIVPROC_a6b2561a(); - -// PFNGLGETSHADERINFOLOGPROC_6c2312e1 is a proxy for callback PFNGLGETSHADERINFOLOGPROC. -void PFNGLGETSHADERINFOLOGPROC_6c2312e1(); - -// PFNGLGETSHADERIVPROC_181fc959 is a proxy for callback PFNGLGETSHADERIVPROC. -void PFNGLGETSHADERIVPROC_181fc959(); - -// PFNGLGETSHADERPRECISIONFORMATPROC_ba71b795 is a proxy for callback PFNGLGETSHADERPRECISIONFORMATPROC. -void PFNGLGETSHADERPRECISIONFORMATPROC_ba71b795(); - -// PFNGLGETSHADERSOURCEPROC_29961e3e is a proxy for callback PFNGLGETSHADERSOURCEPROC. -void PFNGLGETSHADERSOURCEPROC_29961e3e(); - -// PFNGLGETSTRINGIPROC_b4181478 is a proxy for callback PFNGLGETSTRINGIPROC. -void PFNGLGETSTRINGIPROC_b4181478(); - -// PFNGLGETSTRINGPROC_9056842e is a proxy for callback PFNGLGETSTRINGPROC. -void PFNGLGETSTRINGPROC_9056842e(); - -// PFNGLGETSYNCIVPROC_b687ee19 is a proxy for callback PFNGLGETSYNCIVPROC. -void PFNGLGETSYNCIVPROC_b687ee19(); - -// PFNGLGETTEXPARAMETERFVPROC_fbbac33a is a proxy for callback PFNGLGETTEXPARAMETERFVPROC. -void PFNGLGETTEXPARAMETERFVPROC_fbbac33a(); - -// PFNGLGETTEXPARAMETERIVPROC_88ce5347 is a proxy for callback PFNGLGETTEXPARAMETERIVPROC. -void PFNGLGETTEXPARAMETERIVPROC_88ce5347(); - -// PFNGLGETTRANSFORMFEEDBACKVARYINGPROC_bad38b4d is a proxy for callback PFNGLGETTRANSFORMFEEDBACKVARYINGPROC. -void PFNGLGETTRANSFORMFEEDBACKVARYINGPROC_bad38b4d(); - -// PFNGLGETUNIFORMBLOCKINDEXPROC_cb5218b1 is a proxy for callback PFNGLGETUNIFORMBLOCKINDEXPROC. -void PFNGLGETUNIFORMBLOCKINDEXPROC_cb5218b1(); - -// PFNGLGETUNIFORMFVPROC_1ccb78ca is a proxy for callback PFNGLGETUNIFORMFVPROC. -void PFNGLGETUNIFORMFVPROC_1ccb78ca(); - -// PFNGLGETUNIFORMINDICESPROC_548e5e58 is a proxy for callback PFNGLGETUNIFORMINDICESPROC. -void PFNGLGETUNIFORMINDICESPROC_548e5e58(); - -// PFNGLGETUNIFORMIVPROC_37e3a17a is a proxy for callback PFNGLGETUNIFORMIVPROC. -void PFNGLGETUNIFORMIVPROC_37e3a17a(); - -// PFNGLGETUNIFORMLOCATIONPROC_6be9913d is a proxy for callback PFNGLGETUNIFORMLOCATIONPROC. -void PFNGLGETUNIFORMLOCATIONPROC_6be9913d(); - -// PFNGLGETUNIFORMUIVPROC_fdfa8264 is a proxy for callback PFNGLGETUNIFORMUIVPROC. -void PFNGLGETUNIFORMUIVPROC_fdfa8264(); - -// PFNGLGETVERTEXATTRIBFVPROC_2c991e8d is a proxy for callback PFNGLGETVERTEXATTRIBFVPROC. -void PFNGLGETVERTEXATTRIBFVPROC_2c991e8d(); - -// PFNGLGETVERTEXATTRIBIIVPROC_497cc5ff is a proxy for callback PFNGLGETVERTEXATTRIBIIVPROC. -void PFNGLGETVERTEXATTRIBIIVPROC_497cc5ff(); - -// PFNGLGETVERTEXATTRIBIUIVPROC_96b22535 is a proxy for callback PFNGLGETVERTEXATTRIBIUIVPROC. -void PFNGLGETVERTEXATTRIBIUIVPROC_96b22535(); - -// PFNGLGETVERTEXATTRIBIVPROC_8af8ed90 is a proxy for callback PFNGLGETVERTEXATTRIBIVPROC. -void PFNGLGETVERTEXATTRIBIVPROC_8af8ed90(); - -// PFNGLGETVERTEXATTRIBPOINTERVPROC_bbb72eda is a proxy for callback PFNGLGETVERTEXATTRIBPOINTERVPROC. -void PFNGLGETVERTEXATTRIBPOINTERVPROC_bbb72eda(); - -// PFNGLHINTPROC_9615d875 is a proxy for callback PFNGLHINTPROC. -void PFNGLHINTPROC_9615d875(); - -// PFNGLINVALIDATEFRAMEBUFFERPROC_8a44ae58 is a proxy for callback PFNGLINVALIDATEFRAMEBUFFERPROC. -void PFNGLINVALIDATEFRAMEBUFFERPROC_8a44ae58(); - -// PFNGLINVALIDATESUBFRAMEBUFFERPROC_87763868 is a proxy for callback PFNGLINVALIDATESUBFRAMEBUFFERPROC. -void PFNGLINVALIDATESUBFRAMEBUFFERPROC_87763868(); - -// PFNGLISBUFFERPROC_1205a0eb is a proxy for callback PFNGLISBUFFERPROC. -void PFNGLISBUFFERPROC_1205a0eb(); - -// PFNGLISENABLEDPROC_3cfdab2a is a proxy for callback PFNGLISENABLEDPROC. -void PFNGLISENABLEDPROC_3cfdab2a(); - -// PFNGLISFRAMEBUFFERPROC_6a0eb102 is a proxy for callback PFNGLISFRAMEBUFFERPROC. -void PFNGLISFRAMEBUFFERPROC_6a0eb102(); - -// PFNGLISPROGRAMPROC_69d4d96f is a proxy for callback PFNGLISPROGRAMPROC. -void PFNGLISPROGRAMPROC_69d4d96f(); - -// PFNGLISQUERYPROC_8bd23752 is a proxy for callback PFNGLISQUERYPROC. -void PFNGLISQUERYPROC_8bd23752(); - -// PFNGLISRENDERBUFFERPROC_4113416b is a proxy for callback PFNGLISRENDERBUFFERPROC. -void PFNGLISRENDERBUFFERPROC_4113416b(); - -// PFNGLISSAMPLERPROC_38170421 is a proxy for callback PFNGLISSAMPLERPROC. -void PFNGLISSAMPLERPROC_38170421(); - -// PFNGLISSHADERPROC_abbfff54 is a proxy for callback PFNGLISSHADERPROC. -void PFNGLISSHADERPROC_abbfff54(); - -// PFNGLISSYNCPROC_8e68ebbb is a proxy for callback PFNGLISSYNCPROC. -void PFNGLISSYNCPROC_8e68ebbb(); - -// PFNGLISTEXTUREPROC_775b4fd4 is a proxy for callback PFNGLISTEXTUREPROC. -void PFNGLISTEXTUREPROC_775b4fd4(); - -// PFNGLISTRANSFORMFEEDBACKPROC_fcd30ea1 is a proxy for callback PFNGLISTRANSFORMFEEDBACKPROC. -void PFNGLISTRANSFORMFEEDBACKPROC_fcd30ea1(); - -// PFNGLISVERTEXARRAYPROC_736d5edb is a proxy for callback PFNGLISVERTEXARRAYPROC. -void PFNGLISVERTEXARRAYPROC_736d5edb(); - -// PFNGLLINEWIDTHPROC_ba5950e5 is a proxy for callback PFNGLLINEWIDTHPROC. -void PFNGLLINEWIDTHPROC_ba5950e5(); - -// PFNGLLINKPROGRAMPROC_161a12a7 is a proxy for callback PFNGLLINKPROGRAMPROC. -void PFNGLLINKPROGRAMPROC_161a12a7(); - -// PFNGLMAPBUFFERRANGEPROC_627ea2f5 is a proxy for callback PFNGLMAPBUFFERRANGEPROC. -void PFNGLMAPBUFFERRANGEPROC_627ea2f5(); - -// PFNGLPAUSETRANSFORMFEEDBACKPROC_9de9d6d1 is a proxy for callback PFNGLPAUSETRANSFORMFEEDBACKPROC. -void PFNGLPAUSETRANSFORMFEEDBACKPROC_9de9d6d1(); - -// PFNGLPIXELSTOREIPROC_7a0339f7 is a proxy for callback PFNGLPIXELSTOREIPROC. -void PFNGLPIXELSTOREIPROC_7a0339f7(); - -// PFNGLPOLYGONOFFSETPROC_c431f0c7 is a proxy for callback PFNGLPOLYGONOFFSETPROC. -void PFNGLPOLYGONOFFSETPROC_c431f0c7(); - -// PFNGLPROGRAMBINARYPROC_21944aec is a proxy for callback PFNGLPROGRAMBINARYPROC. -void PFNGLPROGRAMBINARYPROC_21944aec(); - -// PFNGLPROGRAMPARAMETERIPROC_a171055f is a proxy for callback PFNGLPROGRAMPARAMETERIPROC. -void PFNGLPROGRAMPARAMETERIPROC_a171055f(); - -// PFNGLREADBUFFERPROC_11385d22 is a proxy for callback PFNGLREADBUFFERPROC. -void PFNGLREADBUFFERPROC_11385d22(); - -// PFNGLREADPIXELSPROC_97c2ff0f is a proxy for callback PFNGLREADPIXELSPROC. -void PFNGLREADPIXELSPROC_97c2ff0f(); - -// PFNGLRELEASESHADERCOMPILERPROC_fd48183d is a proxy for callback PFNGLRELEASESHADERCOMPILERPROC. -void PFNGLRELEASESHADERCOMPILERPROC_fd48183d(); - -// PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC_76ccd59c is a proxy for callback PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC. -void PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC_76ccd59c(); - -// PFNGLRENDERBUFFERSTORAGEPROC_7a4ec204 is a proxy for callback PFNGLRENDERBUFFERSTORAGEPROC. -void PFNGLRENDERBUFFERSTORAGEPROC_7a4ec204(); - -// PFNGLRESUMETRANSFORMFEEDBACKPROC_85f458d6 is a proxy for callback PFNGLRESUMETRANSFORMFEEDBACKPROC. -void PFNGLRESUMETRANSFORMFEEDBACKPROC_85f458d6(); - -// PFNGLSAMPLECOVERAGEPROC_7a0d5034 is a proxy for callback PFNGLSAMPLECOVERAGEPROC. -void PFNGLSAMPLECOVERAGEPROC_7a0d5034(); - -// PFNGLSAMPLERPARAMETERFPROC_bd904a68 is a proxy for callback PFNGLSAMPLERPARAMETERFPROC. -void PFNGLSAMPLERPARAMETERFPROC_bd904a68(); - -// PFNGLSAMPLERPARAMETERFVPROC_0dc22a41 is a proxy for callback PFNGLSAMPLERPARAMETERFVPROC. -void PFNGLSAMPLERPARAMETERFVPROC_0dc22a41(); - -// PFNGLSAMPLERPARAMETERIPROC_a43d84c8 is a proxy for callback PFNGLSAMPLERPARAMETERIPROC. -void PFNGLSAMPLERPARAMETERIPROC_a43d84c8(); - -// PFNGLSAMPLERPARAMETERIVPROC_7d65b105 is a proxy for callback PFNGLSAMPLERPARAMETERIVPROC. -void PFNGLSAMPLERPARAMETERIVPROC_7d65b105(); - -// PFNGLSCISSORPROC_882c96cc is a proxy for callback PFNGLSCISSORPROC. -void PFNGLSCISSORPROC_882c96cc(); - -// PFNGLSHADERBINARYPROC_eb973fb2 is a proxy for callback PFNGLSHADERBINARYPROC. -void PFNGLSHADERBINARYPROC_eb973fb2(); - -// PFNGLSHADERSOURCEPROC_7ffe3e77 is a proxy for callback PFNGLSHADERSOURCEPROC. -void PFNGLSHADERSOURCEPROC_7ffe3e77(); - -// PFNGLSTENCILFUNCPROC_ca625f61 is a proxy for callback PFNGLSTENCILFUNCPROC. -void PFNGLSTENCILFUNCPROC_ca625f61(); - -// PFNGLSTENCILFUNCSEPARATEPROC_91a002dc is a proxy for callback PFNGLSTENCILFUNCSEPARATEPROC. -void PFNGLSTENCILFUNCSEPARATEPROC_91a002dc(); - -// PFNGLSTENCILMASKPROC_2fcda6ac is a proxy for callback PFNGLSTENCILMASKPROC. -void PFNGLSTENCILMASKPROC_2fcda6ac(); - -// PFNGLSTENCILMASKSEPARATEPROC_470e1c05 is a proxy for callback PFNGLSTENCILMASKSEPARATEPROC. -void PFNGLSTENCILMASKSEPARATEPROC_470e1c05(); - -// PFNGLSTENCILOPPROC_6bfd6244 is a proxy for callback PFNGLSTENCILOPPROC. -void PFNGLSTENCILOPPROC_6bfd6244(); - -// PFNGLSTENCILOPSEPARATEPROC_34d4afbe is a proxy for callback PFNGLSTENCILOPSEPARATEPROC. -void PFNGLSTENCILOPSEPARATEPROC_34d4afbe(); - -// PFNGLTEXIMAGE2DPROC_5118e801 is a proxy for callback PFNGLTEXIMAGE2DPROC. -void PFNGLTEXIMAGE2DPROC_5118e801(); - -// PFNGLTEXIMAGE3DPROC_36a4932a is a proxy for callback PFNGLTEXIMAGE3DPROC. -void PFNGLTEXIMAGE3DPROC_36a4932a(); - -// PFNGLTEXPARAMETERFPROC_1d38fabb is a proxy for callback PFNGLTEXPARAMETERFPROC. -void PFNGLTEXPARAMETERFPROC_1d38fabb(); - -// PFNGLTEXPARAMETERFVPROC_0b118e13 is a proxy for callback PFNGLTEXPARAMETERFVPROC. -void PFNGLTEXPARAMETERFVPROC_0b118e13(); - -// PFNGLTEXPARAMETERIPROC_3f03378a is a proxy for callback PFNGLTEXPARAMETERIPROC. -void PFNGLTEXPARAMETERIPROC_3f03378a(); - -// PFNGLTEXPARAMETERIVPROC_7337f38e is a proxy for callback PFNGLTEXPARAMETERIVPROC. -void PFNGLTEXPARAMETERIVPROC_7337f38e(); - -// PFNGLTEXSTORAGE2DPROC_408b7c7c is a proxy for callback PFNGLTEXSTORAGE2DPROC. -void PFNGLTEXSTORAGE2DPROC_408b7c7c(); - -// PFNGLTEXSTORAGE3DPROC_ccdc130d is a proxy for callback PFNGLTEXSTORAGE3DPROC. -void PFNGLTEXSTORAGE3DPROC_ccdc130d(); - -// PFNGLTEXSUBIMAGE2DPROC_accd8326 is a proxy for callback PFNGLTEXSUBIMAGE2DPROC. -void PFNGLTEXSUBIMAGE2DPROC_accd8326(); - -// PFNGLTEXSUBIMAGE3DPROC_65f790a0 is a proxy for callback PFNGLTEXSUBIMAGE3DPROC. -void PFNGLTEXSUBIMAGE3DPROC_65f790a0(); - -// PFNGLTRANSFORMFEEDBACKVARYINGSPROC_1095cbc2 is a proxy for callback PFNGLTRANSFORMFEEDBACKVARYINGSPROC. -void PFNGLTRANSFORMFEEDBACKVARYINGSPROC_1095cbc2(); - -// PFNGLUNIFORM1FPROC_59f5a391 is a proxy for callback PFNGLUNIFORM1FPROC. -void PFNGLUNIFORM1FPROC_59f5a391(); - -// PFNGLUNIFORM1FVPROC_51063184 is a proxy for callback PFNGLUNIFORM1FVPROC. -void PFNGLUNIFORM1FVPROC_51063184(); - -// PFNGLUNIFORM1IPROC_9956b5f5 is a proxy for callback PFNGLUNIFORM1IPROC. -void PFNGLUNIFORM1IPROC_9956b5f5(); - -// PFNGLUNIFORM1IVPROC_e056147c is a proxy for callback PFNGLUNIFORM1IVPROC. -void PFNGLUNIFORM1IVPROC_e056147c(); - -// PFNGLUNIFORM1UIPROC_81070bcb is a proxy for callback PFNGLUNIFORM1UIPROC. -void PFNGLUNIFORM1UIPROC_81070bcb(); - -// PFNGLUNIFORM1UIVPROC_9eebd3ec is a proxy for callback PFNGLUNIFORM1UIVPROC. -void PFNGLUNIFORM1UIVPROC_9eebd3ec(); - -// PFNGLUNIFORM2FPROC_4a2bebbf is a proxy for callback PFNGLUNIFORM2FPROC. -void PFNGLUNIFORM2FPROC_4a2bebbf(); - -// PFNGLUNIFORM2FVPROC_791c53e7 is a proxy for callback PFNGLUNIFORM2FVPROC. -void PFNGLUNIFORM2FVPROC_791c53e7(); - -// PFNGLUNIFORM2IPROC_b9a237a7 is a proxy for callback PFNGLUNIFORM2IPROC. -void PFNGLUNIFORM2IPROC_b9a237a7(); - -// PFNGLUNIFORM2IVPROC_88812862 is a proxy for callback PFNGLUNIFORM2IVPROC. -void PFNGLUNIFORM2IVPROC_88812862(); - -// PFNGLUNIFORM2UIPROC_fbbdbaea is a proxy for callback PFNGLUNIFORM2UIPROC. -void PFNGLUNIFORM2UIPROC_fbbdbaea(); - -// PFNGLUNIFORM2UIVPROC_acd33cba is a proxy for callback PFNGLUNIFORM2UIVPROC. -void PFNGLUNIFORM2UIVPROC_acd33cba(); - -// PFNGLUNIFORM3FPROC_bef7aa61 is a proxy for callback PFNGLUNIFORM3FPROC. -void PFNGLUNIFORM3FPROC_bef7aa61(); - -// PFNGLUNIFORM3FVPROC_93b9acfb is a proxy for callback PFNGLUNIFORM3FVPROC. -void PFNGLUNIFORM3FVPROC_93b9acfb(); - -// PFNGLUNIFORM3IPROC_1e304eda is a proxy for callback PFNGLUNIFORM3IPROC. -void PFNGLUNIFORM3IPROC_1e304eda(); - -// PFNGLUNIFORM3IVPROC_e98100d4 is a proxy for callback PFNGLUNIFORM3IVPROC. -void PFNGLUNIFORM3IVPROC_e98100d4(); - -// PFNGLUNIFORM3UIPROC_bdc65300 is a proxy for callback PFNGLUNIFORM3UIPROC. -void PFNGLUNIFORM3UIPROC_bdc65300(); - -// PFNGLUNIFORM3UIVPROC_206d6b43 is a proxy for callback PFNGLUNIFORM3UIVPROC. -void PFNGLUNIFORM3UIVPROC_206d6b43(); - -// PFNGLUNIFORM4FPROC_b064ba73 is a proxy for callback PFNGLUNIFORM4FPROC. -void PFNGLUNIFORM4FPROC_b064ba73(); - -// PFNGLUNIFORM4FVPROC_a45ea02f is a proxy for callback PFNGLUNIFORM4FVPROC. -void PFNGLUNIFORM4FVPROC_a45ea02f(); - -// PFNGLUNIFORM4IPROC_0ef851c5 is a proxy for callback PFNGLUNIFORM4IPROC. -void PFNGLUNIFORM4IPROC_0ef851c5(); - -// PFNGLUNIFORM4IVPROC_af39c73d is a proxy for callback PFNGLUNIFORM4IVPROC. -void PFNGLUNIFORM4IVPROC_af39c73d(); - -// PFNGLUNIFORM4UIPROC_b5f68357 is a proxy for callback PFNGLUNIFORM4UIPROC. -void PFNGLUNIFORM4UIPROC_b5f68357(); - -// PFNGLUNIFORM4UIVPROC_f6962598 is a proxy for callback PFNGLUNIFORM4UIVPROC. -void PFNGLUNIFORM4UIVPROC_f6962598(); - -// PFNGLUNIFORMBLOCKBINDINGPROC_7ae350b0 is a proxy for callback PFNGLUNIFORMBLOCKBINDINGPROC. -void PFNGLUNIFORMBLOCKBINDINGPROC_7ae350b0(); - -// PFNGLUNIFORMMATRIX2FVPROC_65c33403 is a proxy for callback PFNGLUNIFORMMATRIX2FVPROC. -void PFNGLUNIFORMMATRIX2FVPROC_65c33403(); - -// PFNGLUNIFORMMATRIX2X3FVPROC_e42ba878 is a proxy for callback PFNGLUNIFORMMATRIX2X3FVPROC. -void PFNGLUNIFORMMATRIX2X3FVPROC_e42ba878(); - -// PFNGLUNIFORMMATRIX2X4FVPROC_0b76e4a2 is a proxy for callback PFNGLUNIFORMMATRIX2X4FVPROC. -void PFNGLUNIFORMMATRIX2X4FVPROC_0b76e4a2(); - -// PFNGLUNIFORMMATRIX3FVPROC_2d08e9c6 is a proxy for callback PFNGLUNIFORMMATRIX3FVPROC. -void PFNGLUNIFORMMATRIX3FVPROC_2d08e9c6(); - -// PFNGLUNIFORMMATRIX3X2FVPROC_a409db19 is a proxy for callback PFNGLUNIFORMMATRIX3X2FVPROC. -void PFNGLUNIFORMMATRIX3X2FVPROC_a409db19(); - -// PFNGLUNIFORMMATRIX3X4FVPROC_97dd1a67 is a proxy for callback PFNGLUNIFORMMATRIX3X4FVPROC. -void PFNGLUNIFORMMATRIX3X4FVPROC_97dd1a67(); - -// PFNGLUNIFORMMATRIX4FVPROC_9b24359d is a proxy for callback PFNGLUNIFORMMATRIX4FVPROC. -void PFNGLUNIFORMMATRIX4FVPROC_9b24359d(); - -// PFNGLUNIFORMMATRIX4X2FVPROC_bf8c50e9 is a proxy for callback PFNGLUNIFORMMATRIX4X2FVPROC. -void PFNGLUNIFORMMATRIX4X2FVPROC_bf8c50e9(); - -// PFNGLUNIFORMMATRIX4X3FVPROC_dd54cd1f is a proxy for callback PFNGLUNIFORMMATRIX4X3FVPROC. -void PFNGLUNIFORMMATRIX4X3FVPROC_dd54cd1f(); - -// PFNGLUNMAPBUFFERPROC_cdda11f6 is a proxy for callback PFNGLUNMAPBUFFERPROC. -void PFNGLUNMAPBUFFERPROC_cdda11f6(); - -// PFNGLUSEPROGRAMPROC_ca4e8162 is a proxy for callback PFNGLUSEPROGRAMPROC. -void PFNGLUSEPROGRAMPROC_ca4e8162(); - -// PFNGLVALIDATEPROGRAMPROC_d5a5ec0a is a proxy for callback PFNGLVALIDATEPROGRAMPROC. -void PFNGLVALIDATEPROGRAMPROC_d5a5ec0a(); - -// PFNGLVERTEXATTRIB1FPROC_a73ce5b3 is a proxy for callback PFNGLVERTEXATTRIB1FPROC. -void PFNGLVERTEXATTRIB1FPROC_a73ce5b3(); - -// PFNGLVERTEXATTRIB1FVPROC_79cc789c is a proxy for callback PFNGLVERTEXATTRIB1FVPROC. -void PFNGLVERTEXATTRIB1FVPROC_79cc789c(); - -// PFNGLVERTEXATTRIB2FPROC_1bd2201b is a proxy for callback PFNGLVERTEXATTRIB2FPROC. -void PFNGLVERTEXATTRIB2FPROC_1bd2201b(); - -// PFNGLVERTEXATTRIB2FVPROC_c7d14a1a is a proxy for callback PFNGLVERTEXATTRIB2FVPROC. -void PFNGLVERTEXATTRIB2FVPROC_c7d14a1a(); - -// PFNGLVERTEXATTRIB3FPROC_422f4c14 is a proxy for callback PFNGLVERTEXATTRIB3FPROC. -void PFNGLVERTEXATTRIB3FPROC_422f4c14(); - -// PFNGLVERTEXATTRIB3FVPROC_b47b0707 is a proxy for callback PFNGLVERTEXATTRIB3FVPROC. -void PFNGLVERTEXATTRIB3FVPROC_b47b0707(); - -// PFNGLVERTEXATTRIB4FPROC_be466156 is a proxy for callback PFNGLVERTEXATTRIB4FPROC. -void PFNGLVERTEXATTRIB4FPROC_be466156(); - -// PFNGLVERTEXATTRIB4FVPROC_0049c127 is a proxy for callback PFNGLVERTEXATTRIB4FVPROC. -void PFNGLVERTEXATTRIB4FVPROC_0049c127(); - -// PFNGLVERTEXATTRIBDIVISORPROC_be125e6e is a proxy for callback PFNGLVERTEXATTRIBDIVISORPROC. -void PFNGLVERTEXATTRIBDIVISORPROC_be125e6e(); - -// PFNGLVERTEXATTRIBI4IPROC_c76eb9a3 is a proxy for callback PFNGLVERTEXATTRIBI4IPROC. -void PFNGLVERTEXATTRIBI4IPROC_c76eb9a3(); - -// PFNGLVERTEXATTRIBI4IVPROC_568d8487 is a proxy for callback PFNGLVERTEXATTRIBI4IVPROC. -void PFNGLVERTEXATTRIBI4IVPROC_568d8487(); - -// PFNGLVERTEXATTRIBI4UIPROC_6821c9de is a proxy for callback PFNGLVERTEXATTRIBI4UIPROC. -void PFNGLVERTEXATTRIBI4UIPROC_6821c9de(); - -// PFNGLVERTEXATTRIBI4UIVPROC_88245792 is a proxy for callback PFNGLVERTEXATTRIBI4UIVPROC. -void PFNGLVERTEXATTRIBI4UIVPROC_88245792(); - -// PFNGLVERTEXATTRIBIPOINTERPROC_48e37dfc is a proxy for callback PFNGLVERTEXATTRIBIPOINTERPROC. -void PFNGLVERTEXATTRIBIPOINTERPROC_48e37dfc(); - -// PFNGLVERTEXATTRIBPOINTERPROC_f18d3b5e is a proxy for callback PFNGLVERTEXATTRIBPOINTERPROC. -void PFNGLVERTEXATTRIBPOINTERPROC_f18d3b5e(); - -// PFNGLVIEWPORTPROC_bc565588 is a proxy for callback PFNGLVIEWPORTPROC. -void PFNGLVIEWPORTPROC_bc565588(); - -// PFNGLWAITSYNCPROC_c9b9a615 is a proxy for callback PFNGLWAITSYNCPROC. -void PFNGLWAITSYNCPROC_c9b9a615(); - diff --git a/capi/gles3/const.go b/capi/gles3/const.go deleted file mode 100644 index 1e8358b..0000000 --- a/capi/gles3/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package gles3 diff --git a/capi/gles3/doc.go b/capi/gles3/doc.go deleted file mode 100644 index b9bc727..0000000 --- a/capi/gles3/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for OpenGL ES 3.0 -*/ -package gles3 diff --git a/capi/gles3/gles3.go b/capi/gles3/gles3.go deleted file mode 100644 index 262a7cb..0000000 --- a/capi/gles3/gles3.go +++ /dev/null @@ -1,2586 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package gles3 - -/* -#cgo LDFLAGS: -lGLESv3 -#include "GLES3/gl3.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func GlActiveTexture(texture GLenum) { - ctexture, ctextureAllocMap := (C.GLenum)(texture), cgoAllocsUnknown - C.glActiveTexture(ctexture) - runtime.KeepAlive(ctextureAllocMap) -} - -func GlAttachShader(program GLuint, shader GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - C.glAttachShader(cprogram, cshader) - runtime.KeepAlive(cshaderAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlBeginQuery(target GLenum, id GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cid, cidAllocMap := (C.GLuint)(id), cgoAllocsUnknown - C.glBeginQuery(ctarget, cid) - runtime.KeepAlive(cidAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBeginTransformFeedback(primitiveMode GLenum) { - cprimitiveMode, cprimitiveModeAllocMap := (C.GLenum)(primitiveMode), cgoAllocsUnknown - C.glBeginTransformFeedback(cprimitiveMode) - runtime.KeepAlive(cprimitiveModeAllocMap) -} - -func GlBindAttribLocation(program GLuint, index GLuint, name *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - C.glBindAttribLocation(cprogram, cindex, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlBindBuffer(target GLenum, buffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (C.GLuint)(buffer), cgoAllocsUnknown - C.glBindBuffer(ctarget, cbuffer) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindBufferBase(target GLenum, index GLuint, buffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (C.GLuint)(buffer), cgoAllocsUnknown - C.glBindBufferBase(ctarget, cindex, cbuffer) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindBufferRange(target GLenum, index GLuint, buffer GLuint, offset GLintptr, size GLsizeiptr) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (C.GLuint)(buffer), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.GLintptr)(offset), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLsizeiptr)(size), cgoAllocsUnknown - C.glBindBufferRange(ctarget, cindex, cbuffer, coffset, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindFramebuffer(target GLenum, framebuffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cframebuffer, cframebufferAllocMap := (C.GLuint)(framebuffer), cgoAllocsUnknown - C.glBindFramebuffer(ctarget, cframebuffer) - runtime.KeepAlive(cframebufferAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindRenderbuffer(target GLenum, renderbuffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - crenderbuffer, crenderbufferAllocMap := (C.GLuint)(renderbuffer), cgoAllocsUnknown - C.glBindRenderbuffer(ctarget, crenderbuffer) - runtime.KeepAlive(crenderbufferAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindSampler(unit GLuint, sampler GLuint) { - cunit, cunitAllocMap := (C.GLuint)(unit), cgoAllocsUnknown - csampler, csamplerAllocMap := (C.GLuint)(sampler), cgoAllocsUnknown - C.glBindSampler(cunit, csampler) - runtime.KeepAlive(csamplerAllocMap) - runtime.KeepAlive(cunitAllocMap) -} - -func GlBindTexture(target GLenum, texture GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - ctexture, ctextureAllocMap := (C.GLuint)(texture), cgoAllocsUnknown - C.glBindTexture(ctarget, ctexture) - runtime.KeepAlive(ctextureAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindTransformFeedback(target GLenum, id GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cid, cidAllocMap := (C.GLuint)(id), cgoAllocsUnknown - C.glBindTransformFeedback(ctarget, cid) - runtime.KeepAlive(cidAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBindVertexArray(array GLuint) { - carray, carrayAllocMap := (C.GLuint)(array), cgoAllocsUnknown - C.glBindVertexArray(carray) - runtime.KeepAlive(carrayAllocMap) -} - -func GlBlendColor(red GLfloat, green GLfloat, blue GLfloat, alpha GLfloat) { - cred, credAllocMap := (C.GLfloat)(red), cgoAllocsUnknown - cgreen, cgreenAllocMap := (C.GLfloat)(green), cgoAllocsUnknown - cblue, cblueAllocMap := (C.GLfloat)(blue), cgoAllocsUnknown - calpha, calphaAllocMap := (C.GLfloat)(alpha), cgoAllocsUnknown - C.glBlendColor(cred, cgreen, cblue, calpha) - runtime.KeepAlive(calphaAllocMap) - runtime.KeepAlive(cblueAllocMap) - runtime.KeepAlive(cgreenAllocMap) - runtime.KeepAlive(credAllocMap) -} - -func GlBlendEquation(mode GLenum) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - C.glBlendEquation(cmode) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlBlendEquationSeparate(modeRGB GLenum, modeAlpha GLenum) { - cmodeRGB, cmodeRGBAllocMap := (C.GLenum)(modeRGB), cgoAllocsUnknown - cmodeAlpha, cmodeAlphaAllocMap := (C.GLenum)(modeAlpha), cgoAllocsUnknown - C.glBlendEquationSeparate(cmodeRGB, cmodeAlpha) - runtime.KeepAlive(cmodeAlphaAllocMap) - runtime.KeepAlive(cmodeRGBAllocMap) -} - -func GlBlendFunc(sfactor GLenum, dfactor GLenum) { - csfactor, csfactorAllocMap := (C.GLenum)(sfactor), cgoAllocsUnknown - cdfactor, cdfactorAllocMap := (C.GLenum)(dfactor), cgoAllocsUnknown - C.glBlendFunc(csfactor, cdfactor) - runtime.KeepAlive(cdfactorAllocMap) - runtime.KeepAlive(csfactorAllocMap) -} - -func GlBlendFuncSeparate(sfactorRGB GLenum, dfactorRGB GLenum, sfactorAlpha GLenum, dfactorAlpha GLenum) { - csfactorRGB, csfactorRGBAllocMap := (C.GLenum)(sfactorRGB), cgoAllocsUnknown - cdfactorRGB, cdfactorRGBAllocMap := (C.GLenum)(dfactorRGB), cgoAllocsUnknown - csfactorAlpha, csfactorAlphaAllocMap := (C.GLenum)(sfactorAlpha), cgoAllocsUnknown - cdfactorAlpha, cdfactorAlphaAllocMap := (C.GLenum)(dfactorAlpha), cgoAllocsUnknown - C.glBlendFuncSeparate(csfactorRGB, cdfactorRGB, csfactorAlpha, cdfactorAlpha) - runtime.KeepAlive(cdfactorAlphaAllocMap) - runtime.KeepAlive(csfactorAlphaAllocMap) - runtime.KeepAlive(cdfactorRGBAllocMap) - runtime.KeepAlive(csfactorRGBAllocMap) -} - -func GlBlitFramebuffer(srcX0 GLint, srcY0 GLint, srcX1 GLint, srcY1 GLint, dstX0 GLint, dstY0 GLint, dstX1 GLint, dstY1 GLint, mask GLbitfield, filter GLenum) { - csrcX0, csrcX0AllocMap := (C.GLint)(srcX0), cgoAllocsUnknown - csrcY0, csrcY0AllocMap := (C.GLint)(srcY0), cgoAllocsUnknown - csrcX1, csrcX1AllocMap := (C.GLint)(srcX1), cgoAllocsUnknown - csrcY1, csrcY1AllocMap := (C.GLint)(srcY1), cgoAllocsUnknown - cdstX0, cdstX0AllocMap := (C.GLint)(dstX0), cgoAllocsUnknown - cdstY0, cdstY0AllocMap := (C.GLint)(dstY0), cgoAllocsUnknown - cdstX1, cdstX1AllocMap := (C.GLint)(dstX1), cgoAllocsUnknown - cdstY1, cdstY1AllocMap := (C.GLint)(dstY1), cgoAllocsUnknown - cmask, cmaskAllocMap := (C.GLbitfield)(mask), cgoAllocsUnknown - cfilter, cfilterAllocMap := (C.GLenum)(filter), cgoAllocsUnknown - C.glBlitFramebuffer(csrcX0, csrcY0, csrcX1, csrcY1, cdstX0, cdstY0, cdstX1, cdstY1, cmask, cfilter) - runtime.KeepAlive(cfilterAllocMap) - runtime.KeepAlive(cmaskAllocMap) - runtime.KeepAlive(cdstY1AllocMap) - runtime.KeepAlive(cdstX1AllocMap) - runtime.KeepAlive(cdstY0AllocMap) - runtime.KeepAlive(cdstX0AllocMap) - runtime.KeepAlive(csrcY1AllocMap) - runtime.KeepAlive(csrcX1AllocMap) - runtime.KeepAlive(csrcY0AllocMap) - runtime.KeepAlive(csrcX0AllocMap) -} - -func GlBufferData(target GLenum, size GLsizeiptr, data unsafe.Pointer, usage GLenum) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLsizeiptr)(size), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - cusage, cusageAllocMap := (C.GLenum)(usage), cgoAllocsUnknown - C.glBufferData(ctarget, csize, cdata, cusage) - runtime.KeepAlive(cusageAllocMap) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlBufferSubData(target GLenum, offset GLintptr, size GLsizeiptr, data unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.GLintptr)(offset), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLsizeiptr)(size), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.glBufferSubData(ctarget, coffset, csize, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCheckFramebufferStatus(target GLenum) GLenum { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - __ret := C.glCheckFramebufferStatus(ctarget) - runtime.KeepAlive(ctargetAllocMap) - __v := (GLenum)(__ret) - return __v -} - -func GlClear(mask GLbitfield) { - cmask, cmaskAllocMap := (C.GLbitfield)(mask), cgoAllocsUnknown - C.glClear(cmask) - runtime.KeepAlive(cmaskAllocMap) -} - -func GlClearBufferfi(buffer GLenum, drawbuffer GLint, depth GLfloat, stencil GLint) { - cbuffer, cbufferAllocMap := (C.GLenum)(buffer), cgoAllocsUnknown - cdrawbuffer, cdrawbufferAllocMap := (C.GLint)(drawbuffer), cgoAllocsUnknown - cdepth, cdepthAllocMap := (C.GLfloat)(depth), cgoAllocsUnknown - cstencil, cstencilAllocMap := (C.GLint)(stencil), cgoAllocsUnknown - C.glClearBufferfi(cbuffer, cdrawbuffer, cdepth, cstencil) - runtime.KeepAlive(cstencilAllocMap) - runtime.KeepAlive(cdepthAllocMap) - runtime.KeepAlive(cdrawbufferAllocMap) - runtime.KeepAlive(cbufferAllocMap) -} - -func GlClearBufferfv(buffer GLenum, drawbuffer GLint, value *GLfloat) { - cbuffer, cbufferAllocMap := (C.GLenum)(buffer), cgoAllocsUnknown - cdrawbuffer, cdrawbufferAllocMap := (C.GLint)(drawbuffer), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glClearBufferfv(cbuffer, cdrawbuffer, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cdrawbufferAllocMap) - runtime.KeepAlive(cbufferAllocMap) -} - -func GlClearBufferiv(buffer GLenum, drawbuffer GLint, value *GLint) { - cbuffer, cbufferAllocMap := (C.GLenum)(buffer), cgoAllocsUnknown - cdrawbuffer, cdrawbufferAllocMap := (C.GLint)(drawbuffer), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glClearBufferiv(cbuffer, cdrawbuffer, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cdrawbufferAllocMap) - runtime.KeepAlive(cbufferAllocMap) -} - -func GlClearBufferuiv(buffer GLenum, drawbuffer GLint, value *GLuint) { - cbuffer, cbufferAllocMap := (C.GLenum)(buffer), cgoAllocsUnknown - cdrawbuffer, cdrawbufferAllocMap := (C.GLint)(drawbuffer), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLuint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glClearBufferuiv(cbuffer, cdrawbuffer, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cdrawbufferAllocMap) - runtime.KeepAlive(cbufferAllocMap) -} - -func GlClearColor(red GLfloat, green GLfloat, blue GLfloat, alpha GLfloat) { - cred, credAllocMap := (C.GLfloat)(red), cgoAllocsUnknown - cgreen, cgreenAllocMap := (C.GLfloat)(green), cgoAllocsUnknown - cblue, cblueAllocMap := (C.GLfloat)(blue), cgoAllocsUnknown - calpha, calphaAllocMap := (C.GLfloat)(alpha), cgoAllocsUnknown - C.glClearColor(cred, cgreen, cblue, calpha) - runtime.KeepAlive(calphaAllocMap) - runtime.KeepAlive(cblueAllocMap) - runtime.KeepAlive(cgreenAllocMap) - runtime.KeepAlive(credAllocMap) -} - -func GlClearDepthf(d GLfloat) { - cd, cdAllocMap := (C.GLfloat)(d), cgoAllocsUnknown - C.glClearDepthf(cd) - runtime.KeepAlive(cdAllocMap) -} - -func GlClearStencil(s GLint) { - cs, csAllocMap := (C.GLint)(s), cgoAllocsUnknown - C.glClearStencil(cs) - runtime.KeepAlive(csAllocMap) -} - -func GlClientWaitSync(sync GLsync, flags GLbitfield, timeout GLuint64) GLenum { - csync, csyncAllocMap := (C.GLsync)(sync), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.GLbitfield)(flags), cgoAllocsUnknown - ctimeout, ctimeoutAllocMap := (C.GLuint64)(timeout), cgoAllocsUnknown - __ret := C.glClientWaitSync(csync, cflags, ctimeout) - runtime.KeepAlive(ctimeoutAllocMap) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(csyncAllocMap) - __v := (GLenum)(__ret) - return __v -} - -func GlColorMask(red GLboolean, green GLboolean, blue GLboolean, alpha GLboolean) { - cred, credAllocMap := (C.GLboolean)(red), cgoAllocsUnknown - cgreen, cgreenAllocMap := (C.GLboolean)(green), cgoAllocsUnknown - cblue, cblueAllocMap := (C.GLboolean)(blue), cgoAllocsUnknown - calpha, calphaAllocMap := (C.GLboolean)(alpha), cgoAllocsUnknown - C.glColorMask(cred, cgreen, cblue, calpha) - runtime.KeepAlive(calphaAllocMap) - runtime.KeepAlive(cblueAllocMap) - runtime.KeepAlive(cgreenAllocMap) - runtime.KeepAlive(credAllocMap) -} - -func GlCompileShader(shader GLuint) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - C.glCompileShader(cshader) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlCompressedTexImage2D(target GLenum, level GLint, internalformat GLenum, width GLsizei, height GLsizei, border GLint, imageSize GLsizei, data unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cborder, cborderAllocMap := (C.GLint)(border), cgoAllocsUnknown - cimageSize, cimageSizeAllocMap := (C.GLsizei)(imageSize), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.glCompressedTexImage2D(ctarget, clevel, cinternalformat, cwidth, cheight, cborder, cimageSize, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cimageSizeAllocMap) - runtime.KeepAlive(cborderAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCompressedTexImage3D(target GLenum, level GLint, internalformat GLenum, width GLsizei, height GLsizei, depth GLsizei, border GLint, imageSize GLsizei, data unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cdepth, cdepthAllocMap := (C.GLsizei)(depth), cgoAllocsUnknown - cborder, cborderAllocMap := (C.GLint)(border), cgoAllocsUnknown - cimageSize, cimageSizeAllocMap := (C.GLsizei)(imageSize), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.glCompressedTexImage3D(ctarget, clevel, cinternalformat, cwidth, cheight, cdepth, cborder, cimageSize, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cimageSizeAllocMap) - runtime.KeepAlive(cborderAllocMap) - runtime.KeepAlive(cdepthAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCompressedTexSubImage2D(target GLenum, level GLint, xoffset GLint, yoffset GLint, width GLsizei, height GLsizei, format GLenum, imageSize GLsizei, data unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - cimageSize, cimageSizeAllocMap := (C.GLsizei)(imageSize), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.glCompressedTexSubImage2D(ctarget, clevel, cxoffset, cyoffset, cwidth, cheight, cformat, cimageSize, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cimageSizeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCompressedTexSubImage3D(target GLenum, level GLint, xoffset GLint, yoffset GLint, zoffset GLint, width GLsizei, height GLsizei, depth GLsizei, format GLenum, imageSize GLsizei, data unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - czoffset, czoffsetAllocMap := (C.GLint)(zoffset), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cdepth, cdepthAllocMap := (C.GLsizei)(depth), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - cimageSize, cimageSizeAllocMap := (C.GLsizei)(imageSize), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.glCompressedTexSubImage3D(ctarget, clevel, cxoffset, cyoffset, czoffset, cwidth, cheight, cdepth, cformat, cimageSize, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cimageSizeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cdepthAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(czoffsetAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCopyBufferSubData(readTarget GLenum, writeTarget GLenum, readOffset GLintptr, writeOffset GLintptr, size GLsizeiptr) { - creadTarget, creadTargetAllocMap := (C.GLenum)(readTarget), cgoAllocsUnknown - cwriteTarget, cwriteTargetAllocMap := (C.GLenum)(writeTarget), cgoAllocsUnknown - creadOffset, creadOffsetAllocMap := (C.GLintptr)(readOffset), cgoAllocsUnknown - cwriteOffset, cwriteOffsetAllocMap := (C.GLintptr)(writeOffset), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLsizeiptr)(size), cgoAllocsUnknown - C.glCopyBufferSubData(creadTarget, cwriteTarget, creadOffset, cwriteOffset, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cwriteOffsetAllocMap) - runtime.KeepAlive(creadOffsetAllocMap) - runtime.KeepAlive(cwriteTargetAllocMap) - runtime.KeepAlive(creadTargetAllocMap) -} - -func GlCopyTexImage2D(target GLenum, level GLint, internalformat GLenum, x GLint, y GLint, width GLsizei, height GLsizei, border GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cborder, cborderAllocMap := (C.GLint)(border), cgoAllocsUnknown - C.glCopyTexImage2D(ctarget, clevel, cinternalformat, cx, cy, cwidth, cheight, cborder) - runtime.KeepAlive(cborderAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCopyTexSubImage2D(target GLenum, level GLint, xoffset GLint, yoffset GLint, x GLint, y GLint, width GLsizei, height GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glCopyTexSubImage2D(ctarget, clevel, cxoffset, cyoffset, cx, cy, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCopyTexSubImage3D(target GLenum, level GLint, xoffset GLint, yoffset GLint, zoffset GLint, x GLint, y GLint, width GLsizei, height GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - czoffset, czoffsetAllocMap := (C.GLint)(zoffset), cgoAllocsUnknown - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glCopyTexSubImage3D(ctarget, clevel, cxoffset, cyoffset, czoffset, cx, cy, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(czoffsetAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlCreateProgram() GLuint { - __ret := C.glCreateProgram() - __v := (GLuint)(__ret) - return __v -} - -func GlCreateShader(_type GLenum) GLuint { - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - __ret := C.glCreateShader(c_type) - runtime.KeepAlive(c_typeAllocMap) - __v := (GLuint)(__ret) - return __v -} - -func GlCullFace(mode GLenum) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - C.glCullFace(cmode) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlDeleteBuffers(n GLsizei, buffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cbuffers, cbuffersAllocMap := (*C.GLuint)(unsafe.Pointer(buffers)), cgoAllocsUnknown - C.glDeleteBuffers(cn, cbuffers) - runtime.KeepAlive(cbuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteFramebuffers(n GLsizei, framebuffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cframebuffers, cframebuffersAllocMap := (*C.GLuint)(unsafe.Pointer(framebuffers)), cgoAllocsUnknown - C.glDeleteFramebuffers(cn, cframebuffers) - runtime.KeepAlive(cframebuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteProgram(program GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - C.glDeleteProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlDeleteQueries(n GLsizei, ids *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cids, cidsAllocMap := (*C.GLuint)(unsafe.Pointer(ids)), cgoAllocsUnknown - C.glDeleteQueries(cn, cids) - runtime.KeepAlive(cidsAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteRenderbuffers(n GLsizei, renderbuffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - crenderbuffers, crenderbuffersAllocMap := (*C.GLuint)(unsafe.Pointer(renderbuffers)), cgoAllocsUnknown - C.glDeleteRenderbuffers(cn, crenderbuffers) - runtime.KeepAlive(crenderbuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteSamplers(count GLsizei, samplers *GLuint) { - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - csamplers, csamplersAllocMap := (*C.GLuint)(unsafe.Pointer(samplers)), cgoAllocsUnknown - C.glDeleteSamplers(ccount, csamplers) - runtime.KeepAlive(csamplersAllocMap) - runtime.KeepAlive(ccountAllocMap) -} - -func GlDeleteShader(shader GLuint) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - C.glDeleteShader(cshader) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlDeleteSync(sync GLsync) { - csync, csyncAllocMap := (C.GLsync)(sync), cgoAllocsUnknown - C.glDeleteSync(csync) - runtime.KeepAlive(csyncAllocMap) -} - -func GlDeleteTextures(n GLsizei, textures *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - ctextures, ctexturesAllocMap := (*C.GLuint)(unsafe.Pointer(textures)), cgoAllocsUnknown - C.glDeleteTextures(cn, ctextures) - runtime.KeepAlive(ctexturesAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteTransformFeedbacks(n GLsizei, ids *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cids, cidsAllocMap := (*C.GLuint)(unsafe.Pointer(ids)), cgoAllocsUnknown - C.glDeleteTransformFeedbacks(cn, cids) - runtime.KeepAlive(cidsAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDeleteVertexArrays(n GLsizei, arrays *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - carrays, carraysAllocMap := (*C.GLuint)(unsafe.Pointer(arrays)), cgoAllocsUnknown - C.glDeleteVertexArrays(cn, carrays) - runtime.KeepAlive(carraysAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDepthFunc(_func GLenum) { - c_func, c_funcAllocMap := (C.GLenum)(_func), cgoAllocsUnknown - C.glDepthFunc(c_func) - runtime.KeepAlive(c_funcAllocMap) -} - -func GlDepthMask(flag GLboolean) { - cflag, cflagAllocMap := (C.GLboolean)(flag), cgoAllocsUnknown - C.glDepthMask(cflag) - runtime.KeepAlive(cflagAllocMap) -} - -func GlDepthRangef(n GLfloat, f GLfloat) { - cn, cnAllocMap := (C.GLfloat)(n), cgoAllocsUnknown - cf, cfAllocMap := (C.GLfloat)(f), cgoAllocsUnknown - C.glDepthRangef(cn, cf) - runtime.KeepAlive(cfAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDetachShader(program GLuint, shader GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - C.glDetachShader(cprogram, cshader) - runtime.KeepAlive(cshaderAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlDisable(cap GLenum) { - ccap, ccapAllocMap := (C.GLenum)(cap), cgoAllocsUnknown - C.glDisable(ccap) - runtime.KeepAlive(ccapAllocMap) -} - -func GlDisableVertexAttribArray(index GLuint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - C.glDisableVertexAttribArray(cindex) - runtime.KeepAlive(cindexAllocMap) -} - -func GlDrawArrays(mode GLenum, first GLint, count GLsizei) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - cfirst, cfirstAllocMap := (C.GLint)(first), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - C.glDrawArrays(cmode, cfirst, ccount) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cfirstAllocMap) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlDrawArraysInstanced(mode GLenum, first GLint, count GLsizei, instancecount GLsizei) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - cfirst, cfirstAllocMap := (C.GLint)(first), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cinstancecount, cinstancecountAllocMap := (C.GLsizei)(instancecount), cgoAllocsUnknown - C.glDrawArraysInstanced(cmode, cfirst, ccount, cinstancecount) - runtime.KeepAlive(cinstancecountAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cfirstAllocMap) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlDrawBuffers(n GLsizei, bufs *GLenum) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cbufs, cbufsAllocMap := (*C.GLenum)(unsafe.Pointer(bufs)), cgoAllocsUnknown - C.glDrawBuffers(cn, cbufs) - runtime.KeepAlive(cbufsAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlDrawElements(mode GLenum, count GLsizei, _type GLenum, indices unsafe.Pointer) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cindices, cindicesAllocMap := indices, cgoAllocsUnknown - C.glDrawElements(cmode, ccount, c_type, cindices) - runtime.KeepAlive(cindicesAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlDrawElementsInstanced(mode GLenum, count GLsizei, _type GLenum, indices unsafe.Pointer, instancecount GLsizei) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cindices, cindicesAllocMap := indices, cgoAllocsUnknown - cinstancecount, cinstancecountAllocMap := (C.GLsizei)(instancecount), cgoAllocsUnknown - C.glDrawElementsInstanced(cmode, ccount, c_type, cindices, cinstancecount) - runtime.KeepAlive(cinstancecountAllocMap) - runtime.KeepAlive(cindicesAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlDrawRangeElements(mode GLenum, start GLuint, end GLuint, count GLsizei, _type GLenum, indices unsafe.Pointer) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - cstart, cstartAllocMap := (C.GLuint)(start), cgoAllocsUnknown - cend, cendAllocMap := (C.GLuint)(end), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cindices, cindicesAllocMap := indices, cgoAllocsUnknown - C.glDrawRangeElements(cmode, cstart, cend, ccount, c_type, cindices) - runtime.KeepAlive(cindicesAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cendAllocMap) - runtime.KeepAlive(cstartAllocMap) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlEnable(cap GLenum) { - ccap, ccapAllocMap := (C.GLenum)(cap), cgoAllocsUnknown - C.glEnable(ccap) - runtime.KeepAlive(ccapAllocMap) -} - -func GlEnableVertexAttribArray(index GLuint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - C.glEnableVertexAttribArray(cindex) - runtime.KeepAlive(cindexAllocMap) -} - -func GlEndQuery(target GLenum) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - C.glEndQuery(ctarget) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlEndTransformFeedback() { - C.glEndTransformFeedback() -} - -func GlFenceSync(condition GLenum, flags GLbitfield) GLsync { - ccondition, cconditionAllocMap := (C.GLenum)(condition), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.GLbitfield)(flags), cgoAllocsUnknown - __ret := C.glFenceSync(ccondition, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(cconditionAllocMap) - __v := (GLsync)(__ret) - return __v -} - -func GlFinish() { - C.glFinish() -} - -func GlFlush() { - C.glFlush() -} - -func GlFlushMappedBufferRange(target GLenum, offset GLintptr, length GLsizeiptr) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.GLintptr)(offset), cgoAllocsUnknown - clength, clengthAllocMap := (C.GLsizeiptr)(length), cgoAllocsUnknown - C.glFlushMappedBufferRange(ctarget, coffset, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlFramebufferRenderbuffer(target GLenum, attachment GLenum, renderbuffertarget GLenum, renderbuffer GLuint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cattachment, cattachmentAllocMap := (C.GLenum)(attachment), cgoAllocsUnknown - crenderbuffertarget, crenderbuffertargetAllocMap := (C.GLenum)(renderbuffertarget), cgoAllocsUnknown - crenderbuffer, crenderbufferAllocMap := (C.GLuint)(renderbuffer), cgoAllocsUnknown - C.glFramebufferRenderbuffer(ctarget, cattachment, crenderbuffertarget, crenderbuffer) - runtime.KeepAlive(crenderbufferAllocMap) - runtime.KeepAlive(crenderbuffertargetAllocMap) - runtime.KeepAlive(cattachmentAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlFramebufferTexture2D(target GLenum, attachment GLenum, textarget GLenum, texture GLuint, level GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cattachment, cattachmentAllocMap := (C.GLenum)(attachment), cgoAllocsUnknown - ctextarget, ctextargetAllocMap := (C.GLenum)(textarget), cgoAllocsUnknown - ctexture, ctextureAllocMap := (C.GLuint)(texture), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - C.glFramebufferTexture2D(ctarget, cattachment, ctextarget, ctexture, clevel) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctextureAllocMap) - runtime.KeepAlive(ctextargetAllocMap) - runtime.KeepAlive(cattachmentAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlFramebufferTextureLayer(target GLenum, attachment GLenum, texture GLuint, level GLint, layer GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cattachment, cattachmentAllocMap := (C.GLenum)(attachment), cgoAllocsUnknown - ctexture, ctextureAllocMap := (C.GLuint)(texture), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - clayer, clayerAllocMap := (C.GLint)(layer), cgoAllocsUnknown - C.glFramebufferTextureLayer(ctarget, cattachment, ctexture, clevel, clayer) - runtime.KeepAlive(clayerAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctextureAllocMap) - runtime.KeepAlive(cattachmentAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlFrontFace(mode GLenum) { - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - C.glFrontFace(cmode) - runtime.KeepAlive(cmodeAllocMap) -} - -func GlGenBuffers(n GLsizei, buffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cbuffers, cbuffersAllocMap := (*C.GLuint)(unsafe.Pointer(buffers)), cgoAllocsUnknown - C.glGenBuffers(cn, cbuffers) - runtime.KeepAlive(cbuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenFramebuffers(n GLsizei, framebuffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cframebuffers, cframebuffersAllocMap := (*C.GLuint)(unsafe.Pointer(framebuffers)), cgoAllocsUnknown - C.glGenFramebuffers(cn, cframebuffers) - runtime.KeepAlive(cframebuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenQueries(n GLsizei, ids *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cids, cidsAllocMap := (*C.GLuint)(unsafe.Pointer(ids)), cgoAllocsUnknown - C.glGenQueries(cn, cids) - runtime.KeepAlive(cidsAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenRenderbuffers(n GLsizei, renderbuffers *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - crenderbuffers, crenderbuffersAllocMap := (*C.GLuint)(unsafe.Pointer(renderbuffers)), cgoAllocsUnknown - C.glGenRenderbuffers(cn, crenderbuffers) - runtime.KeepAlive(crenderbuffersAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenSamplers(count GLsizei, samplers *GLuint) { - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - csamplers, csamplersAllocMap := (*C.GLuint)(unsafe.Pointer(samplers)), cgoAllocsUnknown - C.glGenSamplers(ccount, csamplers) - runtime.KeepAlive(csamplersAllocMap) - runtime.KeepAlive(ccountAllocMap) -} - -func GlGenTextures(n GLsizei, textures *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - ctextures, ctexturesAllocMap := (*C.GLuint)(unsafe.Pointer(textures)), cgoAllocsUnknown - C.glGenTextures(cn, ctextures) - runtime.KeepAlive(ctexturesAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenTransformFeedbacks(n GLsizei, ids *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - cids, cidsAllocMap := (*C.GLuint)(unsafe.Pointer(ids)), cgoAllocsUnknown - C.glGenTransformFeedbacks(cn, cids) - runtime.KeepAlive(cidsAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenVertexArrays(n GLsizei, arrays *GLuint) { - cn, cnAllocMap := (C.GLsizei)(n), cgoAllocsUnknown - carrays, carraysAllocMap := (*C.GLuint)(unsafe.Pointer(arrays)), cgoAllocsUnknown - C.glGenVertexArrays(cn, carrays) - runtime.KeepAlive(carraysAllocMap) - runtime.KeepAlive(cnAllocMap) -} - -func GlGenerateMipmap(target GLenum) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - C.glGenerateMipmap(ctarget) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetActiveAttrib(program GLuint, index GLuint, bufSize GLsizei, length *GLsizei, size *GLint, _type *GLenum, name *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - csize, csizeAllocMap := (*C.GLint)(unsafe.Pointer(size)), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.GLenum)(unsafe.Pointer(_type)), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - C.glGetActiveAttrib(cprogram, cindex, cbufSize, clength, csize, c_type, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetActiveUniform(program GLuint, index GLuint, bufSize GLsizei, length *GLsizei, size *GLint, _type *GLenum, name *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - csize, csizeAllocMap := (*C.GLint)(unsafe.Pointer(size)), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.GLenum)(unsafe.Pointer(_type)), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - C.glGetActiveUniform(cprogram, cindex, cbufSize, clength, csize, c_type, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetActiveUniformBlockName(program GLuint, uniformBlockIndex GLuint, bufSize GLsizei, length *GLsizei, uniformBlockName *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cuniformBlockIndex, cuniformBlockIndexAllocMap := (C.GLuint)(uniformBlockIndex), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - cuniformBlockName, cuniformBlockNameAllocMap := (*C.GLchar)(unsafe.Pointer(uniformBlockName)), cgoAllocsUnknown - C.glGetActiveUniformBlockName(cprogram, cuniformBlockIndex, cbufSize, clength, cuniformBlockName) - runtime.KeepAlive(cuniformBlockNameAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cuniformBlockIndexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetActiveUniformBlockiv(program GLuint, uniformBlockIndex GLuint, pname GLenum, params *GLint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cuniformBlockIndex, cuniformBlockIndexAllocMap := (C.GLuint)(uniformBlockIndex), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetActiveUniformBlockiv(cprogram, cuniformBlockIndex, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cuniformBlockIndexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetActiveUniformsiv(program GLuint, uniformCount GLsizei, uniformIndices *GLuint, pname GLenum, params *GLint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cuniformCount, cuniformCountAllocMap := (C.GLsizei)(uniformCount), cgoAllocsUnknown - cuniformIndices, cuniformIndicesAllocMap := (*C.GLuint)(unsafe.Pointer(uniformIndices)), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetActiveUniformsiv(cprogram, cuniformCount, cuniformIndices, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cuniformIndicesAllocMap) - runtime.KeepAlive(cuniformCountAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetAttachedShaders(program GLuint, maxCount GLsizei, count *GLsizei, shaders *GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cmaxCount, cmaxCountAllocMap := (C.GLsizei)(maxCount), cgoAllocsUnknown - ccount, ccountAllocMap := (*C.GLsizei)(unsafe.Pointer(count)), cgoAllocsUnknown - cshaders, cshadersAllocMap := (*C.GLuint)(unsafe.Pointer(shaders)), cgoAllocsUnknown - C.glGetAttachedShaders(cprogram, cmaxCount, ccount, cshaders) - runtime.KeepAlive(cshadersAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cmaxCountAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetAttribLocation(program GLuint, name *GLchar) GLint { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - __ret := C.glGetAttribLocation(cprogram, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cprogramAllocMap) - __v := (GLint)(__ret) - return __v -} - -func GlGetBooleanv(pname GLenum, data *GLboolean) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLboolean)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetBooleanv(cpname, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlGetBufferParameteri64v(target GLenum, pname GLenum, params *GLint64) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint64)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetBufferParameteri64v(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetBufferParameteriv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetBufferParameteriv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetBufferPointerv(target GLenum, pname GLenum, params *unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := params, cgoAllocsUnknown - C.glGetBufferPointerv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetError() GLenum { - __ret := C.glGetError() - __v := (GLenum)(__ret) - return __v -} - -func GlGetFloatv(pname GLenum, data *GLfloat) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLfloat)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetFloatv(cpname, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlGetFragDataLocation(program GLuint, name *GLchar) GLint { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - __ret := C.glGetFragDataLocation(cprogram, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cprogramAllocMap) - __v := (GLint)(__ret) - return __v -} - -func GlGetFramebufferAttachmentParameteriv(target GLenum, attachment GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cattachment, cattachmentAllocMap := (C.GLenum)(attachment), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetFramebufferAttachmentParameteriv(ctarget, cattachment, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cattachmentAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetInteger64i_v(target GLenum, index GLuint, data *GLint64) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLint64)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetInteger64i_v(ctarget, cindex, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetInteger64v(pname GLenum, data *GLint64) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLint64)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetInteger64v(cpname, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlGetIntegeri_v(target GLenum, index GLuint, data *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLint)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetIntegeri_v(ctarget, cindex, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetIntegerv(pname GLenum, data *GLint) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.GLint)(unsafe.Pointer(data)), cgoAllocsUnknown - C.glGetIntegerv(cpname, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlGetInternalformativ(target GLenum, internalformat GLenum, pname GLenum, bufSize GLsizei, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetInternalformativ(ctarget, cinternalformat, cpname, cbufSize, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetProgramBinary(program GLuint, bufSize GLsizei, length *GLsizei, binaryFormat *GLenum, binary unsafe.Pointer) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - cbinaryFormat, cbinaryFormatAllocMap := (*C.GLenum)(unsafe.Pointer(binaryFormat)), cgoAllocsUnknown - cbinary, cbinaryAllocMap := binary, cgoAllocsUnknown - C.glGetProgramBinary(cprogram, cbufSize, clength, cbinaryFormat, cbinary) - runtime.KeepAlive(cbinaryAllocMap) - runtime.KeepAlive(cbinaryFormatAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetProgramInfoLog(program GLuint, bufSize GLsizei, length *GLsizei, infoLog *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - cinfoLog, cinfoLogAllocMap := (*C.GLchar)(unsafe.Pointer(infoLog)), cgoAllocsUnknown - C.glGetProgramInfoLog(cprogram, cbufSize, clength, cinfoLog) - runtime.KeepAlive(cinfoLogAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetProgramiv(program GLuint, pname GLenum, params *GLint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetProgramiv(cprogram, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetQueryObjectuiv(id GLuint, pname GLenum, params *GLuint) { - cid, cidAllocMap := (C.GLuint)(id), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLuint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetQueryObjectuiv(cid, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cidAllocMap) -} - -func GlGetQueryiv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetQueryiv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetRenderbufferParameteriv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetRenderbufferParameteriv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetSamplerParameterfv(sampler GLuint, pname GLenum, params *GLfloat) { - csampler, csamplerAllocMap := (C.GLuint)(sampler), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetSamplerParameterfv(csampler, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(csamplerAllocMap) -} - -func GlGetSamplerParameteriv(sampler GLuint, pname GLenum, params *GLint) { - csampler, csamplerAllocMap := (C.GLuint)(sampler), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetSamplerParameteriv(csampler, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(csamplerAllocMap) -} - -func GlGetShaderInfoLog(shader GLuint, bufSize GLsizei, length *GLsizei, infoLog *GLchar) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - cinfoLog, cinfoLogAllocMap := (*C.GLchar)(unsafe.Pointer(infoLog)), cgoAllocsUnknown - C.glGetShaderInfoLog(cshader, cbufSize, clength, cinfoLog) - runtime.KeepAlive(cinfoLogAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlGetShaderPrecisionFormat(shadertype GLenum, precisiontype GLenum, _range *GLint, precision *GLint) { - cshadertype, cshadertypeAllocMap := (C.GLenum)(shadertype), cgoAllocsUnknown - cprecisiontype, cprecisiontypeAllocMap := (C.GLenum)(precisiontype), cgoAllocsUnknown - c_range, c_rangeAllocMap := (*C.GLint)(unsafe.Pointer(_range)), cgoAllocsUnknown - cprecision, cprecisionAllocMap := (*C.GLint)(unsafe.Pointer(precision)), cgoAllocsUnknown - C.glGetShaderPrecisionFormat(cshadertype, cprecisiontype, c_range, cprecision) - runtime.KeepAlive(cprecisionAllocMap) - runtime.KeepAlive(c_rangeAllocMap) - runtime.KeepAlive(cprecisiontypeAllocMap) - runtime.KeepAlive(cshadertypeAllocMap) -} - -func GlGetShaderSource(shader GLuint, bufSize GLsizei, length *GLsizei, source *GLchar) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - csource, csourceAllocMap := (*C.GLchar)(unsafe.Pointer(source)), cgoAllocsUnknown - C.glGetShaderSource(cshader, cbufSize, clength, csource) - runtime.KeepAlive(csourceAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlGetShaderiv(shader GLuint, pname GLenum, params *GLint) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetShaderiv(cshader, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlGetString(name GLenum) *GLubyte { - cname, cnameAllocMap := (C.GLenum)(name), cgoAllocsUnknown - __ret := C.glGetString(cname) - runtime.KeepAlive(cnameAllocMap) - __v := (*GLubyte)(unsafe.Pointer(__ret)) - return __v -} - -func GlGetStringi(name GLenum, index GLuint) *GLubyte { - cname, cnameAllocMap := (C.GLenum)(name), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - __ret := C.glGetStringi(cname, cindex) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cnameAllocMap) - __v := (*GLubyte)(unsafe.Pointer(__ret)) - return __v -} - -func GlGetSynciv(sync GLsync, pname GLenum, bufSize GLsizei, length *GLsizei, values *GLint) { - csync, csyncAllocMap := (C.GLsync)(sync), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - cvalues, cvaluesAllocMap := (*C.GLint)(unsafe.Pointer(values)), cgoAllocsUnknown - C.glGetSynciv(csync, cpname, cbufSize, clength, cvalues) - runtime.KeepAlive(cvaluesAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(csyncAllocMap) -} - -func GlGetTexParameterfv(target GLenum, pname GLenum, params *GLfloat) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetTexParameterfv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetTexParameteriv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetTexParameteriv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlGetTransformFeedbackVarying(program GLuint, index GLuint, bufSize GLsizei, length *GLsizei, size *GLsizei, _type *GLenum, name *GLchar) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cbufSize, cbufSizeAllocMap := (C.GLsizei)(bufSize), cgoAllocsUnknown - clength, clengthAllocMap := (*C.GLsizei)(unsafe.Pointer(length)), cgoAllocsUnknown - csize, csizeAllocMap := (*C.GLsizei)(unsafe.Pointer(size)), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.GLenum)(unsafe.Pointer(_type)), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - C.glGetTransformFeedbackVarying(cprogram, cindex, cbufSize, clength, csize, c_type, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufSizeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetUniformBlockIndex(program GLuint, uniformBlockName *GLchar) GLuint { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cuniformBlockName, cuniformBlockNameAllocMap := (*C.GLchar)(unsafe.Pointer(uniformBlockName)), cgoAllocsUnknown - __ret := C.glGetUniformBlockIndex(cprogram, cuniformBlockName) - runtime.KeepAlive(cuniformBlockNameAllocMap) - runtime.KeepAlive(cprogramAllocMap) - __v := (GLuint)(__ret) - return __v -} - -func GlGetUniformIndices(program GLuint, uniformCount GLsizei, uniformNames **GLchar, uniformIndices *GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cuniformCount, cuniformCountAllocMap := (C.GLsizei)(uniformCount), cgoAllocsUnknown - cuniformNames, cuniformNamesAllocMap := (**C.GLchar)(unsafe.Pointer(uniformNames)), cgoAllocsUnknown - var pinnercuniformNames runtime.Pinner - pinnercuniformNames.Pin(uniformNames) - if uniformNames != nil { - pinnercuniformNames.Pin(unsafe.Pointer(*uniformNames)) - } - defer pinnercuniformNames.Unpin() - cuniformIndices, cuniformIndicesAllocMap := (*C.GLuint)(unsafe.Pointer(uniformIndices)), cgoAllocsUnknown - C.glGetUniformIndices(cprogram, cuniformCount, cuniformNames, cuniformIndices) - runtime.KeepAlive(cuniformIndicesAllocMap) - runtime.KeepAlive(cuniformNamesAllocMap) - runtime.KeepAlive(cuniformCountAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetUniformLocation(program GLuint, name *GLchar) GLint { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cname, cnameAllocMap := (*C.GLchar)(unsafe.Pointer(name)), cgoAllocsUnknown - __ret := C.glGetUniformLocation(cprogram, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cprogramAllocMap) - __v := (GLint)(__ret) - return __v -} - -func GlGetUniformfv(program GLuint, location GLint, params *GLfloat) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetUniformfv(cprogram, clocation, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(clocationAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetUniformiv(program GLuint, location GLint, params *GLint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetUniformiv(cprogram, clocation, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(clocationAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetUniformuiv(program GLuint, location GLint, params *GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLuint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetUniformuiv(cprogram, clocation, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(clocationAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlGetVertexAttribIiv(index GLuint, pname GLenum, params *GLint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetVertexAttribIiv(cindex, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlGetVertexAttribIuiv(index GLuint, pname GLenum, params *GLuint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLuint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetVertexAttribIuiv(cindex, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlGetVertexAttribPointerv(index GLuint, pname GLenum, pointer *unsafe.Pointer) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cpointer, cpointerAllocMap := pointer, cgoAllocsUnknown - C.glGetVertexAttribPointerv(cindex, cpname, cpointer) - runtime.KeepAlive(cpointerAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlGetVertexAttribfv(index GLuint, pname GLenum, params *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetVertexAttribfv(cindex, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlGetVertexAttribiv(index GLuint, pname GLenum, params *GLint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glGetVertexAttribiv(cindex, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlHint(target GLenum, mode GLenum) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cmode, cmodeAllocMap := (C.GLenum)(mode), cgoAllocsUnknown - C.glHint(ctarget, cmode) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlInvalidateFramebuffer(target GLenum, numAttachments GLsizei, attachments *GLenum) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cnumAttachments, cnumAttachmentsAllocMap := (C.GLsizei)(numAttachments), cgoAllocsUnknown - cattachments, cattachmentsAllocMap := (*C.GLenum)(unsafe.Pointer(attachments)), cgoAllocsUnknown - C.glInvalidateFramebuffer(ctarget, cnumAttachments, cattachments) - runtime.KeepAlive(cattachmentsAllocMap) - runtime.KeepAlive(cnumAttachmentsAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlInvalidateSubFramebuffer(target GLenum, numAttachments GLsizei, attachments *GLenum, x GLint, y GLint, width GLsizei, height GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cnumAttachments, cnumAttachmentsAllocMap := (C.GLsizei)(numAttachments), cgoAllocsUnknown - cattachments, cattachmentsAllocMap := (*C.GLenum)(unsafe.Pointer(attachments)), cgoAllocsUnknown - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glInvalidateSubFramebuffer(ctarget, cnumAttachments, cattachments, cx, cy, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cattachmentsAllocMap) - runtime.KeepAlive(cnumAttachmentsAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlIsBuffer(buffer GLuint) GLboolean { - cbuffer, cbufferAllocMap := (C.GLuint)(buffer), cgoAllocsUnknown - __ret := C.glIsBuffer(cbuffer) - runtime.KeepAlive(cbufferAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsEnabled(cap GLenum) GLboolean { - ccap, ccapAllocMap := (C.GLenum)(cap), cgoAllocsUnknown - __ret := C.glIsEnabled(ccap) - runtime.KeepAlive(ccapAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsFramebuffer(framebuffer GLuint) GLboolean { - cframebuffer, cframebufferAllocMap := (C.GLuint)(framebuffer), cgoAllocsUnknown - __ret := C.glIsFramebuffer(cframebuffer) - runtime.KeepAlive(cframebufferAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsProgram(program GLuint) GLboolean { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - __ret := C.glIsProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsQuery(id GLuint) GLboolean { - cid, cidAllocMap := (C.GLuint)(id), cgoAllocsUnknown - __ret := C.glIsQuery(cid) - runtime.KeepAlive(cidAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsRenderbuffer(renderbuffer GLuint) GLboolean { - crenderbuffer, crenderbufferAllocMap := (C.GLuint)(renderbuffer), cgoAllocsUnknown - __ret := C.glIsRenderbuffer(crenderbuffer) - runtime.KeepAlive(crenderbufferAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsSampler(sampler GLuint) GLboolean { - csampler, csamplerAllocMap := (C.GLuint)(sampler), cgoAllocsUnknown - __ret := C.glIsSampler(csampler) - runtime.KeepAlive(csamplerAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsShader(shader GLuint) GLboolean { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - __ret := C.glIsShader(cshader) - runtime.KeepAlive(cshaderAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsSync(sync GLsync) GLboolean { - csync, csyncAllocMap := (C.GLsync)(sync), cgoAllocsUnknown - __ret := C.glIsSync(csync) - runtime.KeepAlive(csyncAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsTexture(texture GLuint) GLboolean { - ctexture, ctextureAllocMap := (C.GLuint)(texture), cgoAllocsUnknown - __ret := C.glIsTexture(ctexture) - runtime.KeepAlive(ctextureAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsTransformFeedback(id GLuint) GLboolean { - cid, cidAllocMap := (C.GLuint)(id), cgoAllocsUnknown - __ret := C.glIsTransformFeedback(cid) - runtime.KeepAlive(cidAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlIsVertexArray(array GLuint) GLboolean { - carray, carrayAllocMap := (C.GLuint)(array), cgoAllocsUnknown - __ret := C.glIsVertexArray(carray) - runtime.KeepAlive(carrayAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlLineWidth(width GLfloat) { - cwidth, cwidthAllocMap := (C.GLfloat)(width), cgoAllocsUnknown - C.glLineWidth(cwidth) - runtime.KeepAlive(cwidthAllocMap) -} - -func GlLinkProgram(program GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - C.glLinkProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlMapBufferRange(target GLenum, offset GLintptr, length GLsizeiptr, access GLbitfield) unsafe.Pointer { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.GLintptr)(offset), cgoAllocsUnknown - clength, clengthAllocMap := (C.GLsizeiptr)(length), cgoAllocsUnknown - caccess, caccessAllocMap := (C.GLbitfield)(access), cgoAllocsUnknown - __ret := C.glMapBufferRange(ctarget, coffset, clength, caccess) - runtime.KeepAlive(caccessAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(ctargetAllocMap) - __v := (unsafe.Pointer)(__ret) - return __v -} - -func GlPauseTransformFeedback() { - C.glPauseTransformFeedback() -} - -func GlPixelStorei(pname GLenum, param GLint) { - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (C.GLint)(param), cgoAllocsUnknown - C.glPixelStorei(cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) -} - -func GlPolygonOffset(factor GLfloat, units GLfloat) { - cfactor, cfactorAllocMap := (C.GLfloat)(factor), cgoAllocsUnknown - cunits, cunitsAllocMap := (C.GLfloat)(units), cgoAllocsUnknown - C.glPolygonOffset(cfactor, cunits) - runtime.KeepAlive(cunitsAllocMap) - runtime.KeepAlive(cfactorAllocMap) -} - -func GlProgramBinary(program GLuint, binaryFormat GLenum, binary unsafe.Pointer, length GLsizei) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cbinaryFormat, cbinaryFormatAllocMap := (C.GLenum)(binaryFormat), cgoAllocsUnknown - cbinary, cbinaryAllocMap := binary, cgoAllocsUnknown - clength, clengthAllocMap := (C.GLsizei)(length), cgoAllocsUnknown - C.glProgramBinary(cprogram, cbinaryFormat, cbinary, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbinaryAllocMap) - runtime.KeepAlive(cbinaryFormatAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlProgramParameteri(program GLuint, pname GLenum, value GLint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cvalue, cvalueAllocMap := (C.GLint)(value), cgoAllocsUnknown - C.glProgramParameteri(cprogram, cpname, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlReadBuffer(src GLenum) { - csrc, csrcAllocMap := (C.GLenum)(src), cgoAllocsUnknown - C.glReadBuffer(csrc) - runtime.KeepAlive(csrcAllocMap) -} - -func GlReadPixels(x GLint, y GLint, width GLsizei, height GLsizei, format GLenum, _type GLenum, pixels unsafe.Pointer) { - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - C.glReadPixels(cx, cy, cwidth, cheight, cformat, c_type, cpixels) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) -} - -func GlReleaseShaderCompiler() { - C.glReleaseShaderCompiler() -} - -func GlRenderbufferStorage(target GLenum, internalformat GLenum, width GLsizei, height GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glRenderbufferStorage(ctarget, cinternalformat, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlRenderbufferStorageMultisample(target GLenum, samples GLsizei, internalformat GLenum, width GLsizei, height GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - csamples, csamplesAllocMap := (C.GLsizei)(samples), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glRenderbufferStorageMultisample(ctarget, csamples, cinternalformat, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(csamplesAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlResumeTransformFeedback() { - C.glResumeTransformFeedback() -} - -func GlSampleCoverage(value GLfloat, invert GLboolean) { - cvalue, cvalueAllocMap := (C.GLfloat)(value), cgoAllocsUnknown - cinvert, cinvertAllocMap := (C.GLboolean)(invert), cgoAllocsUnknown - C.glSampleCoverage(cvalue, cinvert) - runtime.KeepAlive(cinvertAllocMap) - runtime.KeepAlive(cvalueAllocMap) -} - -func GlSamplerParameterf(sampler GLuint, pname GLenum, param GLfloat) { - csampler, csamplerAllocMap := (C.GLuint)(sampler), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (C.GLfloat)(param), cgoAllocsUnknown - C.glSamplerParameterf(csampler, cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(csamplerAllocMap) -} - -func GlSamplerParameterfv(sampler GLuint, pname GLenum, param *GLfloat) { - csampler, csamplerAllocMap := (C.GLuint)(sampler), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (*C.GLfloat)(unsafe.Pointer(param)), cgoAllocsUnknown - C.glSamplerParameterfv(csampler, cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(csamplerAllocMap) -} - -func GlSamplerParameteri(sampler GLuint, pname GLenum, param GLint) { - csampler, csamplerAllocMap := (C.GLuint)(sampler), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (C.GLint)(param), cgoAllocsUnknown - C.glSamplerParameteri(csampler, cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(csamplerAllocMap) -} - -func GlSamplerParameteriv(sampler GLuint, pname GLenum, param *GLint) { - csampler, csamplerAllocMap := (C.GLuint)(sampler), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (*C.GLint)(unsafe.Pointer(param)), cgoAllocsUnknown - C.glSamplerParameteriv(csampler, cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(csamplerAllocMap) -} - -func GlScissor(x GLint, y GLint, width GLsizei, height GLsizei) { - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glScissor(cx, cy, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) -} - -func GlShaderBinary(count GLsizei, shaders *GLuint, binaryformat GLenum, binary unsafe.Pointer, length GLsizei) { - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cshaders, cshadersAllocMap := (*C.GLuint)(unsafe.Pointer(shaders)), cgoAllocsUnknown - cbinaryformat, cbinaryformatAllocMap := (C.GLenum)(binaryformat), cgoAllocsUnknown - cbinary, cbinaryAllocMap := binary, cgoAllocsUnknown - clength, clengthAllocMap := (C.GLsizei)(length), cgoAllocsUnknown - C.glShaderBinary(ccount, cshaders, cbinaryformat, cbinary, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbinaryAllocMap) - runtime.KeepAlive(cbinaryformatAllocMap) - runtime.KeepAlive(cshadersAllocMap) - runtime.KeepAlive(ccountAllocMap) -} - -func GlShaderSource(shader GLuint, count GLsizei, _string **GLchar, length *GLint) { - cshader, cshaderAllocMap := (C.GLuint)(shader), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - c_string, c_stringAllocMap := (**C.GLchar)(unsafe.Pointer(_string)), cgoAllocsUnknown - var pinnerc_string runtime.Pinner - pinnerc_string.Pin(_string) - if _string != nil { - pinnerc_string.Pin(unsafe.Pointer(*_string)) - } - defer pinnerc_string.Unpin() - clength, clengthAllocMap := (*C.GLint)(unsafe.Pointer(length)), cgoAllocsUnknown - C.glShaderSource(cshader, ccount, c_string, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(c_stringAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cshaderAllocMap) -} - -func GlStencilFunc(_func GLenum, ref GLint, mask GLuint) { - c_func, c_funcAllocMap := (C.GLenum)(_func), cgoAllocsUnknown - cref, crefAllocMap := (C.GLint)(ref), cgoAllocsUnknown - cmask, cmaskAllocMap := (C.GLuint)(mask), cgoAllocsUnknown - C.glStencilFunc(c_func, cref, cmask) - runtime.KeepAlive(cmaskAllocMap) - runtime.KeepAlive(crefAllocMap) - runtime.KeepAlive(c_funcAllocMap) -} - -func GlStencilFuncSeparate(face GLenum, _func GLenum, ref GLint, mask GLuint) { - cface, cfaceAllocMap := (C.GLenum)(face), cgoAllocsUnknown - c_func, c_funcAllocMap := (C.GLenum)(_func), cgoAllocsUnknown - cref, crefAllocMap := (C.GLint)(ref), cgoAllocsUnknown - cmask, cmaskAllocMap := (C.GLuint)(mask), cgoAllocsUnknown - C.glStencilFuncSeparate(cface, c_func, cref, cmask) - runtime.KeepAlive(cmaskAllocMap) - runtime.KeepAlive(crefAllocMap) - runtime.KeepAlive(c_funcAllocMap) - runtime.KeepAlive(cfaceAllocMap) -} - -func GlStencilMask(mask GLuint) { - cmask, cmaskAllocMap := (C.GLuint)(mask), cgoAllocsUnknown - C.glStencilMask(cmask) - runtime.KeepAlive(cmaskAllocMap) -} - -func GlStencilMaskSeparate(face GLenum, mask GLuint) { - cface, cfaceAllocMap := (C.GLenum)(face), cgoAllocsUnknown - cmask, cmaskAllocMap := (C.GLuint)(mask), cgoAllocsUnknown - C.glStencilMaskSeparate(cface, cmask) - runtime.KeepAlive(cmaskAllocMap) - runtime.KeepAlive(cfaceAllocMap) -} - -func GlStencilOp(fail GLenum, zfail GLenum, zpass GLenum) { - cfail, cfailAllocMap := (C.GLenum)(fail), cgoAllocsUnknown - czfail, czfailAllocMap := (C.GLenum)(zfail), cgoAllocsUnknown - czpass, czpassAllocMap := (C.GLenum)(zpass), cgoAllocsUnknown - C.glStencilOp(cfail, czfail, czpass) - runtime.KeepAlive(czpassAllocMap) - runtime.KeepAlive(czfailAllocMap) - runtime.KeepAlive(cfailAllocMap) -} - -func GlStencilOpSeparate(face GLenum, sfail GLenum, dpfail GLenum, dppass GLenum) { - cface, cfaceAllocMap := (C.GLenum)(face), cgoAllocsUnknown - csfail, csfailAllocMap := (C.GLenum)(sfail), cgoAllocsUnknown - cdpfail, cdpfailAllocMap := (C.GLenum)(dpfail), cgoAllocsUnknown - cdppass, cdppassAllocMap := (C.GLenum)(dppass), cgoAllocsUnknown - C.glStencilOpSeparate(cface, csfail, cdpfail, cdppass) - runtime.KeepAlive(cdppassAllocMap) - runtime.KeepAlive(cdpfailAllocMap) - runtime.KeepAlive(csfailAllocMap) - runtime.KeepAlive(cfaceAllocMap) -} - -func GlTexImage2D(target GLenum, level GLint, internalformat GLint, width GLsizei, height GLsizei, border GLint, format GLenum, _type GLenum, pixels unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLint)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cborder, cborderAllocMap := (C.GLint)(border), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - C.glTexImage2D(ctarget, clevel, cinternalformat, cwidth, cheight, cborder, cformat, c_type, cpixels) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cborderAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexImage3D(target GLenum, level GLint, internalformat GLint, width GLsizei, height GLsizei, depth GLsizei, border GLint, format GLenum, _type GLenum, pixels unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLint)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cdepth, cdepthAllocMap := (C.GLsizei)(depth), cgoAllocsUnknown - cborder, cborderAllocMap := (C.GLint)(border), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - C.glTexImage3D(ctarget, clevel, cinternalformat, cwidth, cheight, cdepth, cborder, cformat, c_type, cpixels) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cborderAllocMap) - runtime.KeepAlive(cdepthAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexParameterf(target GLenum, pname GLenum, param GLfloat) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (C.GLfloat)(param), cgoAllocsUnknown - C.glTexParameterf(ctarget, cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexParameterfv(target GLenum, pname GLenum, params *GLfloat) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLfloat)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glTexParameterfv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexParameteri(target GLenum, pname GLenum, param GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparam, cparamAllocMap := (C.GLint)(param), cgoAllocsUnknown - C.glTexParameteri(ctarget, cpname, cparam) - runtime.KeepAlive(cparamAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexParameteriv(target GLenum, pname GLenum, params *GLint) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - cpname, cpnameAllocMap := (C.GLenum)(pname), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.GLint)(unsafe.Pointer(params)), cgoAllocsUnknown - C.glTexParameteriv(ctarget, cpname, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cpnameAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexStorage2D(target GLenum, levels GLsizei, internalformat GLenum, width GLsizei, height GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevels, clevelsAllocMap := (C.GLsizei)(levels), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glTexStorage2D(ctarget, clevels, cinternalformat, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelsAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexStorage3D(target GLenum, levels GLsizei, internalformat GLenum, width GLsizei, height GLsizei, depth GLsizei) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevels, clevelsAllocMap := (C.GLsizei)(levels), cgoAllocsUnknown - cinternalformat, cinternalformatAllocMap := (C.GLenum)(internalformat), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cdepth, cdepthAllocMap := (C.GLsizei)(depth), cgoAllocsUnknown - C.glTexStorage3D(ctarget, clevels, cinternalformat, cwidth, cheight, cdepth) - runtime.KeepAlive(cdepthAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cinternalformatAllocMap) - runtime.KeepAlive(clevelsAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexSubImage2D(target GLenum, level GLint, xoffset GLint, yoffset GLint, width GLsizei, height GLsizei, format GLenum, _type GLenum, pixels unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - C.glTexSubImage2D(ctarget, clevel, cxoffset, cyoffset, cwidth, cheight, cformat, c_type, cpixels) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTexSubImage3D(target GLenum, level GLint, xoffset GLint, yoffset GLint, zoffset GLint, width GLsizei, height GLsizei, depth GLsizei, format GLenum, _type GLenum, pixels unsafe.Pointer) { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - clevel, clevelAllocMap := (C.GLint)(level), cgoAllocsUnknown - cxoffset, cxoffsetAllocMap := (C.GLint)(xoffset), cgoAllocsUnknown - cyoffset, cyoffsetAllocMap := (C.GLint)(yoffset), cgoAllocsUnknown - czoffset, czoffsetAllocMap := (C.GLint)(zoffset), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - cdepth, cdepthAllocMap := (C.GLsizei)(depth), cgoAllocsUnknown - cformat, cformatAllocMap := (C.GLenum)(format), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - C.glTexSubImage3D(ctarget, clevel, cxoffset, cyoffset, czoffset, cwidth, cheight, cdepth, cformat, c_type, cpixels) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cdepthAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(czoffsetAllocMap) - runtime.KeepAlive(cyoffsetAllocMap) - runtime.KeepAlive(cxoffsetAllocMap) - runtime.KeepAlive(clevelAllocMap) - runtime.KeepAlive(ctargetAllocMap) -} - -func GlTransformFeedbackVaryings(program GLuint, count GLsizei, varyings **GLchar, bufferMode GLenum) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvaryings, cvaryingsAllocMap := (**C.GLchar)(unsafe.Pointer(varyings)), cgoAllocsUnknown - var pinnercvaryings runtime.Pinner - pinnercvaryings.Pin(varyings) - if varyings != nil { - pinnercvaryings.Pin(unsafe.Pointer(*varyings)) - } - defer pinnercvaryings.Unpin() - cbufferMode, cbufferModeAllocMap := (C.GLenum)(bufferMode), cgoAllocsUnknown - C.glTransformFeedbackVaryings(cprogram, ccount, cvaryings, cbufferMode) - runtime.KeepAlive(cbufferModeAllocMap) - runtime.KeepAlive(cvaryingsAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlUniform1f(location GLint, v0 GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLfloat)(v0), cgoAllocsUnknown - C.glUniform1f(clocation, cv0) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform1fv(location GLint, count GLsizei, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform1fv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform1i(location GLint, v0 GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLint)(v0), cgoAllocsUnknown - C.glUniform1i(clocation, cv0) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform1iv(location GLint, count GLsizei, value *GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform1iv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform1ui(location GLint, v0 GLuint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLuint)(v0), cgoAllocsUnknown - C.glUniform1ui(clocation, cv0) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform1uiv(location GLint, count GLsizei, value *GLuint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLuint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform1uiv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2f(location GLint, v0 GLfloat, v1 GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLfloat)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLfloat)(v1), cgoAllocsUnknown - C.glUniform2f(clocation, cv0, cv1) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2fv(location GLint, count GLsizei, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform2fv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2i(location GLint, v0 GLint, v1 GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLint)(v1), cgoAllocsUnknown - C.glUniform2i(clocation, cv0, cv1) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2iv(location GLint, count GLsizei, value *GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform2iv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2ui(location GLint, v0 GLuint, v1 GLuint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLuint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLuint)(v1), cgoAllocsUnknown - C.glUniform2ui(clocation, cv0, cv1) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform2uiv(location GLint, count GLsizei, value *GLuint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLuint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform2uiv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3f(location GLint, v0 GLfloat, v1 GLfloat, v2 GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLfloat)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLfloat)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLfloat)(v2), cgoAllocsUnknown - C.glUniform3f(clocation, cv0, cv1, cv2) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3fv(location GLint, count GLsizei, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform3fv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3i(location GLint, v0 GLint, v1 GLint, v2 GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLint)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLint)(v2), cgoAllocsUnknown - C.glUniform3i(clocation, cv0, cv1, cv2) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3iv(location GLint, count GLsizei, value *GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform3iv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3ui(location GLint, v0 GLuint, v1 GLuint, v2 GLuint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLuint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLuint)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLuint)(v2), cgoAllocsUnknown - C.glUniform3ui(clocation, cv0, cv1, cv2) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform3uiv(location GLint, count GLsizei, value *GLuint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLuint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform3uiv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4f(location GLint, v0 GLfloat, v1 GLfloat, v2 GLfloat, v3 GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLfloat)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLfloat)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLfloat)(v2), cgoAllocsUnknown - cv3, cv3AllocMap := (C.GLfloat)(v3), cgoAllocsUnknown - C.glUniform4f(clocation, cv0, cv1, cv2, cv3) - runtime.KeepAlive(cv3AllocMap) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4fv(location GLint, count GLsizei, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform4fv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4i(location GLint, v0 GLint, v1 GLint, v2 GLint, v3 GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLint)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLint)(v2), cgoAllocsUnknown - cv3, cv3AllocMap := (C.GLint)(v3), cgoAllocsUnknown - C.glUniform4i(clocation, cv0, cv1, cv2, cv3) - runtime.KeepAlive(cv3AllocMap) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4iv(location GLint, count GLsizei, value *GLint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform4iv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4ui(location GLint, v0 GLuint, v1 GLuint, v2 GLuint, v3 GLuint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - cv0, cv0AllocMap := (C.GLuint)(v0), cgoAllocsUnknown - cv1, cv1AllocMap := (C.GLuint)(v1), cgoAllocsUnknown - cv2, cv2AllocMap := (C.GLuint)(v2), cgoAllocsUnknown - cv3, cv3AllocMap := (C.GLuint)(v3), cgoAllocsUnknown - C.glUniform4ui(clocation, cv0, cv1, cv2, cv3) - runtime.KeepAlive(cv3AllocMap) - runtime.KeepAlive(cv2AllocMap) - runtime.KeepAlive(cv1AllocMap) - runtime.KeepAlive(cv0AllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniform4uiv(location GLint, count GLsizei, value *GLuint) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLuint)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniform4uiv(clocation, ccount, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformBlockBinding(program GLuint, uniformBlockIndex GLuint, uniformBlockBinding GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - cuniformBlockIndex, cuniformBlockIndexAllocMap := (C.GLuint)(uniformBlockIndex), cgoAllocsUnknown - cuniformBlockBinding, cuniformBlockBindingAllocMap := (C.GLuint)(uniformBlockBinding), cgoAllocsUnknown - C.glUniformBlockBinding(cprogram, cuniformBlockIndex, cuniformBlockBinding) - runtime.KeepAlive(cuniformBlockBindingAllocMap) - runtime.KeepAlive(cuniformBlockIndexAllocMap) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlUniformMatrix2fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix2fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix2x3fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix2x3fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix2x4fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix2x4fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix3fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix3fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix3x2fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix3x2fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix3x4fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix3x4fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix4fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix4fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix4x2fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix4x2fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUniformMatrix4x3fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) { - clocation, clocationAllocMap := (C.GLint)(location), cgoAllocsUnknown - ccount, ccountAllocMap := (C.GLsizei)(count), cgoAllocsUnknown - ctranspose, ctransposeAllocMap := (C.GLboolean)(transpose), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.GLfloat)(unsafe.Pointer(value)), cgoAllocsUnknown - C.glUniformMatrix4x3fv(clocation, ccount, ctranspose, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(ctransposeAllocMap) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(clocationAllocMap) -} - -func GlUnmapBuffer(target GLenum) GLboolean { - ctarget, ctargetAllocMap := (C.GLenum)(target), cgoAllocsUnknown - __ret := C.glUnmapBuffer(ctarget) - runtime.KeepAlive(ctargetAllocMap) - __v := (GLboolean)(__ret) - return __v -} - -func GlUseProgram(program GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - C.glUseProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlValidateProgram(program GLuint) { - cprogram, cprogramAllocMap := (C.GLuint)(program), cgoAllocsUnknown - C.glValidateProgram(cprogram) - runtime.KeepAlive(cprogramAllocMap) -} - -func GlVertexAttrib1f(index GLuint, x GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLfloat)(x), cgoAllocsUnknown - C.glVertexAttrib1f(cindex, cx) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib1fv(index GLuint, v *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLfloat)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttrib1fv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib2f(index GLuint, x GLfloat, y GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLfloat)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLfloat)(y), cgoAllocsUnknown - C.glVertexAttrib2f(cindex, cx, cy) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib2fv(index GLuint, v *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLfloat)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttrib2fv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib3f(index GLuint, x GLfloat, y GLfloat, z GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLfloat)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLfloat)(y), cgoAllocsUnknown - cz, czAllocMap := (C.GLfloat)(z), cgoAllocsUnknown - C.glVertexAttrib3f(cindex, cx, cy, cz) - runtime.KeepAlive(czAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib3fv(index GLuint, v *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLfloat)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttrib3fv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib4f(index GLuint, x GLfloat, y GLfloat, z GLfloat, w GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLfloat)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLfloat)(y), cgoAllocsUnknown - cz, czAllocMap := (C.GLfloat)(z), cgoAllocsUnknown - cw, cwAllocMap := (C.GLfloat)(w), cgoAllocsUnknown - C.glVertexAttrib4f(cindex, cx, cy, cz, cw) - runtime.KeepAlive(cwAllocMap) - runtime.KeepAlive(czAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttrib4fv(index GLuint, v *GLfloat) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLfloat)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttrib4fv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttribDivisor(index GLuint, divisor GLuint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cdivisor, cdivisorAllocMap := (C.GLuint)(divisor), cgoAllocsUnknown - C.glVertexAttribDivisor(cindex, cdivisor) - runtime.KeepAlive(cdivisorAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttribI4i(index GLuint, x GLint, y GLint, z GLint, w GLint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cz, czAllocMap := (C.GLint)(z), cgoAllocsUnknown - cw, cwAllocMap := (C.GLint)(w), cgoAllocsUnknown - C.glVertexAttribI4i(cindex, cx, cy, cz, cw) - runtime.KeepAlive(cwAllocMap) - runtime.KeepAlive(czAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttribI4iv(index GLuint, v *GLint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLint)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttribI4iv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttribI4ui(index GLuint, x GLuint, y GLuint, z GLuint, w GLuint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cx, cxAllocMap := (C.GLuint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLuint)(y), cgoAllocsUnknown - cz, czAllocMap := (C.GLuint)(z), cgoAllocsUnknown - cw, cwAllocMap := (C.GLuint)(w), cgoAllocsUnknown - C.glVertexAttribI4ui(cindex, cx, cy, cz, cw) - runtime.KeepAlive(cwAllocMap) - runtime.KeepAlive(czAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttribI4uiv(index GLuint, v *GLuint) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - cv, cvAllocMap := (*C.GLuint)(unsafe.Pointer(v)), cgoAllocsUnknown - C.glVertexAttribI4uiv(cindex, cv) - runtime.KeepAlive(cvAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttribIPointer(index GLuint, size GLint, _type GLenum, stride GLsizei, pointer unsafe.Pointer) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLint)(size), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cstride, cstrideAllocMap := (C.GLsizei)(stride), cgoAllocsUnknown - cpointer, cpointerAllocMap := pointer, cgoAllocsUnknown - C.glVertexAttribIPointer(cindex, csize, c_type, cstride, cpointer) - runtime.KeepAlive(cpointerAllocMap) - runtime.KeepAlive(cstrideAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlVertexAttribPointer(index GLuint, size GLint, _type GLenum, normalized GLboolean, stride GLsizei, pointer unsafe.Pointer) { - cindex, cindexAllocMap := (C.GLuint)(index), cgoAllocsUnknown - csize, csizeAllocMap := (C.GLint)(size), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.GLenum)(_type), cgoAllocsUnknown - cnormalized, cnormalizedAllocMap := (C.GLboolean)(normalized), cgoAllocsUnknown - cstride, cstrideAllocMap := (C.GLsizei)(stride), cgoAllocsUnknown - cpointer, cpointerAllocMap := pointer, cgoAllocsUnknown - C.glVertexAttribPointer(cindex, csize, c_type, cnormalized, cstride, cpointer) - runtime.KeepAlive(cpointerAllocMap) - runtime.KeepAlive(cstrideAllocMap) - runtime.KeepAlive(cnormalizedAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cindexAllocMap) -} - -func GlViewport(x GLint, y GLint, width GLsizei, height GLsizei) { - cx, cxAllocMap := (C.GLint)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.GLint)(y), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.GLsizei)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.GLsizei)(height), cgoAllocsUnknown - C.glViewport(cx, cy, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) -} - -func GlWaitSync(sync GLsync, flags GLbitfield, timeout GLuint64) { - csync, csyncAllocMap := (C.GLsync)(sync), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.GLbitfield)(flags), cgoAllocsUnknown - ctimeout, ctimeoutAllocMap := (C.GLuint64)(timeout), cgoAllocsUnknown - C.glWaitSync(csync, cflags, ctimeout) - runtime.KeepAlive(ctimeoutAllocMap) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(csyncAllocMap) -} diff --git a/capi/gles3/types.go b/capi/gles3/types.go deleted file mode 100644 index c760da0..0000000 --- a/capi/gles3/types.go +++ /dev/null @@ -1,543 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package gles3 - -/* -#cgo LDFLAGS: -lGLESv3 -#include "GLES3/gl3.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type GLbitfield uint32 - -type GLboolean uint8 - -type GLbyte C.GLbyte - -type GLchar int8 - -type GLclampf C.GLclampf - -type GLenum uint32 - -type GLfixed C.GLfixed - -type GLfloat C.GLfloat - -type GLhalf uint16 - -type GLint int32 - -type GLint64 C.GLint64 - -type GLintptr C.GLintptr - -type GLshort int16 - -type GLsizei int32 - -type GLsizeiptr C.GLsizeiptr - -type GLsync C.GLsync - -type GLubyte C.GLubyte - -type GLuint uint32 - -type GLuint64 C.GLuint64 - -type GLushort uint16 - -type PFNGLACTIVETEXTUREPROC func() - -type PFNGLATTACHSHADERPROC func() - -type PFNGLBEGINQUERYPROC func() - -type PFNGLBEGINTRANSFORMFEEDBACKPROC func() - -type PFNGLBINDATTRIBLOCATIONPROC func() - -type PFNGLBINDBUFFERBASEPROC func() - -type PFNGLBINDBUFFERPROC func() - -type PFNGLBINDBUFFERRANGEPROC func() - -type PFNGLBINDFRAMEBUFFERPROC func() - -type PFNGLBINDRENDERBUFFERPROC func() - -type PFNGLBINDSAMPLERPROC func() - -type PFNGLBINDTEXTUREPROC func() - -type PFNGLBINDTRANSFORMFEEDBACKPROC func() - -type PFNGLBINDVERTEXARRAYPROC func() - -type PFNGLBLENDCOLORPROC func() - -type PFNGLBLENDEQUATIONPROC func() - -type PFNGLBLENDEQUATIONSEPARATEPROC func() - -type PFNGLBLENDFUNCPROC func() - -type PFNGLBLENDFUNCSEPARATEPROC func() - -type PFNGLBLITFRAMEBUFFERPROC func() - -type PFNGLBUFFERDATAPROC func() - -type PFNGLBUFFERSUBDATAPROC func() - -type PFNGLCHECKFRAMEBUFFERSTATUSPROC func() - -type PFNGLCLEARBUFFERFIPROC func() - -type PFNGLCLEARBUFFERFVPROC func() - -type PFNGLCLEARBUFFERIVPROC func() - -type PFNGLCLEARBUFFERUIVPROC func() - -type PFNGLCLEARCOLORPROC func() - -type PFNGLCLEARDEPTHFPROC func() - -type PFNGLCLEARPROC func() - -type PFNGLCLEARSTENCILPROC func() - -type PFNGLCLIENTWAITSYNCPROC func() - -type PFNGLCOLORMASKPROC func() - -type PFNGLCOMPILESHADERPROC func() - -type PFNGLCOMPRESSEDTEXIMAGE2DPROC func() - -type PFNGLCOMPRESSEDTEXIMAGE3DPROC func() - -type PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC func() - -type PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC func() - -type PFNGLCOPYBUFFERSUBDATAPROC func() - -type PFNGLCOPYTEXIMAGE2DPROC func() - -type PFNGLCOPYTEXSUBIMAGE2DPROC func() - -type PFNGLCOPYTEXSUBIMAGE3DPROC func() - -type PFNGLCREATEPROGRAMPROC func() - -type PFNGLCREATESHADERPROC func() - -type PFNGLCULLFACEPROC func() - -type PFNGLDELETEBUFFERSPROC func() - -type PFNGLDELETEFRAMEBUFFERSPROC func() - -type PFNGLDELETEPROGRAMPROC func() - -type PFNGLDELETEQUERIESPROC func() - -type PFNGLDELETERENDERBUFFERSPROC func() - -type PFNGLDELETESAMPLERSPROC func() - -type PFNGLDELETESHADERPROC func() - -type PFNGLDELETESYNCPROC func() - -type PFNGLDELETETEXTURESPROC func() - -type PFNGLDELETETRANSFORMFEEDBACKSPROC func() - -type PFNGLDELETEVERTEXARRAYSPROC func() - -type PFNGLDEPTHFUNCPROC func() - -type PFNGLDEPTHMASKPROC func() - -type PFNGLDEPTHRANGEFPROC func() - -type PFNGLDETACHSHADERPROC func() - -type PFNGLDISABLEPROC func() - -type PFNGLDISABLEVERTEXATTRIBARRAYPROC func() - -type PFNGLDRAWARRAYSINSTANCEDPROC func() - -type PFNGLDRAWARRAYSPROC func() - -type PFNGLDRAWBUFFERSPROC func() - -type PFNGLDRAWELEMENTSINSTANCEDPROC func() - -type PFNGLDRAWELEMENTSPROC func() - -type PFNGLDRAWRANGEELEMENTSPROC func() - -type PFNGLENABLEPROC func() - -type PFNGLENABLEVERTEXATTRIBARRAYPROC func() - -type PFNGLENDQUERYPROC func() - -type PFNGLENDTRANSFORMFEEDBACKPROC func() - -type PFNGLFENCESYNCPROC func() - -type PFNGLFINISHPROC func() - -type PFNGLFLUSHMAPPEDBUFFERRANGEPROC func() - -type PFNGLFLUSHPROC func() - -type PFNGLFRAMEBUFFERRENDERBUFFERPROC func() - -type PFNGLFRAMEBUFFERTEXTURE2DPROC func() - -type PFNGLFRAMEBUFFERTEXTURELAYERPROC func() - -type PFNGLFRONTFACEPROC func() - -type PFNGLGENBUFFERSPROC func() - -type PFNGLGENERATEMIPMAPPROC func() - -type PFNGLGENFRAMEBUFFERSPROC func() - -type PFNGLGENQUERIESPROC func() - -type PFNGLGENRENDERBUFFERSPROC func() - -type PFNGLGENSAMPLERSPROC func() - -type PFNGLGENTEXTURESPROC func() - -type PFNGLGENTRANSFORMFEEDBACKSPROC func() - -type PFNGLGENVERTEXARRAYSPROC func() - -type PFNGLGETACTIVEATTRIBPROC func() - -type PFNGLGETACTIVEUNIFORMBLOCKIVPROC func() - -type PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC func() - -type PFNGLGETACTIVEUNIFORMPROC func() - -type PFNGLGETACTIVEUNIFORMSIVPROC func() - -type PFNGLGETATTACHEDSHADERSPROC func() - -type PFNGLGETATTRIBLOCATIONPROC func() - -type PFNGLGETBOOLEANVPROC func() - -type PFNGLGETBUFFERPARAMETERI64VPROC func() - -type PFNGLGETBUFFERPARAMETERIVPROC func() - -type PFNGLGETBUFFERPOINTERVPROC func() - -type PFNGLGETERRORPROC func() - -type PFNGLGETFLOATVPROC func() - -type PFNGLGETFRAGDATALOCATIONPROC func() - -type PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC func() - -type PFNGLGETINTEGER64I_VPROC func() - -type PFNGLGETINTEGER64VPROC func() - -type PFNGLGETINTEGERI_VPROC func() - -type PFNGLGETINTEGERVPROC func() - -type PFNGLGETINTERNALFORMATIVPROC func() - -type PFNGLGETPROGRAMBINARYPROC func() - -type PFNGLGETPROGRAMINFOLOGPROC func() - -type PFNGLGETPROGRAMIVPROC func() - -type PFNGLGETQUERYIVPROC func() - -type PFNGLGETQUERYOBJECTUIVPROC func() - -type PFNGLGETRENDERBUFFERPARAMETERIVPROC func() - -type PFNGLGETSAMPLERPARAMETERFVPROC func() - -type PFNGLGETSAMPLERPARAMETERIVPROC func() - -type PFNGLGETSHADERINFOLOGPROC func() - -type PFNGLGETSHADERIVPROC func() - -type PFNGLGETSHADERPRECISIONFORMATPROC func() - -type PFNGLGETSHADERSOURCEPROC func() - -type PFNGLGETSTRINGIPROC func() - -type PFNGLGETSTRINGPROC func() - -type PFNGLGETSYNCIVPROC func() - -type PFNGLGETTEXPARAMETERFVPROC func() - -type PFNGLGETTEXPARAMETERIVPROC func() - -type PFNGLGETTRANSFORMFEEDBACKVARYINGPROC func() - -type PFNGLGETUNIFORMBLOCKINDEXPROC func() - -type PFNGLGETUNIFORMFVPROC func() - -type PFNGLGETUNIFORMINDICESPROC func() - -type PFNGLGETUNIFORMIVPROC func() - -type PFNGLGETUNIFORMLOCATIONPROC func() - -type PFNGLGETUNIFORMUIVPROC func() - -type PFNGLGETVERTEXATTRIBFVPROC func() - -type PFNGLGETVERTEXATTRIBIIVPROC func() - -type PFNGLGETVERTEXATTRIBIUIVPROC func() - -type PFNGLGETVERTEXATTRIBIVPROC func() - -type PFNGLGETVERTEXATTRIBPOINTERVPROC func() - -type PFNGLHINTPROC func() - -type PFNGLINVALIDATEFRAMEBUFFERPROC func() - -type PFNGLINVALIDATESUBFRAMEBUFFERPROC func() - -type PFNGLISBUFFERPROC func() - -type PFNGLISENABLEDPROC func() - -type PFNGLISFRAMEBUFFERPROC func() - -type PFNGLISPROGRAMPROC func() - -type PFNGLISQUERYPROC func() - -type PFNGLISRENDERBUFFERPROC func() - -type PFNGLISSAMPLERPROC func() - -type PFNGLISSHADERPROC func() - -type PFNGLISSYNCPROC func() - -type PFNGLISTEXTUREPROC func() - -type PFNGLISTRANSFORMFEEDBACKPROC func() - -type PFNGLISVERTEXARRAYPROC func() - -type PFNGLLINEWIDTHPROC func() - -type PFNGLLINKPROGRAMPROC func() - -type PFNGLMAPBUFFERRANGEPROC func() - -type PFNGLPAUSETRANSFORMFEEDBACKPROC func() - -type PFNGLPIXELSTOREIPROC func() - -type PFNGLPOLYGONOFFSETPROC func() - -type PFNGLPROGRAMBINARYPROC func() - -type PFNGLPROGRAMPARAMETERIPROC func() - -type PFNGLREADBUFFERPROC func() - -type PFNGLREADPIXELSPROC func() - -type PFNGLRELEASESHADERCOMPILERPROC func() - -type PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC func() - -type PFNGLRENDERBUFFERSTORAGEPROC func() - -type PFNGLRESUMETRANSFORMFEEDBACKPROC func() - -type PFNGLSAMPLECOVERAGEPROC func() - -type PFNGLSAMPLERPARAMETERFPROC func() - -type PFNGLSAMPLERPARAMETERFVPROC func() - -type PFNGLSAMPLERPARAMETERIPROC func() - -type PFNGLSAMPLERPARAMETERIVPROC func() - -type PFNGLSCISSORPROC func() - -type PFNGLSHADERBINARYPROC func() - -type PFNGLSHADERSOURCEPROC func() - -type PFNGLSTENCILFUNCPROC func() - -type PFNGLSTENCILFUNCSEPARATEPROC func() - -type PFNGLSTENCILMASKPROC func() - -type PFNGLSTENCILMASKSEPARATEPROC func() - -type PFNGLSTENCILOPPROC func() - -type PFNGLSTENCILOPSEPARATEPROC func() - -type PFNGLTEXIMAGE2DPROC func() - -type PFNGLTEXIMAGE3DPROC func() - -type PFNGLTEXPARAMETERFPROC func() - -type PFNGLTEXPARAMETERFVPROC func() - -type PFNGLTEXPARAMETERIPROC func() - -type PFNGLTEXPARAMETERIVPROC func() - -type PFNGLTEXSTORAGE2DPROC func() - -type PFNGLTEXSTORAGE3DPROC func() - -type PFNGLTEXSUBIMAGE2DPROC func() - -type PFNGLTEXSUBIMAGE3DPROC func() - -type PFNGLTRANSFORMFEEDBACKVARYINGSPROC func() - -type PFNGLUNIFORM1FPROC func() - -type PFNGLUNIFORM1FVPROC func() - -type PFNGLUNIFORM1IPROC func() - -type PFNGLUNIFORM1IVPROC func() - -type PFNGLUNIFORM1UIPROC func() - -type PFNGLUNIFORM1UIVPROC func() - -type PFNGLUNIFORM2FPROC func() - -type PFNGLUNIFORM2FVPROC func() - -type PFNGLUNIFORM2IPROC func() - -type PFNGLUNIFORM2IVPROC func() - -type PFNGLUNIFORM2UIPROC func() - -type PFNGLUNIFORM2UIVPROC func() - -type PFNGLUNIFORM3FPROC func() - -type PFNGLUNIFORM3FVPROC func() - -type PFNGLUNIFORM3IPROC func() - -type PFNGLUNIFORM3IVPROC func() - -type PFNGLUNIFORM3UIPROC func() - -type PFNGLUNIFORM3UIVPROC func() - -type PFNGLUNIFORM4FPROC func() - -type PFNGLUNIFORM4FVPROC func() - -type PFNGLUNIFORM4IPROC func() - -type PFNGLUNIFORM4IVPROC func() - -type PFNGLUNIFORM4UIPROC func() - -type PFNGLUNIFORM4UIVPROC func() - -type PFNGLUNIFORMBLOCKBINDINGPROC func() - -type PFNGLUNIFORMMATRIX2FVPROC func() - -type PFNGLUNIFORMMATRIX2X3FVPROC func() - -type PFNGLUNIFORMMATRIX2X4FVPROC func() - -type PFNGLUNIFORMMATRIX3FVPROC func() - -type PFNGLUNIFORMMATRIX3X2FVPROC func() - -type PFNGLUNIFORMMATRIX3X4FVPROC func() - -type PFNGLUNIFORMMATRIX4FVPROC func() - -type PFNGLUNIFORMMATRIX4X2FVPROC func() - -type PFNGLUNIFORMMATRIX4X3FVPROC func() - -type PFNGLUNMAPBUFFERPROC func() - -type PFNGLUSEPROGRAMPROC func() - -type PFNGLVALIDATEPROGRAMPROC func() - -type PFNGLVERTEXATTRIB1FPROC func() - -type PFNGLVERTEXATTRIB1FVPROC func() - -type PFNGLVERTEXATTRIB2FPROC func() - -type PFNGLVERTEXATTRIB2FVPROC func() - -type PFNGLVERTEXATTRIB3FPROC func() - -type PFNGLVERTEXATTRIB3FVPROC func() - -type PFNGLVERTEXATTRIB4FPROC func() - -type PFNGLVERTEXATTRIB4FVPROC func() - -type PFNGLVERTEXATTRIBDIVISORPROC func() - -type PFNGLVERTEXATTRIBI4IPROC func() - -type PFNGLVERTEXATTRIBI4IVPROC func() - -type PFNGLVERTEXATTRIBI4UIPROC func() - -type PFNGLVERTEXATTRIBI4UIVPROC func() - -type PFNGLVERTEXATTRIBIPOINTERPROC func() - -type PFNGLVERTEXATTRIBPOINTERPROC func() - -type PFNGLVIEWPORTPROC func() - -type PFNGLWAITSYNCPROC func() diff --git a/capi/hardwarebuffer/cgo_helpers.c b/capi/hardwarebuffer/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/hardwarebuffer/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/hardwarebuffer/cgo_helpers.go b/capi/hardwarebuffer/cgo_helpers.go deleted file mode 100644 index b11bc69..0000000 --- a/capi/hardwarebuffer/cgo_helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package hardwarebuffer - -/* -#cgo LDFLAGS: -lnativewindow -#include "android/hardware_buffer.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} diff --git a/capi/hardwarebuffer/cgo_helpers.h b/capi/hardwarebuffer/cgo_helpers.h deleted file mode 100644 index eefb1c2..0000000 --- a/capi/hardwarebuffer/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/hardware_buffer.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/hardwarebuffer/const.go b/capi/hardwarebuffer/const.go deleted file mode 100644 index 7cda5a6..0000000 --- a/capi/hardwarebuffer/const.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package hardwarebuffer - -const ( - AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM = 1 - AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM = 2 - AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM = 3 - AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM = 4 - AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT = 22 - AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM = 43 - AHARDWAREBUFFER_FORMAT_BLOB = 33 - AHARDWAREBUFFER_FORMAT_D16_UNORM = 48 - AHARDWAREBUFFER_FORMAT_D24_UNORM = 49 - AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT = 50 - AHARDWAREBUFFER_FORMAT_D32_FLOAT = 51 - AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT = 52 - AHARDWAREBUFFER_FORMAT_S8_UINT = 53 - AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 = 35 - AHARDWAREBUFFER_FORMAT_YCbCr_P010 = 54 - AHARDWAREBUFFER_FORMAT_YCbCr_P210 = 60 - AHARDWAREBUFFER_FORMAT_R8_UNORM = 56 - AHARDWAREBUFFER_FORMAT_R16_UINT = 57 - AHARDWAREBUFFER_FORMAT_R16G16_UINT = 58 - AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM = 59 -) - -const ( - AHARDWAREBUFFER_USAGE_CPU_READ_NEVER = 0 - AHARDWAREBUFFER_USAGE_CPU_READ_RARELY = 2 - AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN = 3 - AHARDWAREBUFFER_USAGE_CPU_READ_MASK = 15 - AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER = 0 - AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY = 32 - AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN = 48 - AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK = 240 - AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE = 256 - AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER = 512 - AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT = 512 - AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY = 2048 - AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT = 16384 - AHARDWAREBUFFER_USAGE_VIDEO_ENCODE = 65536 - AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA = 8388608 - AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER = 16777216 - AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP = 33554432 - AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE = 67108864 - AHARDWAREBUFFER_USAGE_FRONT_BUFFER = 4294967296 - AHARDWAREBUFFER_USAGE_VENDOR_0 = 268435456 - AHARDWAREBUFFER_USAGE_VENDOR_1 = 536870912 - AHARDWAREBUFFER_USAGE_VENDOR_2 = 1073741824 - AHARDWAREBUFFER_USAGE_VENDOR_3 = -2147483648 - AHARDWAREBUFFER_USAGE_VENDOR_4 = 281474976710656 - AHARDWAREBUFFER_USAGE_VENDOR_5 = 562949953421312 - AHARDWAREBUFFER_USAGE_VENDOR_6 = 1125899906842624 - AHARDWAREBUFFER_USAGE_VENDOR_7 = 2251799813685248 - AHARDWAREBUFFER_USAGE_VENDOR_8 = 4503599627370496 - AHARDWAREBUFFER_USAGE_VENDOR_9 = 9007199254740992 - AHARDWAREBUFFER_USAGE_VENDOR_10 = 18014398509481984 - AHARDWAREBUFFER_USAGE_VENDOR_11 = 36028797018963968 - AHARDWAREBUFFER_USAGE_VENDOR_12 = 72057594037927936 - AHARDWAREBUFFER_USAGE_VENDOR_13 = 144115188075855872 - AHARDWAREBUFFER_USAGE_VENDOR_14 = 288230376151711744 - AHARDWAREBUFFER_USAGE_VENDOR_15 = 576460752303423488 - AHARDWAREBUFFER_USAGE_VENDOR_16 = 1152921504606846976 - AHARDWAREBUFFER_USAGE_VENDOR_17 = 2305843009213693952 - AHARDWAREBUFFER_USAGE_VENDOR_18 = 4611686018427387904 - AHARDWAREBUFFER_USAGE_VENDOR_19 = -9223372036854775808 -) diff --git a/capi/hardwarebuffer/doc.go b/capi/hardwarebuffer/doc.go deleted file mode 100644 index 8f5055c..0000000 --- a/capi/hardwarebuffer/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android hardware buffer -*/ -package hardwarebuffer diff --git a/capi/hardwarebuffer/hardwarebuffer.go b/capi/hardwarebuffer/hardwarebuffer.go deleted file mode 100644 index cbda365..0000000 --- a/capi/hardwarebuffer/hardwarebuffer.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package hardwarebuffer - -/* -#cgo LDFLAGS: -lnativewindow -#include "android/hardware_buffer.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AHardwareBuffer_acquire(buffer *AHardwareBuffer) { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - C.AHardwareBuffer_acquire(cbuffer) - runtime.KeepAlive(cbufferAllocMap) -} - -func AHardwareBuffer_allocate(desc *AHardwareBuffer_Desc, outBuffer **AHardwareBuffer) int32 { - cdesc, cdescAllocMap := (*C.AHardwareBuffer_Desc)(unsafe.Pointer(desc)), cgoAllocsUnknown - coutBuffer, coutBufferAllocMap := (**C.AHardwareBuffer)(unsafe.Pointer(outBuffer)), cgoAllocsUnknown - var pinnercoutBuffer runtime.Pinner - pinnercoutBuffer.Pin(outBuffer) - if outBuffer != nil { - pinnercoutBuffer.Pin(unsafe.Pointer(*outBuffer)) - } - defer pinnercoutBuffer.Unpin() - __ret := C.AHardwareBuffer_allocate(cdesc, coutBuffer) - runtime.KeepAlive(coutBufferAllocMap) - runtime.KeepAlive(cdescAllocMap) - __v := (int32)(__ret) - return __v -} - -func AHardwareBuffer_describe(buffer *AHardwareBuffer, outDesc *AHardwareBuffer_Desc) { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - coutDesc, coutDescAllocMap := (*C.AHardwareBuffer_Desc)(unsafe.Pointer(outDesc)), cgoAllocsUnknown - C.AHardwareBuffer_describe(cbuffer, coutDesc) - runtime.KeepAlive(coutDescAllocMap) - runtime.KeepAlive(cbufferAllocMap) -} - -func AHardwareBuffer_getId(buffer *AHardwareBuffer, outId *uint64) int32 { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - coutId, coutIdAllocMap := (*C.uint64_t)(unsafe.Pointer(outId)), cgoAllocsUnknown - __ret := C.AHardwareBuffer_getId(cbuffer, coutId) - runtime.KeepAlive(coutIdAllocMap) - runtime.KeepAlive(cbufferAllocMap) - __v := (int32)(__ret) - return __v -} - -func AHardwareBuffer_isSupported(desc *AHardwareBuffer_Desc) int32 { - cdesc, cdescAllocMap := (*C.AHardwareBuffer_Desc)(unsafe.Pointer(desc)), cgoAllocsUnknown - __ret := C.AHardwareBuffer_isSupported(cdesc) - runtime.KeepAlive(cdescAllocMap) - __v := (int32)(__ret) - return __v -} - -func AHardwareBuffer_lock(buffer *AHardwareBuffer, usage uint64, fence int32, rect *ARect, outVirtualAddress *unsafe.Pointer) int32 { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cusage, cusageAllocMap := (C.uint64_t)(usage), cgoAllocsUnknown - cfence, cfenceAllocMap := (C.int)(fence), cgoAllocsUnknown - crect, crectAllocMap := (*C.ARect)(unsafe.Pointer(rect)), cgoAllocsUnknown - coutVirtualAddress, coutVirtualAddressAllocMap := outVirtualAddress, cgoAllocsUnknown - __ret := C.AHardwareBuffer_lock(cbuffer, cusage, cfence, crect, coutVirtualAddress) - runtime.KeepAlive(coutVirtualAddressAllocMap) - runtime.KeepAlive(crectAllocMap) - runtime.KeepAlive(cfenceAllocMap) - runtime.KeepAlive(cusageAllocMap) - runtime.KeepAlive(cbufferAllocMap) - __v := (int32)(__ret) - return __v -} - -func AHardwareBuffer_lockAndGetInfo(buffer *AHardwareBuffer, usage uint64, fence int32, rect *ARect, outVirtualAddress *unsafe.Pointer, outBytesPerPixel *int32, outBytesPerStride *int32) int32 { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cusage, cusageAllocMap := (C.uint64_t)(usage), cgoAllocsUnknown - cfence, cfenceAllocMap := (C.int)(fence), cgoAllocsUnknown - crect, crectAllocMap := (*C.ARect)(unsafe.Pointer(rect)), cgoAllocsUnknown - coutVirtualAddress, coutVirtualAddressAllocMap := outVirtualAddress, cgoAllocsUnknown - coutBytesPerPixel, coutBytesPerPixelAllocMap := (*C.int)(unsafe.Pointer(outBytesPerPixel)), cgoAllocsUnknown - coutBytesPerStride, coutBytesPerStrideAllocMap := (*C.int)(unsafe.Pointer(outBytesPerStride)), cgoAllocsUnknown - __ret := C.AHardwareBuffer_lockAndGetInfo(cbuffer, cusage, cfence, crect, coutVirtualAddress, coutBytesPerPixel, coutBytesPerStride) - runtime.KeepAlive(coutBytesPerStrideAllocMap) - runtime.KeepAlive(coutBytesPerPixelAllocMap) - runtime.KeepAlive(coutVirtualAddressAllocMap) - runtime.KeepAlive(crectAllocMap) - runtime.KeepAlive(cfenceAllocMap) - runtime.KeepAlive(cusageAllocMap) - runtime.KeepAlive(cbufferAllocMap) - __v := (int32)(__ret) - return __v -} - -func AHardwareBuffer_lockPlanes(buffer *AHardwareBuffer, usage uint64, fence int32, rect *ARect, outPlanes *AHardwareBuffer_Planes) int32 { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cusage, cusageAllocMap := (C.uint64_t)(usage), cgoAllocsUnknown - cfence, cfenceAllocMap := (C.int)(fence), cgoAllocsUnknown - crect, crectAllocMap := (*C.ARect)(unsafe.Pointer(rect)), cgoAllocsUnknown - coutPlanes, coutPlanesAllocMap := (*C.AHardwareBuffer_Planes)(unsafe.Pointer(outPlanes)), cgoAllocsUnknown - __ret := C.AHardwareBuffer_lockPlanes(cbuffer, cusage, cfence, crect, coutPlanes) - runtime.KeepAlive(coutPlanesAllocMap) - runtime.KeepAlive(crectAllocMap) - runtime.KeepAlive(cfenceAllocMap) - runtime.KeepAlive(cusageAllocMap) - runtime.KeepAlive(cbufferAllocMap) - __v := (int32)(__ret) - return __v -} - -func AHardwareBuffer_recvHandleFromUnixSocket(socketFd int32, outBuffer **AHardwareBuffer) int32 { - csocketFd, csocketFdAllocMap := (C.int)(socketFd), cgoAllocsUnknown - coutBuffer, coutBufferAllocMap := (**C.AHardwareBuffer)(unsafe.Pointer(outBuffer)), cgoAllocsUnknown - var pinnercoutBuffer runtime.Pinner - pinnercoutBuffer.Pin(outBuffer) - if outBuffer != nil { - pinnercoutBuffer.Pin(unsafe.Pointer(*outBuffer)) - } - defer pinnercoutBuffer.Unpin() - __ret := C.AHardwareBuffer_recvHandleFromUnixSocket(csocketFd, coutBuffer) - runtime.KeepAlive(coutBufferAllocMap) - runtime.KeepAlive(csocketFdAllocMap) - __v := (int32)(__ret) - return __v -} - -func AHardwareBuffer_release(buffer *AHardwareBuffer) { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - C.AHardwareBuffer_release(cbuffer) - runtime.KeepAlive(cbufferAllocMap) -} - -func AHardwareBuffer_sendHandleToUnixSocket(buffer *AHardwareBuffer, socketFd int32) int32 { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - csocketFd, csocketFdAllocMap := (C.int)(socketFd), cgoAllocsUnknown - __ret := C.AHardwareBuffer_sendHandleToUnixSocket(cbuffer, csocketFd) - runtime.KeepAlive(csocketFdAllocMap) - runtime.KeepAlive(cbufferAllocMap) - __v := (int32)(__ret) - return __v -} - -func AHardwareBuffer_unlock(buffer *AHardwareBuffer, fence *int32) int32 { - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cfence, cfenceAllocMap := (*C.int)(unsafe.Pointer(fence)), cgoAllocsUnknown - __ret := C.AHardwareBuffer_unlock(cbuffer, cfence) - runtime.KeepAlive(cfenceAllocMap) - runtime.KeepAlive(cbufferAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/hardwarebuffer/types.go b/capi/hardwarebuffer/types.go deleted file mode 100644 index e78b4f3..0000000 --- a/capi/hardwarebuffer/types.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package hardwarebuffer - -/* -#cgo LDFLAGS: -lnativewindow -#include "android/hardware_buffer.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AHardwareBuffer C.AHardwareBuffer - -type AHardwareBuffer_Desc C.AHardwareBuffer_Desc - -type AHardwareBuffer_Plane C.AHardwareBuffer_Plane - -type AHardwareBuffer_Planes C.AHardwareBuffer_Planes - -type ARect C.ARect diff --git a/capi/imagedecoder/cgo_helpers.c b/capi/imagedecoder/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/imagedecoder/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/imagedecoder/cgo_helpers.go b/capi/imagedecoder/cgo_helpers.go deleted file mode 100644 index c74174f..0000000 --- a/capi/imagedecoder/cgo_helpers.go +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package imagedecoder - -/* -#cgo LDFLAGS: -ljnigraphics -landroid -#include "android/imagedecoder.h" -#include "android/asset_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/imagedecoder/cgo_helpers.h b/capi/imagedecoder/cgo_helpers.h deleted file mode 100644 index 8e93607..0000000 --- a/capi/imagedecoder/cgo_helpers.h +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/imagedecoder.h" -#include "android/asset_manager.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/imagedecoder/const.go b/capi/imagedecoder/const.go deleted file mode 100644 index 6cb97cc..0000000 --- a/capi/imagedecoder/const.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package imagedecoder - -const ( - AASSET_MODE_UNKNOWN = 0 - AASSET_MODE_RANDOM = 1 - AASSET_MODE_STREAMING = 2 - AASSET_MODE_BUFFER = 3 -) - -const ( - ANDROID_IMAGE_DECODER_INFINITE = 2147483647 -) - -const ( - ANDROID_IMAGE_DECODER_SUCCESS = 0 - ANDROID_IMAGE_DECODER_INCOMPLETE = -1 - ANDROID_IMAGE_DECODER_ERROR = -2 - ANDROID_IMAGE_DECODER_INVALID_CONVERSION = -3 - ANDROID_IMAGE_DECODER_INVALID_SCALE = -4 - ANDROID_IMAGE_DECODER_BAD_PARAMETER = -5 - ANDROID_IMAGE_DECODER_INVALID_INPUT = -6 - ANDROID_IMAGE_DECODER_SEEK_ERROR = -7 - ANDROID_IMAGE_DECODER_INTERNAL_ERROR = -8 - ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT = -9 - ANDROID_IMAGE_DECODER_FINISHED = -10 - ANDROID_IMAGE_DECODER_INVALID_STATE = -11 -) - -const ( - ANDROID_IMAGE_DECODER_BLEND_OP_SRC = 1 - ANDROID_IMAGE_DECODER_BLEND_OP_SRC_OVER = 2 -) - -const ( - ANDROID_IMAGE_DECODER_DISPOSE_OP_NONE = 1 - ANDROID_IMAGE_DECODER_DISPOSE_OP_BACKGROUND = 2 - ANDROID_IMAGE_DECODER_DISPOSE_OP_PREVIOUS = 3 -) diff --git a/capi/imagedecoder/doc.go b/capi/imagedecoder/doc.go deleted file mode 100644 index 1d6cc1e..0000000 --- a/capi/imagedecoder/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Image Decoder -*/ -package imagedecoder diff --git a/capi/imagedecoder/imagedecoder.go b/capi/imagedecoder/imagedecoder.go deleted file mode 100644 index 73dbff6..0000000 --- a/capi/imagedecoder/imagedecoder.go +++ /dev/null @@ -1,485 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package imagedecoder - -/* -#cgo LDFLAGS: -ljnigraphics -landroid -#include "android/imagedecoder.h" -#include "android/asset_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AAssetDir_close(assetDir *AAssetDir) { - cassetDir, cassetDirAllocMap := (*C.AAssetDir)(unsafe.Pointer(assetDir)), cgoAllocsUnknown - C.AAssetDir_close(cassetDir) - runtime.KeepAlive(cassetDirAllocMap) -} - -func AAssetDir_getNextFileName(assetDir *AAssetDir) string { - cassetDir, cassetDirAllocMap := (*C.AAssetDir)(unsafe.Pointer(assetDir)), cgoAllocsUnknown - __ret := C.AAssetDir_getNextFileName(cassetDir) - runtime.KeepAlive(cassetDirAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AAssetDir_rewind(assetDir *AAssetDir) { - cassetDir, cassetDirAllocMap := (*C.AAssetDir)(unsafe.Pointer(assetDir)), cgoAllocsUnknown - C.AAssetDir_rewind(cassetDir) - runtime.KeepAlive(cassetDirAllocMap) -} - -func AAssetManager_open(mgr *AAssetManager, filename string, mode int32) *AAsset { - cmgr, cmgrAllocMap := (*C.AAssetManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - cfilename, cfilenameAllocMap := UnpackPCharString(filename) - cmode, cmodeAllocMap := (C.int)(mode), cgoAllocsUnknown - __ret := C.AAssetManager_open(cmgr, cfilename, cmode) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(cfilenameAllocMap) - runtime.KeepAlive(cmgrAllocMap) - __v := (*AAsset)(unsafe.Pointer(__ret)) - return __v -} - -func AAssetManager_openDir(mgr *AAssetManager, dirName string) *AAssetDir { - cmgr, cmgrAllocMap := (*C.AAssetManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - cdirName, cdirNameAllocMap := UnpackPCharString(dirName) - __ret := C.AAssetManager_openDir(cmgr, cdirName) - runtime.KeepAlive(cdirNameAllocMap) - runtime.KeepAlive(cmgrAllocMap) - __v := (*AAssetDir)(unsafe.Pointer(__ret)) - return __v -} - -func AAsset_close(asset *AAsset) { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - C.AAsset_close(casset) - runtime.KeepAlive(cassetAllocMap) -} - -func AAsset_getBuffer(asset *AAsset) unsafe.Pointer { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getBuffer(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (unsafe.Pointer)(__ret) - return __v -} - -func AAsset_getLength(asset *AAsset) Off_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getLength(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (Off_t)(__ret) - return __v -} - -func AAsset_getLength64(asset *AAsset) Off64_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getLength64(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (Off64_t)(__ret) - return __v -} - -func AAsset_getRemainingLength(asset *AAsset) Off_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getRemainingLength(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (Off_t)(__ret) - return __v -} - -func AAsset_getRemainingLength64(asset *AAsset) Off64_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_getRemainingLength64(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (Off64_t)(__ret) - return __v -} - -func AAsset_isAllocated(asset *AAsset) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - __ret := C.AAsset_isAllocated(casset) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAsset_openFileDescriptor(asset *AAsset, outStart *Off_t, outLength *Off_t) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coutStart, coutStartAllocMap := (*C.off_t)(unsafe.Pointer(outStart)), cgoAllocsUnknown - coutLength, coutLengthAllocMap := (*C.off_t)(unsafe.Pointer(outLength)), cgoAllocsUnknown - __ret := C.AAsset_openFileDescriptor(casset, coutStart, coutLength) - runtime.KeepAlive(coutLengthAllocMap) - runtime.KeepAlive(coutStartAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAsset_openFileDescriptor64(asset *AAsset, outStart *Off64_t, outLength *Off64_t) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coutStart, coutStartAllocMap := (*C.off64_t)(unsafe.Pointer(outStart)), cgoAllocsUnknown - coutLength, coutLengthAllocMap := (*C.off64_t)(unsafe.Pointer(outLength)), cgoAllocsUnknown - __ret := C.AAsset_openFileDescriptor64(casset, coutStart, coutLength) - runtime.KeepAlive(coutLengthAllocMap) - runtime.KeepAlive(coutStartAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAsset_read(asset *AAsset, buf unsafe.Pointer, count uint64) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - cbuf, cbufAllocMap := buf, cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint64_t)(count), cgoAllocsUnknown - __ret := C.AAsset_read(casset, cbuf, ccount) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(cbufAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AAsset_seek(asset *AAsset, offset Off_t, whence int32) Off_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.off_t)(offset), cgoAllocsUnknown - cwhence, cwhenceAllocMap := (C.int)(whence), cgoAllocsUnknown - __ret := C.AAsset_seek(casset, coffset, cwhence) - runtime.KeepAlive(cwhenceAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (Off_t)(__ret) - return __v -} - -func AAsset_seek64(asset *AAsset, offset Off64_t, whence int32) Off64_t { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.off64_t)(offset), cgoAllocsUnknown - cwhence, cwhenceAllocMap := (C.int)(whence), cgoAllocsUnknown - __ret := C.AAsset_seek64(casset, coffset, cwhence) - runtime.KeepAlive(cwhenceAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (Off64_t)(__ret) - return __v -} - -func AImageDecoderFrameInfo_create() *AImageDecoderFrameInfo { - __ret := C.AImageDecoderFrameInfo_create() - __v := (*AImageDecoderFrameInfo)(unsafe.Pointer(__ret)) - return __v -} - -func AImageDecoderFrameInfo_delete(info *AImageDecoderFrameInfo) { - cinfo, cinfoAllocMap := (*C.AImageDecoderFrameInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - C.AImageDecoderFrameInfo_delete(cinfo) - runtime.KeepAlive(cinfoAllocMap) -} - -func AImageDecoderFrameInfo_getBlendOp(info *AImageDecoderFrameInfo) int32 { - cinfo, cinfoAllocMap := (*C.AImageDecoderFrameInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AImageDecoderFrameInfo_getBlendOp(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoderFrameInfo_getDisposeOp(info *AImageDecoderFrameInfo) int32 { - cinfo, cinfoAllocMap := (*C.AImageDecoderFrameInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AImageDecoderFrameInfo_getDisposeOp(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoderFrameInfo_getDuration(info *AImageDecoderFrameInfo) int64 { - cinfo, cinfoAllocMap := (*C.AImageDecoderFrameInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AImageDecoderFrameInfo_getDuration(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (int64)(__ret) - return __v -} - -func AImageDecoderFrameInfo_getFrameRect(info *AImageDecoderFrameInfo) ARect { - cinfo, cinfoAllocMap := (*C.AImageDecoderFrameInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AImageDecoderFrameInfo_getFrameRect(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (ARect)(__ret) - return __v -} - -func AImageDecoderFrameInfo_hasAlphaWithinBounds(info *AImageDecoderFrameInfo) bool { - cinfo, cinfoAllocMap := (*C.AImageDecoderFrameInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AImageDecoderFrameInfo_hasAlphaWithinBounds(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (bool)(__ret) - return __v -} - -func AImageDecoderHeaderInfo_getAlphaFlags(p0 *AImageDecoderHeaderInfo) int32 { - cp0, cp0AllocMap := (*C.AImageDecoderHeaderInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AImageDecoderHeaderInfo_getAlphaFlags(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoderHeaderInfo_getAndroidBitmapFormat(p0 *AImageDecoderHeaderInfo) int32 { - cp0, cp0AllocMap := (*C.AImageDecoderHeaderInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AImageDecoderHeaderInfo_getAndroidBitmapFormat(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoderHeaderInfo_getDataSpace(p0 *AImageDecoderHeaderInfo) int32 { - cp0, cp0AllocMap := (*C.AImageDecoderHeaderInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AImageDecoderHeaderInfo_getDataSpace(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoderHeaderInfo_getHeight(p0 *AImageDecoderHeaderInfo) int32 { - cp0, cp0AllocMap := (*C.AImageDecoderHeaderInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AImageDecoderHeaderInfo_getHeight(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoderHeaderInfo_getMimeType(p0 *AImageDecoderHeaderInfo) string { - cp0, cp0AllocMap := (*C.AImageDecoderHeaderInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AImageDecoderHeaderInfo_getMimeType(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := C.GoString(__ret) - return __v -} - -func AImageDecoderHeaderInfo_getWidth(p0 *AImageDecoderHeaderInfo) int32 { - cp0, cp0AllocMap := (*C.AImageDecoderHeaderInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AImageDecoderHeaderInfo_getWidth(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_advanceFrame(decoder *AImageDecoder) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - __ret := C.AImageDecoder_advanceFrame(cdecoder) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_computeSampledSize(decoder *AImageDecoder, sampleSize int32, width *int32, height *int32) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - csampleSize, csampleSizeAllocMap := (C.int)(sampleSize), cgoAllocsUnknown - cwidth, cwidthAllocMap := (*C.int)(unsafe.Pointer(width)), cgoAllocsUnknown - cheight, cheightAllocMap := (*C.int)(unsafe.Pointer(height)), cgoAllocsUnknown - __ret := C.AImageDecoder_computeSampledSize(cdecoder, csampleSize, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(csampleSizeAllocMap) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_createFromAAsset(asset *AAsset, outDecoder **AImageDecoder) int32 { - casset, cassetAllocMap := (*C.AAsset)(unsafe.Pointer(asset)), cgoAllocsUnknown - coutDecoder, coutDecoderAllocMap := (**C.AImageDecoder)(unsafe.Pointer(outDecoder)), cgoAllocsUnknown - var pinnercoutDecoder runtime.Pinner - pinnercoutDecoder.Pin(outDecoder) - if outDecoder != nil { - pinnercoutDecoder.Pin(unsafe.Pointer(*outDecoder)) - } - defer pinnercoutDecoder.Unpin() - __ret := C.AImageDecoder_createFromAAsset(casset, coutDecoder) - runtime.KeepAlive(coutDecoderAllocMap) - runtime.KeepAlive(cassetAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_createFromBuffer(buffer unsafe.Pointer, length uint64, outDecoder **AImageDecoder) int32 { - cbuffer, cbufferAllocMap := buffer, cgoAllocsUnknown - clength, clengthAllocMap := (C.uint64_t)(length), cgoAllocsUnknown - coutDecoder, coutDecoderAllocMap := (**C.AImageDecoder)(unsafe.Pointer(outDecoder)), cgoAllocsUnknown - var pinnercoutDecoder runtime.Pinner - pinnercoutDecoder.Pin(outDecoder) - if outDecoder != nil { - pinnercoutDecoder.Pin(unsafe.Pointer(*outDecoder)) - } - defer pinnercoutDecoder.Unpin() - __ret := C.AImageDecoder_createFromBuffer(cbuffer, clength, coutDecoder) - runtime.KeepAlive(coutDecoderAllocMap) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufferAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_createFromFd(fd int32, outDecoder **AImageDecoder) int32 { - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - coutDecoder, coutDecoderAllocMap := (**C.AImageDecoder)(unsafe.Pointer(outDecoder)), cgoAllocsUnknown - var pinnercoutDecoder runtime.Pinner - pinnercoutDecoder.Pin(outDecoder) - if outDecoder != nil { - pinnercoutDecoder.Pin(unsafe.Pointer(*outDecoder)) - } - defer pinnercoutDecoder.Unpin() - __ret := C.AImageDecoder_createFromFd(cfd, coutDecoder) - runtime.KeepAlive(coutDecoderAllocMap) - runtime.KeepAlive(cfdAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_decodeImage(decoder *AImageDecoder, pixels unsafe.Pointer, stride uint64, size uint64) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - cpixels, cpixelsAllocMap := pixels, cgoAllocsUnknown - cstride, cstrideAllocMap := (C.uint64_t)(stride), cgoAllocsUnknown - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - __ret := C.AImageDecoder_decodeImage(cdecoder, cpixels, cstride, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cstrideAllocMap) - runtime.KeepAlive(cpixelsAllocMap) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_delete(decoder *AImageDecoder) { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - C.AImageDecoder_delete(cdecoder) - runtime.KeepAlive(cdecoderAllocMap) -} - -func AImageDecoder_getFrameInfo(decoder *AImageDecoder, info *AImageDecoderFrameInfo) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - cinfo, cinfoAllocMap := (*C.AImageDecoderFrameInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AImageDecoder_getFrameInfo(cdecoder, cinfo) - runtime.KeepAlive(cinfoAllocMap) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_getHeaderInfo(decoder *AImageDecoder) *AImageDecoderHeaderInfo { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - __ret := C.AImageDecoder_getHeaderInfo(cdecoder) - runtime.KeepAlive(cdecoderAllocMap) - __v := (*AImageDecoderHeaderInfo)(unsafe.Pointer(__ret)) - return __v -} - -func AImageDecoder_getMinimumStride(decoder *AImageDecoder) uint64 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - __ret := C.AImageDecoder_getMinimumStride(cdecoder) - runtime.KeepAlive(cdecoderAllocMap) - __v := (uint64)(__ret) - return __v -} - -func AImageDecoder_getRepeatCount(decoder *AImageDecoder) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - __ret := C.AImageDecoder_getRepeatCount(cdecoder) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_isAnimated(decoder *AImageDecoder) bool { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - __ret := C.AImageDecoder_isAnimated(cdecoder) - runtime.KeepAlive(cdecoderAllocMap) - __v := (bool)(__ret) - return __v -} - -func AImageDecoder_resultToString(p0 int32) string { - cp0, cp0AllocMap := (C.int)(p0), cgoAllocsUnknown - __ret := C.AImageDecoder_resultToString(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := C.GoString(__ret) - return __v -} - -func AImageDecoder_rewind(decoder *AImageDecoder) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - __ret := C.AImageDecoder_rewind(cdecoder) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_setAndroidBitmapFormat(decoder *AImageDecoder, format int32) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - cformat, cformatAllocMap := (C.int)(format), cgoAllocsUnknown - __ret := C.AImageDecoder_setAndroidBitmapFormat(cdecoder, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_setCrop(decoder *AImageDecoder, crop ARect) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - ccrop, ccropAllocMap := (C.ARect)(crop), cgoAllocsUnknown - __ret := C.AImageDecoder_setCrop(cdecoder, ccrop) - runtime.KeepAlive(ccropAllocMap) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_setDataSpace(decoder *AImageDecoder, dataspace int32) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - cdataspace, cdataspaceAllocMap := (C.int)(dataspace), cgoAllocsUnknown - __ret := C.AImageDecoder_setDataSpace(cdecoder, cdataspace) - runtime.KeepAlive(cdataspaceAllocMap) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_setInternallyHandleDisposePrevious(decoder *AImageDecoder, handleInternally bool) { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - chandleInternally, chandleInternallyAllocMap := (C._Bool)(handleInternally), cgoAllocsUnknown - C.AImageDecoder_setInternallyHandleDisposePrevious(cdecoder, chandleInternally) - runtime.KeepAlive(chandleInternallyAllocMap) - runtime.KeepAlive(cdecoderAllocMap) -} - -func AImageDecoder_setTargetSize(decoder *AImageDecoder, width int32, height int32) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - __ret := C.AImageDecoder_setTargetSize(cdecoder, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} - -func AImageDecoder_setUnpremultipliedRequired(decoder *AImageDecoder, unpremultipliedRequired bool) int32 { - cdecoder, cdecoderAllocMap := (*C.AImageDecoder)(unsafe.Pointer(decoder)), cgoAllocsUnknown - cunpremultipliedRequired, cunpremultipliedRequiredAllocMap := (C._Bool)(unpremultipliedRequired), cgoAllocsUnknown - __ret := C.AImageDecoder_setUnpremultipliedRequired(cdecoder, cunpremultipliedRequired) - runtime.KeepAlive(cunpremultipliedRequiredAllocMap) - runtime.KeepAlive(cdecoderAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/imagedecoder/types.go b/capi/imagedecoder/types.go deleted file mode 100644 index 0c9502e..0000000 --- a/capi/imagedecoder/types.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package imagedecoder - -/* -#cgo LDFLAGS: -ljnigraphics -landroid -#include "android/imagedecoder.h" -#include "android/asset_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AAsset C.AAsset - -type AAssetDir C.AAssetDir - -type AAssetManager C.AAssetManager - -type AImageDecoder C.AImageDecoder - -type AImageDecoderFrameInfo C.AImageDecoderFrameInfo - -type AImageDecoderHeaderInfo C.AImageDecoderHeaderInfo - -type ARect C.ARect - -type Off64_t C.off64_t - -type Off_t C.off_t diff --git a/capi/input/cgo_helpers.c b/capi/input/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/input/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/input/cgo_helpers.go b/capi/input/cgo_helpers.go deleted file mode 100644 index 9d3a37e..0000000 --- a/capi/input/cgo_helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package input - -/* -#cgo LDFLAGS: -landroid -#include "android/input.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} diff --git a/capi/input/cgo_helpers.h b/capi/input/cgo_helpers.h deleted file mode 100644 index b6347f4..0000000 --- a/capi/input/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/input.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/input/const.go b/capi/input/const.go deleted file mode 100644 index f833999..0000000 --- a/capi/input/const.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package input - -const ( - AINPUT_EVENT_TYPE_KEY = 1 - AINPUT_EVENT_TYPE_MOTION = 2 - AINPUT_EVENT_TYPE_FOCUS = 3 - AINPUT_EVENT_TYPE_CAPTURE = 4 - AINPUT_EVENT_TYPE_DRAG = 5 - AINPUT_EVENT_TYPE_TOUCH_MODE = 6 -) - -const ( - AINPUT_KEYBOARD_TYPE_NONE = 0 - AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1 - AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2 -) - -const ( - AINPUT_MOTION_RANGE_X = 0 - AINPUT_MOTION_RANGE_Y = 1 - AINPUT_MOTION_RANGE_PRESSURE = 2 - AINPUT_MOTION_RANGE_SIZE = 3 - AINPUT_MOTION_RANGE_TOUCH_MAJOR = 4 - AINPUT_MOTION_RANGE_TOUCH_MINOR = 5 - AINPUT_MOTION_RANGE_TOOL_MAJOR = 6 - AINPUT_MOTION_RANGE_TOOL_MINOR = 7 - AINPUT_MOTION_RANGE_ORIENTATION = 8 -) - -const ( - AINPUT_SOURCE_UNKNOWN = 0 - AINPUT_SOURCE_KEYBOARD = 257 - AINPUT_SOURCE_DPAD = 513 - AINPUT_SOURCE_GAMEPAD = 1025 - AINPUT_SOURCE_TOUCHSCREEN = 4098 - AINPUT_SOURCE_MOUSE = 8194 - AINPUT_SOURCE_STYLUS = 16386 - AINPUT_SOURCE_BLUETOOTH_STYLUS = 49154 - AINPUT_SOURCE_TRACKBALL = 65540 - AINPUT_SOURCE_MOUSE_RELATIVE = 131076 - AINPUT_SOURCE_TOUCHPAD = 1048584 - AINPUT_SOURCE_TOUCH_NAVIGATION = 2097152 - AINPUT_SOURCE_JOYSTICK = 16777232 - AINPUT_SOURCE_HDMI = 33554433 - AINPUT_SOURCE_SENSOR = 67108864 - AINPUT_SOURCE_ROTARY_ENCODER = 4194304 - AINPUT_SOURCE_ANY = -256 -) - -const ( - AINPUT_SOURCE_CLASS_MASK = 255 - AINPUT_SOURCE_CLASS_NONE = 0 - AINPUT_SOURCE_CLASS_BUTTON = 1 - AINPUT_SOURCE_CLASS_POINTER = 2 - AINPUT_SOURCE_CLASS_NAVIGATION = 4 - AINPUT_SOURCE_CLASS_POSITION = 8 - AINPUT_SOURCE_CLASS_JOYSTICK = 16 -) - -const ( - AKEY_EVENT_ACTION_DOWN = 0 - AKEY_EVENT_ACTION_UP = 1 - AKEY_EVENT_ACTION_MULTIPLE = 2 -) - -const ( - AKEY_EVENT_FLAG_WOKE_HERE = 1 - AKEY_EVENT_FLAG_SOFT_KEYBOARD = 2 - AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 4 - AKEY_EVENT_FLAG_FROM_SYSTEM = 8 - AKEY_EVENT_FLAG_EDITOR_ACTION = 16 - AKEY_EVENT_FLAG_CANCELED = 32 - AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 64 - AKEY_EVENT_FLAG_LONG_PRESS = 128 - AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 256 - AKEY_EVENT_FLAG_TRACKING = 512 - AKEY_EVENT_FLAG_FALLBACK = 1024 -) - -const ( - AKEY_STATE_UNKNOWN = -1 - AKEY_STATE_UP = 0 - AKEY_STATE_DOWN = 1 - AKEY_STATE_VIRTUAL = 2 -) - -const ( - AMETA_NONE = 0 - AMETA_ALT_ON = 2 - AMETA_ALT_LEFT_ON = 16 - AMETA_ALT_RIGHT_ON = 32 - AMETA_SHIFT_ON = 1 - AMETA_SHIFT_LEFT_ON = 64 - AMETA_SHIFT_RIGHT_ON = 128 - AMETA_SYM_ON = 4 - AMETA_FUNCTION_ON = 8 - AMETA_CTRL_ON = 4096 - AMETA_CTRL_LEFT_ON = 8192 - AMETA_CTRL_RIGHT_ON = 16384 - AMETA_META_ON = 65536 - AMETA_META_LEFT_ON = 131072 - AMETA_META_RIGHT_ON = 262144 - AMETA_CAPS_LOCK_ON = 1048576 - AMETA_NUM_LOCK_ON = 2097152 - AMETA_SCROLL_LOCK_ON = 4194304 -) - -const ( - AMOTION_EVENT_AXIS_X = 0 - AMOTION_EVENT_AXIS_Y = 1 - AMOTION_EVENT_AXIS_PRESSURE = 2 - AMOTION_EVENT_AXIS_SIZE = 3 - AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4 - AMOTION_EVENT_AXIS_TOUCH_MINOR = 5 - AMOTION_EVENT_AXIS_TOOL_MAJOR = 6 - AMOTION_EVENT_AXIS_TOOL_MINOR = 7 - AMOTION_EVENT_AXIS_ORIENTATION = 8 - AMOTION_EVENT_AXIS_VSCROLL = 9 - AMOTION_EVENT_AXIS_HSCROLL = 10 - AMOTION_EVENT_AXIS_Z = 11 - AMOTION_EVENT_AXIS_RX = 12 - AMOTION_EVENT_AXIS_RY = 13 - AMOTION_EVENT_AXIS_RZ = 14 - AMOTION_EVENT_AXIS_HAT_X = 15 - AMOTION_EVENT_AXIS_HAT_Y = 16 - AMOTION_EVENT_AXIS_LTRIGGER = 17 - AMOTION_EVENT_AXIS_RTRIGGER = 18 - AMOTION_EVENT_AXIS_THROTTLE = 19 - AMOTION_EVENT_AXIS_RUDDER = 20 - AMOTION_EVENT_AXIS_WHEEL = 21 - AMOTION_EVENT_AXIS_GAS = 22 - AMOTION_EVENT_AXIS_BRAKE = 23 - AMOTION_EVENT_AXIS_DISTANCE = 24 - AMOTION_EVENT_AXIS_TILT = 25 - AMOTION_EVENT_AXIS_SCROLL = 26 - AMOTION_EVENT_AXIS_RELATIVE_X = 27 - AMOTION_EVENT_AXIS_RELATIVE_Y = 28 - AMOTION_EVENT_AXIS_GENERIC_1 = 32 - AMOTION_EVENT_AXIS_GENERIC_2 = 33 - AMOTION_EVENT_AXIS_GENERIC_3 = 34 - AMOTION_EVENT_AXIS_GENERIC_4 = 35 - AMOTION_EVENT_AXIS_GENERIC_5 = 36 - AMOTION_EVENT_AXIS_GENERIC_6 = 37 - AMOTION_EVENT_AXIS_GENERIC_7 = 38 - AMOTION_EVENT_AXIS_GENERIC_8 = 39 - AMOTION_EVENT_AXIS_GENERIC_9 = 40 - AMOTION_EVENT_AXIS_GENERIC_10 = 41 - AMOTION_EVENT_AXIS_GENERIC_11 = 42 - AMOTION_EVENT_AXIS_GENERIC_12 = 43 - AMOTION_EVENT_AXIS_GENERIC_13 = 44 - AMOTION_EVENT_AXIS_GENERIC_14 = 45 - AMOTION_EVENT_AXIS_GENERIC_15 = 46 - AMOTION_EVENT_AXIS_GENERIC_16 = 47 - AMOTION_EVENT_AXIS_GESTURE_X_OFFSET = 48 - AMOTION_EVENT_AXIS_GESTURE_Y_OFFSET = 49 - AMOTION_EVENT_AXIS_GESTURE_SCROLL_X_DISTANCE = 50 - AMOTION_EVENT_AXIS_GESTURE_SCROLL_Y_DISTANCE = 51 - AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR = 52 - AMOTION_EVENT_AXIS_GESTURE_SWIPE_FINGER_COUNT = 53 - AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE = 53 -) - -const ( - AMOTION_EVENT_ACTION_MASK = 255 - AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 65280 - AMOTION_EVENT_ACTION_DOWN = 0 - AMOTION_EVENT_ACTION_UP = 1 - AMOTION_EVENT_ACTION_MOVE = 2 - AMOTION_EVENT_ACTION_CANCEL = 3 - AMOTION_EVENT_ACTION_OUTSIDE = 4 - AMOTION_EVENT_ACTION_POINTER_DOWN = 5 - AMOTION_EVENT_ACTION_POINTER_UP = 6 - AMOTION_EVENT_ACTION_HOVER_MOVE = 7 - AMOTION_EVENT_ACTION_SCROLL = 8 - AMOTION_EVENT_ACTION_HOVER_ENTER = 9 - AMOTION_EVENT_ACTION_HOVER_EXIT = 10 - AMOTION_EVENT_ACTION_BUTTON_PRESS = 11 - AMOTION_EVENT_ACTION_BUTTON_RELEASE = 12 -) - -const ( - AMOTION_EVENT_BUTTON_PRIMARY = 1 - AMOTION_EVENT_BUTTON_SECONDARY = 2 - AMOTION_EVENT_BUTTON_TERTIARY = 4 - AMOTION_EVENT_BUTTON_BACK = 8 - AMOTION_EVENT_BUTTON_FORWARD = 16 - AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 32 - AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 64 -) - -const ( - AMOTION_EVENT_EDGE_FLAG_NONE = 0 - AMOTION_EVENT_EDGE_FLAG_TOP = 1 - AMOTION_EVENT_EDGE_FLAG_BOTTOM = 2 - AMOTION_EVENT_EDGE_FLAG_LEFT = 4 - AMOTION_EVENT_EDGE_FLAG_RIGHT = 8 -) - -const ( - AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 1 -) - -const ( - AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0 - AMOTION_EVENT_TOOL_TYPE_FINGER = 1 - AMOTION_EVENT_TOOL_TYPE_STYLUS = 2 - AMOTION_EVENT_TOOL_TYPE_MOUSE = 3 - AMOTION_EVENT_TOOL_TYPE_ERASER = 4 - AMOTION_EVENT_TOOL_TYPE_PALM = 5 -) - -const ( - AMOTION_EVENT_CLASSIFICATION_NONE = 0 - AMOTION_EVENT_CLASSIFICATION_AMBIGUOUS_GESTURE = 1 - AMOTION_EVENT_CLASSIFICATION_DEEP_PRESS = 2 - AMOTION_EVENT_CLASSIFICATION_TWO_FINGER_SWIPE = 3 - AMOTION_EVENT_CLASSIFICATION_MULTI_FINGER_SWIPE = 4 - AMOTION_EVENT_CLASSIFICATION_PINCH = 5 -) diff --git a/capi/input/doc.go b/capi/input/doc.go deleted file mode 100644 index 5664abe..0000000 --- a/capi/input/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android input -*/ -package input diff --git a/capi/input/input.go b/capi/input/input.go deleted file mode 100644 index ea62486..0000000 --- a/capi/input/input.go +++ /dev/null @@ -1,634 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package input - -/* -#cgo LDFLAGS: -landroid -#include "android/input.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AInputEvent_getDeviceId(event *AInputEvent) int32 { - cevent, ceventAllocMap := (*C.AInputEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - __ret := C.AInputEvent_getDeviceId(cevent) - runtime.KeepAlive(ceventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AInputEvent_getSource(event *AInputEvent) int32 { - cevent, ceventAllocMap := (*C.AInputEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - __ret := C.AInputEvent_getSource(cevent) - runtime.KeepAlive(ceventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AInputEvent_getType(event *AInputEvent) int32 { - cevent, ceventAllocMap := (*C.AInputEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - __ret := C.AInputEvent_getType(cevent) - runtime.KeepAlive(ceventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AInputEvent_release(event *AInputEvent) { - cevent, ceventAllocMap := (*C.AInputEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - C.AInputEvent_release(cevent) - runtime.KeepAlive(ceventAllocMap) -} - -func AInputEvent_toJava(env *JNIEnv, aInputEvent *AInputEvent) Jobject { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - caInputEvent, caInputEventAllocMap := (*C.AInputEvent)(unsafe.Pointer(aInputEvent)), cgoAllocsUnknown - __ret := C.AInputEvent_toJava(cenv, caInputEvent) - runtime.KeepAlive(caInputEventAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (Jobject)(__ret) - return __v -} - -func AInputQueue_attachLooper(queue *AInputQueue, looper *ALooper, ident int32, callback ALooper_callbackFunc, data unsafe.Pointer) { - cqueue, cqueueAllocMap := (*C.AInputQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - clooper, clooperAllocMap := (*C.ALooper)(unsafe.Pointer(looper)), cgoAllocsUnknown - cident, cidentAllocMap := (C.int)(ident), cgoAllocsUnknown - ccallback, ccallbackAllocMap := (C.ALooper_callbackFunc)(callback), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.AInputQueue_attachLooper(cqueue, clooper, cident, ccallback, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cidentAllocMap) - runtime.KeepAlive(clooperAllocMap) - runtime.KeepAlive(cqueueAllocMap) -} - -func AInputQueue_detachLooper(queue *AInputQueue) { - cqueue, cqueueAllocMap := (*C.AInputQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - C.AInputQueue_detachLooper(cqueue) - runtime.KeepAlive(cqueueAllocMap) -} - -func AInputQueue_finishEvent(queue *AInputQueue, event *AInputEvent, handled int32) { - cqueue, cqueueAllocMap := (*C.AInputQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - cevent, ceventAllocMap := (*C.AInputEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - chandled, chandledAllocMap := (C.int)(handled), cgoAllocsUnknown - C.AInputQueue_finishEvent(cqueue, cevent, chandled) - runtime.KeepAlive(chandledAllocMap) - runtime.KeepAlive(ceventAllocMap) - runtime.KeepAlive(cqueueAllocMap) -} - -func AInputQueue_fromJava(env *JNIEnv, inputQueue Jobject) *AInputQueue { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - cinputQueue, cinputQueueAllocMap := (C.jobject)(inputQueue), cgoAllocsUnknown - __ret := C.AInputQueue_fromJava(cenv, cinputQueue) - runtime.KeepAlive(cinputQueueAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (*AInputQueue)(unsafe.Pointer(__ret)) - return __v -} - -func AInputQueue_getEvent(queue *AInputQueue, outEvent **AInputEvent) int32 { - cqueue, cqueueAllocMap := (*C.AInputQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - coutEvent, coutEventAllocMap := (**C.AInputEvent)(unsafe.Pointer(outEvent)), cgoAllocsUnknown - var pinnercoutEvent runtime.Pinner - pinnercoutEvent.Pin(outEvent) - if outEvent != nil { - pinnercoutEvent.Pin(unsafe.Pointer(*outEvent)) - } - defer pinnercoutEvent.Unpin() - __ret := C.AInputQueue_getEvent(cqueue, coutEvent) - runtime.KeepAlive(coutEventAllocMap) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func AInputQueue_hasEvents(queue *AInputQueue) int32 { - cqueue, cqueueAllocMap := (*C.AInputQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - __ret := C.AInputQueue_hasEvents(cqueue) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func AInputQueue_preDispatchEvent(queue *AInputQueue, event *AInputEvent) int32 { - cqueue, cqueueAllocMap := (*C.AInputQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - cevent, ceventAllocMap := (*C.AInputEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - __ret := C.AInputQueue_preDispatchEvent(cqueue, cevent) - runtime.KeepAlive(ceventAllocMap) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func AKeyEvent_fromJava(env *JNIEnv, keyEvent Jobject) *AInputEvent { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - ckeyEvent, ckeyEventAllocMap := (C.jobject)(keyEvent), cgoAllocsUnknown - __ret := C.AKeyEvent_fromJava(cenv, ckeyEvent) - runtime.KeepAlive(ckeyEventAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (*AInputEvent)(unsafe.Pointer(__ret)) - return __v -} - -func AKeyEvent_getAction(key_event *AInputEvent) int32 { - ckey_event, ckey_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(key_event)), cgoAllocsUnknown - __ret := C.AKeyEvent_getAction(ckey_event) - runtime.KeepAlive(ckey_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AKeyEvent_getDownTime(key_event *AInputEvent) int64 { - ckey_event, ckey_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(key_event)), cgoAllocsUnknown - __ret := C.AKeyEvent_getDownTime(ckey_event) - runtime.KeepAlive(ckey_eventAllocMap) - __v := (int64)(__ret) - return __v -} - -func AKeyEvent_getEventTime(key_event *AInputEvent) int64 { - ckey_event, ckey_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(key_event)), cgoAllocsUnknown - __ret := C.AKeyEvent_getEventTime(ckey_event) - runtime.KeepAlive(ckey_eventAllocMap) - __v := (int64)(__ret) - return __v -} - -func AKeyEvent_getFlags(key_event *AInputEvent) int32 { - ckey_event, ckey_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(key_event)), cgoAllocsUnknown - __ret := C.AKeyEvent_getFlags(ckey_event) - runtime.KeepAlive(ckey_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AKeyEvent_getKeyCode(key_event *AInputEvent) int32 { - ckey_event, ckey_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(key_event)), cgoAllocsUnknown - __ret := C.AKeyEvent_getKeyCode(ckey_event) - runtime.KeepAlive(ckey_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AKeyEvent_getMetaState(key_event *AInputEvent) int32 { - ckey_event, ckey_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(key_event)), cgoAllocsUnknown - __ret := C.AKeyEvent_getMetaState(ckey_event) - runtime.KeepAlive(ckey_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AKeyEvent_getRepeatCount(key_event *AInputEvent) int32 { - ckey_event, ckey_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(key_event)), cgoAllocsUnknown - __ret := C.AKeyEvent_getRepeatCount(ckey_event) - runtime.KeepAlive(ckey_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AKeyEvent_getScanCode(key_event *AInputEvent) int32 { - ckey_event, ckey_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(key_event)), cgoAllocsUnknown - __ret := C.AKeyEvent_getScanCode(ckey_event) - runtime.KeepAlive(ckey_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_fromJava(env *JNIEnv, motionEvent Jobject) *AInputEvent { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - cmotionEvent, cmotionEventAllocMap := (C.jobject)(motionEvent), cgoAllocsUnknown - __ret := C.AMotionEvent_fromJava(cenv, cmotionEvent) - runtime.KeepAlive(cmotionEventAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (*AInputEvent)(unsafe.Pointer(__ret)) - return __v -} - -func AMotionEvent_getAction(motion_event *AInputEvent) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getAction(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getActionButton(motion_event *AInputEvent) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getActionButton(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getAxisValue(motion_event *AInputEvent, axis int32, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - caxis, caxisAllocMap := (C.int)(axis), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getAxisValue(cmotion_event, caxis, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(caxisAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getButtonState(motion_event *AInputEvent) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getButtonState(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getClassification(motion_event *AInputEvent) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getClassification(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getDownTime(motion_event *AInputEvent) int64 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getDownTime(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int64)(__ret) - return __v -} - -func AMotionEvent_getEdgeFlags(motion_event *AInputEvent) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getEdgeFlags(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getEventTime(motion_event *AInputEvent) int64 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getEventTime(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int64)(__ret) - return __v -} - -func AMotionEvent_getFlags(motion_event *AInputEvent) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getFlags(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalAxisValue(motion_event *AInputEvent, axis int32, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - caxis, caxisAllocMap := (C.int)(axis), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalAxisValue(cmotion_event, caxis, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(caxisAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalEventTime(motion_event *AInputEvent, history_index uint64) int64 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalEventTime(cmotion_event, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int64)(__ret) - return __v -} - -func AMotionEvent_getHistoricalOrientation(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalOrientation(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalPressure(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalPressure(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalRawX(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalRawX(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalRawY(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalRawY(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalSize(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalSize(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalToolMajor(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalToolMajor(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalToolMinor(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalToolMinor(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalTouchMajor(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalTouchMajor(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalTouchMinor(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalTouchMinor(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalX(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalX(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistoricalY(motion_event *AInputEvent, pointer_index uint64, history_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - chistory_index, chistory_indexAllocMap := (C.uint64_t)(history_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistoricalY(cmotion_event, cpointer_index, chistory_index) - runtime.KeepAlive(chistory_indexAllocMap) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getHistorySize(motion_event *AInputEvent) uint64 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getHistorySize(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (uint64)(__ret) - return __v -} - -func AMotionEvent_getMetaState(motion_event *AInputEvent) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getMetaState(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getOrientation(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getOrientation(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getPointerCount(motion_event *AInputEvent) uint64 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getPointerCount(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (uint64)(__ret) - return __v -} - -func AMotionEvent_getPointerId(motion_event *AInputEvent, pointer_index uint64) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getPointerId(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getPressure(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getPressure(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getRawX(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getRawX(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getRawY(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getRawY(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getSize(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getSize(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getToolMajor(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getToolMajor(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getToolMinor(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getToolMinor(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getToolType(motion_event *AInputEvent, pointer_index uint64) int32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getToolType(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMotionEvent_getTouchMajor(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getTouchMajor(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getTouchMinor(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getTouchMinor(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getX(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getX(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getXOffset(motion_event *AInputEvent) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getXOffset(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getXPrecision(motion_event *AInputEvent) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getXPrecision(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getY(motion_event *AInputEvent, pointer_index uint64) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - cpointer_index, cpointer_indexAllocMap := (C.uint64_t)(pointer_index), cgoAllocsUnknown - __ret := C.AMotionEvent_getY(cmotion_event, cpointer_index) - runtime.KeepAlive(cpointer_indexAllocMap) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getYOffset(motion_event *AInputEvent) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getYOffset(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} - -func AMotionEvent_getYPrecision(motion_event *AInputEvent) float32 { - cmotion_event, cmotion_eventAllocMap := (*C.AInputEvent)(unsafe.Pointer(motion_event)), cgoAllocsUnknown - __ret := C.AMotionEvent_getYPrecision(cmotion_event) - runtime.KeepAlive(cmotion_eventAllocMap) - __v := (float32)(__ret) - return __v -} diff --git a/capi/input/types.go b/capi/input/types.go deleted file mode 100644 index e9e6012..0000000 --- a/capi/input/types.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package input - -/* -#cgo LDFLAGS: -landroid -#include "android/input.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AInputEvent C.AInputEvent - -type AInputQueue C.AInputQueue - -type ALooper C.ALooper - -type ALooper_callbackFunc C.ALooper_callbackFunc - -type JNIEnv C.JNIEnv - -type Jobject C.jobject diff --git a/capi/logging/cgo_helpers.c b/capi/logging/cgo_helpers.c deleted file mode 100644 index 3d7e01c..0000000 --- a/capi/logging/cgo_helpers.c +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void __android_aborter_function_6780bbf7(const char* abort_message) { - Android_aborter_function6780BBF7((char*)abort_message); -} - -void __android_logger_function_cb93890b(const struct __android_log_message* log_message) { - Android_logger_functionCB93890B((struct __android_log_message*)log_message); -} - diff --git a/capi/logging/cgo_helpers.go b/capi/logging/cgo_helpers.go deleted file mode 100644 index cc9d8e9..0000000 --- a/capi/logging/cgo_helpers.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package logging - -/* -#cgo LDFLAGS: -llog -#include "android/log.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x Android_aborter_function) PassRef() (ref *C.__android_aborter_function, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if android_aborter_function6780BBF7Func == nil { - android_aborter_function6780BBF7Func = x - } - return (*C.__android_aborter_function)(C.__android_aborter_function_6780bbf7), nil -} - -func (x Android_aborter_function) PassValue() (ref C.__android_aborter_function, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if android_aborter_function6780BBF7Func == nil { - android_aborter_function6780BBF7Func = x - } - return (C.__android_aborter_function)(C.__android_aborter_function_6780bbf7), nil -} - -func NewAndroid_aborter_functionRef(ref unsafe.Pointer) *Android_aborter_function { - return (*Android_aborter_function)(ref) -} - -//export Android_aborter_function6780BBF7 -func Android_aborter_function6780BBF7(cabort_message *C.char) { - if android_aborter_function6780BBF7Func != nil { - abort_message6780bbf7 := C.GoString(cabort_message) - android_aborter_function6780BBF7Func(abort_message6780bbf7) - return - } - panic("callback func has not been set (race?)") -} - -var android_aborter_function6780BBF7Func Android_aborter_function - -func (x Android_logger_function) PassRef() (ref *C.__android_logger_function, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if android_logger_functionCB93890BFunc == nil { - android_logger_functionCB93890BFunc = x - } - return (*C.__android_logger_function)(C.__android_logger_function_cb93890b), nil -} - -func (x Android_logger_function) PassValue() (ref C.__android_logger_function, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if android_logger_functionCB93890BFunc == nil { - android_logger_functionCB93890BFunc = x - } - return (C.__android_logger_function)(C.__android_logger_function_cb93890b), nil -} - -func NewAndroid_logger_functionRef(ref unsafe.Pointer) *Android_logger_function { - return (*Android_logger_function)(ref) -} - -//export Android_logger_functionCB93890B -func Android_logger_functionCB93890B(clog_message *C.struct___android_log_message) { - if android_logger_functionCB93890BFunc != nil { - log_messagecb93890b := (*Android_log_message)(unsafe.Pointer(clog_message)) - android_logger_functionCB93890BFunc(log_messagecb93890b) - return - } - panic("callback func has not been set (race?)") -} - -var android_logger_functionCB93890BFunc Android_logger_function - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/logging/cgo_helpers.h b/capi/logging/cgo_helpers.h deleted file mode 100644 index 32f4ea5..0000000 --- a/capi/logging/cgo_helpers.h +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/log.h" -#include -#pragma once - -#define __CGOGEN 1 - -// __android_aborter_function_6780bbf7 is a proxy for callback __android_aborter_function. -void __android_aborter_function_6780bbf7(const char* abort_message); - -// __android_logger_function_cb93890b is a proxy for callback __android_logger_function. -void __android_logger_function_cb93890b(const struct __android_log_message* log_message); - diff --git a/capi/logging/const.go b/capi/logging/const.go deleted file mode 100644 index 7431832..0000000 --- a/capi/logging/const.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package logging - -const ( - ANDROID_LOG_UNKNOWN Android_LogPriority = 0 - ANDROID_LOG_DEFAULT Android_LogPriority = 1 - ANDROID_LOG_VERBOSE Android_LogPriority = 2 - ANDROID_LOG_DEBUG Android_LogPriority = 3 - ANDROID_LOG_INFO Android_LogPriority = 4 - ANDROID_LOG_WARN Android_LogPriority = 5 - ANDROID_LOG_ERROR Android_LogPriority = 6 - ANDROID_LOG_FATAL Android_LogPriority = 7 - ANDROID_LOG_SILENT Android_LogPriority = 8 -) - -const ( - LOG_ID_MIN Log_id_t = 0 - LOG_ID_MAIN Log_id_t = 0 - LOG_ID_RADIO Log_id_t = 1 - LOG_ID_EVENTS Log_id_t = 2 - LOG_ID_SYSTEM Log_id_t = 3 - LOG_ID_CRASH Log_id_t = 4 - LOG_ID_STATS Log_id_t = 5 - LOG_ID_SECURITY Log_id_t = 6 - LOG_ID_KERNEL Log_id_t = 7 - LOG_ID_MAX Log_id_t = 8 - LOG_ID_DEFAULT Log_id_t = 2147483647 -) diff --git a/capi/logging/doc.go b/capi/logging/doc.go deleted file mode 100644 index dd3089f..0000000 --- a/capi/logging/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android logging -*/ -package logging diff --git a/capi/logging/logging.go b/capi/logging/logging.go deleted file mode 100644 index 00fb16f..0000000 --- a/capi/logging/logging.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package logging - -/* -#cgo LDFLAGS: -llog -#include "android/log.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func Android_log_buf_write(bufID int32, prio int32, tag string, text string) int32 { - cbufID, cbufIDAllocMap := (C.int)(bufID), cgoAllocsUnknown - cprio, cprioAllocMap := (C.int)(prio), cgoAllocsUnknown - ctag, ctagAllocMap := UnpackPCharString(tag) - ctext, ctextAllocMap := UnpackPCharString(text) - __ret := C.__android_log_buf_write(cbufID, cprio, ctag, ctext) - runtime.KeepAlive(ctextAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cprioAllocMap) - runtime.KeepAlive(cbufIDAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_log_call_aborter(abort_message string) { - cabort_message, cabort_messageAllocMap := UnpackPCharString(abort_message) - C.__android_log_call_aborter(cabort_message) - runtime.KeepAlive(cabort_messageAllocMap) -} - -func Android_log_default_aborter(abort_message string) { - cabort_message, cabort_messageAllocMap := UnpackPCharString(abort_message) - C.__android_log_default_aborter(cabort_message) - runtime.KeepAlive(cabort_messageAllocMap) -} - -func Android_log_get_minimum_priority() int32 { - __ret := C.__android_log_get_minimum_priority() - __v := (int32)(__ret) - return __v -} - -func Android_log_id_is_valid(id Log_id_t) bool { - cid, cidAllocMap := (C.log_id_t)(id), cgoAllocsUnknown - __ret := C.__android_log_id_is_valid(cid) - runtime.KeepAlive(cidAllocMap) - __v := (bool)(__ret) - return __v -} - -func Android_log_is_loggable(prio int32, tag string, default_prio int32) int32 { - cprio, cprioAllocMap := (C.int)(prio), cgoAllocsUnknown - ctag, ctagAllocMap := UnpackPCharString(tag) - cdefault_prio, cdefault_prioAllocMap := (C.int)(default_prio), cgoAllocsUnknown - __ret := C.__android_log_is_loggable(cprio, ctag, cdefault_prio) - runtime.KeepAlive(cdefault_prioAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cprioAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_log_is_loggable_len(prio int32, tag string, len uint64, default_prio int32) int32 { - cprio, cprioAllocMap := (C.int)(prio), cgoAllocsUnknown - ctag, ctagAllocMap := UnpackPCharString(tag) - clen, clenAllocMap := (C.uint64_t)(len), cgoAllocsUnknown - cdefault_prio, cdefault_prioAllocMap := (C.int)(default_prio), cgoAllocsUnknown - __ret := C.__android_log_is_loggable_len(cprio, ctag, clen, cdefault_prio) - runtime.KeepAlive(cdefault_prioAllocMap) - runtime.KeepAlive(clenAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cprioAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_log_logd_logger(log_message *Android_log_message) { - clog_message, clog_messageAllocMap := (*C.struct___android_log_message)(unsafe.Pointer(log_message)), cgoAllocsUnknown - C.__android_log_logd_logger(clog_message) - runtime.KeepAlive(clog_messageAllocMap) -} - -func Android_log_set_aborter(aborter Android_aborter_function) { - caborter, caborterAllocMap := aborter.PassValue() - C.__android_log_set_aborter(caborter) - runtime.KeepAlive(caborterAllocMap) -} - -func Android_log_set_default_tag(tag string) { - ctag, ctagAllocMap := UnpackPCharString(tag) - C.__android_log_set_default_tag(ctag) - runtime.KeepAlive(ctagAllocMap) -} - -func Android_log_set_logger(logger Android_logger_function) { - clogger, cloggerAllocMap := logger.PassValue() - C.__android_log_set_logger(clogger) - runtime.KeepAlive(cloggerAllocMap) -} - -func Android_log_set_minimum_priority(priority int32) int32 { - cpriority, cpriorityAllocMap := (C.int)(priority), cgoAllocsUnknown - __ret := C.__android_log_set_minimum_priority(cpriority) - runtime.KeepAlive(cpriorityAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_log_stderr_logger(log_message *Android_log_message) { - clog_message, clog_messageAllocMap := (*C.struct___android_log_message)(unsafe.Pointer(log_message)), cgoAllocsUnknown - C.__android_log_stderr_logger(clog_message) - runtime.KeepAlive(clog_messageAllocMap) -} - -func Android_log_write(prio int32, tag string, text string) int32 { - cprio, cprioAllocMap := (C.int)(prio), cgoAllocsUnknown - ctag, ctagAllocMap := UnpackPCharString(tag) - ctext, ctextAllocMap := UnpackPCharString(text) - __ret := C.__android_log_write(cprio, ctag, ctext) - runtime.KeepAlive(ctextAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(cprioAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_log_write_log_message(log_message *Android_log_message) { - clog_message, clog_messageAllocMap := (*C.struct___android_log_message)(unsafe.Pointer(log_message)), cgoAllocsUnknown - C.__android_log_write_log_message(clog_message) - runtime.KeepAlive(clog_messageAllocMap) -} diff --git a/capi/logging/types.go b/capi/logging/types.go deleted file mode 100644 index 90d64c3..0000000 --- a/capi/logging/types.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package logging - -/* -#cgo LDFLAGS: -llog -#include "android/log.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type Android_LogPriority int32 - -type Log_id_t int32 - -type Android_log_message C.struct___android_log_message - -type Android_aborter_function func(abort_message string) - -type Android_logger_function func(log_message *Android_log_message) diff --git a/capi/looper/cgo_helpers.c b/capi/looper/cgo_helpers.c deleted file mode 100644 index 0e2aeba..0000000 --- a/capi/looper/cgo_helpers.c +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -int ALooper_callbackFunc_e9f631a5(int fd, int events, void* data) { - return ALooper_callbackFuncE9F631A5(fd, events, data); -} - diff --git a/capi/looper/cgo_helpers.go b/capi/looper/cgo_helpers.go deleted file mode 100644 index 53ade85..0000000 --- a/capi/looper/cgo_helpers.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package looper - -/* -#cgo LDFLAGS: -landroid -#include "android/looper.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x ALooper_callbackFunc) PassRef() (ref *C.ALooper_callbackFunc, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aLooper_callbackFuncE9F631A5Func == nil { - aLooper_callbackFuncE9F631A5Func = x - } - return (*C.ALooper_callbackFunc)(C.ALooper_callbackFunc_e9f631a5), nil -} - -func (x ALooper_callbackFunc) PassValue() (ref C.ALooper_callbackFunc, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aLooper_callbackFuncE9F631A5Func == nil { - aLooper_callbackFuncE9F631A5Func = x - } - return (C.ALooper_callbackFunc)(C.ALooper_callbackFunc_e9f631a5), nil -} - -func NewALooper_callbackFuncRef(ref unsafe.Pointer) *ALooper_callbackFunc { - return (*ALooper_callbackFunc)(ref) -} - -//export ALooper_callbackFuncE9F631A5 -func ALooper_callbackFuncE9F631A5(cfd C.int, cevents C.int, cdata unsafe.Pointer) C.int { - if aLooper_callbackFuncE9F631A5Func != nil { - fde9f631a5 := (int32)(cfd) - eventse9f631a5 := (int32)(cevents) - datae9f631a5 := (unsafe.Pointer)(unsafe.Pointer(cdata)) - rete9f631a5 := aLooper_callbackFuncE9F631A5Func(fde9f631a5, eventse9f631a5, datae9f631a5) - ret, _ := (C.int)(rete9f631a5), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aLooper_callbackFuncE9F631A5Func ALooper_callbackFunc diff --git a/capi/looper/cgo_helpers.h b/capi/looper/cgo_helpers.h deleted file mode 100644 index 1963dc8..0000000 --- a/capi/looper/cgo_helpers.h +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/looper.h" -#include -#pragma once - -#define __CGOGEN 1 - -// ALooper_callbackFunc_e9f631a5 is a proxy for callback ALooper_callbackFunc. -int ALooper_callbackFunc_e9f631a5(int fd, int events, void* data); - diff --git a/capi/looper/const.go b/capi/looper/const.go deleted file mode 100644 index 4e143f9..0000000 --- a/capi/looper/const.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package looper - -const ( - ALOOPER_EVENT_INPUT = 1 - ALOOPER_EVENT_OUTPUT = 2 - ALOOPER_EVENT_ERROR = 4 - ALOOPER_EVENT_HANGUP = 8 - ALOOPER_EVENT_INVALID = 16 -) - -const ( - ALOOPER_POLL_WAKE = -1 - ALOOPER_POLL_CALLBACK = -2 - ALOOPER_POLL_TIMEOUT = -3 - ALOOPER_POLL_ERROR = -4 -) - -const ( - ALOOPER_PREPARE_ALLOW_NON_CALLBACKS = 1 -) diff --git a/capi/looper/doc.go b/capi/looper/doc.go deleted file mode 100644 index bb4dfec..0000000 --- a/capi/looper/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android looper -*/ -package looper diff --git a/capi/looper/looper.go b/capi/looper/looper.go deleted file mode 100644 index ffdb3bc..0000000 --- a/capi/looper/looper.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package looper - -/* -#cgo LDFLAGS: -landroid -#include "android/looper.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ALooper_acquire(looper *ALooper) { - clooper, clooperAllocMap := (*C.ALooper)(unsafe.Pointer(looper)), cgoAllocsUnknown - C.ALooper_acquire(clooper) - runtime.KeepAlive(clooperAllocMap) -} - -func ALooper_addFd(looper *ALooper, fd int32, ident int32, events int32, callback ALooper_callbackFunc, data unsafe.Pointer) int32 { - clooper, clooperAllocMap := (*C.ALooper)(unsafe.Pointer(looper)), cgoAllocsUnknown - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - cident, cidentAllocMap := (C.int)(ident), cgoAllocsUnknown - cevents, ceventsAllocMap := (C.int)(events), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - __ret := C.ALooper_addFd(clooper, cfd, cident, cevents, ccallback, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(ceventsAllocMap) - runtime.KeepAlive(cidentAllocMap) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(clooperAllocMap) - __v := (int32)(__ret) - return __v -} - -func ALooper_forThread() *ALooper { - __ret := C.ALooper_forThread() - __v := (*ALooper)(unsafe.Pointer(__ret)) - return __v -} - -func ALooper_pollOnce(timeoutMillis int32, outFd *int32, outEvents *int32, outData *unsafe.Pointer) int32 { - ctimeoutMillis, ctimeoutMillisAllocMap := (C.int)(timeoutMillis), cgoAllocsUnknown - coutFd, coutFdAllocMap := (*C.int)(unsafe.Pointer(outFd)), cgoAllocsUnknown - coutEvents, coutEventsAllocMap := (*C.int)(unsafe.Pointer(outEvents)), cgoAllocsUnknown - coutData, coutDataAllocMap := outData, cgoAllocsUnknown - __ret := C.ALooper_pollOnce(ctimeoutMillis, coutFd, coutEvents, coutData) - runtime.KeepAlive(coutDataAllocMap) - runtime.KeepAlive(coutEventsAllocMap) - runtime.KeepAlive(coutFdAllocMap) - runtime.KeepAlive(ctimeoutMillisAllocMap) - __v := (int32)(__ret) - return __v -} - -func ALooper_prepare(opts int32) *ALooper { - copts, coptsAllocMap := (C.int)(opts), cgoAllocsUnknown - __ret := C.ALooper_prepare(copts) - runtime.KeepAlive(coptsAllocMap) - __v := (*ALooper)(unsafe.Pointer(__ret)) - return __v -} - -func ALooper_release(looper *ALooper) { - clooper, clooperAllocMap := (*C.ALooper)(unsafe.Pointer(looper)), cgoAllocsUnknown - C.ALooper_release(clooper) - runtime.KeepAlive(clooperAllocMap) -} - -func ALooper_removeFd(looper *ALooper, fd int32) int32 { - clooper, clooperAllocMap := (*C.ALooper)(unsafe.Pointer(looper)), cgoAllocsUnknown - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - __ret := C.ALooper_removeFd(clooper, cfd) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(clooperAllocMap) - __v := (int32)(__ret) - return __v -} - -func ALooper_wake(looper *ALooper) { - clooper, clooperAllocMap := (*C.ALooper)(unsafe.Pointer(looper)), cgoAllocsUnknown - C.ALooper_wake(clooper) - runtime.KeepAlive(clooperAllocMap) -} diff --git a/capi/looper/types.go b/capi/looper/types.go deleted file mode 100644 index 566ccc8..0000000 --- a/capi/looper/types.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package looper - -/* -#cgo LDFLAGS: -landroid -#include "android/looper.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type ALooper C.ALooper - -type ALooper_callbackFunc func(fd int32, events int32, data unsafe.Pointer) int32 diff --git a/capi/manifests/.gen_egl_test_pp.h b/capi/manifests/.gen_egl_test_pp.h deleted file mode 100644 index 3ca32e5..0000000 --- a/capi/manifests/.gen_egl_test_pp.h +++ /dev/null @@ -1,191 +0,0 @@ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wc23-extensions" -#pragma clang diagnostic pop -int __system_property_get(const char* __name, char* __value); -int atoi(const char* __s) ; -static __inline__ int android_get_device_api_level() { - char value[92] = { 0 }; - if (__system_property_get("ro.build.version.sdk", value) < 1) return -1; - int api_level = atoi(value); - return (api_level > 0) ? api_level : -1; -} - - -typedef long int ptrdiff_t; -typedef long unsigned int size_t; -typedef int wchar_t; -typedef struct { - long long __clang_max_align_nonce1 - ; - long double __clang_max_align_nonce2 - ; -} max_align_t; - -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; -typedef long __intptr_t; -typedef unsigned long __uintptr_t; -typedef __int8_t int8_t; -typedef __uint8_t uint8_t; -typedef __int16_t int16_t; -typedef __uint16_t uint16_t; -typedef __int32_t int32_t; -typedef __uint32_t uint32_t; -typedef __int64_t int64_t; -typedef __uint64_t uint64_t; -typedef __intptr_t intptr_t; -typedef __uintptr_t uintptr_t; -typedef int8_t int_least8_t; -typedef uint8_t uint_least8_t; -typedef int16_t int_least16_t; -typedef uint16_t uint_least16_t; -typedef int32_t int_least32_t; -typedef uint32_t uint_least32_t; -typedef int64_t int_least64_t; -typedef uint64_t uint_least64_t; -typedef int8_t int_fast8_t; -typedef uint8_t uint_fast8_t; -typedef int64_t int_fast64_t; -typedef uint64_t uint_fast64_t; -typedef int64_t int_fast16_t; -typedef uint64_t uint_fast16_t; -typedef int64_t int_fast32_t; -typedef uint64_t uint_fast32_t; -typedef uint64_t uintmax_t; -typedef int64_t intmax_t; -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -typedef signed char khronos_int8_t; -typedef unsigned char khronos_uint8_t; -typedef signed short int khronos_int16_t; -typedef unsigned short int khronos_uint16_t; -typedef signed long int khronos_intptr_t; -typedef unsigned long int khronos_uintptr_t; -typedef signed long int khronos_ssize_t; -typedef unsigned long int khronos_usize_t; -typedef float khronos_float_t; -typedef khronos_uint64_t khronos_utime_nanoseconds_t; -typedef khronos_int64_t khronos_stime_nanoseconds_t; -typedef enum { - KHRONOS_FALSE = 0, - KHRONOS_TRUE = 1, - KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = 0x7FFFFFFF -} khronos_boolean_enum_t; -struct ANativeWindow; -struct egl_native_pixmap_t; -typedef void* EGLNativeDisplayType; -typedef struct egl_native_pixmap_t* EGLNativePixmapType; -typedef struct ANativeWindow* EGLNativeWindowType; -typedef EGLNativeDisplayType NativeDisplayType; -typedef EGLNativePixmapType NativePixmapType; -typedef EGLNativeWindowType NativeWindowType; -typedef khronos_int32_t EGLint; -typedef unsigned int EGLBoolean; -typedef void *EGLDisplay; -typedef void *EGLConfig; -typedef void *EGLSurface; -typedef void *EGLContext; -typedef void (*__eglMustCastToProperFunctionPointerType)(void); -typedef EGLBoolean (* PFNEGLCHOOSECONFIGPROC) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); -typedef EGLBoolean (* PFNEGLCOPYBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); -typedef EGLContext (* PFNEGLCREATECONTEXTPROC) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); -typedef EGLSurface (* PFNEGLCREATEPBUFFERSURFACEPROC) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); -typedef EGLSurface (* PFNEGLCREATEPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); -typedef EGLSurface (* PFNEGLCREATEWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); -typedef EGLBoolean (* PFNEGLDESTROYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx); -typedef EGLBoolean (* PFNEGLDESTROYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface); -typedef EGLBoolean (* PFNEGLGETCONFIGATTRIBPROC) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); -typedef EGLBoolean (* PFNEGLGETCONFIGSPROC) (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); -typedef EGLDisplay (* PFNEGLGETCURRENTDISPLAYPROC) (void); -typedef EGLSurface (* PFNEGLGETCURRENTSURFACEPROC) (EGLint readdraw); -typedef EGLDisplay (* PFNEGLGETDISPLAYPROC) (EGLNativeDisplayType display_id); -typedef EGLint (* PFNEGLGETERRORPROC) (void); -typedef __eglMustCastToProperFunctionPointerType (* PFNEGLGETPROCADDRESSPROC) (const char *procname); -typedef EGLBoolean (* PFNEGLINITIALIZEPROC) (EGLDisplay dpy, EGLint *major, EGLint *minor); -typedef EGLBoolean (* PFNEGLMAKECURRENTPROC) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); -typedef EGLBoolean (* PFNEGLQUERYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); -typedef const char *(* PFNEGLQUERYSTRINGPROC) (EGLDisplay dpy, EGLint name); -typedef EGLBoolean (* PFNEGLQUERYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); -typedef EGLBoolean (* PFNEGLSWAPBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface); -typedef EGLBoolean (* PFNEGLTERMINATEPROC) (EGLDisplay dpy); -typedef EGLBoolean (* PFNEGLWAITGLPROC) (void); -typedef EGLBoolean (* PFNEGLWAITNATIVEPROC) (EGLint engine); - EGLBoolean eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); - EGLBoolean eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); - EGLContext eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); - EGLSurface eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); - EGLSurface eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); - EGLSurface eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); - EGLBoolean eglDestroyContext (EGLDisplay dpy, EGLContext ctx); - EGLBoolean eglDestroySurface (EGLDisplay dpy, EGLSurface surface); - EGLBoolean eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); - EGLBoolean eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); - EGLDisplay eglGetCurrentDisplay (void); - EGLSurface eglGetCurrentSurface (EGLint readdraw); - EGLDisplay eglGetDisplay (EGLNativeDisplayType display_id); - EGLint eglGetError (void); - __eglMustCastToProperFunctionPointerType eglGetProcAddress (const char *procname); - EGLBoolean eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); - EGLBoolean eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); - EGLBoolean eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); - const char * eglQueryString (EGLDisplay dpy, EGLint name); - EGLBoolean eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); - EGLBoolean eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); - EGLBoolean eglTerminate (EGLDisplay dpy); - EGLBoolean eglWaitGL (void); - EGLBoolean eglWaitNative (EGLint engine); -typedef EGLBoolean (* PFNEGLBINDTEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer); -typedef EGLBoolean (* PFNEGLRELEASETEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer); -typedef EGLBoolean (* PFNEGLSURFACEATTRIBPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); -typedef EGLBoolean (* PFNEGLSWAPINTERVALPROC) (EGLDisplay dpy, EGLint interval); - EGLBoolean eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); - EGLBoolean eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); - EGLBoolean eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); - EGLBoolean eglSwapInterval (EGLDisplay dpy, EGLint interval); -typedef unsigned int EGLenum; -typedef void *EGLClientBuffer; -typedef EGLBoolean (* PFNEGLBINDAPIPROC) (EGLenum api); -typedef EGLenum (* PFNEGLQUERYAPIPROC) (void); -typedef EGLSurface (* PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); -typedef EGLBoolean (* PFNEGLRELEASETHREADPROC) (void); -typedef EGLBoolean (* PFNEGLWAITCLIENTPROC) (void); - EGLBoolean eglBindAPI (EGLenum api); - EGLenum eglQueryAPI (void); - EGLSurface eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); - EGLBoolean eglReleaseThread (void); - EGLBoolean eglWaitClient (void); -typedef EGLContext (* PFNEGLGETCURRENTCONTEXTPROC) (void); - EGLContext eglGetCurrentContext (void); -typedef void *EGLSync; -typedef intptr_t EGLAttrib; -typedef khronos_utime_nanoseconds_t EGLTime; -typedef void *EGLImage; -typedef EGLSync (* PFNEGLCREATESYNCPROC) (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); -typedef EGLBoolean (* PFNEGLDESTROYSYNCPROC) (EGLDisplay dpy, EGLSync sync); -typedef EGLint (* PFNEGLCLIENTWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); -typedef EGLBoolean (* PFNEGLGETSYNCATTRIBPROC) (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); -typedef EGLImage (* PFNEGLCREATEIMAGEPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); -typedef EGLBoolean (* PFNEGLDESTROYIMAGEPROC) (EGLDisplay dpy, EGLImage image); -typedef EGLDisplay (* PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); -typedef EGLSurface (* PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); -typedef EGLSurface (* PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); -typedef EGLBoolean (* PFNEGLWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags); - EGLSync eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); - EGLBoolean eglDestroySync (EGLDisplay dpy, EGLSync sync); - EGLint eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); - EGLBoolean eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); - EGLImage eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); - EGLBoolean eglDestroyImage (EGLDisplay dpy, EGLImage image); - EGLDisplay eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); - EGLSurface eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); - EGLSurface eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); - EGLBoolean eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); - diff --git a/capi/manifests/.gen_surfacecontrol_pp.h b/capi/manifests/.gen_surfacecontrol_pp.h deleted file mode 100644 index 91ee3ac..0000000 --- a/capi/manifests/.gen_surfacecontrol_pp.h +++ /dev/null @@ -1,533 +0,0 @@ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wc23-extensions" -#pragma clang diagnostic pop -int __system_property_get(const char* __name, char* __value); -int atoi(const char* __s) ; -static __inline__ int android_get_device_api_level() { - char value[92] = { 0 }; - if (__system_property_get("ro.build.version.sdk", value) < 1) return -1; - int api_level = atoi(value); - return (api_level > 0) ? api_level : -1; -} - -typedef long int ptrdiff_t; -typedef long unsigned int size_t; -typedef int wchar_t; -typedef struct { - long long __clang_max_align_nonce1 - ; - long double __clang_max_align_nonce2 - ; -} max_align_t; - -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; -typedef long __intptr_t; -typedef unsigned long __uintptr_t; -typedef __int8_t int8_t; -typedef __uint8_t uint8_t; -typedef __int16_t int16_t; -typedef __uint16_t uint16_t; -typedef __int32_t int32_t; -typedef __uint32_t uint32_t; -typedef __int64_t int64_t; -typedef __uint64_t uint64_t; -typedef __intptr_t intptr_t; -typedef __uintptr_t uintptr_t; -typedef int8_t int_least8_t; -typedef uint8_t uint_least8_t; -typedef int16_t int_least16_t; -typedef uint16_t uint_least16_t; -typedef int32_t int_least32_t; -typedef uint32_t uint_least32_t; -typedef int64_t int_least64_t; -typedef uint64_t uint_least64_t; -typedef int8_t int_fast8_t; -typedef uint8_t uint_fast8_t; -typedef int64_t int_fast64_t; -typedef uint64_t uint_fast64_t; -typedef int64_t int_fast16_t; -typedef uint64_t uint_fast16_t; -typedef int64_t int_fast32_t; -typedef uint64_t uint_fast32_t; -typedef uint64_t uintmax_t; -typedef int64_t intmax_t; -typedef struct { - intmax_t quot; - intmax_t rem; -} imaxdiv_t; -intmax_t imaxabs(intmax_t __i) ; -imaxdiv_t imaxdiv(intmax_t __numerator, intmax_t __denominator) ; -intmax_t strtoimax(const char* __s, char* * __end_ptr, int __base); -uintmax_t strtoumax(const char* __s, char* * __end_ptr, int __base); -intmax_t wcstoimax(const wchar_t* __s, wchar_t* * __end_ptr, int __base); -uintmax_t wcstoumax(const wchar_t* __s, wchar_t* * __end_ptr, int __base); -enum ADataSpace { - ADATASPACE_UNKNOWN = 0, - ADATASPACE_STANDARD_MASK = 63 << 16, - ADATASPACE_STANDARD_UNSPECIFIED = 0 << 16, - ADATASPACE_STANDARD_BT709 = 1 << 16, - ADATASPACE_STANDARD_BT601_625 = 2 << 16, - ADATASPACE_STANDARD_BT601_625_UNADJUSTED = 3 << 16, - ADATASPACE_STANDARD_BT601_525 = 4 << 16, - ADATASPACE_STANDARD_BT601_525_UNADJUSTED = 5 << 16, - ADATASPACE_STANDARD_BT2020 = 6 << 16, - ADATASPACE_STANDARD_BT2020_CONSTANT_LUMINANCE = 7 << 16, - ADATASPACE_STANDARD_BT470M = 8 << 16, - ADATASPACE_STANDARD_FILM = 9 << 16, - ADATASPACE_STANDARD_DCI_P3 = 10 << 16, - ADATASPACE_STANDARD_ADOBE_RGB = 11 << 16, - ADATASPACE_TRANSFER_MASK = 31 << 22, - ADATASPACE_TRANSFER_UNSPECIFIED = 0 << 22, - ADATASPACE_TRANSFER_LINEAR = 1 << 22, - ADATASPACE_TRANSFER_SRGB = 2 << 22, - ADATASPACE_TRANSFER_SMPTE_170M = 3 << 22, - ADATASPACE_TRANSFER_GAMMA2_2 = 4 << 22, - ADATASPACE_TRANSFER_GAMMA2_6 = 5 << 22, - ADATASPACE_TRANSFER_GAMMA2_8 = 6 << 22, - ADATASPACE_TRANSFER_ST2084 = 7 << 22, - ADATASPACE_TRANSFER_HLG = 8 << 22, - ADATASPACE_RANGE_MASK = 7 << 27, - ADATASPACE_RANGE_UNSPECIFIED = 0 << 27, - ADATASPACE_RANGE_FULL = 1 << 27, - ADATASPACE_RANGE_LIMITED = 2 << 27, - ADATASPACE_RANGE_EXTENDED = 3 << 27, - ADATASPACE_SCRGB_LINEAR = 406913024, - ADATASPACE_SRGB = 142671872, - ADATASPACE_SCRGB = 411107328, - ADATASPACE_DISPLAY_P3 = 143261696, - ADATASPACE_BT2020_PQ = 163971072, - ADATASPACE_BT2020_ITU_PQ = 298188800, - ADATASPACE_ADOBE_RGB = 151715840, - ADATASPACE_JFIF = 146931712, - ADATASPACE_BT601_625 = 281149440, - ADATASPACE_BT601_525 = 281280512, - ADATASPACE_BT2020 = 147193856, - ADATASPACE_BT709 = 281083904, - ADATASPACE_DCI_P3 = 155844608, - ADATASPACE_SRGB_LINEAR = 138477568, - ADATASPACE_BT2020_HLG = 168165376, - ADATASPACE_BT2020_ITU_HLG = 302383104, - ADATASPACE_DEPTH = 4096, - ADATASPACE_DYNAMIC_DEPTH = 4098, - STANDARD_MASK = ADATASPACE_STANDARD_MASK, - STANDARD_UNSPECIFIED = ADATASPACE_STANDARD_UNSPECIFIED, - STANDARD_BT709 = ADATASPACE_STANDARD_BT709, - STANDARD_BT601_625 = ADATASPACE_STANDARD_BT601_625, - STANDARD_BT601_625_UNADJUSTED = ADATASPACE_STANDARD_BT601_625_UNADJUSTED, - STANDARD_BT601_525 = ADATASPACE_STANDARD_BT601_525, - STANDARD_BT601_525_UNADJUSTED = ADATASPACE_STANDARD_BT601_525_UNADJUSTED, - STANDARD_BT470M = ADATASPACE_STANDARD_BT470M, - STANDARD_BT2020 = ADATASPACE_STANDARD_BT2020, - STANDARD_FILM = ADATASPACE_STANDARD_FILM, - STANDARD_DCI_P3 = ADATASPACE_STANDARD_DCI_P3, - STANDARD_ADOBE_RGB = ADATASPACE_STANDARD_ADOBE_RGB, - TRANSFER_MASK = ADATASPACE_TRANSFER_MASK, - TRANSFER_UNSPECIFIED = ADATASPACE_TRANSFER_UNSPECIFIED, - TRANSFER_LINEAR = ADATASPACE_TRANSFER_LINEAR, - TRANSFER_SMPTE_170M = ADATASPACE_TRANSFER_SMPTE_170M, - TRANSFER_GAMMA2_2 = ADATASPACE_TRANSFER_GAMMA2_2, - TRANSFER_GAMMA2_6 = ADATASPACE_TRANSFER_GAMMA2_6, - TRANSFER_GAMMA2_8 = ADATASPACE_TRANSFER_GAMMA2_8, - TRANSFER_SRGB = ADATASPACE_TRANSFER_SRGB, - TRANSFER_ST2084 = ADATASPACE_TRANSFER_ST2084, - TRANSFER_HLG = ADATASPACE_TRANSFER_HLG, - RANGE_MASK = ADATASPACE_RANGE_MASK, - RANGE_UNSPECIFIED = ADATASPACE_RANGE_UNSPECIFIED, - RANGE_FULL = ADATASPACE_RANGE_FULL, - RANGE_LIMITED = ADATASPACE_RANGE_LIMITED, - RANGE_EXTENDED = ADATASPACE_RANGE_EXTENDED, -}; -struct AChoreographer; -typedef struct AChoreographer AChoreographer; -typedef int64_t AVsyncId; -struct AChoreographerFrameCallbackData; -typedef struct AChoreographerFrameCallbackData AChoreographerFrameCallbackData; -typedef void (*AChoreographer_frameCallback)(long frameTimeNanos, void* data); -typedef void (*AChoreographer_frameCallback64)(int64_t frameTimeNanos, void* data); -typedef void (*AChoreographer_vsyncCallback)( - const AChoreographerFrameCallbackData* callbackData, void* data); -typedef void (*AChoreographer_refreshRateCallback)(int64_t vsyncPeriodNanos, void* data); -AChoreographer* AChoreographer_getInstance() ; -void AChoreographer_postFrameCallback(AChoreographer* choreographer, - AChoreographer_frameCallback callback, void* data) - ; -void AChoreographer_postFrameCallbackDelayed(AChoreographer* choreographer, - AChoreographer_frameCallback callback, void* data, - long delayMillis) - ; -void AChoreographer_postFrameCallback64(AChoreographer* choreographer, - AChoreographer_frameCallback64 callback, void* data) - ; -void AChoreographer_postFrameCallbackDelayed64(AChoreographer* choreographer, - AChoreographer_frameCallback64 callback, void* data, - uint32_t delayMillis) ; -void AChoreographer_postVsyncCallback(AChoreographer* choreographer, - AChoreographer_vsyncCallback callback, void* data) - ; -void AChoreographer_registerRefreshRateCallback(AChoreographer* choreographer, - AChoreographer_refreshRateCallback, void* data) - ; -void AChoreographer_unregisterRefreshRateCallback(AChoreographer* choreographer, - AChoreographer_refreshRateCallback, void* data) - ; -int64_t AChoreographerFrameCallbackData_getFrameTimeNanos( - const AChoreographerFrameCallbackData* data) ; -size_t AChoreographerFrameCallbackData_getFrameTimelinesLength( - const AChoreographerFrameCallbackData* data) ; -size_t AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex( - const AChoreographerFrameCallbackData* data) ; -AVsyncId AChoreographerFrameCallbackData_getFrameTimelineVsyncId( - const AChoreographerFrameCallbackData* data, size_t index) ; -int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos( - const AChoreographerFrameCallbackData* data, size_t index) ; -int64_t AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos( - const AChoreographerFrameCallbackData* data, size_t index) ; - -typedef struct ARect { - int32_t left; - int32_t top; - int32_t right; - int32_t bottom; -} ARect; -enum AHardwareBuffer_Format { - AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM = 1, - AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM = 2, - AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM = 3, - AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM = 4, - AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT = 0x16, - AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM = 0x2b, - AHARDWAREBUFFER_FORMAT_BLOB = 0x21, - AHARDWAREBUFFER_FORMAT_D16_UNORM = 0x30, - AHARDWAREBUFFER_FORMAT_D24_UNORM = 0x31, - AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT = 0x32, - AHARDWAREBUFFER_FORMAT_D32_FLOAT = 0x33, - AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT = 0x34, - AHARDWAREBUFFER_FORMAT_S8_UINT = 0x35, - AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 = 0x23, - AHARDWAREBUFFER_FORMAT_YCbCr_P010 = 0x36, - AHARDWAREBUFFER_FORMAT_YCbCr_P210 = 0x3c, - AHARDWAREBUFFER_FORMAT_R8_UNORM = 0x38, - AHARDWAREBUFFER_FORMAT_R16_UINT = 0x39, - AHARDWAREBUFFER_FORMAT_R16G16_UINT = 0x3a, - AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM = 0x3b, -}; -enum AHardwareBuffer_UsageFlags { - AHARDWAREBUFFER_USAGE_CPU_READ_NEVER = 0UL, - AHARDWAREBUFFER_USAGE_CPU_READ_RARELY = 2UL, - AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN = 3UL, - AHARDWAREBUFFER_USAGE_CPU_READ_MASK = 0xFUL, - AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER = 0UL << 4, - AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY = 2UL << 4, - AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN = 3UL << 4, - AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK = 0xFUL << 4, - AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE = 1UL << 8, - AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER = 1UL << 9, - AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT = AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER, - AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY = 1ULL << 11, - AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT = 1UL << 14, - AHARDWAREBUFFER_USAGE_VIDEO_ENCODE = 1UL << 16, - AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA = 1UL << 23, - AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER = 1UL << 24, - AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP = 1UL << 25, - AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE = 1UL << 26, - AHARDWAREBUFFER_USAGE_FRONT_BUFFER = 1ULL << 32, - AHARDWAREBUFFER_USAGE_VENDOR_0 = 1ULL << 28, - AHARDWAREBUFFER_USAGE_VENDOR_1 = 1ULL << 29, - AHARDWAREBUFFER_USAGE_VENDOR_2 = 1ULL << 30, - AHARDWAREBUFFER_USAGE_VENDOR_3 = 1ULL << 31, - AHARDWAREBUFFER_USAGE_VENDOR_4 = 1ULL << 48, - AHARDWAREBUFFER_USAGE_VENDOR_5 = 1ULL << 49, - AHARDWAREBUFFER_USAGE_VENDOR_6 = 1ULL << 50, - AHARDWAREBUFFER_USAGE_VENDOR_7 = 1ULL << 51, - AHARDWAREBUFFER_USAGE_VENDOR_8 = 1ULL << 52, - AHARDWAREBUFFER_USAGE_VENDOR_9 = 1ULL << 53, - AHARDWAREBUFFER_USAGE_VENDOR_10 = 1ULL << 54, - AHARDWAREBUFFER_USAGE_VENDOR_11 = 1ULL << 55, - AHARDWAREBUFFER_USAGE_VENDOR_12 = 1ULL << 56, - AHARDWAREBUFFER_USAGE_VENDOR_13 = 1ULL << 57, - AHARDWAREBUFFER_USAGE_VENDOR_14 = 1ULL << 58, - AHARDWAREBUFFER_USAGE_VENDOR_15 = 1ULL << 59, - AHARDWAREBUFFER_USAGE_VENDOR_16 = 1ULL << 60, - AHARDWAREBUFFER_USAGE_VENDOR_17 = 1ULL << 61, - AHARDWAREBUFFER_USAGE_VENDOR_18 = 1ULL << 62, - AHARDWAREBUFFER_USAGE_VENDOR_19 = 1ULL << 63, -}; -typedef struct AHardwareBuffer_Desc { - uint32_t width; - uint32_t height; - uint32_t layers; - uint32_t format; - uint64_t usage; - uint32_t stride; - uint32_t rfu0; - uint64_t rfu1; -} AHardwareBuffer_Desc; -typedef struct AHardwareBuffer_Plane { - void* data; - uint32_t pixelStride; - uint32_t rowStride; -} AHardwareBuffer_Plane; -typedef struct AHardwareBuffer_Planes { - uint32_t planeCount; - AHardwareBuffer_Plane planes[4]; -} AHardwareBuffer_Planes; -typedef struct AHardwareBuffer AHardwareBuffer; -int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc, - AHardwareBuffer* * outBuffer) ; -void AHardwareBuffer_acquire(AHardwareBuffer* buffer) ; -void AHardwareBuffer_release(AHardwareBuffer* buffer) ; -void AHardwareBuffer_describe(const AHardwareBuffer* buffer, - AHardwareBuffer_Desc* outDesc) ; -int AHardwareBuffer_lock(AHardwareBuffer* buffer, uint64_t usage, int32_t fence, - const ARect* rect, void* * outVirtualAddress) - ; -int AHardwareBuffer_unlock(AHardwareBuffer* buffer, int32_t* fence) - ; -int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int socketFd) - ; -int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, - AHardwareBuffer* * outBuffer) - ; -int AHardwareBuffer_lockPlanes(AHardwareBuffer* buffer, uint64_t usage, int32_t fence, - const ARect* rect, - AHardwareBuffer_Planes* outPlanes) ; -int AHardwareBuffer_isSupported(const AHardwareBuffer_Desc* desc) ; -int AHardwareBuffer_lockAndGetInfo(AHardwareBuffer* buffer, uint64_t usage, int32_t fence, - const ARect* rect, - void* * outVirtualAddress, - int32_t* outBytesPerPixel, - int32_t* outBytesPerStride) ; -int AHardwareBuffer_getId(const AHardwareBuffer* buffer, uint64_t* outId) - ; -enum AHdrMetadataType { - HDR10_SMPTE2086 = 1, - HDR10_CTA861_3 = 2, - HDR10PLUS_SEI = 3, -}; -struct AColor_xy { - float x; - float y; -}; -struct AHdrMetadata_smpte2086 { - struct AColor_xy displayPrimaryRed; - struct AColor_xy displayPrimaryGreen; - struct AColor_xy displayPrimaryBlue; - struct AColor_xy whitePoint; - float maxLuminance; - float minLuminance; -}; -struct AHdrMetadata_cta861_3 { - float maxContentLightLevel; - float maxFrameAverageLightLevel; -}; -enum ANativeWindow_LegacyFormat { - WINDOW_FORMAT_RGBA_8888 = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM, - WINDOW_FORMAT_RGBX_8888 = AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM, - WINDOW_FORMAT_RGB_565 = AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM, -}; -enum ANativeWindowTransform { - ANATIVEWINDOW_TRANSFORM_IDENTITY = 0x00, - ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL = 0x01, - ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL = 0x02, - ANATIVEWINDOW_TRANSFORM_ROTATE_90 = 0x04, - ANATIVEWINDOW_TRANSFORM_ROTATE_180 = ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL | - ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL, - ANATIVEWINDOW_TRANSFORM_ROTATE_270 = ANATIVEWINDOW_TRANSFORM_ROTATE_180 | - ANATIVEWINDOW_TRANSFORM_ROTATE_90, -}; -struct ANativeWindow; -typedef struct ANativeWindow ANativeWindow; -typedef struct ANativeWindow_Buffer { - int32_t width; - int32_t height; - int32_t stride; - int32_t format; - void* bits; - uint32_t reserved[6]; -} ANativeWindow_Buffer; -void ANativeWindow_acquire(ANativeWindow* window); -void ANativeWindow_release(ANativeWindow* window); -int32_t ANativeWindow_getWidth(ANativeWindow* window); -int32_t ANativeWindow_getHeight(ANativeWindow* window); -int32_t ANativeWindow_getFormat(ANativeWindow* window); -int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, - int32_t width, int32_t height, int32_t format); -int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer, - ARect* inOutDirtyBounds); -int32_t ANativeWindow_unlockAndPost(ANativeWindow* window); -int32_t ANativeWindow_setBuffersTransform(ANativeWindow* window, int32_t transform) ; -int32_t ANativeWindow_setBuffersDataSpace(ANativeWindow* window, int32_t dataSpace) ; -int32_t ANativeWindow_getBuffersDataSpace(ANativeWindow* window) ; -int32_t ANativeWindow_getBuffersDefaultDataSpace(ANativeWindow* window) ; -enum ANativeWindow_FrameRateCompatibility { - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT = 0, - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1 -}; -int32_t ANativeWindow_setFrameRate(ANativeWindow* window, float frameRate, int8_t compatibility) - ; -void ANativeWindow_tryAllocateBuffers(ANativeWindow* window) ; -enum ANativeWindow_ChangeFrameRateStrategy { - ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS = 0, - ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS = 1 -} ; -int32_t ANativeWindow_setFrameRateWithChangeStrategy(ANativeWindow* window, float frameRate, - int8_t compatibility, int8_t changeFrameRateStrategy) - ; -inline int32_t ANativeWindow_clearFrameRate(ANativeWindow* window) { - return ANativeWindow_setFrameRateWithChangeStrategy(window, 0, - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT, - ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS); -} -struct ASurfaceControl; -typedef struct ASurfaceControl ASurfaceControl; -ASurfaceControl* ASurfaceControl_createFromWindow(ANativeWindow* parent, - const char* debug_name) - ; -ASurfaceControl* ASurfaceControl_create(ASurfaceControl* parent, - const char* debug_name) - ; -void ASurfaceControl_acquire(ASurfaceControl* surface_control) ; -void ASurfaceControl_release(ASurfaceControl* surface_control) ; -struct ASurfaceTransaction; -typedef struct ASurfaceTransaction ASurfaceTransaction; -ASurfaceTransaction* ASurfaceTransaction_create() ; -void ASurfaceTransaction_delete(ASurfaceTransaction* transaction) ; -void ASurfaceTransaction_apply(ASurfaceTransaction* transaction) ; -typedef struct ASurfaceTransactionStats ASurfaceTransactionStats; -typedef void (*ASurfaceTransaction_OnComplete)(void* context, - ASurfaceTransactionStats* stats); -typedef void (*ASurfaceTransaction_OnCommit)(void* context, - ASurfaceTransactionStats* stats); -typedef void (*ASurfaceTransaction_OnBufferRelease)(void* context, - int release_fence_fd); -int64_t ASurfaceTransactionStats_getLatchTime( - ASurfaceTransactionStats* surface_transaction_stats) ; -int ASurfaceTransactionStats_getPresentFenceFd( - ASurfaceTransactionStats* surface_transaction_stats) ; -void ASurfaceTransactionStats_getASurfaceControls( - ASurfaceTransactionStats* surface_transaction_stats, - ASurfaceControl* * * outASurfaceControls, - size_t* outASurfaceControlsSize) ; -void ASurfaceTransactionStats_releaseASurfaceControls( - ASurfaceControl* * surface_controls) ; -int64_t ASurfaceTransactionStats_getAcquireTime( - ASurfaceTransactionStats* surface_transaction_stats, - ASurfaceControl* surface_control) ; -int ASurfaceTransactionStats_getPreviousReleaseFenceFd( - ASurfaceTransactionStats* surface_transaction_stats, - ASurfaceControl* surface_control) ; -void ASurfaceTransaction_setOnComplete(ASurfaceTransaction* transaction, - void* context, - ASurfaceTransaction_OnComplete func) - ; -void ASurfaceTransaction_setOnCommit(ASurfaceTransaction* transaction, - void* context, - ASurfaceTransaction_OnCommit func) - ; -void ASurfaceTransaction_reparent(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - ASurfaceControl* new_parent) ; -enum ASurfaceTransactionVisibility { - ASURFACE_TRANSACTION_VISIBILITY_HIDE = 0, - ASURFACE_TRANSACTION_VISIBILITY_SHOW = 1, -}; -void ASurfaceTransaction_setVisibility(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - enum ASurfaceTransactionVisibility visibility) - ; -void ASurfaceTransaction_setZOrder(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, int32_t z_order) - ; -void ASurfaceTransaction_setBuffer(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - AHardwareBuffer* buffer, int acquire_fence_fd) - ; -void ASurfaceTransaction_setBufferWithRelease(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - AHardwareBuffer* buffer, - int acquire_fence_fd, void* context, - ASurfaceTransaction_OnBufferRelease func) - ; -void ASurfaceTransaction_setColor(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, float r, float g, - float b, float alpha, enum ADataSpace dataspace) - ; -void ASurfaceTransaction_setGeometry(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - const ARect* source, - const ARect* destination, - int32_t transform) ; -void ASurfaceTransaction_setCrop(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - const ARect* crop) - ; -void ASurfaceTransaction_setPosition(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, int32_t x, - int32_t y) ; -void ASurfaceTransaction_setBufferTransform(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - int32_t transform) ; -void ASurfaceTransaction_setScale(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, float xScale, - float yScale) ; -enum ASurfaceTransactionTransparency { - ASURFACE_TRANSACTION_TRANSPARENCY_TRANSPARENT = 0, - ASURFACE_TRANSACTION_TRANSPARENCY_TRANSLUCENT = 1, - ASURFACE_TRANSACTION_TRANSPARENCY_OPAQUE = 2, -}; -void ASurfaceTransaction_setBufferTransparency(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - enum ASurfaceTransactionTransparency transparency) - ; -void ASurfaceTransaction_setDamageRegion(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - const ARect* rects, uint32_t count) - ; -void ASurfaceTransaction_setDesiredPresentTime(ASurfaceTransaction* transaction, - int64_t desiredPresentTime) ; -void ASurfaceTransaction_setBufferAlpha(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, float alpha) - ; -void ASurfaceTransaction_setBufferDataSpace(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - enum ADataSpace data_space) ; -void ASurfaceTransaction_setHdrMetadata_smpte2086(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - struct AHdrMetadata_smpte2086* metadata) - ; -void ASurfaceTransaction_setHdrMetadata_cta861_3(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - struct AHdrMetadata_cta861_3* metadata) - ; -void ASurfaceTransaction_setExtendedRangeBrightness(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - float currentBufferRatio, float desiredRatio) - ; -void ASurfaceTransaction_setDesiredHdrHeadroom(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - float desiredHeadroom) - ; -void ASurfaceTransaction_setFrameRate(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, float frameRate, - int8_t compatibility) ; -void ASurfaceTransaction_setFrameRateWithChangeStrategy(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - float frameRate, int8_t compatibility, - int8_t changeFrameRateStrategy) - ; -void ASurfaceTransaction_clearFrameRate(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control) - ; -void ASurfaceTransaction_setEnableBackPressure(ASurfaceTransaction* transaction, - ASurfaceControl* surface_control, - _Bool enableBackPressure) ; -void ASurfaceTransaction_setFrameTimeline(ASurfaceTransaction* transaction, - AVsyncId vsyncId) ; - diff --git a/capi/manifests/.gitkeep b/capi/manifests/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/capi/manifests/aaudio.yaml b/capi/manifests/aaudio.yaml deleted file mode 100644 index 5d37811..0000000 --- a/capi/manifests/aaudio.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: aaudio - PackageDescription: "Raw CGo bindings for Android AAudio" - PackageLicense: "Apache-2.0" - Includes: ["aaudio/AAudio.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-laaudio]} diff --git a/capi/manifests/android/looper.h b/capi/manifests/android/looper.h deleted file mode 100644 index 76df443..0000000 --- a/capi/manifests/android/looper.h +++ /dev/null @@ -1,28 +0,0 @@ -// Stub looper.h for c-for-go parser — provides forward declarations only. -#ifndef _ANDROID_LOOPER_H -#define _ANDROID_LOOPER_H - -typedef struct ALooper ALooper; -typedef int (*ALooper_callbackFunc)(int fd, int events, void* data); - -#define ALOOPER_POLL_WAKE 1 -#define ALOOPER_POLL_CALLBACK 2 -#define ALOOPER_POLL_TIMEOUT 3 -#define ALOOPER_POLL_ERROR 4 -#define ALOOPER_EVENT_INPUT 1 -#define ALOOPER_EVENT_OUTPUT 2 -#define ALOOPER_EVENT_ERROR 4 -#define ALOOPER_EVENT_HANGUP 8 -#define ALOOPER_EVENT_INVALID 16 - -ALooper* ALooper_forThread(void); -ALooper* ALooper_prepare(int opts); -void ALooper_acquire(ALooper* looper); -void ALooper_release(ALooper* looper); -int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData); -int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData); -void ALooper_wake(ALooper* looper); -int ALooper_addFd(ALooper* looper, int fd, int ident, int events, ALooper_callbackFunc callback, void* data); -int ALooper_removeFd(ALooper* looper, int fd); - -#endif diff --git a/capi/manifests/asset.yaml b/capi/manifests/asset.yaml deleted file mode 100644 index 46cb93c..0000000 --- a/capi/manifests/asset.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: asset - PackageDescription: "Raw CGo bindings for Android asset manager" - PackageLicense: "Apache-2.0" - Includes: ["android/asset_manager.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/binder.yaml b/capi/manifests/binder.yaml deleted file mode 100644 index e3737d5..0000000 --- a/capi/manifests/binder.yaml +++ /dev/null @@ -1,17 +0,0 @@ -GENERATOR: - PackageName: binder - PackageDescription: "Raw CGo bindings for Android Binder NDK" - PackageLicense: "Apache-2.0" - Includes: - - "android/binder_ibinder.h" - - "android/binder_parcel.h" - - "android/binder_status.h" - FlagGroups: - - {name: LDFLAGS, flags: [-lbinder_ndk]} -TRANSLATOR: - Rules: - global: - # API level 36 functions not available at API 35. - - {action: ignore, from: "^AIBinder_Class_getFunctionName$"} - - {action: ignore, from: "^AIBinder_Class_setTransactionCodeToFunctionNameMap$"} - - {action: accept, from: "."} diff --git a/capi/manifests/bitmap.yaml b/capi/manifests/bitmap.yaml deleted file mode 100644 index cfb4399..0000000 --- a/capi/manifests/bitmap.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: bitmap - PackageDescription: "Raw CGo bindings for Android Bitmap" - PackageLicense: "Apache-2.0" - Includes: ["android/bitmap.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-ljnigraphics]} diff --git a/capi/manifests/camera.yaml b/capi/manifests/camera.yaml deleted file mode 100644 index 9b98881..0000000 --- a/capi/manifests/camera.yaml +++ /dev/null @@ -1,13 +0,0 @@ -GENERATOR: - PackageName: camera - PackageDescription: "Raw CGo bindings for Android Camera2 NDK" - PackageLicense: "Apache-2.0" - Includes: - - "camera/NdkCameraManager.h" - - "camera/NdkCameraDevice.h" - - "camera/NdkCaptureRequest.h" - - "camera/NdkCameraCaptureSession.h" - - "camera/NdkCameraMetadata.h" - - "camera/NdkCameraMetadataTags.h" - FlagGroups: - - {name: LDFLAGS, flags: [-lcamera2ndk]} diff --git a/capi/manifests/choreographer.yaml b/capi/manifests/choreographer.yaml deleted file mode 100644 index cf56f5c..0000000 --- a/capi/manifests/choreographer.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: choreographer - PackageDescription: "Raw CGo bindings for Android choreographer" - PackageLicense: "Apache-2.0" - Includes: ["android/choreographer.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid, -lnativewindow]} diff --git a/capi/manifests/configuration.yaml b/capi/manifests/configuration.yaml deleted file mode 100644 index 192d277..0000000 --- a/capi/manifests/configuration.yaml +++ /dev/null @@ -1,9 +0,0 @@ -GENERATOR: - PackageName: configuration - PackageDescription: "Raw CGo bindings for Android configuration" - PackageLicense: "Apache-2.0" - Includes: ["android/configuration.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} - ExcludeFunctions: - - AConfiguration_setScreenRound diff --git a/capi/manifests/egl.yaml b/capi/manifests/egl.yaml deleted file mode 100644 index b001843..0000000 --- a/capi/manifests/egl.yaml +++ /dev/null @@ -1,9 +0,0 @@ -GENERATOR: - PackageName: egl - PackageDescription: "Raw CGo bindings for EGL" - PackageLicense: "Apache-2.0" - Includes: ["EGL/egl.h", "android/native_window.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-lEGL, -landroid, -lnativewindow]} - ExcludeFunctions: - - ANativeWindow_clearFrameRate diff --git a/capi/manifests/font.yaml b/capi/manifests/font.yaml deleted file mode 100644 index 89df1a4..0000000 --- a/capi/manifests/font.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: font - PackageDescription: "Raw CGo bindings for Android Font" - PackageLicense: "Apache-2.0" - Includes: ["android/font.h", "android/font_matcher.h", "android/system_fonts.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/gles2.yaml b/capi/manifests/gles2.yaml deleted file mode 100644 index e076e8d..0000000 --- a/capi/manifests/gles2.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: gles2 - PackageDescription: "Raw CGo bindings for OpenGL ES 2.0" - PackageLicense: "Apache-2.0" - Includes: ["GLES2/gl2.h", "GLES2/gl2ext.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-lGLESv2]} diff --git a/capi/manifests/gles3.yaml b/capi/manifests/gles3.yaml deleted file mode 100644 index cbbae79..0000000 --- a/capi/manifests/gles3.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: gles3 - PackageDescription: "Raw CGo bindings for OpenGL ES 3.0" - PackageLicense: "Apache-2.0" - Includes: ["GLES3/gl3.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-lGLESv3]} diff --git a/capi/manifests/hardwarebuffer.yaml b/capi/manifests/hardwarebuffer.yaml deleted file mode 100644 index 2b318f4..0000000 --- a/capi/manifests/hardwarebuffer.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: hardwarebuffer - PackageDescription: "Raw CGo bindings for Android hardware buffer" - PackageLicense: "Apache-2.0" - Includes: ["android/hardware_buffer.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-lnativewindow]} diff --git a/capi/manifests/imagedecoder.yaml b/capi/manifests/imagedecoder.yaml deleted file mode 100644 index 7e67358..0000000 --- a/capi/manifests/imagedecoder.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: imagedecoder - PackageDescription: "Raw CGo bindings for Android Image Decoder" - PackageLicense: "Apache-2.0" - Includes: ["android/imagedecoder.h", "android/asset_manager.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-ljnigraphics, -landroid]} diff --git a/capi/manifests/input.yaml b/capi/manifests/input.yaml deleted file mode 100644 index 739ab86..0000000 --- a/capi/manifests/input.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: input - PackageDescription: "Raw CGo bindings for Android input" - PackageLicense: "Apache-2.0" - Includes: ["android/input.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/logging.yaml b/capi/manifests/logging.yaml deleted file mode 100644 index ca4f6d6..0000000 --- a/capi/manifests/logging.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: logging - PackageDescription: "Raw CGo bindings for Android logging" - PackageLicense: "Apache-2.0" - Includes: ["android/log.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-llog]} diff --git a/capi/manifests/looper.yaml b/capi/manifests/looper.yaml deleted file mode 100644 index 21a69e5..0000000 --- a/capi/manifests/looper.yaml +++ /dev/null @@ -1,13 +0,0 @@ -GENERATOR: - PackageName: looper - PackageDescription: "Raw CGo bindings for Android looper" - PackageLicense: "Apache-2.0" - Includes: ["android/looper.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} -TRANSLATOR: - Rules: - global: - # Removed in API level 1 (__REMOVED_IN); use ALooper_pollOnce instead. - - {action: ignore, from: "^ALooper_pollAll$"} - - {action: accept, from: "."} diff --git a/capi/manifests/media.yaml b/capi/manifests/media.yaml deleted file mode 100644 index 05a1cc8..0000000 --- a/capi/manifests/media.yaml +++ /dev/null @@ -1,17 +0,0 @@ -GENERATOR: - PackageName: media - PackageDescription: "Raw CGo bindings for Android Media NDK" - PackageLicense: "Apache-2.0" - Includes: - - "media/NdkImage.h" - - "media/NdkImageReader.h" - - "media/NdkMediaCodec.h" - - "media/NdkMediaCodecInfo.h" - - "media/NdkMediaDataSource.h" - - "media/NdkMediaExtractor.h" - - "media/NdkMediaFormat.h" - - "media/NdkMediaMuxer.h" - - "media/NdkMediaDrm.h" - - "media/NdkMediaCrypto.h" - FlagGroups: - - {name: LDFLAGS, flags: ["-lmediandk"]} diff --git a/capi/manifests/midi.yaml b/capi/manifests/midi.yaml deleted file mode 100644 index c1d2017..0000000 --- a/capi/manifests/midi.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: midi - PackageDescription: "Raw CGo bindings for Android MIDI" - PackageLicense: "Apache-2.0" - Includes: ["amidi/AMidi.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-lamidi]} diff --git a/capi/manifests/multinetwork.yaml b/capi/manifests/multinetwork.yaml deleted file mode 100644 index 483bd0e..0000000 --- a/capi/manifests/multinetwork.yaml +++ /dev/null @@ -1,13 +0,0 @@ -GENERATOR: - PackageName: multinetwork - PackageDescription: "Raw CGo bindings for Android Multi-Network" - PackageLicense: "Apache-2.0" - Includes: ["android/multinetwork.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} -TRANSLATOR: - Rules: - global: - # References struct addrinfo from which is not included in the CGo preamble. - - {action: ignore, from: "^android_getaddrinfofornetwork$"} - - {action: accept, from: "."} diff --git a/capi/manifests/nativeactivity.yaml b/capi/manifests/nativeactivity.yaml deleted file mode 100644 index 99d6b07..0000000 --- a/capi/manifests/nativeactivity.yaml +++ /dev/null @@ -1,13 +0,0 @@ -GENERATOR: - PackageName: nativeactivity - PackageDescription: "Raw CGo bindings for Android NativeActivity" - PackageLicense: "Apache-2.0" - Includes: ["android/native_activity.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} -TRANSLATOR: - Rules: - global: - # Extern variable (user-implemented), not an NDK function to call. - - {action: ignore, from: "^ANativeActivity_onCreate$"} - - {action: accept, from: "."} diff --git a/capi/manifests/nativewindow.yaml b/capi/manifests/nativewindow.yaml deleted file mode 100644 index 74a552d..0000000 --- a/capi/manifests/nativewindow.yaml +++ /dev/null @@ -1,9 +0,0 @@ -GENERATOR: - PackageName: nativewindow - PackageDescription: "Raw CGo bindings for Android native window" - PackageLicense: "Apache-2.0" - Includes: ["android/native_window.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid, -lnativewindow]} - ExcludeFunctions: - - ANativeWindow_clearFrameRate diff --git a/capi/manifests/neuralnetworks.yaml b/capi/manifests/neuralnetworks.yaml deleted file mode 100644 index 13b2c3a..0000000 --- a/capi/manifests/neuralnetworks.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: neuralnetworks - PackageDescription: "Raw CGo bindings for Android Neural Networks" - PackageLicense: "Apache-2.0" - Includes: ["android/NeuralNetworks.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-lneuralnetworks]} diff --git a/capi/manifests/performancehint.yaml b/capi/manifests/performancehint.yaml deleted file mode 100644 index ef21814..0000000 --- a/capi/manifests/performancehint.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: performancehint - PackageDescription: "Raw CGo bindings for Android Performance Hint" - PackageLicense: "Apache-2.0" - Includes: ["android/performance_hint.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/permission.yaml b/capi/manifests/permission.yaml deleted file mode 100644 index ddd76cf..0000000 --- a/capi/manifests/permission.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: permission - PackageDescription: "Raw CGo bindings for Android Permission Manager" - PackageLicense: "Apache-2.0" - Includes: ["android/permission_manager.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/persistablebundle.yaml b/capi/manifests/persistablebundle.yaml deleted file mode 100644 index b2bb701..0000000 --- a/capi/manifests/persistablebundle.yaml +++ /dev/null @@ -1,12 +0,0 @@ -GENERATOR: - PackageName: persistablebundle - PackageDescription: "Raw CGo bindings for Android PersistableBundle NDK" - PackageLicense: "Apache-2.0" - Includes: - - "android/persistable_bundle.h" - FlagGroups: - - {name: LDFLAGS, flags: [-lbinder_ndk]} -TRANSLATOR: - Rules: - global: - - {action: accept, from: "."} diff --git a/capi/manifests/sensor.yaml b/capi/manifests/sensor.yaml deleted file mode 100644 index 4f91837..0000000 --- a/capi/manifests/sensor.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: sensor - PackageDescription: "Raw CGo bindings for Android sensor" - PackageLicense: "Apache-2.0" - Includes: ["android/sensor.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/sharedmem.yaml b/capi/manifests/sharedmem.yaml deleted file mode 100644 index cfd28e5..0000000 --- a/capi/manifests/sharedmem.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: sharedmem - PackageDescription: "Raw CGo bindings for Android Shared Memory" - PackageLicense: "Apache-2.0" - Includes: ["android/sharedmem.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/storage.yaml b/capi/manifests/storage.yaml deleted file mode 100644 index ccb678b..0000000 --- a/capi/manifests/storage.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: storage - PackageDescription: "Raw CGo bindings for Android Storage Manager" - PackageLicense: "Apache-2.0" - Includes: ["android/storage_manager.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/surfacecontrol.yaml b/capi/manifests/surfacecontrol.yaml deleted file mode 100644 index 8c64de8..0000000 --- a/capi/manifests/surfacecontrol.yaml +++ /dev/null @@ -1,23 +0,0 @@ -GENERATOR: - PackageName: surfacecontrol - PackageDescription: "Raw CGo bindings for Android SurfaceControl" - PackageLicense: "Apache-2.0" - Includes: ["android/surface_control.h", "android/hdr_metadata.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} -TRANSLATOR: - Rules: - global: - # API level 36 function not available at API 35. - - {action: ignore, from: "^ASurfaceTransaction_setBufferWithRelease$"} - # Functions with enum parameters that cause int32/uint32 type mismatches. - - {action: ignore, from: "^ASurfaceTransaction_setHdrMetadata_smpte2086$"} - - {action: ignore, from: "^ASurfaceTransaction_setHdrMetadata_cta861_3$"} - - {action: ignore, from: "^ASurfaceTransaction_setVisibility$"} - - {action: ignore, from: "^ASurfaceTransaction_setColor$"} - - {action: ignore, from: "^ASurfaceTransaction_setBufferTransparency$"} - - {action: ignore, from: "^ASurfaceTransaction_setBufferDataSpace$"} - # Triple-pointer parameters not supported by capigen. - - {action: ignore, from: "^ASurfaceTransactionStats_getASurfaceControls$"} - - {action: ignore, from: "^ASurfaceTransactionStats_releaseASurfaceControls$"} - - {action: accept, from: "."} diff --git a/capi/manifests/surfacetexture.yaml b/capi/manifests/surfacetexture.yaml deleted file mode 100644 index 9b2f645..0000000 --- a/capi/manifests/surfacetexture.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: surfacetexture - PackageDescription: "Raw CGo bindings for Android SurfaceTexture" - PackageLicense: "Apache-2.0" - Includes: ["android/surface_texture.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/sync.yaml b/capi/manifests/sync.yaml deleted file mode 100644 index 7c9c02f..0000000 --- a/capi/manifests/sync.yaml +++ /dev/null @@ -1,13 +0,0 @@ -GENERATOR: - PackageName: sync - PackageDescription: "Raw CGo bindings for Android Sync" - PackageLicense: "Apache-2.0" - Includes: ["android/sync.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-lsync]} -TRANSLATOR: - Rules: - global: - # Static inline function not callable from CGo. - - {action: ignore, from: "^sync_get_fence_info$"} - - {action: accept, from: "."} diff --git a/capi/manifests/thermal.yaml b/capi/manifests/thermal.yaml deleted file mode 100644 index b31a9fa..0000000 --- a/capi/manifests/thermal.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: thermal - PackageDescription: "Raw CGo bindings for Android thermal" - PackageLicense: "Apache-2.0" - Includes: ["android/thermal.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/trace.yaml b/capi/manifests/trace.yaml deleted file mode 100644 index 4b42dc7..0000000 --- a/capi/manifests/trace.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: trace - PackageDescription: "Raw CGo bindings for Android trace" - PackageLicense: "Apache-2.0" - Includes: ["android/trace.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-landroid]} diff --git a/capi/manifests/vulkan.yaml b/capi/manifests/vulkan.yaml deleted file mode 100644 index 9882ca6..0000000 --- a/capi/manifests/vulkan.yaml +++ /dev/null @@ -1,7 +0,0 @@ -GENERATOR: - PackageName: vulkan - PackageDescription: "Raw CGo bindings for Vulkan" - PackageLicense: "Apache-2.0" - Includes: ["vulkan/vulkan.h"] - FlagGroups: - - {name: LDFLAGS, flags: [-lvulkan]} diff --git a/capi/media/cgo_helpers.c b/capi/media/cgo_helpers.c deleted file mode 100644 index 1d83f83..0000000 --- a/capi/media/cgo_helpers.c +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void AImageReader_BufferRemovedCallback_b28d8959(void* context, AImageReader* reader, AHardwareBuffer* buffer) { - AImageReader_BufferRemovedCallbackB28D8959(context, reader, buffer); -} - -void AImageReader_ImageCallback_32cdd235(void* context, AImageReader* reader) { - AImageReader_ImageCallback32CDD235(context, reader); -} - -void AMediaCodecOnAsyncError_f1342a37(AMediaCodec* codec, void* userdata, media_status_t _error, int32_t actionCode, const char* detail) { - AMediaCodecOnAsyncErrorF1342A37(codec, userdata, _error, actionCode, (char*)detail); -} - -void AMediaCodecOnAsyncFormatChanged_3dabd828(AMediaCodec* codec, void* userdata, AMediaFormat* format) { - AMediaCodecOnAsyncFormatChanged3DABD828(codec, userdata, format); -} - -void AMediaCodecOnAsyncInputAvailable_2f5096c4(AMediaCodec* codec, void* userdata, int32_t index) { - AMediaCodecOnAsyncInputAvailable2F5096C4(codec, userdata, index); -} - -void AMediaCodecOnAsyncOutputAvailable_f41b4c39(AMediaCodec* codec, void* userdata, int32_t index, AMediaCodecBufferInfo* bufferInfo) { - AMediaCodecOnAsyncOutputAvailableF41B4C39(codec, userdata, index, bufferInfo); -} - -void AMediaCodecOnFrameRendered_61af0881(AMediaCodec* codec, void* userdata, int64_t mediaTimeUs, int64_t systemNano) { - AMediaCodecOnFrameRendered61AF0881(codec, userdata, mediaTimeUs, systemNano); -} - -void AMediaDataSourceClose_06c40935(void* userdata) { - AMediaDataSourceClose06C40935(userdata); -} - -int64_t AMediaDataSourceGetAvailableSize_40cc3318(void* userdata, off64_t offset) { - return AMediaDataSourceGetAvailableSize40CC3318(userdata, offset); -} - -int64_t AMediaDataSourceGetSize_e0220813(void* userdata) { - return AMediaDataSourceGetSizeE0220813(userdata); -} - -int64_t AMediaDataSourceReadAt_865c1a4b(void* userdata, off64_t offset, void* buffer, size_t size) { - return AMediaDataSourceReadAt865C1A4B(userdata, offset, buffer, size); -} - -void AMediaDrmEventListener_76bb5445(AMediaDrm* p0, const AMediaDrmSessionId* sessionId, AMediaDrmEventType eventType, int extra, const uint8_t* data, size_t dataSize) { - AMediaDrmEventListener76BB5445(p0, (AMediaDrmSessionId*)sessionId, eventType, extra, (uint8_t*)data, dataSize); -} - -void AMediaDrmExpirationUpdateListener_ec3b27d6(AMediaDrm* p0, const AMediaDrmSessionId* sessionId, int64_t expiryTimeInMS) { - AMediaDrmExpirationUpdateListenerEC3B27D6(p0, (AMediaDrmSessionId*)sessionId, expiryTimeInMS); -} - -void AMediaDrmKeysChangeListener_fd05e34a(AMediaDrm* p0, const AMediaDrmSessionId* sessionId, const AMediaDrmKeyStatus* keyStatus, size_t numKeys, bool hasNewUsableKey) { - AMediaDrmKeysChangeListenerFD05E34A(p0, (AMediaDrmSessionId*)sessionId, (AMediaDrmKeyStatus*)keyStatus, numKeys, hasNewUsableKey); -} - diff --git a/capi/media/cgo_helpers.go b/capi/media/cgo_helpers.go deleted file mode 100644 index 0380361..0000000 --- a/capi/media/cgo_helpers.go +++ /dev/null @@ -1,632 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package media - -/* -#cgo LDFLAGS: -lmediandk -#include "media/NdkImage.h" -#include "media/NdkImageReader.h" -#include "media/NdkMediaCodec.h" -#include "media/NdkMediaCodecInfo.h" -#include "media/NdkMediaDataSource.h" -#include "media/NdkMediaExtractor.h" -#include "media/NdkMediaFormat.h" -#include "media/NdkMediaMuxer.h" -#include "media/NdkMediaDrm.h" -#include "media/NdkMediaCrypto.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x AImageReader_BufferRemovedCallback) PassRef() (ref *C.AImageReader_BufferRemovedCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aImageReader_BufferRemovedCallbackB28D8959Func == nil { - aImageReader_BufferRemovedCallbackB28D8959Func = x - } - return (*C.AImageReader_BufferRemovedCallback)(C.AImageReader_BufferRemovedCallback_b28d8959), nil -} - -func (x AImageReader_BufferRemovedCallback) PassValue() (ref C.AImageReader_BufferRemovedCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aImageReader_BufferRemovedCallbackB28D8959Func == nil { - aImageReader_BufferRemovedCallbackB28D8959Func = x - } - return (C.AImageReader_BufferRemovedCallback)(C.AImageReader_BufferRemovedCallback_b28d8959), nil -} - -func NewAImageReader_BufferRemovedCallbackRef(ref unsafe.Pointer) *AImageReader_BufferRemovedCallback { - return (*AImageReader_BufferRemovedCallback)(ref) -} - -//export AImageReader_BufferRemovedCallbackB28D8959 -func AImageReader_BufferRemovedCallbackB28D8959(ccontext unsafe.Pointer, creader *C.AImageReader, cbuffer *C.AHardwareBuffer) { - if aImageReader_BufferRemovedCallbackB28D8959Func != nil { - contextb28d8959 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - readerb28d8959 := (*AImageReader)(unsafe.Pointer(creader)) - bufferb28d8959 := (*AHardwareBuffer)(unsafe.Pointer(cbuffer)) - aImageReader_BufferRemovedCallbackB28D8959Func(contextb28d8959, readerb28d8959, bufferb28d8959) - return - } - panic("callback func has not been set (race?)") -} - -var aImageReader_BufferRemovedCallbackB28D8959Func AImageReader_BufferRemovedCallback - -func (x AImageReader_ImageCallback) PassRef() (ref *C.AImageReader_ImageCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aImageReader_ImageCallback32CDD235Func == nil { - aImageReader_ImageCallback32CDD235Func = x - } - return (*C.AImageReader_ImageCallback)(C.AImageReader_ImageCallback_32cdd235), nil -} - -func (x AImageReader_ImageCallback) PassValue() (ref C.AImageReader_ImageCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aImageReader_ImageCallback32CDD235Func == nil { - aImageReader_ImageCallback32CDD235Func = x - } - return (C.AImageReader_ImageCallback)(C.AImageReader_ImageCallback_32cdd235), nil -} - -func NewAImageReader_ImageCallbackRef(ref unsafe.Pointer) *AImageReader_ImageCallback { - return (*AImageReader_ImageCallback)(ref) -} - -//export AImageReader_ImageCallback32CDD235 -func AImageReader_ImageCallback32CDD235(ccontext unsafe.Pointer, creader *C.AImageReader) { - if aImageReader_ImageCallback32CDD235Func != nil { - context32cdd235 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - reader32cdd235 := (*AImageReader)(unsafe.Pointer(creader)) - aImageReader_ImageCallback32CDD235Func(context32cdd235, reader32cdd235) - return - } - panic("callback func has not been set (race?)") -} - -var aImageReader_ImageCallback32CDD235Func AImageReader_ImageCallback - -func (x AMediaCodecOnAsyncError) PassRef() (ref *C.AMediaCodecOnAsyncError, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnAsyncErrorF1342A37Func == nil { - aMediaCodecOnAsyncErrorF1342A37Func = x - } - return (*C.AMediaCodecOnAsyncError)(C.AMediaCodecOnAsyncError_f1342a37), nil -} - -func (x AMediaCodecOnAsyncError) PassValue() (ref C.AMediaCodecOnAsyncError, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnAsyncErrorF1342A37Func == nil { - aMediaCodecOnAsyncErrorF1342A37Func = x - } - return (C.AMediaCodecOnAsyncError)(C.AMediaCodecOnAsyncError_f1342a37), nil -} - -func NewAMediaCodecOnAsyncErrorRef(ref unsafe.Pointer) *AMediaCodecOnAsyncError { - return (*AMediaCodecOnAsyncError)(ref) -} - -//export AMediaCodecOnAsyncErrorF1342A37 -func AMediaCodecOnAsyncErrorF1342A37(ccodec *C.AMediaCodec, cuserdata unsafe.Pointer, c_error C.media_status_t, cactionCode C.int32_t, cdetail *C.char) { - if aMediaCodecOnAsyncErrorF1342A37Func != nil { - codecf1342a37 := (*AMediaCodec)(unsafe.Pointer(ccodec)) - userdataf1342a37 := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - _errorf1342a37 := (Media_status_t)(c_error) - actionCodef1342a37 := (int32)(cactionCode) - detailf1342a37 := C.GoString(cdetail) - aMediaCodecOnAsyncErrorF1342A37Func(codecf1342a37, userdataf1342a37, _errorf1342a37, actionCodef1342a37, detailf1342a37) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaCodecOnAsyncErrorF1342A37Func AMediaCodecOnAsyncError - -func (x AMediaCodecOnAsyncFormatChanged) PassRef() (ref *C.AMediaCodecOnAsyncFormatChanged, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnAsyncFormatChanged3DABD828Func == nil { - aMediaCodecOnAsyncFormatChanged3DABD828Func = x - } - return (*C.AMediaCodecOnAsyncFormatChanged)(C.AMediaCodecOnAsyncFormatChanged_3dabd828), nil -} - -func (x AMediaCodecOnAsyncFormatChanged) PassValue() (ref C.AMediaCodecOnAsyncFormatChanged, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnAsyncFormatChanged3DABD828Func == nil { - aMediaCodecOnAsyncFormatChanged3DABD828Func = x - } - return (C.AMediaCodecOnAsyncFormatChanged)(C.AMediaCodecOnAsyncFormatChanged_3dabd828), nil -} - -func NewAMediaCodecOnAsyncFormatChangedRef(ref unsafe.Pointer) *AMediaCodecOnAsyncFormatChanged { - return (*AMediaCodecOnAsyncFormatChanged)(ref) -} - -//export AMediaCodecOnAsyncFormatChanged3DABD828 -func AMediaCodecOnAsyncFormatChanged3DABD828(ccodec *C.AMediaCodec, cuserdata unsafe.Pointer, cformat *C.AMediaFormat) { - if aMediaCodecOnAsyncFormatChanged3DABD828Func != nil { - codec3dabd828 := (*AMediaCodec)(unsafe.Pointer(ccodec)) - userdata3dabd828 := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - format3dabd828 := (*AMediaFormat)(unsafe.Pointer(cformat)) - aMediaCodecOnAsyncFormatChanged3DABD828Func(codec3dabd828, userdata3dabd828, format3dabd828) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaCodecOnAsyncFormatChanged3DABD828Func AMediaCodecOnAsyncFormatChanged - -func (x AMediaCodecOnAsyncInputAvailable) PassRef() (ref *C.AMediaCodecOnAsyncInputAvailable, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnAsyncInputAvailable2F5096C4Func == nil { - aMediaCodecOnAsyncInputAvailable2F5096C4Func = x - } - return (*C.AMediaCodecOnAsyncInputAvailable)(C.AMediaCodecOnAsyncInputAvailable_2f5096c4), nil -} - -func (x AMediaCodecOnAsyncInputAvailable) PassValue() (ref C.AMediaCodecOnAsyncInputAvailable, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnAsyncInputAvailable2F5096C4Func == nil { - aMediaCodecOnAsyncInputAvailable2F5096C4Func = x - } - return (C.AMediaCodecOnAsyncInputAvailable)(C.AMediaCodecOnAsyncInputAvailable_2f5096c4), nil -} - -func NewAMediaCodecOnAsyncInputAvailableRef(ref unsafe.Pointer) *AMediaCodecOnAsyncInputAvailable { - return (*AMediaCodecOnAsyncInputAvailable)(ref) -} - -//export AMediaCodecOnAsyncInputAvailable2F5096C4 -func AMediaCodecOnAsyncInputAvailable2F5096C4(ccodec *C.AMediaCodec, cuserdata unsafe.Pointer, cindex C.int32_t) { - if aMediaCodecOnAsyncInputAvailable2F5096C4Func != nil { - codec2f5096c4 := (*AMediaCodec)(unsafe.Pointer(ccodec)) - userdata2f5096c4 := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - index2f5096c4 := (int32)(cindex) - aMediaCodecOnAsyncInputAvailable2F5096C4Func(codec2f5096c4, userdata2f5096c4, index2f5096c4) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaCodecOnAsyncInputAvailable2F5096C4Func AMediaCodecOnAsyncInputAvailable - -func (x AMediaCodecOnAsyncOutputAvailable) PassRef() (ref *C.AMediaCodecOnAsyncOutputAvailable, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnAsyncOutputAvailableF41B4C39Func == nil { - aMediaCodecOnAsyncOutputAvailableF41B4C39Func = x - } - return (*C.AMediaCodecOnAsyncOutputAvailable)(C.AMediaCodecOnAsyncOutputAvailable_f41b4c39), nil -} - -func (x AMediaCodecOnAsyncOutputAvailable) PassValue() (ref C.AMediaCodecOnAsyncOutputAvailable, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnAsyncOutputAvailableF41B4C39Func == nil { - aMediaCodecOnAsyncOutputAvailableF41B4C39Func = x - } - return (C.AMediaCodecOnAsyncOutputAvailable)(C.AMediaCodecOnAsyncOutputAvailable_f41b4c39), nil -} - -func NewAMediaCodecOnAsyncOutputAvailableRef(ref unsafe.Pointer) *AMediaCodecOnAsyncOutputAvailable { - return (*AMediaCodecOnAsyncOutputAvailable)(ref) -} - -//export AMediaCodecOnAsyncOutputAvailableF41B4C39 -func AMediaCodecOnAsyncOutputAvailableF41B4C39(ccodec *C.AMediaCodec, cuserdata unsafe.Pointer, cindex C.int32_t, cbufferInfo *C.AMediaCodecBufferInfo) { - if aMediaCodecOnAsyncOutputAvailableF41B4C39Func != nil { - codecf41b4c39 := (*AMediaCodec)(unsafe.Pointer(ccodec)) - userdataf41b4c39 := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - indexf41b4c39 := (int32)(cindex) - bufferInfof41b4c39 := (*AMediaCodecBufferInfo)(unsafe.Pointer(cbufferInfo)) - aMediaCodecOnAsyncOutputAvailableF41B4C39Func(codecf41b4c39, userdataf41b4c39, indexf41b4c39, bufferInfof41b4c39) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaCodecOnAsyncOutputAvailableF41B4C39Func AMediaCodecOnAsyncOutputAvailable - -func (x AMediaCodecOnFrameRendered) PassRef() (ref *C.AMediaCodecOnFrameRendered, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnFrameRendered61AF0881Func == nil { - aMediaCodecOnFrameRendered61AF0881Func = x - } - return (*C.AMediaCodecOnFrameRendered)(C.AMediaCodecOnFrameRendered_61af0881), nil -} - -func (x AMediaCodecOnFrameRendered) PassValue() (ref C.AMediaCodecOnFrameRendered, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaCodecOnFrameRendered61AF0881Func == nil { - aMediaCodecOnFrameRendered61AF0881Func = x - } - return (C.AMediaCodecOnFrameRendered)(C.AMediaCodecOnFrameRendered_61af0881), nil -} - -func NewAMediaCodecOnFrameRenderedRef(ref unsafe.Pointer) *AMediaCodecOnFrameRendered { - return (*AMediaCodecOnFrameRendered)(ref) -} - -//export AMediaCodecOnFrameRendered61AF0881 -func AMediaCodecOnFrameRendered61AF0881(ccodec *C.AMediaCodec, cuserdata unsafe.Pointer, cmediaTimeUs C.int64_t, csystemNano C.int64_t) { - if aMediaCodecOnFrameRendered61AF0881Func != nil { - codec61af0881 := (*AMediaCodec)(unsafe.Pointer(ccodec)) - userdata61af0881 := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - mediaTimeUs61af0881 := (int64)(cmediaTimeUs) - systemNano61af0881 := (int64)(csystemNano) - aMediaCodecOnFrameRendered61AF0881Func(codec61af0881, userdata61af0881, mediaTimeUs61af0881, systemNano61af0881) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaCodecOnFrameRendered61AF0881Func AMediaCodecOnFrameRendered - -func (x AMediaDataSourceClose) PassRef() (ref *C.AMediaDataSourceClose, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDataSourceClose06C40935Func == nil { - aMediaDataSourceClose06C40935Func = x - } - return (*C.AMediaDataSourceClose)(C.AMediaDataSourceClose_06c40935), nil -} - -func (x AMediaDataSourceClose) PassValue() (ref C.AMediaDataSourceClose, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDataSourceClose06C40935Func == nil { - aMediaDataSourceClose06C40935Func = x - } - return (C.AMediaDataSourceClose)(C.AMediaDataSourceClose_06c40935), nil -} - -func NewAMediaDataSourceCloseRef(ref unsafe.Pointer) *AMediaDataSourceClose { - return (*AMediaDataSourceClose)(ref) -} - -//export AMediaDataSourceClose06C40935 -func AMediaDataSourceClose06C40935(cuserdata unsafe.Pointer) { - if aMediaDataSourceClose06C40935Func != nil { - userdata06c40935 := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - aMediaDataSourceClose06C40935Func(userdata06c40935) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaDataSourceClose06C40935Func AMediaDataSourceClose - -func (x AMediaDataSourceGetAvailableSize) PassRef() (ref *C.AMediaDataSourceGetAvailableSize, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDataSourceGetAvailableSize40CC3318Func == nil { - aMediaDataSourceGetAvailableSize40CC3318Func = x - } - return (*C.AMediaDataSourceGetAvailableSize)(C.AMediaDataSourceGetAvailableSize_40cc3318), nil -} - -func (x AMediaDataSourceGetAvailableSize) PassValue() (ref C.AMediaDataSourceGetAvailableSize, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDataSourceGetAvailableSize40CC3318Func == nil { - aMediaDataSourceGetAvailableSize40CC3318Func = x - } - return (C.AMediaDataSourceGetAvailableSize)(C.AMediaDataSourceGetAvailableSize_40cc3318), nil -} - -func NewAMediaDataSourceGetAvailableSizeRef(ref unsafe.Pointer) *AMediaDataSourceGetAvailableSize { - return (*AMediaDataSourceGetAvailableSize)(ref) -} - -//export AMediaDataSourceGetAvailableSize40CC3318 -func AMediaDataSourceGetAvailableSize40CC3318(cuserdata unsafe.Pointer, coffset C.off64_t) C.int64_t { - if aMediaDataSourceGetAvailableSize40CC3318Func != nil { - userdata40cc3318 := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - offset40cc3318 := (Off64_t)(coffset) - ret40cc3318 := aMediaDataSourceGetAvailableSize40CC3318Func(userdata40cc3318, offset40cc3318) - ret, _ := (C.int64_t)(ret40cc3318), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aMediaDataSourceGetAvailableSize40CC3318Func AMediaDataSourceGetAvailableSize - -func (x AMediaDataSourceGetSize) PassRef() (ref *C.AMediaDataSourceGetSize, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDataSourceGetSizeE0220813Func == nil { - aMediaDataSourceGetSizeE0220813Func = x - } - return (*C.AMediaDataSourceGetSize)(C.AMediaDataSourceGetSize_e0220813), nil -} - -func (x AMediaDataSourceGetSize) PassValue() (ref C.AMediaDataSourceGetSize, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDataSourceGetSizeE0220813Func == nil { - aMediaDataSourceGetSizeE0220813Func = x - } - return (C.AMediaDataSourceGetSize)(C.AMediaDataSourceGetSize_e0220813), nil -} - -func NewAMediaDataSourceGetSizeRef(ref unsafe.Pointer) *AMediaDataSourceGetSize { - return (*AMediaDataSourceGetSize)(ref) -} - -//export AMediaDataSourceGetSizeE0220813 -func AMediaDataSourceGetSizeE0220813(cuserdata unsafe.Pointer) C.int64_t { - if aMediaDataSourceGetSizeE0220813Func != nil { - userdatae0220813 := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - rete0220813 := aMediaDataSourceGetSizeE0220813Func(userdatae0220813) - ret, _ := (C.int64_t)(rete0220813), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aMediaDataSourceGetSizeE0220813Func AMediaDataSourceGetSize - -func (x AMediaDataSourceReadAt) PassRef() (ref *C.AMediaDataSourceReadAt, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDataSourceReadAt865C1A4BFunc == nil { - aMediaDataSourceReadAt865C1A4BFunc = x - } - return (*C.AMediaDataSourceReadAt)(C.AMediaDataSourceReadAt_865c1a4b), nil -} - -func (x AMediaDataSourceReadAt) PassValue() (ref C.AMediaDataSourceReadAt, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDataSourceReadAt865C1A4BFunc == nil { - aMediaDataSourceReadAt865C1A4BFunc = x - } - return (C.AMediaDataSourceReadAt)(C.AMediaDataSourceReadAt_865c1a4b), nil -} - -func NewAMediaDataSourceReadAtRef(ref unsafe.Pointer) *AMediaDataSourceReadAt { - return (*AMediaDataSourceReadAt)(ref) -} - -//export AMediaDataSourceReadAt865C1A4B -func AMediaDataSourceReadAt865C1A4B(cuserdata unsafe.Pointer, coffset C.off64_t, cbuffer unsafe.Pointer, csize C.size_t) C.int64_t { - if aMediaDataSourceReadAt865C1A4BFunc != nil { - userdata865c1a4b := (unsafe.Pointer)(unsafe.Pointer(cuserdata)) - offset865c1a4b := (Off64_t)(coffset) - buffer865c1a4b := (unsafe.Pointer)(unsafe.Pointer(cbuffer)) - size865c1a4b := (uint64)(csize) - ret865c1a4b := aMediaDataSourceReadAt865C1A4BFunc(userdata865c1a4b, offset865c1a4b, buffer865c1a4b, size865c1a4b) - ret, _ := (C.int64_t)(ret865c1a4b), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aMediaDataSourceReadAt865C1A4BFunc AMediaDataSourceReadAt - -func (x AMediaDrmEventListener) PassRef() (ref *C.AMediaDrmEventListener, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDrmEventListener76BB5445Func == nil { - aMediaDrmEventListener76BB5445Func = x - } - return (*C.AMediaDrmEventListener)(C.AMediaDrmEventListener_76bb5445), nil -} - -func (x AMediaDrmEventListener) PassValue() (ref C.AMediaDrmEventListener, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDrmEventListener76BB5445Func == nil { - aMediaDrmEventListener76BB5445Func = x - } - return (C.AMediaDrmEventListener)(C.AMediaDrmEventListener_76bb5445), nil -} - -func NewAMediaDrmEventListenerRef(ref unsafe.Pointer) *AMediaDrmEventListener { - return (*AMediaDrmEventListener)(ref) -} - -//export AMediaDrmEventListener76BB5445 -func AMediaDrmEventListener76BB5445(cp0 *C.AMediaDrm, csessionId *C.AMediaDrmSessionId, ceventType C.AMediaDrmEventType, cextra C.int, cdata *C.uint8_t, cdataSize C.size_t) { - if aMediaDrmEventListener76BB5445Func != nil { - p076bb5445 := (*AMediaDrm)(unsafe.Pointer(cp0)) - sessionId76bb5445 := (*AMediaDrmSessionId)(unsafe.Pointer(csessionId)) - eventType76bb5445 := (AMediaDrmEventType)(ceventType) - extra76bb5445 := (int32)(cextra) - data76bb5445 := (*uint8)(unsafe.Pointer(cdata)) - dataSize76bb5445 := (uint64)(cdataSize) - aMediaDrmEventListener76BB5445Func(p076bb5445, sessionId76bb5445, eventType76bb5445, extra76bb5445, data76bb5445, dataSize76bb5445) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaDrmEventListener76BB5445Func AMediaDrmEventListener - -func (x AMediaDrmExpirationUpdateListener) PassRef() (ref *C.AMediaDrmExpirationUpdateListener, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDrmExpirationUpdateListenerEC3B27D6Func == nil { - aMediaDrmExpirationUpdateListenerEC3B27D6Func = x - } - return (*C.AMediaDrmExpirationUpdateListener)(C.AMediaDrmExpirationUpdateListener_ec3b27d6), nil -} - -func (x AMediaDrmExpirationUpdateListener) PassValue() (ref C.AMediaDrmExpirationUpdateListener, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDrmExpirationUpdateListenerEC3B27D6Func == nil { - aMediaDrmExpirationUpdateListenerEC3B27D6Func = x - } - return (C.AMediaDrmExpirationUpdateListener)(C.AMediaDrmExpirationUpdateListener_ec3b27d6), nil -} - -func NewAMediaDrmExpirationUpdateListenerRef(ref unsafe.Pointer) *AMediaDrmExpirationUpdateListener { - return (*AMediaDrmExpirationUpdateListener)(ref) -} - -//export AMediaDrmExpirationUpdateListenerEC3B27D6 -func AMediaDrmExpirationUpdateListenerEC3B27D6(cp0 *C.AMediaDrm, csessionId *C.AMediaDrmSessionId, cexpiryTimeInMS C.int64_t) { - if aMediaDrmExpirationUpdateListenerEC3B27D6Func != nil { - p0ec3b27d6 := (*AMediaDrm)(unsafe.Pointer(cp0)) - sessionIdec3b27d6 := (*AMediaDrmSessionId)(unsafe.Pointer(csessionId)) - expiryTimeInMSec3b27d6 := (int64)(cexpiryTimeInMS) - aMediaDrmExpirationUpdateListenerEC3B27D6Func(p0ec3b27d6, sessionIdec3b27d6, expiryTimeInMSec3b27d6) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaDrmExpirationUpdateListenerEC3B27D6Func AMediaDrmExpirationUpdateListener - -func (x AMediaDrmKeysChangeListener) PassRef() (ref *C.AMediaDrmKeysChangeListener, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDrmKeysChangeListenerFD05E34AFunc == nil { - aMediaDrmKeysChangeListenerFD05E34AFunc = x - } - return (*C.AMediaDrmKeysChangeListener)(C.AMediaDrmKeysChangeListener_fd05e34a), nil -} - -func (x AMediaDrmKeysChangeListener) PassValue() (ref C.AMediaDrmKeysChangeListener, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aMediaDrmKeysChangeListenerFD05E34AFunc == nil { - aMediaDrmKeysChangeListenerFD05E34AFunc = x - } - return (C.AMediaDrmKeysChangeListener)(C.AMediaDrmKeysChangeListener_fd05e34a), nil -} - -func NewAMediaDrmKeysChangeListenerRef(ref unsafe.Pointer) *AMediaDrmKeysChangeListener { - return (*AMediaDrmKeysChangeListener)(ref) -} - -//export AMediaDrmKeysChangeListenerFD05E34A -func AMediaDrmKeysChangeListenerFD05E34A(cp0 *C.AMediaDrm, csessionId *C.AMediaDrmSessionId, ckeyStatus *C.AMediaDrmKeyStatus, cnumKeys C.size_t, chasNewUsableKey C.bool) { - if aMediaDrmKeysChangeListenerFD05E34AFunc != nil { - p0fd05e34a := (*AMediaDrm)(unsafe.Pointer(cp0)) - sessionIdfd05e34a := (*AMediaDrmSessionId)(unsafe.Pointer(csessionId)) - keyStatusfd05e34a := (*AMediaDrmKeyStatus)(unsafe.Pointer(ckeyStatus)) - numKeysfd05e34a := (uint64)(cnumKeys) - hasNewUsableKeyfd05e34a := (bool)(chasNewUsableKey) - aMediaDrmKeysChangeListenerFD05E34AFunc(p0fd05e34a, sessionIdfd05e34a, keyStatusfd05e34a, numKeysfd05e34a, hasNewUsableKeyfd05e34a) - return - } - panic("callback func has not been set (race?)") -} - -var aMediaDrmKeysChangeListenerFD05E34AFunc AMediaDrmKeysChangeListener - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/media/cgo_helpers.h b/capi/media/cgo_helpers.h deleted file mode 100644 index 131e070..0000000 --- a/capi/media/cgo_helpers.h +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "media/NdkImage.h" -#include "media/NdkImageReader.h" -#include "media/NdkMediaCodec.h" -#include "media/NdkMediaCodecInfo.h" -#include "media/NdkMediaDataSource.h" -#include "media/NdkMediaExtractor.h" -#include "media/NdkMediaFormat.h" -#include "media/NdkMediaMuxer.h" -#include "media/NdkMediaDrm.h" -#include "media/NdkMediaCrypto.h" -#include -#pragma once - -#define __CGOGEN 1 - -// AImageReader_BufferRemovedCallback_b28d8959 is a proxy for callback AImageReader_BufferRemovedCallback. -void AImageReader_BufferRemovedCallback_b28d8959(void* context, AImageReader* reader, AHardwareBuffer* buffer); - -// AImageReader_ImageCallback_32cdd235 is a proxy for callback AImageReader_ImageCallback. -void AImageReader_ImageCallback_32cdd235(void* context, AImageReader* reader); - -// AMediaCodecOnAsyncError_f1342a37 is a proxy for callback AMediaCodecOnAsyncError. -void AMediaCodecOnAsyncError_f1342a37(AMediaCodec* codec, void* userdata, media_status_t _error, int32_t actionCode, const char* detail); - -// AMediaCodecOnAsyncFormatChanged_3dabd828 is a proxy for callback AMediaCodecOnAsyncFormatChanged. -void AMediaCodecOnAsyncFormatChanged_3dabd828(AMediaCodec* codec, void* userdata, AMediaFormat* format); - -// AMediaCodecOnAsyncInputAvailable_2f5096c4 is a proxy for callback AMediaCodecOnAsyncInputAvailable. -void AMediaCodecOnAsyncInputAvailable_2f5096c4(AMediaCodec* codec, void* userdata, int32_t index); - -// AMediaCodecOnAsyncOutputAvailable_f41b4c39 is a proxy for callback AMediaCodecOnAsyncOutputAvailable. -void AMediaCodecOnAsyncOutputAvailable_f41b4c39(AMediaCodec* codec, void* userdata, int32_t index, AMediaCodecBufferInfo* bufferInfo); - -// AMediaCodecOnFrameRendered_61af0881 is a proxy for callback AMediaCodecOnFrameRendered. -void AMediaCodecOnFrameRendered_61af0881(AMediaCodec* codec, void* userdata, int64_t mediaTimeUs, int64_t systemNano); - -// AMediaDataSourceClose_06c40935 is a proxy for callback AMediaDataSourceClose. -void AMediaDataSourceClose_06c40935(void* userdata); - -// AMediaDataSourceGetAvailableSize_40cc3318 is a proxy for callback AMediaDataSourceGetAvailableSize. -int64_t AMediaDataSourceGetAvailableSize_40cc3318(void* userdata, off64_t offset); - -// AMediaDataSourceGetSize_e0220813 is a proxy for callback AMediaDataSourceGetSize. -int64_t AMediaDataSourceGetSize_e0220813(void* userdata); - -// AMediaDataSourceReadAt_865c1a4b is a proxy for callback AMediaDataSourceReadAt. -int64_t AMediaDataSourceReadAt_865c1a4b(void* userdata, off64_t offset, void* buffer, size_t size); - -// AMediaDrmEventListener_76bb5445 is a proxy for callback AMediaDrmEventListener. -void AMediaDrmEventListener_76bb5445(AMediaDrm* p0, const AMediaDrmSessionId* sessionId, AMediaDrmEventType eventType, int extra, const uint8_t* data, size_t dataSize); - -// AMediaDrmExpirationUpdateListener_ec3b27d6 is a proxy for callback AMediaDrmExpirationUpdateListener. -void AMediaDrmExpirationUpdateListener_ec3b27d6(AMediaDrm* p0, const AMediaDrmSessionId* sessionId, int64_t expiryTimeInMS); - -// AMediaDrmKeysChangeListener_fd05e34a is a proxy for callback AMediaDrmKeysChangeListener. -void AMediaDrmKeysChangeListener_fd05e34a(AMediaDrm* p0, const AMediaDrmSessionId* sessionId, const AMediaDrmKeyStatus* keyStatus, size_t numKeys, bool hasNewUsableKey); - diff --git a/capi/media/const.go b/capi/media/const.go deleted file mode 100644 index ec4289c..0000000 --- a/capi/media/const.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package media - -const ( - ABITRATE_MODE_CQ ABitrateMode = 0 - ABITRATE_MODE_VBR ABitrateMode = 1 - ABITRATE_MODE_CBR ABitrateMode = 2 - ABITRATE_MODE_CBR_FD ABitrateMode = 3 -) - -const ( - AIMAGE_FORMAT_RGBA_8888 = 1 - AIMAGE_FORMAT_RGBX_8888 = 2 - AIMAGE_FORMAT_RGB_888 = 3 - AIMAGE_FORMAT_RGB_565 = 4 - AIMAGE_FORMAT_RGBA_FP16 = 22 - AIMAGE_FORMAT_YUV_420_888 = 35 - AIMAGE_FORMAT_JPEG = 256 - AIMAGE_FORMAT_RAW16 = 32 - AIMAGE_FORMAT_RAW_PRIVATE = 36 - AIMAGE_FORMAT_RAW10 = 37 - AIMAGE_FORMAT_RAW12 = 38 - AIMAGE_FORMAT_DEPTH16 = 1144402265 - AIMAGE_FORMAT_DEPTH_POINT_CLOUD = 257 - AIMAGE_FORMAT_PRIVATE = 34 - AIMAGE_FORMAT_Y8 = 538982489 - AIMAGE_FORMAT_HEIC = 1212500294 - AIMAGE_FORMAT_DEPTH_JPEG = 1768253795 -) - -const ( - AMEDIACODEC_CONFIGURE_FLAG_ENCODE = 1 - AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED = -3 - AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED = -2 - AMEDIACODEC_INFO_TRY_AGAIN_LATER = -1 -) - -const ( - AMEDIACODEC_BUFFER_FLAG_KEY_FRAME = 1 - AMEDIACODEC_BUFFER_FLAG_CODEC_CONFIG = 2 - AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM = 4 - AMEDIACODEC_BUFFER_FLAG_PARTIAL_FRAME = 8 - AMEDIACODEC_BUFFER_FLAG_MUXER_DATA = 16 - AMEDIACODEC_BUFFER_FLAG_DECODE_ONLY = 32 -) - -const ( - AMEDIAEXTRACTOR_SAMPLE_FLAG_SYNC = 1 - AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED = 2 -) - -const ( - AMediaCodecKind_INVALID AMediaCodecKind = 0 - AMediaCodecKind_DECODER AMediaCodecKind = 1 - AMediaCodecKind_ENCODER AMediaCodecKind = 2 -) - -const ( - AMediaCodecType_INVALID_CODEC_INFO AMediaCodecType = 0 - AMediaCodecType_SOFTWARE_ONLY AMediaCodecType = 1 - AMediaCodecType_HARDWARE_ACCELERATED AMediaCodecType = 2 - AMediaCodecType_SOFTWARE_WITH_DEVICE_ACCESS AMediaCodecType = 3 -) - -const ( - EVENT_PROVISION_REQUIRED AMediaDrmEventType = 1 - EVENT_KEY_REQUIRED AMediaDrmEventType = 2 - EVENT_KEY_EXPIRED AMediaDrmEventType = 3 - EVENT_VENDOR_DEFINED AMediaDrmEventType = 4 - EVENT_SESSION_RECLAIMED AMediaDrmEventType = 5 -) - -const ( - KEY_REQUEST_TYPE_INITIAL AMediaDrmKeyRequestType = 0 - KEY_REQUEST_TYPE_RENEWAL AMediaDrmKeyRequestType = 1 - KEY_REQUEST_TYPE_RELEASE AMediaDrmKeyRequestType = 2 - KEY_REQUEST_TYPE_NONE AMediaDrmKeyRequestType = 3 - KEY_REQUEST_TYPE_UPDATE AMediaDrmKeyRequestType = 4 -) - -const ( - KEY_STATUS_TYPE_USABLE AMediaDrmKeyStatusType = 0 - KEY_STATUS_TYPE_EXPIRED AMediaDrmKeyStatusType = 1 - KEY_STATUS_TYPE_OUTPUTNOTALLOWED AMediaDrmKeyStatusType = 2 - KEY_STATUS_TYPE_STATUSPENDING AMediaDrmKeyStatusType = 3 - KEY_STATUS_TYPE_INTERNALERROR AMediaDrmKeyStatusType = 4 -) - -const ( - KEY_TYPE_STREAMING AMediaDrmKeyType = 1 - KEY_TYPE_OFFLINE AMediaDrmKeyType = 2 - KEY_TYPE_RELEASE AMediaDrmKeyType = 3 -) - -const ( - AMEDIAMUXER_APPEND_IGNORE_LAST_VIDEO_GOP AppendMode = 0 - AMEDIAMUXER_APPEND_TO_EXISTING_DATA AppendMode = 1 -) - -const ( - AMEDIAMUXER_OUTPUT_FORMAT_MPEG_4 OutputFormat = 0 - AMEDIAMUXER_OUTPUT_FORMAT_WEBM OutputFormat = 1 - AMEDIAMUXER_OUTPUT_FORMAT_THREE_GPP OutputFormat = 2 - AMEDIAMUXER_OUTPUT_FORMAT_HEIF OutputFormat = 3 - AMEDIAMUXER_OUTPUT_FORMAT_OGG OutputFormat = 4 -) - -const ( - AMEDIAEXTRACTOR_SEEK_PREVIOUS_SYNC SeekMode = 0 - AMEDIAEXTRACTOR_SEEK_NEXT_SYNC SeekMode = 1 - AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC SeekMode = 2 -) - -const ( - AMEDIACODECRYPTOINFO_MODE_CLEAR Cryptoinfo_mode_t = 0 - AMEDIACODECRYPTOINFO_MODE_AES_CTR Cryptoinfo_mode_t = 1 - AMEDIACODECRYPTOINFO_MODE_AES_WV Cryptoinfo_mode_t = 2 - AMEDIACODECRYPTOINFO_MODE_AES_CBC Cryptoinfo_mode_t = 3 -) diff --git a/capi/media/doc.go b/capi/media/doc.go deleted file mode 100644 index cfc8033..0000000 --- a/capi/media/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Media NDK -*/ -package media diff --git a/capi/media/media.go b/capi/media/media.go deleted file mode 100644 index e84e79f..0000000 --- a/capi/media/media.go +++ /dev/null @@ -1,1873 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package media - -/* -#cgo LDFLAGS: -lmediandk -#include "media/NdkImage.h" -#include "media/NdkImageReader.h" -#include "media/NdkMediaCodec.h" -#include "media/NdkMediaCodecInfo.h" -#include "media/NdkMediaDataSource.h" -#include "media/NdkMediaExtractor.h" -#include "media/NdkMediaFormat.h" -#include "media/NdkMediaMuxer.h" -#include "media/NdkMediaDrm.h" -#include "media/NdkMediaCrypto.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AImageReader_acquireLatestImage(reader *AImageReader, image **AImage) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cimage, cimageAllocMap := (**C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - var pinnercimage runtime.Pinner - pinnercimage.Pin(image) - if image != nil { - pinnercimage.Pin(unsafe.Pointer(*image)) - } - defer pinnercimage.Unpin() - __ret := C.AImageReader_acquireLatestImage(creader, cimage) - runtime.KeepAlive(cimageAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_acquireLatestImageAsync(reader *AImageReader, image **AImage, acquireFenceFd *int32) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cimage, cimageAllocMap := (**C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - var pinnercimage runtime.Pinner - pinnercimage.Pin(image) - if image != nil { - pinnercimage.Pin(unsafe.Pointer(*image)) - } - defer pinnercimage.Unpin() - cacquireFenceFd, cacquireFenceFdAllocMap := (*C.int)(unsafe.Pointer(acquireFenceFd)), cgoAllocsUnknown - __ret := C.AImageReader_acquireLatestImageAsync(creader, cimage, cacquireFenceFd) - runtime.KeepAlive(cacquireFenceFdAllocMap) - runtime.KeepAlive(cimageAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_acquireNextImage(reader *AImageReader, image **AImage) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cimage, cimageAllocMap := (**C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - var pinnercimage runtime.Pinner - pinnercimage.Pin(image) - if image != nil { - pinnercimage.Pin(unsafe.Pointer(*image)) - } - defer pinnercimage.Unpin() - __ret := C.AImageReader_acquireNextImage(creader, cimage) - runtime.KeepAlive(cimageAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_acquireNextImageAsync(reader *AImageReader, image **AImage, acquireFenceFd *int32) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cimage, cimageAllocMap := (**C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - var pinnercimage runtime.Pinner - pinnercimage.Pin(image) - if image != nil { - pinnercimage.Pin(unsafe.Pointer(*image)) - } - defer pinnercimage.Unpin() - cacquireFenceFd, cacquireFenceFdAllocMap := (*C.int)(unsafe.Pointer(acquireFenceFd)), cgoAllocsUnknown - __ret := C.AImageReader_acquireNextImageAsync(creader, cimage, cacquireFenceFd) - runtime.KeepAlive(cacquireFenceFdAllocMap) - runtime.KeepAlive(cimageAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_delete(reader *AImageReader) { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - C.AImageReader_delete(creader) - runtime.KeepAlive(creaderAllocMap) -} - -func AImageReader_getFormat(reader *AImageReader, format *int32) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cformat, cformatAllocMap := (*C.int)(unsafe.Pointer(format)), cgoAllocsUnknown - __ret := C.AImageReader_getFormat(creader, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_getHeight(reader *AImageReader, height *int32) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cheight, cheightAllocMap := (*C.int)(unsafe.Pointer(height)), cgoAllocsUnknown - __ret := C.AImageReader_getHeight(creader, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_getMaxImages(reader *AImageReader, maxImages *int32) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cmaxImages, cmaxImagesAllocMap := (*C.int)(unsafe.Pointer(maxImages)), cgoAllocsUnknown - __ret := C.AImageReader_getMaxImages(creader, cmaxImages) - runtime.KeepAlive(cmaxImagesAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_getWidth(reader *AImageReader, width *int32) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (*C.int)(unsafe.Pointer(width)), cgoAllocsUnknown - __ret := C.AImageReader_getWidth(creader, cwidth) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_getWindow(reader *AImageReader, window **ANativeWindow) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - cwindow, cwindowAllocMap := (**C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - var pinnercwindow runtime.Pinner - pinnercwindow.Pin(window) - if window != nil { - pinnercwindow.Pin(unsafe.Pointer(*window)) - } - defer pinnercwindow.Unpin() - __ret := C.AImageReader_getWindow(creader, cwindow) - runtime.KeepAlive(cwindowAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_new(width int32, height int32, format int32, maxImages int32, reader **AImageReader) Media_status_t { - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.int)(format), cgoAllocsUnknown - cmaxImages, cmaxImagesAllocMap := (C.int)(maxImages), cgoAllocsUnknown - creader, creaderAllocMap := (**C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - var pinnercreader runtime.Pinner - pinnercreader.Pin(reader) - if reader != nil { - pinnercreader.Pin(unsafe.Pointer(*reader)) - } - defer pinnercreader.Unpin() - __ret := C.AImageReader_new(cwidth, cheight, cformat, cmaxImages, creader) - runtime.KeepAlive(creaderAllocMap) - runtime.KeepAlive(cmaxImagesAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_newWithDataSpace(width int32, height int32, usage uint64, maxImages int32, hardwareBufferFormat uint32, dataSpace int32, reader **AImageReader) Media_status_t { - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - cusage, cusageAllocMap := (C.uint64_t)(usage), cgoAllocsUnknown - cmaxImages, cmaxImagesAllocMap := (C.int)(maxImages), cgoAllocsUnknown - chardwareBufferFormat, chardwareBufferFormatAllocMap := (C.uint)(hardwareBufferFormat), cgoAllocsUnknown - cdataSpace, cdataSpaceAllocMap := (C.int)(dataSpace), cgoAllocsUnknown - creader, creaderAllocMap := (**C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - var pinnercreader runtime.Pinner - pinnercreader.Pin(reader) - if reader != nil { - pinnercreader.Pin(unsafe.Pointer(*reader)) - } - defer pinnercreader.Unpin() - __ret := C.AImageReader_newWithDataSpace(cwidth, cheight, cusage, cmaxImages, chardwareBufferFormat, cdataSpace, creader) - runtime.KeepAlive(creaderAllocMap) - runtime.KeepAlive(cdataSpaceAllocMap) - runtime.KeepAlive(chardwareBufferFormatAllocMap) - runtime.KeepAlive(cmaxImagesAllocMap) - runtime.KeepAlive(cusageAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_newWithUsage(width int32, height int32, format int32, usage uint64, maxImages int32, reader **AImageReader) Media_status_t { - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.int)(format), cgoAllocsUnknown - cusage, cusageAllocMap := (C.uint64_t)(usage), cgoAllocsUnknown - cmaxImages, cmaxImagesAllocMap := (C.int)(maxImages), cgoAllocsUnknown - creader, creaderAllocMap := (**C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - var pinnercreader runtime.Pinner - pinnercreader.Pin(reader) - if reader != nil { - pinnercreader.Pin(unsafe.Pointer(*reader)) - } - defer pinnercreader.Unpin() - __ret := C.AImageReader_newWithUsage(cwidth, cheight, cformat, cusage, cmaxImages, creader) - runtime.KeepAlive(creaderAllocMap) - runtime.KeepAlive(cmaxImagesAllocMap) - runtime.KeepAlive(cusageAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_setBufferRemovedListener(reader *AImageReader, listener *AImageReader_BufferRemovedListener) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - clistener, clistenerAllocMap := (*C.AImageReader_BufferRemovedListener)(unsafe.Pointer(listener)), cgoAllocsUnknown - __ret := C.AImageReader_setBufferRemovedListener(creader, clistener) - runtime.KeepAlive(clistenerAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImageReader_setImageListener(reader *AImageReader, listener *AImageReader_ImageListener) Media_status_t { - creader, creaderAllocMap := (*C.AImageReader)(unsafe.Pointer(reader)), cgoAllocsUnknown - clistener, clistenerAllocMap := (*C.AImageReader_ImageListener)(unsafe.Pointer(listener)), cgoAllocsUnknown - __ret := C.AImageReader_setImageListener(creader, clistener) - runtime.KeepAlive(clistenerAllocMap) - runtime.KeepAlive(creaderAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_delete(image *AImage) { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - C.AImage_delete(cimage) - runtime.KeepAlive(cimageAllocMap) -} - -func AImage_deleteAsync(image *AImage, releaseFenceFd int32) { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - creleaseFenceFd, creleaseFenceFdAllocMap := (C.int)(releaseFenceFd), cgoAllocsUnknown - C.AImage_deleteAsync(cimage, creleaseFenceFd) - runtime.KeepAlive(creleaseFenceFdAllocMap) - runtime.KeepAlive(cimageAllocMap) -} - -func AImage_getCropRect(image *AImage, rect *AImageCropRect) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - crect, crectAllocMap := (*C.AImageCropRect)(unsafe.Pointer(rect)), cgoAllocsUnknown - __ret := C.AImage_getCropRect(cimage, crect) - runtime.KeepAlive(crectAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getDataSpace(image *AImage, dataSpace *int32) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cdataSpace, cdataSpaceAllocMap := (*C.int)(unsafe.Pointer(dataSpace)), cgoAllocsUnknown - __ret := C.AImage_getDataSpace(cimage, cdataSpace) - runtime.KeepAlive(cdataSpaceAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getFormat(image *AImage, format *int32) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cformat, cformatAllocMap := (*C.int)(unsafe.Pointer(format)), cgoAllocsUnknown - __ret := C.AImage_getFormat(cimage, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getHardwareBuffer(image *AImage, buffer **AHardwareBuffer) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (**C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - var pinnercbuffer runtime.Pinner - pinnercbuffer.Pin(buffer) - if buffer != nil { - pinnercbuffer.Pin(unsafe.Pointer(*buffer)) - } - defer pinnercbuffer.Unpin() - __ret := C.AImage_getHardwareBuffer(cimage, cbuffer) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getHeight(image *AImage, height *int32) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cheight, cheightAllocMap := (*C.int)(unsafe.Pointer(height)), cgoAllocsUnknown - __ret := C.AImage_getHeight(cimage, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getNumberOfPlanes(image *AImage, numPlanes *int32) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cnumPlanes, cnumPlanesAllocMap := (*C.int)(unsafe.Pointer(numPlanes)), cgoAllocsUnknown - __ret := C.AImage_getNumberOfPlanes(cimage, cnumPlanes) - runtime.KeepAlive(cnumPlanesAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getPlaneData(image *AImage, planeIdx int32, data **uint8, dataLength *int32) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cplaneIdx, cplaneIdxAllocMap := (C.int)(planeIdx), cgoAllocsUnknown - cdata, cdataAllocMap := (**C.uint8_t)(unsafe.Pointer(data)), cgoAllocsUnknown - var pinnercdata runtime.Pinner - pinnercdata.Pin(data) - if data != nil { - pinnercdata.Pin(unsafe.Pointer(*data)) - } - defer pinnercdata.Unpin() - cdataLength, cdataLengthAllocMap := (*C.int)(unsafe.Pointer(dataLength)), cgoAllocsUnknown - __ret := C.AImage_getPlaneData(cimage, cplaneIdx, cdata, cdataLength) - runtime.KeepAlive(cdataLengthAllocMap) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cplaneIdxAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getPlanePixelStride(image *AImage, planeIdx int32, pixelStride *int32) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cplaneIdx, cplaneIdxAllocMap := (C.int)(planeIdx), cgoAllocsUnknown - cpixelStride, cpixelStrideAllocMap := (*C.int)(unsafe.Pointer(pixelStride)), cgoAllocsUnknown - __ret := C.AImage_getPlanePixelStride(cimage, cplaneIdx, cpixelStride) - runtime.KeepAlive(cpixelStrideAllocMap) - runtime.KeepAlive(cplaneIdxAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getPlaneRowStride(image *AImage, planeIdx int32, rowStride *int32) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cplaneIdx, cplaneIdxAllocMap := (C.int)(planeIdx), cgoAllocsUnknown - crowStride, crowStrideAllocMap := (*C.int)(unsafe.Pointer(rowStride)), cgoAllocsUnknown - __ret := C.AImage_getPlaneRowStride(cimage, cplaneIdx, crowStride) - runtime.KeepAlive(crowStrideAllocMap) - runtime.KeepAlive(cplaneIdxAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getTimestamp(image *AImage, timestampNs *int64) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - ctimestampNs, ctimestampNsAllocMap := (*C.int64_t)(unsafe.Pointer(timestampNs)), cgoAllocsUnknown - __ret := C.AImage_getTimestamp(cimage, ctimestampNs) - runtime.KeepAlive(ctimestampNsAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AImage_getWidth(image *AImage, width *int32) Media_status_t { - cimage, cimageAllocMap := (*C.AImage)(unsafe.Pointer(image)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (*C.int)(unsafe.Pointer(width)), cgoAllocsUnknown - __ret := C.AImage_getWidth(cimage, cwidth) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cimageAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecActionCode_isRecoverable(actionCode int32) bool { - cactionCode, cactionCodeAllocMap := (C.int)(actionCode), cgoAllocsUnknown - __ret := C.AMediaCodecActionCode_isRecoverable(cactionCode) - runtime.KeepAlive(cactionCodeAllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaCodecActionCode_isTransient(actionCode int32) bool { - cactionCode, cactionCodeAllocMap := (C.int)(actionCode), cgoAllocsUnknown - __ret := C.AMediaCodecActionCode_isTransient(cactionCode) - runtime.KeepAlive(cactionCodeAllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaCodecCryptoInfo_delete(p0 *AMediaCodecCryptoInfo) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodecCryptoInfo_delete(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecCryptoInfo_getClearBytes(p0 *AMediaCodecCryptoInfo, dst *uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - cdst, cdstAllocMap := (*C.uint64_t)(unsafe.Pointer(dst)), cgoAllocsUnknown - __ret := C.AMediaCodecCryptoInfo_getClearBytes(cp0, cdst) - runtime.KeepAlive(cdstAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecCryptoInfo_getEncryptedBytes(p0 *AMediaCodecCryptoInfo, dst *uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - cdst, cdstAllocMap := (*C.uint64_t)(unsafe.Pointer(dst)), cgoAllocsUnknown - __ret := C.AMediaCodecCryptoInfo_getEncryptedBytes(cp0, cdst) - runtime.KeepAlive(cdstAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecCryptoInfo_getIV(p0 *AMediaCodecCryptoInfo, dst *uint8) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - cdst, cdstAllocMap := (*C.uint8_t)(unsafe.Pointer(dst)), cgoAllocsUnknown - __ret := C.AMediaCodecCryptoInfo_getIV(cp0, cdst) - runtime.KeepAlive(cdstAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecCryptoInfo_getKey(p0 *AMediaCodecCryptoInfo, dst *uint8) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - cdst, cdstAllocMap := (*C.uint8_t)(unsafe.Pointer(dst)), cgoAllocsUnknown - __ret := C.AMediaCodecCryptoInfo_getKey(cp0, cdst) - runtime.KeepAlive(cdstAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecCryptoInfo_getMode(p0 *AMediaCodecCryptoInfo) Cryptoinfo_mode_t { - cp0, cp0AllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodecCryptoInfo_getMode(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Cryptoinfo_mode_t)(__ret) - return __v -} - -func AMediaCodecCryptoInfo_getNumSubSamples(p0 *AMediaCodecCryptoInfo) uint64 { - cp0, cp0AllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodecCryptoInfo_getNumSubSamples(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (uint64)(__ret) - return __v -} - -func AMediaCodecCryptoInfo_new(numsubsamples int32, key *[16]uint8, iv *[16]uint8, mode Cryptoinfo_mode_t, clearbytes *uint64, encryptedbytes *uint64) *AMediaCodecCryptoInfo { - cnumsubsamples, cnumsubsamplesAllocMap := (C.int)(numsubsamples), cgoAllocsUnknown - ckey, ckeyAllocMap := (*C.uint8_t)(unsafe.Pointer(&key[0])), cgoAllocsUnknown - civ, civAllocMap := (*C.uint8_t)(unsafe.Pointer(&iv[0])), cgoAllocsUnknown - cmode, cmodeAllocMap := (C.cryptoinfo_mode_t)(mode), cgoAllocsUnknown - cclearbytes, cclearbytesAllocMap := (*C.uint64_t)(unsafe.Pointer(clearbytes)), cgoAllocsUnknown - cencryptedbytes, cencryptedbytesAllocMap := (*C.uint64_t)(unsafe.Pointer(encryptedbytes)), cgoAllocsUnknown - __ret := C.AMediaCodecCryptoInfo_new(cnumsubsamples, ckey, civ, cmode, cclearbytes, cencryptedbytes) - runtime.KeepAlive(cencryptedbytesAllocMap) - runtime.KeepAlive(cclearbytesAllocMap) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(civAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cnumsubsamplesAllocMap) - __v := (*AMediaCodecCryptoInfo)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodecCryptoInfo_setPattern(info *AMediaCodecCryptoInfo, pattern *Cryptoinfo_pattern_t) { - cinfo, cinfoAllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - cpattern, cpatternAllocMap := (*C.cryptoinfo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown - C.AMediaCodecCryptoInfo_setPattern(cinfo, cpattern) - runtime.KeepAlive(cpatternAllocMap) - runtime.KeepAlive(cinfoAllocMap) -} - -func AMediaCodec_configure(p0 *AMediaCodec, format *AMediaFormat, surface *ANativeWindow, crypto *AMediaCrypto, flags uint32) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cformat, cformatAllocMap := (*C.AMediaFormat)(unsafe.Pointer(format)), cgoAllocsUnknown - csurface, csurfaceAllocMap := (*C.ANativeWindow)(unsafe.Pointer(surface)), cgoAllocsUnknown - ccrypto, ccryptoAllocMap := (*C.AMediaCrypto)(unsafe.Pointer(crypto)), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.uint)(flags), cgoAllocsUnknown - __ret := C.AMediaCodec_configure(cp0, cformat, csurface, ccrypto, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(ccryptoAllocMap) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_createCodecByName(name string) *AMediaCodec { - cname, cnameAllocMap := UnpackPCharString(name) - __ret := C.AMediaCodec_createCodecByName(cname) - runtime.KeepAlive(cnameAllocMap) - __v := (*AMediaCodec)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodec_createDecoderByType(mime_type string) *AMediaCodec { - cmime_type, cmime_typeAllocMap := UnpackPCharString(mime_type) - __ret := C.AMediaCodec_createDecoderByType(cmime_type) - runtime.KeepAlive(cmime_typeAllocMap) - __v := (*AMediaCodec)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodec_createEncoderByType(mime_type string) *AMediaCodec { - cmime_type, cmime_typeAllocMap := UnpackPCharString(mime_type) - __ret := C.AMediaCodec_createEncoderByType(cmime_type) - runtime.KeepAlive(cmime_typeAllocMap) - __v := (*AMediaCodec)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodec_createInputSurface(mData *AMediaCodec, surface **ANativeWindow) Media_status_t { - cmData, cmDataAllocMap := (*C.AMediaCodec)(unsafe.Pointer(mData)), cgoAllocsUnknown - csurface, csurfaceAllocMap := (**C.ANativeWindow)(unsafe.Pointer(surface)), cgoAllocsUnknown - var pinnercsurface runtime.Pinner - pinnercsurface.Pin(surface) - if surface != nil { - pinnercsurface.Pin(unsafe.Pointer(*surface)) - } - defer pinnercsurface.Unpin() - __ret := C.AMediaCodec_createInputSurface(cmData, csurface) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cmDataAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_createPersistentInputSurface(surface **ANativeWindow) Media_status_t { - csurface, csurfaceAllocMap := (**C.ANativeWindow)(unsafe.Pointer(surface)), cgoAllocsUnknown - var pinnercsurface runtime.Pinner - pinnercsurface.Pin(surface) - if surface != nil { - pinnercsurface.Pin(unsafe.Pointer(*surface)) - } - defer pinnercsurface.Unpin() - __ret := C.AMediaCodec_createPersistentInputSurface(csurface) - runtime.KeepAlive(csurfaceAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_delete(p0 *AMediaCodec) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodec_delete(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_dequeueInputBuffer(p0 *AMediaCodec, timeoutUs int64) int64 { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - ctimeoutUs, ctimeoutUsAllocMap := (C.int64_t)(timeoutUs), cgoAllocsUnknown - __ret := C.AMediaCodec_dequeueInputBuffer(cp0, ctimeoutUs) - runtime.KeepAlive(ctimeoutUsAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (int64)(__ret) - return __v -} - -func AMediaCodec_dequeueOutputBuffer(p0 *AMediaCodec, info *AMediaCodecBufferInfo, timeoutUs int64) int64 { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cinfo, cinfoAllocMap := (*C.AMediaCodecBufferInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - ctimeoutUs, ctimeoutUsAllocMap := (C.int64_t)(timeoutUs), cgoAllocsUnknown - __ret := C.AMediaCodec_dequeueOutputBuffer(cp0, cinfo, ctimeoutUs) - runtime.KeepAlive(ctimeoutUsAllocMap) - runtime.KeepAlive(cinfoAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (int64)(__ret) - return __v -} - -func AMediaCodec_flush(p0 *AMediaCodec) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodec_flush(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_getBufferFormat(p0 *AMediaCodec, index uint64) *AMediaFormat { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint64_t)(index), cgoAllocsUnknown - __ret := C.AMediaCodec_getBufferFormat(cp0, cindex) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (*AMediaFormat)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodec_getInputBuffer(p0 *AMediaCodec, idx uint64, out_size *uint64) *uint8 { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - cout_size, cout_sizeAllocMap := (*C.uint64_t)(unsafe.Pointer(out_size)), cgoAllocsUnknown - __ret := C.AMediaCodec_getInputBuffer(cp0, cidx, cout_size) - runtime.KeepAlive(cout_sizeAllocMap) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (*uint8)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodec_getInputFormat(p0 *AMediaCodec) *AMediaFormat { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodec_getInputFormat(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (*AMediaFormat)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodec_getName(p0 *AMediaCodec, out_name **int8) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cout_name, cout_nameAllocMap := (**C.char)(unsafe.Pointer(out_name)), cgoAllocsUnknown - var pinnercout_name runtime.Pinner - pinnercout_name.Pin(out_name) - if out_name != nil { - pinnercout_name.Pin(unsafe.Pointer(*out_name)) - } - defer pinnercout_name.Unpin() - __ret := C.AMediaCodec_getName(cp0, cout_name) - runtime.KeepAlive(cout_nameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_getOutputBuffer(p0 *AMediaCodec, idx uint64, out_size *uint64) *uint8 { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - cout_size, cout_sizeAllocMap := (*C.uint64_t)(unsafe.Pointer(out_size)), cgoAllocsUnknown - __ret := C.AMediaCodec_getOutputBuffer(cp0, cidx, cout_size) - runtime.KeepAlive(cout_sizeAllocMap) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (*uint8)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodec_getOutputFormat(p0 *AMediaCodec) *AMediaFormat { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodec_getOutputFormat(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (*AMediaFormat)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCodec_queueInputBuffer(p0 *AMediaCodec, idx uint64, offset Off_t, size uint64, time uint64, flags uint32) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.off_t)(offset), cgoAllocsUnknown - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - ctime, ctimeAllocMap := (C.uint64_t)(time), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.uint)(flags), cgoAllocsUnknown - __ret := C.AMediaCodec_queueInputBuffer(cp0, cidx, coffset, csize, ctime, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(ctimeAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_queueSecureInputBuffer(p0 *AMediaCodec, idx uint64, offset Off_t, p3 *AMediaCodecCryptoInfo, time uint64, flags uint32) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.off_t)(offset), cgoAllocsUnknown - cp3, cp3AllocMap := (*C.AMediaCodecCryptoInfo)(unsafe.Pointer(p3)), cgoAllocsUnknown - ctime, ctimeAllocMap := (C.uint64_t)(time), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.uint)(flags), cgoAllocsUnknown - __ret := C.AMediaCodec_queueSecureInputBuffer(cp0, cidx, coffset, cp3, ctime, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(ctimeAllocMap) - runtime.KeepAlive(cp3AllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_releaseCrypto(p0 *AMediaCodec) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodec_releaseCrypto(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_releaseName(p0 *AMediaCodec, name string) { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - C.AMediaCodec_releaseName(cp0, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaCodec_releaseOutputBuffer(p0 *AMediaCodec, idx uint64, render bool) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - crender, crenderAllocMap := (C._Bool)(render), cgoAllocsUnknown - __ret := C.AMediaCodec_releaseOutputBuffer(cp0, cidx, crender) - runtime.KeepAlive(crenderAllocMap) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_releaseOutputBufferAtTime(mData *AMediaCodec, idx uint64, timestampNs int64) Media_status_t { - cmData, cmDataAllocMap := (*C.AMediaCodec)(unsafe.Pointer(mData)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - ctimestampNs, ctimestampNsAllocMap := (C.int64_t)(timestampNs), cgoAllocsUnknown - __ret := C.AMediaCodec_releaseOutputBufferAtTime(cmData, cidx, ctimestampNs) - runtime.KeepAlive(ctimestampNsAllocMap) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cmDataAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_setAsyncNotifyCallback(p0 *AMediaCodec, callback AMediaCodecOnAsyncNotifyCallback, userdata unsafe.Pointer) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := (C.AMediaCodecOnAsyncNotifyCallback)(callback), cgoAllocsUnknown - cuserdata, cuserdataAllocMap := userdata, cgoAllocsUnknown - __ret := C.AMediaCodec_setAsyncNotifyCallback(cp0, ccallback, cuserdata) - runtime.KeepAlive(cuserdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_setInputSurface(mData *AMediaCodec, surface *ANativeWindow) Media_status_t { - cmData, cmDataAllocMap := (*C.AMediaCodec)(unsafe.Pointer(mData)), cgoAllocsUnknown - csurface, csurfaceAllocMap := (*C.ANativeWindow)(unsafe.Pointer(surface)), cgoAllocsUnknown - __ret := C.AMediaCodec_setInputSurface(cmData, csurface) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cmDataAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_setOnFrameRenderedCallback(p0 *AMediaCodec, callback AMediaCodecOnFrameRendered, userdata unsafe.Pointer) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cuserdata, cuserdataAllocMap := userdata, cgoAllocsUnknown - __ret := C.AMediaCodec_setOnFrameRenderedCallback(cp0, ccallback, cuserdata) - runtime.KeepAlive(cuserdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_setOutputSurface(p0 *AMediaCodec, surface *ANativeWindow) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - csurface, csurfaceAllocMap := (*C.ANativeWindow)(unsafe.Pointer(surface)), cgoAllocsUnknown - __ret := C.AMediaCodec_setOutputSurface(cp0, csurface) - runtime.KeepAlive(csurfaceAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_setParameters(mData *AMediaCodec, params *AMediaFormat) Media_status_t { - cmData, cmDataAllocMap := (*C.AMediaCodec)(unsafe.Pointer(mData)), cgoAllocsUnknown - cparams, cparamsAllocMap := (*C.AMediaFormat)(unsafe.Pointer(params)), cgoAllocsUnknown - __ret := C.AMediaCodec_setParameters(cmData, cparams) - runtime.KeepAlive(cparamsAllocMap) - runtime.KeepAlive(cmDataAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_signalEndOfInputStream(mData *AMediaCodec) Media_status_t { - cmData, cmDataAllocMap := (*C.AMediaCodec)(unsafe.Pointer(mData)), cgoAllocsUnknown - __ret := C.AMediaCodec_signalEndOfInputStream(cmData) - runtime.KeepAlive(cmDataAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_start(p0 *AMediaCodec) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodec_start(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodec_stop(p0 *AMediaCodec) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaCodec)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaCodec_stop(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCrypto_delete(crypto *AMediaCrypto) { - ccrypto, ccryptoAllocMap := (*C.AMediaCrypto)(unsafe.Pointer(crypto)), cgoAllocsUnknown - C.AMediaCrypto_delete(ccrypto) - runtime.KeepAlive(ccryptoAllocMap) -} - -func AMediaCrypto_isCryptoSchemeSupported(uuid AMediaUUID) bool { - __ret := C.AMediaCrypto_isCryptoSchemeSupported((*C.uint8_t)(unsafe.Pointer(&uuid[0]))) - __v := (bool)(__ret) - return __v -} - -func AMediaCrypto_new(uuid AMediaUUID, initData unsafe.Pointer, initDataSize uint64) *AMediaCrypto { - cinitData, cinitDataAllocMap := initData, cgoAllocsUnknown - cinitDataSize, cinitDataSizeAllocMap := (C.uint64_t)(initDataSize), cgoAllocsUnknown - __ret := C.AMediaCrypto_new((*C.uint8_t)(unsafe.Pointer(&uuid[0])), cinitData, cinitDataSize) - runtime.KeepAlive(cinitDataSizeAllocMap) - runtime.KeepAlive(cinitDataAllocMap) - __v := (*AMediaCrypto)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaCrypto_requiresSecureDecoderComponent(mime string) bool { - cmime, cmimeAllocMap := UnpackPCharString(mime) - __ret := C.AMediaCrypto_requiresSecureDecoderComponent(cmime) - runtime.KeepAlive(cmimeAllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaDataSource_close(p0 *AMediaDataSource) { - cp0, cp0AllocMap := (*C.AMediaDataSource)(unsafe.Pointer(p0)), cgoAllocsUnknown - C.AMediaDataSource_close(cp0) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaDataSource_delete(p0 *AMediaDataSource) { - cp0, cp0AllocMap := (*C.AMediaDataSource)(unsafe.Pointer(p0)), cgoAllocsUnknown - C.AMediaDataSource_delete(cp0) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaDataSource_new() *AMediaDataSource { - __ret := C.AMediaDataSource_new() - __v := (*AMediaDataSource)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaDataSource_newUri(uri string, numheaders int32, key_values **int8) *AMediaDataSource { - curi, curiAllocMap := UnpackPCharString(uri) - cnumheaders, cnumheadersAllocMap := (C.int)(numheaders), cgoAllocsUnknown - ckey_values, ckey_valuesAllocMap := (**C.char)(unsafe.Pointer(key_values)), cgoAllocsUnknown - var pinnerckey_values runtime.Pinner - pinnerckey_values.Pin(key_values) - if key_values != nil { - pinnerckey_values.Pin(unsafe.Pointer(*key_values)) - } - defer pinnerckey_values.Unpin() - __ret := C.AMediaDataSource_newUri(curi, cnumheaders, ckey_values) - runtime.KeepAlive(ckey_valuesAllocMap) - runtime.KeepAlive(cnumheadersAllocMap) - runtime.KeepAlive(curiAllocMap) - __v := (*AMediaDataSource)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaDataSource_setClose(p0 *AMediaDataSource, p1 AMediaDataSourceClose) { - cp0, cp0AllocMap := (*C.AMediaDataSource)(unsafe.Pointer(p0)), cgoAllocsUnknown - cp1, cp1AllocMap := p1.PassValue() - C.AMediaDataSource_setClose(cp0, cp1) - runtime.KeepAlive(cp1AllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaDataSource_setGetAvailableSize(p0 *AMediaDataSource, p1 AMediaDataSourceGetAvailableSize) { - cp0, cp0AllocMap := (*C.AMediaDataSource)(unsafe.Pointer(p0)), cgoAllocsUnknown - cp1, cp1AllocMap := p1.PassValue() - C.AMediaDataSource_setGetAvailableSize(cp0, cp1) - runtime.KeepAlive(cp1AllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaDataSource_setGetSize(p0 *AMediaDataSource, p1 AMediaDataSourceGetSize) { - cp0, cp0AllocMap := (*C.AMediaDataSource)(unsafe.Pointer(p0)), cgoAllocsUnknown - cp1, cp1AllocMap := p1.PassValue() - C.AMediaDataSource_setGetSize(cp0, cp1) - runtime.KeepAlive(cp1AllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaDataSource_setReadAt(p0 *AMediaDataSource, p1 AMediaDataSourceReadAt) { - cp0, cp0AllocMap := (*C.AMediaDataSource)(unsafe.Pointer(p0)), cgoAllocsUnknown - cp1, cp1AllocMap := p1.PassValue() - C.AMediaDataSource_setReadAt(cp0, cp1) - runtime.KeepAlive(cp1AllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaDataSource_setUserdata(p0 *AMediaDataSource, userdata unsafe.Pointer) { - cp0, cp0AllocMap := (*C.AMediaDataSource)(unsafe.Pointer(p0)), cgoAllocsUnknown - cuserdata, cuserdataAllocMap := userdata, cgoAllocsUnknown - C.AMediaDataSource_setUserdata(cp0, cuserdata) - runtime.KeepAlive(cuserdataAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaDrm_closeSession(p0 *AMediaDrm, sessionId *AMediaDrmSessionId) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(sessionId)), cgoAllocsUnknown - __ret := C.AMediaDrm_closeSession(cp0, csessionId) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_createByUUID(uuid *uint8) *AMediaDrm { - cuuid, cuuidAllocMap := (*C.uint8_t)(unsafe.Pointer(uuid)), cgoAllocsUnknown - __ret := C.AMediaDrm_createByUUID(cuuid) - runtime.KeepAlive(cuuidAllocMap) - __v := (*AMediaDrm)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaDrm_decrypt(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, cipherAlgorithm string, keyId *uint8, iv *uint8, input *uint8, output *uint8, dataSize uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(sessionId)), cgoAllocsUnknown - ccipherAlgorithm, ccipherAlgorithmAllocMap := UnpackPCharString(cipherAlgorithm) - ckeyId, ckeyIdAllocMap := (*C.uint8_t)(unsafe.Pointer(keyId)), cgoAllocsUnknown - civ, civAllocMap := (*C.uint8_t)(unsafe.Pointer(iv)), cgoAllocsUnknown - cinput, cinputAllocMap := (*C.uint8_t)(unsafe.Pointer(input)), cgoAllocsUnknown - coutput, coutputAllocMap := (*C.uint8_t)(unsafe.Pointer(output)), cgoAllocsUnknown - cdataSize, cdataSizeAllocMap := (C.uint64_t)(dataSize), cgoAllocsUnknown - __ret := C.AMediaDrm_decrypt(cp0, csessionId, ccipherAlgorithm, ckeyId, civ, cinput, coutput, cdataSize) - runtime.KeepAlive(cdataSizeAllocMap) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(cinputAllocMap) - runtime.KeepAlive(civAllocMap) - runtime.KeepAlive(ckeyIdAllocMap) - runtime.KeepAlive(ccipherAlgorithmAllocMap) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_encrypt(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, cipherAlgorithm string, keyId *uint8, iv *uint8, input *uint8, output *uint8, dataSize uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(sessionId)), cgoAllocsUnknown - ccipherAlgorithm, ccipherAlgorithmAllocMap := UnpackPCharString(cipherAlgorithm) - ckeyId, ckeyIdAllocMap := (*C.uint8_t)(unsafe.Pointer(keyId)), cgoAllocsUnknown - civ, civAllocMap := (*C.uint8_t)(unsafe.Pointer(iv)), cgoAllocsUnknown - cinput, cinputAllocMap := (*C.uint8_t)(unsafe.Pointer(input)), cgoAllocsUnknown - coutput, coutputAllocMap := (*C.uint8_t)(unsafe.Pointer(output)), cgoAllocsUnknown - cdataSize, cdataSizeAllocMap := (C.uint64_t)(dataSize), cgoAllocsUnknown - __ret := C.AMediaDrm_encrypt(cp0, csessionId, ccipherAlgorithm, ckeyId, civ, cinput, coutput, cdataSize) - runtime.KeepAlive(cdataSizeAllocMap) - runtime.KeepAlive(coutputAllocMap) - runtime.KeepAlive(cinputAllocMap) - runtime.KeepAlive(civAllocMap) - runtime.KeepAlive(ckeyIdAllocMap) - runtime.KeepAlive(ccipherAlgorithmAllocMap) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_getKeyRequest(p0 *AMediaDrm, scope *AMediaDrmScope, init *uint8, initSize uint64, mimeType string, keyType AMediaDrmKeyType, optionalParameters *AMediaDrmKeyValue, numOptionalParameters uint64, keyRequest **uint8, keyRequestSize *uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cscope, cscopeAllocMap := (*C.AMediaDrmScope)(unsafe.Pointer(scope)), cgoAllocsUnknown - cinit, cinitAllocMap := (*C.uint8_t)(unsafe.Pointer(init)), cgoAllocsUnknown - cinitSize, cinitSizeAllocMap := (C.uint64_t)(initSize), cgoAllocsUnknown - cmimeType, cmimeTypeAllocMap := UnpackPCharString(mimeType) - ckeyType, ckeyTypeAllocMap := (C.AMediaDrmKeyType)(keyType), cgoAllocsUnknown - coptionalParameters, coptionalParametersAllocMap := (*C.AMediaDrmKeyValue)(unsafe.Pointer(optionalParameters)), cgoAllocsUnknown - cnumOptionalParameters, cnumOptionalParametersAllocMap := (C.uint64_t)(numOptionalParameters), cgoAllocsUnknown - ckeyRequest, ckeyRequestAllocMap := (**C.uint8_t)(unsafe.Pointer(keyRequest)), cgoAllocsUnknown - var pinnerckeyRequest runtime.Pinner - pinnerckeyRequest.Pin(keyRequest) - if keyRequest != nil { - pinnerckeyRequest.Pin(unsafe.Pointer(*keyRequest)) - } - defer pinnerckeyRequest.Unpin() - ckeyRequestSize, ckeyRequestSizeAllocMap := (*C.uint64_t)(unsafe.Pointer(keyRequestSize)), cgoAllocsUnknown - __ret := C.AMediaDrm_getKeyRequest(cp0, cscope, cinit, cinitSize, cmimeType, ckeyType, coptionalParameters, cnumOptionalParameters, ckeyRequest, ckeyRequestSize) - runtime.KeepAlive(ckeyRequestSizeAllocMap) - runtime.KeepAlive(ckeyRequestAllocMap) - runtime.KeepAlive(cnumOptionalParametersAllocMap) - runtime.KeepAlive(coptionalParametersAllocMap) - runtime.KeepAlive(ckeyTypeAllocMap) - runtime.KeepAlive(cmimeTypeAllocMap) - runtime.KeepAlive(cinitSizeAllocMap) - runtime.KeepAlive(cinitAllocMap) - runtime.KeepAlive(cscopeAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_getKeyRequestWithDefaultUrlAndType(p0 *AMediaDrm, scope *AMediaDrmScope, init *uint8, initSize uint64, mimeType string, keyType AMediaDrmKeyType, optionalParameters *AMediaDrmKeyValue, numOptionalParameters uint64, keyRequest **uint8, keyRequestSize *uint64, defaultUrl **int8, keyRequestType *AMediaDrmKeyRequestType) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cscope, cscopeAllocMap := (*C.AMediaDrmScope)(unsafe.Pointer(scope)), cgoAllocsUnknown - cinit, cinitAllocMap := (*C.uint8_t)(unsafe.Pointer(init)), cgoAllocsUnknown - cinitSize, cinitSizeAllocMap := (C.uint64_t)(initSize), cgoAllocsUnknown - cmimeType, cmimeTypeAllocMap := UnpackPCharString(mimeType) - ckeyType, ckeyTypeAllocMap := (C.AMediaDrmKeyType)(keyType), cgoAllocsUnknown - coptionalParameters, coptionalParametersAllocMap := (*C.AMediaDrmKeyValue)(unsafe.Pointer(optionalParameters)), cgoAllocsUnknown - cnumOptionalParameters, cnumOptionalParametersAllocMap := (C.uint64_t)(numOptionalParameters), cgoAllocsUnknown - ckeyRequest, ckeyRequestAllocMap := (**C.uint8_t)(unsafe.Pointer(keyRequest)), cgoAllocsUnknown - var pinnerckeyRequest runtime.Pinner - pinnerckeyRequest.Pin(keyRequest) - if keyRequest != nil { - pinnerckeyRequest.Pin(unsafe.Pointer(*keyRequest)) - } - defer pinnerckeyRequest.Unpin() - ckeyRequestSize, ckeyRequestSizeAllocMap := (*C.uint64_t)(unsafe.Pointer(keyRequestSize)), cgoAllocsUnknown - cdefaultUrl, cdefaultUrlAllocMap := (**C.char)(unsafe.Pointer(defaultUrl)), cgoAllocsUnknown - var pinnercdefaultUrl runtime.Pinner - pinnercdefaultUrl.Pin(defaultUrl) - if defaultUrl != nil { - pinnercdefaultUrl.Pin(unsafe.Pointer(*defaultUrl)) - } - defer pinnercdefaultUrl.Unpin() - ckeyRequestType, ckeyRequestTypeAllocMap := (*C.AMediaDrmKeyRequestType)(unsafe.Pointer(keyRequestType)), cgoAllocsUnknown - __ret := C.AMediaDrm_getKeyRequestWithDefaultUrlAndType(cp0, cscope, cinit, cinitSize, cmimeType, ckeyType, coptionalParameters, cnumOptionalParameters, ckeyRequest, ckeyRequestSize, cdefaultUrl, ckeyRequestType) - runtime.KeepAlive(ckeyRequestTypeAllocMap) - runtime.KeepAlive(cdefaultUrlAllocMap) - runtime.KeepAlive(ckeyRequestSizeAllocMap) - runtime.KeepAlive(ckeyRequestAllocMap) - runtime.KeepAlive(cnumOptionalParametersAllocMap) - runtime.KeepAlive(coptionalParametersAllocMap) - runtime.KeepAlive(ckeyTypeAllocMap) - runtime.KeepAlive(cmimeTypeAllocMap) - runtime.KeepAlive(cinitSizeAllocMap) - runtime.KeepAlive(cinitAllocMap) - runtime.KeepAlive(cscopeAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_getPropertyByteArray(p0 *AMediaDrm, propertyName string, propertyValue *AMediaDrmByteArray) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cpropertyName, cpropertyNameAllocMap := UnpackPCharString(propertyName) - cpropertyValue, cpropertyValueAllocMap := (*C.AMediaDrmByteArray)(unsafe.Pointer(propertyValue)), cgoAllocsUnknown - __ret := C.AMediaDrm_getPropertyByteArray(cp0, cpropertyName, cpropertyValue) - runtime.KeepAlive(cpropertyValueAllocMap) - runtime.KeepAlive(cpropertyNameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_getPropertyString(p0 *AMediaDrm, propertyName string, propertyValue **int8) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cpropertyName, cpropertyNameAllocMap := UnpackPCharString(propertyName) - cpropertyValue, cpropertyValueAllocMap := (**C.char)(unsafe.Pointer(propertyValue)), cgoAllocsUnknown - var pinnercpropertyValue runtime.Pinner - pinnercpropertyValue.Pin(propertyValue) - if propertyValue != nil { - pinnercpropertyValue.Pin(unsafe.Pointer(*propertyValue)) - } - defer pinnercpropertyValue.Unpin() - __ret := C.AMediaDrm_getPropertyString(cp0, cpropertyName, cpropertyValue) - runtime.KeepAlive(cpropertyValueAllocMap) - runtime.KeepAlive(cpropertyNameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_getProvisionRequest(p0 *AMediaDrm, provisionRequest **uint8, provisionRequestSize *uint64, serverUrl **int8) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cprovisionRequest, cprovisionRequestAllocMap := (**C.uint8_t)(unsafe.Pointer(provisionRequest)), cgoAllocsUnknown - var pinnercprovisionRequest runtime.Pinner - pinnercprovisionRequest.Pin(provisionRequest) - if provisionRequest != nil { - pinnercprovisionRequest.Pin(unsafe.Pointer(*provisionRequest)) - } - defer pinnercprovisionRequest.Unpin() - cprovisionRequestSize, cprovisionRequestSizeAllocMap := (*C.uint64_t)(unsafe.Pointer(provisionRequestSize)), cgoAllocsUnknown - cserverUrl, cserverUrlAllocMap := (**C.char)(unsafe.Pointer(serverUrl)), cgoAllocsUnknown - var pinnercserverUrl runtime.Pinner - pinnercserverUrl.Pin(serverUrl) - if serverUrl != nil { - pinnercserverUrl.Pin(unsafe.Pointer(*serverUrl)) - } - defer pinnercserverUrl.Unpin() - __ret := C.AMediaDrm_getProvisionRequest(cp0, cprovisionRequest, cprovisionRequestSize, cserverUrl) - runtime.KeepAlive(cserverUrlAllocMap) - runtime.KeepAlive(cprovisionRequestSizeAllocMap) - runtime.KeepAlive(cprovisionRequestAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_getSecureStops(p0 *AMediaDrm, secureStops *AMediaDrmSecureStop, numSecureStops *uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csecureStops, csecureStopsAllocMap := (*C.AMediaDrmSecureStop)(unsafe.Pointer(secureStops)), cgoAllocsUnknown - cnumSecureStops, cnumSecureStopsAllocMap := (*C.uint64_t)(unsafe.Pointer(numSecureStops)), cgoAllocsUnknown - __ret := C.AMediaDrm_getSecureStops(cp0, csecureStops, cnumSecureStops) - runtime.KeepAlive(cnumSecureStopsAllocMap) - runtime.KeepAlive(csecureStopsAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_isCryptoSchemeSupported(uuid *uint8, mimeType string) bool { - cuuid, cuuidAllocMap := (*C.uint8_t)(unsafe.Pointer(uuid)), cgoAllocsUnknown - cmimeType, cmimeTypeAllocMap := UnpackPCharString(mimeType) - __ret := C.AMediaDrm_isCryptoSchemeSupported(cuuid, cmimeType) - runtime.KeepAlive(cmimeTypeAllocMap) - runtime.KeepAlive(cuuidAllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaDrm_openSession(p0 *AMediaDrm, sessionId *AMediaDrmSessionId) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(sessionId)), cgoAllocsUnknown - __ret := C.AMediaDrm_openSession(cp0, csessionId) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_provideKeyResponse(p0 *AMediaDrm, scope *AMediaDrmScope, response *uint8, responseSize uint64, keySetId *AMediaDrmKeySetId) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cscope, cscopeAllocMap := (*C.AMediaDrmScope)(unsafe.Pointer(scope)), cgoAllocsUnknown - cresponse, cresponseAllocMap := (*C.uint8_t)(unsafe.Pointer(response)), cgoAllocsUnknown - cresponseSize, cresponseSizeAllocMap := (C.uint64_t)(responseSize), cgoAllocsUnknown - ckeySetId, ckeySetIdAllocMap := (*C.AMediaDrmKeySetId)(unsafe.Pointer(keySetId)), cgoAllocsUnknown - __ret := C.AMediaDrm_provideKeyResponse(cp0, cscope, cresponse, cresponseSize, ckeySetId) - runtime.KeepAlive(ckeySetIdAllocMap) - runtime.KeepAlive(cresponseSizeAllocMap) - runtime.KeepAlive(cresponseAllocMap) - runtime.KeepAlive(cscopeAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_provideProvisionResponse(p0 *AMediaDrm, response *uint8, responseSize uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cresponse, cresponseAllocMap := (*C.uint8_t)(unsafe.Pointer(response)), cgoAllocsUnknown - cresponseSize, cresponseSizeAllocMap := (C.uint64_t)(responseSize), cgoAllocsUnknown - __ret := C.AMediaDrm_provideProvisionResponse(cp0, cresponse, cresponseSize) - runtime.KeepAlive(cresponseSizeAllocMap) - runtime.KeepAlive(cresponseAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_queryKeyStatus(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, keyValuePairs *AMediaDrmKeyValue, numPairs *uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(sessionId)), cgoAllocsUnknown - ckeyValuePairs, ckeyValuePairsAllocMap := (*C.AMediaDrmKeyValue)(unsafe.Pointer(keyValuePairs)), cgoAllocsUnknown - cnumPairs, cnumPairsAllocMap := (*C.uint64_t)(unsafe.Pointer(numPairs)), cgoAllocsUnknown - __ret := C.AMediaDrm_queryKeyStatus(cp0, csessionId, ckeyValuePairs, cnumPairs) - runtime.KeepAlive(cnumPairsAllocMap) - runtime.KeepAlive(ckeyValuePairsAllocMap) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_release(p0 *AMediaDrm) { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - C.AMediaDrm_release(cp0) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaDrm_releaseSecureStops(p0 *AMediaDrm, ssRelease *AMediaDrmSecureStop) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cssRelease, cssReleaseAllocMap := (*C.AMediaDrmSecureStop)(unsafe.Pointer(ssRelease)), cgoAllocsUnknown - __ret := C.AMediaDrm_releaseSecureStops(cp0, cssRelease) - runtime.KeepAlive(cssReleaseAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_removeKeys(p0 *AMediaDrm, keySetId *AMediaDrmSessionId) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - ckeySetId, ckeySetIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(keySetId)), cgoAllocsUnknown - __ret := C.AMediaDrm_removeKeys(cp0, ckeySetId) - runtime.KeepAlive(ckeySetIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_restoreKeys(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, keySetId *AMediaDrmKeySetId) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(sessionId)), cgoAllocsUnknown - ckeySetId, ckeySetIdAllocMap := (*C.AMediaDrmKeySetId)(unsafe.Pointer(keySetId)), cgoAllocsUnknown - __ret := C.AMediaDrm_restoreKeys(cp0, csessionId, ckeySetId) - runtime.KeepAlive(ckeySetIdAllocMap) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_setOnEventListener(p0 *AMediaDrm, listener AMediaDrmEventListener) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - clistener, clistenerAllocMap := listener.PassValue() - __ret := C.AMediaDrm_setOnEventListener(cp0, clistener) - runtime.KeepAlive(clistenerAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_setOnExpirationUpdateListener(p0 *AMediaDrm, listener AMediaDrmExpirationUpdateListener) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - clistener, clistenerAllocMap := listener.PassValue() - __ret := C.AMediaDrm_setOnExpirationUpdateListener(cp0, clistener) - runtime.KeepAlive(clistenerAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_setOnKeysChangeListener(p0 *AMediaDrm, listener AMediaDrmKeysChangeListener) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - clistener, clistenerAllocMap := listener.PassValue() - __ret := C.AMediaDrm_setOnKeysChangeListener(cp0, clistener) - runtime.KeepAlive(clistenerAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_setPropertyByteArray(p0 *AMediaDrm, propertyName string, value *uint8, valueSize uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cpropertyName, cpropertyNameAllocMap := UnpackPCharString(propertyName) - cvalue, cvalueAllocMap := (*C.uint8_t)(unsafe.Pointer(value)), cgoAllocsUnknown - cvalueSize, cvalueSizeAllocMap := (C.uint64_t)(valueSize), cgoAllocsUnknown - __ret := C.AMediaDrm_setPropertyByteArray(cp0, cpropertyName, cvalue, cvalueSize) - runtime.KeepAlive(cvalueSizeAllocMap) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cpropertyNameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_setPropertyString(p0 *AMediaDrm, propertyName string, value string) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - cpropertyName, cpropertyNameAllocMap := UnpackPCharString(propertyName) - cvalue, cvalueAllocMap := UnpackPCharString(value) - __ret := C.AMediaDrm_setPropertyString(cp0, cpropertyName, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cpropertyNameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_sign(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, macAlgorithm string, keyId *uint8, message *uint8, messageSize uint64, signature *uint8, signatureSize *uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(sessionId)), cgoAllocsUnknown - cmacAlgorithm, cmacAlgorithmAllocMap := UnpackPCharString(macAlgorithm) - ckeyId, ckeyIdAllocMap := (*C.uint8_t)(unsafe.Pointer(keyId)), cgoAllocsUnknown - cmessage, cmessageAllocMap := (*C.uint8_t)(unsafe.Pointer(message)), cgoAllocsUnknown - cmessageSize, cmessageSizeAllocMap := (C.uint64_t)(messageSize), cgoAllocsUnknown - csignature, csignatureAllocMap := (*C.uint8_t)(unsafe.Pointer(signature)), cgoAllocsUnknown - csignatureSize, csignatureSizeAllocMap := (*C.uint64_t)(unsafe.Pointer(signatureSize)), cgoAllocsUnknown - __ret := C.AMediaDrm_sign(cp0, csessionId, cmacAlgorithm, ckeyId, cmessage, cmessageSize, csignature, csignatureSize) - runtime.KeepAlive(csignatureSizeAllocMap) - runtime.KeepAlive(csignatureAllocMap) - runtime.KeepAlive(cmessageSizeAllocMap) - runtime.KeepAlive(cmessageAllocMap) - runtime.KeepAlive(ckeyIdAllocMap) - runtime.KeepAlive(cmacAlgorithmAllocMap) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaDrm_verify(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, macAlgorithm string, keyId *uint8, message *uint8, messageSize uint64, signature *uint8, signatureSize uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaDrm)(unsafe.Pointer(p0)), cgoAllocsUnknown - csessionId, csessionIdAllocMap := (*C.AMediaDrmSessionId)(unsafe.Pointer(sessionId)), cgoAllocsUnknown - cmacAlgorithm, cmacAlgorithmAllocMap := UnpackPCharString(macAlgorithm) - ckeyId, ckeyIdAllocMap := (*C.uint8_t)(unsafe.Pointer(keyId)), cgoAllocsUnknown - cmessage, cmessageAllocMap := (*C.uint8_t)(unsafe.Pointer(message)), cgoAllocsUnknown - cmessageSize, cmessageSizeAllocMap := (C.uint64_t)(messageSize), cgoAllocsUnknown - csignature, csignatureAllocMap := (*C.uint8_t)(unsafe.Pointer(signature)), cgoAllocsUnknown - csignatureSize, csignatureSizeAllocMap := (C.uint64_t)(signatureSize), cgoAllocsUnknown - __ret := C.AMediaDrm_verify(cp0, csessionId, cmacAlgorithm, ckeyId, cmessage, cmessageSize, csignature, csignatureSize) - runtime.KeepAlive(csignatureSizeAllocMap) - runtime.KeepAlive(csignatureAllocMap) - runtime.KeepAlive(cmessageSizeAllocMap) - runtime.KeepAlive(cmessageAllocMap) - runtime.KeepAlive(ckeyIdAllocMap) - runtime.KeepAlive(cmacAlgorithmAllocMap) - runtime.KeepAlive(csessionIdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaExtractor_advance(p0 *AMediaExtractor) bool { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_advance(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaExtractor_delete(p0 *AMediaExtractor) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_delete(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaExtractor_getCachedDuration(p0 *AMediaExtractor) int64 { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getCachedDuration(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int64)(__ret) - return __v -} - -func AMediaExtractor_getFileFormat(p0 *AMediaExtractor) *AMediaFormat { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getFileFormat(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (*AMediaFormat)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaExtractor_getPsshInfo(p0 *AMediaExtractor) *PsshInfo { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getPsshInfo(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (*PsshInfo)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaExtractor_getSampleCryptoInfo(p0 *AMediaExtractor) *AMediaCodecCryptoInfo { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getSampleCryptoInfo(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (*AMediaCodecCryptoInfo)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaExtractor_getSampleFlags(p0 *AMediaExtractor) uint32 { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getSampleFlags(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (uint32)(__ret) - return __v -} - -func AMediaExtractor_getSampleFormat(ex *AMediaExtractor, fmt *AMediaFormat) Media_status_t { - cex, cexAllocMap := (*C.AMediaExtractor)(unsafe.Pointer(ex)), cgoAllocsUnknown - cfmt, cfmtAllocMap := (*C.AMediaFormat)(unsafe.Pointer(fmt)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getSampleFormat(cex, cfmt) - runtime.KeepAlive(cfmtAllocMap) - runtime.KeepAlive(cexAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaExtractor_getSampleSize(p0 *AMediaExtractor) int64 { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getSampleSize(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int64)(__ret) - return __v -} - -func AMediaExtractor_getSampleTime(p0 *AMediaExtractor) int64 { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getSampleTime(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int64)(__ret) - return __v -} - -func AMediaExtractor_getSampleTrackIndex(p0 *AMediaExtractor) int32 { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getSampleTrackIndex(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int32)(__ret) - return __v -} - -func AMediaExtractor_getTrackCount(p0 *AMediaExtractor) uint64 { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaExtractor_getTrackCount(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (uint64)(__ret) - return __v -} - -func AMediaExtractor_getTrackFormat(p0 *AMediaExtractor, idx uint64) *AMediaFormat { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - __ret := C.AMediaExtractor_getTrackFormat(cp0, cidx) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (*AMediaFormat)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaExtractor_new() *AMediaExtractor { - __ret := C.AMediaExtractor_new() - __v := (*AMediaExtractor)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaExtractor_readSampleData(p0 *AMediaExtractor, buffer *uint8, capacity uint64) int64 { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (*C.uint8_t)(unsafe.Pointer(buffer)), cgoAllocsUnknown - ccapacity, ccapacityAllocMap := (C.uint64_t)(capacity), cgoAllocsUnknown - __ret := C.AMediaExtractor_readSampleData(cp0, cbuffer, ccapacity) - runtime.KeepAlive(ccapacityAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (int64)(__ret) - return __v -} - -func AMediaExtractor_seekTo(p0 *AMediaExtractor, seekPosUs int64, mode SeekMode) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - cseekPosUs, cseekPosUsAllocMap := (C.int64_t)(seekPosUs), cgoAllocsUnknown - cmode, cmodeAllocMap := (C.SeekMode)(mode), cgoAllocsUnknown - __ret := C.AMediaExtractor_seekTo(cp0, cseekPosUs, cmode) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(cseekPosUsAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaExtractor_selectTrack(p0 *AMediaExtractor, idx uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - __ret := C.AMediaExtractor_selectTrack(cp0, cidx) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaExtractor_setDataSource(p0 *AMediaExtractor, location string) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - clocation, clocationAllocMap := UnpackPCharString(location) - __ret := C.AMediaExtractor_setDataSource(cp0, clocation) - runtime.KeepAlive(clocationAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaExtractor_setDataSourceCustom(p0 *AMediaExtractor, src *AMediaDataSource) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - csrc, csrcAllocMap := (*C.AMediaDataSource)(unsafe.Pointer(src)), cgoAllocsUnknown - __ret := C.AMediaExtractor_setDataSourceCustom(cp0, csrc) - runtime.KeepAlive(csrcAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaExtractor_setDataSourceFd(p0 *AMediaExtractor, fd int32, offset Off64_t, length Off64_t) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.off64_t)(offset), cgoAllocsUnknown - clength, clengthAllocMap := (C.off64_t)(length), cgoAllocsUnknown - __ret := C.AMediaExtractor_setDataSourceFd(cp0, cfd, coffset, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaExtractor_unselectTrack(p0 *AMediaExtractor, idx uint64) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaExtractor)(unsafe.Pointer(p0)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - __ret := C.AMediaExtractor_unselectTrack(cp0, cidx) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaFormat_clear(p0 *AMediaFormat) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - C.AMediaFormat_clear(cp0) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_copy(to *AMediaFormat, from *AMediaFormat) Media_status_t { - cto, ctoAllocMap := (*C.AMediaFormat)(unsafe.Pointer(to)), cgoAllocsUnknown - cfrom, cfromAllocMap := (*C.AMediaFormat)(unsafe.Pointer(from)), cgoAllocsUnknown - __ret := C.AMediaFormat_copy(cto, cfrom) - runtime.KeepAlive(cfromAllocMap) - runtime.KeepAlive(ctoAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaFormat_delete(p0 *AMediaFormat) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaFormat_delete(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaFormat_getBuffer(p0 *AMediaFormat, name string, data *unsafe.Pointer, size *uint64) bool { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cdata, cdataAllocMap := data, cgoAllocsUnknown - csize, csizeAllocMap := (*C.uint64_t)(unsafe.Pointer(size)), cgoAllocsUnknown - __ret := C.AMediaFormat_getBuffer(cp0, cname, cdata, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaFormat_getDouble(p0 *AMediaFormat, name string, out *float64) bool { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cout, coutAllocMap := (*C.double)(unsafe.Pointer(out)), cgoAllocsUnknown - __ret := C.AMediaFormat_getDouble(cp0, cname, cout) - runtime.KeepAlive(coutAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaFormat_getFloat(p0 *AMediaFormat, name string, out *float32) bool { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cout, coutAllocMap := (*C.float)(unsafe.Pointer(out)), cgoAllocsUnknown - __ret := C.AMediaFormat_getFloat(cp0, cname, cout) - runtime.KeepAlive(coutAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaFormat_getInt32(p0 *AMediaFormat, name string, out *int32) bool { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cout, coutAllocMap := (*C.int)(unsafe.Pointer(out)), cgoAllocsUnknown - __ret := C.AMediaFormat_getInt32(cp0, cname, cout) - runtime.KeepAlive(coutAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaFormat_getInt64(p0 *AMediaFormat, name string, out *int64) bool { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cout, coutAllocMap := (*C.int64_t)(unsafe.Pointer(out)), cgoAllocsUnknown - __ret := C.AMediaFormat_getInt64(cp0, cname, cout) - runtime.KeepAlive(coutAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaFormat_getRect(p0 *AMediaFormat, name string, left *int32, top *int32, right *int32, bottom *int32) bool { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cleft, cleftAllocMap := (*C.int)(unsafe.Pointer(left)), cgoAllocsUnknown - ctop, ctopAllocMap := (*C.int)(unsafe.Pointer(top)), cgoAllocsUnknown - cright, crightAllocMap := (*C.int)(unsafe.Pointer(right)), cgoAllocsUnknown - cbottom, cbottomAllocMap := (*C.int)(unsafe.Pointer(bottom)), cgoAllocsUnknown - __ret := C.AMediaFormat_getRect(cp0, cname, cleft, ctop, cright, cbottom) - runtime.KeepAlive(cbottomAllocMap) - runtime.KeepAlive(crightAllocMap) - runtime.KeepAlive(ctopAllocMap) - runtime.KeepAlive(cleftAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaFormat_getSize(p0 *AMediaFormat, name string, out *uint64) bool { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cout, coutAllocMap := (*C.uint64_t)(unsafe.Pointer(out)), cgoAllocsUnknown - __ret := C.AMediaFormat_getSize(cp0, cname, cout) - runtime.KeepAlive(coutAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaFormat_getString(p0 *AMediaFormat, name string, out **int8) bool { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cout, coutAllocMap := (**C.char)(unsafe.Pointer(out)), cgoAllocsUnknown - var pinnercout runtime.Pinner - pinnercout.Pin(out) - if out != nil { - pinnercout.Pin(unsafe.Pointer(*out)) - } - defer pinnercout.Unpin() - __ret := C.AMediaFormat_getString(cp0, cname, cout) - runtime.KeepAlive(coutAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (bool)(__ret) - return __v -} - -func AMediaFormat_new() *AMediaFormat { - __ret := C.AMediaFormat_new() - __v := (*AMediaFormat)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaFormat_setBuffer(p0 *AMediaFormat, name string, data unsafe.Pointer, size uint64) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cdata, cdataAllocMap := data, cgoAllocsUnknown - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - C.AMediaFormat_setBuffer(cp0, cname, cdata, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_setDouble(p0 *AMediaFormat, name string, value float64) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cvalue, cvalueAllocMap := (C.double)(value), cgoAllocsUnknown - C.AMediaFormat_setDouble(cp0, cname, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_setFloat(p0 *AMediaFormat, name string, value float32) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cvalue, cvalueAllocMap := (C.float)(value), cgoAllocsUnknown - C.AMediaFormat_setFloat(cp0, cname, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_setInt32(p0 *AMediaFormat, name string, value int32) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cvalue, cvalueAllocMap := (C.int)(value), cgoAllocsUnknown - C.AMediaFormat_setInt32(cp0, cname, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_setInt64(p0 *AMediaFormat, name string, value int64) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cvalue, cvalueAllocMap := (C.int64_t)(value), cgoAllocsUnknown - C.AMediaFormat_setInt64(cp0, cname, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_setRect(p0 *AMediaFormat, name string, left int32, top int32, right int32, bottom int32) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cleft, cleftAllocMap := (C.int)(left), cgoAllocsUnknown - ctop, ctopAllocMap := (C.int)(top), cgoAllocsUnknown - cright, crightAllocMap := (C.int)(right), cgoAllocsUnknown - cbottom, cbottomAllocMap := (C.int)(bottom), cgoAllocsUnknown - C.AMediaFormat_setRect(cp0, cname, cleft, ctop, cright, cbottom) - runtime.KeepAlive(cbottomAllocMap) - runtime.KeepAlive(crightAllocMap) - runtime.KeepAlive(ctopAllocMap) - runtime.KeepAlive(cleftAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_setSize(p0 *AMediaFormat, name string, value uint64) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cvalue, cvalueAllocMap := (C.uint64_t)(value), cgoAllocsUnknown - C.AMediaFormat_setSize(cp0, cname, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_setString(p0 *AMediaFormat, name string, value string) { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - cname, cnameAllocMap := UnpackPCharString(name) - cvalue, cvalueAllocMap := UnpackPCharString(value) - C.AMediaFormat_setString(cp0, cname, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cp0AllocMap) -} - -func AMediaFormat_toString(p0 *AMediaFormat) string { - cp0, cp0AllocMap := (*C.AMediaFormat)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaFormat_toString(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := C.GoString(__ret) - return __v -} - -func AMediaMuxer_addTrack(p0 *AMediaMuxer, format *AMediaFormat) int64 { - cp0, cp0AllocMap := (*C.AMediaMuxer)(unsafe.Pointer(p0)), cgoAllocsUnknown - cformat, cformatAllocMap := (*C.AMediaFormat)(unsafe.Pointer(format)), cgoAllocsUnknown - __ret := C.AMediaMuxer_addTrack(cp0, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (int64)(__ret) - return __v -} - -func AMediaMuxer_append(fd int32, mode AppendMode) *AMediaMuxer { - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - cmode, cmodeAllocMap := (C.AppendMode)(mode), cgoAllocsUnknown - __ret := C.AMediaMuxer_append(cfd, cmode) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(cfdAllocMap) - __v := (*AMediaMuxer)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaMuxer_delete(p0 *AMediaMuxer) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaMuxer)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaMuxer_delete(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaMuxer_getTrackCount(p0 *AMediaMuxer) int64 { - cp0, cp0AllocMap := (*C.AMediaMuxer)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaMuxer_getTrackCount(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (int64)(__ret) - return __v -} - -func AMediaMuxer_getTrackFormat(muxer *AMediaMuxer, idx uint64) *AMediaFormat { - cmuxer, cmuxerAllocMap := (*C.AMediaMuxer)(unsafe.Pointer(muxer)), cgoAllocsUnknown - cidx, cidxAllocMap := (C.uint64_t)(idx), cgoAllocsUnknown - __ret := C.AMediaMuxer_getTrackFormat(cmuxer, cidx) - runtime.KeepAlive(cidxAllocMap) - runtime.KeepAlive(cmuxerAllocMap) - __v := (*AMediaFormat)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaMuxer_new(fd int32, format OutputFormat) *AMediaMuxer { - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - cformat, cformatAllocMap := (C.OutputFormat)(format), cgoAllocsUnknown - __ret := C.AMediaMuxer_new(cfd, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cfdAllocMap) - __v := (*AMediaMuxer)(unsafe.Pointer(__ret)) - return __v -} - -func AMediaMuxer_setLocation(p0 *AMediaMuxer, latitude float32, longitude float32) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaMuxer)(unsafe.Pointer(p0)), cgoAllocsUnknown - clatitude, clatitudeAllocMap := (C.float)(latitude), cgoAllocsUnknown - clongitude, clongitudeAllocMap := (C.float)(longitude), cgoAllocsUnknown - __ret := C.AMediaMuxer_setLocation(cp0, clatitude, clongitude) - runtime.KeepAlive(clongitudeAllocMap) - runtime.KeepAlive(clatitudeAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaMuxer_setOrientationHint(p0 *AMediaMuxer, degrees int32) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaMuxer)(unsafe.Pointer(p0)), cgoAllocsUnknown - cdegrees, cdegreesAllocMap := (C.int)(degrees), cgoAllocsUnknown - __ret := C.AMediaMuxer_setOrientationHint(cp0, cdegrees) - runtime.KeepAlive(cdegreesAllocMap) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaMuxer_start(p0 *AMediaMuxer) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaMuxer)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaMuxer_start(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaMuxer_stop(p0 *AMediaMuxer) Media_status_t { - cp0, cp0AllocMap := (*C.AMediaMuxer)(unsafe.Pointer(p0)), cgoAllocsUnknown - __ret := C.AMediaMuxer_stop(cp0) - runtime.KeepAlive(cp0AllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaMuxer_writeSampleData(muxer *AMediaMuxer, trackIdx uint64, data *uint8, info *AMediaCodecBufferInfo) Media_status_t { - cmuxer, cmuxerAllocMap := (*C.AMediaMuxer)(unsafe.Pointer(muxer)), cgoAllocsUnknown - ctrackIdx, ctrackIdxAllocMap := (C.uint64_t)(trackIdx), cgoAllocsUnknown - cdata, cdataAllocMap := (*C.uint8_t)(unsafe.Pointer(data)), cgoAllocsUnknown - cinfo, cinfoAllocMap := (*C.AMediaCodecBufferInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AMediaMuxer_writeSampleData(cmuxer, ctrackIdx, cdata, cinfo) - runtime.KeepAlive(cinfoAllocMap) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ctrackIdxAllocMap) - runtime.KeepAlive(cmuxerAllocMap) - __v := (Media_status_t)(__ret) - return __v -} diff --git a/capi/media/media_api36.go b/capi/media/media_api36.go deleted file mode 100644 index 5b506b9..0000000 --- a/capi/media/media_api36.go +++ /dev/null @@ -1,476 +0,0 @@ -//go:build android_ndk36 - -// Code generated by capigen. DO NOT EDIT. - -package media - -/* -#cgo LDFLAGS: -lmediandk -#undef __ANDROID_MIN_SDK_VERSION__ -#define __ANDROID_MIN_SDK_VERSION__ 36 -#define __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ 1 -#include "media/NdkImage.h" -#include "media/NdkImageReader.h" -#include "media/NdkMediaCodec.h" -#include "media/NdkMediaCodecInfo.h" -#include "media/NdkMediaDataSource.h" -#include "media/NdkMediaExtractor.h" -#include "media/NdkMediaFormat.h" -#include "media/NdkMediaMuxer.h" -#include "media/NdkMediaDrm.h" -#include "media/NdkMediaCrypto.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ACodecAudioCapabilities_getBitrateRange(audioCaps *ACodecAudioCapabilities, outRange *AIntRange) Media_status_t { - caudioCaps, caudioCapsAllocMap := (*C.ACodecAudioCapabilities)(unsafe.Pointer(audioCaps)), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecAudioCapabilities_getBitrateRange(caudioCaps, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(caudioCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecAudioCapabilities_getInputChannelCountRanges(audioCaps *ACodecAudioCapabilities, outArrayPtr **AIntRange, outCount *uint64) Media_status_t { - caudioCaps, caudioCapsAllocMap := (*C.ACodecAudioCapabilities)(unsafe.Pointer(audioCaps)), cgoAllocsUnknown - coutArrayPtr, coutArrayPtrAllocMap := (**C.AIntRange)(unsafe.Pointer(outArrayPtr)), cgoAllocsUnknown - var pinnercoutArrayPtr runtime.Pinner - pinnercoutArrayPtr.Pin(outArrayPtr) - if outArrayPtr != nil { - pinnercoutArrayPtr.Pin(unsafe.Pointer(*outArrayPtr)) - } - defer pinnercoutArrayPtr.Unpin() - coutCount, coutCountAllocMap := (*C.uint64_t)(unsafe.Pointer(outCount)), cgoAllocsUnknown - __ret := C.ACodecAudioCapabilities_getInputChannelCountRanges(caudioCaps, coutArrayPtr, coutCount) - runtime.KeepAlive(coutCountAllocMap) - runtime.KeepAlive(coutArrayPtrAllocMap) - runtime.KeepAlive(caudioCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecAudioCapabilities_getMaxInputChannelCount(audioCaps *ACodecAudioCapabilities) int32 { - caudioCaps, caudioCapsAllocMap := (*C.ACodecAudioCapabilities)(unsafe.Pointer(audioCaps)), cgoAllocsUnknown - __ret := C.ACodecAudioCapabilities_getMaxInputChannelCount(caudioCaps) - runtime.KeepAlive(caudioCapsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecAudioCapabilities_getMinInputChannelCount(audioCaps *ACodecAudioCapabilities) int32 { - caudioCaps, caudioCapsAllocMap := (*C.ACodecAudioCapabilities)(unsafe.Pointer(audioCaps)), cgoAllocsUnknown - __ret := C.ACodecAudioCapabilities_getMinInputChannelCount(caudioCaps) - runtime.KeepAlive(caudioCapsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecAudioCapabilities_getSupportedSampleRateRanges(audioCaps *ACodecAudioCapabilities, outArrayPtr **AIntRange, outCount *uint64) Media_status_t { - caudioCaps, caudioCapsAllocMap := (*C.ACodecAudioCapabilities)(unsafe.Pointer(audioCaps)), cgoAllocsUnknown - coutArrayPtr, coutArrayPtrAllocMap := (**C.AIntRange)(unsafe.Pointer(outArrayPtr)), cgoAllocsUnknown - var pinnercoutArrayPtr runtime.Pinner - pinnercoutArrayPtr.Pin(outArrayPtr) - if outArrayPtr != nil { - pinnercoutArrayPtr.Pin(unsafe.Pointer(*outArrayPtr)) - } - defer pinnercoutArrayPtr.Unpin() - coutCount, coutCountAllocMap := (*C.uint64_t)(unsafe.Pointer(outCount)), cgoAllocsUnknown - __ret := C.ACodecAudioCapabilities_getSupportedSampleRateRanges(caudioCaps, coutArrayPtr, coutCount) - runtime.KeepAlive(coutCountAllocMap) - runtime.KeepAlive(coutArrayPtrAllocMap) - runtime.KeepAlive(caudioCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecAudioCapabilities_getSupportedSampleRates(audioCaps *ACodecAudioCapabilities, outArrayPtr **int32, outCount *uint64) Media_status_t { - caudioCaps, caudioCapsAllocMap := (*C.ACodecAudioCapabilities)(unsafe.Pointer(audioCaps)), cgoAllocsUnknown - coutArrayPtr, coutArrayPtrAllocMap := (**C.int32_t)(unsafe.Pointer(outArrayPtr)), cgoAllocsUnknown - var pinnercoutArrayPtr runtime.Pinner - pinnercoutArrayPtr.Pin(outArrayPtr) - if outArrayPtr != nil { - pinnercoutArrayPtr.Pin(unsafe.Pointer(*outArrayPtr)) - } - defer pinnercoutArrayPtr.Unpin() - coutCount, coutCountAllocMap := (*C.uint64_t)(unsafe.Pointer(outCount)), cgoAllocsUnknown - __ret := C.ACodecAudioCapabilities_getSupportedSampleRates(caudioCaps, coutArrayPtr, coutCount) - runtime.KeepAlive(coutCountAllocMap) - runtime.KeepAlive(coutArrayPtrAllocMap) - runtime.KeepAlive(caudioCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecAudioCapabilities_isSampleRateSupported(audioCaps *ACodecAudioCapabilities, sampleRate int32) int32 { - caudioCaps, caudioCapsAllocMap := (*C.ACodecAudioCapabilities)(unsafe.Pointer(audioCaps)), cgoAllocsUnknown - csampleRate, csampleRateAllocMap := (C.int)(sampleRate), cgoAllocsUnknown - __ret := C.ACodecAudioCapabilities_isSampleRateSupported(caudioCaps, csampleRate) - runtime.KeepAlive(csampleRateAllocMap) - runtime.KeepAlive(caudioCapsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecEncoderCapabilities_getComplexityRange(encoderCaps *ACodecEncoderCapabilities, outRange *AIntRange) Media_status_t { - cencoderCaps, cencoderCapsAllocMap := (*C.ACodecEncoderCapabilities)(unsafe.Pointer(encoderCaps)), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecEncoderCapabilities_getComplexityRange(cencoderCaps, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cencoderCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecEncoderCapabilities_getQualityRange(encoderCaps *ACodecEncoderCapabilities, outRange *AIntRange) Media_status_t { - cencoderCaps, cencoderCapsAllocMap := (*C.ACodecEncoderCapabilities)(unsafe.Pointer(encoderCaps)), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecEncoderCapabilities_getQualityRange(cencoderCaps, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cencoderCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecEncoderCapabilities_isBitrateModeSupported(encoderCaps *ACodecEncoderCapabilities, mode ABitrateMode) int32 { - cencoderCaps, cencoderCapsAllocMap := (*C.ACodecEncoderCapabilities)(unsafe.Pointer(encoderCaps)), cgoAllocsUnknown - cmode, cmodeAllocMap := (C.ABitrateMode)(mode), cgoAllocsUnknown - __ret := C.ACodecEncoderCapabilities_isBitrateModeSupported(cencoderCaps, cmode) - runtime.KeepAlive(cmodeAllocMap) - runtime.KeepAlive(cencoderCapsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecPerformancePoint_covers(one *ACodecPerformancePoint, another *ACodecPerformancePoint) int32 { - cone, coneAllocMap := (*C.ACodecPerformancePoint)(unsafe.Pointer(one)), cgoAllocsUnknown - canother, canotherAllocMap := (*C.ACodecPerformancePoint)(unsafe.Pointer(another)), cgoAllocsUnknown - __ret := C.ACodecPerformancePoint_covers(cone, canother) - runtime.KeepAlive(canotherAllocMap) - runtime.KeepAlive(coneAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecPerformancePoint_coversFormat(performancePoint *ACodecPerformancePoint, format *AMediaFormat) int32 { - cperformancePoint, cperformancePointAllocMap := (*C.ACodecPerformancePoint)(unsafe.Pointer(performancePoint)), cgoAllocsUnknown - cformat, cformatAllocMap := (*C.AMediaFormat)(unsafe.Pointer(format)), cgoAllocsUnknown - __ret := C.ACodecPerformancePoint_coversFormat(cperformancePoint, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cperformancePointAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecPerformancePoint_create(width int32, height int32, frameRate int32) *ACodecPerformancePoint { - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - cframeRate, cframeRateAllocMap := (C.int)(frameRate), cgoAllocsUnknown - __ret := C.ACodecPerformancePoint_create(cwidth, cheight, cframeRate) - runtime.KeepAlive(cframeRateAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - __v := (*ACodecPerformancePoint)(unsafe.Pointer(__ret)) - return __v -} - -func ACodecPerformancePoint_destroy(performancePoint *ACodecPerformancePoint) { - cperformancePoint, cperformancePointAllocMap := (*C.ACodecPerformancePoint)(unsafe.Pointer(performancePoint)), cgoAllocsUnknown - C.ACodecPerformancePoint_destroy(cperformancePoint) - runtime.KeepAlive(cperformancePointAllocMap) -} - -func ACodecPerformancePoint_equals(one *ACodecPerformancePoint, another *ACodecPerformancePoint) int32 { - cone, coneAllocMap := (*C.ACodecPerformancePoint)(unsafe.Pointer(one)), cgoAllocsUnknown - canother, canotherAllocMap := (*C.ACodecPerformancePoint)(unsafe.Pointer(another)), cgoAllocsUnknown - __ret := C.ACodecPerformancePoint_equals(cone, canother) - runtime.KeepAlive(canotherAllocMap) - runtime.KeepAlive(coneAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecVideoCapabilities_areSizeAndRateSupported(videoCaps *ACodecVideoCapabilities, width int32, height int32, frameRate float64) int32 { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - cframeRate, cframeRateAllocMap := (C.double)(frameRate), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_areSizeAndRateSupported(cvideoCaps, cwidth, cheight, cframeRate) - runtime.KeepAlive(cframeRateAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecVideoCapabilities_getAchievableFrameRatesFor(videoCaps *ACodecVideoCapabilities, width int32, height int32, outRange *ADoubleRange) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.ADoubleRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getAchievableFrameRatesFor(cvideoCaps, cwidth, cheight, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getBitrateRange(videoCaps *ACodecVideoCapabilities, outRange *AIntRange) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getBitrateRange(cvideoCaps, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getHeightAlignment(videoCaps *ACodecVideoCapabilities) int32 { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getHeightAlignment(cvideoCaps) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecVideoCapabilities_getNextSupportedPerformancePoint(videoCaps *ACodecVideoCapabilities, outPerformancePoint **ACodecPerformancePoint) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - coutPerformancePoint, coutPerformancePointAllocMap := (**C.ACodecPerformancePoint)(unsafe.Pointer(outPerformancePoint)), cgoAllocsUnknown - var pinnercoutPerformancePoint runtime.Pinner - pinnercoutPerformancePoint.Pin(outPerformancePoint) - if outPerformancePoint != nil { - pinnercoutPerformancePoint.Pin(unsafe.Pointer(*outPerformancePoint)) - } - defer pinnercoutPerformancePoint.Unpin() - __ret := C.ACodecVideoCapabilities_getNextSupportedPerformancePoint(cvideoCaps, coutPerformancePoint) - runtime.KeepAlive(coutPerformancePointAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getSupportedFrameRates(videoCaps *ACodecVideoCapabilities, outRange *AIntRange) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getSupportedFrameRates(cvideoCaps, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getSupportedFrameRatesFor(videoCaps *ACodecVideoCapabilities, width int32, height int32, outRange *ADoubleRange) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.ADoubleRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getSupportedFrameRatesFor(cvideoCaps, cwidth, cheight, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getSupportedHeights(videoCaps *ACodecVideoCapabilities, outRange *AIntRange) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getSupportedHeights(cvideoCaps, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getSupportedHeightsFor(videoCaps *ACodecVideoCapabilities, width int32, outRange *AIntRange) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getSupportedHeightsFor(cvideoCaps, cwidth, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getSupportedWidths(videoCaps *ACodecVideoCapabilities, outRange *AIntRange) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getSupportedWidths(cvideoCaps, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getSupportedWidthsFor(videoCaps *ACodecVideoCapabilities, height int32, outRange *AIntRange) Media_status_t { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - coutRange, coutRangeAllocMap := (*C.AIntRange)(unsafe.Pointer(outRange)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getSupportedWidthsFor(cvideoCaps, cheight, coutRange) - runtime.KeepAlive(coutRangeAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func ACodecVideoCapabilities_getWidthAlignment(videoCaps *ACodecVideoCapabilities) int32 { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_getWidthAlignment(cvideoCaps) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ACodecVideoCapabilities_isSizeSupported(videoCaps *ACodecVideoCapabilities, width int32, height int32) int32 { - cvideoCaps, cvideoCapsAllocMap := (*C.ACodecVideoCapabilities)(unsafe.Pointer(videoCaps)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - __ret := C.ACodecVideoCapabilities_isSizeSupported(cvideoCaps, cwidth, cheight) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cvideoCapsAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMediaCodecInfo_getAudioCapabilities(info *AMediaCodecInfo, outAudioCaps **ACodecAudioCapabilities) Media_status_t { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - coutAudioCaps, coutAudioCapsAllocMap := (**C.ACodecAudioCapabilities)(unsafe.Pointer(outAudioCaps)), cgoAllocsUnknown - var pinnercoutAudioCaps runtime.Pinner - pinnercoutAudioCaps.Pin(outAudioCaps) - if outAudioCaps != nil { - pinnercoutAudioCaps.Pin(unsafe.Pointer(*outAudioCaps)) - } - defer pinnercoutAudioCaps.Unpin() - __ret := C.AMediaCodecInfo_getAudioCapabilities(cinfo, coutAudioCaps) - runtime.KeepAlive(coutAudioCapsAllocMap) - runtime.KeepAlive(cinfoAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecInfo_getCanonicalName(info *AMediaCodecInfo) string { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AMediaCodecInfo_getCanonicalName(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AMediaCodecInfo_getEncoderCapabilities(info *AMediaCodecInfo, outEncoderCaps **ACodecEncoderCapabilities) Media_status_t { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - coutEncoderCaps, coutEncoderCapsAllocMap := (**C.ACodecEncoderCapabilities)(unsafe.Pointer(outEncoderCaps)), cgoAllocsUnknown - var pinnercoutEncoderCaps runtime.Pinner - pinnercoutEncoderCaps.Pin(outEncoderCaps) - if outEncoderCaps != nil { - pinnercoutEncoderCaps.Pin(unsafe.Pointer(*outEncoderCaps)) - } - defer pinnercoutEncoderCaps.Unpin() - __ret := C.AMediaCodecInfo_getEncoderCapabilities(cinfo, coutEncoderCaps) - runtime.KeepAlive(coutEncoderCapsAllocMap) - runtime.KeepAlive(cinfoAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecInfo_getKind(info *AMediaCodecInfo) AMediaCodecKind { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AMediaCodecInfo_getKind(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (AMediaCodecKind)(__ret) - return __v -} - -func AMediaCodecInfo_getMaxSupportedInstances(info *AMediaCodecInfo) int32 { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AMediaCodecInfo_getMaxSupportedInstances(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMediaCodecInfo_getMediaCodecInfoType(info *AMediaCodecInfo) AMediaCodecType { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AMediaCodecInfo_getMediaCodecInfoType(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (AMediaCodecType)(__ret) - return __v -} - -func AMediaCodecInfo_getMediaType(info *AMediaCodecInfo) string { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AMediaCodecInfo_getMediaType(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AMediaCodecInfo_getVideoCapabilities(info *AMediaCodecInfo, outVideoCaps **ACodecVideoCapabilities) Media_status_t { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - coutVideoCaps, coutVideoCapsAllocMap := (**C.ACodecVideoCapabilities)(unsafe.Pointer(outVideoCaps)), cgoAllocsUnknown - var pinnercoutVideoCaps runtime.Pinner - pinnercoutVideoCaps.Pin(outVideoCaps) - if outVideoCaps != nil { - pinnercoutVideoCaps.Pin(unsafe.Pointer(*outVideoCaps)) - } - defer pinnercoutVideoCaps.Unpin() - __ret := C.AMediaCodecInfo_getVideoCapabilities(cinfo, coutVideoCaps) - runtime.KeepAlive(coutVideoCapsAllocMap) - runtime.KeepAlive(cinfoAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMediaCodecInfo_isFeatureRequired(info *AMediaCodecInfo, featureName string) int32 { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - cfeatureName, cfeatureNameAllocMap := UnpackPCharString(featureName) - __ret := C.AMediaCodecInfo_isFeatureRequired(cinfo, cfeatureName) - runtime.KeepAlive(cfeatureNameAllocMap) - runtime.KeepAlive(cinfoAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMediaCodecInfo_isFeatureSupported(info *AMediaCodecInfo, featureName string) int32 { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - cfeatureName, cfeatureNameAllocMap := UnpackPCharString(featureName) - __ret := C.AMediaCodecInfo_isFeatureSupported(cinfo, cfeatureName) - runtime.KeepAlive(cfeatureNameAllocMap) - runtime.KeepAlive(cinfoAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMediaCodecInfo_isFormatSupported(info *AMediaCodecInfo, format *AMediaFormat) int32 { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - cformat, cformatAllocMap := (*C.AMediaFormat)(unsafe.Pointer(format)), cgoAllocsUnknown - __ret := C.AMediaCodecInfo_isFormatSupported(cinfo, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cinfoAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMediaCodecInfo_isVendor(info *AMediaCodecInfo) int32 { - cinfo, cinfoAllocMap := (*C.AMediaCodecInfo)(unsafe.Pointer(info)), cgoAllocsUnknown - __ret := C.AMediaCodecInfo_isVendor(cinfo) - runtime.KeepAlive(cinfoAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/media/types.go b/capi/media/types.go deleted file mode 100644 index 4425f62..0000000 --- a/capi/media/types.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package media - -/* -#cgo LDFLAGS: -lmediandk -#include "media/NdkImage.h" -#include "media/NdkImageReader.h" -#include "media/NdkMediaCodec.h" -#include "media/NdkMediaCodecInfo.h" -#include "media/NdkMediaDataSource.h" -#include "media/NdkMediaExtractor.h" -#include "media/NdkMediaFormat.h" -#include "media/NdkMediaMuxer.h" -#include "media/NdkMediaDrm.h" -#include "media/NdkMediaCrypto.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type ABitrateMode int32 - -type ACodecAudioCapabilities C.ACodecAudioCapabilities - -type ACodecEncoderCapabilities C.ACodecEncoderCapabilities - -type ACodecPerformancePoint C.ACodecPerformancePoint - -type ACodecVideoCapabilities C.ACodecVideoCapabilities - -type ADoubleRange C.ADoubleRange - -type AImage C.AImage - -type AImageCropRect C.AImageCropRect - -type AImageReader C.AImageReader - -type AImageReader_BufferRemovedListener C.AImageReader_BufferRemovedListener - -type AImageReader_ImageListener C.AImageReader_ImageListener - -type AIntRange C.AIntRange - -type AMediaCodec C.AMediaCodec - -type AMediaCodecBufferInfo C.AMediaCodecBufferInfo - -type AMediaCodecCryptoInfo C.AMediaCodecCryptoInfo - -type AMediaCodecInfo C.AMediaCodecInfo - -type AMediaCodecKind int32 - -type AMediaCodecOnAsyncNotifyCallback C.AMediaCodecOnAsyncNotifyCallback - -type AMediaCodecType int32 - -type AMediaCrypto C.AMediaCrypto - -type AMediaDataSource C.AMediaDataSource - -type AMediaDrm C.AMediaDrm - -type AMediaDrmByteArray C.AMediaDrmByteArray - -type AMediaDrmEventType int32 - -type AMediaDrmKeyId AMediaDrmByteArray - -type AMediaDrmKeyRequestType int32 - -type AMediaDrmKeySetId AMediaDrmByteArray - -type AMediaDrmKeyStatus C.AMediaDrmKeyStatus - -type AMediaDrmKeyStatusType int32 - -type AMediaDrmKeyType int32 - -type AMediaDrmKeyValue C.AMediaDrmKeyValue - -type AMediaDrmScope AMediaDrmByteArray - -type AMediaDrmSecureStop AMediaDrmByteArray - -type AMediaDrmSessionId AMediaDrmByteArray - -type AMediaExtractor C.AMediaExtractor - -type AMediaFormat C.AMediaFormat - -type AMediaMuxer C.AMediaMuxer - -type AMediaUUID [16]uint8 - -type ANativeWindow C.ANativeWindow - -type AppendMode int32 - -type OutputFormat int32 - -type PsshEntry C.PsshEntry - -type PsshInfo C.PsshInfo - -type SeekMode int32 - -type Cryptoinfo_mode_t int32 - -type Cryptoinfo_pattern_t C.cryptoinfo_pattern_t - -type AMediaDrmKeyValuePair C.struct_AMediaDrmKeyValuePair - -type AHardwareBuffer C.AHardwareBuffer - -type Media_status_t C.media_status_t - -type Off64_t C.off64_t - -type Off_t C.off_t - -type AImageReader_BufferRemovedCallback func(context unsafe.Pointer, reader *AImageReader, buffer *AHardwareBuffer) - -type AImageReader_ImageCallback func(context unsafe.Pointer, reader *AImageReader) - -type AMediaCodecOnAsyncError func(codec *AMediaCodec, userdata unsafe.Pointer, _error Media_status_t, actionCode int32, detail string) - -type AMediaCodecOnAsyncFormatChanged func(codec *AMediaCodec, userdata unsafe.Pointer, format *AMediaFormat) - -type AMediaCodecOnAsyncInputAvailable func(codec *AMediaCodec, userdata unsafe.Pointer, index int32) - -type AMediaCodecOnAsyncOutputAvailable func(codec *AMediaCodec, userdata unsafe.Pointer, index int32, bufferInfo *AMediaCodecBufferInfo) - -type AMediaCodecOnFrameRendered func(codec *AMediaCodec, userdata unsafe.Pointer, mediaTimeUs int64, systemNano int64) - -type AMediaDataSourceClose func(userdata unsafe.Pointer) - -type AMediaDataSourceGetAvailableSize func(userdata unsafe.Pointer, offset Off64_t) int64 - -type AMediaDataSourceGetSize func(userdata unsafe.Pointer) int64 - -type AMediaDataSourceReadAt func(userdata unsafe.Pointer, offset Off64_t, buffer unsafe.Pointer, size uint64) int64 - -type AMediaDrmEventListener func(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, eventType AMediaDrmEventType, extra int32, data *uint8, dataSize uint64) - -type AMediaDrmExpirationUpdateListener func(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, expiryTimeInMS int64) - -type AMediaDrmKeysChangeListener func(p0 *AMediaDrm, sessionId *AMediaDrmSessionId, keyStatus *AMediaDrmKeyStatus, numKeys uint64, hasNewUsableKey bool) diff --git a/capi/midi/cgo_helpers.c b/capi/midi/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/midi/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/midi/cgo_helpers.go b/capi/midi/cgo_helpers.go deleted file mode 100644 index 5c2859b..0000000 --- a/capi/midi/cgo_helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package midi - -/* -#cgo LDFLAGS: -lamidi -#include "amidi/AMidi.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} diff --git a/capi/midi/cgo_helpers.h b/capi/midi/cgo_helpers.h deleted file mode 100644 index 4049364..0000000 --- a/capi/midi/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "amidi/AMidi.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/midi/const.go b/capi/midi/const.go deleted file mode 100644 index f1d3892..0000000 --- a/capi/midi/const.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package midi - -const ( - AMIDI_DEVICE_TYPE_USB = 1 - AMIDI_DEVICE_TYPE_VIRTUAL = 2 - AMIDI_DEVICE_TYPE_BLUETOOTH = 3 -) - -const ( - AMIDI_OPCODE_DATA = 1 - AMIDI_OPCODE_FLUSH = 2 -) - -const ( - AMIDI_DEVICE_PROTOCOL_UMP_USE_MIDI_CI AMidiDevice_Protocol = 0 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS AMidiDevice_Protocol = 1 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS AMidiDevice_Protocol = 2 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS AMidiDevice_Protocol = 3 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS AMidiDevice_Protocol = 4 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0 AMidiDevice_Protocol = 17 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0_AND_JRTS AMidiDevice_Protocol = 18 - AMIDI_DEVICE_PROTOCOL_UNKNOWN AMidiDevice_Protocol = -1 -) diff --git a/capi/midi/doc.go b/capi/midi/doc.go deleted file mode 100644 index 55cc9a3..0000000 --- a/capi/midi/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android MIDI -*/ -package midi diff --git a/capi/midi/midi.go b/capi/midi/midi.go deleted file mode 100644 index 4732bbe..0000000 --- a/capi/midi/midi.go +++ /dev/null @@ -1,176 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package midi - -/* -#cgo LDFLAGS: -lamidi -#include "amidi/AMidi.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AMidiDevice_fromJava(env *JNIEnv, midiDeviceObj Jobject, outDevicePtrPtr **AMidiDevice) Media_status_t { - cenv, cenvAllocMap := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown - cmidiDeviceObj, cmidiDeviceObjAllocMap := (C.jobject)(midiDeviceObj), cgoAllocsUnknown - coutDevicePtrPtr, coutDevicePtrPtrAllocMap := (**C.AMidiDevice)(unsafe.Pointer(outDevicePtrPtr)), cgoAllocsUnknown - var pinnercoutDevicePtrPtr runtime.Pinner - pinnercoutDevicePtrPtr.Pin(outDevicePtrPtr) - if outDevicePtrPtr != nil { - pinnercoutDevicePtrPtr.Pin(unsafe.Pointer(*outDevicePtrPtr)) - } - defer pinnercoutDevicePtrPtr.Unpin() - __ret := C.AMidiDevice_fromJava(cenv, cmidiDeviceObj, coutDevicePtrPtr) - runtime.KeepAlive(coutDevicePtrPtrAllocMap) - runtime.KeepAlive(cmidiDeviceObjAllocMap) - runtime.KeepAlive(cenvAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMidiDevice_getDefaultProtocol(device *AMidiDevice) AMidiDevice_Protocol { - cdevice, cdeviceAllocMap := (*C.AMidiDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - __ret := C.AMidiDevice_getDefaultProtocol(cdevice) - runtime.KeepAlive(cdeviceAllocMap) - __v := (AMidiDevice_Protocol)(__ret) - return __v -} - -func AMidiDevice_getNumInputPorts(device *AMidiDevice) int64 { - cdevice, cdeviceAllocMap := (*C.AMidiDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - __ret := C.AMidiDevice_getNumInputPorts(cdevice) - runtime.KeepAlive(cdeviceAllocMap) - __v := (int64)(__ret) - return __v -} - -func AMidiDevice_getNumOutputPorts(device *AMidiDevice) int64 { - cdevice, cdeviceAllocMap := (*C.AMidiDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - __ret := C.AMidiDevice_getNumOutputPorts(cdevice) - runtime.KeepAlive(cdeviceAllocMap) - __v := (int64)(__ret) - return __v -} - -func AMidiDevice_getType(device *AMidiDevice) int32 { - cdevice, cdeviceAllocMap := (*C.AMidiDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - __ret := C.AMidiDevice_getType(cdevice) - runtime.KeepAlive(cdeviceAllocMap) - __v := (int32)(__ret) - return __v -} - -func AMidiDevice_release(midiDevice *AMidiDevice) Media_status_t { - cmidiDevice, cmidiDeviceAllocMap := (*C.AMidiDevice)(unsafe.Pointer(midiDevice)), cgoAllocsUnknown - __ret := C.AMidiDevice_release(cmidiDevice) - runtime.KeepAlive(cmidiDeviceAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMidiInputPort_close(inputPort *AMidiInputPort) { - cinputPort, cinputPortAllocMap := (*C.AMidiInputPort)(unsafe.Pointer(inputPort)), cgoAllocsUnknown - C.AMidiInputPort_close(cinputPort) - runtime.KeepAlive(cinputPortAllocMap) -} - -func AMidiInputPort_open(device *AMidiDevice, portNumber int32, outInputPortPtr **AMidiInputPort) Media_status_t { - cdevice, cdeviceAllocMap := (*C.AMidiDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - cportNumber, cportNumberAllocMap := (C.int)(portNumber), cgoAllocsUnknown - coutInputPortPtr, coutInputPortPtrAllocMap := (**C.AMidiInputPort)(unsafe.Pointer(outInputPortPtr)), cgoAllocsUnknown - var pinnercoutInputPortPtr runtime.Pinner - pinnercoutInputPortPtr.Pin(outInputPortPtr) - if outInputPortPtr != nil { - pinnercoutInputPortPtr.Pin(unsafe.Pointer(*outInputPortPtr)) - } - defer pinnercoutInputPortPtr.Unpin() - __ret := C.AMidiInputPort_open(cdevice, cportNumber, coutInputPortPtr) - runtime.KeepAlive(coutInputPortPtrAllocMap) - runtime.KeepAlive(cportNumberAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMidiInputPort_send(inputPort *AMidiInputPort, buffer *uint8, numBytes uint64) int64 { - cinputPort, cinputPortAllocMap := (*C.AMidiInputPort)(unsafe.Pointer(inputPort)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (*C.uint8_t)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cnumBytes, cnumBytesAllocMap := (C.uint64_t)(numBytes), cgoAllocsUnknown - __ret := C.AMidiInputPort_send(cinputPort, cbuffer, cnumBytes) - runtime.KeepAlive(cnumBytesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cinputPortAllocMap) - __v := (int64)(__ret) - return __v -} - -func AMidiInputPort_sendFlush(inputPort *AMidiInputPort) Media_status_t { - cinputPort, cinputPortAllocMap := (*C.AMidiInputPort)(unsafe.Pointer(inputPort)), cgoAllocsUnknown - __ret := C.AMidiInputPort_sendFlush(cinputPort) - runtime.KeepAlive(cinputPortAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMidiInputPort_sendWithTimestamp(inputPort *AMidiInputPort, buffer *uint8, numBytes uint64, timestamp int64) int64 { - cinputPort, cinputPortAllocMap := (*C.AMidiInputPort)(unsafe.Pointer(inputPort)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (*C.uint8_t)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cnumBytes, cnumBytesAllocMap := (C.uint64_t)(numBytes), cgoAllocsUnknown - ctimestamp, ctimestampAllocMap := (C.int64_t)(timestamp), cgoAllocsUnknown - __ret := C.AMidiInputPort_sendWithTimestamp(cinputPort, cbuffer, cnumBytes, ctimestamp) - runtime.KeepAlive(ctimestampAllocMap) - runtime.KeepAlive(cnumBytesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cinputPortAllocMap) - __v := (int64)(__ret) - return __v -} - -func AMidiOutputPort_close(outputPort *AMidiOutputPort) { - coutputPort, coutputPortAllocMap := (*C.AMidiOutputPort)(unsafe.Pointer(outputPort)), cgoAllocsUnknown - C.AMidiOutputPort_close(coutputPort) - runtime.KeepAlive(coutputPortAllocMap) -} - -func AMidiOutputPort_open(device *AMidiDevice, portNumber int32, outOutputPortPtr **AMidiOutputPort) Media_status_t { - cdevice, cdeviceAllocMap := (*C.AMidiDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - cportNumber, cportNumberAllocMap := (C.int)(portNumber), cgoAllocsUnknown - coutOutputPortPtr, coutOutputPortPtrAllocMap := (**C.AMidiOutputPort)(unsafe.Pointer(outOutputPortPtr)), cgoAllocsUnknown - var pinnercoutOutputPortPtr runtime.Pinner - pinnercoutOutputPortPtr.Pin(outOutputPortPtr) - if outOutputPortPtr != nil { - pinnercoutOutputPortPtr.Pin(unsafe.Pointer(*outOutputPortPtr)) - } - defer pinnercoutOutputPortPtr.Unpin() - __ret := C.AMidiOutputPort_open(cdevice, cportNumber, coutOutputPortPtr) - runtime.KeepAlive(coutOutputPortPtrAllocMap) - runtime.KeepAlive(cportNumberAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (Media_status_t)(__ret) - return __v -} - -func AMidiOutputPort_receive(outputPort *AMidiOutputPort, opcodePtr *int32, buffer *uint8, maxBytes uint64, numBytesReceivedPtr *uint64, outTimestampPtr *int64) int64 { - coutputPort, coutputPortAllocMap := (*C.AMidiOutputPort)(unsafe.Pointer(outputPort)), cgoAllocsUnknown - copcodePtr, copcodePtrAllocMap := (*C.int)(unsafe.Pointer(opcodePtr)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (*C.uint8_t)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cmaxBytes, cmaxBytesAllocMap := (C.uint64_t)(maxBytes), cgoAllocsUnknown - cnumBytesReceivedPtr, cnumBytesReceivedPtrAllocMap := (*C.uint64_t)(unsafe.Pointer(numBytesReceivedPtr)), cgoAllocsUnknown - coutTimestampPtr, coutTimestampPtrAllocMap := (*C.int64_t)(unsafe.Pointer(outTimestampPtr)), cgoAllocsUnknown - __ret := C.AMidiOutputPort_receive(coutputPort, copcodePtr, cbuffer, cmaxBytes, cnumBytesReceivedPtr, coutTimestampPtr) - runtime.KeepAlive(coutTimestampPtrAllocMap) - runtime.KeepAlive(cnumBytesReceivedPtrAllocMap) - runtime.KeepAlive(cmaxBytesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(copcodePtrAllocMap) - runtime.KeepAlive(coutputPortAllocMap) - __v := (int64)(__ret) - return __v -} diff --git a/capi/midi/types.go b/capi/midi/types.go deleted file mode 100644 index fa6dc6e..0000000 --- a/capi/midi/types.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package midi - -/* -#cgo LDFLAGS: -lamidi -#include "amidi/AMidi.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AMidiDevice C.AMidiDevice - -type AMidiDevice_Protocol int32 - -type AMidiInputPort C.AMidiInputPort - -type AMidiOutputPort C.AMidiOutputPort - -type JNIEnv C.JNIEnv - -type Jobject C.jobject - -type Media_status_t C.media_status_t diff --git a/capi/multinetwork/cgo_helpers.c b/capi/multinetwork/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/multinetwork/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/multinetwork/cgo_helpers.go b/capi/multinetwork/cgo_helpers.go deleted file mode 100644 index 3d2340c..0000000 --- a/capi/multinetwork/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package multinetwork - -/* -#cgo LDFLAGS: -landroid -#include "android/multinetwork.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/multinetwork/cgo_helpers.h b/capi/multinetwork/cgo_helpers.h deleted file mode 100644 index e3bc333..0000000 --- a/capi/multinetwork/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/multinetwork.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/multinetwork/const.go b/capi/multinetwork/const.go deleted file mode 100644 index 65b4ad4..0000000 --- a/capi/multinetwork/const.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package multinetwork - -const ( - ANDROID_RESOLV_NO_RETRY = 1 - ANDROID_RESOLV_NO_CACHE_STORE = 2 - ANDROID_RESOLV_NO_CACHE_LOOKUP = 4 -) diff --git a/capi/multinetwork/doc.go b/capi/multinetwork/doc.go deleted file mode 100644 index 53fc22a..0000000 --- a/capi/multinetwork/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Multi-Network -*/ -package multinetwork diff --git a/capi/multinetwork/multinetwork.go b/capi/multinetwork/multinetwork.go deleted file mode 100644 index 6b959be..0000000 --- a/capi/multinetwork/multinetwork.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package multinetwork - -/* -#cgo LDFLAGS: -landroid -#include "android/multinetwork.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func Android_getprocdns(network *Net_handle_t) int32 { - cnetwork, cnetworkAllocMap := (*C.net_handle_t)(unsafe.Pointer(network)), cgoAllocsUnknown - __ret := C.android_getprocdns(cnetwork) - runtime.KeepAlive(cnetworkAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_getprocnetwork(network *Net_handle_t) int32 { - cnetwork, cnetworkAllocMap := (*C.net_handle_t)(unsafe.Pointer(network)), cgoAllocsUnknown - __ret := C.android_getprocnetwork(cnetwork) - runtime.KeepAlive(cnetworkAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_res_cancel(nsend_fd int32) { - cnsend_fd, cnsend_fdAllocMap := (C.int)(nsend_fd), cgoAllocsUnknown - C.android_res_cancel(cnsend_fd) - runtime.KeepAlive(cnsend_fdAllocMap) -} - -func Android_res_nquery(network Net_handle_t, dname string, ns_class int32, ns_type int32, flags uint32) int32 { - cnetwork, cnetworkAllocMap := (C.net_handle_t)(network), cgoAllocsUnknown - cdname, cdnameAllocMap := UnpackPCharString(dname) - cns_class, cns_classAllocMap := (C.int)(ns_class), cgoAllocsUnknown - cns_type, cns_typeAllocMap := (C.int)(ns_type), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.uint)(flags), cgoAllocsUnknown - __ret := C.android_res_nquery(cnetwork, cdname, cns_class, cns_type, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(cns_typeAllocMap) - runtime.KeepAlive(cns_classAllocMap) - runtime.KeepAlive(cdnameAllocMap) - runtime.KeepAlive(cnetworkAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_res_nresult(fd int32, rcode *int32, answer *uint8, anslen uint64) int32 { - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - crcode, crcodeAllocMap := (*C.int)(unsafe.Pointer(rcode)), cgoAllocsUnknown - canswer, canswerAllocMap := (*C.uint8_t)(unsafe.Pointer(answer)), cgoAllocsUnknown - canslen, canslenAllocMap := (C.uint64_t)(anslen), cgoAllocsUnknown - __ret := C.android_res_nresult(cfd, crcode, canswer, canslen) - runtime.KeepAlive(canslenAllocMap) - runtime.KeepAlive(canswerAllocMap) - runtime.KeepAlive(crcodeAllocMap) - runtime.KeepAlive(cfdAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_res_nsend(network Net_handle_t, msg *uint8, msglen uint64, flags uint32) int32 { - cnetwork, cnetworkAllocMap := (C.net_handle_t)(network), cgoAllocsUnknown - cmsg, cmsgAllocMap := (*C.uint8_t)(unsafe.Pointer(msg)), cgoAllocsUnknown - cmsglen, cmsglenAllocMap := (C.uint64_t)(msglen), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.uint)(flags), cgoAllocsUnknown - __ret := C.android_res_nsend(cnetwork, cmsg, cmsglen, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(cmsglenAllocMap) - runtime.KeepAlive(cmsgAllocMap) - runtime.KeepAlive(cnetworkAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_setprocdns(network Net_handle_t) int32 { - cnetwork, cnetworkAllocMap := (C.net_handle_t)(network), cgoAllocsUnknown - __ret := C.android_setprocdns(cnetwork) - runtime.KeepAlive(cnetworkAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_setprocnetwork(network Net_handle_t) int32 { - cnetwork, cnetworkAllocMap := (C.net_handle_t)(network), cgoAllocsUnknown - __ret := C.android_setprocnetwork(cnetwork) - runtime.KeepAlive(cnetworkAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_setsocknetwork(network Net_handle_t, fd int32) int32 { - cnetwork, cnetworkAllocMap := (C.net_handle_t)(network), cgoAllocsUnknown - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - __ret := C.android_setsocknetwork(cnetwork, cfd) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(cnetworkAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_tag_socket(sockfd int32, tag uint32) int32 { - csockfd, csockfdAllocMap := (C.int)(sockfd), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - __ret := C.android_tag_socket(csockfd, ctag) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(csockfdAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_tag_socket_with_uid(sockfd int32, tag uint32, uid Uid_t) int32 { - csockfd, csockfdAllocMap := (C.int)(sockfd), cgoAllocsUnknown - ctag, ctagAllocMap := (C.uint)(tag), cgoAllocsUnknown - cuid, cuidAllocMap := (C.uid_t)(uid), cgoAllocsUnknown - __ret := C.android_tag_socket_with_uid(csockfd, ctag, cuid) - runtime.KeepAlive(cuidAllocMap) - runtime.KeepAlive(ctagAllocMap) - runtime.KeepAlive(csockfdAllocMap) - __v := (int32)(__ret) - return __v -} - -func Android_untag_socket(sockfd int32) int32 { - csockfd, csockfdAllocMap := (C.int)(sockfd), cgoAllocsUnknown - __ret := C.android_untag_socket(csockfd) - runtime.KeepAlive(csockfdAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/multinetwork/types.go b/capi/multinetwork/types.go deleted file mode 100644 index 6d7ad94..0000000 --- a/capi/multinetwork/types.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package multinetwork - -/* -#cgo LDFLAGS: -landroid -#include "android/multinetwork.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type Net_handle_t uint64 - -type Uid_t C.uid_t diff --git a/capi/nativeactivity/bridge_lifecycle.go b/capi/nativeactivity/bridge_lifecycle.go deleted file mode 100644 index c5cb77f..0000000 --- a/capi/nativeactivity/bridge_lifecycle.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nativeactivity - -/* -#include "android/native_activity.h" -#include -#include "cgo_helpers.h" - -extern void goBridge_Lifecycle_OnStart(ANativeActivity* activity); -extern void goBridge_Lifecycle_OnResume(ANativeActivity* activity); -extern void* goBridge_Lifecycle_OnSaveInstanceState(ANativeActivity* activity, uint64_t* outSize); -extern void goBridge_Lifecycle_OnPause(ANativeActivity* activity); -extern void goBridge_Lifecycle_OnStop(ANativeActivity* activity); -extern void goBridge_Lifecycle_OnDestroy(ANativeActivity* activity); -extern void goBridge_Lifecycle_OnWindowFocusChanged(ANativeActivity* activity, int32_t hasFocus); -extern void goBridge_Lifecycle_OnNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window); -extern void goBridge_Lifecycle_OnNativeWindowResized(ANativeActivity* activity, ANativeWindow* window); -extern void goBridge_Lifecycle_OnNativeWindowRedrawNeeded(ANativeActivity* activity, ANativeWindow* window); -extern void goBridge_Lifecycle_OnNativeWindowDestroyed(ANativeActivity* activity, ANativeWindow* window); -extern void goBridge_Lifecycle_OnInputQueueCreated(ANativeActivity* activity, AInputQueue* queue); -extern void goBridge_Lifecycle_OnInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue); -extern void goBridge_Lifecycle_OnContentRectChanged(ANativeActivity* activity, const ARect* rect); -extern void goBridge_Lifecycle_OnConfigurationChanged(ANativeActivity* activity); -extern void goBridge_Lifecycle_OnLowMemory(ANativeActivity* activity); - -void bridgeInstallLifecycleCallbacks(ANativeActivity* activity) { - activity->callbacks->onStart = goBridge_Lifecycle_OnStart; - activity->callbacks->onResume = goBridge_Lifecycle_OnResume; - activity->callbacks->onSaveInstanceState = goBridge_Lifecycle_OnSaveInstanceState; - activity->callbacks->onPause = goBridge_Lifecycle_OnPause; - activity->callbacks->onStop = goBridge_Lifecycle_OnStop; - activity->callbacks->onDestroy = goBridge_Lifecycle_OnDestroy; - activity->callbacks->onWindowFocusChanged = goBridge_Lifecycle_OnWindowFocusChanged; - activity->callbacks->onNativeWindowCreated = goBridge_Lifecycle_OnNativeWindowCreated; - activity->callbacks->onNativeWindowResized = goBridge_Lifecycle_OnNativeWindowResized; - activity->callbacks->onNativeWindowRedrawNeeded = goBridge_Lifecycle_OnNativeWindowRedrawNeeded; - activity->callbacks->onNativeWindowDestroyed = goBridge_Lifecycle_OnNativeWindowDestroyed; - activity->callbacks->onInputQueueCreated = goBridge_Lifecycle_OnInputQueueCreated; - activity->callbacks->onInputQueueDestroyed = goBridge_Lifecycle_OnInputQueueDestroyed; - activity->callbacks->onContentRectChanged = goBridge_Lifecycle_OnContentRectChanged; - activity->callbacks->onConfigurationChanged = goBridge_Lifecycle_OnConfigurationChanged; - activity->callbacks->onLowMemory = goBridge_Lifecycle_OnLowMemory; -} -*/ -import "C" - -import ( - "sync" - "unsafe" -) - -// LifecycleCallbacks holds Go callbacks for ANativeActivity lifecycle events. -type LifecycleCallbacks struct { - OnCreate func(unsafe.Pointer) - OnStart func(unsafe.Pointer) - OnResume func(unsafe.Pointer) - OnSaveInstanceState func(unsafe.Pointer, unsafe.Pointer) - OnPause func(unsafe.Pointer) - OnStop func(unsafe.Pointer) - OnDestroy func(unsafe.Pointer) - OnWindowFocusChanged func(unsafe.Pointer, int32) - OnNativeWindowCreated func(unsafe.Pointer, unsafe.Pointer) - OnNativeWindowResized func(unsafe.Pointer, unsafe.Pointer) - OnNativeWindowRedrawNeeded func(unsafe.Pointer, unsafe.Pointer) - OnNativeWindowDestroyed func(unsafe.Pointer, unsafe.Pointer) - OnInputQueueCreated func(unsafe.Pointer, unsafe.Pointer) - OnInputQueueDestroyed func(unsafe.Pointer, unsafe.Pointer) - OnContentRectChanged func(unsafe.Pointer, unsafe.Pointer) - OnConfigurationChanged func(unsafe.Pointer) - OnLowMemory func(unsafe.Pointer) -} - -var ( - bridgeLifecycleMu sync.Mutex - bridgeLifecycleCB LifecycleCallbacks -) - -// BridgeSetLifecycleCallbacks registers callbacks for the lifecycle events. -func BridgeSetLifecycleCallbacks(cb LifecycleCallbacks) { - bridgeLifecycleMu.Lock() - bridgeLifecycleCB = cb - bridgeLifecycleMu.Unlock() -} - -// BridgeInstallLifecycleCallbacks installs the bridge callbacks into a ANativeActivity. -func BridgeInstallLifecycleCallbacks(activity *ANativeActivity) { - C.bridgeInstallLifecycleCallbacks((*C.ANativeActivity)(unsafe.Pointer(activity))) -} diff --git a/capi/nativeactivity/bridge_lifecycle_export.go b/capi/nativeactivity/bridge_lifecycle_export.go deleted file mode 100644 index c3e7dfc..0000000 --- a/capi/nativeactivity/bridge_lifecycle_export.go +++ /dev/null @@ -1,191 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nativeactivity - -/* -#include "android/native_activity.h" -#include -#include "cgo_helpers.h" - -extern void bridgeInstallLifecycleCallbacks(ANativeActivity* activity); -*/ -import "C" - -import "unsafe" - -//export ANativeActivity_onCreate -func ANativeActivity_onCreate( - activity *C.ANativeActivity, - savedState unsafe.Pointer, - savedStateSize C.size_t, -) { - C.bridgeInstallLifecycleCallbacks(activity) - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnCreate - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } - -} - -//export goBridge_Lifecycle_OnStart -func goBridge_Lifecycle_OnStart(activity *C.ANativeActivity) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnStart - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } -} - -//export goBridge_Lifecycle_OnResume -func goBridge_Lifecycle_OnResume(activity *C.ANativeActivity) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnResume - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } -} - -//export goBridge_Lifecycle_OnSaveInstanceState -func goBridge_Lifecycle_OnSaveInstanceState(activity *C.ANativeActivity, outSize *C.uint64_t) unsafe.Pointer { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnSaveInstanceState - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), unsafe.Pointer(outSize)) - } - return nil -} - -//export goBridge_Lifecycle_OnPause -func goBridge_Lifecycle_OnPause(activity *C.ANativeActivity) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnPause - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } -} - -//export goBridge_Lifecycle_OnStop -func goBridge_Lifecycle_OnStop(activity *C.ANativeActivity) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnStop - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } -} - -//export goBridge_Lifecycle_OnDestroy -func goBridge_Lifecycle_OnDestroy(activity *C.ANativeActivity) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnDestroy - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } -} - -//export goBridge_Lifecycle_OnWindowFocusChanged -func goBridge_Lifecycle_OnWindowFocusChanged(activity *C.ANativeActivity, hasFocus C.int32_t) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnWindowFocusChanged - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), int32(hasFocus)) - } -} - -//export goBridge_Lifecycle_OnNativeWindowCreated -func goBridge_Lifecycle_OnNativeWindowCreated(activity *C.ANativeActivity, window *C.ANativeWindow) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnNativeWindowCreated - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), unsafe.Pointer(window)) - } -} - -//export goBridge_Lifecycle_OnNativeWindowResized -func goBridge_Lifecycle_OnNativeWindowResized(activity *C.ANativeActivity, window *C.ANativeWindow) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnNativeWindowResized - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), unsafe.Pointer(window)) - } -} - -//export goBridge_Lifecycle_OnNativeWindowRedrawNeeded -func goBridge_Lifecycle_OnNativeWindowRedrawNeeded(activity *C.ANativeActivity, window *C.ANativeWindow) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnNativeWindowRedrawNeeded - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), unsafe.Pointer(window)) - } -} - -//export goBridge_Lifecycle_OnNativeWindowDestroyed -func goBridge_Lifecycle_OnNativeWindowDestroyed(activity *C.ANativeActivity, window *C.ANativeWindow) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnNativeWindowDestroyed - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), unsafe.Pointer(window)) - } -} - -//export goBridge_Lifecycle_OnInputQueueCreated -func goBridge_Lifecycle_OnInputQueueCreated(activity *C.ANativeActivity, queue *C.AInputQueue) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnInputQueueCreated - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), unsafe.Pointer(queue)) - } -} - -//export goBridge_Lifecycle_OnInputQueueDestroyed -func goBridge_Lifecycle_OnInputQueueDestroyed(activity *C.ANativeActivity, queue *C.AInputQueue) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnInputQueueDestroyed - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), unsafe.Pointer(queue)) - } -} - -//export goBridge_Lifecycle_OnContentRectChanged -func goBridge_Lifecycle_OnContentRectChanged(activity *C.ANativeActivity, rect *C.ARect) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnContentRectChanged - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity), unsafe.Pointer(rect)) - } -} - -//export goBridge_Lifecycle_OnConfigurationChanged -func goBridge_Lifecycle_OnConfigurationChanged(activity *C.ANativeActivity) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnConfigurationChanged - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } -} - -//export goBridge_Lifecycle_OnLowMemory -func goBridge_Lifecycle_OnLowMemory(activity *C.ANativeActivity) { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.OnLowMemory - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } -} diff --git a/capi/nativeactivity/cgo_helpers.c b/capi/nativeactivity/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/nativeactivity/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/nativeactivity/cgo_helpers.go b/capi/nativeactivity/cgo_helpers.go deleted file mode 100644 index aef5f54..0000000 --- a/capi/nativeactivity/cgo_helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package nativeactivity - -/* -#cgo LDFLAGS: -landroid -#include "android/native_activity.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} diff --git a/capi/nativeactivity/cgo_helpers.h b/capi/nativeactivity/cgo_helpers.h deleted file mode 100644 index 028b724..0000000 --- a/capi/nativeactivity/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/native_activity.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/nativeactivity/const.go b/capi/nativeactivity/const.go deleted file mode 100644 index abd73db..0000000 --- a/capi/nativeactivity/const.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package nativeactivity - -const ( - ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = 1 - ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 2 -) - -const ( - ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = 1 - ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED = 2 -) diff --git a/capi/nativeactivity/doc.go b/capi/nativeactivity/doc.go deleted file mode 100644 index 13dcaed..0000000 --- a/capi/nativeactivity/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android NativeActivity -*/ -package nativeactivity diff --git a/capi/nativeactivity/nativeactivity.go b/capi/nativeactivity/nativeactivity.go deleted file mode 100644 index e703a10..0000000 --- a/capi/nativeactivity/nativeactivity.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package nativeactivity - -/* -#cgo LDFLAGS: -landroid -#include "android/native_activity.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ANativeActivity_finish(activity *ANativeActivity) { - cactivity, cactivityAllocMap := (*C.ANativeActivity)(unsafe.Pointer(activity)), cgoAllocsUnknown - C.ANativeActivity_finish(cactivity) - runtime.KeepAlive(cactivityAllocMap) -} - -func ANativeActivity_hideSoftInput(activity *ANativeActivity, flags uint32) { - cactivity, cactivityAllocMap := (*C.ANativeActivity)(unsafe.Pointer(activity)), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.uint)(flags), cgoAllocsUnknown - C.ANativeActivity_hideSoftInput(cactivity, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(cactivityAllocMap) -} - -func ANativeActivity_setWindowFlags(activity *ANativeActivity, addFlags uint32, removeFlags uint32) { - cactivity, cactivityAllocMap := (*C.ANativeActivity)(unsafe.Pointer(activity)), cgoAllocsUnknown - caddFlags, caddFlagsAllocMap := (C.uint)(addFlags), cgoAllocsUnknown - cremoveFlags, cremoveFlagsAllocMap := (C.uint)(removeFlags), cgoAllocsUnknown - C.ANativeActivity_setWindowFlags(cactivity, caddFlags, cremoveFlags) - runtime.KeepAlive(cremoveFlagsAllocMap) - runtime.KeepAlive(caddFlagsAllocMap) - runtime.KeepAlive(cactivityAllocMap) -} - -func ANativeActivity_setWindowFormat(activity *ANativeActivity, format int32) { - cactivity, cactivityAllocMap := (*C.ANativeActivity)(unsafe.Pointer(activity)), cgoAllocsUnknown - cformat, cformatAllocMap := (C.int)(format), cgoAllocsUnknown - C.ANativeActivity_setWindowFormat(cactivity, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cactivityAllocMap) -} - -func ANativeActivity_showSoftInput(activity *ANativeActivity, flags uint32) { - cactivity, cactivityAllocMap := (*C.ANativeActivity)(unsafe.Pointer(activity)), cgoAllocsUnknown - cflags, cflagsAllocMap := (C.uint)(flags), cgoAllocsUnknown - C.ANativeActivity_showSoftInput(cactivity, cflags) - runtime.KeepAlive(cflagsAllocMap) - runtime.KeepAlive(cactivityAllocMap) -} diff --git a/capi/nativeactivity/types.go b/capi/nativeactivity/types.go deleted file mode 100644 index 38e8e99..0000000 --- a/capi/nativeactivity/types.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package nativeactivity - -/* -#cgo LDFLAGS: -landroid -#include "android/native_activity.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type ANativeActivity C.ANativeActivity - -type ANativeActivityCallbacks C.ANativeActivityCallbacks - -type AAssetManager C.AAssetManager - -type JNIEnv C.JNIEnv - -type JavaVM C.JavaVM - -type Jobject C.jobject diff --git a/capi/nativewindow/cgo_helpers.c b/capi/nativewindow/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/nativewindow/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/nativewindow/cgo_helpers.go b/capi/nativewindow/cgo_helpers.go deleted file mode 100644 index a33b07a..0000000 --- a/capi/nativewindow/cgo_helpers.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package nativewindow - -/* -#cgo LDFLAGS: -landroid -lnativewindow -#include "android/native_window.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || a == b || b.IsEmpty() { - return - } - // Acquire locks in consistent pointer-address order to prevent - // ABBA deadlock when two goroutines call x.Borrow(y) and y.Borrow(x). - if uintptr(unsafe.Pointer(a)) < uintptr(unsafe.Pointer(b)) { - a.mux.Lock() - b.mux.Lock() - } else { - b.mux.Lock() - a.mux.Lock() - } - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} diff --git a/capi/nativewindow/cgo_helpers.h b/capi/nativewindow/cgo_helpers.h deleted file mode 100644 index 9d57142..0000000 --- a/capi/nativewindow/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/native_window.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/nativewindow/const.go b/capi/nativewindow/const.go deleted file mode 100644 index 60ec783..0000000 --- a/capi/nativewindow/const.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package nativewindow - -const ( - ANATIVEWINDOW_TRANSFORM_IDENTITY = 0 - ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL = 1 - ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL = 2 - ANATIVEWINDOW_TRANSFORM_ROTATE_90 = 4 - ANATIVEWINDOW_TRANSFORM_ROTATE_180 = 3 - ANATIVEWINDOW_TRANSFORM_ROTATE_270 = 7 -) - -const ( - ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS = 0 - ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS = 1 -) - -const ( - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT = 0 - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1 -) - -const ( - WINDOW_FORMAT_RGBA_8888 = 1 - WINDOW_FORMAT_RGBX_8888 = 2 - WINDOW_FORMAT_RGB_565 = 4 -) diff --git a/capi/nativewindow/doc.go b/capi/nativewindow/doc.go deleted file mode 100644 index 93d34c8..0000000 --- a/capi/nativewindow/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android native window -*/ -package nativewindow diff --git a/capi/nativewindow/nativewindow.go b/capi/nativewindow/nativewindow.go deleted file mode 100644 index 81c3ab6..0000000 --- a/capi/nativewindow/nativewindow.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package nativewindow - -/* -#cgo LDFLAGS: -landroid -lnativewindow -#include "android/native_window.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ANativeWindow_acquire(window *ANativeWindow) { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - C.ANativeWindow_acquire(cwindow) - runtime.KeepAlive(cwindowAllocMap) -} - -func ANativeWindow_getBuffersDataSpace(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getBuffersDataSpace(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_getBuffersDefaultDataSpace(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getBuffersDefaultDataSpace(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_getFormat(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getFormat(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_getHeight(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getHeight(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_getWidth(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_getWidth(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_lock(window *ANativeWindow, outBuffer *ANativeWindow_Buffer, inOutDirtyBounds *ARect) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - coutBuffer, coutBufferAllocMap := (*C.ANativeWindow_Buffer)(unsafe.Pointer(outBuffer)), cgoAllocsUnknown - cinOutDirtyBounds, cinOutDirtyBoundsAllocMap := (*C.ARect)(unsafe.Pointer(inOutDirtyBounds)), cgoAllocsUnknown - __ret := C.ANativeWindow_lock(cwindow, coutBuffer, cinOutDirtyBounds) - runtime.KeepAlive(cinOutDirtyBoundsAllocMap) - runtime.KeepAlive(coutBufferAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_release(window *ANativeWindow) { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - C.ANativeWindow_release(cwindow) - runtime.KeepAlive(cwindowAllocMap) -} - -func ANativeWindow_setBuffersDataSpace(window *ANativeWindow, dataSpace int32) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - cdataSpace, cdataSpaceAllocMap := (C.int)(dataSpace), cgoAllocsUnknown - __ret := C.ANativeWindow_setBuffersDataSpace(cwindow, cdataSpace) - runtime.KeepAlive(cdataSpaceAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_setBuffersGeometry(window *ANativeWindow, width int32, height int32, format int32) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - cwidth, cwidthAllocMap := (C.int)(width), cgoAllocsUnknown - cheight, cheightAllocMap := (C.int)(height), cgoAllocsUnknown - cformat, cformatAllocMap := (C.int)(format), cgoAllocsUnknown - __ret := C.ANativeWindow_setBuffersGeometry(cwindow, cwidth, cheight, cformat) - runtime.KeepAlive(cformatAllocMap) - runtime.KeepAlive(cheightAllocMap) - runtime.KeepAlive(cwidthAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_setBuffersTransform(window *ANativeWindow, transform int32) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - ctransform, ctransformAllocMap := (C.int)(transform), cgoAllocsUnknown - __ret := C.ANativeWindow_setBuffersTransform(cwindow, ctransform) - runtime.KeepAlive(ctransformAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_setFrameRate(window *ANativeWindow, frameRate float32, compatibility int8) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - cframeRate, cframeRateAllocMap := (C.float)(frameRate), cgoAllocsUnknown - ccompatibility, ccompatibilityAllocMap := (C.int8_t)(compatibility), cgoAllocsUnknown - __ret := C.ANativeWindow_setFrameRate(cwindow, cframeRate, ccompatibility) - runtime.KeepAlive(ccompatibilityAllocMap) - runtime.KeepAlive(cframeRateAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_setFrameRateWithChangeStrategy(window *ANativeWindow, frameRate float32, compatibility int8, changeFrameRateStrategy int8) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - cframeRate, cframeRateAllocMap := (C.float)(frameRate), cgoAllocsUnknown - ccompatibility, ccompatibilityAllocMap := (C.int8_t)(compatibility), cgoAllocsUnknown - cchangeFrameRateStrategy, cchangeFrameRateStrategyAllocMap := (C.int8_t)(changeFrameRateStrategy), cgoAllocsUnknown - __ret := C.ANativeWindow_setFrameRateWithChangeStrategy(cwindow, cframeRate, ccompatibility, cchangeFrameRateStrategy) - runtime.KeepAlive(cchangeFrameRateStrategyAllocMap) - runtime.KeepAlive(ccompatibilityAllocMap) - runtime.KeepAlive(cframeRateAllocMap) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANativeWindow_tryAllocateBuffers(window *ANativeWindow) { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - C.ANativeWindow_tryAllocateBuffers(cwindow) - runtime.KeepAlive(cwindowAllocMap) -} - -func ANativeWindow_unlockAndPost(window *ANativeWindow) int32 { - cwindow, cwindowAllocMap := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown - __ret := C.ANativeWindow_unlockAndPost(cwindow) - runtime.KeepAlive(cwindowAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/nativewindow/types.go b/capi/nativewindow/types.go deleted file mode 100644 index d7ded0e..0000000 --- a/capi/nativewindow/types.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package nativewindow - -/* -#cgo LDFLAGS: -landroid -lnativewindow -#include "android/native_window.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type ANativeWindow C.ANativeWindow - -type ANativeWindow_Buffer C.ANativeWindow_Buffer - -type ARect C.ARect diff --git a/capi/neuralnetworks/cgo_helpers.c b/capi/neuralnetworks/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/neuralnetworks/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/neuralnetworks/cgo_helpers.go b/capi/neuralnetworks/cgo_helpers.go deleted file mode 100644 index a79619b..0000000 --- a/capi/neuralnetworks/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package neuralnetworks - -/* -#cgo LDFLAGS: -lneuralnetworks -#include "android/NeuralNetworks.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/neuralnetworks/cgo_helpers.h b/capi/neuralnetworks/cgo_helpers.h deleted file mode 100644 index 8cb2637..0000000 --- a/capi/neuralnetworks/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/NeuralNetworks.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/neuralnetworks/const.go b/capi/neuralnetworks/const.go deleted file mode 100644 index ef96a7d..0000000 --- a/capi/neuralnetworks/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package neuralnetworks diff --git a/capi/neuralnetworks/doc.go b/capi/neuralnetworks/doc.go deleted file mode 100644 index 319e33e..0000000 --- a/capi/neuralnetworks/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Neural Networks -*/ -package neuralnetworks diff --git a/capi/neuralnetworks/neuralnetworks.go b/capi/neuralnetworks/neuralnetworks.go deleted file mode 100644 index 4bb71a8..0000000 --- a/capi/neuralnetworks/neuralnetworks.go +++ /dev/null @@ -1,860 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package neuralnetworks - -/* -#cgo LDFLAGS: -lneuralnetworks -#include "android/NeuralNetworks.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ANeuralNetworksBurst_create(compilation *ANeuralNetworksCompilation, burst **ANeuralNetworksBurst) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cburst, cburstAllocMap := (**C.ANeuralNetworksBurst)(unsafe.Pointer(burst)), cgoAllocsUnknown - var pinnercburst runtime.Pinner - pinnercburst.Pin(burst) - if burst != nil { - pinnercburst.Pin(unsafe.Pointer(*burst)) - } - defer pinnercburst.Unpin() - __ret := C.ANeuralNetworksBurst_create(ccompilation, cburst) - runtime.KeepAlive(cburstAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksBurst_free(burst *ANeuralNetworksBurst) { - cburst, cburstAllocMap := (*C.ANeuralNetworksBurst)(unsafe.Pointer(burst)), cgoAllocsUnknown - C.ANeuralNetworksBurst_free(cburst) - runtime.KeepAlive(cburstAllocMap) -} - -func ANeuralNetworksCompilation_create(model *ANeuralNetworksModel, compilation **ANeuralNetworksCompilation) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - ccompilation, ccompilationAllocMap := (**C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - var pinnerccompilation runtime.Pinner - pinnerccompilation.Pin(compilation) - if compilation != nil { - pinnerccompilation.Pin(unsafe.Pointer(*compilation)) - } - defer pinnerccompilation.Unpin() - __ret := C.ANeuralNetworksCompilation_create(cmodel, ccompilation) - runtime.KeepAlive(ccompilationAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_createForDevices(model *ANeuralNetworksModel, devices **ANeuralNetworksDevice, numDevices uint32, compilation **ANeuralNetworksCompilation) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - cdevices, cdevicesAllocMap := (**C.ANeuralNetworksDevice)(unsafe.Pointer(devices)), cgoAllocsUnknown - var pinnercdevices runtime.Pinner - pinnercdevices.Pin(devices) - if devices != nil { - pinnercdevices.Pin(unsafe.Pointer(*devices)) - } - defer pinnercdevices.Unpin() - cnumDevices, cnumDevicesAllocMap := (C.uint)(numDevices), cgoAllocsUnknown - ccompilation, ccompilationAllocMap := (**C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - var pinnerccompilation runtime.Pinner - pinnerccompilation.Pin(compilation) - if compilation != nil { - pinnerccompilation.Pin(unsafe.Pointer(*compilation)) - } - defer pinnerccompilation.Unpin() - __ret := C.ANeuralNetworksCompilation_createForDevices(cmodel, cdevices, cnumDevices, ccompilation) - runtime.KeepAlive(ccompilationAllocMap) - runtime.KeepAlive(cnumDevicesAllocMap) - runtime.KeepAlive(cdevicesAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_finish(compilation *ANeuralNetworksCompilation) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_finish(ccompilation) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_free(compilation *ANeuralNetworksCompilation) { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - C.ANeuralNetworksCompilation_free(ccompilation) - runtime.KeepAlive(ccompilationAllocMap) -} - -func ANeuralNetworksCompilation_getPreferredMemoryAlignmentForInput(compilation *ANeuralNetworksCompilation, index uint32, alignment *uint32) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint)(index), cgoAllocsUnknown - calignment, calignmentAllocMap := (*C.uint)(unsafe.Pointer(alignment)), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_getPreferredMemoryAlignmentForInput(ccompilation, cindex, calignment) - runtime.KeepAlive(calignmentAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_getPreferredMemoryAlignmentForOutput(compilation *ANeuralNetworksCompilation, index uint32, alignment *uint32) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint)(index), cgoAllocsUnknown - calignment, calignmentAllocMap := (*C.uint)(unsafe.Pointer(alignment)), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_getPreferredMemoryAlignmentForOutput(ccompilation, cindex, calignment) - runtime.KeepAlive(calignmentAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_getPreferredMemoryPaddingForInput(compilation *ANeuralNetworksCompilation, index uint32, padding *uint32) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint)(index), cgoAllocsUnknown - cpadding, cpaddingAllocMap := (*C.uint)(unsafe.Pointer(padding)), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_getPreferredMemoryPaddingForInput(ccompilation, cindex, cpadding) - runtime.KeepAlive(cpaddingAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_getPreferredMemoryPaddingForOutput(compilation *ANeuralNetworksCompilation, index uint32, padding *uint32) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint)(index), cgoAllocsUnknown - cpadding, cpaddingAllocMap := (*C.uint)(unsafe.Pointer(padding)), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_getPreferredMemoryPaddingForOutput(ccompilation, cindex, cpadding) - runtime.KeepAlive(cpaddingAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_setCaching(compilation *ANeuralNetworksCompilation, cacheDir string, token *uint8) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - ccacheDir, ccacheDirAllocMap := UnpackPCharString(cacheDir) - ctoken, ctokenAllocMap := (*C.uint8_t)(unsafe.Pointer(token)), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_setCaching(ccompilation, ccacheDir, ctoken) - runtime.KeepAlive(ctokenAllocMap) - runtime.KeepAlive(ccacheDirAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_setPreference(compilation *ANeuralNetworksCompilation, preference int32) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cpreference, cpreferenceAllocMap := (C.int)(preference), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_setPreference(ccompilation, cpreference) - runtime.KeepAlive(cpreferenceAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_setPriority(compilation *ANeuralNetworksCompilation, priority int32) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cpriority, cpriorityAllocMap := (C.int)(priority), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_setPriority(ccompilation, cpriority) - runtime.KeepAlive(cpriorityAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksCompilation_setTimeout(compilation *ANeuralNetworksCompilation, duration uint64) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cduration, cdurationAllocMap := (C.uint64_t)(duration), cgoAllocsUnknown - __ret := C.ANeuralNetworksCompilation_setTimeout(ccompilation, cduration) - runtime.KeepAlive(cdurationAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksDevice_getFeatureLevel(device *ANeuralNetworksDevice, featureLevel *int64) int32 { - cdevice, cdeviceAllocMap := (*C.ANeuralNetworksDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - cfeatureLevel, cfeatureLevelAllocMap := (*C.int64_t)(unsafe.Pointer(featureLevel)), cgoAllocsUnknown - __ret := C.ANeuralNetworksDevice_getFeatureLevel(cdevice, cfeatureLevel) - runtime.KeepAlive(cfeatureLevelAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksDevice_getName(device *ANeuralNetworksDevice, name **int8) int32 { - cdevice, cdeviceAllocMap := (*C.ANeuralNetworksDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - cname, cnameAllocMap := (**C.char)(unsafe.Pointer(name)), cgoAllocsUnknown - var pinnercname runtime.Pinner - pinnercname.Pin(name) - if name != nil { - pinnercname.Pin(unsafe.Pointer(*name)) - } - defer pinnercname.Unpin() - __ret := C.ANeuralNetworksDevice_getName(cdevice, cname) - runtime.KeepAlive(cnameAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksDevice_getType(device *ANeuralNetworksDevice, _type *int32) int32 { - cdevice, cdeviceAllocMap := (*C.ANeuralNetworksDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.int)(unsafe.Pointer(_type)), cgoAllocsUnknown - __ret := C.ANeuralNetworksDevice_getType(cdevice, c_type) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksDevice_getVersion(device *ANeuralNetworksDevice, version **int8) int32 { - cdevice, cdeviceAllocMap := (*C.ANeuralNetworksDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - cversion, cversionAllocMap := (**C.char)(unsafe.Pointer(version)), cgoAllocsUnknown - var pinnercversion runtime.Pinner - pinnercversion.Pin(version) - if version != nil { - pinnercversion.Pin(unsafe.Pointer(*version)) - } - defer pinnercversion.Unpin() - __ret := C.ANeuralNetworksDevice_getVersion(cdevice, cversion) - runtime.KeepAlive(cversionAllocMap) - runtime.KeepAlive(cdeviceAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksDevice_wait(device *ANeuralNetworksDevice) int32 { - cdevice, cdeviceAllocMap := (*C.ANeuralNetworksDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - __ret := C.ANeuralNetworksDevice_wait(cdevice) - runtime.KeepAlive(cdeviceAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksEvent_createFromSyncFenceFd(sync_fence_fd int32, event **ANeuralNetworksEvent) int32 { - csync_fence_fd, csync_fence_fdAllocMap := (C.int)(sync_fence_fd), cgoAllocsUnknown - cevent, ceventAllocMap := (**C.ANeuralNetworksEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - var pinnercevent runtime.Pinner - pinnercevent.Pin(event) - if event != nil { - pinnercevent.Pin(unsafe.Pointer(*event)) - } - defer pinnercevent.Unpin() - __ret := C.ANeuralNetworksEvent_createFromSyncFenceFd(csync_fence_fd, cevent) - runtime.KeepAlive(ceventAllocMap) - runtime.KeepAlive(csync_fence_fdAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksEvent_free(event *ANeuralNetworksEvent) { - cevent, ceventAllocMap := (*C.ANeuralNetworksEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - C.ANeuralNetworksEvent_free(cevent) - runtime.KeepAlive(ceventAllocMap) -} - -func ANeuralNetworksEvent_getSyncFenceFd(event *ANeuralNetworksEvent, sync_fence_fd *int32) int32 { - cevent, ceventAllocMap := (*C.ANeuralNetworksEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - csync_fence_fd, csync_fence_fdAllocMap := (*C.int)(unsafe.Pointer(sync_fence_fd)), cgoAllocsUnknown - __ret := C.ANeuralNetworksEvent_getSyncFenceFd(cevent, csync_fence_fd) - runtime.KeepAlive(csync_fence_fdAllocMap) - runtime.KeepAlive(ceventAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksEvent_wait(event *ANeuralNetworksEvent) int32 { - cevent, ceventAllocMap := (*C.ANeuralNetworksEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - __ret := C.ANeuralNetworksEvent_wait(cevent) - runtime.KeepAlive(ceventAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_burstCompute(execution *ANeuralNetworksExecution, burst *ANeuralNetworksBurst) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cburst, cburstAllocMap := (*C.ANeuralNetworksBurst)(unsafe.Pointer(burst)), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_burstCompute(cexecution, cburst) - runtime.KeepAlive(cburstAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_compute(execution *ANeuralNetworksExecution) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_compute(cexecution) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_create(compilation *ANeuralNetworksCompilation, execution **ANeuralNetworksExecution) int32 { - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cexecution, cexecutionAllocMap := (**C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - var pinnercexecution runtime.Pinner - pinnercexecution.Pin(execution) - if execution != nil { - pinnercexecution.Pin(unsafe.Pointer(*execution)) - } - defer pinnercexecution.Unpin() - __ret := C.ANeuralNetworksExecution_create(ccompilation, cexecution) - runtime.KeepAlive(cexecutionAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_enableInputAndOutputPadding(execution *ANeuralNetworksExecution, enable bool) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cenable, cenableAllocMap := (C._Bool)(enable), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_enableInputAndOutputPadding(cexecution, cenable) - runtime.KeepAlive(cenableAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_free(execution *ANeuralNetworksExecution) { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - C.ANeuralNetworksExecution_free(cexecution) - runtime.KeepAlive(cexecutionAllocMap) -} - -func ANeuralNetworksExecution_getDuration(execution *ANeuralNetworksExecution, durationCode int32, duration *uint64) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cdurationCode, cdurationCodeAllocMap := (C.int)(durationCode), cgoAllocsUnknown - cduration, cdurationAllocMap := (*C.uint64_t)(unsafe.Pointer(duration)), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_getDuration(cexecution, cdurationCode, cduration) - runtime.KeepAlive(cdurationAllocMap) - runtime.KeepAlive(cdurationCodeAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_getOutputOperandDimensions(execution *ANeuralNetworksExecution, index int32, dimensions *uint32) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - cdimensions, cdimensionsAllocMap := (*C.uint)(unsafe.Pointer(dimensions)), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_getOutputOperandDimensions(cexecution, cindex, cdimensions) - runtime.KeepAlive(cdimensionsAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_getOutputOperandRank(execution *ANeuralNetworksExecution, index int32, rank *uint32) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - crank, crankAllocMap := (*C.uint)(unsafe.Pointer(rank)), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_getOutputOperandRank(cexecution, cindex, crank) - runtime.KeepAlive(crankAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_setInput(execution *ANeuralNetworksExecution, index int32, _type *ANeuralNetworksOperandType, buffer unsafe.Pointer, length uint64) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.ANeuralNetworksOperandType)(unsafe.Pointer(_type)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := buffer, cgoAllocsUnknown - clength, clengthAllocMap := (C.uint64_t)(length), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_setInput(cexecution, cindex, c_type, cbuffer, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_setInputFromMemory(execution *ANeuralNetworksExecution, index int32, _type *ANeuralNetworksOperandType, memory *ANeuralNetworksMemory, offset uint64, length uint64) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.ANeuralNetworksOperandType)(unsafe.Pointer(_type)), cgoAllocsUnknown - cmemory, cmemoryAllocMap := (*C.ANeuralNetworksMemory)(unsafe.Pointer(memory)), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.uint64_t)(offset), cgoAllocsUnknown - clength, clengthAllocMap := (C.uint64_t)(length), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_setInputFromMemory(cexecution, cindex, c_type, cmemory, coffset, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cmemoryAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_setLoopTimeout(execution *ANeuralNetworksExecution, duration uint64) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cduration, cdurationAllocMap := (C.uint64_t)(duration), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_setLoopTimeout(cexecution, cduration) - runtime.KeepAlive(cdurationAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_setMeasureTiming(execution *ANeuralNetworksExecution, measure bool) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cmeasure, cmeasureAllocMap := (C._Bool)(measure), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_setMeasureTiming(cexecution, cmeasure) - runtime.KeepAlive(cmeasureAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_setOutput(execution *ANeuralNetworksExecution, index int32, _type *ANeuralNetworksOperandType, buffer unsafe.Pointer, length uint64) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.ANeuralNetworksOperandType)(unsafe.Pointer(_type)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := buffer, cgoAllocsUnknown - clength, clengthAllocMap := (C.uint64_t)(length), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_setOutput(cexecution, cindex, c_type, cbuffer, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_setOutputFromMemory(execution *ANeuralNetworksExecution, index int32, _type *ANeuralNetworksOperandType, memory *ANeuralNetworksMemory, offset uint64, length uint64) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.ANeuralNetworksOperandType)(unsafe.Pointer(_type)), cgoAllocsUnknown - cmemory, cmemoryAllocMap := (*C.ANeuralNetworksMemory)(unsafe.Pointer(memory)), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.uint64_t)(offset), cgoAllocsUnknown - clength, clengthAllocMap := (C.uint64_t)(length), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_setOutputFromMemory(cexecution, cindex, c_type, cmemory, coffset, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cmemoryAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_setReusable(execution *ANeuralNetworksExecution, reusable bool) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - creusable, creusableAllocMap := (C._Bool)(reusable), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_setReusable(cexecution, creusable) - runtime.KeepAlive(creusableAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_setTimeout(execution *ANeuralNetworksExecution, duration uint64) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cduration, cdurationAllocMap := (C.uint64_t)(duration), cgoAllocsUnknown - __ret := C.ANeuralNetworksExecution_setTimeout(cexecution, cduration) - runtime.KeepAlive(cdurationAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_startCompute(execution *ANeuralNetworksExecution, event **ANeuralNetworksEvent) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cevent, ceventAllocMap := (**C.ANeuralNetworksEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - var pinnercevent runtime.Pinner - pinnercevent.Pin(event) - if event != nil { - pinnercevent.Pin(unsafe.Pointer(*event)) - } - defer pinnercevent.Unpin() - __ret := C.ANeuralNetworksExecution_startCompute(cexecution, cevent) - runtime.KeepAlive(ceventAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksExecution_startComputeWithDependencies(execution *ANeuralNetworksExecution, dependencies **ANeuralNetworksEvent, num_dependencies uint32, duration uint64, event **ANeuralNetworksEvent) int32 { - cexecution, cexecutionAllocMap := (*C.ANeuralNetworksExecution)(unsafe.Pointer(execution)), cgoAllocsUnknown - cdependencies, cdependenciesAllocMap := (**C.ANeuralNetworksEvent)(unsafe.Pointer(dependencies)), cgoAllocsUnknown - var pinnercdependencies runtime.Pinner - pinnercdependencies.Pin(dependencies) - if dependencies != nil { - pinnercdependencies.Pin(unsafe.Pointer(*dependencies)) - } - defer pinnercdependencies.Unpin() - cnum_dependencies, cnum_dependenciesAllocMap := (C.uint)(num_dependencies), cgoAllocsUnknown - cduration, cdurationAllocMap := (C.uint64_t)(duration), cgoAllocsUnknown - cevent, ceventAllocMap := (**C.ANeuralNetworksEvent)(unsafe.Pointer(event)), cgoAllocsUnknown - var pinnercevent runtime.Pinner - pinnercevent.Pin(event) - if event != nil { - pinnercevent.Pin(unsafe.Pointer(*event)) - } - defer pinnercevent.Unpin() - __ret := C.ANeuralNetworksExecution_startComputeWithDependencies(cexecution, cdependencies, cnum_dependencies, cduration, cevent) - runtime.KeepAlive(ceventAllocMap) - runtime.KeepAlive(cdurationAllocMap) - runtime.KeepAlive(cnum_dependenciesAllocMap) - runtime.KeepAlive(cdependenciesAllocMap) - runtime.KeepAlive(cexecutionAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemoryDesc_addInputRole(desc *ANeuralNetworksMemoryDesc, compilation *ANeuralNetworksCompilation, index uint32, frequency float32) int32 { - cdesc, cdescAllocMap := (*C.ANeuralNetworksMemoryDesc)(unsafe.Pointer(desc)), cgoAllocsUnknown - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint)(index), cgoAllocsUnknown - cfrequency, cfrequencyAllocMap := (C.float)(frequency), cgoAllocsUnknown - __ret := C.ANeuralNetworksMemoryDesc_addInputRole(cdesc, ccompilation, cindex, cfrequency) - runtime.KeepAlive(cfrequencyAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - runtime.KeepAlive(cdescAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemoryDesc_addOutputRole(desc *ANeuralNetworksMemoryDesc, compilation *ANeuralNetworksCompilation, index uint32, frequency float32) int32 { - cdesc, cdescAllocMap := (*C.ANeuralNetworksMemoryDesc)(unsafe.Pointer(desc)), cgoAllocsUnknown - ccompilation, ccompilationAllocMap := (*C.ANeuralNetworksCompilation)(unsafe.Pointer(compilation)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.uint)(index), cgoAllocsUnknown - cfrequency, cfrequencyAllocMap := (C.float)(frequency), cgoAllocsUnknown - __ret := C.ANeuralNetworksMemoryDesc_addOutputRole(cdesc, ccompilation, cindex, cfrequency) - runtime.KeepAlive(cfrequencyAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(ccompilationAllocMap) - runtime.KeepAlive(cdescAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemoryDesc_create(desc **ANeuralNetworksMemoryDesc) int32 { - cdesc, cdescAllocMap := (**C.ANeuralNetworksMemoryDesc)(unsafe.Pointer(desc)), cgoAllocsUnknown - var pinnercdesc runtime.Pinner - pinnercdesc.Pin(desc) - if desc != nil { - pinnercdesc.Pin(unsafe.Pointer(*desc)) - } - defer pinnercdesc.Unpin() - __ret := C.ANeuralNetworksMemoryDesc_create(cdesc) - runtime.KeepAlive(cdescAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemoryDesc_finish(desc *ANeuralNetworksMemoryDesc) int32 { - cdesc, cdescAllocMap := (*C.ANeuralNetworksMemoryDesc)(unsafe.Pointer(desc)), cgoAllocsUnknown - __ret := C.ANeuralNetworksMemoryDesc_finish(cdesc) - runtime.KeepAlive(cdescAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemoryDesc_free(desc *ANeuralNetworksMemoryDesc) { - cdesc, cdescAllocMap := (*C.ANeuralNetworksMemoryDesc)(unsafe.Pointer(desc)), cgoAllocsUnknown - C.ANeuralNetworksMemoryDesc_free(cdesc) - runtime.KeepAlive(cdescAllocMap) -} - -func ANeuralNetworksMemoryDesc_setDimensions(desc *ANeuralNetworksMemoryDesc, rank uint32, dimensions *uint32) int32 { - cdesc, cdescAllocMap := (*C.ANeuralNetworksMemoryDesc)(unsafe.Pointer(desc)), cgoAllocsUnknown - crank, crankAllocMap := (C.uint)(rank), cgoAllocsUnknown - cdimensions, cdimensionsAllocMap := (*C.uint)(unsafe.Pointer(dimensions)), cgoAllocsUnknown - __ret := C.ANeuralNetworksMemoryDesc_setDimensions(cdesc, crank, cdimensions) - runtime.KeepAlive(cdimensionsAllocMap) - runtime.KeepAlive(crankAllocMap) - runtime.KeepAlive(cdescAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemory_copy(src *ANeuralNetworksMemory, dst *ANeuralNetworksMemory) int32 { - csrc, csrcAllocMap := (*C.ANeuralNetworksMemory)(unsafe.Pointer(src)), cgoAllocsUnknown - cdst, cdstAllocMap := (*C.ANeuralNetworksMemory)(unsafe.Pointer(dst)), cgoAllocsUnknown - __ret := C.ANeuralNetworksMemory_copy(csrc, cdst) - runtime.KeepAlive(cdstAllocMap) - runtime.KeepAlive(csrcAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemory_createFromAHardwareBuffer(ahwb *AHardwareBuffer, memory **ANeuralNetworksMemory) int32 { - cahwb, cahwbAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(ahwb)), cgoAllocsUnknown - cmemory, cmemoryAllocMap := (**C.ANeuralNetworksMemory)(unsafe.Pointer(memory)), cgoAllocsUnknown - var pinnercmemory runtime.Pinner - pinnercmemory.Pin(memory) - if memory != nil { - pinnercmemory.Pin(unsafe.Pointer(*memory)) - } - defer pinnercmemory.Unpin() - __ret := C.ANeuralNetworksMemory_createFromAHardwareBuffer(cahwb, cmemory) - runtime.KeepAlive(cmemoryAllocMap) - runtime.KeepAlive(cahwbAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemory_createFromDesc(desc *ANeuralNetworksMemoryDesc, memory **ANeuralNetworksMemory) int32 { - cdesc, cdescAllocMap := (*C.ANeuralNetworksMemoryDesc)(unsafe.Pointer(desc)), cgoAllocsUnknown - cmemory, cmemoryAllocMap := (**C.ANeuralNetworksMemory)(unsafe.Pointer(memory)), cgoAllocsUnknown - var pinnercmemory runtime.Pinner - pinnercmemory.Pin(memory) - if memory != nil { - pinnercmemory.Pin(unsafe.Pointer(*memory)) - } - defer pinnercmemory.Unpin() - __ret := C.ANeuralNetworksMemory_createFromDesc(cdesc, cmemory) - runtime.KeepAlive(cmemoryAllocMap) - runtime.KeepAlive(cdescAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemory_createFromFd(size uint64, protect int32, fd int32, offset uint64, memory **ANeuralNetworksMemory) int32 { - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - cprotect, cprotectAllocMap := (C.int)(protect), cgoAllocsUnknown - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.uint64_t)(offset), cgoAllocsUnknown - cmemory, cmemoryAllocMap := (**C.ANeuralNetworksMemory)(unsafe.Pointer(memory)), cgoAllocsUnknown - var pinnercmemory runtime.Pinner - pinnercmemory.Pin(memory) - if memory != nil { - pinnercmemory.Pin(unsafe.Pointer(*memory)) - } - defer pinnercmemory.Unpin() - __ret := C.ANeuralNetworksMemory_createFromFd(csize, cprotect, cfd, coffset, cmemory) - runtime.KeepAlive(cmemoryAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(cprotectAllocMap) - runtime.KeepAlive(csizeAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksMemory_free(memory *ANeuralNetworksMemory) { - cmemory, cmemoryAllocMap := (*C.ANeuralNetworksMemory)(unsafe.Pointer(memory)), cgoAllocsUnknown - C.ANeuralNetworksMemory_free(cmemory) - runtime.KeepAlive(cmemoryAllocMap) -} - -func ANeuralNetworksModel_addOperand(model *ANeuralNetworksModel, _type *ANeuralNetworksOperandType) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - c_type, c_typeAllocMap := (*C.ANeuralNetworksOperandType)(unsafe.Pointer(_type)), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_addOperand(cmodel, c_type) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_addOperation(model *ANeuralNetworksModel, _type ANeuralNetworksOperationType, inputCount uint32, inputs *uint32, outputCount uint32, outputs *uint32) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.ANeuralNetworksOperationType)(_type), cgoAllocsUnknown - cinputCount, cinputCountAllocMap := (C.uint)(inputCount), cgoAllocsUnknown - cinputs, cinputsAllocMap := (*C.uint)(unsafe.Pointer(inputs)), cgoAllocsUnknown - coutputCount, coutputCountAllocMap := (C.uint)(outputCount), cgoAllocsUnknown - coutputs, coutputsAllocMap := (*C.uint)(unsafe.Pointer(outputs)), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_addOperation(cmodel, c_type, cinputCount, cinputs, coutputCount, coutputs) - runtime.KeepAlive(coutputsAllocMap) - runtime.KeepAlive(coutputCountAllocMap) - runtime.KeepAlive(cinputsAllocMap) - runtime.KeepAlive(cinputCountAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_create(model **ANeuralNetworksModel) int32 { - cmodel, cmodelAllocMap := (**C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - var pinnercmodel runtime.Pinner - pinnercmodel.Pin(model) - if model != nil { - pinnercmodel.Pin(unsafe.Pointer(*model)) - } - defer pinnercmodel.Unpin() - __ret := C.ANeuralNetworksModel_create(cmodel) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_finish(model *ANeuralNetworksModel) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_finish(cmodel) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_free(model *ANeuralNetworksModel) { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - C.ANeuralNetworksModel_free(cmodel) - runtime.KeepAlive(cmodelAllocMap) -} - -func ANeuralNetworksModel_getSupportedOperationsForDevices(model *ANeuralNetworksModel, devices **ANeuralNetworksDevice, numDevices uint32, supportedOps *bool) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - cdevices, cdevicesAllocMap := (**C.ANeuralNetworksDevice)(unsafe.Pointer(devices)), cgoAllocsUnknown - var pinnercdevices runtime.Pinner - pinnercdevices.Pin(devices) - if devices != nil { - pinnercdevices.Pin(unsafe.Pointer(*devices)) - } - defer pinnercdevices.Unpin() - cnumDevices, cnumDevicesAllocMap := (C.uint)(numDevices), cgoAllocsUnknown - csupportedOps, csupportedOpsAllocMap := (*C._Bool)(unsafe.Pointer(supportedOps)), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_getSupportedOperationsForDevices(cmodel, cdevices, cnumDevices, csupportedOps) - runtime.KeepAlive(csupportedOpsAllocMap) - runtime.KeepAlive(cnumDevicesAllocMap) - runtime.KeepAlive(cdevicesAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_identifyInputsAndOutputs(model *ANeuralNetworksModel, inputCount uint32, inputs *uint32, outputCount uint32, outputs *uint32) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - cinputCount, cinputCountAllocMap := (C.uint)(inputCount), cgoAllocsUnknown - cinputs, cinputsAllocMap := (*C.uint)(unsafe.Pointer(inputs)), cgoAllocsUnknown - coutputCount, coutputCountAllocMap := (C.uint)(outputCount), cgoAllocsUnknown - coutputs, coutputsAllocMap := (*C.uint)(unsafe.Pointer(outputs)), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_identifyInputsAndOutputs(cmodel, cinputCount, cinputs, coutputCount, coutputs) - runtime.KeepAlive(coutputsAllocMap) - runtime.KeepAlive(coutputCountAllocMap) - runtime.KeepAlive(cinputsAllocMap) - runtime.KeepAlive(cinputCountAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_relaxComputationFloat32toFloat16(model *ANeuralNetworksModel, allow bool) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - callow, callowAllocMap := (C._Bool)(allow), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_relaxComputationFloat32toFloat16(cmodel, callow) - runtime.KeepAlive(callowAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_setOperandSymmPerChannelQuantParams(model *ANeuralNetworksModel, index int32, channelQuant *ANeuralNetworksSymmPerChannelQuantParams) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - cchannelQuant, cchannelQuantAllocMap := (*C.ANeuralNetworksSymmPerChannelQuantParams)(unsafe.Pointer(channelQuant)), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_setOperandSymmPerChannelQuantParams(cmodel, cindex, cchannelQuant) - runtime.KeepAlive(cchannelQuantAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_setOperandValue(model *ANeuralNetworksModel, index int32, buffer unsafe.Pointer, length uint64) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - cbuffer, cbufferAllocMap := buffer, cgoAllocsUnknown - clength, clengthAllocMap := (C.uint64_t)(length), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_setOperandValue(cmodel, cindex, cbuffer, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_setOperandValueFromMemory(model *ANeuralNetworksModel, index int32, memory *ANeuralNetworksMemory, offset uint64, length uint64) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - cmemory, cmemoryAllocMap := (*C.ANeuralNetworksMemory)(unsafe.Pointer(memory)), cgoAllocsUnknown - coffset, coffsetAllocMap := (C.uint64_t)(offset), cgoAllocsUnknown - clength, clengthAllocMap := (C.uint64_t)(length), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_setOperandValueFromMemory(cmodel, cindex, cmemory, coffset, clength) - runtime.KeepAlive(clengthAllocMap) - runtime.KeepAlive(coffsetAllocMap) - runtime.KeepAlive(cmemoryAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworksModel_setOperandValueFromModel(model *ANeuralNetworksModel, index int32, value *ANeuralNetworksModel) int32 { - cmodel, cmodelAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(model)), cgoAllocsUnknown - cindex, cindexAllocMap := (C.int)(index), cgoAllocsUnknown - cvalue, cvalueAllocMap := (*C.ANeuralNetworksModel)(unsafe.Pointer(value)), cgoAllocsUnknown - __ret := C.ANeuralNetworksModel_setOperandValueFromModel(cmodel, cindex, cvalue) - runtime.KeepAlive(cvalueAllocMap) - runtime.KeepAlive(cindexAllocMap) - runtime.KeepAlive(cmodelAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworks_getDefaultLoopTimeout() uint64 { - __ret := C.ANeuralNetworks_getDefaultLoopTimeout() - __v := (uint64)(__ret) - return __v -} - -func ANeuralNetworks_getDevice(devIndex uint32, device **ANeuralNetworksDevice) int32 { - cdevIndex, cdevIndexAllocMap := (C.uint)(devIndex), cgoAllocsUnknown - cdevice, cdeviceAllocMap := (**C.ANeuralNetworksDevice)(unsafe.Pointer(device)), cgoAllocsUnknown - var pinnercdevice runtime.Pinner - pinnercdevice.Pin(device) - if device != nil { - pinnercdevice.Pin(unsafe.Pointer(*device)) - } - defer pinnercdevice.Unpin() - __ret := C.ANeuralNetworks_getDevice(cdevIndex, cdevice) - runtime.KeepAlive(cdeviceAllocMap) - runtime.KeepAlive(cdevIndexAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworks_getDeviceCount(numDevices *uint32) int32 { - cnumDevices, cnumDevicesAllocMap := (*C.uint)(unsafe.Pointer(numDevices)), cgoAllocsUnknown - __ret := C.ANeuralNetworks_getDeviceCount(cnumDevices) - runtime.KeepAlive(cnumDevicesAllocMap) - __v := (int32)(__ret) - return __v -} - -func ANeuralNetworks_getMaximumLoopTimeout() uint64 { - __ret := C.ANeuralNetworks_getMaximumLoopTimeout() - __v := (uint64)(__ret) - return __v -} - -func ANeuralNetworks_getRuntimeFeatureLevel() int64 { - __ret := C.ANeuralNetworks_getRuntimeFeatureLevel() - __v := (int64)(__ret) - return __v -} diff --git a/capi/neuralnetworks/types.go b/capi/neuralnetworks/types.go deleted file mode 100644 index 61f3888..0000000 --- a/capi/neuralnetworks/types.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package neuralnetworks - -/* -#cgo LDFLAGS: -lneuralnetworks -#include "android/NeuralNetworks.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AHardwareBuffer C.AHardwareBuffer - -type ANeuralNetworksBurst C.ANeuralNetworksBurst - -type ANeuralNetworksCompilation C.ANeuralNetworksCompilation - -type ANeuralNetworksDevice C.ANeuralNetworksDevice - -type ANeuralNetworksEvent C.ANeuralNetworksEvent - -type ANeuralNetworksExecution C.ANeuralNetworksExecution - -type ANeuralNetworksMemory C.ANeuralNetworksMemory - -type ANeuralNetworksMemoryDesc C.ANeuralNetworksMemoryDesc - -type ANeuralNetworksModel C.ANeuralNetworksModel - -type ANeuralNetworksOperandType C.ANeuralNetworksOperandType - -type ANeuralNetworksOperationType C.ANeuralNetworksOperationType - -type ANeuralNetworksSymmPerChannelQuantParams C.ANeuralNetworksSymmPerChannelQuantParams diff --git a/capi/performancehint/cgo_helpers.c b/capi/performancehint/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/performancehint/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/performancehint/cgo_helpers.go b/capi/performancehint/cgo_helpers.go deleted file mode 100644 index 916c6e7..0000000 --- a/capi/performancehint/cgo_helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package performancehint - -/* -#cgo LDFLAGS: -landroid -#include "android/performance_hint.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} diff --git a/capi/performancehint/cgo_helpers.h b/capi/performancehint/cgo_helpers.h deleted file mode 100644 index 79e2b13..0000000 --- a/capi/performancehint/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/performance_hint.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/performancehint/const.go b/capi/performancehint/const.go deleted file mode 100644 index 7c1ba4d..0000000 --- a/capi/performancehint/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package performancehint diff --git a/capi/performancehint/doc.go b/capi/performancehint/doc.go deleted file mode 100644 index ee1fbb6..0000000 --- a/capi/performancehint/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Performance Hint -*/ -package performancehint diff --git a/capi/performancehint/performancehint.go b/capi/performancehint/performancehint.go deleted file mode 100644 index a490d62..0000000 --- a/capi/performancehint/performancehint.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package performancehint - -/* -#cgo LDFLAGS: -landroid -#include "android/performance_hint.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func APerformanceHint_closeSession(session *APerformanceHintSession) { - csession, csessionAllocMap := (*C.APerformanceHintSession)(unsafe.Pointer(session)), cgoAllocsUnknown - C.APerformanceHint_closeSession(csession) - runtime.KeepAlive(csessionAllocMap) -} - -func APerformanceHint_createSession(manager *APerformanceHintManager, threadIds *int32, size uint64, initialTargetWorkDurationNanos int64) *APerformanceHintSession { - cmanager, cmanagerAllocMap := (*C.APerformanceHintManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - cthreadIds, cthreadIdsAllocMap := (*C.int)(unsafe.Pointer(threadIds)), cgoAllocsUnknown - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - cinitialTargetWorkDurationNanos, cinitialTargetWorkDurationNanosAllocMap := (C.int64_t)(initialTargetWorkDurationNanos), cgoAllocsUnknown - __ret := C.APerformanceHint_createSession(cmanager, cthreadIds, csize, cinitialTargetWorkDurationNanos) - runtime.KeepAlive(cinitialTargetWorkDurationNanosAllocMap) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cthreadIdsAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (*APerformanceHintSession)(unsafe.Pointer(__ret)) - return __v -} - -func APerformanceHint_getManager() *APerformanceHintManager { - __ret := C.APerformanceHint_getManager() - __v := (*APerformanceHintManager)(unsafe.Pointer(__ret)) - return __v -} - -func APerformanceHint_getPreferredUpdateRateNanos(manager *APerformanceHintManager) int64 { - cmanager, cmanagerAllocMap := (*C.APerformanceHintManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - __ret := C.APerformanceHint_getPreferredUpdateRateNanos(cmanager) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int64)(__ret) - return __v -} - -func APerformanceHint_reportActualWorkDuration(session *APerformanceHintSession, actualDurationNanos int64) int32 { - csession, csessionAllocMap := (*C.APerformanceHintSession)(unsafe.Pointer(session)), cgoAllocsUnknown - cactualDurationNanos, cactualDurationNanosAllocMap := (C.int64_t)(actualDurationNanos), cgoAllocsUnknown - __ret := C.APerformanceHint_reportActualWorkDuration(csession, cactualDurationNanos) - runtime.KeepAlive(cactualDurationNanosAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (int32)(__ret) - return __v -} - -func APerformanceHint_reportActualWorkDuration2(session *APerformanceHintSession, workDuration *AWorkDuration) int32 { - csession, csessionAllocMap := (*C.APerformanceHintSession)(unsafe.Pointer(session)), cgoAllocsUnknown - cworkDuration, cworkDurationAllocMap := (*C.AWorkDuration)(unsafe.Pointer(workDuration)), cgoAllocsUnknown - __ret := C.APerformanceHint_reportActualWorkDuration2(csession, cworkDuration) - runtime.KeepAlive(cworkDurationAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (int32)(__ret) - return __v -} - -func APerformanceHint_setPreferPowerEfficiency(session *APerformanceHintSession, enabled bool) int32 { - csession, csessionAllocMap := (*C.APerformanceHintSession)(unsafe.Pointer(session)), cgoAllocsUnknown - cenabled, cenabledAllocMap := (C._Bool)(enabled), cgoAllocsUnknown - __ret := C.APerformanceHint_setPreferPowerEfficiency(csession, cenabled) - runtime.KeepAlive(cenabledAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (int32)(__ret) - return __v -} - -func APerformanceHint_setThreads(session *APerformanceHintSession, threadIds *Pid_t, size uint64) int32 { - csession, csessionAllocMap := (*C.APerformanceHintSession)(unsafe.Pointer(session)), cgoAllocsUnknown - cthreadIds, cthreadIdsAllocMap := (*C.pid_t)(unsafe.Pointer(threadIds)), cgoAllocsUnknown - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - __ret := C.APerformanceHint_setThreads(csession, cthreadIds, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cthreadIdsAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (int32)(__ret) - return __v -} - -func APerformanceHint_updateTargetWorkDuration(session *APerformanceHintSession, targetDurationNanos int64) int32 { - csession, csessionAllocMap := (*C.APerformanceHintSession)(unsafe.Pointer(session)), cgoAllocsUnknown - ctargetDurationNanos, ctargetDurationNanosAllocMap := (C.int64_t)(targetDurationNanos), cgoAllocsUnknown - __ret := C.APerformanceHint_updateTargetWorkDuration(csession, ctargetDurationNanos) - runtime.KeepAlive(ctargetDurationNanosAllocMap) - runtime.KeepAlive(csessionAllocMap) - __v := (int32)(__ret) - return __v -} - -func AWorkDuration_create() *AWorkDuration { - __ret := C.AWorkDuration_create() - __v := (*AWorkDuration)(unsafe.Pointer(__ret)) - return __v -} - -func AWorkDuration_release(aWorkDuration *AWorkDuration) { - caWorkDuration, caWorkDurationAllocMap := (*C.AWorkDuration)(unsafe.Pointer(aWorkDuration)), cgoAllocsUnknown - C.AWorkDuration_release(caWorkDuration) - runtime.KeepAlive(caWorkDurationAllocMap) -} - -func AWorkDuration_setActualCpuDurationNanos(aWorkDuration *AWorkDuration, actualCpuDurationNanos int64) { - caWorkDuration, caWorkDurationAllocMap := (*C.AWorkDuration)(unsafe.Pointer(aWorkDuration)), cgoAllocsUnknown - cactualCpuDurationNanos, cactualCpuDurationNanosAllocMap := (C.int64_t)(actualCpuDurationNanos), cgoAllocsUnknown - C.AWorkDuration_setActualCpuDurationNanos(caWorkDuration, cactualCpuDurationNanos) - runtime.KeepAlive(cactualCpuDurationNanosAllocMap) - runtime.KeepAlive(caWorkDurationAllocMap) -} - -func AWorkDuration_setActualGpuDurationNanos(aWorkDuration *AWorkDuration, actualGpuDurationNanos int64) { - caWorkDuration, caWorkDurationAllocMap := (*C.AWorkDuration)(unsafe.Pointer(aWorkDuration)), cgoAllocsUnknown - cactualGpuDurationNanos, cactualGpuDurationNanosAllocMap := (C.int64_t)(actualGpuDurationNanos), cgoAllocsUnknown - C.AWorkDuration_setActualGpuDurationNanos(caWorkDuration, cactualGpuDurationNanos) - runtime.KeepAlive(cactualGpuDurationNanosAllocMap) - runtime.KeepAlive(caWorkDurationAllocMap) -} - -func AWorkDuration_setActualTotalDurationNanos(aWorkDuration *AWorkDuration, actualTotalDurationNanos int64) { - caWorkDuration, caWorkDurationAllocMap := (*C.AWorkDuration)(unsafe.Pointer(aWorkDuration)), cgoAllocsUnknown - cactualTotalDurationNanos, cactualTotalDurationNanosAllocMap := (C.int64_t)(actualTotalDurationNanos), cgoAllocsUnknown - C.AWorkDuration_setActualTotalDurationNanos(caWorkDuration, cactualTotalDurationNanos) - runtime.KeepAlive(cactualTotalDurationNanosAllocMap) - runtime.KeepAlive(caWorkDurationAllocMap) -} - -func AWorkDuration_setWorkPeriodStartTimestampNanos(aWorkDuration *AWorkDuration, workPeriodStartTimestampNanos int64) { - caWorkDuration, caWorkDurationAllocMap := (*C.AWorkDuration)(unsafe.Pointer(aWorkDuration)), cgoAllocsUnknown - cworkPeriodStartTimestampNanos, cworkPeriodStartTimestampNanosAllocMap := (C.int64_t)(workPeriodStartTimestampNanos), cgoAllocsUnknown - C.AWorkDuration_setWorkPeriodStartTimestampNanos(caWorkDuration, cworkPeriodStartTimestampNanos) - runtime.KeepAlive(cworkPeriodStartTimestampNanosAllocMap) - runtime.KeepAlive(caWorkDurationAllocMap) -} diff --git a/capi/performancehint/types.go b/capi/performancehint/types.go deleted file mode 100644 index a93b63d..0000000 --- a/capi/performancehint/types.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package performancehint - -/* -#cgo LDFLAGS: -landroid -#include "android/performance_hint.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type APerformanceHintManager C.APerformanceHintManager - -type APerformanceHintSession C.APerformanceHintSession - -type AWorkDuration C.AWorkDuration - -type Pid_t C.pid_t diff --git a/capi/permission/cgo_helpers.c b/capi/permission/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/permission/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/permission/cgo_helpers.go b/capi/permission/cgo_helpers.go deleted file mode 100644 index 71cc624..0000000 --- a/capi/permission/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package permission - -/* -#cgo LDFLAGS: -landroid -#include "android/permission_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/permission/cgo_helpers.h b/capi/permission/cgo_helpers.h deleted file mode 100644 index 392922f..0000000 --- a/capi/permission/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/permission_manager.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/permission/const.go b/capi/permission/const.go deleted file mode 100644 index 0c6d47b..0000000 --- a/capi/permission/const.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package permission - -const ( - PERMISSION_MANAGER_PERMISSION_GRANTED = 0 - PERMISSION_MANAGER_PERMISSION_DENIED = -1 -) - -const ( - PERMISSION_MANAGER_STATUS_OK = 0 - PERMISSION_MANAGER_STATUS_ERROR_UNKNOWN = -1 - PERMISSION_MANAGER_STATUS_SERVICE_UNAVAILABLE = -2 -) diff --git a/capi/permission/doc.go b/capi/permission/doc.go deleted file mode 100644 index 52342e8..0000000 --- a/capi/permission/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Permission Manager -*/ -package permission diff --git a/capi/permission/permission.go b/capi/permission/permission.go deleted file mode 100644 index 1f5e8b0..0000000 --- a/capi/permission/permission.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package permission - -/* -#cgo LDFLAGS: -landroid -#include "android/permission_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func APermissionManager_checkPermission(permission string, pid Pid_t, uid Uid_t, outResult *int32) int32 { - cpermission, cpermissionAllocMap := UnpackPCharString(permission) - cpid, cpidAllocMap := (C.pid_t)(pid), cgoAllocsUnknown - cuid, cuidAllocMap := (C.uid_t)(uid), cgoAllocsUnknown - coutResult, coutResultAllocMap := (*C.int)(unsafe.Pointer(outResult)), cgoAllocsUnknown - __ret := C.APermissionManager_checkPermission(cpermission, cpid, cuid, coutResult) - runtime.KeepAlive(coutResultAllocMap) - runtime.KeepAlive(cuidAllocMap) - runtime.KeepAlive(cpidAllocMap) - runtime.KeepAlive(cpermissionAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/permission/types.go b/capi/permission/types.go deleted file mode 100644 index 4c9c545..0000000 --- a/capi/permission/types.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package permission - -/* -#cgo LDFLAGS: -landroid -#include "android/permission_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type Pid_t C.pid_t - -type Uid_t C.uid_t diff --git a/capi/persistablebundle/cgo_helpers.c b/capi/persistablebundle/cgo_helpers.c deleted file mode 100644 index 17318f3..0000000 --- a/capi/persistablebundle/cgo_helpers.c +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -char* APersistableBundle_stringAllocator_d22e9a69(int32_t sizeBytes, void* context) { - return APersistableBundle_stringAllocatorD22E9A69(sizeBytes, context); -} diff --git a/capi/persistablebundle/cgo_helpers.go b/capi/persistablebundle/cgo_helpers.go deleted file mode 100644 index 49114b7..0000000 --- a/capi/persistablebundle/cgo_helpers.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package persistablebundle - -/* -#cgo LDFLAGS: -lbinder_ndk -#include "android/persistable_bundle.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x APersistableBundle_stringAllocator) PassRef() (ref *C.APersistableBundle_stringAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aPersistableBundle_stringAllocatorD22E9A69Func == nil { - aPersistableBundle_stringAllocatorD22E9A69Func = x - } - return (*C.APersistableBundle_stringAllocator)(C.APersistableBundle_stringAllocator_d22e9a69), nil -} - -func (x APersistableBundle_stringAllocator) PassValue() (ref C.APersistableBundle_stringAllocator, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aPersistableBundle_stringAllocatorD22E9A69Func == nil { - aPersistableBundle_stringAllocatorD22E9A69Func = x - } - return (C.APersistableBundle_stringAllocator)(C.APersistableBundle_stringAllocator_d22e9a69), nil -} - -func NewAPersistableBundle_stringAllocatorRef(ref unsafe.Pointer) *APersistableBundle_stringAllocator { - return (*APersistableBundle_stringAllocator)(ref) -} - -//export APersistableBundle_stringAllocatorD22E9A69 -func APersistableBundle_stringAllocatorD22E9A69(csizeBytes C.int32_t, ccontext unsafe.Pointer) *C.char { - if aPersistableBundle_stringAllocatorD22E9A69Func != nil { - sizeBytesd22e9a69 := (int32)(csizeBytes) - contextd22e9a69 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - retd22e9a69 := aPersistableBundle_stringAllocatorD22E9A69Func(sizeBytesd22e9a69, contextd22e9a69) - ret, _ := (*C.char)(unsafe.Pointer(retd22e9a69)), cgoAllocsUnknown - return ret - } - panic("callback func has not been set (race?)") -} - -var aPersistableBundle_stringAllocatorD22E9A69Func APersistableBundle_stringAllocator - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/persistablebundle/cgo_helpers.h b/capi/persistablebundle/cgo_helpers.h deleted file mode 100644 index eea5bb8..0000000 --- a/capi/persistablebundle/cgo_helpers.h +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/persistable_bundle.h" -#include -#pragma once - -#define __CGOGEN 1 - -// APersistableBundle_stringAllocator_d22e9a69 is a proxy for callback APersistableBundle_stringAllocator. -char* APersistableBundle_stringAllocator_d22e9a69(int32_t sizeBytes, void* context); diff --git a/capi/persistablebundle/const.go b/capi/persistablebundle/const.go deleted file mode 100644 index a24baec..0000000 --- a/capi/persistablebundle/const.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package persistablebundle - -const ( - APERSISTABLEBUNDLE_KEY_NOT_FOUND = -1 - APERSISTABLEBUNDLE_ALLOCATOR_FAILED = -2 -) diff --git a/capi/persistablebundle/doc.go b/capi/persistablebundle/doc.go deleted file mode 100644 index 1c2c94b..0000000 --- a/capi/persistablebundle/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android PersistableBundle NDK -*/ -package persistablebundle diff --git a/capi/persistablebundle/persistablebundle.go b/capi/persistablebundle/persistablebundle.go deleted file mode 100644 index 32bb905..0000000 --- a/capi/persistablebundle/persistablebundle.go +++ /dev/null @@ -1,628 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package persistablebundle - -/* -#cgo LDFLAGS: -lbinder_ndk -#include "android/persistable_bundle.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func APersistableBundle_delete(pBundle *APersistableBundle) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - C.APersistableBundle_delete(cpBundle) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_dup(pBundle *APersistableBundle) *APersistableBundle { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - __ret := C.APersistableBundle_dup(cpBundle) - runtime.KeepAlive(cpBundleAllocMap) - __v := (*APersistableBundle)(unsafe.Pointer(__ret)) - return __v -} - -func APersistableBundle_erase(pBundle *APersistableBundle, key string) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - __ret := C.APersistableBundle_erase(cpBundle, ckey) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getBoolean(pBundle *APersistableBundle, key string, val *bool) bool { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (*C._Bool)(unsafe.Pointer(val)), cgoAllocsUnknown - __ret := C.APersistableBundle_getBoolean(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (bool)(__ret) - return __v -} - -func APersistableBundle_getBooleanKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getBooleanKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getBooleanVector(pBundle *APersistableBundle, key string, buffer *bool, bufferSizeBytes int32) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cbuffer, cbufferAllocMap := (*C._Bool)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - __ret := C.APersistableBundle_getBooleanVector(cpBundle, ckey, cbuffer, cbufferSizeBytes) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getBooleanVectorKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getBooleanVectorKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getDouble(pBundle *APersistableBundle, key string, val *float64) bool { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (*C.double)(unsafe.Pointer(val)), cgoAllocsUnknown - __ret := C.APersistableBundle_getDouble(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (bool)(__ret) - return __v -} - -func APersistableBundle_getDoubleKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getDoubleKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getDoubleVector(pBundle *APersistableBundle, key string, buffer *float64, bufferSizeBytes int32) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cbuffer, cbufferAllocMap := (*C.double)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - __ret := C.APersistableBundle_getDoubleVector(cpBundle, ckey, cbuffer, cbufferSizeBytes) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getDoubleVectorKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getDoubleVectorKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getInt(pBundle *APersistableBundle, key string, val *int32) bool { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (*C.int)(unsafe.Pointer(val)), cgoAllocsUnknown - __ret := C.APersistableBundle_getInt(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (bool)(__ret) - return __v -} - -func APersistableBundle_getIntKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getIntKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getIntVector(pBundle *APersistableBundle, key string, buffer *int32, bufferSizeBytes int32) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cbuffer, cbufferAllocMap := (*C.int)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - __ret := C.APersistableBundle_getIntVector(cpBundle, ckey, cbuffer, cbufferSizeBytes) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getIntVectorKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getIntVectorKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getLong(pBundle *APersistableBundle, key string, val *int64) bool { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (*C.int64_t)(unsafe.Pointer(val)), cgoAllocsUnknown - __ret := C.APersistableBundle_getLong(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (bool)(__ret) - return __v -} - -func APersistableBundle_getLongKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getLongKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getLongVector(pBundle *APersistableBundle, key string, buffer *int64, bufferSizeBytes int32) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cbuffer, cbufferAllocMap := (*C.int64_t)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - __ret := C.APersistableBundle_getLongVector(cpBundle, ckey, cbuffer, cbufferSizeBytes) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getLongVectorKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getLongVectorKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getPersistableBundle(pBundle *APersistableBundle, key string, outBundle **APersistableBundle) bool { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - coutBundle, coutBundleAllocMap := (**C.APersistableBundle)(unsafe.Pointer(outBundle)), cgoAllocsUnknown - var pinnercoutBundle runtime.Pinner - pinnercoutBundle.Pin(outBundle) - if outBundle != nil { - pinnercoutBundle.Pin(unsafe.Pointer(*outBundle)) - } - defer pinnercoutBundle.Unpin() - __ret := C.APersistableBundle_getPersistableBundle(cpBundle, ckey, coutBundle) - runtime.KeepAlive(coutBundleAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (bool)(__ret) - return __v -} - -func APersistableBundle_getPersistableBundleKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getPersistableBundleKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getString(pBundle *APersistableBundle, key string, val **int8, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (**C.char)(unsafe.Pointer(val)), cgoAllocsUnknown - var pinnercval runtime.Pinner - pinnercval.Pin(val) - if val != nil { - pinnercval.Pin(unsafe.Pointer(*val)) - } - defer pinnercval.Unpin() - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getString(cpBundle, ckey, cval, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getStringKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getStringKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getStringVector(pBundle *APersistableBundle, key string, buffer **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cbuffer, cbufferAllocMap := (**C.char)(unsafe.Pointer(buffer)), cgoAllocsUnknown - var pinnercbuffer runtime.Pinner - pinnercbuffer.Pin(buffer) - if buffer != nil { - pinnercbuffer.Pin(unsafe.Pointer(*buffer)) - } - defer pinnercbuffer.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getStringVector(cpBundle, ckey, cbuffer, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_getStringVectorKeys(pBundle *APersistableBundle, outKeys **int8, bufferSizeBytes int32, stringAllocator APersistableBundle_stringAllocator, context unsafe.Pointer) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - coutKeys, coutKeysAllocMap := (**C.char)(unsafe.Pointer(outKeys)), cgoAllocsUnknown - var pinnercoutKeys runtime.Pinner - pinnercoutKeys.Pin(outKeys) - if outKeys != nil { - pinnercoutKeys.Pin(unsafe.Pointer(*outKeys)) - } - defer pinnercoutKeys.Unpin() - cbufferSizeBytes, cbufferSizeBytesAllocMap := (C.int)(bufferSizeBytes), cgoAllocsUnknown - cstringAllocator, cstringAllocatorAllocMap := stringAllocator.PassValue() - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - __ret := C.APersistableBundle_getStringVectorKeys(cpBundle, coutKeys, cbufferSizeBytes, cstringAllocator, ccontext) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(cstringAllocatorAllocMap) - runtime.KeepAlive(cbufferSizeBytesAllocMap) - runtime.KeepAlive(coutKeysAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_isEqual(lhs *APersistableBundle, rhs *APersistableBundle) bool { - clhs, clhsAllocMap := (*C.APersistableBundle)(unsafe.Pointer(lhs)), cgoAllocsUnknown - crhs, crhsAllocMap := (*C.APersistableBundle)(unsafe.Pointer(rhs)), cgoAllocsUnknown - __ret := C.APersistableBundle_isEqual(clhs, crhs) - runtime.KeepAlive(crhsAllocMap) - runtime.KeepAlive(clhsAllocMap) - __v := (bool)(__ret) - return __v -} - -func APersistableBundle_new() *APersistableBundle { - __ret := C.APersistableBundle_new() - __v := (*APersistableBundle)(unsafe.Pointer(__ret)) - return __v -} - -func APersistableBundle_putBoolean(pBundle *APersistableBundle, key string, val bool) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (C._Bool)(val), cgoAllocsUnknown - C.APersistableBundle_putBoolean(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putBooleanVector(pBundle *APersistableBundle, key string, vec *bool, num int32) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cvec, cvecAllocMap := (*C._Bool)(unsafe.Pointer(vec)), cgoAllocsUnknown - cnum, cnumAllocMap := (C.int)(num), cgoAllocsUnknown - C.APersistableBundle_putBooleanVector(cpBundle, ckey, cvec, cnum) - runtime.KeepAlive(cnumAllocMap) - runtime.KeepAlive(cvecAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putDouble(pBundle *APersistableBundle, key string, val float64) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (C.double)(val), cgoAllocsUnknown - C.APersistableBundle_putDouble(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putDoubleVector(pBundle *APersistableBundle, key string, vec *float64, num int32) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cvec, cvecAllocMap := (*C.double)(unsafe.Pointer(vec)), cgoAllocsUnknown - cnum, cnumAllocMap := (C.int)(num), cgoAllocsUnknown - C.APersistableBundle_putDoubleVector(cpBundle, ckey, cvec, cnum) - runtime.KeepAlive(cnumAllocMap) - runtime.KeepAlive(cvecAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putInt(pBundle *APersistableBundle, key string, val int32) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (C.int)(val), cgoAllocsUnknown - C.APersistableBundle_putInt(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putIntVector(pBundle *APersistableBundle, key string, vec *int32, num int32) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cvec, cvecAllocMap := (*C.int)(unsafe.Pointer(vec)), cgoAllocsUnknown - cnum, cnumAllocMap := (C.int)(num), cgoAllocsUnknown - C.APersistableBundle_putIntVector(cpBundle, ckey, cvec, cnum) - runtime.KeepAlive(cnumAllocMap) - runtime.KeepAlive(cvecAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putLong(pBundle *APersistableBundle, key string, val int64) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (C.int64_t)(val), cgoAllocsUnknown - C.APersistableBundle_putLong(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putLongVector(pBundle *APersistableBundle, key string, vec *int64, num int32) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cvec, cvecAllocMap := (*C.int64_t)(unsafe.Pointer(vec)), cgoAllocsUnknown - cnum, cnumAllocMap := (C.int)(num), cgoAllocsUnknown - C.APersistableBundle_putLongVector(cpBundle, ckey, cvec, cnum) - runtime.KeepAlive(cnumAllocMap) - runtime.KeepAlive(cvecAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putPersistableBundle(pBundle *APersistableBundle, key string, val *APersistableBundle) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := (*C.APersistableBundle)(unsafe.Pointer(val)), cgoAllocsUnknown - C.APersistableBundle_putPersistableBundle(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putString(pBundle *APersistableBundle, key string, val string) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cval, cvalAllocMap := UnpackPCharString(val) - C.APersistableBundle_putString(cpBundle, ckey, cval) - runtime.KeepAlive(cvalAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_putStringVector(pBundle *APersistableBundle, key string, vec **int8, num int32) { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - ckey, ckeyAllocMap := UnpackPCharString(key) - cvec, cvecAllocMap := (**C.char)(unsafe.Pointer(vec)), cgoAllocsUnknown - var pinnercvec runtime.Pinner - pinnercvec.Pin(vec) - if vec != nil { - pinnercvec.Pin(unsafe.Pointer(*vec)) - } - defer pinnercvec.Unpin() - cnum, cnumAllocMap := (C.int)(num), cgoAllocsUnknown - C.APersistableBundle_putStringVector(cpBundle, ckey, cvec, cnum) - runtime.KeepAlive(cnumAllocMap) - runtime.KeepAlive(cvecAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cpBundleAllocMap) -} - -func APersistableBundle_readFromParcel(parcel *AParcel, outPBundle **APersistableBundle) Binder_status_t { - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - coutPBundle, coutPBundleAllocMap := (**C.APersistableBundle)(unsafe.Pointer(outPBundle)), cgoAllocsUnknown - var pinnercoutPBundle runtime.Pinner - pinnercoutPBundle.Pin(outPBundle) - if outPBundle != nil { - pinnercoutPBundle.Pin(unsafe.Pointer(*outPBundle)) - } - defer pinnercoutPBundle.Unpin() - __ret := C.APersistableBundle_readFromParcel(cparcel, coutPBundle) - runtime.KeepAlive(coutPBundleAllocMap) - runtime.KeepAlive(cparcelAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} - -func APersistableBundle_size(pBundle *APersistableBundle) int32 { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - __ret := C.APersistableBundle_size(cpBundle) - runtime.KeepAlive(cpBundleAllocMap) - __v := (int32)(__ret) - return __v -} - -func APersistableBundle_writeToParcel(pBundle *APersistableBundle, parcel *AParcel) Binder_status_t { - cpBundle, cpBundleAllocMap := (*C.APersistableBundle)(unsafe.Pointer(pBundle)), cgoAllocsUnknown - cparcel, cparcelAllocMap := (*C.AParcel)(unsafe.Pointer(parcel)), cgoAllocsUnknown - __ret := C.APersistableBundle_writeToParcel(cpBundle, cparcel) - runtime.KeepAlive(cparcelAllocMap) - runtime.KeepAlive(cpBundleAllocMap) - __v := (Binder_status_t)(__ret) - return __v -} diff --git a/capi/persistablebundle/types.go b/capi/persistablebundle/types.go deleted file mode 100644 index 56e89cd..0000000 --- a/capi/persistablebundle/types.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package persistablebundle - -/* -#cgo LDFLAGS: -lbinder_ndk -#include "android/persistable_bundle.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type APersistableBundle C.APersistableBundle - -type AParcel C.AParcel - -type Binder_status_t C.binder_status_t - -type APersistableBundle_stringAllocator func(sizeBytes int32, context unsafe.Pointer) *int8 diff --git a/capi/sensor/cgo_helpers.c b/capi/sensor/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/sensor/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/sensor/cgo_helpers.go b/capi/sensor/cgo_helpers.go deleted file mode 100644 index 52f5197..0000000 --- a/capi/sensor/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sensor - -/* -#cgo LDFLAGS: -landroid -#include "android/sensor.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/sensor/cgo_helpers.h b/capi/sensor/cgo_helpers.h deleted file mode 100644 index 9b22c89..0000000 --- a/capi/sensor/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/sensor.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/sensor/const.go b/capi/sensor/const.go deleted file mode 100644 index 2ba2213..0000000 --- a/capi/sensor/const.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sensor - -const ( - AREPORTING_MODE_INVALID = -1 - AREPORTING_MODE_CONTINUOUS = 0 - AREPORTING_MODE_ON_CHANGE = 1 - AREPORTING_MODE_ONE_SHOT = 2 - AREPORTING_MODE_SPECIAL_TRIGGER = 3 -) - -const ( - ASENSOR_ADDITIONAL_INFO_BEGIN = 0 - ASENSOR_ADDITIONAL_INFO_END = 1 - ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY = 65536 - ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE = 65537 - ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION = 65538 - ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT = 65539 - ASENSOR_ADDITIONAL_INFO_SAMPLING = 65540 -) - -const ( - ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY = 1 - ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER = 2 -) - -const ( - ASENSOR_DIRECT_RATE_STOP = 0 - ASENSOR_DIRECT_RATE_NORMAL = 1 - ASENSOR_DIRECT_RATE_FAST = 2 - ASENSOR_DIRECT_RATE_VERY_FAST = 3 -) - -const ( - ASENSOR_STATUS_NO_CONTACT = -1 - ASENSOR_STATUS_UNRELIABLE = 0 - ASENSOR_STATUS_ACCURACY_LOW = 1 - ASENSOR_STATUS_ACCURACY_MEDIUM = 2 - ASENSOR_STATUS_ACCURACY_HIGH = 3 -) - -const ( - ASENSOR_TYPE_INVALID = -1 - ASENSOR_TYPE_ACCELEROMETER = 1 - ASENSOR_TYPE_MAGNETIC_FIELD = 2 - ASENSOR_TYPE_GYROSCOPE = 4 - ASENSOR_TYPE_LIGHT = 5 - ASENSOR_TYPE_PRESSURE = 6 - ASENSOR_TYPE_PROXIMITY = 8 - ASENSOR_TYPE_GRAVITY = 9 - ASENSOR_TYPE_LINEAR_ACCELERATION = 10 - ASENSOR_TYPE_ROTATION_VECTOR = 11 - ASENSOR_TYPE_RELATIVE_HUMIDITY = 12 - ASENSOR_TYPE_AMBIENT_TEMPERATURE = 13 - ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14 - ASENSOR_TYPE_GAME_ROTATION_VECTOR = 15 - ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 16 - ASENSOR_TYPE_SIGNIFICANT_MOTION = 17 - ASENSOR_TYPE_STEP_DETECTOR = 18 - ASENSOR_TYPE_STEP_COUNTER = 19 - ASENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 20 - ASENSOR_TYPE_HEART_RATE = 21 - ASENSOR_TYPE_POSE_6DOF = 28 - ASENSOR_TYPE_STATIONARY_DETECT = 29 - ASENSOR_TYPE_MOTION_DETECT = 30 - ASENSOR_TYPE_HEART_BEAT = 31 - ASENSOR_TYPE_DYNAMIC_SENSOR_META = 32 - ASENSOR_TYPE_ADDITIONAL_INFO = 33 - ASENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT = 34 - ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 35 - ASENSOR_TYPE_HINGE_ANGLE = 36 - ASENSOR_TYPE_HEAD_TRACKER = 37 - ASENSOR_TYPE_ACCELEROMETER_LIMITED_AXES = 38 - ASENSOR_TYPE_GYROSCOPE_LIMITED_AXES = 39 - ASENSOR_TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40 - ASENSOR_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41 - ASENSOR_TYPE_HEADING = 42 -) diff --git a/capi/sensor/doc.go b/capi/sensor/doc.go deleted file mode 100644 index 96cd9a0..0000000 --- a/capi/sensor/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android sensor -*/ -package sensor diff --git a/capi/sensor/sensor.go b/capi/sensor/sensor.go deleted file mode 100644 index f517b6c..0000000 --- a/capi/sensor/sensor.go +++ /dev/null @@ -1,328 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sensor - -/* -#cgo LDFLAGS: -landroid -#include "android/sensor.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ASensorEventQueue_disableSensor(queue *ASensorEventQueue, sensor *ASensor) int32 { - cqueue, cqueueAllocMap := (*C.ASensorEventQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensorEventQueue_disableSensor(cqueue, csensor) - runtime.KeepAlive(csensorAllocMap) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorEventQueue_enableSensor(queue *ASensorEventQueue, sensor *ASensor) int32 { - cqueue, cqueueAllocMap := (*C.ASensorEventQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensorEventQueue_enableSensor(cqueue, csensor) - runtime.KeepAlive(csensorAllocMap) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorEventQueue_getEvents(queue *ASensorEventQueue, events *ASensorEvent, count uint64) int64 { - cqueue, cqueueAllocMap := (*C.ASensorEventQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - cevents, ceventsAllocMap := (*C.ASensorEvent)(unsafe.Pointer(events)), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint64_t)(count), cgoAllocsUnknown - __ret := C.ASensorEventQueue_getEvents(cqueue, cevents, ccount) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(ceventsAllocMap) - runtime.KeepAlive(cqueueAllocMap) - __v := (int64)(__ret) - return __v -} - -func ASensorEventQueue_hasEvents(queue *ASensorEventQueue) int32 { - cqueue, cqueueAllocMap := (*C.ASensorEventQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - __ret := C.ASensorEventQueue_hasEvents(cqueue) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorEventQueue_registerSensor(queue *ASensorEventQueue, sensor *ASensor, samplingPeriodUs int32, maxBatchReportLatencyUs int64) int32 { - cqueue, cqueueAllocMap := (*C.ASensorEventQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - csamplingPeriodUs, csamplingPeriodUsAllocMap := (C.int)(samplingPeriodUs), cgoAllocsUnknown - cmaxBatchReportLatencyUs, cmaxBatchReportLatencyUsAllocMap := (C.int64_t)(maxBatchReportLatencyUs), cgoAllocsUnknown - __ret := C.ASensorEventQueue_registerSensor(cqueue, csensor, csamplingPeriodUs, cmaxBatchReportLatencyUs) - runtime.KeepAlive(cmaxBatchReportLatencyUsAllocMap) - runtime.KeepAlive(csamplingPeriodUsAllocMap) - runtime.KeepAlive(csensorAllocMap) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorEventQueue_requestAdditionalInfoEvents(queue *ASensorEventQueue, enable bool) int32 { - cqueue, cqueueAllocMap := (*C.ASensorEventQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - cenable, cenableAllocMap := (C._Bool)(enable), cgoAllocsUnknown - __ret := C.ASensorEventQueue_requestAdditionalInfoEvents(cqueue, cenable) - runtime.KeepAlive(cenableAllocMap) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorEventQueue_setEventRate(queue *ASensorEventQueue, sensor *ASensor, usec int32) int32 { - cqueue, cqueueAllocMap := (*C.ASensorEventQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - cusec, cusecAllocMap := (C.int)(usec), cgoAllocsUnknown - __ret := C.ASensorEventQueue_setEventRate(cqueue, csensor, cusec) - runtime.KeepAlive(cusecAllocMap) - runtime.KeepAlive(csensorAllocMap) - runtime.KeepAlive(cqueueAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorManager_configureDirectReport(manager *ASensorManager, sensor *ASensor, channelId int32, rate int32) int32 { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - cchannelId, cchannelIdAllocMap := (C.int)(channelId), cgoAllocsUnknown - crate, crateAllocMap := (C.int)(rate), cgoAllocsUnknown - __ret := C.ASensorManager_configureDirectReport(cmanager, csensor, cchannelId, crate) - runtime.KeepAlive(crateAllocMap) - runtime.KeepAlive(cchannelIdAllocMap) - runtime.KeepAlive(csensorAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorManager_createEventQueue(manager *ASensorManager, looper *ALooper, ident int32, callback ALooper_callbackFunc, data unsafe.Pointer) *ASensorEventQueue { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - clooper, clooperAllocMap := (*C.ALooper)(unsafe.Pointer(looper)), cgoAllocsUnknown - cident, cidentAllocMap := (C.int)(ident), cgoAllocsUnknown - ccallback, ccallbackAllocMap := (C.ALooper_callbackFunc)(callback), cgoAllocsUnknown - cdata, cdataAllocMap := data, cgoAllocsUnknown - __ret := C.ASensorManager_createEventQueue(cmanager, clooper, cident, ccallback, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cidentAllocMap) - runtime.KeepAlive(clooperAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (*ASensorEventQueue)(unsafe.Pointer(__ret)) - return __v -} - -func ASensorManager_createHardwareBufferDirectChannel(manager *ASensorManager, buffer *AHardwareBuffer, size uint64) int32 { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - __ret := C.ASensorManager_createHardwareBufferDirectChannel(cmanager, cbuffer, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorManager_createSharedMemoryDirectChannel(manager *ASensorManager, fd int32, size uint64) int32 { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - __ret := C.ASensorManager_createSharedMemoryDirectChannel(cmanager, cfd, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cfdAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorManager_destroyDirectChannel(manager *ASensorManager, channelId int32) { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - cchannelId, cchannelIdAllocMap := (C.int)(channelId), cgoAllocsUnknown - C.ASensorManager_destroyDirectChannel(cmanager, cchannelId) - runtime.KeepAlive(cchannelIdAllocMap) - runtime.KeepAlive(cmanagerAllocMap) -} - -func ASensorManager_destroyEventQueue(manager *ASensorManager, queue *ASensorEventQueue) int32 { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - cqueue, cqueueAllocMap := (*C.ASensorEventQueue)(unsafe.Pointer(queue)), cgoAllocsUnknown - __ret := C.ASensorManager_destroyEventQueue(cmanager, cqueue) - runtime.KeepAlive(cqueueAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensorManager_getDefaultSensor(manager *ASensorManager, _type int32) *ASensor { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.int)(_type), cgoAllocsUnknown - __ret := C.ASensorManager_getDefaultSensor(cmanager, c_type) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (*ASensor)(unsafe.Pointer(__ret)) - return __v -} - -func ASensorManager_getDefaultSensorEx(manager *ASensorManager, _type int32, wakeUp bool) *ASensor { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - c_type, c_typeAllocMap := (C.int)(_type), cgoAllocsUnknown - cwakeUp, cwakeUpAllocMap := (C._Bool)(wakeUp), cgoAllocsUnknown - __ret := C.ASensorManager_getDefaultSensorEx(cmanager, c_type, cwakeUp) - runtime.KeepAlive(cwakeUpAllocMap) - runtime.KeepAlive(c_typeAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (*ASensor)(unsafe.Pointer(__ret)) - return __v -} - -func ASensorManager_getDynamicSensorList(manager *ASensorManager, list *ASensorList) int64 { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - clist, clistAllocMap := (*C.ASensorList)(unsafe.Pointer(list)), cgoAllocsUnknown - __ret := C.ASensorManager_getDynamicSensorList(cmanager, clist) - runtime.KeepAlive(clistAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int64)(__ret) - return __v -} - -func ASensorManager_getInstance() *ASensorManager { - __ret := C.ASensorManager_getInstance() - __v := (*ASensorManager)(unsafe.Pointer(__ret)) - return __v -} - -func ASensorManager_getInstanceForPackage(packageName string) *ASensorManager { - cpackageName, cpackageNameAllocMap := UnpackPCharString(packageName) - __ret := C.ASensorManager_getInstanceForPackage(cpackageName) - runtime.KeepAlive(cpackageNameAllocMap) - __v := (*ASensorManager)(unsafe.Pointer(__ret)) - return __v -} - -func ASensorManager_getSensorList(manager *ASensorManager, list *ASensorList) int32 { - cmanager, cmanagerAllocMap := (*C.ASensorManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - clist, clistAllocMap := (*C.ASensorList)(unsafe.Pointer(list)), cgoAllocsUnknown - __ret := C.ASensorManager_getSensorList(cmanager, clist) - runtime.KeepAlive(clistAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensor_getFifoMaxEventCount(sensor *ASensor) int32 { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getFifoMaxEventCount(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensor_getFifoReservedEventCount(sensor *ASensor) int32 { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getFifoReservedEventCount(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensor_getHandle(sensor *ASensor) int32 { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getHandle(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensor_getHighestDirectReportRateLevel(sensor *ASensor) int32 { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getHighestDirectReportRateLevel(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensor_getMinDelay(sensor *ASensor) int32 { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getMinDelay(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensor_getName(sensor *ASensor) string { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getName(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := C.GoString(__ret) - return __v -} - -func ASensor_getReportingMode(sensor *ASensor) int32 { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getReportingMode(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensor_getResolution(sensor *ASensor) float32 { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getResolution(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (float32)(__ret) - return __v -} - -func ASensor_getStringType(sensor *ASensor) string { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getStringType(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := C.GoString(__ret) - return __v -} - -func ASensor_getType(sensor *ASensor) int32 { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getType(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASensor_getVendor(sensor *ASensor) string { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_getVendor(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := C.GoString(__ret) - return __v -} - -func ASensor_isDirectChannelTypeSupported(sensor *ASensor, channelType int32) bool { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - cchannelType, cchannelTypeAllocMap := (C.int)(channelType), cgoAllocsUnknown - __ret := C.ASensor_isDirectChannelTypeSupported(csensor, cchannelType) - runtime.KeepAlive(cchannelTypeAllocMap) - runtime.KeepAlive(csensorAllocMap) - __v := (bool)(__ret) - return __v -} - -func ASensor_isWakeUpSensor(sensor *ASensor) bool { - csensor, csensorAllocMap := (*C.ASensor)(unsafe.Pointer(sensor)), cgoAllocsUnknown - __ret := C.ASensor_isWakeUpSensor(csensor) - runtime.KeepAlive(csensorAllocMap) - __v := (bool)(__ret) - return __v -} diff --git a/capi/sensor/types.go b/capi/sensor/types.go deleted file mode 100644 index fed8928..0000000 --- a/capi/sensor/types.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sensor - -/* -#cgo LDFLAGS: -landroid -#include "android/sensor.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type AAdditionalInfoEvent C.AAdditionalInfoEvent - -type ADynamicSensorEvent C.ADynamicSensorEvent - -type AHardwareBuffer C.AHardwareBuffer - -type AHeadTrackerEvent C.AHeadTrackerEvent - -type AHeadingEvent C.AHeadingEvent - -type AHeartRateEvent C.AHeartRateEvent - -type ALimitedAxesImuEvent C.ALimitedAxesImuEvent - -type ALimitedAxesImuUncalibratedEvent C.ALimitedAxesImuUncalibratedEvent - -type AMetaDataEvent C.AMetaDataEvent - -type ASensor C.ASensor - -type ASensorEvent C.ASensorEvent - -type ASensorEventQueue C.ASensorEventQueue - -type ASensorList C.ASensorList - -type ASensorManager C.ASensorManager - -type ASensorRef C.ASensorRef - -type ASensorVector C.ASensorVector - -type AUncalibratedEvent C.AUncalibratedEvent - -type ALooper C.ALooper - -type ALooper_callbackFunc C.ALooper_callbackFunc diff --git a/capi/sharedmem/cgo_helpers.c b/capi/sharedmem/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/sharedmem/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/sharedmem/cgo_helpers.go b/capi/sharedmem/cgo_helpers.go deleted file mode 100644 index d4f0746..0000000 --- a/capi/sharedmem/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sharedmem - -/* -#cgo LDFLAGS: -landroid -#include "android/sharedmem.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/sharedmem/cgo_helpers.h b/capi/sharedmem/cgo_helpers.h deleted file mode 100644 index 4b9905f..0000000 --- a/capi/sharedmem/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/sharedmem.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/sharedmem/const.go b/capi/sharedmem/const.go deleted file mode 100644 index 4e520e4..0000000 --- a/capi/sharedmem/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sharedmem diff --git a/capi/sharedmem/doc.go b/capi/sharedmem/doc.go deleted file mode 100644 index 3a4ecf3..0000000 --- a/capi/sharedmem/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Shared Memory -*/ -package sharedmem diff --git a/capi/sharedmem/sharedmem.go b/capi/sharedmem/sharedmem.go deleted file mode 100644 index ef5b10c..0000000 --- a/capi/sharedmem/sharedmem.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sharedmem - -/* -#cgo LDFLAGS: -landroid -#include "android/sharedmem.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ASharedMemory_create(name string, size uint64) int32 { - cname, cnameAllocMap := UnpackPCharString(name) - csize, csizeAllocMap := (C.uint64_t)(size), cgoAllocsUnknown - __ret := C.ASharedMemory_create(cname, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(cnameAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASharedMemory_getSize(fd int32) uint64 { - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - __ret := C.ASharedMemory_getSize(cfd) - runtime.KeepAlive(cfdAllocMap) - __v := (uint64)(__ret) - return __v -} - -func ASharedMemory_setProt(fd int32, prot int32) int32 { - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - cprot, cprotAllocMap := (C.int)(prot), cgoAllocsUnknown - __ret := C.ASharedMemory_setProt(cfd, cprot) - runtime.KeepAlive(cprotAllocMap) - runtime.KeepAlive(cfdAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/sharedmem/types.go b/capi/sharedmem/types.go deleted file mode 100644 index 44d7e49..0000000 --- a/capi/sharedmem/types.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sharedmem - -/* -#cgo LDFLAGS: -landroid -#include "android/sharedmem.h" -#include -#include "cgo_helpers.h" -*/ -import "C" diff --git a/capi/storage/cgo_helpers.c b/capi/storage/cgo_helpers.c deleted file mode 100644 index 8bf39ed..0000000 --- a/capi/storage/cgo_helpers.c +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void AStorageManager_obbCallbackFunc_a6785822(const char* filename, const int32_t state, void* data) { - AStorageManager_obbCallbackFuncA6785822((char*)filename, state, data); -} - diff --git a/capi/storage/cgo_helpers.go b/capi/storage/cgo_helpers.go deleted file mode 100644 index 453909c..0000000 --- a/capi/storage/cgo_helpers.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package storage - -/* -#cgo LDFLAGS: -landroid -#include "android/storage_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x AStorageManager_obbCallbackFunc) PassRef() (ref *C.AStorageManager_obbCallbackFunc, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aStorageManager_obbCallbackFuncA6785822Func == nil { - aStorageManager_obbCallbackFuncA6785822Func = x - } - return (*C.AStorageManager_obbCallbackFunc)(C.AStorageManager_obbCallbackFunc_a6785822), nil -} - -func (x AStorageManager_obbCallbackFunc) PassValue() (ref C.AStorageManager_obbCallbackFunc, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aStorageManager_obbCallbackFuncA6785822Func == nil { - aStorageManager_obbCallbackFuncA6785822Func = x - } - return (C.AStorageManager_obbCallbackFunc)(C.AStorageManager_obbCallbackFunc_a6785822), nil -} - -func NewAStorageManager_obbCallbackFuncRef(ref unsafe.Pointer) *AStorageManager_obbCallbackFunc { - return (*AStorageManager_obbCallbackFunc)(ref) -} - -//export AStorageManager_obbCallbackFuncA6785822 -func AStorageManager_obbCallbackFuncA6785822(cfilename *C.char, cstate C.int32_t, cdata unsafe.Pointer) { - if aStorageManager_obbCallbackFuncA6785822Func != nil { - filenamea6785822 := C.GoString(cfilename) - statea6785822 := (int32)(cstate) - dataa6785822 := (unsafe.Pointer)(unsafe.Pointer(cdata)) - aStorageManager_obbCallbackFuncA6785822Func(filenamea6785822, statea6785822, dataa6785822) - return - } - panic("callback func has not been set (race?)") -} - -var aStorageManager_obbCallbackFuncA6785822Func AStorageManager_obbCallbackFunc - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/storage/cgo_helpers.h b/capi/storage/cgo_helpers.h deleted file mode 100644 index 8d949d0..0000000 --- a/capi/storage/cgo_helpers.h +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/storage_manager.h" -#include -#pragma once - -#define __CGOGEN 1 - -// AStorageManager_obbCallbackFunc_a6785822 is a proxy for callback AStorageManager_obbCallbackFunc. -void AStorageManager_obbCallbackFunc_a6785822(const char* filename, const int32_t state, void* data); - diff --git a/capi/storage/const.go b/capi/storage/const.go deleted file mode 100644 index 7c7650b..0000000 --- a/capi/storage/const.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package storage - -const ( - AOBB_STATE_MOUNTED = 1 - AOBB_STATE_UNMOUNTED = 2 - AOBB_STATE_ERROR_INTERNAL = 20 - AOBB_STATE_ERROR_COULD_NOT_MOUNT = 21 - AOBB_STATE_ERROR_COULD_NOT_UNMOUNT = 22 - AOBB_STATE_ERROR_NOT_MOUNTED = 23 - AOBB_STATE_ERROR_ALREADY_MOUNTED = 24 - AOBB_STATE_ERROR_PERMISSION_DENIED = 25 -) diff --git a/capi/storage/doc.go b/capi/storage/doc.go deleted file mode 100644 index efb0770..0000000 --- a/capi/storage/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Storage Manager -*/ -package storage diff --git a/capi/storage/storage.go b/capi/storage/storage.go deleted file mode 100644 index b703276..0000000 --- a/capi/storage/storage.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package storage - -/* -#cgo LDFLAGS: -landroid -#include "android/storage_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AStorageManager_delete(mgr *AStorageManager) { - cmgr, cmgrAllocMap := (*C.AStorageManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - C.AStorageManager_delete(cmgr) - runtime.KeepAlive(cmgrAllocMap) -} - -func AStorageManager_getMountedObbPath(mgr *AStorageManager, filename string) string { - cmgr, cmgrAllocMap := (*C.AStorageManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - cfilename, cfilenameAllocMap := UnpackPCharString(filename) - __ret := C.AStorageManager_getMountedObbPath(cmgr, cfilename) - runtime.KeepAlive(cfilenameAllocMap) - runtime.KeepAlive(cmgrAllocMap) - __v := C.GoString(__ret) - return __v -} - -func AStorageManager_isObbMounted(mgr *AStorageManager, filename string) int32 { - cmgr, cmgrAllocMap := (*C.AStorageManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - cfilename, cfilenameAllocMap := UnpackPCharString(filename) - __ret := C.AStorageManager_isObbMounted(cmgr, cfilename) - runtime.KeepAlive(cfilenameAllocMap) - runtime.KeepAlive(cmgrAllocMap) - __v := (int32)(__ret) - return __v -} - -func AStorageManager_mountObb(mgr *AStorageManager, filename string, key string, cb AStorageManager_obbCallbackFunc, data unsafe.Pointer) { - cmgr, cmgrAllocMap := (*C.AStorageManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - cfilename, cfilenameAllocMap := UnpackPCharString(filename) - ckey, ckeyAllocMap := UnpackPCharString(key) - ccb, ccbAllocMap := cb.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.AStorageManager_mountObb(cmgr, cfilename, ckey, ccb, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccbAllocMap) - runtime.KeepAlive(ckeyAllocMap) - runtime.KeepAlive(cfilenameAllocMap) - runtime.KeepAlive(cmgrAllocMap) -} - -func AStorageManager_new() *AStorageManager { - __ret := C.AStorageManager_new() - __v := (*AStorageManager)(unsafe.Pointer(__ret)) - return __v -} - -func AStorageManager_unmountObb(mgr *AStorageManager, filename string, force int32, cb AStorageManager_obbCallbackFunc, data unsafe.Pointer) { - cmgr, cmgrAllocMap := (*C.AStorageManager)(unsafe.Pointer(mgr)), cgoAllocsUnknown - cfilename, cfilenameAllocMap := UnpackPCharString(filename) - cforce, cforceAllocMap := (C.int)(force), cgoAllocsUnknown - ccb, ccbAllocMap := cb.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - C.AStorageManager_unmountObb(cmgr, cfilename, cforce, ccb, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccbAllocMap) - runtime.KeepAlive(cforceAllocMap) - runtime.KeepAlive(cfilenameAllocMap) - runtime.KeepAlive(cmgrAllocMap) -} diff --git a/capi/storage/types.go b/capi/storage/types.go deleted file mode 100644 index a7a8097..0000000 --- a/capi/storage/types.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package storage - -/* -#cgo LDFLAGS: -landroid -#include "android/storage_manager.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type AStorageManager C.AStorageManager - -type AStorageManager_obbCallbackFunc func(filename string, state int32, data unsafe.Pointer) diff --git a/capi/surfacecontrol/cgo_helpers.c b/capi/surfacecontrol/cgo_helpers.c deleted file mode 100644 index fff67c9..0000000 --- a/capi/surfacecontrol/cgo_helpers.c +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void ASurfaceTransaction_OnBufferRelease_1afde85d(void* context, int release_fence_fd) { - ASurfaceTransaction_OnBufferRelease1AFDE85D(context, release_fence_fd); -} - -void ASurfaceTransaction_OnCommit_76a98bc6(void* context, ASurfaceTransactionStats* stats) { - ASurfaceTransaction_OnCommit76A98BC6(context, stats); -} - -void ASurfaceTransaction_OnComplete_695b4546(void* context, ASurfaceTransactionStats* stats) { - ASurfaceTransaction_OnComplete695B4546(context, stats); -} - diff --git a/capi/surfacecontrol/cgo_helpers.go b/capi/surfacecontrol/cgo_helpers.go deleted file mode 100644 index af67378..0000000 --- a/capi/surfacecontrol/cgo_helpers.go +++ /dev/null @@ -1,196 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package surfacecontrol - -/* -#cgo LDFLAGS: -landroid -#include "android/surface_control.h" -#include "android/hdr_metadata.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x ASurfaceTransaction_OnBufferRelease) PassRef() (ref *C.ASurfaceTransaction_OnBufferRelease, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aSurfaceTransaction_OnBufferRelease1AFDE85DFunc == nil { - aSurfaceTransaction_OnBufferRelease1AFDE85DFunc = x - } - return (*C.ASurfaceTransaction_OnBufferRelease)(C.ASurfaceTransaction_OnBufferRelease_1afde85d), nil -} - -func (x ASurfaceTransaction_OnBufferRelease) PassValue() (ref C.ASurfaceTransaction_OnBufferRelease, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aSurfaceTransaction_OnBufferRelease1AFDE85DFunc == nil { - aSurfaceTransaction_OnBufferRelease1AFDE85DFunc = x - } - return (C.ASurfaceTransaction_OnBufferRelease)(C.ASurfaceTransaction_OnBufferRelease_1afde85d), nil -} - -func NewASurfaceTransaction_OnBufferReleaseRef(ref unsafe.Pointer) *ASurfaceTransaction_OnBufferRelease { - return (*ASurfaceTransaction_OnBufferRelease)(ref) -} - -//export ASurfaceTransaction_OnBufferRelease1AFDE85D -func ASurfaceTransaction_OnBufferRelease1AFDE85D(ccontext unsafe.Pointer, crelease_fence_fd C.int) { - if aSurfaceTransaction_OnBufferRelease1AFDE85DFunc != nil { - context1afde85d := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - release_fence_fd1afde85d := (int32)(crelease_fence_fd) - aSurfaceTransaction_OnBufferRelease1AFDE85DFunc(context1afde85d, release_fence_fd1afde85d) - return - } - panic("callback func has not been set (race?)") -} - -var aSurfaceTransaction_OnBufferRelease1AFDE85DFunc ASurfaceTransaction_OnBufferRelease - -func (x ASurfaceTransaction_OnCommit) PassRef() (ref *C.ASurfaceTransaction_OnCommit, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aSurfaceTransaction_OnCommit76A98BC6Func == nil { - aSurfaceTransaction_OnCommit76A98BC6Func = x - } - return (*C.ASurfaceTransaction_OnCommit)(C.ASurfaceTransaction_OnCommit_76a98bc6), nil -} - -func (x ASurfaceTransaction_OnCommit) PassValue() (ref C.ASurfaceTransaction_OnCommit, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aSurfaceTransaction_OnCommit76A98BC6Func == nil { - aSurfaceTransaction_OnCommit76A98BC6Func = x - } - return (C.ASurfaceTransaction_OnCommit)(C.ASurfaceTransaction_OnCommit_76a98bc6), nil -} - -func NewASurfaceTransaction_OnCommitRef(ref unsafe.Pointer) *ASurfaceTransaction_OnCommit { - return (*ASurfaceTransaction_OnCommit)(ref) -} - -//export ASurfaceTransaction_OnCommit76A98BC6 -func ASurfaceTransaction_OnCommit76A98BC6(ccontext unsafe.Pointer, cstats *C.ASurfaceTransactionStats) { - if aSurfaceTransaction_OnCommit76A98BC6Func != nil { - context76a98bc6 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - stats76a98bc6 := (*ASurfaceTransactionStats)(unsafe.Pointer(cstats)) - aSurfaceTransaction_OnCommit76A98BC6Func(context76a98bc6, stats76a98bc6) - return - } - panic("callback func has not been set (race?)") -} - -var aSurfaceTransaction_OnCommit76A98BC6Func ASurfaceTransaction_OnCommit - -func (x ASurfaceTransaction_OnComplete) PassRef() (ref *C.ASurfaceTransaction_OnComplete, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aSurfaceTransaction_OnComplete695B4546Func == nil { - aSurfaceTransaction_OnComplete695B4546Func = x - } - return (*C.ASurfaceTransaction_OnComplete)(C.ASurfaceTransaction_OnComplete_695b4546), nil -} - -func (x ASurfaceTransaction_OnComplete) PassValue() (ref C.ASurfaceTransaction_OnComplete, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aSurfaceTransaction_OnComplete695B4546Func == nil { - aSurfaceTransaction_OnComplete695B4546Func = x - } - return (C.ASurfaceTransaction_OnComplete)(C.ASurfaceTransaction_OnComplete_695b4546), nil -} - -func NewASurfaceTransaction_OnCompleteRef(ref unsafe.Pointer) *ASurfaceTransaction_OnComplete { - return (*ASurfaceTransaction_OnComplete)(ref) -} - -//export ASurfaceTransaction_OnComplete695B4546 -func ASurfaceTransaction_OnComplete695B4546(ccontext unsafe.Pointer, cstats *C.ASurfaceTransactionStats) { - if aSurfaceTransaction_OnComplete695B4546Func != nil { - context695b4546 := (unsafe.Pointer)(unsafe.Pointer(ccontext)) - stats695b4546 := (*ASurfaceTransactionStats)(unsafe.Pointer(cstats)) - aSurfaceTransaction_OnComplete695B4546Func(context695b4546, stats695b4546) - return - } - panic("callback func has not been set (race?)") -} - -var aSurfaceTransaction_OnComplete695B4546Func ASurfaceTransaction_OnComplete - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/surfacecontrol/cgo_helpers.h b/capi/surfacecontrol/cgo_helpers.h deleted file mode 100644 index b9ab158..0000000 --- a/capi/surfacecontrol/cgo_helpers.h +++ /dev/null @@ -1,18 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/surface_control.h" -#include "android/hdr_metadata.h" -#include -#pragma once - -#define __CGOGEN 1 - -// ASurfaceTransaction_OnBufferRelease_1afde85d is a proxy for callback ASurfaceTransaction_OnBufferRelease. -void ASurfaceTransaction_OnBufferRelease_1afde85d(void* context, int release_fence_fd); - -// ASurfaceTransaction_OnCommit_76a98bc6 is a proxy for callback ASurfaceTransaction_OnCommit. -void ASurfaceTransaction_OnCommit_76a98bc6(void* context, ASurfaceTransactionStats* stats); - -// ASurfaceTransaction_OnComplete_695b4546 is a proxy for callback ASurfaceTransaction_OnComplete. -void ASurfaceTransaction_OnComplete_695b4546(void* context, ASurfaceTransactionStats* stats); - diff --git a/capi/surfacecontrol/const.go b/capi/surfacecontrol/const.go deleted file mode 100644 index ae7e728..0000000 --- a/capi/surfacecontrol/const.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package surfacecontrol - -const ( - HDR10_SMPTE2086 = 1 - HDR10_CTA861_3 = 2 - HDR10PLUS_SEI = 3 -) - -const ( - ASURFACE_TRANSACTION_TRANSPARENCY_TRANSPARENT = 0 - ASURFACE_TRANSACTION_TRANSPARENCY_TRANSLUCENT = 1 - ASURFACE_TRANSACTION_TRANSPARENCY_OPAQUE = 2 -) - -const ( - ASURFACE_TRANSACTION_VISIBILITY_HIDE = 0 - ASURFACE_TRANSACTION_VISIBILITY_SHOW = 1 -) diff --git a/capi/surfacecontrol/doc.go b/capi/surfacecontrol/doc.go deleted file mode 100644 index 45a1ce6..0000000 --- a/capi/surfacecontrol/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android SurfaceControl -*/ -package surfacecontrol diff --git a/capi/surfacecontrol/surfacecontrol.go b/capi/surfacecontrol/surfacecontrol.go deleted file mode 100644 index 438be06..0000000 --- a/capi/surfacecontrol/surfacecontrol.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package surfacecontrol - -/* -#cgo LDFLAGS: -landroid -#include "android/surface_control.h" -#include "android/hdr_metadata.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ASurfaceControl_acquire(surface_control *ASurfaceControl) { - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - C.ASurfaceControl_acquire(csurface_control) - runtime.KeepAlive(csurface_controlAllocMap) -} - -func ASurfaceControl_create(parent *ASurfaceControl, debug_name string) *ASurfaceControl { - cparent, cparentAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(parent)), cgoAllocsUnknown - cdebug_name, cdebug_nameAllocMap := UnpackPCharString(debug_name) - __ret := C.ASurfaceControl_create(cparent, cdebug_name) - runtime.KeepAlive(cdebug_nameAllocMap) - runtime.KeepAlive(cparentAllocMap) - __v := (*ASurfaceControl)(unsafe.Pointer(__ret)) - return __v -} - -func ASurfaceControl_createFromWindow(parent *ANativeWindow, debug_name string) *ASurfaceControl { - cparent, cparentAllocMap := (*C.ANativeWindow)(unsafe.Pointer(parent)), cgoAllocsUnknown - cdebug_name, cdebug_nameAllocMap := UnpackPCharString(debug_name) - __ret := C.ASurfaceControl_createFromWindow(cparent, cdebug_name) - runtime.KeepAlive(cdebug_nameAllocMap) - runtime.KeepAlive(cparentAllocMap) - __v := (*ASurfaceControl)(unsafe.Pointer(__ret)) - return __v -} - -func ASurfaceControl_release(surface_control *ASurfaceControl) { - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - C.ASurfaceControl_release(csurface_control) - runtime.KeepAlive(csurface_controlAllocMap) -} - -func ASurfaceTransactionStats_getAcquireTime(surface_transaction_stats *ASurfaceTransactionStats, surface_control *ASurfaceControl) int64 { - csurface_transaction_stats, csurface_transaction_statsAllocMap := (*C.ASurfaceTransactionStats)(unsafe.Pointer(surface_transaction_stats)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - __ret := C.ASurfaceTransactionStats_getAcquireTime(csurface_transaction_stats, csurface_control) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(csurface_transaction_statsAllocMap) - __v := (int64)(__ret) - return __v -} - -func ASurfaceTransactionStats_getLatchTime(surface_transaction_stats *ASurfaceTransactionStats) int64 { - csurface_transaction_stats, csurface_transaction_statsAllocMap := (*C.ASurfaceTransactionStats)(unsafe.Pointer(surface_transaction_stats)), cgoAllocsUnknown - __ret := C.ASurfaceTransactionStats_getLatchTime(csurface_transaction_stats) - runtime.KeepAlive(csurface_transaction_statsAllocMap) - __v := (int64)(__ret) - return __v -} - -func ASurfaceTransactionStats_getPresentFenceFd(surface_transaction_stats *ASurfaceTransactionStats) int32 { - csurface_transaction_stats, csurface_transaction_statsAllocMap := (*C.ASurfaceTransactionStats)(unsafe.Pointer(surface_transaction_stats)), cgoAllocsUnknown - __ret := C.ASurfaceTransactionStats_getPresentFenceFd(csurface_transaction_stats) - runtime.KeepAlive(csurface_transaction_statsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASurfaceTransactionStats_getPreviousReleaseFenceFd(surface_transaction_stats *ASurfaceTransactionStats, surface_control *ASurfaceControl) int32 { - csurface_transaction_stats, csurface_transaction_statsAllocMap := (*C.ASurfaceTransactionStats)(unsafe.Pointer(surface_transaction_stats)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - __ret := C.ASurfaceTransactionStats_getPreviousReleaseFenceFd(csurface_transaction_stats, csurface_control) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(csurface_transaction_statsAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASurfaceTransaction_apply(transaction *ASurfaceTransaction) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - C.ASurfaceTransaction_apply(ctransaction) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_clearFrameRate(transaction *ASurfaceTransaction, surface_control *ASurfaceControl) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - C.ASurfaceTransaction_clearFrameRate(ctransaction, csurface_control) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_create() *ASurfaceTransaction { - __ret := C.ASurfaceTransaction_create() - __v := (*ASurfaceTransaction)(unsafe.Pointer(__ret)) - return __v -} - -func ASurfaceTransaction_delete(transaction *ASurfaceTransaction) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - C.ASurfaceTransaction_delete(ctransaction) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_reparent(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, new_parent *ASurfaceControl) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cnew_parent, cnew_parentAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(new_parent)), cgoAllocsUnknown - C.ASurfaceTransaction_reparent(ctransaction, csurface_control, cnew_parent) - runtime.KeepAlive(cnew_parentAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setBuffer(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, buffer *AHardwareBuffer, acquire_fence_fd int32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cbuffer, cbufferAllocMap := (*C.AHardwareBuffer)(unsafe.Pointer(buffer)), cgoAllocsUnknown - cacquire_fence_fd, cacquire_fence_fdAllocMap := (C.int)(acquire_fence_fd), cgoAllocsUnknown - C.ASurfaceTransaction_setBuffer(ctransaction, csurface_control, cbuffer, cacquire_fence_fd) - runtime.KeepAlive(cacquire_fence_fdAllocMap) - runtime.KeepAlive(cbufferAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setBufferAlpha(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, alpha float32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - calpha, calphaAllocMap := (C.float)(alpha), cgoAllocsUnknown - C.ASurfaceTransaction_setBufferAlpha(ctransaction, csurface_control, calpha) - runtime.KeepAlive(calphaAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setBufferTransform(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, transform int32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - ctransform, ctransformAllocMap := (C.int)(transform), cgoAllocsUnknown - C.ASurfaceTransaction_setBufferTransform(ctransaction, csurface_control, ctransform) - runtime.KeepAlive(ctransformAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setCrop(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, crop *ARect) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - ccrop, ccropAllocMap := (*C.ARect)(unsafe.Pointer(crop)), cgoAllocsUnknown - C.ASurfaceTransaction_setCrop(ctransaction, csurface_control, ccrop) - runtime.KeepAlive(ccropAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setDamageRegion(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, rects *ARect, count uint32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - crects, crectsAllocMap := (*C.ARect)(unsafe.Pointer(rects)), cgoAllocsUnknown - ccount, ccountAllocMap := (C.uint)(count), cgoAllocsUnknown - C.ASurfaceTransaction_setDamageRegion(ctransaction, csurface_control, crects, ccount) - runtime.KeepAlive(ccountAllocMap) - runtime.KeepAlive(crectsAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setDesiredHdrHeadroom(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, desiredHeadroom float32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cdesiredHeadroom, cdesiredHeadroomAllocMap := (C.float)(desiredHeadroom), cgoAllocsUnknown - C.ASurfaceTransaction_setDesiredHdrHeadroom(ctransaction, csurface_control, cdesiredHeadroom) - runtime.KeepAlive(cdesiredHeadroomAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setDesiredPresentTime(transaction *ASurfaceTransaction, desiredPresentTime int64) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - cdesiredPresentTime, cdesiredPresentTimeAllocMap := (C.int64_t)(desiredPresentTime), cgoAllocsUnknown - C.ASurfaceTransaction_setDesiredPresentTime(ctransaction, cdesiredPresentTime) - runtime.KeepAlive(cdesiredPresentTimeAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setEnableBackPressure(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, enableBackPressure bool) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cenableBackPressure, cenableBackPressureAllocMap := (C._Bool)(enableBackPressure), cgoAllocsUnknown - C.ASurfaceTransaction_setEnableBackPressure(ctransaction, csurface_control, cenableBackPressure) - runtime.KeepAlive(cenableBackPressureAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setExtendedRangeBrightness(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, currentBufferRatio float32, desiredRatio float32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - ccurrentBufferRatio, ccurrentBufferRatioAllocMap := (C.float)(currentBufferRatio), cgoAllocsUnknown - cdesiredRatio, cdesiredRatioAllocMap := (C.float)(desiredRatio), cgoAllocsUnknown - C.ASurfaceTransaction_setExtendedRangeBrightness(ctransaction, csurface_control, ccurrentBufferRatio, cdesiredRatio) - runtime.KeepAlive(cdesiredRatioAllocMap) - runtime.KeepAlive(ccurrentBufferRatioAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setFrameRate(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, frameRate float32, compatibility int8) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cframeRate, cframeRateAllocMap := (C.float)(frameRate), cgoAllocsUnknown - ccompatibility, ccompatibilityAllocMap := (C.int8_t)(compatibility), cgoAllocsUnknown - C.ASurfaceTransaction_setFrameRate(ctransaction, csurface_control, cframeRate, ccompatibility) - runtime.KeepAlive(ccompatibilityAllocMap) - runtime.KeepAlive(cframeRateAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setFrameRateWithChangeStrategy(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, frameRate float32, compatibility int8, changeFrameRateStrategy int8) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cframeRate, cframeRateAllocMap := (C.float)(frameRate), cgoAllocsUnknown - ccompatibility, ccompatibilityAllocMap := (C.int8_t)(compatibility), cgoAllocsUnknown - cchangeFrameRateStrategy, cchangeFrameRateStrategyAllocMap := (C.int8_t)(changeFrameRateStrategy), cgoAllocsUnknown - C.ASurfaceTransaction_setFrameRateWithChangeStrategy(ctransaction, csurface_control, cframeRate, ccompatibility, cchangeFrameRateStrategy) - runtime.KeepAlive(cchangeFrameRateStrategyAllocMap) - runtime.KeepAlive(ccompatibilityAllocMap) - runtime.KeepAlive(cframeRateAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setFrameTimeline(transaction *ASurfaceTransaction, vsyncId AVsyncId) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - cvsyncId, cvsyncIdAllocMap := (C.AVsyncId)(vsyncId), cgoAllocsUnknown - C.ASurfaceTransaction_setFrameTimeline(ctransaction, cvsyncId) - runtime.KeepAlive(cvsyncIdAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setGeometry(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, source *ARect, destination *ARect, transform int32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - csource, csourceAllocMap := (*C.ARect)(unsafe.Pointer(source)), cgoAllocsUnknown - cdestination, cdestinationAllocMap := (*C.ARect)(unsafe.Pointer(destination)), cgoAllocsUnknown - ctransform, ctransformAllocMap := (C.int)(transform), cgoAllocsUnknown - C.ASurfaceTransaction_setGeometry(ctransaction, csurface_control, csource, cdestination, ctransform) - runtime.KeepAlive(ctransformAllocMap) - runtime.KeepAlive(cdestinationAllocMap) - runtime.KeepAlive(csourceAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setOnCommit(transaction *ASurfaceTransaction, context unsafe.Pointer, _func ASurfaceTransaction_OnCommit) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - c_func, c_funcAllocMap := _func.PassValue() - C.ASurfaceTransaction_setOnCommit(ctransaction, ccontext, c_func) - runtime.KeepAlive(c_funcAllocMap) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setOnComplete(transaction *ASurfaceTransaction, context unsafe.Pointer, _func ASurfaceTransaction_OnComplete) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - ccontext, ccontextAllocMap := context, cgoAllocsUnknown - c_func, c_funcAllocMap := _func.PassValue() - C.ASurfaceTransaction_setOnComplete(ctransaction, ccontext, c_func) - runtime.KeepAlive(c_funcAllocMap) - runtime.KeepAlive(ccontextAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setPosition(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, x int32, y int32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cx, cxAllocMap := (C.int)(x), cgoAllocsUnknown - cy, cyAllocMap := (C.int)(y), cgoAllocsUnknown - C.ASurfaceTransaction_setPosition(ctransaction, csurface_control, cx, cy) - runtime.KeepAlive(cyAllocMap) - runtime.KeepAlive(cxAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setScale(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, xScale float32, yScale float32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cxScale, cxScaleAllocMap := (C.float)(xScale), cgoAllocsUnknown - cyScale, cyScaleAllocMap := (C.float)(yScale), cgoAllocsUnknown - C.ASurfaceTransaction_setScale(ctransaction, csurface_control, cxScale, cyScale) - runtime.KeepAlive(cyScaleAllocMap) - runtime.KeepAlive(cxScaleAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} - -func ASurfaceTransaction_setZOrder(transaction *ASurfaceTransaction, surface_control *ASurfaceControl, z_order int32) { - ctransaction, ctransactionAllocMap := (*C.ASurfaceTransaction)(unsafe.Pointer(transaction)), cgoAllocsUnknown - csurface_control, csurface_controlAllocMap := (*C.ASurfaceControl)(unsafe.Pointer(surface_control)), cgoAllocsUnknown - cz_order, cz_orderAllocMap := (C.int)(z_order), cgoAllocsUnknown - C.ASurfaceTransaction_setZOrder(ctransaction, csurface_control, cz_order) - runtime.KeepAlive(cz_orderAllocMap) - runtime.KeepAlive(csurface_controlAllocMap) - runtime.KeepAlive(ctransactionAllocMap) -} diff --git a/capi/surfacecontrol/types.go b/capi/surfacecontrol/types.go deleted file mode 100644 index 96dc1ce..0000000 --- a/capi/surfacecontrol/types.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package surfacecontrol - -/* -#cgo LDFLAGS: -landroid -#include "android/surface_control.h" -#include "android/hdr_metadata.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type ASurfaceControl C.ASurfaceControl - -type ASurfaceTransaction C.ASurfaceTransaction - -type ASurfaceTransactionStats C.ASurfaceTransactionStats - -type AColor_xy C.struct_AColor_xy - -type AHdrMetadata_cta861_3 C.struct_AHdrMetadata_cta861_3 - -type AHdrMetadata_smpte2086 C.struct_AHdrMetadata_smpte2086 - -type AHardwareBuffer C.AHardwareBuffer - -type ANativeWindow C.ANativeWindow - -type ARect C.ARect - -type AVsyncId C.AVsyncId - -type ASurfaceTransaction_OnBufferRelease func(context unsafe.Pointer, release_fence_fd int32) - -type ASurfaceTransaction_OnCommit func(context unsafe.Pointer, stats *ASurfaceTransactionStats) - -type ASurfaceTransaction_OnComplete func(context unsafe.Pointer, stats *ASurfaceTransactionStats) diff --git a/capi/surfacetexture/cgo_helpers.c b/capi/surfacetexture/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/surfacetexture/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/surfacetexture/cgo_helpers.go b/capi/surfacetexture/cgo_helpers.go deleted file mode 100644 index 3c11cac..0000000 --- a/capi/surfacetexture/cgo_helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package surfacetexture - -/* -#cgo LDFLAGS: -landroid -#include "android/surface_texture.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} diff --git a/capi/surfacetexture/cgo_helpers.h b/capi/surfacetexture/cgo_helpers.h deleted file mode 100644 index 721d55e..0000000 --- a/capi/surfacetexture/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/surface_texture.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/surfacetexture/const.go b/capi/surfacetexture/const.go deleted file mode 100644 index 7849d4f..0000000 --- a/capi/surfacetexture/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package surfacetexture diff --git a/capi/surfacetexture/doc.go b/capi/surfacetexture/doc.go deleted file mode 100644 index 07ce8db..0000000 --- a/capi/surfacetexture/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android SurfaceTexture -*/ -package surfacetexture diff --git a/capi/surfacetexture/surfacetexture.go b/capi/surfacetexture/surfacetexture.go deleted file mode 100644 index 45cca1c..0000000 --- a/capi/surfacetexture/surfacetexture.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package surfacetexture - -/* -#cgo LDFLAGS: -landroid -#include "android/surface_texture.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ASurfaceTexture_acquireANativeWindow(st *ASurfaceTexture) *ANativeWindow { - cst, cstAllocMap := (*C.ASurfaceTexture)(unsafe.Pointer(st)), cgoAllocsUnknown - __ret := C.ASurfaceTexture_acquireANativeWindow(cst) - runtime.KeepAlive(cstAllocMap) - __v := (*ANativeWindow)(unsafe.Pointer(__ret)) - return __v -} - -func ASurfaceTexture_attachToGLContext(st *ASurfaceTexture, texName uint32) int32 { - cst, cstAllocMap := (*C.ASurfaceTexture)(unsafe.Pointer(st)), cgoAllocsUnknown - ctexName, ctexNameAllocMap := (C.uint)(texName), cgoAllocsUnknown - __ret := C.ASurfaceTexture_attachToGLContext(cst, ctexName) - runtime.KeepAlive(ctexNameAllocMap) - runtime.KeepAlive(cstAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASurfaceTexture_detachFromGLContext(st *ASurfaceTexture) int32 { - cst, cstAllocMap := (*C.ASurfaceTexture)(unsafe.Pointer(st)), cgoAllocsUnknown - __ret := C.ASurfaceTexture_detachFromGLContext(cst) - runtime.KeepAlive(cstAllocMap) - __v := (int32)(__ret) - return __v -} - -func ASurfaceTexture_getTimestamp(st *ASurfaceTexture) int64 { - cst, cstAllocMap := (*C.ASurfaceTexture)(unsafe.Pointer(st)), cgoAllocsUnknown - __ret := C.ASurfaceTexture_getTimestamp(cst) - runtime.KeepAlive(cstAllocMap) - __v := (int64)(__ret) - return __v -} - -func ASurfaceTexture_getTransformMatrix(st *ASurfaceTexture, mtx *[16]float32) { - cst, cstAllocMap := (*C.ASurfaceTexture)(unsafe.Pointer(st)), cgoAllocsUnknown - cmtx, cmtxAllocMap := (*C.float)(unsafe.Pointer(&mtx[0])), cgoAllocsUnknown - C.ASurfaceTexture_getTransformMatrix(cst, cmtx) - runtime.KeepAlive(cmtxAllocMap) - runtime.KeepAlive(cstAllocMap) -} - -func ASurfaceTexture_release(st *ASurfaceTexture) { - cst, cstAllocMap := (*C.ASurfaceTexture)(unsafe.Pointer(st)), cgoAllocsUnknown - C.ASurfaceTexture_release(cst) - runtime.KeepAlive(cstAllocMap) -} - -func ASurfaceTexture_updateTexImage(st *ASurfaceTexture) int32 { - cst, cstAllocMap := (*C.ASurfaceTexture)(unsafe.Pointer(st)), cgoAllocsUnknown - __ret := C.ASurfaceTexture_updateTexImage(cst) - runtime.KeepAlive(cstAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/surfacetexture/types.go b/capi/surfacetexture/types.go deleted file mode 100644 index 3a1f28d..0000000 --- a/capi/surfacetexture/types.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package surfacetexture - -/* -#cgo LDFLAGS: -landroid -#include "android/surface_texture.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type ASurfaceTexture C.ASurfaceTexture - -type ANativeWindow C.ANativeWindow diff --git a/capi/sync/cgo_helpers.c b/capi/sync/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/sync/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/sync/cgo_helpers.go b/capi/sync/cgo_helpers.go deleted file mode 100644 index bdeac7f..0000000 --- a/capi/sync/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sync - -/* -#cgo LDFLAGS: -lsync -#include "android/sync.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/sync/cgo_helpers.h b/capi/sync/cgo_helpers.h deleted file mode 100644 index 1c05f76..0000000 --- a/capi/sync/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/sync.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/sync/const.go b/capi/sync/const.go deleted file mode 100644 index 1712ed4..0000000 --- a/capi/sync/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sync diff --git a/capi/sync/doc.go b/capi/sync/doc.go deleted file mode 100644 index 1be3b9e..0000000 --- a/capi/sync/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android Sync -*/ -package sync diff --git a/capi/sync/sync.go b/capi/sync/sync.go deleted file mode 100644 index a3f5de0..0000000 --- a/capi/sync/sync.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sync - -/* -#cgo LDFLAGS: -lsync -#include "android/sync.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func Sync_file_info(fd int32) *Sync_file_info_s { - cfd, cfdAllocMap := (C.int)(fd), cgoAllocsUnknown - __ret := C.sync_file_info(cfd) - runtime.KeepAlive(cfdAllocMap) - __v := (*Sync_file_info_s)(unsafe.Pointer(__ret)) - return __v -} - -func Sync_file_info_free(info *Sync_file_info_s) { - cinfo, cinfoAllocMap := (*C.struct_sync_file_info)(unsafe.Pointer(info)), cgoAllocsUnknown - C.sync_file_info_free(cinfo) - runtime.KeepAlive(cinfoAllocMap) -} - -func Sync_merge(name string, fd1 int32, fd2 int32) int32 { - cname, cnameAllocMap := UnpackPCharString(name) - cfd1, cfd1AllocMap := (C.int)(fd1), cgoAllocsUnknown - cfd2, cfd2AllocMap := (C.int)(fd2), cgoAllocsUnknown - __ret := C.sync_merge(cname, cfd1, cfd2) - runtime.KeepAlive(cfd2AllocMap) - runtime.KeepAlive(cfd1AllocMap) - runtime.KeepAlive(cnameAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/sync/types.go b/capi/sync/types.go deleted file mode 100644 index c3a8646..0000000 --- a/capi/sync/types.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package sync - -/* -#cgo LDFLAGS: -lsync -#include "android/sync.h" -#include -#include "cgo_helpers.h" -*/ -import "C" - -type Sync_file_info_s C.struct_sync_file_info diff --git a/capi/thermal/cgo_helpers.c b/capi/thermal/cgo_helpers.c deleted file mode 100644 index 9c4bb8a..0000000 --- a/capi/thermal/cgo_helpers.c +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "_cgo_export.h" - -void AThermal_StatusCallback_2a5901bc(void* data, AThermalStatus status) { - AThermal_StatusCallback2A5901BC(data, status); -} - diff --git a/capi/thermal/cgo_helpers.go b/capi/thermal/cgo_helpers.go deleted file mode 100644 index 8f2e869..0000000 --- a/capi/thermal/cgo_helpers.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package thermal - -/* -#cgo LDFLAGS: -landroid -#include "android/thermal.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (x AThermal_StatusCallback) PassRef() (ref *C.AThermal_StatusCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aThermal_StatusCallback2A5901BCFunc == nil { - aThermal_StatusCallback2A5901BCFunc = x - } - return (*C.AThermal_StatusCallback)(C.AThermal_StatusCallback_2a5901bc), nil -} - -func (x AThermal_StatusCallback) PassValue() (ref C.AThermal_StatusCallback, allocs *CgoAllocMap) { - if x == nil { - return nil, nil - } - if aThermal_StatusCallback2A5901BCFunc == nil { - aThermal_StatusCallback2A5901BCFunc = x - } - return (C.AThermal_StatusCallback)(C.AThermal_StatusCallback_2a5901bc), nil -} - -func NewAThermal_StatusCallbackRef(ref unsafe.Pointer) *AThermal_StatusCallback { - return (*AThermal_StatusCallback)(ref) -} - -//export AThermal_StatusCallback2A5901BC -func AThermal_StatusCallback2A5901BC(cdata unsafe.Pointer, cstatus C.AThermalStatus) { - if aThermal_StatusCallback2A5901BCFunc != nil { - data2a5901bc := (unsafe.Pointer)(unsafe.Pointer(cdata)) - status2a5901bc := (AThermalStatus)(cstatus) - aThermal_StatusCallback2A5901BCFunc(data2a5901bc, status2a5901bc) - return - } - panic("callback func has not been set (race?)") -} - -var aThermal_StatusCallback2A5901BCFunc AThermal_StatusCallback diff --git a/capi/thermal/cgo_helpers.h b/capi/thermal/cgo_helpers.h deleted file mode 100644 index b8f401c..0000000 --- a/capi/thermal/cgo_helpers.h +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/thermal.h" -#include -#pragma once - -#define __CGOGEN 1 - -// AThermal_StatusCallback_2a5901bc is a proxy for callback AThermal_StatusCallback. -void AThermal_StatusCallback_2a5901bc(void* data, AThermalStatus status); - diff --git a/capi/thermal/const.go b/capi/thermal/const.go deleted file mode 100644 index a488545..0000000 --- a/capi/thermal/const.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package thermal - -const ( - ATHERMAL_STATUS_ERROR AThermalStatus = -1 - ATHERMAL_STATUS_NONE AThermalStatus = 0 - ATHERMAL_STATUS_LIGHT AThermalStatus = 1 - ATHERMAL_STATUS_MODERATE AThermalStatus = 2 - ATHERMAL_STATUS_SEVERE AThermalStatus = 3 - ATHERMAL_STATUS_CRITICAL AThermalStatus = 4 - ATHERMAL_STATUS_EMERGENCY AThermalStatus = 5 - ATHERMAL_STATUS_SHUTDOWN AThermalStatus = 6 -) diff --git a/capi/thermal/doc.go b/capi/thermal/doc.go deleted file mode 100644 index e9a9bf8..0000000 --- a/capi/thermal/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android thermal -*/ -package thermal diff --git a/capi/thermal/thermal.go b/capi/thermal/thermal.go deleted file mode 100644 index 0c4403c..0000000 --- a/capi/thermal/thermal.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package thermal - -/* -#cgo LDFLAGS: -landroid -#include "android/thermal.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func AThermal_acquireManager() *AThermalManager { - __ret := C.AThermal_acquireManager() - __v := (*AThermalManager)(unsafe.Pointer(__ret)) - return __v -} - -func AThermal_getCurrentThermalStatus(manager *AThermalManager) AThermalStatus { - cmanager, cmanagerAllocMap := (*C.AThermalManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - __ret := C.AThermal_getCurrentThermalStatus(cmanager) - runtime.KeepAlive(cmanagerAllocMap) - __v := (AThermalStatus)(__ret) - return __v -} - -func AThermal_getThermalHeadroom(manager *AThermalManager, forecastSeconds int32) float32 { - cmanager, cmanagerAllocMap := (*C.AThermalManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - cforecastSeconds, cforecastSecondsAllocMap := (C.int)(forecastSeconds), cgoAllocsUnknown - __ret := C.AThermal_getThermalHeadroom(cmanager, cforecastSeconds) - runtime.KeepAlive(cforecastSecondsAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (float32)(__ret) - return __v -} - -func AThermal_getThermalHeadroomThresholds(manager *AThermalManager, outThresholds **AThermalHeadroomThreshold, size *uint64) int32 { - cmanager, cmanagerAllocMap := (*C.AThermalManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - coutThresholds, coutThresholdsAllocMap := (**C.AThermalHeadroomThreshold)(unsafe.Pointer(outThresholds)), cgoAllocsUnknown - var pinnercoutThresholds runtime.Pinner - pinnercoutThresholds.Pin(outThresholds) - if outThresholds != nil { - pinnercoutThresholds.Pin(unsafe.Pointer(*outThresholds)) - } - defer pinnercoutThresholds.Unpin() - csize, csizeAllocMap := (*C.uint64_t)(unsafe.Pointer(size)), cgoAllocsUnknown - __ret := C.AThermal_getThermalHeadroomThresholds(cmanager, coutThresholds, csize) - runtime.KeepAlive(csizeAllocMap) - runtime.KeepAlive(coutThresholdsAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int32)(__ret) - return __v -} - -func AThermal_registerThermalStatusListener(manager *AThermalManager, callback AThermal_StatusCallback, data unsafe.Pointer) int32 { - cmanager, cmanagerAllocMap := (*C.AThermalManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - __ret := C.AThermal_registerThermalStatusListener(cmanager, ccallback, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int32)(__ret) - return __v -} - -func AThermal_releaseManager(manager *AThermalManager) { - cmanager, cmanagerAllocMap := (*C.AThermalManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - C.AThermal_releaseManager(cmanager) - runtime.KeepAlive(cmanagerAllocMap) -} - -func AThermal_unregisterThermalStatusListener(manager *AThermalManager, callback AThermal_StatusCallback, data unsafe.Pointer) int32 { - cmanager, cmanagerAllocMap := (*C.AThermalManager)(unsafe.Pointer(manager)), cgoAllocsUnknown - ccallback, ccallbackAllocMap := callback.PassValue() - cdata, cdataAllocMap := data, cgoAllocsUnknown - __ret := C.AThermal_unregisterThermalStatusListener(cmanager, ccallback, cdata) - runtime.KeepAlive(cdataAllocMap) - runtime.KeepAlive(ccallbackAllocMap) - runtime.KeepAlive(cmanagerAllocMap) - __v := (int32)(__ret) - return __v -} diff --git a/capi/thermal/types.go b/capi/thermal/types.go deleted file mode 100644 index f326ef2..0000000 --- a/capi/thermal/types.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package thermal - -/* -#cgo LDFLAGS: -landroid -#include "android/thermal.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import "unsafe" - -type AThermalHeadroomThreshold C.AThermalHeadroomThreshold - -type AThermalManager C.AThermalManager - -type AThermalStatus int32 - -type AThermal_StatusCallback func(data unsafe.Pointer, status AThermalStatus) diff --git a/capi/trace/cgo_helpers.c b/capi/trace/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/trace/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/trace/cgo_helpers.go b/capi/trace/cgo_helpers.go deleted file mode 100644 index e3e5516..0000000 --- a/capi/trace/cgo_helpers.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package trace - -/* -#cgo LDFLAGS: -landroid -#include "android/trace.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} diff --git a/capi/trace/cgo_helpers.h b/capi/trace/cgo_helpers.h deleted file mode 100644 index 5adfaa1..0000000 --- a/capi/trace/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "android/trace.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/trace/const.go b/capi/trace/const.go deleted file mode 100644 index 2839b19..0000000 --- a/capi/trace/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package trace diff --git a/capi/trace/doc.go b/capi/trace/doc.go deleted file mode 100644 index 3e24349..0000000 --- a/capi/trace/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Android trace -*/ -package trace diff --git a/capi/trace/trace.go b/capi/trace/trace.go deleted file mode 100644 index e5e2ed5..0000000 --- a/capi/trace/trace.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package trace - -/* -#cgo LDFLAGS: -landroid -#include "android/trace.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer - -func ATrace_beginAsyncSection(sectionName string, cookie int32) { - csectionName, csectionNameAllocMap := UnpackPCharString(sectionName) - ccookie, ccookieAllocMap := (C.int)(cookie), cgoAllocsUnknown - C.ATrace_beginAsyncSection(csectionName, ccookie) - runtime.KeepAlive(ccookieAllocMap) - runtime.KeepAlive(csectionNameAllocMap) -} - -func ATrace_beginSection(sectionName string) { - csectionName, csectionNameAllocMap := UnpackPCharString(sectionName) - C.ATrace_beginSection(csectionName) - runtime.KeepAlive(csectionNameAllocMap) -} - -func ATrace_endAsyncSection(sectionName string, cookie int32) { - csectionName, csectionNameAllocMap := UnpackPCharString(sectionName) - ccookie, ccookieAllocMap := (C.int)(cookie), cgoAllocsUnknown - C.ATrace_endAsyncSection(csectionName, ccookie) - runtime.KeepAlive(ccookieAllocMap) - runtime.KeepAlive(csectionNameAllocMap) -} - -func ATrace_endSection() { - C.ATrace_endSection() -} - -func ATrace_isEnabled() bool { - __ret := C.ATrace_isEnabled() - __v := (bool)(__ret) - return __v -} - -func ATrace_setCounter(counterName string, counterValue int64) { - ccounterName, ccounterNameAllocMap := UnpackPCharString(counterName) - ccounterValue, ccounterValueAllocMap := (C.int64_t)(counterValue), cgoAllocsUnknown - C.ATrace_setCounter(ccounterName, ccounterValue) - runtime.KeepAlive(ccounterValueAllocMap) - runtime.KeepAlive(ccounterNameAllocMap) -} diff --git a/capi/trace/types.go b/capi/trace/types.go deleted file mode 100644 index a5af48c..0000000 --- a/capi/trace/types.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package trace - -/* -#cgo LDFLAGS: -landroid -#include "android/trace.h" -#include -#include "cgo_helpers.h" -*/ -import "C" diff --git a/capi/vulkan/cgo_helpers.c b/capi/vulkan/cgo_helpers.c deleted file mode 100644 index c483f4d..0000000 --- a/capi/vulkan/cgo_helpers.c +++ /dev/null @@ -1,2 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - diff --git a/capi/vulkan/cgo_helpers.go b/capi/vulkan/cgo_helpers.go deleted file mode 100644 index 6727b98..0000000 --- a/capi/vulkan/cgo_helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package vulkan - -/* -#cgo LDFLAGS: -lvulkan -#include "vulkan/vulkan.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "sync" - "unsafe" -) - -// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} diff --git a/capi/vulkan/cgo_helpers.h b/capi/vulkan/cgo_helpers.h deleted file mode 100644 index d81152a..0000000 --- a/capi/vulkan/cgo_helpers.h +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -#include "vulkan/vulkan.h" -#include -#pragma once - -#define __CGOGEN 1 - diff --git a/capi/vulkan/const.go b/capi/vulkan/const.go deleted file mode 100644 index da65f8c..0000000 --- a/capi/vulkan/const.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package vulkan diff --git a/capi/vulkan/doc.go b/capi/vulkan/doc.go deleted file mode 100644 index 3269c30..0000000 --- a/capi/vulkan/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -/* -Raw CGo bindings for Vulkan -*/ -package vulkan diff --git a/capi/vulkan/types.go b/capi/vulkan/types.go deleted file mode 100644 index 8398add..0000000 --- a/capi/vulkan/types.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package vulkan - -/* -#cgo LDFLAGS: -lvulkan -#include "vulkan/vulkan.h" -#include -#include "cgo_helpers.h" -*/ -import "C" diff --git a/capi/vulkan/vulkan.go b/capi/vulkan/vulkan.go deleted file mode 100644 index 74c0982..0000000 --- a/capi/vulkan/vulkan.go +++ /dev/null @@ -1,18 +0,0 @@ -// Code generated by capigen. DO NOT EDIT. - -package vulkan - -/* -#cgo LDFLAGS: -lvulkan -#include "vulkan/vulkan.h" -#include -#include "cgo_helpers.h" -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -var _ runtime.Error -var _ unsafe.Pointer diff --git a/choreographer/achoreographer_refresh_rate_callback.go b/choreographer/achoreographer_refresh_rate_callback.go deleted file mode 100644 index 6075350..0000000 --- a/choreographer/achoreographer_refresh_rate_callback.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package choreographer - -import ( - capi "github.com/AndroidGoLab/ndk/capi/choreographer" -) - -type AChoreographer_refreshRateCallback = capi.AChoreographer_refreshRateCallback diff --git a/choreographer/achoreographer_vsync_callback.go b/choreographer/achoreographer_vsync_callback.go deleted file mode 100644 index 4a926a5..0000000 --- a/choreographer/achoreographer_vsync_callback.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package choreographer - -import ( - capi "github.com/AndroidGoLab/ndk/capi/choreographer" -) - -type AChoreographer_vsyncCallback = capi.AChoreographer_vsyncCallback diff --git a/choreographer/avsync_id.go b/choreographer/avsync_id.go deleted file mode 100644 index 487f607..0000000 --- a/choreographer/avsync_id.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package choreographer - -import ( - capi "github.com/AndroidGoLab/ndk/capi/choreographer" -) - -type AVsyncId = capi.AVsyncId diff --git a/choreographer/choreographer.go b/choreographer/choreographer.go deleted file mode 100644 index a78181d..0000000 --- a/choreographer/choreographer.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package choreographer - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/choreographer" -) - -// Choreographer wraps the NDK AChoreographer handle. -type Choreographer struct { - ptr *capi.AChoreographer -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Choreographer) cptr() *capi.AChoreographer { - if h == nil { - return nil - } - return h.ptr -} - -// NewChoreographerFromPointer wraps a raw AChoreographer pointer. -func NewChoreographerFromPointer(ptr unsafe.Pointer) *Choreographer { - return &Choreographer{ptr: (*capi.AChoreographer)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Choreographer) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Choreographer) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewChoreographerFromUintPtr wraps a uintptr as a Choreographer. -// The caller must ensure ptr points to a valid AChoreographer. -func NewChoreographerFromUintPtr(ptr uintptr) *Choreographer { - return &Choreographer{ptr: (*capi.AChoreographer)(unsafe.Pointer(ptr))} -} - -// GetInstance calls the underlying C function. -func GetInstance() *Choreographer { - return &Choreographer{ptr: capi.AChoreographer_getInstance()} -} diff --git a/choreographer/choreographer_frame_callback_data.go b/choreographer/choreographer_frame_callback_data.go deleted file mode 100644 index 04fb6d5..0000000 --- a/choreographer/choreographer_frame_callback_data.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package choreographer - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/choreographer" -) - -// ChoreographerFrameCallbackData wraps the NDK AChoreographerFrameCallbackData handle. -type ChoreographerFrameCallbackData struct { - ptr *capi.AChoreographerFrameCallbackData -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *ChoreographerFrameCallbackData) cptr() *capi.AChoreographerFrameCallbackData { - if h == nil { - return nil - } - return h.ptr -} - -// NewChoreographerFrameCallbackDataFromPointer wraps a raw AChoreographerFrameCallbackData pointer. -func NewChoreographerFrameCallbackDataFromPointer(ptr unsafe.Pointer) *ChoreographerFrameCallbackData { - return &ChoreographerFrameCallbackData{ptr: (*capi.AChoreographerFrameCallbackData)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *ChoreographerFrameCallbackData) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *ChoreographerFrameCallbackData) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewChoreographerFrameCallbackDataFromUintPtr wraps a uintptr as a ChoreographerFrameCallbackData. -// The caller must ensure ptr points to a valid AChoreographerFrameCallbackData. -func NewChoreographerFrameCallbackDataFromUintPtr(ptr uintptr) *ChoreographerFrameCallbackData { - return &ChoreographerFrameCallbackData{ptr: (*capi.AChoreographerFrameCallbackData)(unsafe.Pointer(ptr))} -} - -// GetFrameTimeNanos returns the value directly. -func (h *ChoreographerFrameCallbackData) GetFrameTimeNanos() int64 { - return (int64)(capi.AChoreographerFrameCallbackData_getFrameTimeNanos(h.ptr)) -} - -// GetFrameTimelineDeadlineNanos returns the value directly. -func (h *ChoreographerFrameCallbackData) GetFrameTimelineDeadlineNanos(index uint64) int64 { - return (int64)(capi.AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos(h.ptr, index)) -} - -// GetFrameTimelineExpectedPresentationTimeNanos returns the value directly. -func (h *ChoreographerFrameCallbackData) GetFrameTimelineExpectedPresentationTimeNanos(index uint64) int64 { - return (int64)(capi.AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos(h.ptr, index)) -} - -// GetFrameTimelinesLength returns the value directly. -func (h *ChoreographerFrameCallbackData) GetFrameTimelinesLength() uint64 { - return (uint64)(capi.AChoreographerFrameCallbackData_getFrameTimelinesLength(h.ptr)) -} - -// GetPreferredFrameTimelineIndex returns the value directly. -func (h *ChoreographerFrameCallbackData) GetPreferredFrameTimelineIndex() uint64 { - return (uint64)(capi.AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex(h.ptr)) -} diff --git a/choreographer/errors.go b/choreographer/errors.go deleted file mode 100644 index 79aba9c..0000000 --- a/choreographer/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package choreographer - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/choreographer/functions.go b/choreographer/functions.go deleted file mode 100644 index c636f62..0000000 --- a/choreographer/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package choreographer diff --git a/choreographer/package.go b/choreographer/package.go deleted file mode 100644 index f24ec10..0000000 --- a/choreographer/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package choreographer provides Go bindings for Android AChoreographer. -package choreographer diff --git a/cmd/ndkcli/activity_gen.go b/cmd/ndkcli/activity_gen.go deleted file mode 100644 index 5568af5..0000000 --- a/cmd/ndkcli/activity_gen.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var activityCmd = &cobra.Command{ - Use: "activity", - Short: "activity NDK module", -} - -var activityActivityCmd = &cobra.Command{ - Use: "activity", - Short: "Activity operations", -} - -var activityErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var activityActivityFinishCmd = &cobra.Command{ - Use: "finish", - Short: "Activity.Finish()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var activityActivityHideSoftInputCmd = &cobra.Command{ - Use: "hide-soft-input", - Short: "Activity.HideSoftInput()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var activityActivitySetWindowFlagsCmd = &cobra.Command{ - Use: "set-window-flags", - Short: "Activity.SetWindowFlags()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var activityActivitySetWindowFormatCmd = &cobra.Command{ - Use: "set-window-format", - Short: "Activity.SetWindowFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var activityActivityShowSoftInputCmd = &cobra.Command{ - Use: "show-soft-input", - Short: "Activity.ShowSoftInput()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var activityErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - activityCmd.AddCommand(activityActivityCmd) - activityCmd.AddCommand(activityErrorCmd) - activityActivityCmd.AddCommand(activityActivityFinishCmd) - activityActivityCmd.AddCommand(activityActivityHideSoftInputCmd) - activityActivityCmd.AddCommand(activityActivitySetWindowFlagsCmd) - activityActivityCmd.AddCommand(activityActivitySetWindowFormatCmd) - activityActivityCmd.AddCommand(activityActivityShowSoftInputCmd) - activityErrorCmd.AddCommand(activityErrorErrorCmd) - rootCmd.AddCommand(activityCmd) -} diff --git a/cmd/ndkcli/android_gen.go b/cmd/ndkcli/android_gen.go deleted file mode 100644 index b4a1361..0000000 --- a/cmd/ndkcli/android_gen.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var androidCmd = &cobra.Command{ - Use: "android", - Short: "android NDK module", -} - -var androidAppCmd = &cobra.Command{ - Use: "app", - Short: "App operations", -} - -var androidAppActivityCmd = &cobra.Command{ - Use: "activity", - Short: "App.Activity()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var androidAppWindowCmd = &cobra.Command{ - Use: "window", - Short: "App.Window()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var androidAppWindowSizeCmd = &cobra.Command{ - Use: "window-size", - Short: "App.WindowSize()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var androidAppHasPermissionCmd = &cobra.Command{ - Use: "has-permission", - Short: "App.HasPermission()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var androidAppRequestPermissionCmd = &cobra.Command{ - Use: "request-permission", - Short: "App.RequestPermission()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var androidAppShowToastCmd = &cobra.Command{ - Use: "show-toast", - Short: "App.ShowToast()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var androidAppFillWindowColorCmd = &cobra.Command{ - Use: "fill-window-color", - Short: "App.FillWindowColor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - androidCmd.AddCommand(androidAppCmd) - androidAppCmd.AddCommand(androidAppActivityCmd) - androidAppCmd.AddCommand(androidAppWindowCmd) - androidAppCmd.AddCommand(androidAppWindowSizeCmd) - androidAppCmd.AddCommand(androidAppHasPermissionCmd) - androidAppCmd.AddCommand(androidAppRequestPermissionCmd) - androidAppCmd.AddCommand(androidAppShowToastCmd) - androidAppCmd.AddCommand(androidAppFillWindowColorCmd) - rootCmd.AddCommand(androidCmd) -} diff --git a/cmd/ndkcli/asset_gen.go b/cmd/ndkcli/asset_gen.go deleted file mode 100644 index 85a6b8a..0000000 --- a/cmd/ndkcli/asset_gen.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var assetCmd = &cobra.Command{ - Use: "asset", - Short: "asset NDK module", -} - -var assetAssetCmd = &cobra.Command{ - Use: "asset", - Short: "Asset operations", -} - -var assetDirCmd = &cobra.Command{ - Use: "dir", - Short: "Dir operations", -} - -var assetErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var assetManagerCmd = &cobra.Command{ - Use: "manager", - Short: "Manager operations", -} - -var assetAssetBufferCmd = &cobra.Command{ - Use: "buffer", - Short: "Asset.Buffer()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetAssetLengthCmd = &cobra.Command{ - Use: "length", - Short: "Asset.Length()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetAssetLength64Cmd = &cobra.Command{ - Use: "length64", - Short: "Asset.Length64()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetAssetRemainingLengthCmd = &cobra.Command{ - Use: "remaining-length", - Short: "Asset.RemainingLength()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetAssetRemainingLength64Cmd = &cobra.Command{ - Use: "remaining-length64", - Short: "Asset.RemainingLength64()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetAssetIsAllocatedCmd = &cobra.Command{ - Use: "is-allocated", - Short: "Asset.IsAllocated()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetDirNextFileNameCmd = &cobra.Command{ - Use: "next-file-name", - Short: "Dir.NextFileName()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetDirRewindCmd = &cobra.Command{ - Use: "rewind", - Short: "Dir.Rewind()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetManagerOpenCmd = &cobra.Command{ - Use: "open", - Short: "Manager.Open()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var assetManagerOpenDirCmd = &cobra.Command{ - Use: "open-dir", - Short: "Manager.OpenDir()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - assetCmd.AddCommand(assetAssetCmd) - assetCmd.AddCommand(assetDirCmd) - assetCmd.AddCommand(assetErrorCmd) - assetCmd.AddCommand(assetManagerCmd) - assetAssetCmd.AddCommand(assetAssetBufferCmd) - assetAssetCmd.AddCommand(assetAssetLengthCmd) - assetAssetCmd.AddCommand(assetAssetLength64Cmd) - assetAssetCmd.AddCommand(assetAssetRemainingLengthCmd) - assetAssetCmd.AddCommand(assetAssetRemainingLength64Cmd) - assetAssetCmd.AddCommand(assetAssetIsAllocatedCmd) - assetDirCmd.AddCommand(assetDirNextFileNameCmd) - assetDirCmd.AddCommand(assetDirRewindCmd) - assetErrorCmd.AddCommand(assetErrorErrorCmd) - assetManagerCmd.AddCommand(assetManagerOpenCmd) - assetManagerCmd.AddCommand(assetManagerOpenDirCmd) - rootCmd.AddCommand(assetCmd) -} diff --git a/cmd/ndkcli/audio_gen.go b/cmd/ndkcli/audio_gen.go deleted file mode 100644 index 66299fd..0000000 --- a/cmd/ndkcli/audio_gen.go +++ /dev/null @@ -1,565 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/audio" -) - -var audioCmd = &cobra.Command{ - Use: "audio", - Short: "audio NDK module", -} - -var audioDirectionCmd = &cobra.Command{ - Use: "direction", - Short: "Direction operations", -} - -var audioErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var audioStreamCmd = &cobra.Command{ - Use: "stream", - Short: "Stream operations", -} - -var audioStreamBuilderCmd = &cobra.Command{ - Use: "stream-builder", - Short: "StreamBuilder operations", -} - -var audioStreamStateCmd2 = &cobra.Command{ - Use: "stream-state", - Short: "StreamState operations", -} - -var audioDirectionStringCmd = &cobra.Command{ - Use: "string", - Short: "Direction.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetBufferCapacityInFramesCmd = &cobra.Command{ - Use: "get-buffer-capacity-in-frames", - Short: "Stream.GetBufferCapacityInFrames()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetBufferSizeInFramesCmd = &cobra.Command{ - Use: "get-buffer-size-in-frames", - Short: "Stream.GetBufferSizeInFrames()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamChannelCountCmd = &cobra.Command{ - Use: "channel-count", - Short: "Stream.ChannelCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetDeviceIDCmd = &cobra.Command{ - Use: "get-device-id", - Short: "Stream.GetDeviceID()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamFramesPerBurstCmd = &cobra.Command{ - Use: "frames-per-burst", - Short: "Stream.FramesPerBurst()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetFramesPerDataCallbackCmd = &cobra.Command{ - Use: "get-frames-per-data-callback", - Short: "Stream.GetFramesPerDataCallback()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetFramesReadCmd = &cobra.Command{ - Use: "get-frames-read", - Short: "Stream.GetFramesRead()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetFramesWrittenCmd = &cobra.Command{ - Use: "get-frames-written", - Short: "Stream.GetFramesWritten()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetHardwareChannelCountCmd = &cobra.Command{ - Use: "get-hardware-channel-count", - Short: "Stream.GetHardwareChannelCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetHardwareSampleRateCmd = &cobra.Command{ - Use: "get-hardware-sample-rate", - Short: "Stream.GetHardwareSampleRate()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamSampleRateCmd = &cobra.Command{ - Use: "sample-rate", - Short: "Stream.SampleRate()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamGetSamplesPerFrameCmd = &cobra.Command{ - Use: "get-samples-per-frame", - Short: "Stream.GetSamplesPerFrame()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamStateCmd = &cobra.Command{ - Use: "state", - Short: "Stream.State()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamXRunCountCmd = &cobra.Command{ - Use: "x-run-count", - Short: "Stream.XRunCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamIsContentSpatializedCmd = &cobra.Command{ - Use: "is-content-spatialized", - Short: "Stream.IsContentSpatialized()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamIsPrivacySensitiveCmd = &cobra.Command{ - Use: "is-privacy-sensitive", - Short: "Stream.IsPrivacySensitive()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamFlushCmd = &cobra.Command{ - Use: "flush", - Short: "Stream.Flush()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamPauseCmd = &cobra.Command{ - Use: "pause", - Short: "Stream.Pause()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamStartCmd = &cobra.Command{ - Use: "start", - Short: "Stream.Start()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamStopCmd = &cobra.Command{ - Use: "stop", - Short: "Stream.Stop()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var audioStreamBuilderNewCmd = &cobra.Command{ - Use: "new", - Short: "Create StreamBuilder", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var audioStreamBuilderOpenCmd = &cobra.Command{ - Use: "open", - Short: "StreamBuilder.Open()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - result, err := obj.Open() - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var audioStreamBuilderSetAttributionTagCmd = &cobra.Command{ - Use: "set-attribution-tag", - Short: "StreamBuilder.SetAttributionTag()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - attributionTag, _ := cmd.Flags().GetString("attribution-tag") - obj.SetAttributionTag(attributionTag) - fmt.Println("ok") - return nil - }, -} - -var audioStreamBuilderSetBufferCapacityInFramesCmd = &cobra.Command{ - Use: "set-buffer-capacity-in-frames", - Short: "StreamBuilder.SetBufferCapacityInFrames()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - numFrames, _ := cmd.Flags().GetInt32("num-frames") - result := obj.SetBufferCapacityInFrames(numFrames) - fmt.Println(result) - return nil - }, -} - -var audioStreamBuilderSetChannelCountCmd = &cobra.Command{ - Use: "set-channel-count", - Short: "StreamBuilder.SetChannelCount()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - channelCount, _ := cmd.Flags().GetInt32("channel-count") - result := obj.SetChannelCount(channelCount) - fmt.Println(result) - return nil - }, -} - -var audioStreamBuilderSetDeviceIDCmd = &cobra.Command{ - Use: "set-device-id", - Short: "StreamBuilder.SetDeviceID()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - deviceID, _ := cmd.Flags().GetInt32("device-id") - result := obj.SetDeviceID(deviceID) - fmt.Println(result) - return nil - }, -} - -var audioStreamBuilderSetDirectionCmd = &cobra.Command{ - Use: "set-direction", - Short: "StreamBuilder.SetDirection()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - direction, _ := cmd.Flags().GetInt32("direction") - result := obj.SetDirection(audio.Direction(direction)) - fmt.Println(result) - return nil - }, -} - -var audioStreamBuilderSetFormatCmd = &cobra.Command{ - Use: "set-format", - Short: "StreamBuilder.SetFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - format, _ := cmd.Flags().GetInt32("format") - result := obj.SetFormat(audio.Format(format)) - fmt.Println(result) - return nil - }, -} - -var audioStreamBuilderSetFramesPerDataCallbackCmd = &cobra.Command{ - Use: "set-frames-per-data-callback", - Short: "StreamBuilder.SetFramesPerDataCallback()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - numFrames, _ := cmd.Flags().GetInt32("num-frames") - obj.SetFramesPerDataCallback(numFrames) - fmt.Println("ok") - return nil - }, -} - -var audioStreamBuilderSetIsContentSpatializedCmd = &cobra.Command{ - Use: "set-is-content-spatialized", - Short: "StreamBuilder.SetIsContentSpatialized()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - isSpatialized, _ := cmd.Flags().GetBool("is-spatialized") - obj.SetIsContentSpatialized(isSpatialized) - fmt.Println("ok") - return nil - }, -} - -var audioStreamBuilderSetPackageNameCmd = &cobra.Command{ - Use: "set-package-name", - Short: "StreamBuilder.SetPackageName()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - packageName, _ := cmd.Flags().GetString("package-name") - obj.SetPackageName(packageName) - fmt.Println("ok") - return nil - }, -} - -var audioStreamBuilderSetPerformanceModeCmd = &cobra.Command{ - Use: "set-performance-mode", - Short: "StreamBuilder.SetPerformanceMode()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - mode, _ := cmd.Flags().GetInt32("mode") - result := obj.SetPerformanceMode(audio.PerformanceMode(mode)) - fmt.Println(result) - return nil - }, -} - -var audioStreamBuilderSetPrivacySensitiveCmd = &cobra.Command{ - Use: "set-privacy-sensitive", - Short: "StreamBuilder.SetPrivacySensitive()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - privacySensitive, _ := cmd.Flags().GetBool("privacy-sensitive") - obj.SetPrivacySensitive(privacySensitive) - fmt.Println("ok") - return nil - }, -} - -var audioStreamBuilderSetSampleRateCmd = &cobra.Command{ - Use: "set-sample-rate", - Short: "StreamBuilder.SetSampleRate()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - sampleRate, _ := cmd.Flags().GetInt32("sample-rate") - result := obj.SetSampleRate(sampleRate) - fmt.Println(result) - return nil - }, -} - -var audioStreamBuilderSetSamplesPerFrameCmd = &cobra.Command{ - Use: "set-samples-per-frame", - Short: "StreamBuilder.SetSamplesPerFrame()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - samplesPerFrame, _ := cmd.Flags().GetInt32("samples-per-frame") - obj.SetSamplesPerFrame(samplesPerFrame) - fmt.Println("ok") - return nil - }, -} - -var audioStreamBuilderSetSharingModeCmd = &cobra.Command{ - Use: "set-sharing-mode", - Short: "StreamBuilder.SetSharingMode()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := audio.NewStreamBuilder() - if err != nil { - return err - } - defer obj.Close() - sharingMode, _ := cmd.Flags().GetInt32("sharing-mode") - result := obj.SetSharingMode(audio.SharingMode(sharingMode)) - fmt.Println(result) - return nil - }, -} - -var audioStreamStateStringCmd = &cobra.Command{ - Use: "string", - Short: "StreamState.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - audioStreamBuilderSetAttributionTagCmd.Flags().String("attribution-tag", "", "attributionTag") - audioStreamBuilderSetBufferCapacityInFramesCmd.Flags().Int32("num-frames", 0, "numFrames") - audioStreamBuilderSetChannelCountCmd.Flags().Int32("channel-count", 0, "channelCount") - audioStreamBuilderSetDeviceIDCmd.Flags().Int32("device-id", 0, "deviceID") - audioStreamBuilderSetDirectionCmd.Flags().Int32("direction", 0, "direction") - audioStreamBuilderSetFormatCmd.Flags().Int32("format", 0, "format") - audioStreamBuilderSetFramesPerDataCallbackCmd.Flags().Int32("num-frames", 0, "numFrames") - audioStreamBuilderSetIsContentSpatializedCmd.Flags().Bool("is-spatialized", false, "isSpatialized") - audioStreamBuilderSetPackageNameCmd.Flags().String("package-name", "", "packageName") - audioStreamBuilderSetPerformanceModeCmd.Flags().Int32("mode", 0, "mode") - audioStreamBuilderSetPrivacySensitiveCmd.Flags().Bool("privacy-sensitive", false, "privacySensitive") - audioStreamBuilderSetSampleRateCmd.Flags().Int32("sample-rate", 0, "sampleRate") - audioStreamBuilderSetSamplesPerFrameCmd.Flags().Int32("samples-per-frame", 0, "samplesPerFrame") - audioStreamBuilderSetSharingModeCmd.Flags().Int32("sharing-mode", 0, "sharingMode") - audioCmd.AddCommand(audioDirectionCmd) - audioCmd.AddCommand(audioErrorCmd) - audioCmd.AddCommand(audioStreamCmd) - audioCmd.AddCommand(audioStreamBuilderCmd) - audioCmd.AddCommand(audioStreamStateCmd2) - audioDirectionCmd.AddCommand(audioDirectionStringCmd) - audioErrorCmd.AddCommand(audioErrorErrorCmd) - audioStreamCmd.AddCommand(audioStreamGetBufferCapacityInFramesCmd) - audioStreamCmd.AddCommand(audioStreamGetBufferSizeInFramesCmd) - audioStreamCmd.AddCommand(audioStreamChannelCountCmd) - audioStreamCmd.AddCommand(audioStreamGetDeviceIDCmd) - audioStreamCmd.AddCommand(audioStreamFramesPerBurstCmd) - audioStreamCmd.AddCommand(audioStreamGetFramesPerDataCallbackCmd) - audioStreamCmd.AddCommand(audioStreamGetFramesReadCmd) - audioStreamCmd.AddCommand(audioStreamGetFramesWrittenCmd) - audioStreamCmd.AddCommand(audioStreamGetHardwareChannelCountCmd) - audioStreamCmd.AddCommand(audioStreamGetHardwareSampleRateCmd) - audioStreamCmd.AddCommand(audioStreamSampleRateCmd) - audioStreamCmd.AddCommand(audioStreamGetSamplesPerFrameCmd) - audioStreamCmd.AddCommand(audioStreamStateCmd) - audioStreamCmd.AddCommand(audioStreamXRunCountCmd) - audioStreamCmd.AddCommand(audioStreamIsContentSpatializedCmd) - audioStreamCmd.AddCommand(audioStreamIsPrivacySensitiveCmd) - audioStreamCmd.AddCommand(audioStreamFlushCmd) - audioStreamCmd.AddCommand(audioStreamPauseCmd) - audioStreamCmd.AddCommand(audioStreamStartCmd) - audioStreamCmd.AddCommand(audioStreamStopCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderNewCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderOpenCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetAttributionTagCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetBufferCapacityInFramesCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetChannelCountCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetDeviceIDCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetDirectionCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetFormatCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetFramesPerDataCallbackCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetIsContentSpatializedCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetPackageNameCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetPerformanceModeCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetPrivacySensitiveCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetSampleRateCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetSamplesPerFrameCmd) - audioStreamBuilderCmd.AddCommand(audioStreamBuilderSetSharingModeCmd) - audioStreamStateCmd2.AddCommand(audioStreamStateStringCmd) - rootCmd.AddCommand(audioCmd) -} diff --git a/cmd/ndkcli/audio_workflow.go b/cmd/ndkcli/audio_workflow.go deleted file mode 100644 index 41d81f9..0000000 --- a/cmd/ndkcli/audio_workflow.go +++ /dev/null @@ -1,175 +0,0 @@ -package main - -import ( - "fmt" - "io" - "os" - "time" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/audio" -) - -var audioRecordCmd = &cobra.Command{ - Use: "record", - Short: "Record raw PCM16 audio to a file", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - output, _ := cmd.Flags().GetString("output") - duration, _ := cmd.Flags().GetDuration("duration") - sampleRate, _ := cmd.Flags().GetInt32("sample-rate") - channels, _ := cmd.Flags().GetInt32("channels") - - builder, err := audio.NewStreamBuilder() - if err != nil { - return fmt.Errorf("creating stream builder: %w", err) - } - defer builder.Close() - - builder. - SetDirection(audio.Input). - SetSampleRate(sampleRate). - SetChannelCount(channels). - SetFormat(audio.PcmI16) - - stream, err := builder.Open() - if err != nil { - return fmt.Errorf("opening stream: %w", err) - } - defer func() { - if closeErr := stream.Close(); closeErr != nil && _err == nil { - _err = fmt.Errorf("closing stream: %w", closeErr) - } - }() - - if err := stream.Start(); err != nil { - return fmt.Errorf("starting stream: %w", err) - } - defer func() { - if stopErr := stream.Stop(); stopErr != nil && _err == nil { - _err = fmt.Errorf("stopping stream: %w", stopErr) - } - }() - - f, err := os.Create(output) - if err != nil { - return fmt.Errorf("creating output file: %w", err) - } - defer f.Close() - - framesPerBurst := stream.FramesPerBurst() - // PCM16: 2 bytes per sample per channel - bytesPerFrame := channels * 2 - buf := make([]byte, framesPerBurst*bytesPerFrame) - timeout := 100 * time.Millisecond - - deadline := time.Now().Add(duration) - var totalFrames int64 - for time.Now().Before(deadline) { - framesRead, err := stream.Read(buf, framesPerBurst, timeout) - if err != nil { - return fmt.Errorf("reading from stream: %w", err) - } - if framesRead > 0 { - bytesRead := framesRead * bytesPerFrame - if _, err := f.Write(buf[:bytesRead]); err != nil { - return fmt.Errorf("writing to file: %w", err) - } - totalFrames += int64(framesRead) - } - } - - fmt.Printf("recorded %d frames (%d bytes) to %s\n", totalFrames, totalFrames*int64(bytesPerFrame), output) - return nil - }, -} - -var audioPlayCmd = &cobra.Command{ - Use: "play", - Short: "Play raw PCM16 audio from a file", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - input, _ := cmd.Flags().GetString("input") - sampleRate, _ := cmd.Flags().GetInt32("sample-rate") - channels, _ := cmd.Flags().GetInt32("channels") - - builder, err := audio.NewStreamBuilder() - if err != nil { - return fmt.Errorf("creating stream builder: %w", err) - } - defer builder.Close() - - builder. - SetDirection(audio.Output). - SetSampleRate(sampleRate). - SetChannelCount(channels). - SetFormat(audio.PcmI16) - - stream, err := builder.Open() - if err != nil { - return fmt.Errorf("opening stream: %w", err) - } - defer func() { - if closeErr := stream.Close(); closeErr != nil && _err == nil { - _err = fmt.Errorf("closing stream: %w", closeErr) - } - }() - - if err := stream.Start(); err != nil { - return fmt.Errorf("starting stream: %w", err) - } - defer func() { - if stopErr := stream.Stop(); stopErr != nil && _err == nil { - _err = fmt.Errorf("stopping stream: %w", stopErr) - } - }() - - f, err := os.Open(input) - if err != nil { - return fmt.Errorf("opening input file: %w", err) - } - defer f.Close() - - framesPerBurst := stream.FramesPerBurst() - // PCM16: 2 bytes per sample per channel - bytesPerFrame := channels * 2 - buf := make([]byte, framesPerBurst*bytesPerFrame) - timeout := 100 * time.Millisecond - - var totalFrames int64 - for { - n, err := f.Read(buf) - switch { - case err == nil: - case err == io.EOF: - fmt.Printf("played %d frames from %s\n", totalFrames, input) - return nil - default: - return fmt.Errorf("reading from file: %w", err) - } - - framesToWrite := int32(n) / bytesPerFrame - if framesToWrite == 0 { - continue - } - - framesWritten, err := stream.Write(buf[:framesToWrite*bytesPerFrame], framesToWrite, timeout) - if err != nil { - return fmt.Errorf("writing to stream: %w", err) - } - totalFrames += int64(framesWritten) - } - }, -} - -func init() { - audioRecordCmd.Flags().String("output", "recording.pcm", "output file path") - audioRecordCmd.Flags().Duration("duration", 5*time.Second, "recording duration") - audioRecordCmd.Flags().Int32("sample-rate", 44100, "sample rate in Hz") - audioRecordCmd.Flags().Int32("channels", 1, "number of audio channels") - - audioPlayCmd.Flags().String("input", "recording.pcm", "input file path") - audioPlayCmd.Flags().Int32("sample-rate", 44100, "sample rate in Hz") - audioPlayCmd.Flags().Int32("channels", 1, "number of audio channels") - - audioCmd.AddCommand(audioRecordCmd) - audioCmd.AddCommand(audioPlayCmd) -} diff --git a/cmd/ndkcli/binder_gen.go b/cmd/ndkcli/binder_gen.go deleted file mode 100644 index 6f4a457..0000000 --- a/cmd/ndkcli/binder_gen.go +++ /dev/null @@ -1,312 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/binder" -) - -var binderCmd = &cobra.Command{ - Use: "binder", - Short: "binder NDK module", -} - -var binderBinderCmd = &cobra.Command{ - Use: "binder", - Short: "Binder operations", -} - -var binderClassCmd = &cobra.Command{ - Use: "class", - Short: "Class operations", -} - -var binderErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var binderIBinder_WeakCmd = &cobra.Command{ - Use: "i-binder_-weak", - Short: "IBinder_Weak operations", -} - -var binderParcelCmd = &cobra.Command{ - Use: "parcel", - Short: "Parcel operations", -} - -var binderStatusCmd = &cobra.Command{ - Use: "status", - Short: "Status operations", -} - -var binderAStatus_fromServiceSpecificErrorCmd = &cobra.Command{ - Use: "a-status_from-service-specific-error", - Short: "binder.AStatus_fromServiceSpecificError()", - RunE: func(cmd *cobra.Command, args []string) error { - serviceSpecific, _ := cmd.Flags().GetInt32("service-specific") - result := binder.AStatus_fromServiceSpecificError(serviceSpecific) - fmt.Println(result) - return nil - }, -} - -var binderAStatus_fromServiceSpecificErrorWithMessageCmd = &cobra.Command{ - Use: "a-status_from-service-specific-error-with-message", - Short: "binder.AStatus_fromServiceSpecificErrorWithMessage()", - RunE: func(cmd *cobra.Command, args []string) error { - serviceSpecific, _ := cmd.Flags().GetInt32("service-specific") - message, _ := cmd.Flags().GetString("message") - result := binder.AStatus_fromServiceSpecificErrorWithMessage(serviceSpecific, message) - fmt.Println(result) - return nil - }, -} - -var binderAStatus_newOkCmd = &cobra.Command{ - Use: "a-status_new-ok", - Short: "binder.AStatus_newOk()", - RunE: func(cmd *cobra.Command, args []string) error { - result := binder.AStatus_newOk() - fmt.Println(result) - return nil - }, -} - -var binderAIBinder_isHandlingTransactionCmd = &cobra.Command{ - Use: "ai-binder_is-handling-transaction", - Short: "binder.AIBinder_isHandlingTransaction()", - RunE: func(cmd *cobra.Command, args []string) error { - result := binder.AIBinder_isHandlingTransaction() - fmt.Println(result) - return nil - }, -} - -var binderAStatus_deleteDescriptionCmd = &cobra.Command{ - Use: "a-status_delete-description", - Short: "binder.AStatus_deleteDescription()", - RunE: func(cmd *cobra.Command, args []string) error { - description, _ := cmd.Flags().GetString("description") - binder.AStatus_deleteDescription(description) - fmt.Println("ok") - return nil - }, -} - -var binderBinderDebugGetRefCountCmd = &cobra.Command{ - Use: "debug-get-ref-count", - Short: "Binder.DebugGetRefCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderBinderGetClassCmd = &cobra.Command{ - Use: "get-class", - Short: "Binder.GetClass()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderBinderGetUserDataCmd = &cobra.Command{ - Use: "get-user-data", - Short: "Binder.GetUserData()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderBinderIncStrongCmd = &cobra.Command{ - Use: "inc-strong", - Short: "Binder.IncStrong()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderBinderIsAliveCmd = &cobra.Command{ - Use: "is-alive", - Short: "Binder.IsAlive()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderBinderIsRemoteCmd = &cobra.Command{ - Use: "is-remote", - Short: "Binder.IsRemote()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderClassDisableInterfaceTokenHeaderCmd = &cobra.Command{ - Use: "disable-interface-token-header", - Short: "Class.DisableInterfaceTokenHeader()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderClassGetDescriptorCmd = &cobra.Command{ - Use: "get-descriptor", - Short: "Class.GetDescriptor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderIBinder_WeakCloneCmd = &cobra.Command{ - Use: "clone", - Short: "IBinder_Weak.Clone()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderIBinder_WeakPromoteCmd = &cobra.Command{ - Use: "promote", - Short: "IBinder_Weak.Promote()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderParcelNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Parcel", - RunE: func(cmd *cobra.Command, args []string) error { - obj := binder.NewParcel() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var binderParcelGetDataPositionCmd = &cobra.Command{ - Use: "get-data-position", - Short: "Parcel.GetDataPosition()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := binder.NewParcel() - defer obj.Close() - err := obj.GetDataPosition() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var binderParcelGetDataSizeCmd = &cobra.Command{ - Use: "get-data-size", - Short: "Parcel.GetDataSize()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := binder.NewParcel() - defer obj.Close() - err := obj.GetDataSize() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var binderStatusGetDescriptionCmd = &cobra.Command{ - Use: "get-description", - Short: "Status.GetDescription()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderStatusGetMessageCmd = &cobra.Command{ - Use: "get-message", - Short: "Status.GetMessage()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderStatusGetServiceSpecificErrorCmd = &cobra.Command{ - Use: "get-service-specific-error", - Short: "Status.GetServiceSpecificError()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderStatusIsOkCmd = &cobra.Command{ - Use: "is-ok", - Short: "Status.IsOk()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - binderAStatus_fromServiceSpecificErrorCmd.Flags().Int32("service-specific", 0, "serviceSpecific") - binderAStatus_fromServiceSpecificErrorWithMessageCmd.Flags().Int32("service-specific", 0, "serviceSpecific") - binderAStatus_fromServiceSpecificErrorWithMessageCmd.Flags().String("message", "", "message") - binderAStatus_deleteDescriptionCmd.Flags().String("description", "", "description") - binderCmd.AddCommand(binderBinderCmd) - binderCmd.AddCommand(binderClassCmd) - binderCmd.AddCommand(binderErrorCmd) - binderCmd.AddCommand(binderIBinder_WeakCmd) - binderCmd.AddCommand(binderParcelCmd) - binderCmd.AddCommand(binderStatusCmd) - binderCmd.AddCommand(binderAStatus_fromServiceSpecificErrorCmd) - binderCmd.AddCommand(binderAStatus_fromServiceSpecificErrorWithMessageCmd) - binderCmd.AddCommand(binderAStatus_newOkCmd) - binderCmd.AddCommand(binderAIBinder_isHandlingTransactionCmd) - binderCmd.AddCommand(binderAStatus_deleteDescriptionCmd) - binderBinderCmd.AddCommand(binderBinderDebugGetRefCountCmd) - binderBinderCmd.AddCommand(binderBinderGetClassCmd) - binderBinderCmd.AddCommand(binderBinderGetUserDataCmd) - binderBinderCmd.AddCommand(binderBinderIncStrongCmd) - binderBinderCmd.AddCommand(binderBinderIsAliveCmd) - binderBinderCmd.AddCommand(binderBinderIsRemoteCmd) - binderClassCmd.AddCommand(binderClassDisableInterfaceTokenHeaderCmd) - binderClassCmd.AddCommand(binderClassGetDescriptorCmd) - binderErrorCmd.AddCommand(binderErrorErrorCmd) - binderIBinder_WeakCmd.AddCommand(binderIBinder_WeakCloneCmd) - binderIBinder_WeakCmd.AddCommand(binderIBinder_WeakPromoteCmd) - binderParcelCmd.AddCommand(binderParcelNewCmd) - binderParcelCmd.AddCommand(binderParcelGetDataPositionCmd) - binderParcelCmd.AddCommand(binderParcelGetDataSizeCmd) - binderStatusCmd.AddCommand(binderStatusGetDescriptionCmd) - binderStatusCmd.AddCommand(binderStatusGetMessageCmd) - binderStatusCmd.AddCommand(binderStatusGetServiceSpecificErrorCmd) - binderStatusCmd.AddCommand(binderStatusIsOkCmd) - rootCmd.AddCommand(binderCmd) -} diff --git a/cmd/ndkcli/binderprocess_gen.go b/cmd/ndkcli/binderprocess_gen.go deleted file mode 100644 index 3fbde9e..0000000 --- a/cmd/ndkcli/binderprocess_gen.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/binderprocess" -) - -var binderprocessCmd = &cobra.Command{ - Use: "binderprocess", - Short: "binderprocess NDK module", -} - -var binderprocessErrDLOpenLibbinderNDKCmd = &cobra.Command{ - Use: "err-dl-open-libbinder-ndk", - Short: "ErrDLOpenLibbinderNDK operations", -} - -var binderprocessErrSymbolSetThreadPoolMaxCmd = &cobra.Command{ - Use: "err-symbol-set-thread-pool-max", - Short: "ErrSymbolSetThreadPoolMax operations", -} - -var binderprocessErrSymbolStartThreadPoolCmd = &cobra.Command{ - Use: "err-symbol-start-thread-pool", - Short: "ErrSymbolStartThreadPool operations", -} - -var binderprocessStartThreadPoolCmd = &cobra.Command{ - Use: "start-thread-pool", - Short: "binderprocess.StartThreadPool()", - RunE: func(cmd *cobra.Command, args []string) error { - threads, _ := cmd.Flags().GetInt("threads") - err := binderprocess.StartThreadPool(threads) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var binderprocessErrDLOpenLibbinderNDKErrorCmd = &cobra.Command{ - Use: "error", - Short: "ErrDLOpenLibbinderNDK.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderprocessErrSymbolSetThreadPoolMaxErrorCmd = &cobra.Command{ - Use: "error", - Short: "ErrSymbolSetThreadPoolMax.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var binderprocessErrSymbolStartThreadPoolErrorCmd = &cobra.Command{ - Use: "error", - Short: "ErrSymbolStartThreadPool.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - binderprocessStartThreadPoolCmd.Flags().Int("threads", 0, "threads") - binderprocessCmd.AddCommand(binderprocessErrDLOpenLibbinderNDKCmd) - binderprocessCmd.AddCommand(binderprocessErrSymbolSetThreadPoolMaxCmd) - binderprocessCmd.AddCommand(binderprocessErrSymbolStartThreadPoolCmd) - binderprocessCmd.AddCommand(binderprocessStartThreadPoolCmd) - binderprocessErrDLOpenLibbinderNDKCmd.AddCommand(binderprocessErrDLOpenLibbinderNDKErrorCmd) - binderprocessErrSymbolSetThreadPoolMaxCmd.AddCommand(binderprocessErrSymbolSetThreadPoolMaxErrorCmd) - binderprocessErrSymbolStartThreadPoolCmd.AddCommand(binderprocessErrSymbolStartThreadPoolErrorCmd) - rootCmd.AddCommand(binderprocessCmd) -} diff --git a/cmd/ndkcli/bitmap_gen.go b/cmd/ndkcli/bitmap_gen.go deleted file mode 100644 index bae8863..0000000 --- a/cmd/ndkcli/bitmap_gen.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var bitmapCmd = &cobra.Command{ - Use: "bitmap", - Short: "bitmap NDK module", -} - -var bitmapErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var bitmapErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - bitmapCmd.AddCommand(bitmapErrorCmd) - bitmapErrorCmd.AddCommand(bitmapErrorErrorCmd) - rootCmd.AddCommand(bitmapCmd) -} diff --git a/cmd/ndkcli/camera_gen.go b/cmd/ndkcli/camera_gen.go deleted file mode 100644 index 82c6dd7..0000000 --- a/cmd/ndkcli/camera_gen.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/camera" -) - -var cameraCmd = &cobra.Command{ - Use: "camera", - Short: "camera NDK module", -} - -var cameraCaptureRequestCmd = &cobra.Command{ - Use: "capture-request", - Short: "CaptureRequest operations", -} - -var cameraCaptureSessionCmd = &cobra.Command{ - Use: "capture-session", - Short: "CaptureSession operations", -} - -var cameraDeviceCmd = &cobra.Command{ - Use: "device", - Short: "Device operations", -} - -var cameraErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var cameraManagerCmd = &cobra.Command{ - Use: "manager", - Short: "Manager operations", -} - -var cameraMetadataCmd = &cobra.Command{ - Use: "metadata", - Short: "Metadata operations", -} - -var cameraSessionOutputContainerCmd = &cobra.Command{ - Use: "session-output-container", - Short: "SessionOutputContainer operations", -} - -var cameraCaptureRequestCopyCmd = &cobra.Command{ - Use: "copy", - Short: "CaptureRequest.Copy()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var cameraCaptureSessionStopRepeatingCmd = &cobra.Command{ - Use: "stop-repeating", - Short: "CaptureSession.StopRepeating()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var cameraDeviceCreateCaptureRequestCmd = &cobra.Command{ - Use: "create-capture-request", - Short: "Device.CreateCaptureRequest()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var cameraDeviceGetIDCmd = &cobra.Command{ - Use: "get-id", - Short: "Device.GetID()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var cameraErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var cameraManagerNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Manager", - RunE: func(cmd *cobra.Command, args []string) error { - obj := camera.NewManager() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var cameraManagerGetCameraCharacteristicsCmd = &cobra.Command{ - Use: "get-camera-characteristics", - Short: "Manager.GetCameraCharacteristics()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := camera.NewManager() - defer obj.Close() - cameraID, _ := cmd.Flags().GetString("camera-id") - result, err := obj.GetCameraCharacteristics(cameraID) - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var cameraManagerCameraIDListCmd = &cobra.Command{ - Use: "camera-id-list", - Short: "Manager.CameraIDList()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := camera.NewManager() - defer obj.Close() - result, err := obj.CameraIDList() - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var cameraMetadataCopyCmd = &cobra.Command{ - Use: "copy", - Short: "Metadata.Copy()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var cameraMetadataI32AtCmd = &cobra.Command{ - Use: "i32-at", - Short: "Metadata.I32At()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var cameraMetadataI32CountCmd = &cobra.Command{ - Use: "i32-count", - Short: "Metadata.I32Count()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var cameraSessionOutputContainerNewCmd = &cobra.Command{ - Use: "new", - Short: "Create SessionOutputContainer", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := camera.NewSessionOutputContainer() - if err != nil { - return err - } - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -func init() { - cameraManagerGetCameraCharacteristicsCmd.Flags().String("camera-id", "", "cameraID") - cameraCmd.AddCommand(cameraCaptureRequestCmd) - cameraCmd.AddCommand(cameraCaptureSessionCmd) - cameraCmd.AddCommand(cameraDeviceCmd) - cameraCmd.AddCommand(cameraErrorCmd) - cameraCmd.AddCommand(cameraManagerCmd) - cameraCmd.AddCommand(cameraMetadataCmd) - cameraCmd.AddCommand(cameraSessionOutputContainerCmd) - cameraCaptureRequestCmd.AddCommand(cameraCaptureRequestCopyCmd) - cameraCaptureSessionCmd.AddCommand(cameraCaptureSessionStopRepeatingCmd) - cameraDeviceCmd.AddCommand(cameraDeviceCreateCaptureRequestCmd) - cameraDeviceCmd.AddCommand(cameraDeviceGetIDCmd) - cameraErrorCmd.AddCommand(cameraErrorErrorCmd) - cameraManagerCmd.AddCommand(cameraManagerNewCmd) - cameraManagerCmd.AddCommand(cameraManagerGetCameraCharacteristicsCmd) - cameraManagerCmd.AddCommand(cameraManagerCameraIDListCmd) - cameraMetadataCmd.AddCommand(cameraMetadataCopyCmd) - cameraMetadataCmd.AddCommand(cameraMetadataI32AtCmd) - cameraMetadataCmd.AddCommand(cameraMetadataI32CountCmd) - cameraSessionOutputContainerCmd.AddCommand(cameraSessionOutputContainerNewCmd) - rootCmd.AddCommand(cameraCmd) -} diff --git a/cmd/ndkcli/camera_workflow.go b/cmd/ndkcli/camera_workflow.go deleted file mode 100644 index d0f214d..0000000 --- a/cmd/ndkcli/camera_workflow.go +++ /dev/null @@ -1,298 +0,0 @@ -package main - -import ( - "fmt" - "os" - "sync" - "time" - "unsafe" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/camera" - "github.com/AndroidGoLab/ndk/looper" - "github.com/AndroidGoLab/ndk/media" - "github.com/AndroidGoLab/ndk/window" -) - -// cameraTagLensFacing is ACAMERA_LENS_FACING from the NDK header. -const cameraTagLensFacing = 524293 - -// cameraTagInfoSupportedHardwareLevel is ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL. -const cameraTagInfoSupportedHardwareLevel = 1376256 - -func lensFacingString(value int32) string { - switch value { - case 0: - return "front" - case 1: - return "back" - case 2: - return "external" - default: - return fmt.Sprintf("unknown(%d)", value) - } -} - -func hardwareLevelString(value int32) string { - switch value { - case 0: - return "limited" - case 1: - return "full" - case 2: - return "legacy" - case 3: - return "level_3" - case 4: - return "external" - default: - return fmt.Sprintf("unknown(%d)", value) - } -} - -// imageFormatYUV420888 is AIMAGE_FORMAT_YUV_420_888 from the NDK header. -const imageFormatYUV420888 = 35 - -var cameraCaptureCmd = &cobra.Command{ - Use: "capture", - Short: "Capture raw frames from a camera using ImageReader", - Long: `Captures N raw image frames from the specified camera device. -Frames are written sequentially to the output file as raw pixel data. -Uses the camera2 NDK pipeline: ImageReader -> OutputTarget -> CaptureSession. -Runs on a looper thread so Camera2 callbacks are dispatched correctly.`, - RunE: func(cmd *cobra.Command, args []string) (_err error) { - cameraID, _ := cmd.Flags().GetString("id") - width, _ := cmd.Flags().GetInt32("width") - height, _ := cmd.Flags().GetInt32("height") - format, _ := cmd.Flags().GetInt32("format") - count, _ := cmd.Flags().GetInt32("count") - output, _ := cmd.Flags().GetString("output") - - // Run the entire capture pipeline on a looper thread. - // Camera2 NDK dispatches session callbacks (OnReady, OnActive) - // on the calling thread's looper — without one, callbacks never - // fire and the session never produces frames. - looper.Run(func(lp *looper.Looper) { - _err = runCameraCapture(lp, cameraID, width, height, format, count, output) - }) - return _err - }, -} - -func runCameraCapture( - lp *looper.Looper, - cameraID string, - width int32, - height int32, - format int32, - count int32, - output string, -) (_err error) { - // Create ImageReader with CPU_READ_OFTEN usage for frame access. - const usageCPUReadOften = uint64(0x3) // AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN - var maxImages int32 = 4 - reader, err := media.NewImageReaderWithUsage(width, height, format, usageCPUReadOften, maxImages) - if err != nil { - return fmt.Errorf("creating image reader: %w", err) - } - defer reader.Close() - - // Get ANativeWindow from the ImageReader. - win, err := reader.Window() - if err != nil { - return fmt.Errorf("getting window from image reader: %w", err) - } - - // Acquire a reference to the window (required before creating session outputs). - // The media.Window and window.Window are separate wrapper types for the same - // underlying ANativeWindow. Convert via unsafe.Pointer for the camera API. - nw := window.NewWindowFromPointer(win.Pointer()) - nw.Acquire() - camWindow := (*camera.ANativeWindow)(win.Pointer()) - - mgr := camera.NewManager() - defer mgr.Close() - - outputTarget, err := camera.NewOutputTarget(camWindow) - if err != nil { - return fmt.Errorf("creating output target: %w", err) - } - defer outputTarget.Close() - - sessionOutput, err := camera.NewSessionOutput(camWindow) - if err != nil { - return fmt.Errorf("creating session output: %w", err) - } - defer sessionOutput.Close() - - container, err := camera.NewSessionOutputContainer() - if err != nil { - return fmt.Errorf("creating session output container: %w", err) - } - defer container.Close() - - if err := container.Add(sessionOutput); err != nil { - return fmt.Errorf("adding session output to container: %w", err) - } - - fmt.Println("opening camera...") - device, err := mgr.OpenCamera(cameraID, camera.DeviceStateCallbacks{ - OnDisconnected: func() { fmt.Println("callback: camera disconnected") }, - OnError: func(code int) { fmt.Printf("callback: camera error %d\n", code) }, - }) - if err != nil { - return fmt.Errorf("opening camera %q: %w", cameraID, err) - } - defer device.Close() - - request, err := device.CreateCaptureRequest(camera.Record) - if err != nil { - return fmt.Errorf("creating capture request: %w", err) - } - defer request.Close() - - request.AddTarget(outputTarget) - - // Use a WaitGroup to block until the session reports ready. - var wg sync.WaitGroup - wg.Add(1) - var readyOnce sync.Once - - fmt.Println("creating capture session...") - session, err := device.CreateCaptureSession(container, camera.SessionStateCallbacks{ - OnClosed: func() { fmt.Println("callback: session closed") }, - OnReady: func() { - fmt.Println("callback: session ready") - readyOnce.Do(wg.Done) - }, - OnActive: func() { fmt.Println("callback: session active") }, - }) - if err != nil { - return fmt.Errorf("creating capture session: %w", err) - } - defer session.Close() - - // Wait for the session to become ready. Camera2 dispatches callbacks - // on its own internal thread — we just need to wait for OnReady. - fmt.Println("waiting for session ready...") - done := make(chan struct{}) - go func() { - wg.Wait() - close(done) - }() - - select { - case <-done: - // Session is ready. - case <-time.After(10 * time.Second): - return fmt.Errorf("timeout waiting for camera session to become ready") - } - - fmt.Println("camera session ready") - - if err := session.SetRepeatingRequest(request); err != nil { - return fmt.Errorf("setting repeating request: %w", err) - } - defer func() { - if stopErr := session.StopRepeating(); stopErr != nil && _err == nil { - _err = fmt.Errorf("stopping repeating request: %w", stopErr) - } - }() - - f, err := os.Create(output) - if err != nil { - return fmt.Errorf("creating output file: %w", err) - } - defer f.Close() - - // Acquire and write frames. Poll the looper between acquires - // to keep Camera2 callbacks flowing. - var totalBytes int64 - for i := int32(0); i < count; i++ { - var img *media.Image - var acquireErr error - - for retries := 0; retries < 200; retries++ { - img, acquireErr = reader.AcquireNextImage() - if acquireErr == nil { - break - } - // Poll looper to let Camera2 process internally. - looper.PollOnce(16*time.Millisecond, nil, nil, nil) - } - if acquireErr != nil { - return fmt.Errorf("acquiring image %d: %w", i, acquireErr) - } - - dataPtr, dataLen, err := img.PlaneData(0) - if err != nil { - img.Close() - return fmt.Errorf("getting plane data for image %d: %w", i, err) - } - - data := unsafe.Slice(dataPtr, dataLen) - if _, err := f.Write(data); err != nil { - img.Close() - return fmt.Errorf("writing image %d to file: %w", i, err) - } - totalBytes += int64(dataLen) - - img.Close() - fmt.Printf("captured frame %d/%d (%d bytes)\n", i+1, count, dataLen) - } - - fmt.Printf("captured %d frames (%d bytes total) to %s\n", count, totalBytes, output) - return nil -} - -var cameraListDetailsCmd = &cobra.Command{ - Use: "list-details", - Short: "List all cameras with full characteristics", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - mgr := camera.NewManager() - defer mgr.Close() - - ids, err := mgr.CameraIDList() - if err != nil { - return fmt.Errorf("getting camera ID list: %w", err) - } - - if len(ids) == 0 { - fmt.Println("no cameras found") - return nil - } - - for _, id := range ids { - meta, err := mgr.GetCameraCharacteristics(id) - if err != nil { - fmt.Printf("camera %s: error getting characteristics: %v\n", id, err) - continue - } - - facing := meta.I32At(uint32(cameraTagLensFacing), 0) - orientation := meta.I32At(uint32(camera.SensorOrientation), 0) - hwLevel := meta.I32At(uint32(cameraTagInfoSupportedHardwareLevel), 0) - - fmt.Printf("camera %s:\n", id) - fmt.Printf(" lens facing: %s\n", lensFacingString(facing)) - fmt.Printf(" orientation: %d degrees\n", orientation) - fmt.Printf(" hardware level: %s\n", hardwareLevelString(hwLevel)) - - meta.Close() - } - - return nil - }, -} - -func init() { - cameraCaptureCmd.Flags().String("id", "0", "camera device ID") - cameraCaptureCmd.Flags().Int32("width", 640, "image width in pixels") - cameraCaptureCmd.Flags().Int32("height", 480, "image height in pixels") - cameraCaptureCmd.Flags().Int32("format", imageFormatYUV420888, "image format (35=YUV_420_888, 256=JPEG)") - cameraCaptureCmd.Flags().Int32("count", 1, "number of frames to capture") - cameraCaptureCmd.Flags().String("output", "capture.raw", "output file path") - - cameraCmd.AddCommand(cameraCaptureCmd) - cameraCmd.AddCommand(cameraListDetailsCmd) -} diff --git a/cmd/ndkcli/choreographer_gen.go b/cmd/ndkcli/choreographer_gen.go deleted file mode 100644 index dffe91e..0000000 --- a/cmd/ndkcli/choreographer_gen.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/choreographer" -) - -var choreographerCmd = &cobra.Command{ - Use: "choreographer", - Short: "choreographer NDK module", -} - -var choreographerChoreographerCmd = &cobra.Command{ - Use: "choreographer", - Short: "Choreographer operations", -} - -var choreographerChoreographerFrameCallbackDataCmd = &cobra.Command{ - Use: "choreographer-frame-callback-data", - Short: "ChoreographerFrameCallbackData operations", -} - -var choreographerErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var choreographerChoreographerNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Choreographer", - RunE: func(cmd *cobra.Command, args []string) error { - _ = choreographer.GetInstance() - fmt.Println("created successfully") - return nil - }, -} - -var choreographerChoreographerFrameCallbackDataGetFrameTimeNanosCmd = &cobra.Command{ - Use: "get-frame-time-nanos", - Short: "ChoreographerFrameCallbackData.GetFrameTimeNanos()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var choreographerChoreographerFrameCallbackDataGetFrameTimelineDeadlineNanosCmd = &cobra.Command{ - Use: "get-frame-timeline-deadline-nanos", - Short: "ChoreographerFrameCallbackData.GetFrameTimelineDeadlineNanos()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var choreographerChoreographerFrameCallbackDataGetFrameTimelineExpectedPresentationTimeNanosCmd = &cobra.Command{ - Use: "get-frame-timeline-expected-presentation-time-nanos", - Short: "ChoreographerFrameCallbackData.GetFrameTimelineExpectedPresentationTimeNanos()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var choreographerChoreographerFrameCallbackDataGetFrameTimelinesLengthCmd = &cobra.Command{ - Use: "get-frame-timelines-length", - Short: "ChoreographerFrameCallbackData.GetFrameTimelinesLength()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var choreographerChoreographerFrameCallbackDataGetPreferredFrameTimelineIndexCmd = &cobra.Command{ - Use: "get-preferred-frame-timeline-index", - Short: "ChoreographerFrameCallbackData.GetPreferredFrameTimelineIndex()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var choreographerErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - choreographerCmd.AddCommand(choreographerChoreographerCmd) - choreographerCmd.AddCommand(choreographerChoreographerFrameCallbackDataCmd) - choreographerCmd.AddCommand(choreographerErrorCmd) - choreographerChoreographerCmd.AddCommand(choreographerChoreographerNewCmd) - choreographerChoreographerFrameCallbackDataCmd.AddCommand(choreographerChoreographerFrameCallbackDataGetFrameTimeNanosCmd) - choreographerChoreographerFrameCallbackDataCmd.AddCommand(choreographerChoreographerFrameCallbackDataGetFrameTimelineDeadlineNanosCmd) - choreographerChoreographerFrameCallbackDataCmd.AddCommand(choreographerChoreographerFrameCallbackDataGetFrameTimelineExpectedPresentationTimeNanosCmd) - choreographerChoreographerFrameCallbackDataCmd.AddCommand(choreographerChoreographerFrameCallbackDataGetFrameTimelinesLengthCmd) - choreographerChoreographerFrameCallbackDataCmd.AddCommand(choreographerChoreographerFrameCallbackDataGetPreferredFrameTimelineIndexCmd) - choreographerErrorCmd.AddCommand(choreographerErrorErrorCmd) - rootCmd.AddCommand(choreographerCmd) -} diff --git a/cmd/ndkcli/config_gen.go b/cmd/ndkcli/config_gen.go deleted file mode 100644 index 49d1581..0000000 --- a/cmd/ndkcli/config_gen.go +++ /dev/null @@ -1,700 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/config" -) - -var configCmd = &cobra.Command{ - Use: "config", - Short: "config NDK module", -} - -var configConfigCmd = &cobra.Command{ - Use: "config", - Short: "Config operations", -} - -var configErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var configConfigNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Config", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var configConfigCountryCmd = &cobra.Command{ - Use: "country", - Short: "Config.Country()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - outCountry, _ := cmd.Flags().GetString("out-country") - obj.Country(outCountry) - fmt.Println("ok") - return nil - }, -} - -var configConfigDensityCmd = &cobra.Command{ - Use: "density", - Short: "Config.Density()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - result := obj.Density() - fmt.Println(result) - return nil - }, -} - -var configConfigGetGrammaticalGenderCmd = &cobra.Command{ - Use: "get-grammatical-gender", - Short: "Config.GetGrammaticalGender()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetGrammaticalGender() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetKeyboardCmd = &cobra.Command{ - Use: "get-keyboard", - Short: "Config.GetKeyboard()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetKeyboard() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetKeysHiddenCmd = &cobra.Command{ - Use: "get-keys-hidden", - Short: "Config.GetKeysHidden()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetKeysHidden() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigLanguageCmd = &cobra.Command{ - Use: "language", - Short: "Config.Language()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - outLanguage, _ := cmd.Flags().GetString("out-language") - obj.Language(outLanguage) - fmt.Println("ok") - return nil - }, -} - -var configConfigGetLayoutDirectionCmd = &cobra.Command{ - Use: "get-layout-direction", - Short: "Config.GetLayoutDirection()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetLayoutDirection() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetMccCmd = &cobra.Command{ - Use: "get-mcc", - Short: "Config.GetMcc()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetMcc() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetMncCmd = &cobra.Command{ - Use: "get-mnc", - Short: "Config.GetMnc()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetMnc() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetNavHiddenCmd = &cobra.Command{ - Use: "get-nav-hidden", - Short: "Config.GetNavHidden()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetNavHidden() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetNavigationCmd = &cobra.Command{ - Use: "get-navigation", - Short: "Config.GetNavigation()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetNavigation() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigOrientationCmd = &cobra.Command{ - Use: "orientation", - Short: "Config.Orientation()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - result := obj.Orientation() - fmt.Println(result) - return nil - }, -} - -var configConfigScreenHeightDpCmd = &cobra.Command{ - Use: "screen-height-dp", - Short: "Config.ScreenHeightDp()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - result := obj.ScreenHeightDp() - fmt.Println(result) - return nil - }, -} - -var configConfigGetScreenLongCmd = &cobra.Command{ - Use: "get-screen-long", - Short: "Config.GetScreenLong()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetScreenLong() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetScreenRoundCmd = &cobra.Command{ - Use: "get-screen-round", - Short: "Config.GetScreenRound()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetScreenRound() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigScreenSizeCmd = &cobra.Command{ - Use: "screen-size", - Short: "Config.ScreenSize()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - result := obj.ScreenSize() - fmt.Println(result) - return nil - }, -} - -var configConfigScreenWidthDpCmd = &cobra.Command{ - Use: "screen-width-dp", - Short: "Config.ScreenWidthDp()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - result := obj.ScreenWidthDp() - fmt.Println(result) - return nil - }, -} - -var configConfigSdkVersionCmd = &cobra.Command{ - Use: "sdk-version", - Short: "Config.SdkVersion()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - result := obj.SdkVersion() - fmt.Println(result) - return nil - }, -} - -var configConfigGetSmallestScreenWidthDpCmd = &cobra.Command{ - Use: "get-smallest-screen-width-dp", - Short: "Config.GetSmallestScreenWidthDp()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetSmallestScreenWidthDp() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetTouchscreenCmd = &cobra.Command{ - Use: "get-touchscreen", - Short: "Config.GetTouchscreen()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetTouchscreen() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetUiModeNightCmd = &cobra.Command{ - Use: "get-ui-mode-night", - Short: "Config.GetUiModeNight()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetUiModeNight() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigGetUiModeTypeCmd = &cobra.Command{ - Use: "get-ui-mode-type", - Short: "Config.GetUiModeType()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - err := obj.GetUiModeType() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var configConfigSetCountryCmd = &cobra.Command{ - Use: "set-country", - Short: "Config.SetCountry()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - country, _ := cmd.Flags().GetString("country") - obj.SetCountry(country) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetDensityCmd = &cobra.Command{ - Use: "set-density", - Short: "Config.SetDensity()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - density, _ := cmd.Flags().GetInt32("density") - obj.SetDensity(density) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetGrammaticalGenderCmd = &cobra.Command{ - Use: "set-grammatical-gender", - Short: "Config.SetGrammaticalGender()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - value, _ := cmd.Flags().GetInt32("value") - obj.SetGrammaticalGender(value) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetKeyboardCmd = &cobra.Command{ - Use: "set-keyboard", - Short: "Config.SetKeyboard()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - keyboard, _ := cmd.Flags().GetInt32("keyboard") - obj.SetKeyboard(keyboard) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetKeysHiddenCmd = &cobra.Command{ - Use: "set-keys-hidden", - Short: "Config.SetKeysHidden()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - keysHidden, _ := cmd.Flags().GetInt32("keys-hidden") - obj.SetKeysHidden(keysHidden) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetLanguageCmd = &cobra.Command{ - Use: "set-language", - Short: "Config.SetLanguage()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - language, _ := cmd.Flags().GetString("language") - obj.SetLanguage(language) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetLayoutDirectionCmd = &cobra.Command{ - Use: "set-layout-direction", - Short: "Config.SetLayoutDirection()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - value, _ := cmd.Flags().GetInt32("value") - obj.SetLayoutDirection(value) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetMccCmd = &cobra.Command{ - Use: "set-mcc", - Short: "Config.SetMcc()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - mcc, _ := cmd.Flags().GetInt32("mcc") - obj.SetMcc(mcc) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetMncCmd = &cobra.Command{ - Use: "set-mnc", - Short: "Config.SetMnc()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - mnc, _ := cmd.Flags().GetInt32("mnc") - obj.SetMnc(mnc) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetNavHiddenCmd = &cobra.Command{ - Use: "set-nav-hidden", - Short: "Config.SetNavHidden()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - navHidden, _ := cmd.Flags().GetInt32("nav-hidden") - obj.SetNavHidden(navHidden) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetNavigationCmd = &cobra.Command{ - Use: "set-navigation", - Short: "Config.SetNavigation()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - navigation, _ := cmd.Flags().GetInt32("navigation") - obj.SetNavigation(navigation) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetOrientationCmd = &cobra.Command{ - Use: "set-orientation", - Short: "Config.SetOrientation()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - orientation, _ := cmd.Flags().GetInt32("orientation") - obj.SetOrientation(config.Orientation(orientation)) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetScreenHeightDpCmd = &cobra.Command{ - Use: "set-screen-height-dp", - Short: "Config.SetScreenHeightDp()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - value, _ := cmd.Flags().GetInt32("value") - obj.SetScreenHeightDp(value) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetScreenLongCmd = &cobra.Command{ - Use: "set-screen-long", - Short: "Config.SetScreenLong()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - screenLong, _ := cmd.Flags().GetInt32("screen-long") - obj.SetScreenLong(screenLong) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetScreenSizeCmd = &cobra.Command{ - Use: "set-screen-size", - Short: "Config.SetScreenSize()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - screenSize, _ := cmd.Flags().GetInt32("screen-size") - obj.SetScreenSize(config.ScreenSize(screenSize)) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetScreenWidthDpCmd = &cobra.Command{ - Use: "set-screen-width-dp", - Short: "Config.SetScreenWidthDp()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - value, _ := cmd.Flags().GetInt32("value") - obj.SetScreenWidthDp(value) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetSdkVersionCmd = &cobra.Command{ - Use: "set-sdk-version", - Short: "Config.SetSdkVersion()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - sdkVersion, _ := cmd.Flags().GetInt32("sdk-version") - obj.SetSdkVersion(sdkVersion) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetSmallestScreenWidthDpCmd = &cobra.Command{ - Use: "set-smallest-screen-width-dp", - Short: "Config.SetSmallestScreenWidthDp()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - value, _ := cmd.Flags().GetInt32("value") - obj.SetSmallestScreenWidthDp(value) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetTouchscreenCmd = &cobra.Command{ - Use: "set-touchscreen", - Short: "Config.SetTouchscreen()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - touchscreen, _ := cmd.Flags().GetInt32("touchscreen") - obj.SetTouchscreen(touchscreen) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetUiModeNightCmd = &cobra.Command{ - Use: "set-ui-mode-night", - Short: "Config.SetUiModeNight()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - uiModeNight, _ := cmd.Flags().GetInt32("ui-mode-night") - obj.SetUiModeNight(uiModeNight) - fmt.Println("ok") - return nil - }, -} - -var configConfigSetUiModeTypeCmd = &cobra.Command{ - Use: "set-ui-mode-type", - Short: "Config.SetUiModeType()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := config.NewConfig() - defer obj.Close() - uiModeType, _ := cmd.Flags().GetInt32("ui-mode-type") - obj.SetUiModeType(uiModeType) - fmt.Println("ok") - return nil - }, -} - -var configErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - configConfigCountryCmd.Flags().String("out-country", "", "outCountry") - configConfigLanguageCmd.Flags().String("out-language", "", "outLanguage") - configConfigSetCountryCmd.Flags().String("country", "", "country") - configConfigSetDensityCmd.Flags().Int32("density", 0, "density") - configConfigSetGrammaticalGenderCmd.Flags().Int32("value", 0, "value") - configConfigSetKeyboardCmd.Flags().Int32("keyboard", 0, "keyboard") - configConfigSetKeysHiddenCmd.Flags().Int32("keys-hidden", 0, "keysHidden") - configConfigSetLanguageCmd.Flags().String("language", "", "language") - configConfigSetLayoutDirectionCmd.Flags().Int32("value", 0, "value") - configConfigSetMccCmd.Flags().Int32("mcc", 0, "mcc") - configConfigSetMncCmd.Flags().Int32("mnc", 0, "mnc") - configConfigSetNavHiddenCmd.Flags().Int32("nav-hidden", 0, "navHidden") - configConfigSetNavigationCmd.Flags().Int32("navigation", 0, "navigation") - configConfigSetOrientationCmd.Flags().Int32("orientation", 0, "orientation") - configConfigSetScreenHeightDpCmd.Flags().Int32("value", 0, "value") - configConfigSetScreenLongCmd.Flags().Int32("screen-long", 0, "screenLong") - configConfigSetScreenSizeCmd.Flags().Int32("screen-size", 0, "screenSize") - configConfigSetScreenWidthDpCmd.Flags().Int32("value", 0, "value") - configConfigSetSdkVersionCmd.Flags().Int32("sdk-version", 0, "sdkVersion") - configConfigSetSmallestScreenWidthDpCmd.Flags().Int32("value", 0, "value") - configConfigSetTouchscreenCmd.Flags().Int32("touchscreen", 0, "touchscreen") - configConfigSetUiModeNightCmd.Flags().Int32("ui-mode-night", 0, "uiModeNight") - configConfigSetUiModeTypeCmd.Flags().Int32("ui-mode-type", 0, "uiModeType") - configCmd.AddCommand(configConfigCmd) - configCmd.AddCommand(configErrorCmd) - configConfigCmd.AddCommand(configConfigNewCmd) - configConfigCmd.AddCommand(configConfigCountryCmd) - configConfigCmd.AddCommand(configConfigDensityCmd) - configConfigCmd.AddCommand(configConfigGetGrammaticalGenderCmd) - configConfigCmd.AddCommand(configConfigGetKeyboardCmd) - configConfigCmd.AddCommand(configConfigGetKeysHiddenCmd) - configConfigCmd.AddCommand(configConfigLanguageCmd) - configConfigCmd.AddCommand(configConfigGetLayoutDirectionCmd) - configConfigCmd.AddCommand(configConfigGetMccCmd) - configConfigCmd.AddCommand(configConfigGetMncCmd) - configConfigCmd.AddCommand(configConfigGetNavHiddenCmd) - configConfigCmd.AddCommand(configConfigGetNavigationCmd) - configConfigCmd.AddCommand(configConfigOrientationCmd) - configConfigCmd.AddCommand(configConfigScreenHeightDpCmd) - configConfigCmd.AddCommand(configConfigGetScreenLongCmd) - configConfigCmd.AddCommand(configConfigGetScreenRoundCmd) - configConfigCmd.AddCommand(configConfigScreenSizeCmd) - configConfigCmd.AddCommand(configConfigScreenWidthDpCmd) - configConfigCmd.AddCommand(configConfigSdkVersionCmd) - configConfigCmd.AddCommand(configConfigGetSmallestScreenWidthDpCmd) - configConfigCmd.AddCommand(configConfigGetTouchscreenCmd) - configConfigCmd.AddCommand(configConfigGetUiModeNightCmd) - configConfigCmd.AddCommand(configConfigGetUiModeTypeCmd) - configConfigCmd.AddCommand(configConfigSetCountryCmd) - configConfigCmd.AddCommand(configConfigSetDensityCmd) - configConfigCmd.AddCommand(configConfigSetGrammaticalGenderCmd) - configConfigCmd.AddCommand(configConfigSetKeyboardCmd) - configConfigCmd.AddCommand(configConfigSetKeysHiddenCmd) - configConfigCmd.AddCommand(configConfigSetLanguageCmd) - configConfigCmd.AddCommand(configConfigSetLayoutDirectionCmd) - configConfigCmd.AddCommand(configConfigSetMccCmd) - configConfigCmd.AddCommand(configConfigSetMncCmd) - configConfigCmd.AddCommand(configConfigSetNavHiddenCmd) - configConfigCmd.AddCommand(configConfigSetNavigationCmd) - configConfigCmd.AddCommand(configConfigSetOrientationCmd) - configConfigCmd.AddCommand(configConfigSetScreenHeightDpCmd) - configConfigCmd.AddCommand(configConfigSetScreenLongCmd) - configConfigCmd.AddCommand(configConfigSetScreenSizeCmd) - configConfigCmd.AddCommand(configConfigSetScreenWidthDpCmd) - configConfigCmd.AddCommand(configConfigSetSdkVersionCmd) - configConfigCmd.AddCommand(configConfigSetSmallestScreenWidthDpCmd) - configConfigCmd.AddCommand(configConfigSetTouchscreenCmd) - configConfigCmd.AddCommand(configConfigSetUiModeNightCmd) - configConfigCmd.AddCommand(configConfigSetUiModeTypeCmd) - configErrorCmd.AddCommand(configErrorErrorCmd) - rootCmd.AddCommand(configCmd) -} diff --git a/cmd/ndkcli/config_workflow.go b/cmd/ndkcli/config_workflow.go deleted file mode 100644 index dd7a8bd..0000000 --- a/cmd/ndkcli/config_workflow.go +++ /dev/null @@ -1,41 +0,0 @@ -package main - -import ( - "fmt" - "strings" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/config" -) - -var configShowCmd = &cobra.Command{ - Use: "show", - Short: "Display device configuration (density, orientation, screen, SDK version)", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - cfg := config.NewConfig() - defer cfg.Close() - - fmt.Printf("density: %d\n", cfg.Density()) - fmt.Printf("orientation: %d (%s)\n", cfg.Orientation(), config.Orientation(cfg.Orientation())) - fmt.Printf("screen width dp: %d\n", cfg.ScreenWidthDp()) - fmt.Printf("screen height dp: %d\n", cfg.ScreenHeightDp()) - fmt.Printf("screen size: %d (%s)\n", cfg.ScreenSize(), config.ScreenSize(cfg.ScreenSize())) - fmt.Printf("SDK version: %d\n", cfg.SdkVersion()) - - // Country and Language take a string buffer; pass a zero-filled - // string of sufficient length so the C function can write into it. - countryBuf := strings.Repeat("\x00", 4) - cfg.Country(countryBuf) - fmt.Printf("country: %s\n", strings.TrimRight(countryBuf, "\x00")) - - languageBuf := strings.Repeat("\x00", 4) - cfg.Language(languageBuf) - fmt.Printf("language: %s\n", strings.TrimRight(languageBuf, "\x00")) - - return nil - }, -} - -func init() { - configCmd.AddCommand(configShowCmd) -} diff --git a/cmd/ndkcli/egl_gen.go b/cmd/ndkcli/egl_gen.go deleted file mode 100644 index 5254fbd..0000000 --- a/cmd/ndkcli/egl_gen.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/egl" -) - -var eglCmd = &cobra.Command{ - Use: "egl", - Short: "egl NDK module", -} - -var eglANativeWindowCmd = &cobra.Command{ - Use: "a-native-window", - Short: "ANativeWindow operations", -} - -var eglErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var eglGetCurrentContextCmd = &cobra.Command{ - Use: "get-current-context", - Short: "egl.GetCurrentContext()", - RunE: func(cmd *cobra.Command, args []string) error { - result := egl.GetCurrentContext() - fmt.Println(result) - return nil - }, -} - -var eglGetCurrentDisplayCmd = &cobra.Command{ - Use: "get-current-display", - Short: "egl.GetCurrentDisplay()", - RunE: func(cmd *cobra.Command, args []string) error { - result := egl.GetCurrentDisplay() - fmt.Println(result) - return nil - }, -} - -var eglGetCurrentSurfaceCmd = &cobra.Command{ - Use: "get-current-surface", - Short: "egl.GetCurrentSurface()", - RunE: func(cmd *cobra.Command, args []string) error { - readdraw, _ := cmd.Flags().GetInt32("readdraw") - result := egl.GetCurrentSurface(egl.Int(readdraw)) - fmt.Println(result) - return nil - }, -} - -var eglGetErrorCmd = &cobra.Command{ - Use: "get-error", - Short: "egl.GetError()", - RunE: func(cmd *cobra.Command, args []string) error { - result := egl.GetError() - fmt.Println(result) - return nil - }, -} - -var eglQueryAPICmd = &cobra.Command{ - Use: "query-api", - Short: "egl.QueryAPI()", - RunE: func(cmd *cobra.Command, args []string) error { - result := egl.QueryAPI() - fmt.Println(result) - return nil - }, -} - -var eglReleaseThreadCmd = &cobra.Command{ - Use: "release-thread", - Short: "egl.ReleaseThread()", - RunE: func(cmd *cobra.Command, args []string) error { - result := egl.ReleaseThread() - fmt.Println(result) - return nil - }, -} - -var eglWaitGLCmd = &cobra.Command{ - Use: "wait-gl", - Short: "egl.WaitGL()", - RunE: func(cmd *cobra.Command, args []string) error { - result := egl.WaitGL() - fmt.Println(result) - return nil - }, -} - -var eglWaitNativeCmd = &cobra.Command{ - Use: "wait-native", - Short: "egl.WaitNative()", - RunE: func(cmd *cobra.Command, args []string) error { - engine, _ := cmd.Flags().GetInt32("engine") - result := egl.WaitNative(egl.Int(engine)) - fmt.Println(result) - return nil - }, -} - -var eglANativeWindowAcquireCmd = &cobra.Command{ - Use: "acquire", - Short: "ANativeWindow.Acquire()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowClearFrameRateCmd = &cobra.Command{ - Use: "clear-frame-rate", - Short: "ANativeWindow.ClearFrameRate()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowGetBuffersDataSpaceCmd = &cobra.Command{ - Use: "get-buffers-data-space", - Short: "ANativeWindow.GetBuffersDataSpace()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowGetBuffersDefaultDataSpaceCmd = &cobra.Command{ - Use: "get-buffers-default-data-space", - Short: "ANativeWindow.GetBuffersDefaultDataSpace()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowGetFormatCmd = &cobra.Command{ - Use: "get-format", - Short: "ANativeWindow.GetFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowGetHeightCmd = &cobra.Command{ - Use: "get-height", - Short: "ANativeWindow.GetHeight()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowGetWidthCmd = &cobra.Command{ - Use: "get-width", - Short: "ANativeWindow.GetWidth()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowSetBuffersDataSpaceCmd = &cobra.Command{ - Use: "set-buffers-data-space", - Short: "ANativeWindow.SetBuffersDataSpace()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowSetBuffersGeometryCmd = &cobra.Command{ - Use: "set-buffers-geometry", - Short: "ANativeWindow.SetBuffersGeometry()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowSetBuffersTransformCmd = &cobra.Command{ - Use: "set-buffers-transform", - Short: "ANativeWindow.SetBuffersTransform()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowTryAllocateBuffersCmd = &cobra.Command{ - Use: "try-allocate-buffers", - Short: "ANativeWindow.TryAllocateBuffers()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglANativeWindowUnlockAndPostCmd = &cobra.Command{ - Use: "unlock-and-post", - Short: "ANativeWindow.UnlockAndPost()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var eglErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - eglGetCurrentSurfaceCmd.Flags().Int32("readdraw", 0, "readdraw") - eglWaitNativeCmd.Flags().Int32("engine", 0, "engine") - eglCmd.AddCommand(eglANativeWindowCmd) - eglCmd.AddCommand(eglErrorCmd) - eglCmd.AddCommand(eglGetCurrentContextCmd) - eglCmd.AddCommand(eglGetCurrentDisplayCmd) - eglCmd.AddCommand(eglGetCurrentSurfaceCmd) - eglCmd.AddCommand(eglGetErrorCmd) - eglCmd.AddCommand(eglQueryAPICmd) - eglCmd.AddCommand(eglReleaseThreadCmd) - eglCmd.AddCommand(eglWaitGLCmd) - eglCmd.AddCommand(eglWaitNativeCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowAcquireCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowClearFrameRateCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowGetBuffersDataSpaceCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowGetBuffersDefaultDataSpaceCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowGetFormatCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowGetHeightCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowGetWidthCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowSetBuffersDataSpaceCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowSetBuffersGeometryCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowSetBuffersTransformCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowTryAllocateBuffersCmd) - eglANativeWindowCmd.AddCommand(eglANativeWindowUnlockAndPostCmd) - eglErrorCmd.AddCommand(eglErrorErrorCmd) - rootCmd.AddCommand(eglCmd) -} diff --git a/cmd/ndkcli/egl_workflow.go b/cmd/ndkcli/egl_workflow.go deleted file mode 100644 index c1de874..0000000 --- a/cmd/ndkcli/egl_workflow.go +++ /dev/null @@ -1,84 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/egl" -) - -var eglInfoCmd = &cobra.Command{ - Use: "info", - Short: "Display EGL information (vendor, version, extensions, client APIs)", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - var defaultDisplay egl.EGLNativeDisplayType - dpy := egl.GetDisplay(defaultDisplay) - if dpy == nil { - return fmt.Errorf("egl.GetDisplay returned no display") - } - - var major, minor egl.Int - if egl.Initialize(dpy, &major, &minor) == egl.False { - return fmt.Errorf("egl.Initialize failed (error 0x%x)", egl.GetError()) - } - defer egl.Terminate(dpy) - - fmt.Printf("EGL version: %d.%d\n", major, minor) - fmt.Printf("vendor: %s\n", egl.QueryString(dpy, 0x3053)) - fmt.Printf("version: %s\n", egl.QueryString(dpy, 0x3054)) - fmt.Printf("extensions: %s\n", egl.QueryString(dpy, 0x3055)) - fmt.Printf("client APIs: %s\n", egl.QueryString(dpy, 0x308D)) - - return nil - }, -} - -var eglConfigsCmd = &cobra.Command{ - Use: "configs", - Short: "List available EGL configurations", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - var defaultDisplay egl.EGLNativeDisplayType - dpy := egl.GetDisplay(defaultDisplay) - if dpy == nil { - return fmt.Errorf("egl.GetDisplay returned no display") - } - - var major, minor egl.Int - if egl.Initialize(dpy, &major, &minor) == egl.False { - return fmt.Errorf("egl.Initialize failed (error 0x%x)", egl.GetError()) - } - defer egl.Terminate(dpy) - - var config egl.EGLConfig - var numConfig egl.Int - if egl.ChooseConfig(dpy, nil, &config, 1, &numConfig) == egl.False { - return fmt.Errorf("egl.ChooseConfig failed (error 0x%x)", egl.GetError()) - } - - if numConfig == 0 { - fmt.Println("no EGL configs found") - return nil - } - - var redSize, greenSize, blueSize, depthSize, surfaceType egl.Int - egl.GetConfigAttrib(dpy, config, egl.RedSize, &redSize) - egl.GetConfigAttrib(dpy, config, egl.GreenSize, &greenSize) - egl.GetConfigAttrib(dpy, config, egl.BlueSize, &blueSize) - egl.GetConfigAttrib(dpy, config, egl.DepthSize, &depthSize) - egl.GetConfigAttrib(dpy, config, egl.SurfaceType, &surfaceType) - - fmt.Printf("config 0:\n") - fmt.Printf(" red size: %d\n", redSize) - fmt.Printf(" green size: %d\n", greenSize) - fmt.Printf(" blue size: %d\n", blueSize) - fmt.Printf(" depth size: %d\n", depthSize) - fmt.Printf(" surface type: 0x%x\n", surfaceType) - - return nil - }, -} - -func init() { - eglCmd.AddCommand(eglInfoCmd) - eglCmd.AddCommand(eglConfigsCmd) -} diff --git a/cmd/ndkcli/font_gen.go b/cmd/ndkcli/font_gen.go deleted file mode 100644 index d84bc3f..0000000 --- a/cmd/ndkcli/font_gen.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/font" -) - -var fontCmd = &cobra.Command{ - Use: "font", - Short: "font NDK module", -} - -var fontErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var fontFontCmd = &cobra.Command{ - Use: "font", - Short: "Font operations", -} - -var fontMatcherCmd = &cobra.Command{ - Use: "matcher", - Short: "Matcher operations", -} - -var fontSystemFontIteratorCmd = &cobra.Command{ - Use: "system-font-iterator", - Short: "SystemFontIterator operations", -} - -var fontASystemFontIterator_openCmd = &cobra.Command{ - Use: "a-system-font-iterator_open", - Short: "font.ASystemFontIterator_open()", - RunE: func(cmd *cobra.Command, args []string) error { - result := font.ASystemFontIterator_open() - fmt.Println(result) - return nil - }, -} - -var fontErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontFontGetAxisCountCmd = &cobra.Command{ - Use: "get-axis-count", - Short: "Font.GetAxisCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontFontGetAxisTagCmd = &cobra.Command{ - Use: "get-axis-tag", - Short: "Font.GetAxisTag()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontFontGetAxisValueCmd = &cobra.Command{ - Use: "get-axis-value", - Short: "Font.GetAxisValue()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontFontGetCollectionIndexCmd = &cobra.Command{ - Use: "get-collection-index", - Short: "Font.GetCollectionIndex()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontFontGetFontFilePathCmd = &cobra.Command{ - Use: "get-font-file-path", - Short: "Font.GetFontFilePath()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontFontGetLocaleCmd = &cobra.Command{ - Use: "get-locale", - Short: "Font.GetLocale()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontFontWeightCmd = &cobra.Command{ - Use: "weight", - Short: "Font.Weight()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontFontIsItalicCmd = &cobra.Command{ - Use: "is-italic", - Short: "Font.IsItalic()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var fontMatcherNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Matcher", - RunE: func(cmd *cobra.Command, args []string) error { - obj := font.NewMatcher() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var fontMatcherSetFamilyVariantCmd = &cobra.Command{ - Use: "set-family-variant", - Short: "Matcher.SetFamilyVariant()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := font.NewMatcher() - defer obj.Close() - familyVariant, _ := cmd.Flags().GetUint32("family-variant") - obj.SetFamilyVariant(familyVariant) - fmt.Println("ok") - return nil - }, -} - -var fontMatcherSetLocalesCmd = &cobra.Command{ - Use: "set-locales", - Short: "Matcher.SetLocales()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := font.NewMatcher() - defer obj.Close() - languageTags, _ := cmd.Flags().GetString("language-tags") - obj.SetLocales(languageTags) - fmt.Println("ok") - return nil - }, -} - -var fontMatcherSetStyleCmd = &cobra.Command{ - Use: "set-style", - Short: "Matcher.SetStyle()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := font.NewMatcher() - defer obj.Close() - weight, _ := cmd.Flags().GetInt32("weight") - italic, _ := cmd.Flags().GetBool("italic") - result := obj.SetStyle(uint16(weight), italic) - fmt.Println(result) - return nil - }, -} - -var fontSystemFontIteratorNextCmd = &cobra.Command{ - Use: "next", - Short: "SystemFontIterator.Next()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - fontMatcherSetFamilyVariantCmd.Flags().Uint32("family-variant", 0, "familyVariant") - fontMatcherSetLocalesCmd.Flags().String("language-tags", "", "languageTags") - fontMatcherSetStyleCmd.Flags().Int32("weight", 0, "weight") - fontMatcherSetStyleCmd.Flags().Bool("italic", false, "italic") - fontCmd.AddCommand(fontErrorCmd) - fontCmd.AddCommand(fontFontCmd) - fontCmd.AddCommand(fontMatcherCmd) - fontCmd.AddCommand(fontSystemFontIteratorCmd) - fontCmd.AddCommand(fontASystemFontIterator_openCmd) - fontErrorCmd.AddCommand(fontErrorErrorCmd) - fontFontCmd.AddCommand(fontFontGetAxisCountCmd) - fontFontCmd.AddCommand(fontFontGetAxisTagCmd) - fontFontCmd.AddCommand(fontFontGetAxisValueCmd) - fontFontCmd.AddCommand(fontFontGetCollectionIndexCmd) - fontFontCmd.AddCommand(fontFontGetFontFilePathCmd) - fontFontCmd.AddCommand(fontFontGetLocaleCmd) - fontFontCmd.AddCommand(fontFontWeightCmd) - fontFontCmd.AddCommand(fontFontIsItalicCmd) - fontMatcherCmd.AddCommand(fontMatcherNewCmd) - fontMatcherCmd.AddCommand(fontMatcherSetFamilyVariantCmd) - fontMatcherCmd.AddCommand(fontMatcherSetLocalesCmd) - fontMatcherCmd.AddCommand(fontMatcherSetStyleCmd) - fontSystemFontIteratorCmd.AddCommand(fontSystemFontIteratorNextCmd) - rootCmd.AddCommand(fontCmd) -} diff --git a/cmd/ndkcli/font_workflow.go b/cmd/ndkcli/font_workflow.go deleted file mode 100644 index 27eaaf7..0000000 --- a/cmd/ndkcli/font_workflow.go +++ /dev/null @@ -1,156 +0,0 @@ -package main - -import ( - "fmt" - "math" - "path/filepath" - "strings" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/font" -) - -// matchFontFromIterator iterates all system fonts and finds the best -// match for the given family, weight, and italic style. -// -// This replaces AFontMatcher_match which crashes (SIGSEGV) from headless -// CLI binaries. Root cause: AFontMatcher_match calls -// minikin::SystemFonts::findFontCollection(), which accesses a singleton -// populated by Java's Typeface static initializer via JNI -// (nativeAddFontCollections → minikin::SystemFonts::registerFallback). -// Without Java/ART running, the singleton's mDefaultFallback is null, -// causing a null pointer dereference in FontCollection::getFamilyForChar. -// -// ASystemFontIterator works from CLI because it reads /system/etc/fonts.xml -// directly from the filesystem, bypassing minikin's singleton entirely. -func matchFontFromIterator( - family string, - weight uint16, - italic bool, -) (*font.Font, error) { - iter := font.ASystemFontIterator_open() - if iter == nil || iter.Pointer() == nil { - return nil, fmt.Errorf("ASystemFontIterator_open returned nil") - } - defer iter.Close() - - var bestFont *font.Font - bestScore := math.MaxInt32 - - for { - f := iter.Next() - if f == nil || f.Pointer() == nil { - break - } - - // Check family match via file path (font files are named after families). - path := f.GetFontFilePath() - base := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)) - baseLower := strings.ToLower(base) - familyLower := strings.ToLower(family) - - // Skip fonts that don't match the family name. - // Match by checking if the file name contains the family name. - if !strings.Contains(baseLower, familyLower) && - !strings.Contains(familyLower, baseLower) { - f.Close() - continue - } - - // Score: lower is better. - // Weight distance + italic mismatch penalty. - weightDist := int(weight) - int(f.Weight()) - if weightDist < 0 { - weightDist = -weightDist - } - score := weightDist - if f.IsItalic() != italic { - score += 1000 - } - - if score < bestScore { - if bestFont != nil { - bestFont.Close() - } - bestFont = f - bestScore = score - } else { - f.Close() - } - } - - return bestFont, nil -} - -var fontMatchCmd = &cobra.Command{ - Use: "match", - Short: "Match a font by family name, weight, and italic style", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - family, _ := cmd.Flags().GetString("family") - weight, _ := cmd.Flags().GetUint16("weight") - italic, _ := cmd.Flags().GetBool("italic") - - fmt.Printf("matching family=%q weight=%d italic=%v...\n", family, weight, italic) - - matched, err := matchFontFromIterator(family, weight, italic) - if err != nil { - return fmt.Errorf("font matching: %w", err) - } - if matched == nil { - fmt.Println("no matching font found") - return nil - } - defer matched.Close() - - fmt.Printf("matched font:\n") - fmt.Printf(" path: %s\n", matched.GetFontFilePath()) - fmt.Printf(" weight: %d\n", matched.Weight()) - fmt.Printf(" italic: %v\n", matched.IsItalic()) - fmt.Printf(" locale: %s\n", matched.GetLocale()) - - return nil - }, -} - -var fontListCmd = &cobra.Command{ - Use: "list", - Short: "List system fonts using ASystemFontIterator", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - limit, _ := cmd.Flags().GetInt("limit") - - iter := font.ASystemFontIterator_open() - if iter == nil || iter.Pointer() == nil { - return fmt.Errorf("ASystemFontIterator_open returned nil") - } - defer iter.Close() - - count := 0 - for { - f := iter.Next() - if f == nil || f.Pointer() == nil { - break - } - fmt.Printf(" [%d] weight=%d italic=%-5v %s\n", - count, f.Weight(), f.IsItalic(), f.GetFontFilePath()) - f.Close() - count++ - if limit > 0 && count >= limit { - fmt.Println(" ... (truncated)") - break - } - } - fmt.Printf("listed %d fonts\n", count) - return nil - }, -} - -func init() { - fontMatchCmd.Flags().String("family", "Roboto", "font family name (matched against file name)") - fontMatchCmd.Flags().Uint16("weight", 400, "font weight (100-900)") - fontMatchCmd.Flags().Bool("italic", false, "request italic style") - - fontListCmd.Flags().Int("limit", 0, "max fonts to list (0=all)") - - fontCmd.AddCommand(fontMatchCmd) - fontCmd.AddCommand(fontListCmd) -} diff --git a/cmd/ndkcli/gameactivity_gen.go b/cmd/ndkcli/gameactivity_gen.go deleted file mode 100644 index e537c25..0000000 --- a/cmd/ndkcli/gameactivity_gen.go +++ /dev/null @@ -1,200 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var gameactivityCmd = &cobra.Command{ - Use: "gameactivity", - Short: "gameactivity NDK module", -} - -var gameactivityActivityCmd = &cobra.Command{ - Use: "activity", - Short: "Activity operations", -} - -var gameactivityPointerAxesCmd = &cobra.Command{ - Use: "pointer-axes", - Short: "PointerAxes operations", -} - -var gameactivityActivityVMCmd = &cobra.Command{ - Use: "vm", - Short: "Activity.VM()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityEnvCmd = &cobra.Command{ - Use: "env", - Short: "Activity.Env()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityJavaGameActivityCmd = &cobra.Command{ - Use: "java-game-activity", - Short: "Activity.JavaGameActivity()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivitySDKVersionCmd = &cobra.Command{ - Use: "sdk-version", - Short: "Activity.SDKVersion()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityInternalDataPathCmd = &cobra.Command{ - Use: "internal-data-path", - Short: "Activity.InternalDataPath()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityExternalDataPathCmd = &cobra.Command{ - Use: "external-data-path", - Short: "Activity.ExternalDataPath()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityOBBPathCmd = &cobra.Command{ - Use: "obb-path", - Short: "Activity.OBBPath()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityAssetManagerCmd = &cobra.Command{ - Use: "asset-manager", - Short: "Activity.AssetManager()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityInstanceCmd = &cobra.Command{ - Use: "instance", - Short: "Activity.Instance()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityFinishCmd = &cobra.Command{ - Use: "finish", - Short: "Activity.Finish()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivitySetWindowFlagsCmd = &cobra.Command{ - Use: "set-window-flags", - Short: "Activity.SetWindowFlags()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityShowSoftInputCmd = &cobra.Command{ - Use: "show-soft-input", - Short: "Activity.ShowSoftInput()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityHideSoftInputCmd = &cobra.Command{ - Use: "hide-soft-input", - Short: "Activity.HideSoftInput()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivitySetImeEditorInfoCmd = &cobra.Command{ - Use: "set-ime-editor-info", - Short: "Activity.SetImeEditorInfo()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityActivityGetWindowInsetsCmd = &cobra.Command{ - Use: "get-window-insets", - Short: "Activity.GetWindowInsets()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityPointerAxesXCmd = &cobra.Command{ - Use: "x", - Short: "PointerAxes.X()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var gameactivityPointerAxesYCmd = &cobra.Command{ - Use: "y", - Short: "PointerAxes.Y()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - gameactivityCmd.AddCommand(gameactivityActivityCmd) - gameactivityCmd.AddCommand(gameactivityPointerAxesCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityVMCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityEnvCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityJavaGameActivityCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivitySDKVersionCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityInternalDataPathCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityExternalDataPathCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityOBBPathCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityAssetManagerCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityInstanceCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityFinishCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivitySetWindowFlagsCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityShowSoftInputCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityHideSoftInputCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivitySetImeEditorInfoCmd) - gameactivityActivityCmd.AddCommand(gameactivityActivityGetWindowInsetsCmd) - gameactivityPointerAxesCmd.AddCommand(gameactivityPointerAxesXCmd) - gameactivityPointerAxesCmd.AddCommand(gameactivityPointerAxesYCmd) - rootCmd.AddCommand(gameactivityCmd) -} diff --git a/cmd/ndkcli/gles2_gen.go b/cmd/ndkcli/gles2_gen.go deleted file mode 100644 index ead4d0a..0000000 --- a/cmd/ndkcli/gles2_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/gles2" -) - -var gles2Cmd = &cobra.Command{ - Use: "gles2", - Short: "gles2 NDK module", -} - -var gles2ActiveTextureCmd = &cobra.Command{ - Use: "active-texture", - Short: "gles2.ActiveTexture()", - RunE: func(cmd *cobra.Command, args []string) error { - texture, _ := cmd.Flags().GetUint32("texture") - gles2.ActiveTexture(gles2.Enum(texture)) - fmt.Println("ok") - return nil - }, -} - -var gles2BlendFuncCmd = &cobra.Command{ - Use: "blend-func", - Short: "gles2.BlendFunc()", - RunE: func(cmd *cobra.Command, args []string) error { - sfactor, _ := cmd.Flags().GetUint32("sfactor") - dfactor, _ := cmd.Flags().GetUint32("dfactor") - gles2.BlendFunc(gles2.Enum(sfactor), gles2.Enum(dfactor)) - fmt.Println("ok") - return nil - }, -} - -var gles2BlendFuncSeparateCmd = &cobra.Command{ - Use: "blend-func-separate", - Short: "gles2.BlendFuncSeparate()", - RunE: func(cmd *cobra.Command, args []string) error { - sfactorRGB, _ := cmd.Flags().GetUint32("sfactor-rgb") - dfactorRGB, _ := cmd.Flags().GetUint32("dfactor-rgb") - sfactorAlpha, _ := cmd.Flags().GetUint32("sfactor-alpha") - dfactorAlpha, _ := cmd.Flags().GetUint32("dfactor-alpha") - gles2.BlendFuncSeparate(gles2.Enum(sfactorRGB), gles2.Enum(dfactorRGB), gles2.Enum(sfactorAlpha), gles2.Enum(dfactorAlpha)) - fmt.Println("ok") - return nil - }, -} - -var gles2CheckFramebufferStatusCmd = &cobra.Command{ - Use: "check-framebuffer-status", - Short: "gles2.CheckFramebufferStatus()", - RunE: func(cmd *cobra.Command, args []string) error { - target, _ := cmd.Flags().GetUint32("target") - result := gles2.CheckFramebufferStatus(gles2.Enum(target)) - fmt.Println(result) - return nil - }, -} - -var gles2CreateProgramCmd = &cobra.Command{ - Use: "create-program", - Short: "gles2.CreateProgram()", - RunE: func(cmd *cobra.Command, args []string) error { - result := gles2.CreateProgram() - fmt.Println(result) - return nil - }, -} - -var gles2CreateShaderCmd = &cobra.Command{ - Use: "create-shader", - Short: "gles2.CreateShader()", - RunE: func(cmd *cobra.Command, args []string) error { - _type, _ := cmd.Flags().GetUint32("_type") - result := gles2.CreateShader(gles2.Enum(_type)) - fmt.Println(result) - return nil - }, -} - -var gles2DepthFuncCmd = &cobra.Command{ - Use: "depth-func", - Short: "gles2.DepthFunc()", - RunE: func(cmd *cobra.Command, args []string) error { - _func, _ := cmd.Flags().GetUint32("_func") - gles2.DepthFunc(gles2.Enum(_func)) - fmt.Println("ok") - return nil - }, -} - -var gles2DisableCmd = &cobra.Command{ - Use: "disable", - Short: "gles2.Disable()", - RunE: func(cmd *cobra.Command, args []string) error { - cap, _ := cmd.Flags().GetUint32("cap") - gles2.Disable(gles2.Enum(cap)) - fmt.Println("ok") - return nil - }, -} - -var gles2EnableCmd = &cobra.Command{ - Use: "enable", - Short: "gles2.Enable()", - RunE: func(cmd *cobra.Command, args []string) error { - cap, _ := cmd.Flags().GetUint32("cap") - gles2.Enable(gles2.Enum(cap)) - fmt.Println("ok") - return nil - }, -} - -var gles2FinishCmd = &cobra.Command{ - Use: "finish", - Short: "gles2.Finish()", - RunE: func(cmd *cobra.Command, args []string) error { - gles2.Finish() - fmt.Println("ok") - return nil - }, -} - -var gles2FlushCmd = &cobra.Command{ - Use: "flush", - Short: "gles2.Flush()", - RunE: func(cmd *cobra.Command, args []string) error { - gles2.Flush() - fmt.Println("ok") - return nil - }, -} - -var gles2GetErrorCmd = &cobra.Command{ - Use: "get-error", - Short: "gles2.GetError()", - RunE: func(cmd *cobra.Command, args []string) error { - result := gles2.GetError() - fmt.Println(result) - return nil - }, -} - -var gles2GetStringCmd = &cobra.Command{ - Use: "get-string", - Short: "gles2.GetString()", - RunE: func(cmd *cobra.Command, args []string) error { - name, _ := cmd.Flags().GetUint32("name") - result := gles2.GetString(gles2.Enum(name)) - fmt.Println(result) - return nil - }, -} - -var gles2GlReleaseShaderCompilerCmd = &cobra.Command{ - Use: "gl-release-shader-compiler", - Short: "gles2.GlReleaseShaderCompiler()", - RunE: func(cmd *cobra.Command, args []string) error { - gles2.GlReleaseShaderCompiler() - fmt.Println("ok") - return nil - }, -} - -var gles2StencilOpCmd = &cobra.Command{ - Use: "stencil-op", - Short: "gles2.StencilOp()", - RunE: func(cmd *cobra.Command, args []string) error { - fail, _ := cmd.Flags().GetUint32("fail") - zfail, _ := cmd.Flags().GetUint32("zfail") - zpass, _ := cmd.Flags().GetUint32("zpass") - gles2.StencilOp(gles2.Enum(fail), gles2.Enum(zfail), gles2.Enum(zpass)) - fmt.Println("ok") - return nil - }, -} - -func init() { - gles2ActiveTextureCmd.Flags().Uint32("texture", 0, "texture") - gles2BlendFuncCmd.Flags().Uint32("sfactor", 0, "sfactor") - gles2BlendFuncCmd.Flags().Uint32("dfactor", 0, "dfactor") - gles2BlendFuncSeparateCmd.Flags().Uint32("sfactor-rgb", 0, "sfactorRGB") - gles2BlendFuncSeparateCmd.Flags().Uint32("dfactor-rgb", 0, "dfactorRGB") - gles2BlendFuncSeparateCmd.Flags().Uint32("sfactor-alpha", 0, "sfactorAlpha") - gles2BlendFuncSeparateCmd.Flags().Uint32("dfactor-alpha", 0, "dfactorAlpha") - gles2CheckFramebufferStatusCmd.Flags().Uint32("target", 0, "target") - gles2CreateShaderCmd.Flags().Uint32("_type", 0, "_type") - gles2DepthFuncCmd.Flags().Uint32("_func", 0, "_func") - gles2DisableCmd.Flags().Uint32("cap", 0, "cap") - gles2EnableCmd.Flags().Uint32("cap", 0, "cap") - gles2GetStringCmd.Flags().Uint32("name", 0, "name") - gles2StencilOpCmd.Flags().Uint32("fail", 0, "fail") - gles2StencilOpCmd.Flags().Uint32("zfail", 0, "zfail") - gles2StencilOpCmd.Flags().Uint32("zpass", 0, "zpass") - gles2Cmd.AddCommand(gles2ActiveTextureCmd) - gles2Cmd.AddCommand(gles2BlendFuncCmd) - gles2Cmd.AddCommand(gles2BlendFuncSeparateCmd) - gles2Cmd.AddCommand(gles2CheckFramebufferStatusCmd) - gles2Cmd.AddCommand(gles2CreateProgramCmd) - gles2Cmd.AddCommand(gles2CreateShaderCmd) - gles2Cmd.AddCommand(gles2DepthFuncCmd) - gles2Cmd.AddCommand(gles2DisableCmd) - gles2Cmd.AddCommand(gles2EnableCmd) - gles2Cmd.AddCommand(gles2FinishCmd) - gles2Cmd.AddCommand(gles2FlushCmd) - gles2Cmd.AddCommand(gles2GetErrorCmd) - gles2Cmd.AddCommand(gles2GetStringCmd) - gles2Cmd.AddCommand(gles2GlReleaseShaderCompilerCmd) - gles2Cmd.AddCommand(gles2StencilOpCmd) - rootCmd.AddCommand(gles2Cmd) -} diff --git a/cmd/ndkcli/gles3_gen.go b/cmd/ndkcli/gles3_gen.go deleted file mode 100644 index 4e1d418..0000000 --- a/cmd/ndkcli/gles3_gen.go +++ /dev/null @@ -1,165 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/gles3" -) - -var gles3Cmd = &cobra.Command{ - Use: "gles3", - Short: "gles3 NDK module", -} - -var gles3BeginTransformFeedbackCmd = &cobra.Command{ - Use: "begin-transform-feedback", - Short: "gles3.BeginTransformFeedback()", - RunE: func(cmd *cobra.Command, args []string) error { - primitiveMode, _ := cmd.Flags().GetUint32("primitive-mode") - gles3.BeginTransformFeedback(gles3.GLenum(primitiveMode)) - fmt.Println("ok") - return nil - }, -} - -var gles3EndQueryCmd = &cobra.Command{ - Use: "end-query", - Short: "gles3.EndQuery()", - RunE: func(cmd *cobra.Command, args []string) error { - target, _ := cmd.Flags().GetUint32("target") - gles3.EndQuery(gles3.GLenum(target)) - fmt.Println("ok") - return nil - }, -} - -var gles3EndTransformFeedbackCmd = &cobra.Command{ - Use: "end-transform-feedback", - Short: "gles3.EndTransformFeedback()", - RunE: func(cmd *cobra.Command, args []string) error { - gles3.EndTransformFeedback() - fmt.Println("ok") - return nil - }, -} - -var gles3FenceSyncCmd = &cobra.Command{ - Use: "fence-sync", - Short: "gles3.FenceSync()", - RunE: func(cmd *cobra.Command, args []string) error { - condition, _ := cmd.Flags().GetUint32("condition") - flags, _ := cmd.Flags().GetUint32("flags") - result := gles3.FenceSync(gles3.GLenum(condition), gles3.GLbitfield(flags)) - fmt.Println(result) - return nil - }, -} - -var gles3GlFinishCmd = &cobra.Command{ - Use: "gl-finish", - Short: "gles3.GlFinish()", - RunE: func(cmd *cobra.Command, args []string) error { - gles3.GlFinish() - fmt.Println("ok") - return nil - }, -} - -var gles3GlFlushCmd = &cobra.Command{ - Use: "gl-flush", - Short: "gles3.GlFlush()", - RunE: func(cmd *cobra.Command, args []string) error { - gles3.GlFlush() - fmt.Println("ok") - return nil - }, -} - -var gles3GetStringCmd = &cobra.Command{ - Use: "get-string", - Short: "gles3.GetString()", - RunE: func(cmd *cobra.Command, args []string) error { - name, _ := cmd.Flags().GetUint32("name") - result := gles3.GetString(gles3.GLenum(name)) - fmt.Println(result) - return nil - }, -} - -var gles3GlPauseTransformFeedbackCmd = &cobra.Command{ - Use: "gl-pause-transform-feedback", - Short: "gles3.GlPauseTransformFeedback()", - RunE: func(cmd *cobra.Command, args []string) error { - gles3.GlPauseTransformFeedback() - fmt.Println("ok") - return nil - }, -} - -var gles3ReadBufferCmd = &cobra.Command{ - Use: "read-buffer", - Short: "gles3.ReadBuffer()", - RunE: func(cmd *cobra.Command, args []string) error { - src, _ := cmd.Flags().GetUint32("src") - gles3.ReadBuffer(gles3.GLenum(src)) - fmt.Println("ok") - return nil - }, -} - -var gles3GlReleaseShaderCompilerCmd = &cobra.Command{ - Use: "gl-release-shader-compiler", - Short: "gles3.GlReleaseShaderCompiler()", - RunE: func(cmd *cobra.Command, args []string) error { - gles3.GlReleaseShaderCompiler() - fmt.Println("ok") - return nil - }, -} - -var gles3GlResumeTransformFeedbackCmd = &cobra.Command{ - Use: "gl-resume-transform-feedback", - Short: "gles3.GlResumeTransformFeedback()", - RunE: func(cmd *cobra.Command, args []string) error { - gles3.GlResumeTransformFeedback() - fmt.Println("ok") - return nil - }, -} - -var gles3UnmapBufferCmd = &cobra.Command{ - Use: "unmap-buffer", - Short: "gles3.UnmapBuffer()", - RunE: func(cmd *cobra.Command, args []string) error { - target, _ := cmd.Flags().GetUint32("target") - result := gles3.UnmapBuffer(gles3.GLenum(target)) - fmt.Println(result) - return nil - }, -} - -func init() { - gles3BeginTransformFeedbackCmd.Flags().Uint32("primitive-mode", 0, "primitiveMode") - gles3EndQueryCmd.Flags().Uint32("target", 0, "target") - gles3FenceSyncCmd.Flags().Uint32("condition", 0, "condition") - gles3FenceSyncCmd.Flags().Uint32("flags", 0, "flags") - gles3GetStringCmd.Flags().Uint32("name", 0, "name") - gles3ReadBufferCmd.Flags().Uint32("src", 0, "src") - gles3UnmapBufferCmd.Flags().Uint32("target", 0, "target") - gles3Cmd.AddCommand(gles3BeginTransformFeedbackCmd) - gles3Cmd.AddCommand(gles3EndQueryCmd) - gles3Cmd.AddCommand(gles3EndTransformFeedbackCmd) - gles3Cmd.AddCommand(gles3FenceSyncCmd) - gles3Cmd.AddCommand(gles3GlFinishCmd) - gles3Cmd.AddCommand(gles3GlFlushCmd) - gles3Cmd.AddCommand(gles3GetStringCmd) - gles3Cmd.AddCommand(gles3GlPauseTransformFeedbackCmd) - gles3Cmd.AddCommand(gles3ReadBufferCmd) - gles3Cmd.AddCommand(gles3GlReleaseShaderCompilerCmd) - gles3Cmd.AddCommand(gles3GlResumeTransformFeedbackCmd) - gles3Cmd.AddCommand(gles3UnmapBufferCmd) - rootCmd.AddCommand(gles3Cmd) -} diff --git a/cmd/ndkcli/gles_workflow.go b/cmd/ndkcli/gles_workflow.go deleted file mode 100644 index f0d9ba7..0000000 --- a/cmd/ndkcli/gles_workflow.go +++ /dev/null @@ -1,170 +0,0 @@ -package main - -import ( - "fmt" - "unsafe" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" - "github.com/AndroidGoLab/ndk/gles3" -) - -// glUbyteToString converts a *GLubyte (C string) to a Go string by walking -// bytes until a NUL terminator is found. -func glUbyteToString(p *gles2.GLubyte) string { - if p == nil { - return "" - } - - var buf []byte - ptr := unsafe.Pointer(p) - for { - b := *(*byte)(ptr) - if b == 0 { - break - } - buf = append(buf, b) - ptr = unsafe.Add(ptr, 1) - } - return string(buf) -} - -// initEGLForES creates an EGL display + pbuffer context for the given ES -// major version. The caller must call the returned cleanup function. -func initEGLForES(esVersion egl.Int) ( - dpy egl.EGLDisplay, - cleanup func(), - _err error, -) { - var defaultDisplay egl.EGLNativeDisplayType - dpy = egl.GetDisplay(defaultDisplay) - if dpy == nil { - return nil, nil, fmt.Errorf("egl.GetDisplay returned no display") - } - - var major, minor egl.Int - if egl.Initialize(dpy, &major, &minor) == egl.False { - return nil, nil, fmt.Errorf("egl.Initialize failed (error 0x%x)", egl.GetError()) - } - - egl.BindAPI(egl.EGLenum(egl.OpenglEsApi)) - - renderableBit := egl.OpenglEs2Bit - if esVersion >= 3 { - renderableBit = egl.OpenglEs3Bit - } - configAttribs := []egl.Int{ - egl.RenderableType, renderableBit, - egl.SurfaceType, egl.PbufferBit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.None, - } - - var config egl.EGLConfig - var numConfig egl.Int - if egl.ChooseConfig(dpy, &configAttribs[0], &config, 1, &numConfig) == egl.False || numConfig == 0 { - egl.Terminate(dpy) - return nil, nil, fmt.Errorf("egl.ChooseConfig failed (error 0x%x)", egl.GetError()) - } - - contextAttribs := []egl.Int{ - egl.ContextClientVersion, esVersion, - egl.None, - } - ctx := egl.CreateContext(dpy, config, nil, &contextAttribs[0]) - if ctx == nil { - egl.Terminate(dpy) - return nil, nil, fmt.Errorf("egl.CreateContext failed (error 0x%x)", egl.GetError()) - } - - pbufAttribs := []egl.Int{ - egl.Width, 1, - egl.Height, 1, - egl.None, - } - surface := egl.CreatePbufferSurface(dpy, config, &pbufAttribs[0]) - if surface == nil { - egl.DestroyContext(dpy, ctx) - egl.Terminate(dpy) - return nil, nil, fmt.Errorf("egl.CreatePbufferSurface failed (error 0x%x)", egl.GetError()) - } - - if egl.MakeCurrent(dpy, surface, surface, ctx) == egl.False { - egl.DestroySurface(dpy, surface) - egl.DestroyContext(dpy, ctx) - egl.Terminate(dpy) - return nil, nil, fmt.Errorf("egl.MakeCurrent failed (error 0x%x)", egl.GetError()) - } - - cleanup = func() { - egl.MakeCurrent(dpy, nil, nil, nil) - egl.DestroySurface(dpy, surface) - egl.DestroyContext(dpy, ctx) - egl.Terminate(dpy) - } - return dpy, cleanup, nil -} - -var gles2InfoCmd = &cobra.Command{ - Use: "info", - Short: "Display OpenGL ES 2 information (vendor, renderer, version, extensions)", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - _, cleanup, err := initEGLForES(2) - if err != nil { - return fmt.Errorf("initializing EGL for ES2: %w", err) - } - defer cleanup() - - fmt.Printf("GL_VENDOR: %s\n", glUbyteToString(gles2.GetString(0x1F00))) - fmt.Printf("GL_RENDERER: %s\n", glUbyteToString(gles2.GetString(0x1F01))) - fmt.Printf("GL_VERSION: %s\n", glUbyteToString(gles2.GetString(0x1F02))) - fmt.Printf("GL_EXTENSIONS: %s\n", glUbyteToString(gles2.GetString(0x1F03))) - - return nil - }, -} - -var gles3InfoCmd = &cobra.Command{ - Use: "info", - Short: "Display OpenGL ES 3 information (vendor, renderer, version, extensions)", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - _, cleanup, err := initEGLForES(3) - if err != nil { - return fmt.Errorf("initializing EGL for ES3: %w", err) - } - defer cleanup() - - getString := func(name uint32) string { - p := gles3.GetString(gles3.GLenum(name)) - if p == nil { - return "" - } - var buf []byte - ptr := unsafe.Pointer(p) - for { - b := *(*byte)(ptr) - if b == 0 { - break - } - buf = append(buf, b) - ptr = unsafe.Add(ptr, 1) - } - return string(buf) - } - - fmt.Printf("GL_VENDOR: %s\n", getString(0x1F00)) - fmt.Printf("GL_RENDERER: %s\n", getString(0x1F01)) - fmt.Printf("GL_VERSION: %s\n", getString(0x1F02)) - fmt.Printf("GL_EXTENSIONS: %s\n", getString(0x1F03)) - - return nil - }, -} - -func init() { - gles2Cmd.AddCommand(gles2InfoCmd) - gles3Cmd.AddCommand(gles3InfoCmd) -} diff --git a/cmd/ndkcli/hint_gen.go b/cmd/ndkcli/hint_gen.go deleted file mode 100644 index 0c6f441..0000000 --- a/cmd/ndkcli/hint_gen.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/hint" -) - -var hintCmd = &cobra.Command{ - Use: "hint", - Short: "hint NDK module", -} - -var hintErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var hintManagerCmd = &cobra.Command{ - Use: "manager", - Short: "Manager operations", -} - -var hintSessionCmd = &cobra.Command{ - Use: "session", - Short: "Session operations", -} - -var hintWorkDurationCmd = &cobra.Command{ - Use: "work-duration", - Short: "WorkDuration operations", -} - -var hintAPerformanceHint_getManagerCmd = &cobra.Command{ - Use: "a-performance-hint_get-manager", - Short: "hint.APerformanceHint_getManager()", - RunE: func(cmd *cobra.Command, args []string) error { - result := hint.APerformanceHint_getManager() - fmt.Println(result) - return nil - }, -} - -var hintErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var hintManagerPreferredUpdateRateNanosCmd = &cobra.Command{ - Use: "preferred-update-rate-nanos", - Short: "Manager.PreferredUpdateRateNanos()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var hintSessionAPerformanceHint_setPreferPowerEfficiencyCmd = &cobra.Command{ - Use: "a-performance-hint_set-prefer-power-efficiency", - Short: "Session.APerformanceHint_setPreferPowerEfficiency()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var hintWorkDurationNewCmd = &cobra.Command{ - Use: "new", - Short: "Create WorkDuration", - RunE: func(cmd *cobra.Command, args []string) error { - obj := hint.NewWorkDuration() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var hintWorkDurationSetActualCpuDurationNanosCmd = &cobra.Command{ - Use: "set-actual-cpu-duration-nanos", - Short: "WorkDuration.SetActualCpuDurationNanos()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := hint.NewWorkDuration() - defer obj.Close() - actualCpuDurationNanos, _ := cmd.Flags().GetInt64("actual-cpu-duration-nanos") - obj.SetActualCpuDurationNanos(actualCpuDurationNanos) - fmt.Println("ok") - return nil - }, -} - -var hintWorkDurationSetActualGpuDurationNanosCmd = &cobra.Command{ - Use: "set-actual-gpu-duration-nanos", - Short: "WorkDuration.SetActualGpuDurationNanos()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := hint.NewWorkDuration() - defer obj.Close() - actualGpuDurationNanos, _ := cmd.Flags().GetInt64("actual-gpu-duration-nanos") - obj.SetActualGpuDurationNanos(actualGpuDurationNanos) - fmt.Println("ok") - return nil - }, -} - -var hintWorkDurationSetActualTotalDurationNanosCmd = &cobra.Command{ - Use: "set-actual-total-duration-nanos", - Short: "WorkDuration.SetActualTotalDurationNanos()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := hint.NewWorkDuration() - defer obj.Close() - actualTotalDurationNanos, _ := cmd.Flags().GetInt64("actual-total-duration-nanos") - obj.SetActualTotalDurationNanos(actualTotalDurationNanos) - fmt.Println("ok") - return nil - }, -} - -var hintWorkDurationSetWorkPeriodStartTimestampNanosCmd = &cobra.Command{ - Use: "set-work-period-start-timestamp-nanos", - Short: "WorkDuration.SetWorkPeriodStartTimestampNanos()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := hint.NewWorkDuration() - defer obj.Close() - workPeriodStartTimestampNanos, _ := cmd.Flags().GetInt64("work-period-start-timestamp-nanos") - obj.SetWorkPeriodStartTimestampNanos(workPeriodStartTimestampNanos) - fmt.Println("ok") - return nil - }, -} - -func init() { - hintWorkDurationSetActualCpuDurationNanosCmd.Flags().Int64("actual-cpu-duration-nanos", 0, "actualCpuDurationNanos") - hintWorkDurationSetActualGpuDurationNanosCmd.Flags().Int64("actual-gpu-duration-nanos", 0, "actualGpuDurationNanos") - hintWorkDurationSetActualTotalDurationNanosCmd.Flags().Int64("actual-total-duration-nanos", 0, "actualTotalDurationNanos") - hintWorkDurationSetWorkPeriodStartTimestampNanosCmd.Flags().Int64("work-period-start-timestamp-nanos", 0, "workPeriodStartTimestampNanos") - hintCmd.AddCommand(hintErrorCmd) - hintCmd.AddCommand(hintManagerCmd) - hintCmd.AddCommand(hintSessionCmd) - hintCmd.AddCommand(hintWorkDurationCmd) - hintCmd.AddCommand(hintAPerformanceHint_getManagerCmd) - hintErrorCmd.AddCommand(hintErrorErrorCmd) - hintManagerCmd.AddCommand(hintManagerPreferredUpdateRateNanosCmd) - hintSessionCmd.AddCommand(hintSessionAPerformanceHint_setPreferPowerEfficiencyCmd) - hintWorkDurationCmd.AddCommand(hintWorkDurationNewCmd) - hintWorkDurationCmd.AddCommand(hintWorkDurationSetActualCpuDurationNanosCmd) - hintWorkDurationCmd.AddCommand(hintWorkDurationSetActualGpuDurationNanosCmd) - hintWorkDurationCmd.AddCommand(hintWorkDurationSetActualTotalDurationNanosCmd) - hintWorkDurationCmd.AddCommand(hintWorkDurationSetWorkPeriodStartTimestampNanosCmd) - rootCmd.AddCommand(hintCmd) -} diff --git a/cmd/ndkcli/hwbuf_gen.go b/cmd/ndkcli/hwbuf_gen.go deleted file mode 100644 index 6e99f8a..0000000 --- a/cmd/ndkcli/hwbuf_gen.go +++ /dev/null @@ -1,96 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var hwbufCmd = &cobra.Command{ - Use: "hwbuf", - Short: "hwbuf NDK module", -} - -var hwbufBufferCmd = &cobra.Command{ - Use: "buffer", - Short: "Buffer operations", -} - -var hwbufErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var hwbufFormatCmd = &cobra.Command{ - Use: "format", - Short: "Format operations", -} - -var hwbufBufferAcquireCmd = &cobra.Command{ - Use: "acquire", - Short: "Buffer.Acquire()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var hwbufBufferGetIDCmd = &cobra.Command{ - Use: "get-id", - Short: "Buffer.GetID()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var hwbufBufferSendHandleToUnixSocketCmd = &cobra.Command{ - Use: "send-handle-to-unix-socket", - Short: "Buffer.SendHandleToUnixSocket()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var hwbufBufferUnlockCmd = &cobra.Command{ - Use: "unlock", - Short: "Buffer.Unlock()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var hwbufErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var hwbufFormatStringCmd = &cobra.Command{ - Use: "string", - Short: "Format.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - hwbufCmd.AddCommand(hwbufBufferCmd) - hwbufCmd.AddCommand(hwbufErrorCmd) - hwbufCmd.AddCommand(hwbufFormatCmd) - hwbufBufferCmd.AddCommand(hwbufBufferAcquireCmd) - hwbufBufferCmd.AddCommand(hwbufBufferGetIDCmd) - hwbufBufferCmd.AddCommand(hwbufBufferSendHandleToUnixSocketCmd) - hwbufBufferCmd.AddCommand(hwbufBufferUnlockCmd) - hwbufErrorCmd.AddCommand(hwbufErrorErrorCmd) - hwbufFormatCmd.AddCommand(hwbufFormatStringCmd) - rootCmd.AddCommand(hwbufCmd) -} diff --git a/cmd/ndkcli/image_gen.go b/cmd/ndkcli/image_gen.go deleted file mode 100644 index 63982ff..0000000 --- a/cmd/ndkcli/image_gen.go +++ /dev/null @@ -1,410 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - ndkimage "github.com/AndroidGoLab/ndk/image" -) - -var imageCmd = &cobra.Command{ - Use: "image", - Short: "image NDK module", -} - -var imageAssetCmd = &cobra.Command{ - Use: "asset", - Short: "Asset operations", -} - -var imageAssetDirCmd = &cobra.Command{ - Use: "asset-dir", - Short: "AssetDir operations", -} - -var imageAssetManagerCmd = &cobra.Command{ - Use: "asset-manager", - Short: "AssetManager operations", -} - -var imageDecoderCmd = &cobra.Command{ - Use: "decoder", - Short: "Decoder operations", -} - -var imageErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var imageHeaderInfoCmd = &cobra.Command{ - Use: "header-info", - Short: "HeaderInfo operations", -} - -var imageImageDecoderFrameInfoCmd = &cobra.Command{ - Use: "image-decoder-frame-info", - Short: "ImageDecoderFrameInfo operations", -} - -var imageAImageDecoder_resultToStringCmd = &cobra.Command{ - Use: "a-image-decoder_result-to-string", - Short: "image.AImageDecoder_resultToString()", - RunE: func(cmd *cobra.Command, args []string) error { - arg0, _ := cmd.Flags().GetInt32("arg0") - result := ndkimage.AImageDecoder_resultToString(arg0) - fmt.Println(result) - return nil - }, -} - -var imageNewDecoderFromFdCmd = &cobra.Command{ - Use: "new-decoder-from-fd", - Short: "image.NewDecoderFromFd()", - RunE: func(cmd *cobra.Command, args []string) error { - fd, _ := cmd.Flags().GetInt32("fd") - result, err := ndkimage.NewDecoderFromFd(fd) - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var imageAssetGetBufferCmd = &cobra.Command{ - Use: "get-buffer", - Short: "Asset.GetBuffer()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageAssetIsAllocatedCmd = &cobra.Command{ - Use: "is-allocated", - Short: "Asset.IsAllocated()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageAssetDirGetNextFileNameCmd = &cobra.Command{ - Use: "get-next-file-name", - Short: "AssetDir.GetNextFileName()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageAssetDirRewindCmd = &cobra.Command{ - Use: "rewind", - Short: "AssetDir.Rewind()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageAssetManagerOpenCmd = &cobra.Command{ - Use: "open", - Short: "AssetManager.Open()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageAssetManagerOpenDirCmd = &cobra.Command{ - Use: "open-dir", - Short: "AssetManager.OpenDir()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderAdvanceFrameCmd = &cobra.Command{ - Use: "advance-frame", - Short: "Decoder.AdvanceFrame()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderComputeSampledSizeCmd = &cobra.Command{ - Use: "compute-sampled-size", - Short: "Decoder.ComputeSampledSize()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderHeaderInfoCmd = &cobra.Command{ - Use: "header-info", - Short: "Decoder.HeaderInfo()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderMinimumStrideCmd = &cobra.Command{ - Use: "minimum-stride", - Short: "Decoder.MinimumStride()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderGetRepeatCountCmd = &cobra.Command{ - Use: "get-repeat-count", - Short: "Decoder.GetRepeatCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderIsAnimatedCmd = &cobra.Command{ - Use: "is-animated", - Short: "Decoder.IsAnimated()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderRewindCmd = &cobra.Command{ - Use: "rewind", - Short: "Decoder.Rewind()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderSetAndroidBitmapFormatCmd = &cobra.Command{ - Use: "set-android-bitmap-format", - Short: "Decoder.SetAndroidBitmapFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderSetDataSpaceCmd = &cobra.Command{ - Use: "set-data-space", - Short: "Decoder.SetDataSpace()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderSetInternallyHandleDisposePreviousCmd = &cobra.Command{ - Use: "set-internally-handle-dispose-previous", - Short: "Decoder.SetInternallyHandleDisposePrevious()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderSetTargetSizeCmd = &cobra.Command{ - Use: "set-target-size", - Short: "Decoder.SetTargetSize()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageDecoderSetUnpremultipliedRequiredCmd = &cobra.Command{ - Use: "set-unpremultiplied-required", - Short: "Decoder.SetUnpremultipliedRequired()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageHeaderInfoGetAlphaFlagsCmd = &cobra.Command{ - Use: "get-alpha-flags", - Short: "HeaderInfo.GetAlphaFlags()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageHeaderInfoGetAndroidBitmapFormatCmd = &cobra.Command{ - Use: "get-android-bitmap-format", - Short: "HeaderInfo.GetAndroidBitmapFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageHeaderInfoGetDataSpaceCmd = &cobra.Command{ - Use: "get-data-space", - Short: "HeaderInfo.GetDataSpace()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageHeaderInfoHeightCmd = &cobra.Command{ - Use: "height", - Short: "HeaderInfo.Height()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageHeaderInfoMimeTypeCmd = &cobra.Command{ - Use: "mime-type", - Short: "HeaderInfo.MimeType()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageHeaderInfoWidthCmd = &cobra.Command{ - Use: "width", - Short: "HeaderInfo.Width()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var imageImageDecoderFrameInfoNewCmd = &cobra.Command{ - Use: "new", - Short: "Create ImageDecoderFrameInfo", - RunE: func(cmd *cobra.Command, args []string) error { - obj := ndkimage.NewImageDecoderFrameInfo() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var imageImageDecoderFrameInfoGetBlendOpCmd = &cobra.Command{ - Use: "get-blend-op", - Short: "ImageDecoderFrameInfo.GetBlendOp()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := ndkimage.NewImageDecoderFrameInfo() - defer obj.Close() - err := obj.GetBlendOp() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var imageImageDecoderFrameInfoGetDisposeOpCmd = &cobra.Command{ - Use: "get-dispose-op", - Short: "ImageDecoderFrameInfo.GetDisposeOp()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := ndkimage.NewImageDecoderFrameInfo() - defer obj.Close() - err := obj.GetDisposeOp() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var imageImageDecoderFrameInfoGetDurationCmd = &cobra.Command{ - Use: "get-duration", - Short: "ImageDecoderFrameInfo.GetDuration()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := ndkimage.NewImageDecoderFrameInfo() - defer obj.Close() - result := obj.GetDuration() - fmt.Println(result) - return nil - }, -} - -var imageImageDecoderFrameInfoHasAlphaWithinBoundsCmd = &cobra.Command{ - Use: "has-alpha-within-bounds", - Short: "ImageDecoderFrameInfo.HasAlphaWithinBounds()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := ndkimage.NewImageDecoderFrameInfo() - defer obj.Close() - result := obj.HasAlphaWithinBounds() - fmt.Println(result) - return nil - }, -} - -func init() { - imageAImageDecoder_resultToStringCmd.Flags().Int32("arg0", 0, "arg0") - imageNewDecoderFromFdCmd.Flags().Int32("fd", 0, "fd") - imageCmd.AddCommand(imageAssetCmd) - imageCmd.AddCommand(imageAssetDirCmd) - imageCmd.AddCommand(imageAssetManagerCmd) - imageCmd.AddCommand(imageDecoderCmd) - imageCmd.AddCommand(imageErrorCmd) - imageCmd.AddCommand(imageHeaderInfoCmd) - imageCmd.AddCommand(imageImageDecoderFrameInfoCmd) - imageCmd.AddCommand(imageAImageDecoder_resultToStringCmd) - imageCmd.AddCommand(imageNewDecoderFromFdCmd) - imageAssetCmd.AddCommand(imageAssetGetBufferCmd) - imageAssetCmd.AddCommand(imageAssetIsAllocatedCmd) - imageAssetDirCmd.AddCommand(imageAssetDirGetNextFileNameCmd) - imageAssetDirCmd.AddCommand(imageAssetDirRewindCmd) - imageAssetManagerCmd.AddCommand(imageAssetManagerOpenCmd) - imageAssetManagerCmd.AddCommand(imageAssetManagerOpenDirCmd) - imageDecoderCmd.AddCommand(imageDecoderAdvanceFrameCmd) - imageDecoderCmd.AddCommand(imageDecoderComputeSampledSizeCmd) - imageDecoderCmd.AddCommand(imageDecoderHeaderInfoCmd) - imageDecoderCmd.AddCommand(imageDecoderMinimumStrideCmd) - imageDecoderCmd.AddCommand(imageDecoderGetRepeatCountCmd) - imageDecoderCmd.AddCommand(imageDecoderIsAnimatedCmd) - imageDecoderCmd.AddCommand(imageDecoderRewindCmd) - imageDecoderCmd.AddCommand(imageDecoderSetAndroidBitmapFormatCmd) - imageDecoderCmd.AddCommand(imageDecoderSetDataSpaceCmd) - imageDecoderCmd.AddCommand(imageDecoderSetInternallyHandleDisposePreviousCmd) - imageDecoderCmd.AddCommand(imageDecoderSetTargetSizeCmd) - imageDecoderCmd.AddCommand(imageDecoderSetUnpremultipliedRequiredCmd) - imageErrorCmd.AddCommand(imageErrorErrorCmd) - imageHeaderInfoCmd.AddCommand(imageHeaderInfoGetAlphaFlagsCmd) - imageHeaderInfoCmd.AddCommand(imageHeaderInfoGetAndroidBitmapFormatCmd) - imageHeaderInfoCmd.AddCommand(imageHeaderInfoGetDataSpaceCmd) - imageHeaderInfoCmd.AddCommand(imageHeaderInfoHeightCmd) - imageHeaderInfoCmd.AddCommand(imageHeaderInfoMimeTypeCmd) - imageHeaderInfoCmd.AddCommand(imageHeaderInfoWidthCmd) - imageImageDecoderFrameInfoCmd.AddCommand(imageImageDecoderFrameInfoNewCmd) - imageImageDecoderFrameInfoCmd.AddCommand(imageImageDecoderFrameInfoGetBlendOpCmd) - imageImageDecoderFrameInfoCmd.AddCommand(imageImageDecoderFrameInfoGetDisposeOpCmd) - imageImageDecoderFrameInfoCmd.AddCommand(imageImageDecoderFrameInfoGetDurationCmd) - imageImageDecoderFrameInfoCmd.AddCommand(imageImageDecoderFrameInfoHasAlphaWithinBoundsCmd) - rootCmd.AddCommand(imageCmd) -} diff --git a/cmd/ndkcli/image_workflow.go b/cmd/ndkcli/image_workflow.go deleted file mode 100644 index a78e701..0000000 --- a/cmd/ndkcli/image_workflow.go +++ /dev/null @@ -1,74 +0,0 @@ -package main - -import ( - "fmt" - "os" - "unsafe" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/image" -) - -var imageDecodeCmd = &cobra.Command{ - Use: "decode", - Short: "Decode an image file and print dimensions, stride, and format info", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - filePath, _ := cmd.Flags().GetString("file") - targetWidth, _ := cmd.Flags().GetInt32("width") - targetHeight, _ := cmd.Flags().GetInt32("height") - - f, err := os.Open(filePath) - if err != nil { - return fmt.Errorf("opening file: %w", err) - } - defer f.Close() - - decoder, err := image.NewDecoderFromFd(int32(f.Fd())) - if err != nil { - return fmt.Errorf("creating decoder: %w", err) - } - defer decoder.Close() - - header := decoder.HeaderInfo() - width := header.Width() - height := header.Height() - mimeType := header.MimeType() - - fmt.Printf("file: %s\n", filePath) - fmt.Printf("mime type: %s\n", mimeType) - fmt.Printf("dimensions: %d x %d\n", width, height) - - if targetWidth > 0 && targetHeight > 0 { - if err := decoder.SetTargetSize(targetWidth, targetHeight); err != nil { - return fmt.Errorf("setting target size: %w", err) - } - fmt.Printf("target size: %d x %d\n", targetWidth, targetHeight) - } - - stride := decoder.MinimumStride() - fmt.Printf("min stride: %d bytes\n", stride) - - effectiveHeight := height - if targetHeight > 0 { - effectiveHeight = targetHeight - } - bufSize := stride * uint64(effectiveHeight) - buf := make([]byte, bufSize) - - if err := decoder.Decode(unsafe.Pointer(&buf[0]), stride, bufSize); err != nil { - return fmt.Errorf("decoding image: %w", err) - } - fmt.Printf("decoded: %d bytes\n", bufSize) - - return nil - }, -} - -func init() { - imageDecodeCmd.Flags().String("file", "", "path to image file") - _ = imageDecodeCmd.MarkFlagRequired("file") - imageDecodeCmd.Flags().Int32("width", 0, "target decode width (0 = original)") - imageDecodeCmd.Flags().Int32("height", 0, "target decode height (0 = original)") - - imageCmd.AddCommand(imageDecodeCmd) -} diff --git a/cmd/ndkcli/input_gen.go b/cmd/ndkcli/input_gen.go deleted file mode 100644 index d946676..0000000 --- a/cmd/ndkcli/input_gen.go +++ /dev/null @@ -1,670 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var inputCmd = &cobra.Command{ - Use: "input", - Short: "input NDK module", -} - -var inputErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var inputEventCmd = &cobra.Command{ - Use: "event", - Short: "Event operations", -} - -var inputEventTypeCmd2 = &cobra.Command{ - Use: "event-type", - Short: "EventType operations", -} - -var inputKeyActionCmd = &cobra.Command{ - Use: "key-action", - Short: "KeyAction operations", -} - -var inputMotionActionCmd = &cobra.Command{ - Use: "motion-action", - Short: "MotionAction operations", -} - -var inputQueueCmd = &cobra.Command{ - Use: "queue", - Short: "Queue operations", -} - -var inputSourceCmd = &cobra.Command{ - Use: "source", - Short: "Source operations", -} - -var inputErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventGetDeviceIDCmd = &cobra.Command{ - Use: "get-device-id", - Short: "Event.GetDeviceID()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventSourceCmd = &cobra.Command{ - Use: "source", - Short: "Event.Source()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventTypeCmd = &cobra.Command{ - Use: "type", - Short: "Event.Type()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventKeyActionCmd = &cobra.Command{ - Use: "key-action", - Short: "Event.KeyAction()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAKeyEvent_getDownTimeCmd = &cobra.Command{ - Use: "a-key-event_get-down-time", - Short: "Event.AKeyEvent_getDownTime()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAKeyEvent_getEventTimeCmd = &cobra.Command{ - Use: "a-key-event_get-event-time", - Short: "Event.AKeyEvent_getEventTime()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAKeyEvent_getFlagsCmd = &cobra.Command{ - Use: "a-key-event_get-flags", - Short: "Event.AKeyEvent_getFlags()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventKeyCodeCmd = &cobra.Command{ - Use: "key-code", - Short: "Event.KeyCode()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAKeyEvent_getMetaStateCmd = &cobra.Command{ - Use: "a-key-event_get-meta-state", - Short: "Event.AKeyEvent_getMetaState()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventRepeatCountCmd = &cobra.Command{ - Use: "repeat-count", - Short: "Event.RepeatCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAKeyEvent_getScanCodeCmd = &cobra.Command{ - Use: "a-key-event_get-scan-code", - Short: "Event.AKeyEvent_getScanCode()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventMotionActionCmd = &cobra.Command{ - Use: "motion-action", - Short: "Event.MotionAction()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getActionButtonCmd = &cobra.Command{ - Use: "a-motion-event_get-action-button", - Short: "Event.AMotionEvent_getActionButton()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getAxisValueCmd = &cobra.Command{ - Use: "a-motion-event_get-axis-value", - Short: "Event.AMotionEvent_getAxisValue()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getButtonStateCmd = &cobra.Command{ - Use: "a-motion-event_get-button-state", - Short: "Event.AMotionEvent_getButtonState()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getClassificationCmd = &cobra.Command{ - Use: "a-motion-event_get-classification", - Short: "Event.AMotionEvent_getClassification()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getDownTimeCmd = &cobra.Command{ - Use: "a-motion-event_get-down-time", - Short: "Event.AMotionEvent_getDownTime()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getEdgeFlagsCmd = &cobra.Command{ - Use: "a-motion-event_get-edge-flags", - Short: "Event.AMotionEvent_getEdgeFlags()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getEventTimeCmd = &cobra.Command{ - Use: "a-motion-event_get-event-time", - Short: "Event.AMotionEvent_getEventTime()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getFlagsCmd = &cobra.Command{ - Use: "a-motion-event_get-flags", - Short: "Event.AMotionEvent_getFlags()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalAxisValueCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-axis-value", - Short: "Event.AMotionEvent_getHistoricalAxisValue()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalEventTimeCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-event-time", - Short: "Event.AMotionEvent_getHistoricalEventTime()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalOrientationCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-orientation", - Short: "Event.AMotionEvent_getHistoricalOrientation()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalPressureCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-pressure", - Short: "Event.AMotionEvent_getHistoricalPressure()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalRawXCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-raw-x", - Short: "Event.AMotionEvent_getHistoricalRawX()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalRawYCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-raw-y", - Short: "Event.AMotionEvent_getHistoricalRawY()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalSizeCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-size", - Short: "Event.AMotionEvent_getHistoricalSize()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalToolMajorCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-tool-major", - Short: "Event.AMotionEvent_getHistoricalToolMajor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalToolMinorCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-tool-minor", - Short: "Event.AMotionEvent_getHistoricalToolMinor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalTouchMajorCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-touch-major", - Short: "Event.AMotionEvent_getHistoricalTouchMajor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalTouchMinorCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-touch-minor", - Short: "Event.AMotionEvent_getHistoricalTouchMinor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalXCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-x", - Short: "Event.AMotionEvent_getHistoricalX()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistoricalYCmd = &cobra.Command{ - Use: "a-motion-event_get-historical-y", - Short: "Event.AMotionEvent_getHistoricalY()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getHistorySizeCmd = &cobra.Command{ - Use: "a-motion-event_get-history-size", - Short: "Event.AMotionEvent_getHistorySize()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getMetaStateCmd = &cobra.Command{ - Use: "a-motion-event_get-meta-state", - Short: "Event.AMotionEvent_getMetaState()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getOrientationCmd = &cobra.Command{ - Use: "a-motion-event_get-orientation", - Short: "Event.AMotionEvent_getOrientation()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventPointerCountCmd = &cobra.Command{ - Use: "pointer-count", - Short: "Event.PointerCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getPointerIDCmd = &cobra.Command{ - Use: "a-motion-event_get-pointer-id", - Short: "Event.AMotionEvent_getPointerID()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventPressureCmd = &cobra.Command{ - Use: "pressure", - Short: "Event.Pressure()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getRawXCmd = &cobra.Command{ - Use: "a-motion-event_get-raw-x", - Short: "Event.AMotionEvent_getRawX()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getRawYCmd = &cobra.Command{ - Use: "a-motion-event_get-raw-y", - Short: "Event.AMotionEvent_getRawY()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getSizeCmd = &cobra.Command{ - Use: "a-motion-event_get-size", - Short: "Event.AMotionEvent_getSize()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getToolMajorCmd = &cobra.Command{ - Use: "a-motion-event_get-tool-major", - Short: "Event.AMotionEvent_getToolMajor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getToolMinorCmd = &cobra.Command{ - Use: "a-motion-event_get-tool-minor", - Short: "Event.AMotionEvent_getToolMinor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getToolTypeCmd = &cobra.Command{ - Use: "a-motion-event_get-tool-type", - Short: "Event.AMotionEvent_getToolType()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getTouchMajorCmd = &cobra.Command{ - Use: "a-motion-event_get-touch-major", - Short: "Event.AMotionEvent_getTouchMajor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getTouchMinorCmd = &cobra.Command{ - Use: "a-motion-event_get-touch-minor", - Short: "Event.AMotionEvent_getTouchMinor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventXCmd = &cobra.Command{ - Use: "x", - Short: "Event.X()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getXOffsetCmd = &cobra.Command{ - Use: "a-motion-event_get-x-offset", - Short: "Event.AMotionEvent_getXOffset()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getXPrecisionCmd = &cobra.Command{ - Use: "a-motion-event_get-x-precision", - Short: "Event.AMotionEvent_getXPrecision()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventYCmd = &cobra.Command{ - Use: "y", - Short: "Event.Y()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getYOffsetCmd = &cobra.Command{ - Use: "a-motion-event_get-y-offset", - Short: "Event.AMotionEvent_getYOffset()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventAMotionEvent_getYPrecisionCmd = &cobra.Command{ - Use: "a-motion-event_get-y-precision", - Short: "Event.AMotionEvent_getYPrecision()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputEventTypeStringCmd = &cobra.Command{ - Use: "string", - Short: "EventType.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputKeyActionStringCmd = &cobra.Command{ - Use: "string", - Short: "KeyAction.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputMotionActionStringCmd = &cobra.Command{ - Use: "string", - Short: "MotionAction.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputQueueGetEventCmd = &cobra.Command{ - Use: "get-event", - Short: "Queue.GetEvent()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputQueueDetachLooperCmd = &cobra.Command{ - Use: "detach-looper", - Short: "Queue.DetachLooper()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputQueueHasEventsCmd = &cobra.Command{ - Use: "has-events", - Short: "Queue.HasEvents()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var inputSourceStringCmd = &cobra.Command{ - Use: "string", - Short: "Source.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - inputCmd.AddCommand(inputErrorCmd) - inputCmd.AddCommand(inputEventCmd) - inputCmd.AddCommand(inputEventTypeCmd2) - inputCmd.AddCommand(inputKeyActionCmd) - inputCmd.AddCommand(inputMotionActionCmd) - inputCmd.AddCommand(inputQueueCmd) - inputCmd.AddCommand(inputSourceCmd) - inputErrorCmd.AddCommand(inputErrorErrorCmd) - inputEventCmd.AddCommand(inputEventGetDeviceIDCmd) - inputEventCmd.AddCommand(inputEventSourceCmd) - inputEventCmd.AddCommand(inputEventTypeCmd) - inputEventCmd.AddCommand(inputEventKeyActionCmd) - inputEventCmd.AddCommand(inputEventAKeyEvent_getDownTimeCmd) - inputEventCmd.AddCommand(inputEventAKeyEvent_getEventTimeCmd) - inputEventCmd.AddCommand(inputEventAKeyEvent_getFlagsCmd) - inputEventCmd.AddCommand(inputEventKeyCodeCmd) - inputEventCmd.AddCommand(inputEventAKeyEvent_getMetaStateCmd) - inputEventCmd.AddCommand(inputEventRepeatCountCmd) - inputEventCmd.AddCommand(inputEventAKeyEvent_getScanCodeCmd) - inputEventCmd.AddCommand(inputEventMotionActionCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getActionButtonCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getAxisValueCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getButtonStateCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getClassificationCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getDownTimeCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getEdgeFlagsCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getEventTimeCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getFlagsCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalAxisValueCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalEventTimeCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalOrientationCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalPressureCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalRawXCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalRawYCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalSizeCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalToolMajorCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalToolMinorCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalTouchMajorCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalTouchMinorCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalXCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistoricalYCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getHistorySizeCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getMetaStateCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getOrientationCmd) - inputEventCmd.AddCommand(inputEventPointerCountCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getPointerIDCmd) - inputEventCmd.AddCommand(inputEventPressureCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getRawXCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getRawYCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getSizeCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getToolMajorCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getToolMinorCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getToolTypeCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getTouchMajorCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getTouchMinorCmd) - inputEventCmd.AddCommand(inputEventXCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getXOffsetCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getXPrecisionCmd) - inputEventCmd.AddCommand(inputEventYCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getYOffsetCmd) - inputEventCmd.AddCommand(inputEventAMotionEvent_getYPrecisionCmd) - inputEventTypeCmd2.AddCommand(inputEventTypeStringCmd) - inputKeyActionCmd.AddCommand(inputKeyActionStringCmd) - inputMotionActionCmd.AddCommand(inputMotionActionStringCmd) - inputQueueCmd.AddCommand(inputQueueGetEventCmd) - inputQueueCmd.AddCommand(inputQueueDetachLooperCmd) - inputQueueCmd.AddCommand(inputQueueHasEventsCmd) - inputSourceCmd.AddCommand(inputSourceStringCmd) - rootCmd.AddCommand(inputCmd) -} diff --git a/cmd/ndkcli/log_cmd_gen.go b/cmd/ndkcli/log_cmd_gen.go deleted file mode 100644 index 99e4201..0000000 --- a/cmd/ndkcli/log_cmd_gen.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - ndklog "github.com/AndroidGoLab/ndk/log" -) - -var logCmd = &cobra.Command{ - Use: "log", - Short: "log NDK module", -} - -var logPriorityCmd = &cobra.Command{ - Use: "priority", - Short: "Priority operations", -} - -var logWriteCmd = &cobra.Command{ - Use: "write", - Short: "log.Write()", - RunE: func(cmd *cobra.Command, args []string) error { - prio, _ := cmd.Flags().GetInt32("prio") - tag, _ := cmd.Flags().GetString("tag") - text, _ := cmd.Flags().GetString("text") - result := ndklog.Write(prio, tag, text) - fmt.Println(result) - return nil - }, -} - -var logPriorityStringCmd = &cobra.Command{ - Use: "string", - Short: "Priority.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - logWriteCmd.Flags().Int32("prio", 0, "prio") - logWriteCmd.Flags().String("tag", "", "tag") - logWriteCmd.Flags().String("text", "", "text") - logCmd.AddCommand(logPriorityCmd) - logCmd.AddCommand(logWriteCmd) - logPriorityCmd.AddCommand(logPriorityStringCmd) - rootCmd.AddCommand(logCmd) -} diff --git a/cmd/ndkcli/looper_gen.go b/cmd/ndkcli/looper_gen.go deleted file mode 100644 index a4122ae..0000000 --- a/cmd/ndkcli/looper_gen.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/looper" -) - -var looperCmd = &cobra.Command{ - Use: "looper", - Short: "looper NDK module", -} - -var looperErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var looperLooperCmd = &cobra.Command{ - Use: "looper", - Short: "Looper operations", -} - -var looperALooper_forThreadCmd = &cobra.Command{ - Use: "a-looper_for-thread", - Short: "looper.ALooper_forThread()", - RunE: func(cmd *cobra.Command, args []string) error { - result := looper.ALooper_forThread() - fmt.Println(result) - return nil - }, -} - -var looperPrepareCmd = &cobra.Command{ - Use: "prepare", - Short: "looper.Prepare()", - RunE: func(cmd *cobra.Command, args []string) error { - opts, _ := cmd.Flags().GetInt32("opts") - result := looper.Prepare(opts) - fmt.Println(result) - return nil - }, -} - -var looperErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var looperLooperAcquireCmd = &cobra.Command{ - Use: "acquire", - Short: "Looper.Acquire()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var looperLooperRemoveFdCmd = &cobra.Command{ - Use: "remove-fd", - Short: "Looper.RemoveFd()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var looperLooperWakeCmd = &cobra.Command{ - Use: "wake", - Short: "Looper.Wake()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - looperPrepareCmd.Flags().Int32("opts", 0, "opts") - looperCmd.AddCommand(looperErrorCmd) - looperCmd.AddCommand(looperLooperCmd) - looperCmd.AddCommand(looperALooper_forThreadCmd) - looperCmd.AddCommand(looperPrepareCmd) - looperErrorCmd.AddCommand(looperErrorErrorCmd) - looperLooperCmd.AddCommand(looperLooperAcquireCmd) - looperLooperCmd.AddCommand(looperLooperRemoveFdCmd) - looperLooperCmd.AddCommand(looperLooperWakeCmd) - rootCmd.AddCommand(looperCmd) -} diff --git a/cmd/ndkcli/looper_workflow.go b/cmd/ndkcli/looper_workflow.go deleted file mode 100644 index a1ef025..0000000 --- a/cmd/ndkcli/looper_workflow.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "fmt" - "runtime" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/looper" -) - -var looperTestCmd = &cobra.Command{ - Use: "test", - Short: "Prepare a looper, wake it, and poll once to verify looper functionality", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - // Looper must be used on a locked OS thread. - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - lp := looper.Prepare(1) // 1 = ALOOPER_PREPARE_ALLOW_NON_CALLBACKS - if lp.Pointer() == nil { - return fmt.Errorf("looper.Prepare returned nil") - } - defer lp.Close() - - fmt.Println("looper prepared successfully") - - lp.Wake() - fmt.Println("looper.Wake called") - - result := looper.PollOnce(0, nil, nil, nil) - fmt.Printf("looper.PollOnce(0) result: %d\n", result) - - return nil - }, -} - -func init() { - looperCmd.AddCommand(looperTestCmd) -} diff --git a/cmd/ndkcli/main.go b/cmd/ndkcli/main.go deleted file mode 100644 index a5a50d9..0000000 --- a/cmd/ndkcli/main.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -import ( - "fmt" - "os" -) - -func main() { - if err := rootCmd.Execute(); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } -} diff --git a/cmd/ndkcli/media_gen.go b/cmd/ndkcli/media_gen.go deleted file mode 100644 index 5d26bc0..0000000 --- a/cmd/ndkcli/media_gen.go +++ /dev/null @@ -1,1235 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/media" -) - -var mediaCmd = &cobra.Command{ - Use: "media", - Short: "media NDK module", -} - -var mediaCodecCmd = &cobra.Command{ - Use: "codec", - Short: "Codec operations", -} - -var mediaCodecAudioCapabilitiesCmd = &cobra.Command{ - Use: "codec-audio-capabilities", - Short: "CodecAudioCapabilities operations", -} - -var mediaCodecEncoderCapabilitiesCmd = &cobra.Command{ - Use: "codec-encoder-capabilities", - Short: "CodecEncoderCapabilities operations", -} - -var mediaCodecVideoCapabilitiesCmd = &cobra.Command{ - Use: "codec-video-capabilities", - Short: "CodecVideoCapabilities operations", -} - -var mediaErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var mediaExtractorCmd = &cobra.Command{ - Use: "extractor", - Short: "Extractor operations", -} - -var mediaFormatCmd = &cobra.Command{ - Use: "format", - Short: "Format operations", -} - -var mediaImageCmd = &cobra.Command{ - Use: "image", - Short: "Image operations", -} - -var mediaImageReaderCmd = &cobra.Command{ - Use: "image-reader", - Short: "ImageReader operations", -} - -var mediaMediaCodecCryptoInfoCmd = &cobra.Command{ - Use: "media-codec-crypto-info", - Short: "MediaCodecCryptoInfo operations", -} - -var mediaMediaCodecInfoCmd = &cobra.Command{ - Use: "media-codec-info", - Short: "MediaCodecInfo operations", -} - -var mediaMediaDataSourceCmd = &cobra.Command{ - Use: "media-data-source", - Short: "MediaDataSource operations", -} - -var mediaMuxerCmd = &cobra.Command{ - Use: "muxer", - Short: "Muxer operations", -} - -var mediaAMediaCodec_createCodecByNameCmd = &cobra.Command{ - Use: "a-media-codec_create-codec-by-name", - Short: "media.AMediaCodec_createCodecByName()", - RunE: func(cmd *cobra.Command, args []string) error { - name, _ := cmd.Flags().GetString("name") - result := media.AMediaCodec_createCodecByName(name) - fmt.Println(result) - return nil - }, -} - -var mediaNewDecoderCmd = &cobra.Command{ - Use: "new-decoder", - Short: "media.NewDecoder()", - RunE: func(cmd *cobra.Command, args []string) error { - mime_type, _ := cmd.Flags().GetString("mime_type") - result := media.NewDecoder(mime_type) - fmt.Println(result) - return nil - }, -} - -var mediaNewEncoderCmd = &cobra.Command{ - Use: "new-encoder", - Short: "media.NewEncoder()", - RunE: func(cmd *cobra.Command, args []string) error { - mime_type, _ := cmd.Flags().GetString("mime_type") - result := media.NewEncoder(mime_type) - fmt.Println(result) - return nil - }, -} - -var mediaAMediaCodecActionCode_isRecoverableCmd = &cobra.Command{ - Use: "a-media-codec-action-code_is-recoverable", - Short: "media.AMediaCodecActionCode_isRecoverable()", - RunE: func(cmd *cobra.Command, args []string) error { - actionCode, _ := cmd.Flags().GetInt32("action-code") - result := media.AMediaCodecActionCode_isRecoverable(actionCode) - fmt.Println(result) - return nil - }, -} - -var mediaAMediaCodecActionCode_isTransientCmd = &cobra.Command{ - Use: "a-media-codec-action-code_is-transient", - Short: "media.AMediaCodecActionCode_isTransient()", - RunE: func(cmd *cobra.Command, args []string) error { - actionCode, _ := cmd.Flags().GetInt32("action-code") - result := media.AMediaCodecActionCode_isTransient(actionCode) - fmt.Println(result) - return nil - }, -} - -var mediaAMediaCrypto_requiresSecureDecoderComponentCmd = &cobra.Command{ - Use: "a-media-crypto_requires-secure-decoder-component", - Short: "media.AMediaCrypto_requiresSecureDecoderComponent()", - RunE: func(cmd *cobra.Command, args []string) error { - mime, _ := cmd.Flags().GetString("mime") - result := media.AMediaCrypto_requiresSecureDecoderComponent(mime) - fmt.Println(result) - return nil - }, -} - -var mediaNewImageReaderWithUsageCmd = &cobra.Command{ - Use: "new-image-reader-with-usage", - Short: "media.NewImageReaderWithUsage()", - RunE: func(cmd *cobra.Command, args []string) error { - width, _ := cmd.Flags().GetInt32("width") - height, _ := cmd.Flags().GetInt32("height") - format, _ := cmd.Flags().GetInt32("format") - usage, _ := cmd.Flags().GetUint64("usage") - maxImages, _ := cmd.Flags().GetInt32("max-images") - result, err := media.NewImageReaderWithUsage(width, height, format, usage, maxImages) - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var mediaCodecFlushCmd = &cobra.Command{ - Use: "flush", - Short: "Codec.Flush()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecGetBufferFormatCmd = &cobra.Command{ - Use: "get-buffer-format", - Short: "Codec.GetBufferFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecGetInputBufferCmd = &cobra.Command{ - Use: "get-input-buffer", - Short: "Codec.GetInputBuffer()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecGetInputFormatCmd = &cobra.Command{ - Use: "get-input-format", - Short: "Codec.GetInputFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecGetOutputBufferCmd = &cobra.Command{ - Use: "get-output-buffer", - Short: "Codec.GetOutputBuffer()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecReleaseNameCmd = &cobra.Command{ - Use: "release-name", - Short: "Codec.ReleaseName()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecReleaseOutputBufferCmd = &cobra.Command{ - Use: "release-output-buffer", - Short: "Codec.ReleaseOutputBuffer()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecStartCmd = &cobra.Command{ - Use: "start", - Short: "Codec.Start()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecStopCmd = &cobra.Command{ - Use: "stop", - Short: "Codec.Stop()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecAudioCapabilitiesGetMaxInputChannelCountCmd = &cobra.Command{ - Use: "get-max-input-channel-count", - Short: "CodecAudioCapabilities.GetMaxInputChannelCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecAudioCapabilitiesGetMinInputChannelCountCmd = &cobra.Command{ - Use: "get-min-input-channel-count", - Short: "CodecAudioCapabilities.GetMinInputChannelCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecAudioCapabilitiesIsSampleRateSupportedCmd = &cobra.Command{ - Use: "is-sample-rate-supported", - Short: "CodecAudioCapabilities.IsSampleRateSupported()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecEncoderCapabilitiesIsBitrateModeSupportedCmd = &cobra.Command{ - Use: "is-bitrate-mode-supported", - Short: "CodecEncoderCapabilities.IsBitrateModeSupported()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecVideoCapabilitiesAreSizeAndRateSupportedCmd = &cobra.Command{ - Use: "are-size-and-rate-supported", - Short: "CodecVideoCapabilities.AreSizeAndRateSupported()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecVideoCapabilitiesGetHeightAlignmentCmd = &cobra.Command{ - Use: "get-height-alignment", - Short: "CodecVideoCapabilities.GetHeightAlignment()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecVideoCapabilitiesGetWidthAlignmentCmd = &cobra.Command{ - Use: "get-width-alignment", - Short: "CodecVideoCapabilities.GetWidthAlignment()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaCodecVideoCapabilitiesIsSizeSupportedCmd = &cobra.Command{ - Use: "is-size-supported", - Short: "CodecVideoCapabilities.IsSizeSupported()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaExtractorNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Extractor", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var mediaExtractorGetCachedDurationCmd = &cobra.Command{ - Use: "get-cached-duration", - Short: "Extractor.GetCachedDuration()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - result := obj.GetCachedDuration() - fmt.Println(result) - return nil - }, -} - -var mediaExtractorGetFileFormatCmd = &cobra.Command{ - Use: "get-file-format", - Short: "Extractor.GetFileFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - result := obj.GetFileFormat() - fmt.Println(result) - return nil - }, -} - -var mediaExtractorGetPsshInfoCmd = &cobra.Command{ - Use: "get-pssh-info", - Short: "Extractor.GetPsshInfo()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - result := obj.GetPsshInfo() - fmt.Println(result) - return nil - }, -} - -var mediaExtractorGetSampleCryptoInfoCmd = &cobra.Command{ - Use: "get-sample-crypto-info", - Short: "Extractor.GetSampleCryptoInfo()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - result := obj.GetSampleCryptoInfo() - fmt.Println(result) - return nil - }, -} - -var mediaExtractorGetSampleFlagsCmd = &cobra.Command{ - Use: "get-sample-flags", - Short: "Extractor.GetSampleFlags()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - err := obj.GetSampleFlags() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var mediaExtractorGetSampleSizeCmd = &cobra.Command{ - Use: "get-sample-size", - Short: "Extractor.GetSampleSize()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - result := obj.GetSampleSize() - fmt.Println(result) - return nil - }, -} - -var mediaExtractorSampleTimeCmd = &cobra.Command{ - Use: "sample-time", - Short: "Extractor.SampleTime()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - result := obj.SampleTime() - fmt.Println(result) - return nil - }, -} - -var mediaExtractorGetSampleTrackIndexCmd = &cobra.Command{ - Use: "get-sample-track-index", - Short: "Extractor.GetSampleTrackIndex()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - err := obj.GetSampleTrackIndex() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var mediaExtractorTrackCountCmd = &cobra.Command{ - Use: "track-count", - Short: "Extractor.TrackCount()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - result := obj.TrackCount() - fmt.Println(result) - return nil - }, -} - -var mediaExtractorSelectTrackCmd = &cobra.Command{ - Use: "select-track", - Short: "Extractor.SelectTrack()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewExtractor() - defer obj.Close() - idx, _ := cmd.Flags().GetUint64("idx") - err := obj.SelectTrack(idx) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var mediaFormatNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Format", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var mediaFormatClearCmd = &cobra.Command{ - Use: "clear", - Short: "Format.Clear()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - obj.Clear() - fmt.Println("ok") - return nil - }, -} - -var mediaFormatGetDoubleCmd = &cobra.Command{ - Use: "get-double", - Short: "Format.GetDouble()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - var out float64 - // output param out printed below - result := obj.GetDouble(name, &out) - fmt.Println(result) - return nil - }, -} - -var mediaFormatGetFloatCmd = &cobra.Command{ - Use: "get-float", - Short: "Format.GetFloat()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - var out float32 - // output param out printed below - result := obj.GetFloat(name, &out) - fmt.Println(result) - return nil - }, -} - -var mediaFormatGetInt32Cmd = &cobra.Command{ - Use: "get-int32", - Short: "Format.GetInt32()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - var out int32 - // output param out printed below - result := obj.GetInt32(name, &out) - fmt.Println(result) - return nil - }, -} - -var mediaFormatGetInt64Cmd = &cobra.Command{ - Use: "get-int64", - Short: "Format.GetInt64()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - var out int64 - // output param out printed below - result := obj.GetInt64(name, &out) - fmt.Println(result) - return nil - }, -} - -var mediaFormatGetRectCmd = &cobra.Command{ - Use: "get-rect", - Short: "Format.GetRect()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - var left int32 - var top int32 - var right int32 - var bottom int32 - // output param left printed below - // output param top printed below - // output param right printed below - // output param bottom printed below - result := obj.GetRect(name, &left, &top, &right, &bottom) - fmt.Println(result) - return nil - }, -} - -var mediaFormatGetSizeCmd = &cobra.Command{ - Use: "get-size", - Short: "Format.GetSize()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - var out uint64 - // output param out printed below - result := obj.GetSize(name, &out) - fmt.Println(result) - return nil - }, -} - -var mediaFormatSetDoubleCmd = &cobra.Command{ - Use: "set-double", - Short: "Format.SetDouble()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - value, _ := cmd.Flags().GetFloat64("value") - obj.SetDouble(name, value) - fmt.Println("ok") - return nil - }, -} - -var mediaFormatSetFloatCmd = &cobra.Command{ - Use: "set-float", - Short: "Format.SetFloat()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - value, _ := cmd.Flags().GetFloat32("value") - obj.SetFloat(name, value) - fmt.Println("ok") - return nil - }, -} - -var mediaFormatSetInt32Cmd = &cobra.Command{ - Use: "set-int32", - Short: "Format.SetInt32()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - value, _ := cmd.Flags().GetInt32("value") - result := obj.SetInt32(name, value) - fmt.Println(result) - return nil - }, -} - -var mediaFormatSetInt64Cmd = &cobra.Command{ - Use: "set-int64", - Short: "Format.SetInt64()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - value, _ := cmd.Flags().GetInt64("value") - obj.SetInt64(name, value) - fmt.Println("ok") - return nil - }, -} - -var mediaFormatSetRectCmd = &cobra.Command{ - Use: "set-rect", - Short: "Format.SetRect()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - left, _ := cmd.Flags().GetInt32("left") - top, _ := cmd.Flags().GetInt32("top") - right, _ := cmd.Flags().GetInt32("right") - bottom, _ := cmd.Flags().GetInt32("bottom") - obj.SetRect(name, left, top, right, bottom) - fmt.Println("ok") - return nil - }, -} - -var mediaFormatSetSizeCmd = &cobra.Command{ - Use: "set-size", - Short: "Format.SetSize()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - value, _ := cmd.Flags().GetUint64("value") - obj.SetSize(name, value) - fmt.Println("ok") - return nil - }, -} - -var mediaFormatSetStringCmd = &cobra.Command{ - Use: "set-string", - Short: "Format.SetString()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - name, _ := cmd.Flags().GetString("name") - value, _ := cmd.Flags().GetString("value") - result := obj.SetString(name, value) - fmt.Println(result) - return nil - }, -} - -var mediaFormatToStringCmd = &cobra.Command{ - Use: "to-string", - Short: "Format.ToString()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewFormat() - defer obj.Close() - result := obj.ToString() - fmt.Println(result) - return nil - }, -} - -var mediaImageDeleteAsyncCmd = &cobra.Command{ - Use: "delete-async", - Short: "Image.DeleteAsync()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImageFormatCmd = &cobra.Command{ - Use: "format", - Short: "Image.Format()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImageHeightCmd = &cobra.Command{ - Use: "height", - Short: "Image.Height()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImageNumberOfPlanesCmd = &cobra.Command{ - Use: "number-of-planes", - Short: "Image.NumberOfPlanes()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImagePlaneDataCmd = &cobra.Command{ - Use: "plane-data", - Short: "Image.PlaneData()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImagePlanePixelStrideCmd = &cobra.Command{ - Use: "plane-pixel-stride", - Short: "Image.PlanePixelStride()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImagePlaneRowStrideCmd = &cobra.Command{ - Use: "plane-row-stride", - Short: "Image.PlaneRowStride()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImageTimestampCmd = &cobra.Command{ - Use: "timestamp", - Short: "Image.Timestamp()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImageWidthCmd = &cobra.Command{ - Use: "width", - Short: "Image.Width()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaImageReaderNewCmd = &cobra.Command{ - Use: "new", - Short: "Create ImageReader", - RunE: func(cmd *cobra.Command, args []string) error { - width, _ := cmd.Flags().GetInt32("width") - height, _ := cmd.Flags().GetInt32("height") - format, _ := cmd.Flags().GetInt32("format") - maxImages, _ := cmd.Flags().GetInt32("max-images") - obj, err := media.NewImageReader(width, height, format, maxImages) - if err != nil { - return err - } - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var mediaImageReaderAcquireLatestImageCmd = &cobra.Command{ - Use: "acquire-latest-image", - Short: "ImageReader.AcquireLatestImage()", - RunE: func(cmd *cobra.Command, args []string) error { - ctorWidth, _ := cmd.Flags().GetInt32("ctor-width") - ctorHeight, _ := cmd.Flags().GetInt32("ctor-height") - ctorFormat, _ := cmd.Flags().GetInt32("ctor-format") - ctorMaxImages, _ := cmd.Flags().GetInt32("ctor-max-images") - obj, err := media.NewImageReader(ctorWidth, ctorHeight, ctorFormat, ctorMaxImages) - if err != nil { - return err - } - defer obj.Close() - result, err := obj.AcquireLatestImage() - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var mediaImageReaderAcquireNextImageCmd = &cobra.Command{ - Use: "acquire-next-image", - Short: "ImageReader.AcquireNextImage()", - RunE: func(cmd *cobra.Command, args []string) error { - ctorWidth, _ := cmd.Flags().GetInt32("ctor-width") - ctorHeight, _ := cmd.Flags().GetInt32("ctor-height") - ctorFormat, _ := cmd.Flags().GetInt32("ctor-format") - ctorMaxImages, _ := cmd.Flags().GetInt32("ctor-max-images") - obj, err := media.NewImageReader(ctorWidth, ctorHeight, ctorFormat, ctorMaxImages) - if err != nil { - return err - } - defer obj.Close() - result, err := obj.AcquireNextImage() - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var mediaImageReaderFormatCmd = &cobra.Command{ - Use: "format", - Short: "ImageReader.Format()", - RunE: func(cmd *cobra.Command, args []string) error { - ctorWidth, _ := cmd.Flags().GetInt32("ctor-width") - ctorHeight, _ := cmd.Flags().GetInt32("ctor-height") - ctorFormat, _ := cmd.Flags().GetInt32("ctor-format") - ctorMaxImages, _ := cmd.Flags().GetInt32("ctor-max-images") - obj, err := media.NewImageReader(ctorWidth, ctorHeight, ctorFormat, ctorMaxImages) - if err != nil { - return err - } - defer obj.Close() - var format int32 - // output param format printed below - err = obj.Format(&format) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var mediaImageReaderHeightCmd = &cobra.Command{ - Use: "height", - Short: "ImageReader.Height()", - RunE: func(cmd *cobra.Command, args []string) error { - ctorWidth, _ := cmd.Flags().GetInt32("ctor-width") - ctorHeight, _ := cmd.Flags().GetInt32("ctor-height") - ctorFormat, _ := cmd.Flags().GetInt32("ctor-format") - ctorMaxImages, _ := cmd.Flags().GetInt32("ctor-max-images") - obj, err := media.NewImageReader(ctorWidth, ctorHeight, ctorFormat, ctorMaxImages) - if err != nil { - return err - } - defer obj.Close() - var height int32 - // output param height printed below - err = obj.Height(&height) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var mediaImageReaderMaxImagesCmd = &cobra.Command{ - Use: "max-images", - Short: "ImageReader.MaxImages()", - RunE: func(cmd *cobra.Command, args []string) error { - ctorWidth, _ := cmd.Flags().GetInt32("ctor-width") - ctorHeight, _ := cmd.Flags().GetInt32("ctor-height") - ctorFormat, _ := cmd.Flags().GetInt32("ctor-format") - ctorMaxImages, _ := cmd.Flags().GetInt32("ctor-max-images") - obj, err := media.NewImageReader(ctorWidth, ctorHeight, ctorFormat, ctorMaxImages) - if err != nil { - return err - } - defer obj.Close() - var maxImages int32 - // output param maxImages printed below - err = obj.MaxImages(&maxImages) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var mediaImageReaderWidthCmd = &cobra.Command{ - Use: "width", - Short: "ImageReader.Width()", - RunE: func(cmd *cobra.Command, args []string) error { - ctorWidth, _ := cmd.Flags().GetInt32("ctor-width") - ctorHeight, _ := cmd.Flags().GetInt32("ctor-height") - ctorFormat, _ := cmd.Flags().GetInt32("ctor-format") - ctorMaxImages, _ := cmd.Flags().GetInt32("ctor-max-images") - obj, err := media.NewImageReader(ctorWidth, ctorHeight, ctorFormat, ctorMaxImages) - if err != nil { - return err - } - defer obj.Close() - var width int32 - // output param width printed below - err = obj.Width(&width) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var mediaImageReaderWindowCmd = &cobra.Command{ - Use: "window", - Short: "ImageReader.Window()", - RunE: func(cmd *cobra.Command, args []string) error { - ctorWidth, _ := cmd.Flags().GetInt32("ctor-width") - ctorHeight, _ := cmd.Flags().GetInt32("ctor-height") - ctorFormat, _ := cmd.Flags().GetInt32("ctor-format") - ctorMaxImages, _ := cmd.Flags().GetInt32("ctor-max-images") - obj, err := media.NewImageReader(ctorWidth, ctorHeight, ctorFormat, ctorMaxImages) - if err != nil { - return err - } - defer obj.Close() - result, err := obj.Window() - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var mediaMediaCodecCryptoInfoGetNumSubSamplesCmd = &cobra.Command{ - Use: "get-num-sub-samples", - Short: "MediaCodecCryptoInfo.GetNumSubSamples()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMediaCodecInfoGetCanonicalNameCmd = &cobra.Command{ - Use: "get-canonical-name", - Short: "MediaCodecInfo.GetCanonicalName()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMediaCodecInfoGetMaxSupportedInstancesCmd = &cobra.Command{ - Use: "get-max-supported-instances", - Short: "MediaCodecInfo.GetMaxSupportedInstances()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMediaCodecInfoGetMediaTypeCmd = &cobra.Command{ - Use: "get-media-type", - Short: "MediaCodecInfo.GetMediaType()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMediaCodecInfoIsFeatureRequiredCmd = &cobra.Command{ - Use: "is-feature-required", - Short: "MediaCodecInfo.IsFeatureRequired()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMediaCodecInfoIsFeatureSupportedCmd = &cobra.Command{ - Use: "is-feature-supported", - Short: "MediaCodecInfo.IsFeatureSupported()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMediaCodecInfoIsVendorCmd = &cobra.Command{ - Use: "is-vendor", - Short: "MediaCodecInfo.IsVendor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMediaDataSourceNewCmd = &cobra.Command{ - Use: "new", - Short: "Create MediaDataSource", - RunE: func(cmd *cobra.Command, args []string) error { - obj := media.NewMediaDataSource() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var mediaMuxerGetTrackCountCmd = &cobra.Command{ - Use: "get-track-count", - Short: "Muxer.GetTrackCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMuxerGetTrackFormatCmd = &cobra.Command{ - Use: "get-track-format", - Short: "Muxer.GetTrackFormat()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMuxerStartCmd = &cobra.Command{ - Use: "start", - Short: "Muxer.Start()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var mediaMuxerStopCmd = &cobra.Command{ - Use: "stop", - Short: "Muxer.Stop()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - mediaAMediaCodec_createCodecByNameCmd.Flags().String("name", "", "name") - mediaNewDecoderCmd.Flags().String("mime_type", "", "mime_type") - mediaNewEncoderCmd.Flags().String("mime_type", "", "mime_type") - mediaAMediaCodecActionCode_isRecoverableCmd.Flags().Int32("action-code", 0, "actionCode") - mediaAMediaCodecActionCode_isTransientCmd.Flags().Int32("action-code", 0, "actionCode") - mediaAMediaCrypto_requiresSecureDecoderComponentCmd.Flags().String("mime", "", "mime") - mediaNewImageReaderWithUsageCmd.Flags().Int32("width", 0, "width") - mediaNewImageReaderWithUsageCmd.Flags().Int32("height", 0, "height") - mediaNewImageReaderWithUsageCmd.Flags().Int32("format", 0, "format") - mediaNewImageReaderWithUsageCmd.Flags().Uint64("usage", 0, "usage") - mediaNewImageReaderWithUsageCmd.Flags().Int32("max-images", 0, "maxImages") - mediaExtractorSelectTrackCmd.Flags().Uint64("idx", 0, "idx") - mediaFormatGetDoubleCmd.Flags().String("name", "", "name") - mediaFormatGetFloatCmd.Flags().String("name", "", "name") - mediaFormatGetInt32Cmd.Flags().String("name", "", "name") - mediaFormatGetInt64Cmd.Flags().String("name", "", "name") - mediaFormatGetRectCmd.Flags().String("name", "", "name") - mediaFormatGetSizeCmd.Flags().String("name", "", "name") - mediaFormatSetDoubleCmd.Flags().String("name", "", "name") - mediaFormatSetDoubleCmd.Flags().Float64("value", 0, "value") - mediaFormatSetFloatCmd.Flags().String("name", "", "name") - mediaFormatSetFloatCmd.Flags().Float32("value", 0, "value") - mediaFormatSetInt32Cmd.Flags().String("name", "", "name") - mediaFormatSetInt32Cmd.Flags().Int32("value", 0, "value") - mediaFormatSetInt64Cmd.Flags().String("name", "", "name") - mediaFormatSetInt64Cmd.Flags().Int64("value", 0, "value") - mediaFormatSetRectCmd.Flags().String("name", "", "name") - mediaFormatSetRectCmd.Flags().Int32("left", 0, "left") - mediaFormatSetRectCmd.Flags().Int32("top", 0, "top") - mediaFormatSetRectCmd.Flags().Int32("right", 0, "right") - mediaFormatSetRectCmd.Flags().Int32("bottom", 0, "bottom") - mediaFormatSetSizeCmd.Flags().String("name", "", "name") - mediaFormatSetSizeCmd.Flags().Uint64("value", 0, "value") - mediaFormatSetStringCmd.Flags().String("name", "", "name") - mediaFormatSetStringCmd.Flags().String("value", "", "value") - mediaImageReaderNewCmd.Flags().Int32("width", 0, "width") - mediaImageReaderNewCmd.Flags().Int32("height", 0, "height") - mediaImageReaderNewCmd.Flags().Int32("format", 0, "format") - mediaImageReaderNewCmd.Flags().Int32("max-images", 0, "maxImages") - mediaImageReaderAcquireLatestImageCmd.Flags().Int32("ctor-width", 0, "width") - mediaImageReaderAcquireLatestImageCmd.Flags().Int32("ctor-height", 0, "height") - mediaImageReaderAcquireLatestImageCmd.Flags().Int32("ctor-format", 0, "format") - mediaImageReaderAcquireLatestImageCmd.Flags().Int32("ctor-max-images", 0, "maxImages") - mediaImageReaderAcquireNextImageCmd.Flags().Int32("ctor-width", 0, "width") - mediaImageReaderAcquireNextImageCmd.Flags().Int32("ctor-height", 0, "height") - mediaImageReaderAcquireNextImageCmd.Flags().Int32("ctor-format", 0, "format") - mediaImageReaderAcquireNextImageCmd.Flags().Int32("ctor-max-images", 0, "maxImages") - mediaImageReaderFormatCmd.Flags().Int32("ctor-width", 0, "width") - mediaImageReaderFormatCmd.Flags().Int32("ctor-height", 0, "height") - mediaImageReaderFormatCmd.Flags().Int32("ctor-format", 0, "format") - mediaImageReaderFormatCmd.Flags().Int32("ctor-max-images", 0, "maxImages") - mediaImageReaderHeightCmd.Flags().Int32("ctor-width", 0, "width") - mediaImageReaderHeightCmd.Flags().Int32("ctor-height", 0, "height") - mediaImageReaderHeightCmd.Flags().Int32("ctor-format", 0, "format") - mediaImageReaderHeightCmd.Flags().Int32("ctor-max-images", 0, "maxImages") - mediaImageReaderMaxImagesCmd.Flags().Int32("ctor-width", 0, "width") - mediaImageReaderMaxImagesCmd.Flags().Int32("ctor-height", 0, "height") - mediaImageReaderMaxImagesCmd.Flags().Int32("ctor-format", 0, "format") - mediaImageReaderMaxImagesCmd.Flags().Int32("ctor-max-images", 0, "maxImages") - mediaImageReaderWidthCmd.Flags().Int32("ctor-width", 0, "width") - mediaImageReaderWidthCmd.Flags().Int32("ctor-height", 0, "height") - mediaImageReaderWidthCmd.Flags().Int32("ctor-format", 0, "format") - mediaImageReaderWidthCmd.Flags().Int32("ctor-max-images", 0, "maxImages") - mediaImageReaderWindowCmd.Flags().Int32("ctor-width", 0, "width") - mediaImageReaderWindowCmd.Flags().Int32("ctor-height", 0, "height") - mediaImageReaderWindowCmd.Flags().Int32("ctor-format", 0, "format") - mediaImageReaderWindowCmd.Flags().Int32("ctor-max-images", 0, "maxImages") - mediaCmd.AddCommand(mediaCodecCmd) - mediaCmd.AddCommand(mediaCodecAudioCapabilitiesCmd) - mediaCmd.AddCommand(mediaCodecEncoderCapabilitiesCmd) - mediaCmd.AddCommand(mediaCodecVideoCapabilitiesCmd) - mediaCmd.AddCommand(mediaErrorCmd) - mediaCmd.AddCommand(mediaExtractorCmd) - mediaCmd.AddCommand(mediaFormatCmd) - mediaCmd.AddCommand(mediaImageCmd) - mediaCmd.AddCommand(mediaImageReaderCmd) - mediaCmd.AddCommand(mediaMediaCodecCryptoInfoCmd) - mediaCmd.AddCommand(mediaMediaCodecInfoCmd) - mediaCmd.AddCommand(mediaMediaDataSourceCmd) - mediaCmd.AddCommand(mediaMuxerCmd) - mediaCmd.AddCommand(mediaAMediaCodec_createCodecByNameCmd) - mediaCmd.AddCommand(mediaNewDecoderCmd) - mediaCmd.AddCommand(mediaNewEncoderCmd) - mediaCmd.AddCommand(mediaAMediaCodecActionCode_isRecoverableCmd) - mediaCmd.AddCommand(mediaAMediaCodecActionCode_isTransientCmd) - mediaCmd.AddCommand(mediaAMediaCrypto_requiresSecureDecoderComponentCmd) - mediaCmd.AddCommand(mediaNewImageReaderWithUsageCmd) - mediaCodecCmd.AddCommand(mediaCodecFlushCmd) - mediaCodecCmd.AddCommand(mediaCodecGetBufferFormatCmd) - mediaCodecCmd.AddCommand(mediaCodecGetInputBufferCmd) - mediaCodecCmd.AddCommand(mediaCodecGetInputFormatCmd) - mediaCodecCmd.AddCommand(mediaCodecGetOutputBufferCmd) - mediaCodecCmd.AddCommand(mediaCodecReleaseNameCmd) - mediaCodecCmd.AddCommand(mediaCodecReleaseOutputBufferCmd) - mediaCodecCmd.AddCommand(mediaCodecStartCmd) - mediaCodecCmd.AddCommand(mediaCodecStopCmd) - mediaCodecAudioCapabilitiesCmd.AddCommand(mediaCodecAudioCapabilitiesGetMaxInputChannelCountCmd) - mediaCodecAudioCapabilitiesCmd.AddCommand(mediaCodecAudioCapabilitiesGetMinInputChannelCountCmd) - mediaCodecAudioCapabilitiesCmd.AddCommand(mediaCodecAudioCapabilitiesIsSampleRateSupportedCmd) - mediaCodecEncoderCapabilitiesCmd.AddCommand(mediaCodecEncoderCapabilitiesIsBitrateModeSupportedCmd) - mediaCodecVideoCapabilitiesCmd.AddCommand(mediaCodecVideoCapabilitiesAreSizeAndRateSupportedCmd) - mediaCodecVideoCapabilitiesCmd.AddCommand(mediaCodecVideoCapabilitiesGetHeightAlignmentCmd) - mediaCodecVideoCapabilitiesCmd.AddCommand(mediaCodecVideoCapabilitiesGetWidthAlignmentCmd) - mediaCodecVideoCapabilitiesCmd.AddCommand(mediaCodecVideoCapabilitiesIsSizeSupportedCmd) - mediaErrorCmd.AddCommand(mediaErrorErrorCmd) - mediaExtractorCmd.AddCommand(mediaExtractorNewCmd) - mediaExtractorCmd.AddCommand(mediaExtractorGetCachedDurationCmd) - mediaExtractorCmd.AddCommand(mediaExtractorGetFileFormatCmd) - mediaExtractorCmd.AddCommand(mediaExtractorGetPsshInfoCmd) - mediaExtractorCmd.AddCommand(mediaExtractorGetSampleCryptoInfoCmd) - mediaExtractorCmd.AddCommand(mediaExtractorGetSampleFlagsCmd) - mediaExtractorCmd.AddCommand(mediaExtractorGetSampleSizeCmd) - mediaExtractorCmd.AddCommand(mediaExtractorSampleTimeCmd) - mediaExtractorCmd.AddCommand(mediaExtractorGetSampleTrackIndexCmd) - mediaExtractorCmd.AddCommand(mediaExtractorTrackCountCmd) - mediaExtractorCmd.AddCommand(mediaExtractorSelectTrackCmd) - mediaFormatCmd.AddCommand(mediaFormatNewCmd) - mediaFormatCmd.AddCommand(mediaFormatClearCmd) - mediaFormatCmd.AddCommand(mediaFormatGetDoubleCmd) - mediaFormatCmd.AddCommand(mediaFormatGetFloatCmd) - mediaFormatCmd.AddCommand(mediaFormatGetInt32Cmd) - mediaFormatCmd.AddCommand(mediaFormatGetInt64Cmd) - mediaFormatCmd.AddCommand(mediaFormatGetRectCmd) - mediaFormatCmd.AddCommand(mediaFormatGetSizeCmd) - mediaFormatCmd.AddCommand(mediaFormatSetDoubleCmd) - mediaFormatCmd.AddCommand(mediaFormatSetFloatCmd) - mediaFormatCmd.AddCommand(mediaFormatSetInt32Cmd) - mediaFormatCmd.AddCommand(mediaFormatSetInt64Cmd) - mediaFormatCmd.AddCommand(mediaFormatSetRectCmd) - mediaFormatCmd.AddCommand(mediaFormatSetSizeCmd) - mediaFormatCmd.AddCommand(mediaFormatSetStringCmd) - mediaFormatCmd.AddCommand(mediaFormatToStringCmd) - mediaImageCmd.AddCommand(mediaImageDeleteAsyncCmd) - mediaImageCmd.AddCommand(mediaImageFormatCmd) - mediaImageCmd.AddCommand(mediaImageHeightCmd) - mediaImageCmd.AddCommand(mediaImageNumberOfPlanesCmd) - mediaImageCmd.AddCommand(mediaImagePlaneDataCmd) - mediaImageCmd.AddCommand(mediaImagePlanePixelStrideCmd) - mediaImageCmd.AddCommand(mediaImagePlaneRowStrideCmd) - mediaImageCmd.AddCommand(mediaImageTimestampCmd) - mediaImageCmd.AddCommand(mediaImageWidthCmd) - mediaImageReaderCmd.AddCommand(mediaImageReaderNewCmd) - mediaImageReaderCmd.AddCommand(mediaImageReaderAcquireLatestImageCmd) - mediaImageReaderCmd.AddCommand(mediaImageReaderAcquireNextImageCmd) - mediaImageReaderCmd.AddCommand(mediaImageReaderFormatCmd) - mediaImageReaderCmd.AddCommand(mediaImageReaderHeightCmd) - mediaImageReaderCmd.AddCommand(mediaImageReaderMaxImagesCmd) - mediaImageReaderCmd.AddCommand(mediaImageReaderWidthCmd) - mediaImageReaderCmd.AddCommand(mediaImageReaderWindowCmd) - mediaMediaCodecCryptoInfoCmd.AddCommand(mediaMediaCodecCryptoInfoGetNumSubSamplesCmd) - mediaMediaCodecInfoCmd.AddCommand(mediaMediaCodecInfoGetCanonicalNameCmd) - mediaMediaCodecInfoCmd.AddCommand(mediaMediaCodecInfoGetMaxSupportedInstancesCmd) - mediaMediaCodecInfoCmd.AddCommand(mediaMediaCodecInfoGetMediaTypeCmd) - mediaMediaCodecInfoCmd.AddCommand(mediaMediaCodecInfoIsFeatureRequiredCmd) - mediaMediaCodecInfoCmd.AddCommand(mediaMediaCodecInfoIsFeatureSupportedCmd) - mediaMediaCodecInfoCmd.AddCommand(mediaMediaCodecInfoIsVendorCmd) - mediaMediaDataSourceCmd.AddCommand(mediaMediaDataSourceNewCmd) - mediaMuxerCmd.AddCommand(mediaMuxerGetTrackCountCmd) - mediaMuxerCmd.AddCommand(mediaMuxerGetTrackFormatCmd) - mediaMuxerCmd.AddCommand(mediaMuxerStartCmd) - mediaMuxerCmd.AddCommand(mediaMuxerStopCmd) - rootCmd.AddCommand(mediaCmd) -} diff --git a/cmd/ndkcli/media_workflow.go b/cmd/ndkcli/media_workflow.go deleted file mode 100644 index 3fc2aa5..0000000 --- a/cmd/ndkcli/media_workflow.go +++ /dev/null @@ -1,97 +0,0 @@ -package main - -import ( - "fmt" - "os" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/media" -) - -var mediaCodecsCmd = &cobra.Command{ - Use: "codecs", - Short: "Probe available media codecs (encoder/decoder) for common MIME types", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - mimeTypes := []string{ - "video/avc", - "video/hevc", - "video/x-vnd.on2.vp8", - "video/x-vnd.on2.vp9", - "video/av01", - "audio/mp4a-latm", - "audio/mpeg", - "audio/opus", - "audio/vorbis", - } - - fmt.Printf("%-25s %-10s %-10s\n", "MIME", "Encoder", "Decoder") - fmt.Printf("%-25s %-10s %-10s\n", "----", "-------", "-------") - - for _, mime := range mimeTypes { - enc := media.NewEncoder(mime) - hasEncoder := enc.Pointer() != nil - if hasEncoder { - enc.Close() - } - - dec := media.NewDecoder(mime) - hasDecoder := dec.Pointer() != nil - if hasDecoder { - dec.Close() - } - - fmt.Printf("%-25s %-10v %-10v\n", mime, hasEncoder, hasDecoder) - } - - return nil - }, -} - -var mediaProbeCmd = &cobra.Command{ - Use: "probe", - Short: "Probe a media file for track information", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - filePath, _ := cmd.Flags().GetString("file") - - f, err := os.Open(filePath) - if err != nil { - return fmt.Errorf("opening file: %w", err) - } - defer f.Close() - - info, err := f.Stat() - if err != nil { - return fmt.Errorf("stat file: %w", err) - } - - extractor := media.NewExtractor() - defer extractor.Close() - - if err := extractor.SetDataSourceFd(int32(f.Fd()), 0, media.Off64_t(info.Size())); err != nil { - return fmt.Errorf("setting data source: %w", err) - } - - trackCount := extractor.TrackCount() - fmt.Printf("file: %s\n", filePath) - fmt.Printf("tracks: %d\n", trackCount) - - for i := uint64(0); i < trackCount; i++ { - if err := extractor.SelectTrack(i); err != nil { - fmt.Printf(" track %d: error selecting: %v\n", i, err) - continue - } - sampleTime := extractor.SampleTime() - fmt.Printf(" track %d: sample_time=%d us\n", i, sampleTime) - } - - return nil - }, -} - -func init() { - mediaProbeCmd.Flags().String("file", "", "path to media file") - _ = mediaProbeCmd.MarkFlagRequired("file") - - mediaCmd.AddCommand(mediaCodecsCmd) - mediaCmd.AddCommand(mediaProbeCmd) -} diff --git a/cmd/ndkcli/midi_gen.go b/cmd/ndkcli/midi_gen.go deleted file mode 100644 index 83be87a..0000000 --- a/cmd/ndkcli/midi_gen.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var midiCmd = &cobra.Command{ - Use: "midi", - Short: "midi NDK module", -} - -var midiDeviceCmd = &cobra.Command{ - Use: "device", - Short: "Device operations", -} - -var midiErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var midiDeviceNumInputPortsCmd = &cobra.Command{ - Use: "num-input-ports", - Short: "Device.NumInputPorts()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var midiDeviceNumOutputPortsCmd = &cobra.Command{ - Use: "num-output-ports", - Short: "Device.NumOutputPorts()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var midiDeviceGetTypeCmd = &cobra.Command{ - Use: "get-type", - Short: "Device.GetType()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var midiDeviceOpenInputPortCmd = &cobra.Command{ - Use: "open-input-port", - Short: "Device.OpenInputPort()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var midiDeviceOpenOutputPortCmd = &cobra.Command{ - Use: "open-output-port", - Short: "Device.OpenOutputPort()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var midiErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - midiCmd.AddCommand(midiDeviceCmd) - midiCmd.AddCommand(midiErrorCmd) - midiDeviceCmd.AddCommand(midiDeviceNumInputPortsCmd) - midiDeviceCmd.AddCommand(midiDeviceNumOutputPortsCmd) - midiDeviceCmd.AddCommand(midiDeviceGetTypeCmd) - midiDeviceCmd.AddCommand(midiDeviceOpenInputPortCmd) - midiDeviceCmd.AddCommand(midiDeviceOpenOutputPortCmd) - midiErrorCmd.AddCommand(midiErrorErrorCmd) - rootCmd.AddCommand(midiCmd) -} diff --git a/cmd/ndkcli/nnapi_gen.go b/cmd/ndkcli/nnapi_gen.go deleted file mode 100644 index 563a7db..0000000 --- a/cmd/ndkcli/nnapi_gen.go +++ /dev/null @@ -1,313 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/nnapi" -) - -var nnapiCmd = &cobra.Command{ - Use: "nnapi", - Short: "nnapi NDK module", -} - -var nnapiCompilationCmd = &cobra.Command{ - Use: "compilation", - Short: "Compilation operations", -} - -var nnapiErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var nnapiEventCmd = &cobra.Command{ - Use: "event", - Short: "Event operations", -} - -var nnapiExecutionCmd = &cobra.Command{ - Use: "execution", - Short: "Execution operations", -} - -var nnapiModelCmd = &cobra.Command{ - Use: "model", - Short: "Model operations", -} - -var nnapiANeuralNetworks_getDefaultLoopTimeoutCmd = &cobra.Command{ - Use: "a-neural-networks_get-default-loop-timeout", - Short: "nnapi.ANeuralNetworks_getDefaultLoopTimeout()", - RunE: func(cmd *cobra.Command, args []string) error { - result := nnapi.ANeuralNetworks_getDefaultLoopTimeout() - fmt.Println(result) - return nil - }, -} - -var nnapiANeuralNetworks_getMaximumLoopTimeoutCmd = &cobra.Command{ - Use: "a-neural-networks_get-maximum-loop-timeout", - Short: "nnapi.ANeuralNetworks_getMaximumLoopTimeout()", - RunE: func(cmd *cobra.Command, args []string) error { - result := nnapi.ANeuralNetworks_getMaximumLoopTimeout() - fmt.Println(result) - return nil - }, -} - -var nnapiANeuralNetworks_getRuntimeFeatureLevelCmd = &cobra.Command{ - Use: "a-neural-networks_get-runtime-feature-level", - Short: "nnapi.ANeuralNetworks_getRuntimeFeatureLevel()", - RunE: func(cmd *cobra.Command, args []string) error { - result := nnapi.ANeuralNetworks_getRuntimeFeatureLevel() - fmt.Println(result) - return nil - }, -} - -var nnapiCompilationNewBurstCmd = &cobra.Command{ - Use: "new-burst", - Short: "Compilation.NewBurst()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiCompilationFinishCmd = &cobra.Command{ - Use: "finish", - Short: "Compilation.Finish()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiCompilationSetPreferenceCmd = &cobra.Command{ - Use: "set-preference", - Short: "Compilation.SetPreference()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiCompilationSetPriorityCmd = &cobra.Command{ - Use: "set-priority", - Short: "Compilation.SetPriority()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiCompilationSetTimeoutCmd = &cobra.Command{ - Use: "set-timeout", - Short: "Compilation.SetTimeout()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiCompilationNewExecutionCmd = &cobra.Command{ - Use: "new-execution", - Short: "Compilation.NewExecution()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiEventWaitCmd = &cobra.Command{ - Use: "wait", - Short: "Event.Wait()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiExecutionComputeCmd = &cobra.Command{ - Use: "compute", - Short: "Execution.Compute()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiExecutionGetDurationCmd = &cobra.Command{ - Use: "get-duration", - Short: "Execution.GetDuration()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiExecutionSetMeasureTimingCmd = &cobra.Command{ - Use: "set-measure-timing", - Short: "Execution.SetMeasureTiming()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiExecutionSetTimeoutCmd = &cobra.Command{ - Use: "set-timeout", - Short: "Execution.SetTimeout()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiExecutionStartComputeCmd = &cobra.Command{ - Use: "start-compute", - Short: "Execution.StartCompute()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var nnapiModelNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Model", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := nnapi.NewModel() - if err != nil { - return err - } - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var nnapiModelNewCompilationCmd = &cobra.Command{ - Use: "new-compilation", - Short: "Model.NewCompilation()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := nnapi.NewModel() - if err != nil { - return err - } - defer obj.Close() - result, err := obj.NewCompilation() - if err != nil { - return err - } - fmt.Println(result) - return nil - }, -} - -var nnapiModelFinishCmd = &cobra.Command{ - Use: "finish", - Short: "Model.Finish()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := nnapi.NewModel() - if err != nil { - return err - } - defer obj.Close() - err = obj.Finish() - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var nnapiModelIdentifyInputsAndOutputsCmd = &cobra.Command{ - Use: "identify-inputs-and-outputs", - Short: "Model.IdentifyInputsAndOutputs()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := nnapi.NewModel() - if err != nil { - return err - } - defer obj.Close() - inputCount, _ := cmd.Flags().GetUint32("input-count") - var inputs uint32 - outputCount, _ := cmd.Flags().GetUint32("output-count") - var outputs uint32 - // output param inputs printed below - // output param outputs printed below - err = obj.IdentifyInputsAndOutputs(inputCount, &inputs, outputCount, &outputs) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var nnapiModelRelaxFloat32toFloat16Cmd = &cobra.Command{ - Use: "relax-float32to-float16", - Short: "Model.RelaxFloat32toFloat16()", - RunE: func(cmd *cobra.Command, args []string) error { - obj, err := nnapi.NewModel() - if err != nil { - return err - } - defer obj.Close() - allow, _ := cmd.Flags().GetBool("allow") - err = obj.RelaxFloat32toFloat16(allow) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -func init() { - nnapiModelIdentifyInputsAndOutputsCmd.Flags().Uint32("input-count", 0, "inputCount") - nnapiModelIdentifyInputsAndOutputsCmd.Flags().Uint32("output-count", 0, "outputCount") - nnapiModelRelaxFloat32toFloat16Cmd.Flags().Bool("allow", false, "allow") - nnapiCmd.AddCommand(nnapiCompilationCmd) - nnapiCmd.AddCommand(nnapiErrorCmd) - nnapiCmd.AddCommand(nnapiEventCmd) - nnapiCmd.AddCommand(nnapiExecutionCmd) - nnapiCmd.AddCommand(nnapiModelCmd) - nnapiCmd.AddCommand(nnapiANeuralNetworks_getDefaultLoopTimeoutCmd) - nnapiCmd.AddCommand(nnapiANeuralNetworks_getMaximumLoopTimeoutCmd) - nnapiCmd.AddCommand(nnapiANeuralNetworks_getRuntimeFeatureLevelCmd) - nnapiCompilationCmd.AddCommand(nnapiCompilationNewBurstCmd) - nnapiCompilationCmd.AddCommand(nnapiCompilationFinishCmd) - nnapiCompilationCmd.AddCommand(nnapiCompilationSetPreferenceCmd) - nnapiCompilationCmd.AddCommand(nnapiCompilationSetPriorityCmd) - nnapiCompilationCmd.AddCommand(nnapiCompilationSetTimeoutCmd) - nnapiCompilationCmd.AddCommand(nnapiCompilationNewExecutionCmd) - nnapiErrorCmd.AddCommand(nnapiErrorErrorCmd) - nnapiEventCmd.AddCommand(nnapiEventWaitCmd) - nnapiExecutionCmd.AddCommand(nnapiExecutionComputeCmd) - nnapiExecutionCmd.AddCommand(nnapiExecutionGetDurationCmd) - nnapiExecutionCmd.AddCommand(nnapiExecutionSetMeasureTimingCmd) - nnapiExecutionCmd.AddCommand(nnapiExecutionSetTimeoutCmd) - nnapiExecutionCmd.AddCommand(nnapiExecutionStartComputeCmd) - nnapiModelCmd.AddCommand(nnapiModelNewCmd) - nnapiModelCmd.AddCommand(nnapiModelNewCompilationCmd) - nnapiModelCmd.AddCommand(nnapiModelFinishCmd) - nnapiModelCmd.AddCommand(nnapiModelIdentifyInputsAndOutputsCmd) - nnapiModelCmd.AddCommand(nnapiModelRelaxFloat32toFloat16Cmd) - rootCmd.AddCommand(nnapiCmd) -} diff --git a/cmd/ndkcli/nnapi_workflow.go b/cmd/ndkcli/nnapi_workflow.go deleted file mode 100644 index 82002ea..0000000 --- a/cmd/ndkcli/nnapi_workflow.go +++ /dev/null @@ -1,35 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/nnapi" -) - -var nnapiProbeCmd = &cobra.Command{ - Use: "probe", - Short: "Probe NNAPI availability by creating and finishing an empty model", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - model, err := nnapi.NewModel() - if err != nil { - fmt.Printf("NNAPI not available: %v\n", err) - return nil - } - defer model.Close() - - fmt.Println("NNAPI model created successfully") - - if err := model.Finish(); err != nil { - fmt.Printf("model.Finish (empty model): %v\n", err) - return nil - } - fmt.Println("model.Finish completed successfully") - - return nil - }, -} - -func init() { - nnapiCmd.AddCommand(nnapiProbeCmd) -} diff --git a/cmd/ndkcli/permission_workflow.go b/cmd/ndkcli/permission_workflow.go deleted file mode 100644 index 65f4971..0000000 --- a/cmd/ndkcli/permission_workflow.go +++ /dev/null @@ -1,57 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/permission" -) - -var permissionCmd = &cobra.Command{ - Use: "permission", - Short: "permission NDK module", -} - -var permissionCheckCmd = &cobra.Command{ - Use: "check", - Short: "Check whether a permission is granted for a given PID/UID", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - name, _ := cmd.Flags().GetString("name") - pid, _ := cmd.Flags().GetInt32("pid") - uid, _ := cmd.Flags().GetInt32("uid") - - var outResult int32 - ret := permission.CheckPermission( - name, - permission.Pid_t(pid), - permission.Uid_t(uid), - &outResult, - ) - - fmt.Printf("permission: %s\n", name) - fmt.Printf("pid: %d\n", pid) - fmt.Printf("uid: %d\n", uid) - fmt.Printf("return: %d\n", ret) - - switch permission.Result(outResult) { - case permission.Granted: - fmt.Println("result: granted") - case permission.Denied: - fmt.Println("result: denied") - default: - fmt.Printf("result: unknown (%d)\n", outResult) - } - - return nil - }, -} - -func init() { - permissionCheckCmd.Flags().String("name", "", "permission name (e.g. android.permission.CAMERA)") - _ = permissionCheckCmd.MarkFlagRequired("name") - permissionCheckCmd.Flags().Int32("pid", 0, "process ID to check") - permissionCheckCmd.Flags().Int32("uid", 0, "user ID to check") - - permissionCmd.AddCommand(permissionCheckCmd) - rootCmd.AddCommand(permissionCmd) -} diff --git a/cmd/ndkcli/root.go b/cmd/ndkcli/root.go deleted file mode 100644 index 5199f0c..0000000 --- a/cmd/ndkcli/root.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import ( - "github.com/spf13/cobra" -) - -var rootCmd = &cobra.Command{ - Use: "ndkcli", - Short: "CLI tool for querying and interacting with the Android NDK surface", - Long: `ndkcli provides access to all Android NDK modules from the command line. - -Subcommands are organized by NDK module (camera, sensor, audio, etc.). -Run on an Android device or emulator.`, -} diff --git a/cmd/ndkcli/sensor_gen.go b/cmd/ndkcli/sensor_gen.go deleted file mode 100644 index 48aa5d0..0000000 --- a/cmd/ndkcli/sensor_gen.go +++ /dev/null @@ -1,322 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/sensor" -) - -var sensorCmd = &cobra.Command{ - Use: "sensor", - Short: "sensor NDK module", -} - -var sensorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var sensorEventQueueCmd = &cobra.Command{ - Use: "event-queue", - Short: "EventQueue operations", -} - -var sensorManagerCmd = &cobra.Command{ - Use: "manager", - Short: "Manager operations", -} - -var sensorSensorCmd = &cobra.Command{ - Use: "sensor", - Short: "Sensor operations", -} - -var sensorStatusCmd = &cobra.Command{ - Use: "status", - Short: "Status operations", -} - -var sensorTypeCmd = &cobra.Command{ - Use: "type", - Short: "Type operations", -} - -var sensorASensorManager_getInstanceForPackageCmd = &cobra.Command{ - Use: "a-sensor-manager_get-instance-for-package", - Short: "sensor.ASensorManager_getInstanceForPackage()", - RunE: func(cmd *cobra.Command, args []string) error { - packageName, _ := cmd.Flags().GetString("package-name") - result := sensor.ASensorManager_getInstanceForPackage(packageName) - fmt.Println(result) - return nil - }, -} - -var sensorErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorEventQueueHasEventsCmd = &cobra.Command{ - Use: "has-events", - Short: "EventQueue.HasEvents()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorEventQueueRequestAdditionalInfoEventsCmd = &cobra.Command{ - Use: "request-additional-info-events", - Short: "EventQueue.RequestAdditionalInfoEvents()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorManagerNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Manager", - RunE: func(cmd *cobra.Command, args []string) error { - _ = sensor.GetInstance() - fmt.Println("created successfully") - return nil - }, -} - -var sensorManagerCreateSharedMemoryDirectChannelCmd = &cobra.Command{ - Use: "create-shared-memory-direct-channel", - Short: "Manager.CreateSharedMemoryDirectChannel()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := sensor.GetInstance() - fd, _ := cmd.Flags().GetInt32("fd") - size, _ := cmd.Flags().GetUint64("size") - err := obj.CreateSharedMemoryDirectChannel(fd, size) - if err != nil { - return err - } - fmt.Println("ok") - return nil - }, -} - -var sensorManagerDestroyDirectChannelCmd = &cobra.Command{ - Use: "destroy-direct-channel", - Short: "Manager.DestroyDirectChannel()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := sensor.GetInstance() - channelID, _ := cmd.Flags().GetInt32("channel-id") - obj.DestroyDirectChannel(channelID) - fmt.Println("ok") - return nil - }, -} - -var sensorManagerDefaultSensorCmd = &cobra.Command{ - Use: "default-sensor", - Short: "Manager.DefaultSensor()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := sensor.GetInstance() - _type, _ := cmd.Flags().GetInt32("_type") - result := obj.DefaultSensor(sensor.Type(_type)) - fmt.Println(result) - return nil - }, -} - -var sensorManagerGetDefaultSensorExCmd = &cobra.Command{ - Use: "get-default-sensor-ex", - Short: "Manager.GetDefaultSensorEx()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := sensor.GetInstance() - _type, _ := cmd.Flags().GetInt32("_type") - wakeUp, _ := cmd.Flags().GetBool("wake-up") - result := obj.GetDefaultSensorEx(sensor.Type(_type), wakeUp) - fmt.Println(result) - return nil - }, -} - -var sensorSensorGetFifoMaxEventCountCmd = &cobra.Command{ - Use: "get-fifo-max-event-count", - Short: "Sensor.GetFifoMaxEventCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorGetFifoReservedEventCountCmd = &cobra.Command{ - Use: "get-fifo-reserved-event-count", - Short: "Sensor.GetFifoReservedEventCount()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorGetHandleCmd = &cobra.Command{ - Use: "get-handle", - Short: "Sensor.GetHandle()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorGetHighestDirectReportRateLevelCmd = &cobra.Command{ - Use: "get-highest-direct-report-rate-level", - Short: "Sensor.GetHighestDirectReportRateLevel()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorMinDelayCmd = &cobra.Command{ - Use: "min-delay", - Short: "Sensor.MinDelay()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorNameCmd = &cobra.Command{ - Use: "name", - Short: "Sensor.Name()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorGetReportingModeCmd = &cobra.Command{ - Use: "get-reporting-mode", - Short: "Sensor.GetReportingMode()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorResolutionCmd = &cobra.Command{ - Use: "resolution", - Short: "Sensor.Resolution()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorGetStringTypeCmd = &cobra.Command{ - Use: "get-string-type", - Short: "Sensor.GetStringType()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorTypeCmd = &cobra.Command{ - Use: "type", - Short: "Sensor.Type()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorVendorCmd = &cobra.Command{ - Use: "vendor", - Short: "Sensor.Vendor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorIsDirectChannelTypeSupportedCmd = &cobra.Command{ - Use: "is-direct-channel-type-supported", - Short: "Sensor.IsDirectChannelTypeSupported()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorSensorIsWakeUpSensorCmd = &cobra.Command{ - Use: "is-wake-up-sensor", - Short: "Sensor.IsWakeUpSensor()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorStatusStringCmd = &cobra.Command{ - Use: "string", - Short: "Status.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var sensorTypeStringCmd = &cobra.Command{ - Use: "string", - Short: "Type.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - sensorASensorManager_getInstanceForPackageCmd.Flags().String("package-name", "", "packageName") - sensorManagerCreateSharedMemoryDirectChannelCmd.Flags().Int32("fd", 0, "fd") - sensorManagerCreateSharedMemoryDirectChannelCmd.Flags().Uint64("size", 0, "size") - sensorManagerDestroyDirectChannelCmd.Flags().Int32("channel-id", 0, "channelID") - sensorManagerDefaultSensorCmd.Flags().Int32("_type", 0, "_type") - sensorManagerGetDefaultSensorExCmd.Flags().Int32("_type", 0, "_type") - sensorManagerGetDefaultSensorExCmd.Flags().Bool("wake-up", false, "wakeUp") - sensorCmd.AddCommand(sensorErrorCmd) - sensorCmd.AddCommand(sensorEventQueueCmd) - sensorCmd.AddCommand(sensorManagerCmd) - sensorCmd.AddCommand(sensorSensorCmd) - sensorCmd.AddCommand(sensorStatusCmd) - sensorCmd.AddCommand(sensorTypeCmd) - sensorCmd.AddCommand(sensorASensorManager_getInstanceForPackageCmd) - sensorErrorCmd.AddCommand(sensorErrorErrorCmd) - sensorEventQueueCmd.AddCommand(sensorEventQueueHasEventsCmd) - sensorEventQueueCmd.AddCommand(sensorEventQueueRequestAdditionalInfoEventsCmd) - sensorManagerCmd.AddCommand(sensorManagerNewCmd) - sensorManagerCmd.AddCommand(sensorManagerCreateSharedMemoryDirectChannelCmd) - sensorManagerCmd.AddCommand(sensorManagerDestroyDirectChannelCmd) - sensorManagerCmd.AddCommand(sensorManagerDefaultSensorCmd) - sensorManagerCmd.AddCommand(sensorManagerGetDefaultSensorExCmd) - sensorSensorCmd.AddCommand(sensorSensorGetFifoMaxEventCountCmd) - sensorSensorCmd.AddCommand(sensorSensorGetFifoReservedEventCountCmd) - sensorSensorCmd.AddCommand(sensorSensorGetHandleCmd) - sensorSensorCmd.AddCommand(sensorSensorGetHighestDirectReportRateLevelCmd) - sensorSensorCmd.AddCommand(sensorSensorMinDelayCmd) - sensorSensorCmd.AddCommand(sensorSensorNameCmd) - sensorSensorCmd.AddCommand(sensorSensorGetReportingModeCmd) - sensorSensorCmd.AddCommand(sensorSensorResolutionCmd) - sensorSensorCmd.AddCommand(sensorSensorGetStringTypeCmd) - sensorSensorCmd.AddCommand(sensorSensorTypeCmd) - sensorSensorCmd.AddCommand(sensorSensorVendorCmd) - sensorSensorCmd.AddCommand(sensorSensorIsDirectChannelTypeSupportedCmd) - sensorSensorCmd.AddCommand(sensorSensorIsWakeUpSensorCmd) - sensorStatusCmd.AddCommand(sensorStatusStringCmd) - sensorTypeCmd.AddCommand(sensorTypeStringCmd) - rootCmd.AddCommand(sensorCmd) -} diff --git a/cmd/ndkcli/sensor_workflow.go b/cmd/ndkcli/sensor_workflow.go deleted file mode 100644 index 1edf63f..0000000 --- a/cmd/ndkcli/sensor_workflow.go +++ /dev/null @@ -1,123 +0,0 @@ -package main - -import ( - "fmt" - "time" - "unsafe" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/looper" - "github.com/AndroidGoLab/ndk/sensor" -) - -// sensorEventData extracts x, y, z from an ASensorEvent. -// ASensorEvent layout: version(4) + sensor(4) + type(4) + reserved(4) + timestamp(8) + data[16]float32 -// data offset = 24 bytes from the start. -func sensorEventData(event *sensor.SensorEvent) (x, y, z float32, timestamp int64) { - base := (*byte)(event.Pointer()) - // timestamp at offset 16 (after version+sensor+type+reserved = 4*4 = 16) - timestamp = *(*int64)(unsafe.Pointer(uintptr(unsafe.Pointer(base)) + 16)) - // data[0..2] at offset 24 - dataPtr := uintptr(unsafe.Pointer(base)) + 24 - x = *(*float32)(unsafe.Pointer(dataPtr)) - y = *(*float32)(unsafe.Pointer(dataPtr + 4)) - z = *(*float32)(unsafe.Pointer(dataPtr + 8)) - return -} - -var sensorReadCmd = &cobra.Command{ - Use: "read", - Short: "Read real-time sensor data", - Long: `Reads real-time sensor events using a looper and event queue. -Prints x, y, z values for each event at the configured sample rate.`, - RunE: func(cmd *cobra.Command, args []string) (_err error) { - sensorTypeInt, _ := cmd.Flags().GetInt32("type") - duration, _ := cmd.Flags().GetDuration("duration") - rate, _ := cmd.Flags().GetInt32("rate") - - if duration == 0 { - duration = 5 * time.Second - } - - looper.Run(func(lp *looper.Looper) { - _err = readSensorEvents(lp, sensor.Type(sensorTypeInt), duration, rate) - }) - return - }, -} - -func readSensorEvents( - lp *looper.Looper, - sensorType sensor.Type, - duration time.Duration, - rateUs int32, -) error { - mgr := sensor.GetInstance() - - s := mgr.DefaultSensor(sensorType) - if s.Pointer() == nil { - return fmt.Errorf("no default sensor found for type %d", sensorType) - } - - fmt.Printf("sensor: %s (%s)\n", s.Name(), sensor.Type(s.Type())) - fmt.Printf("vendor: %s\n", s.Vendor()) - fmt.Printf("resolution: %g, min delay: %d us\n", s.Resolution(), s.MinDelay()) - - // Create event queue on the current looper thread. - const looperIdent = 1 - queue := mgr.CreateEventQueue( - (*sensor.ALooper)(lp.Pointer()), - looperIdent, - sensor.ALooper_callbackFunc(nil), // no callback — we poll manually - nil, - ) - if queue == nil || queue.Pointer() == nil { - return fmt.Errorf("failed to create sensor event queue") - } - defer mgr.DestroyEventQueue(queue) - - // Enable the sensor on the queue and set the sample rate. - if err := queue.EnableSensor(s); err != nil { - return fmt.Errorf("enabling sensor: %w", err) - } - if err := queue.SetEventRate(s, rateUs); err != nil { - return fmt.Errorf("setting event rate: %w", err) - } - - fmt.Printf("\nstreaming for %v (rate=%d us)...\n", duration, rateUs) - - deadline := time.Now().Add(duration) - count := 0 - // Allocate a raw ASensorEvent buffer (104 bytes per event on arm64). - // SensorEvent.ptr must point to valid C memory for GetEvents to write into. - const eventSize = 104 // sizeof(ASensorEvent) - eventBuf := make([]byte, eventSize) - event := sensor.NewSensorEventFromPointer(unsafe.Pointer(&eventBuf[0])) - - for time.Now().Before(deadline) { - // Poll the looper for events (100ms timeout). - looper.PollOnce(100*time.Millisecond, nil, nil, nil) - - // Drain all available events. - for { - n := queue.GetEvents(event, 1) - if n <= 0 { - break - } - x, y, z, ts := sensorEventData(event) - fmt.Printf(" [%d] t=%d x=%.6f y=%.6f z=%.6f\n", count, ts, x, y, z) - count++ - } - } - - fmt.Printf("received %d events\n", count) - return nil -} - -func init() { - sensorReadCmd.Flags().Int32("type", int32(sensor.Accelerometer), "sensor type ID (1=accelerometer, 2=magnetic, 3=orientation, 4=gyroscope, 5=light, 8=proximity)") - sensorReadCmd.Flags().Duration("duration", 5*time.Second, "how long to stream") - sensorReadCmd.Flags().Int32("rate", 100000, "sample period in microseconds (default 100ms)") - - sensorCmd.AddCommand(sensorReadCmd) -} diff --git a/cmd/ndkcli/storage_gen.go b/cmd/ndkcli/storage_gen.go deleted file mode 100644 index e42fb14..0000000 --- a/cmd/ndkcli/storage_gen.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/storage" -) - -var storageCmd = &cobra.Command{ - Use: "storage", - Short: "storage NDK module", -} - -var storageErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var storageManagerCmd = &cobra.Command{ - Use: "manager", - Short: "Manager operations", -} - -var storageErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var storageManagerNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Manager", - RunE: func(cmd *cobra.Command, args []string) error { - obj := storage.NewManager() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var storageManagerMountedObbPathCmd = &cobra.Command{ - Use: "mounted-obb-path", - Short: "Manager.MountedObbPath()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := storage.NewManager() - defer obj.Close() - filename, _ := cmd.Flags().GetString("filename") - result := obj.MountedObbPath(filename) - fmt.Println(result) - return nil - }, -} - -var storageManagerIsObbMountedCmd = &cobra.Command{ - Use: "is-obb-mounted", - Short: "Manager.IsObbMounted()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := storage.NewManager() - defer obj.Close() - filename, _ := cmd.Flags().GetString("filename") - result := obj.IsObbMounted(filename) - fmt.Println(result) - return nil - }, -} - -func init() { - storageManagerMountedObbPathCmd.Flags().String("filename", "", "filename") - storageManagerIsObbMountedCmd.Flags().String("filename", "", "filename") - storageCmd.AddCommand(storageErrorCmd) - storageCmd.AddCommand(storageManagerCmd) - storageErrorCmd.AddCommand(storageErrorErrorCmd) - storageManagerCmd.AddCommand(storageManagerNewCmd) - storageManagerCmd.AddCommand(storageManagerMountedObbPathCmd) - storageManagerCmd.AddCommand(storageManagerIsObbMountedCmd) - rootCmd.AddCommand(storageCmd) -} diff --git a/cmd/ndkcli/storage_workflow.go b/cmd/ndkcli/storage_workflow.go deleted file mode 100644 index 6759202..0000000 --- a/cmd/ndkcli/storage_workflow.go +++ /dev/null @@ -1,35 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/storage" -) - -var storageObbCmd = &cobra.Command{ - Use: "obb", - Short: "Check OBB mount status for a given file path", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - filePath, _ := cmd.Flags().GetString("file") - - mgr := storage.NewManager() - defer mgr.Close() - - mounted := mgr.IsObbMounted(filePath) - mountedPath := mgr.MountedObbPath(filePath) - - fmt.Printf("file: %s\n", filePath) - fmt.Printf("is mounted: %v (raw: %d)\n", mounted != 0, mounted) - fmt.Printf("mounted path: %s\n", mountedPath) - - return nil - }, -} - -func init() { - storageObbCmd.Flags().String("file", "", "path to OBB file") - _ = storageObbCmd.MarkFlagRequired("file") - - storageCmd.AddCommand(storageObbCmd) -} diff --git a/cmd/ndkcli/surfacecontrol_gen.go b/cmd/ndkcli/surfacecontrol_gen.go deleted file mode 100644 index 16a00e7..0000000 --- a/cmd/ndkcli/surfacecontrol_gen.go +++ /dev/null @@ -1,133 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/surfacecontrol" -) - -var surfacecontrolCmd = &cobra.Command{ - Use: "surfacecontrol", - Short: "surfacecontrol NDK module", -} - -var surfacecontrolErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var surfacecontrolSurfaceControlCmd = &cobra.Command{ - Use: "surface-control", - Short: "SurfaceControl operations", -} - -var surfacecontrolSurfaceTransactionStatsCmd = &cobra.Command{ - Use: "surface-transaction-stats", - Short: "SurfaceTransactionStats operations", -} - -var surfacecontrolTransactionCmd = &cobra.Command{ - Use: "transaction", - Short: "Transaction operations", -} - -var surfacecontrolErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacecontrolSurfaceControlAcquireCmd = &cobra.Command{ - Use: "acquire", - Short: "SurfaceControl.Acquire()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacecontrolSurfaceControlCreateChildCmd = &cobra.Command{ - Use: "create-child", - Short: "SurfaceControl.CreateChild()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacecontrolSurfaceTransactionStatsGetLatchTimeCmd = &cobra.Command{ - Use: "get-latch-time", - Short: "SurfaceTransactionStats.GetLatchTime()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacecontrolSurfaceTransactionStatsGetPresentFenceFdCmd = &cobra.Command{ - Use: "get-present-fence-fd", - Short: "SurfaceTransactionStats.GetPresentFenceFd()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacecontrolTransactionNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Transaction", - RunE: func(cmd *cobra.Command, args []string) error { - obj := surfacecontrol.NewTransaction() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var surfacecontrolTransactionApplyCmd = &cobra.Command{ - Use: "apply", - Short: "Transaction.Apply()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := surfacecontrol.NewTransaction() - defer obj.Close() - obj.Apply() - fmt.Println("ok") - return nil - }, -} - -var surfacecontrolTransactionSetDesiredPresentTimeCmd = &cobra.Command{ - Use: "set-desired-present-time", - Short: "Transaction.SetDesiredPresentTime()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := surfacecontrol.NewTransaction() - defer obj.Close() - desiredPresentTime, _ := cmd.Flags().GetInt64("desired-present-time") - obj.SetDesiredPresentTime(desiredPresentTime) - fmt.Println("ok") - return nil - }, -} - -func init() { - surfacecontrolTransactionSetDesiredPresentTimeCmd.Flags().Int64("desired-present-time", 0, "desiredPresentTime") - surfacecontrolCmd.AddCommand(surfacecontrolErrorCmd) - surfacecontrolCmd.AddCommand(surfacecontrolSurfaceControlCmd) - surfacecontrolCmd.AddCommand(surfacecontrolSurfaceTransactionStatsCmd) - surfacecontrolCmd.AddCommand(surfacecontrolTransactionCmd) - surfacecontrolErrorCmd.AddCommand(surfacecontrolErrorErrorCmd) - surfacecontrolSurfaceControlCmd.AddCommand(surfacecontrolSurfaceControlAcquireCmd) - surfacecontrolSurfaceControlCmd.AddCommand(surfacecontrolSurfaceControlCreateChildCmd) - surfacecontrolSurfaceTransactionStatsCmd.AddCommand(surfacecontrolSurfaceTransactionStatsGetLatchTimeCmd) - surfacecontrolSurfaceTransactionStatsCmd.AddCommand(surfacecontrolSurfaceTransactionStatsGetPresentFenceFdCmd) - surfacecontrolTransactionCmd.AddCommand(surfacecontrolTransactionNewCmd) - surfacecontrolTransactionCmd.AddCommand(surfacecontrolTransactionApplyCmd) - surfacecontrolTransactionCmd.AddCommand(surfacecontrolTransactionSetDesiredPresentTimeCmd) - rootCmd.AddCommand(surfacecontrolCmd) -} diff --git a/cmd/ndkcli/surfacetexture_gen.go b/cmd/ndkcli/surfacetexture_gen.go deleted file mode 100644 index 1fba506..0000000 --- a/cmd/ndkcli/surfacetexture_gen.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var surfacetextureCmd = &cobra.Command{ - Use: "surfacetexture", - Short: "surfacetexture NDK module", -} - -var surfacetextureErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var surfacetextureSurfaceTextureCmd = &cobra.Command{ - Use: "surface-texture", - Short: "SurfaceTexture operations", -} - -var surfacetextureErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacetextureSurfaceTextureAcquireWindowCmd = &cobra.Command{ - Use: "acquire-window", - Short: "SurfaceTexture.AcquireWindow()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacetextureSurfaceTextureAttachToGLContextCmd = &cobra.Command{ - Use: "attach-to-gl-context", - Short: "SurfaceTexture.AttachToGLContext()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacetextureSurfaceTextureDetachFromGLContextCmd = &cobra.Command{ - Use: "detach-from-gl-context", - Short: "SurfaceTexture.DetachFromGLContext()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacetextureSurfaceTextureTimestampCmd = &cobra.Command{ - Use: "timestamp", - Short: "SurfaceTexture.Timestamp()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var surfacetextureSurfaceTextureUpdateTexImageCmd = &cobra.Command{ - Use: "update-tex-image", - Short: "SurfaceTexture.UpdateTexImage()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - surfacetextureCmd.AddCommand(surfacetextureErrorCmd) - surfacetextureCmd.AddCommand(surfacetextureSurfaceTextureCmd) - surfacetextureErrorCmd.AddCommand(surfacetextureErrorErrorCmd) - surfacetextureSurfaceTextureCmd.AddCommand(surfacetextureSurfaceTextureAcquireWindowCmd) - surfacetextureSurfaceTextureCmd.AddCommand(surfacetextureSurfaceTextureAttachToGLContextCmd) - surfacetextureSurfaceTextureCmd.AddCommand(surfacetextureSurfaceTextureDetachFromGLContextCmd) - surfacetextureSurfaceTextureCmd.AddCommand(surfacetextureSurfaceTextureTimestampCmd) - surfacetextureSurfaceTextureCmd.AddCommand(surfacetextureSurfaceTextureUpdateTexImageCmd) - rootCmd.AddCommand(surfacetextureCmd) -} diff --git a/cmd/ndkcli/thermal_gen.go b/cmd/ndkcli/thermal_gen.go deleted file mode 100644 index 9a3af5a..0000000 --- a/cmd/ndkcli/thermal_gen.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/thermal" -) - -var thermalCmd = &cobra.Command{ - Use: "thermal", - Short: "thermal NDK module", -} - -var thermalErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var thermalManagerCmd = &cobra.Command{ - Use: "manager", - Short: "Manager operations", -} - -var thermalThermalStatusCmd = &cobra.Command{ - Use: "thermal-status", - Short: "ThermalStatus operations", -} - -var thermalErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var thermalManagerNewCmd = &cobra.Command{ - Use: "new", - Short: "Create Manager", - RunE: func(cmd *cobra.Command, args []string) error { - obj := thermal.NewManager() - defer obj.Close() - fmt.Println("created successfully") - return nil - }, -} - -var thermalManagerCurrentStatusCmd = &cobra.Command{ - Use: "current-status", - Short: "Manager.CurrentStatus()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := thermal.NewManager() - defer obj.Close() - result := obj.CurrentStatus() - fmt.Println(result) - return nil - }, -} - -var thermalManagerAThermal_getThermalHeadroomCmd = &cobra.Command{ - Use: "a-thermal_get-thermal-headroom", - Short: "Manager.AThermal_getThermalHeadroom()", - RunE: func(cmd *cobra.Command, args []string) error { - obj := thermal.NewManager() - defer obj.Close() - forecastSeconds, _ := cmd.Flags().GetInt32("forecast-seconds") - result := obj.AThermal_getThermalHeadroom(forecastSeconds) - fmt.Println(result) - return nil - }, -} - -var thermalThermalStatusStringCmd = &cobra.Command{ - Use: "string", - Short: "ThermalStatus.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - thermalManagerAThermal_getThermalHeadroomCmd.Flags().Int32("forecast-seconds", 0, "forecastSeconds") - thermalCmd.AddCommand(thermalErrorCmd) - thermalCmd.AddCommand(thermalManagerCmd) - thermalCmd.AddCommand(thermalThermalStatusCmd) - thermalErrorCmd.AddCommand(thermalErrorErrorCmd) - thermalManagerCmd.AddCommand(thermalManagerNewCmd) - thermalManagerCmd.AddCommand(thermalManagerCurrentStatusCmd) - thermalManagerCmd.AddCommand(thermalManagerAThermal_getThermalHeadroomCmd) - thermalThermalStatusCmd.AddCommand(thermalThermalStatusStringCmd) - rootCmd.AddCommand(thermalCmd) -} diff --git a/cmd/ndkcli/thermal_workflow.go b/cmd/ndkcli/thermal_workflow.go deleted file mode 100644 index a607e13..0000000 --- a/cmd/ndkcli/thermal_workflow.go +++ /dev/null @@ -1,61 +0,0 @@ -package main - -import ( - "fmt" - "os" - "os/signal" - "time" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/thermal" -) - -var thermalMonitorCmd = &cobra.Command{ - Use: "monitor", - Short: "Monitor thermal status at a regular interval", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - interval, _ := cmd.Flags().GetDuration("interval") - duration, _ := cmd.Flags().GetDuration("duration") - - mgr := thermal.NewManager() - defer mgr.Close() - - sigCh := make(chan os.Signal, 1) - signal.Notify(sigCh, os.Interrupt) - defer signal.Stop(sigCh) - - var deadline <-chan time.Time - if duration > 0 { - timer := time.NewTimer(duration) - defer timer.Stop() - deadline = timer.C - } - - ticker := time.NewTicker(interval) - defer ticker.Stop() - - tick := 0 - for { - status := mgr.CurrentStatus() - fmt.Printf("[%d] thermal status: %s (%d)\n", tick, status, int32(status)) - tick++ - - select { - case <-sigCh: - fmt.Println("interrupted") - return nil - case <-deadline: - fmt.Printf("monitoring complete (%d samples)\n", tick) - return nil - case <-ticker.C: - } - } - }, -} - -func init() { - thermalMonitorCmd.Flags().Duration("interval", time.Second, "polling interval") - thermalMonitorCmd.Flags().Duration("duration", 0, "total monitoring duration (0 = until Ctrl+C)") - - thermalCmd.AddCommand(thermalMonitorCmd) -} diff --git a/cmd/ndkcli/trace_gen.go b/cmd/ndkcli/trace_gen.go deleted file mode 100644 index b90e3b1..0000000 --- a/cmd/ndkcli/trace_gen.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/trace" -) - -var traceCmd = &cobra.Command{ - Use: "trace", - Short: "trace NDK module", -} - -var traceBeginAsyncSectionCmd = &cobra.Command{ - Use: "begin-async-section", - Short: "trace.BeginAsyncSection()", - RunE: func(cmd *cobra.Command, args []string) error { - sectionName, _ := cmd.Flags().GetString("section-name") - cookie, _ := cmd.Flags().GetInt32("cookie") - trace.BeginAsyncSection(sectionName, cookie) - fmt.Println("ok") - return nil - }, -} - -var traceBeginSectionCmd = &cobra.Command{ - Use: "begin-section", - Short: "trace.BeginSection()", - RunE: func(cmd *cobra.Command, args []string) error { - sectionName, _ := cmd.Flags().GetString("section-name") - trace.BeginSection(sectionName) - fmt.Println("ok") - return nil - }, -} - -var traceEndAsyncSectionCmd = &cobra.Command{ - Use: "end-async-section", - Short: "trace.EndAsyncSection()", - RunE: func(cmd *cobra.Command, args []string) error { - sectionName, _ := cmd.Flags().GetString("section-name") - cookie, _ := cmd.Flags().GetInt32("cookie") - trace.EndAsyncSection(sectionName, cookie) - fmt.Println("ok") - return nil - }, -} - -var traceEndSectionCmd = &cobra.Command{ - Use: "end-section", - Short: "trace.EndSection()", - RunE: func(cmd *cobra.Command, args []string) error { - trace.EndSection() - fmt.Println("ok") - return nil - }, -} - -var traceIsEnabledCmd = &cobra.Command{ - Use: "is-enabled", - Short: "trace.IsEnabled()", - RunE: func(cmd *cobra.Command, args []string) error { - result := trace.IsEnabled() - fmt.Println(result) - return nil - }, -} - -var traceSetCounterCmd = &cobra.Command{ - Use: "set-counter", - Short: "trace.SetCounter()", - RunE: func(cmd *cobra.Command, args []string) error { - counterName, _ := cmd.Flags().GetString("counter-name") - counterValue, _ := cmd.Flags().GetInt64("counter-value") - trace.SetCounter(counterName, counterValue) - fmt.Println("ok") - return nil - }, -} - -func init() { - traceBeginAsyncSectionCmd.Flags().String("section-name", "", "sectionName") - traceBeginAsyncSectionCmd.Flags().Int32("cookie", 0, "cookie") - traceBeginSectionCmd.Flags().String("section-name", "", "sectionName") - traceEndAsyncSectionCmd.Flags().String("section-name", "", "sectionName") - traceEndAsyncSectionCmd.Flags().Int32("cookie", 0, "cookie") - traceSetCounterCmd.Flags().String("counter-name", "", "counterName") - traceSetCounterCmd.Flags().Int64("counter-value", 0, "counterValue") - traceCmd.AddCommand(traceBeginAsyncSectionCmd) - traceCmd.AddCommand(traceBeginSectionCmd) - traceCmd.AddCommand(traceEndAsyncSectionCmd) - traceCmd.AddCommand(traceEndSectionCmd) - traceCmd.AddCommand(traceIsEnabledCmd) - traceCmd.AddCommand(traceSetCounterCmd) - rootCmd.AddCommand(traceCmd) -} diff --git a/cmd/ndkcli/trace_workflow.go b/cmd/ndkcli/trace_workflow.go deleted file mode 100644 index 9876d45..0000000 --- a/cmd/ndkcli/trace_workflow.go +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/trace" -) - -var traceSectionCmd = &cobra.Command{ - Use: "section", - Short: "Begin a named trace section (ended on process exit)", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - name, _ := cmd.Flags().GetString("name") - - trace.BeginSection(name) - fmt.Println("trace section '" + name + "' started") - return nil - }, -} - -func init() { - traceSectionCmd.Flags().String("name", "ndkcli", "trace section name") - - traceCmd.AddCommand(traceSectionCmd) -} diff --git a/cmd/ndkcli/window_gen.go b/cmd/ndkcli/window_gen.go deleted file mode 100644 index b9f3e3f..0000000 --- a/cmd/ndkcli/window_gen.go +++ /dev/null @@ -1,176 +0,0 @@ -// Code generated by cligen. DO NOT EDIT. - -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -var windowCmd = &cobra.Command{ - Use: "window", - Short: "window NDK module", -} - -var windowErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error operations", -} - -var windowFormatCmd = &cobra.Command{ - Use: "format", - Short: "Format operations", -} - -var windowWindowCmd = &cobra.Command{ - Use: "window", - Short: "Window operations", -} - -var windowErrorErrorCmd = &cobra.Command{ - Use: "error", - Short: "Error.Error()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowFormatStringCmd = &cobra.Command{ - Use: "string", - Short: "Format.String()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowAcquireCmd = &cobra.Command{ - Use: "acquire", - Short: "Window.Acquire()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowClearFrameRateCmd = &cobra.Command{ - Use: "clear-frame-rate", - Short: "Window.ClearFrameRate()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowGetBuffersDataSpaceCmd = &cobra.Command{ - Use: "get-buffers-data-space", - Short: "Window.GetBuffersDataSpace()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowGetBuffersDefaultDataSpaceCmd = &cobra.Command{ - Use: "get-buffers-default-data-space", - Short: "Window.GetBuffersDefaultDataSpace()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowFormatCmd = &cobra.Command{ - Use: "format", - Short: "Window.Format()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowHeightCmd = &cobra.Command{ - Use: "height", - Short: "Window.Height()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowWidthCmd = &cobra.Command{ - Use: "width", - Short: "Window.Width()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowSetBuffersDataSpaceCmd = &cobra.Command{ - Use: "set-buffers-data-space", - Short: "Window.SetBuffersDataSpace()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowSetBuffersGeometryCmd = &cobra.Command{ - Use: "set-buffers-geometry", - Short: "Window.SetBuffersGeometry()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowSetBuffersTransformCmd = &cobra.Command{ - Use: "set-buffers-transform", - Short: "Window.SetBuffersTransform()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowTryAllocateBuffersCmd = &cobra.Command{ - Use: "try-allocate-buffers", - Short: "Window.TryAllocateBuffers()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -var windowWindowUnlockAndPostCmd = &cobra.Command{ - Use: "unlock-and-post", - Short: "Window.UnlockAndPost()", - RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("requires external context (NativeActivity, JNI, etc.)") - return nil - }, -} - -func init() { - windowCmd.AddCommand(windowErrorCmd) - windowCmd.AddCommand(windowFormatCmd) - windowCmd.AddCommand(windowWindowCmd) - windowErrorCmd.AddCommand(windowErrorErrorCmd) - windowFormatCmd.AddCommand(windowFormatStringCmd) - windowWindowCmd.AddCommand(windowWindowAcquireCmd) - windowWindowCmd.AddCommand(windowWindowClearFrameRateCmd) - windowWindowCmd.AddCommand(windowWindowGetBuffersDataSpaceCmd) - windowWindowCmd.AddCommand(windowWindowGetBuffersDefaultDataSpaceCmd) - windowWindowCmd.AddCommand(windowWindowFormatCmd) - windowWindowCmd.AddCommand(windowWindowHeightCmd) - windowWindowCmd.AddCommand(windowWindowWidthCmd) - windowWindowCmd.AddCommand(windowWindowSetBuffersDataSpaceCmd) - windowWindowCmd.AddCommand(windowWindowSetBuffersGeometryCmd) - windowWindowCmd.AddCommand(windowWindowSetBuffersTransformCmd) - windowWindowCmd.AddCommand(windowWindowTryAllocateBuffersCmd) - windowWindowCmd.AddCommand(windowWindowUnlockAndPostCmd) - rootCmd.AddCommand(windowCmd) -} diff --git a/cmd/ndkcli/window_workflow.go b/cmd/ndkcli/window_workflow.go deleted file mode 100644 index 6f9b8f7..0000000 --- a/cmd/ndkcli/window_workflow.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/spf13/cobra" - "github.com/AndroidGoLab/ndk/media" - "github.com/AndroidGoLab/ndk/window" -) - -// imageFormatRGBA8888 is AIMAGE_FORMAT_RGBA_8888 from the NDK header. -const imageFormatRGBA8888 = 1 - -var windowQueryCmd = &cobra.Command{ - Use: "query", - Short: "Query window properties via an ImageReader-backed ANativeWindow", - RunE: func(cmd *cobra.Command, args []string) (_err error) { - width, _ := cmd.Flags().GetInt32("width") - height, _ := cmd.Flags().GetInt32("height") - format, _ := cmd.Flags().GetInt32("format") - - // Create an ImageReader to get an ANativeWindow handle. - reader, err := media.NewImageReader(width, height, format, 2) - if err != nil { - return fmt.Errorf("creating image reader: %w", err) - } - defer reader.Close() - - mediaWin, err := reader.Window() - if err != nil { - return fmt.Errorf("getting window from image reader: %w", err) - } - - // Convert media.Window to window.Window via unsafe.Pointer for the - // window package's query methods. - win := window.NewWindowFromPointer(mediaWin.Pointer()) - - fmt.Printf("window properties:\n") - fmt.Printf(" width: %d\n", win.Width()) - fmt.Printf(" height: %d\n", win.Height()) - fmt.Printf(" format: %d (%s)\n", win.Format(), window.Format(win.Format())) - - return nil - }, -} - -func init() { - windowQueryCmd.Flags().Int32("width", 640, "image reader width") - windowQueryCmd.Flags().Int32("height", 480, "image reader height") - windowQueryCmd.Flags().Int32("format", imageFormatRGBA8888, "image format (1=RGBA_8888)") - - windowCmd.AddCommand(windowQueryCmd) -} diff --git a/compat/xaionaro-go-ndk/go.mod b/compat/xaionaro-go-ndk/go.mod deleted file mode 100644 index 8c5094c..0000000 --- a/compat/xaionaro-go-ndk/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/xaionaro-go/ndk - -go 1.25.0 diff --git a/compat/xaionaro-go-ndk/media/media_codec.go b/compat/xaionaro-go-ndk/media/media_codec.go deleted file mode 100644 index c414774..0000000 --- a/compat/xaionaro-go-ndk/media/media_codec.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build android && cgo - -// Copyright 2018-2024 The gooid Authors. All rights reserved. -// Use of this source code is governed by a MIT-style license. - -package media - -// #cgo LDFLAGS: -lmediandk -// #include -// #include -// #include -import "C" - -// MediaCodec is a non-owning view of an NDK AMediaCodec handle. -type MediaCodec C.AMediaCodec - -// CPointer returns the underlying NDK handle without transferring ownership. -func (mc *MediaCodec) CPointer() *C.AMediaCodec { - return (*C.AMediaCodec)(mc) -} - -// SetParameters applies params to the codec. -func (mc *MediaCodec) SetParameters(params *MediaFormat) error { - status := C.AMediaCodec_setParameters(mc.CPointer(), params.CPointer()) - return CMediaStatusToError(status) -} diff --git a/compat/xaionaro-go-ndk/media/media_format.go b/compat/xaionaro-go-ndk/media/media_format.go deleted file mode 100644 index a3c1eaa..0000000 --- a/compat/xaionaro-go-ndk/media/media_format.go +++ /dev/null @@ -1,19 +0,0 @@ -//go:build android && cgo - -// Copyright 2018-2024 The gooid Authors. All rights reserved. -// Use of this source code is governed by a MIT-style license. - -package media - -// #cgo LDFLAGS: -lmediandk -// #include -// #include -import "C" - -// MediaFormat is a non-owning view of an NDK AMediaFormat handle. -type MediaFormat C.AMediaFormat - -// CPointer returns the underlying NDK handle without transferring ownership. -func (mf *MediaFormat) CPointer() *C.AMediaFormat { - return (*C.AMediaFormat)(mf) -} diff --git a/config/config.go b/config/config.go index 0480bbc..707719e 100644 --- a/config/config.go +++ b/config/config.go @@ -1,296 +1,100 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. package config import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/configuration" + "github.com/xaionaro-go/ndk/ndk" ) -// Config wraps the NDK AConfiguration handle. -type Config struct { - ptr *capi.AConfiguration -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Config) cptr() *capi.AConfiguration { - if h == nil { - return nil - } - return h.ptr -} - -// NewConfig creates a new Config. -func NewConfig() *Config { - return &Config{ptr: capi.AConfiguration_new()} -} - -// Close releases the underlying NDK handle. -func (h *Config) Close() error { - if h.ptr == nil { - return nil - } - capi.AConfiguration_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewConfigFromPointer wraps a raw AConfiguration pointer. -func NewConfigFromPointer(ptr unsafe.Pointer) *Config { - return &Config{ptr: (*capi.AConfiguration)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Config) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Config) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewConfigFromUintPtr wraps a uintptr as a Config. -// The caller must ensure ptr points to a valid AConfiguration. -func NewConfigFromUintPtr(ptr uintptr) *Config { - return &Config{ptr: (*capi.AConfiguration)(unsafe.Pointer(ptr))} -} - -// Copy calls the underlying NDK function. -func (h *Config) Copy(src *Config) { - capi.AConfiguration_copy(h.ptr, src.cptr()) -} - -// Diff calls the underlying NDK function. -func (h *Config) Diff(config2 *Config) error { - return result(capi.AConfiguration_diff(h.ptr, config2.cptr())) -} - -// Country calls the underlying NDK function. -func (h *Config) Country(outCountry string) { - capi.AConfiguration_getCountry(h.ptr, outCountry) -} - -// Density returns the value directly. -func (h *Config) Density() int32 { - return (int32)(capi.AConfiguration_getDensity(h.ptr)) -} - -// GetGrammaticalGender calls the underlying NDK function. -func (h *Config) GetGrammaticalGender() error { - return result(capi.AConfiguration_getGrammaticalGender(h.ptr)) -} - -// GetKeyboard calls the underlying NDK function. -func (h *Config) GetKeyboard() error { - return result(capi.AConfiguration_getKeyboard(h.ptr)) -} - -// GetKeysHidden calls the underlying NDK function. -func (h *Config) GetKeysHidden() error { - return result(capi.AConfiguration_getKeysHidden(h.ptr)) -} - -// Language calls the underlying NDK function. -func (h *Config) Language(outLanguage string) { - capi.AConfiguration_getLanguage(h.ptr, outLanguage) -} - -// GetLayoutDirection calls the underlying NDK function. -func (h *Config) GetLayoutDirection() error { - return result(capi.AConfiguration_getLayoutDirection(h.ptr)) -} - -// GetMcc calls the underlying NDK function. -func (h *Config) GetMcc() error { - return result(capi.AConfiguration_getMcc(h.ptr)) -} - -// GetMnc calls the underlying NDK function. -func (h *Config) GetMnc() error { - return result(capi.AConfiguration_getMnc(h.ptr)) -} - -// GetNavHidden calls the underlying NDK function. -func (h *Config) GetNavHidden() error { - return result(capi.AConfiguration_getNavHidden(h.ptr)) -} - -// GetNavigation calls the underlying NDK function. -func (h *Config) GetNavigation() error { - return result(capi.AConfiguration_getNavigation(h.ptr)) -} - -// Orientation returns the value directly. -func (h *Config) Orientation() int32 { - return (int32)(capi.AConfiguration_getOrientation(h.ptr)) -} - -// ScreenHeightDp returns the value directly. -func (h *Config) ScreenHeightDp() int32 { - return (int32)(capi.AConfiguration_getScreenHeightDp(h.ptr)) -} - -// GetScreenLong calls the underlying NDK function. -func (h *Config) GetScreenLong() error { - return result(capi.AConfiguration_getScreenLong(h.ptr)) -} - -// GetScreenRound calls the underlying NDK function. -func (h *Config) GetScreenRound() error { - return result(capi.AConfiguration_getScreenRound(h.ptr)) -} - -// ScreenSize returns the value directly. -func (h *Config) ScreenSize() int32 { - return (int32)(capi.AConfiguration_getScreenSize(h.ptr)) -} - -// ScreenWidthDp returns the value directly. -func (h *Config) ScreenWidthDp() int32 { - return (int32)(capi.AConfiguration_getScreenWidthDp(h.ptr)) -} - -// SdkVersion returns the value directly. -func (h *Config) SdkVersion() int32 { - return (int32)(capi.AConfiguration_getSdkVersion(h.ptr)) -} - -// GetSmallestScreenWidthDp calls the underlying NDK function. -func (h *Config) GetSmallestScreenWidthDp() error { - return result(capi.AConfiguration_getSmallestScreenWidthDp(h.ptr)) -} - -// GetTouchscreen calls the underlying NDK function. -func (h *Config) GetTouchscreen() error { - return result(capi.AConfiguration_getTouchscreen(h.ptr)) -} - -// GetUiModeNight calls the underlying NDK function. -func (h *Config) GetUiModeNight() error { - return result(capi.AConfiguration_getUiModeNight(h.ptr)) -} - -// GetUiModeType calls the underlying NDK function. -func (h *Config) GetUiModeType() error { - return result(capi.AConfiguration_getUiModeType(h.ptr)) -} - -// IsBetterThan calls the underlying NDK function. -func (h *Config) IsBetterThan(test *Config, requested *Config) error { - return result(capi.AConfiguration_isBetterThan(h.ptr, test.cptr(), requested.cptr())) -} - -// Match calls the underlying NDK function. -func (h *Config) Match(requested *Config) error { - return result(capi.AConfiguration_match(h.ptr, requested.cptr())) -} - -// SetCountry calls the underlying NDK function. -func (h *Config) SetCountry(country string) { - capi.AConfiguration_setCountry(h.ptr, country) -} - -// SetDensity calls the underlying NDK function. -func (h *Config) SetDensity(density int32) { - capi.AConfiguration_setDensity(h.ptr, density) -} - -// SetGrammaticalGender calls the underlying NDK function. -func (h *Config) SetGrammaticalGender(value int32) { - capi.AConfiguration_setGrammaticalGender(h.ptr, value) -} - -// SetKeyboard calls the underlying NDK function. -func (h *Config) SetKeyboard(keyboard int32) { - capi.AConfiguration_setKeyboard(h.ptr, keyboard) -} - -// SetKeysHidden calls the underlying NDK function. -func (h *Config) SetKeysHidden(keysHidden int32) { - capi.AConfiguration_setKeysHidden(h.ptr, keysHidden) -} - -// SetLanguage calls the underlying NDK function. -func (h *Config) SetLanguage(language string) { - capi.AConfiguration_setLanguage(h.ptr, language) -} - -// SetLayoutDirection calls the underlying NDK function. -func (h *Config) SetLayoutDirection(value int32) { - capi.AConfiguration_setLayoutDirection(h.ptr, value) -} - -// SetMcc calls the underlying NDK function. -func (h *Config) SetMcc(mcc int32) { - capi.AConfiguration_setMcc(h.ptr, mcc) -} - -// SetMnc calls the underlying NDK function. -func (h *Config) SetMnc(mnc int32) { - capi.AConfiguration_setMnc(h.ptr, mnc) -} - -// SetNavHidden calls the underlying NDK function. -func (h *Config) SetNavHidden(navHidden int32) { - capi.AConfiguration_setNavHidden(h.ptr, navHidden) -} - -// SetNavigation calls the underlying NDK function. -func (h *Config) SetNavigation(navigation int32) { - capi.AConfiguration_setNavigation(h.ptr, navigation) -} - -// SetOrientation calls the underlying NDK function. -func (h *Config) SetOrientation(orientation Orientation) { - capi.AConfiguration_setOrientation(h.ptr, int32(orientation)) -} - -// SetScreenHeightDp calls the underlying NDK function. -func (h *Config) SetScreenHeightDp(value int32) { - capi.AConfiguration_setScreenHeightDp(h.ptr, value) -} - -// SetScreenLong calls the underlying NDK function. -func (h *Config) SetScreenLong(screenLong int32) { - capi.AConfiguration_setScreenLong(h.ptr, screenLong) -} - -// SetScreenSize calls the underlying NDK function. -func (h *Config) SetScreenSize(screenSize ScreenSize) { - capi.AConfiguration_setScreenSize(h.ptr, int32(screenSize)) -} - -// SetScreenWidthDp calls the underlying NDK function. -func (h *Config) SetScreenWidthDp(value int32) { - capi.AConfiguration_setScreenWidthDp(h.ptr, value) -} - -// SetSdkVersion calls the underlying NDK function. -func (h *Config) SetSdkVersion(sdkVersion int32) { - capi.AConfiguration_setSdkVersion(h.ptr, sdkVersion) -} - -// SetSmallestScreenWidthDp calls the underlying NDK function. -func (h *Config) SetSmallestScreenWidthDp(value int32) { - capi.AConfiguration_setSmallestScreenWidthDp(h.ptr, value) -} - -// SetTouchscreen calls the underlying NDK function. -func (h *Config) SetTouchscreen(touchscreen int32) { - capi.AConfiguration_setTouchscreen(h.ptr, touchscreen) -} - -// SetUiModeNight calls the underlying NDK function. -func (h *Config) SetUiModeNight(uiModeNight int32) { - capi.AConfiguration_setUiModeNight(h.ptr, uiModeNight) -} +const ( + ORIENTATION_ANY = ndk.CONFIGURATION_ORIENTATION_ANY + ORIENTATION_PORT = ndk.CONFIGURATION_ORIENTATION_PORT + ORIENTATION_LAND = ndk.CONFIGURATION_ORIENTATION_LAND + ORIENTATION_SQUARE = ndk.CONFIGURATION_ORIENTATION_SQUARE + + TOUCHSCREEN_ANY = ndk.CONFIGURATION_TOUCHSCREEN_ANY + TOUCHSCREEN_NOTOUCH = ndk.CONFIGURATION_TOUCHSCREEN_NOTOUCH + TOUCHSCREEN_STYLUS = ndk.CONFIGURATION_TOUCHSCREEN_STYLUS + TOUCHSCREEN_FINGER = ndk.CONFIGURATION_TOUCHSCREEN_FINGER + + DENSITY_DEFAULT = ndk.CONFIGURATION_DENSITY_DEFAULT + DENSITY_LOW = ndk.CONFIGURATION_DENSITY_LOW + DENSITY_MEDIUM = ndk.CONFIGURATION_DENSITY_MEDIUM + DENSITY_TV = ndk.CONFIGURATION_DENSITY_TV + DENSITY_HIGH = ndk.CONFIGURATION_DENSITY_HIGH + DENSITY_XHIGH = ndk.CONFIGURATION_DENSITY_XHIGH + DENSITY_XXHIGH = ndk.CONFIGURATION_DENSITY_XXHIGH + DENSITY_XXXHIGH = ndk.CONFIGURATION_DENSITY_XXXHIGH + DENSITY_NONE = ndk.CONFIGURATION_DENSITY_NONE + + KEYBOARD_ANY = ndk.CONFIGURATION_KEYBOARD_ANY + KEYBOARD_NOKEYS = ndk.CONFIGURATION_KEYBOARD_NOKEYS + KEYBOARD_QWERTY = ndk.CONFIGURATION_KEYBOARD_QWERTY + KEYBOARD_12KEY = ndk.CONFIGURATION_KEYBOARD_12KEY + + NAVIGATION_ANY = ndk.CONFIGURATION_NAVIGATION_ANY + NAVIGATION_NONAV = ndk.CONFIGURATION_NAVIGATION_NONAV + NAVIGATION_DPAD = ndk.CONFIGURATION_NAVIGATION_DPAD + NAVIGATION_TRACKBALL = ndk.CONFIGURATION_NAVIGATION_TRACKBALL + NAVIGATION_WHEEL = ndk.CONFIGURATION_NAVIGATION_WHEEL + + KEYSHIDDEN_ANY = ndk.CONFIGURATION_KEYSHIDDEN_ANY + KEYSHIDDEN_NO = ndk.CONFIGURATION_KEYSHIDDEN_NO + KEYSHIDDEN_YES = ndk.CONFIGURATION_KEYSHIDDEN_YES + KEYSHIDDEN_SOFT = ndk.CONFIGURATION_KEYSHIDDEN_SOFT + + NAVHIDDEN_ANY = ndk.CONFIGURATION_NAVHIDDEN_ANY + NAVHIDDEN_NO = ndk.CONFIGURATION_NAVHIDDEN_NO + NAVHIDDEN_YES = ndk.CONFIGURATION_NAVHIDDEN_YES + + SCREENSIZE_ANY = ndk.CONFIGURATION_SCREENSIZE_ANY + SCREENSIZE_SMALL = ndk.CONFIGURATION_SCREENSIZE_SMALL + SCREENSIZE_NORMAL = ndk.CONFIGURATION_SCREENSIZE_NORMAL + SCREENSIZE_LARGE = ndk.CONFIGURATION_SCREENSIZE_LARGE + SCREENSIZE_XLARGE = ndk.CONFIGURATION_SCREENSIZE_XLARGE + + SCREENLONG_ANY = ndk.CONFIGURATION_SCREENLONG_ANY + SCREENLONG_NO = ndk.CONFIGURATION_SCREENLONG_NO + SCREENLONG_YES = ndk.CONFIGURATION_SCREENLONG_YES + + UI_MODE_TYPE_ANY = ndk.CONFIGURATION_UI_MODE_TYPE_ANY + UI_MODE_TYPE_NORMAL = ndk.CONFIGURATION_UI_MODE_TYPE_NORMAL + UI_MODE_TYPE_DESK = ndk.CONFIGURATION_UI_MODE_TYPE_DESK + UI_MODE_TYPE_CAR = ndk.CONFIGURATION_UI_MODE_TYPE_CAR + UI_MODE_TYPE_TELEVISION = ndk.CONFIGURATION_UI_MODE_TYPE_TELEVISION + UI_MODE_TYPE_APPLIANCE = ndk.CONFIGURATION_UI_MODE_TYPE_APPLIANCE + + UI_MODE_NIGHT_ANY = ndk.CONFIGURATION_UI_MODE_NIGHT_ANY + UI_MODE_NIGHT_NO = ndk.CONFIGURATION_UI_MODE_NIGHT_NO + UI_MODE_NIGHT_YES = ndk.CONFIGURATION_UI_MODE_NIGHT_YES + + SCREEN_WIDTH_DP_ANY = ndk.CONFIGURATION_SCREEN_WIDTH_DP_ANY + + SCREEN_HEIGHT_DP_ANY = ndk.CONFIGURATION_SCREEN_HEIGHT_DP_ANY + + SMALLEST_SCREEN_WIDTH_DP_ANY = ndk.CONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY + + LAYOUTDIR_ANY = ndk.CONFIGURATION_LAYOUTDIR_ANY + LAYOUTDIR_LTR = ndk.CONFIGURATION_LAYOUTDIR_LTR + LAYOUTDIR_RTL = ndk.CONFIGURATION_LAYOUTDIR_RTL + + MCC = ndk.CONFIGURATION_MCC + MNC = ndk.CONFIGURATION_MNC + LOCALE = ndk.CONFIGURATION_LOCALE + TOUCHSCREEN = ndk.CONFIGURATION_TOUCHSCREEN + KEYBOARD = ndk.CONFIGURATION_KEYBOARD + KEYBOARD_HIDDEN = ndk.CONFIGURATION_KEYBOARD_HIDDEN + NAVIGATION = ndk.CONFIGURATION_NAVIGATION + ORIENTATION = ndk.CONFIGURATION_ORIENTATION + DENSITY = ndk.CONFIGURATION_DENSITY + SCREEN_SIZE = ndk.CONFIGURATION_SCREEN_SIZE + VERSION = ndk.CONFIGURATION_VERSION + SCREEN_LAYOUT = ndk.CONFIGURATION_SCREEN_LAYOUT + UI_MODE = ndk.CONFIGURATION_UI_MODE + SMALLEST_SCREEN_SIZE = ndk.CONFIGURATION_SMALLEST_SCREEN_SIZE + LAYOUTDIR = ndk.CONFIGURATION_LAYOUTDIR +) -// SetUiModeType calls the underlying NDK function. -func (h *Config) SetUiModeType(uiModeType int32) { - capi.AConfiguration_setUiModeType(h.ptr, uiModeType) -} +type Configuration = ndk.Configuration diff --git a/config/configuration.go b/config/configuration.go deleted file mode 100644 index 2c4a5d8..0000000 --- a/config/configuration.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package config - -type CONFIGURATION int32 - -const ( - ACONFIGURATION_ORIENTATION_ANY CONFIGURATION = 0 - ACONFIGURATION_ORIENTATION_PORT CONFIGURATION = 1 - ACONFIGURATION_ORIENTATION_LAND CONFIGURATION = 2 - ACONFIGURATION_ORIENTATION_SQUARE CONFIGURATION = 3 - ACONFIGURATION_TOUCHSCREEN_ANY CONFIGURATION = 0 - ACONFIGURATION_TOUCHSCREEN_NOTOUCH CONFIGURATION = 1 - ACONFIGURATION_TOUCHSCREEN_STYLUS CONFIGURATION = 2 - ACONFIGURATION_TOUCHSCREEN_FINGER CONFIGURATION = 3 - ACONFIGURATION_DENSITY_DEFAULT CONFIGURATION = 0 - ACONFIGURATION_DENSITY_LOW CONFIGURATION = 120 - ACONFIGURATION_DENSITY_MEDIUM CONFIGURATION = 160 - ACONFIGURATION_DENSITY_TV CONFIGURATION = 213 - ACONFIGURATION_DENSITY_HIGH CONFIGURATION = 240 - ACONFIGURATION_DENSITY_XHIGH CONFIGURATION = 320 - ACONFIGURATION_DENSITY_XXHIGH CONFIGURATION = 480 - ACONFIGURATION_DENSITY_XXXHIGH CONFIGURATION = 640 - ACONFIGURATION_DENSITY_ANY CONFIGURATION = 65534 - ACONFIGURATION_DENSITY_NONE CONFIGURATION = 65535 - ACONFIGURATION_KEYBOARD_ANY CONFIGURATION = 0 - ACONFIGURATION_KEYBOARD_NOKEYS CONFIGURATION = 1 - ACONFIGURATION_KEYBOARD_QWERTY CONFIGURATION = 2 - ACONFIGURATION_KEYBOARD_12KEY CONFIGURATION = 3 - ACONFIGURATION_NAVIGATION_ANY CONFIGURATION = 0 - ACONFIGURATION_NAVIGATION_NONAV CONFIGURATION = 1 - ACONFIGURATION_NAVIGATION_DPAD CONFIGURATION = 2 - ACONFIGURATION_NAVIGATION_TRACKBALL CONFIGURATION = 3 - ACONFIGURATION_NAVIGATION_WHEEL CONFIGURATION = 4 - ACONFIGURATION_KEYSHIDDEN_ANY CONFIGURATION = 0 - ACONFIGURATION_KEYSHIDDEN_NO CONFIGURATION = 1 - ACONFIGURATION_KEYSHIDDEN_YES CONFIGURATION = 2 - ACONFIGURATION_KEYSHIDDEN_SOFT CONFIGURATION = 3 - ACONFIGURATION_NAVHIDDEN_ANY CONFIGURATION = 0 - ACONFIGURATION_NAVHIDDEN_NO CONFIGURATION = 1 - ACONFIGURATION_NAVHIDDEN_YES CONFIGURATION = 2 - ACONFIGURATION_SCREENSIZE_ANY CONFIGURATION = 0 - ACONFIGURATION_SCREENSIZE_SMALL CONFIGURATION = 1 - ACONFIGURATION_SCREENSIZE_NORMAL CONFIGURATION = 2 - ACONFIGURATION_SCREENSIZE_LARGE CONFIGURATION = 3 - ACONFIGURATION_SCREENSIZE_XLARGE CONFIGURATION = 4 - ACONFIGURATION_SCREENLONG_ANY CONFIGURATION = 0 - ACONFIGURATION_SCREENLONG_NO CONFIGURATION = 1 - ACONFIGURATION_SCREENLONG_YES CONFIGURATION = 2 - ACONFIGURATION_SCREENROUND_ANY CONFIGURATION = 0 - ACONFIGURATION_SCREENROUND_NO CONFIGURATION = 1 - ACONFIGURATION_SCREENROUND_YES CONFIGURATION = 2 - ACONFIGURATION_WIDE_COLOR_GAMUT_ANY CONFIGURATION = 0 - ACONFIGURATION_WIDE_COLOR_GAMUT_NO CONFIGURATION = 1 - ACONFIGURATION_WIDE_COLOR_GAMUT_YES CONFIGURATION = 2 - ACONFIGURATION_HDR_ANY CONFIGURATION = 0 - ACONFIGURATION_HDR_NO CONFIGURATION = 1 - ACONFIGURATION_HDR_YES CONFIGURATION = 2 - ACONFIGURATION_UI_MODE_TYPE_ANY CONFIGURATION = 0 - ACONFIGURATION_UI_MODE_TYPE_NORMAL CONFIGURATION = 1 - ACONFIGURATION_UI_MODE_TYPE_DESK CONFIGURATION = 2 - ACONFIGURATION_UI_MODE_TYPE_CAR CONFIGURATION = 3 - ACONFIGURATION_UI_MODE_TYPE_TELEVISION CONFIGURATION = 4 - ACONFIGURATION_UI_MODE_TYPE_APPLIANCE CONFIGURATION = 5 - ACONFIGURATION_UI_MODE_TYPE_WATCH CONFIGURATION = 6 - ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET CONFIGURATION = 7 - ACONFIGURATION_UI_MODE_NIGHT_ANY CONFIGURATION = 0 - ACONFIGURATION_UI_MODE_NIGHT_NO CONFIGURATION = 1 - ACONFIGURATION_UI_MODE_NIGHT_YES CONFIGURATION = 2 - ACONFIGURATION_SCREEN_WIDTH_DP_ANY CONFIGURATION = 0 - ACONFIGURATION_SCREEN_HEIGHT_DP_ANY CONFIGURATION = 0 - ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY CONFIGURATION = 0 - ACONFIGURATION_LAYOUTDIR_ANY CONFIGURATION = 0 - ACONFIGURATION_LAYOUTDIR_LTR CONFIGURATION = 1 - ACONFIGURATION_LAYOUTDIR_RTL CONFIGURATION = 2 - ACONFIGURATION_MCC CONFIGURATION = 1 - ACONFIGURATION_MNC CONFIGURATION = 2 - ACONFIGURATION_LOCALE CONFIGURATION = 4 - ACONFIGURATION_TOUCHSCREEN CONFIGURATION = 8 - ACONFIGURATION_KEYBOARD CONFIGURATION = 16 - ACONFIGURATION_KEYBOARD_HIDDEN CONFIGURATION = 32 - ACONFIGURATION_NAVIGATION CONFIGURATION = 64 - ACONFIGURATION_ORIENTATION CONFIGURATION = 128 - ACONFIGURATION_DENSITY CONFIGURATION = 256 - ACONFIGURATION_SCREEN_SIZE CONFIGURATION = 512 - ACONFIGURATION_VERSION CONFIGURATION = 1024 - ACONFIGURATION_SCREEN_LAYOUT CONFIGURATION = 2048 - ACONFIGURATION_UI_MODE CONFIGURATION = 4096 - ACONFIGURATION_SMALLEST_SCREEN_SIZE CONFIGURATION = 8192 - ACONFIGURATION_LAYOUTDIR CONFIGURATION = 16384 - ACONFIGURATION_SCREEN_ROUND CONFIGURATION = 32768 - ACONFIGURATION_COLOR_MODE CONFIGURATION = 65536 - ACONFIGURATION_GRAMMATICAL_GENDER CONFIGURATION = 131072 - ACONFIGURATION_MNC_ZERO CONFIGURATION = 65535 - ACONFIGURATION_GRAMMATICAL_GENDER_ANY CONFIGURATION = 0 - ACONFIGURATION_GRAMMATICAL_GENDER_NEUTER CONFIGURATION = 1 - ACONFIGURATION_GRAMMATICAL_GENDER_FEMININE CONFIGURATION = 2 - ACONFIGURATION_GRAMMATICAL_GENDER_MASCULINE CONFIGURATION = 3 -) diff --git a/config/errors.go b/config/errors.go deleted file mode 100644 index 74127a6..0000000 --- a/config/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package config - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/config/functions.go b/config/functions.go deleted file mode 100644 index a554625..0000000 --- a/config/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package config diff --git a/config/orientation.go b/config/orientation.go deleted file mode 100644 index 4aa3427..0000000 --- a/config/orientation.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package config - -type Orientation int32 - -const ( - OrientationAny Orientation = 0 - OrientationPort Orientation = 1 - OrientationLand Orientation = 2 - OrientationSquare Orientation = 3 -) diff --git a/config/package.go b/config/package.go deleted file mode 100644 index 970feca..0000000 --- a/config/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package config provides Go bindings for Android AConfiguration. -package config diff --git a/config/screen_size.go b/config/screen_size.go deleted file mode 100644 index d2acb74..0000000 --- a/config/screen_size.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package config - -type ScreenSize int32 - -const ( - ScreensizeAny ScreenSize = 0 - ScreensizeSmall ScreenSize = 1 - ScreensizeNormal ScreenSize = 2 - ScreensizeLarge ScreenSize = 3 - ScreensizeXlarge ScreenSize = 4 -) diff --git a/constants.go b/constants.go new file mode 100644 index 0000000..beacf67 --- /dev/null +++ b/constants.go @@ -0,0 +1,42 @@ +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package ndk + +import ( + "github.com/xaionaro-go/ndk/ndk" +) + +const ( + ACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = ndk.ACTIVITY_SHOW_SOFT_INPUT_IMPLICIT + ACTIVITY_SHOW_SOFT_INPUT_FORCED = ndk.ACTIVITY_SHOW_SOFT_INPUT_FORCED + ACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = ndk.ACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY + ACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = ndk.ACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS + WINDOW_FORMAT_RGBA_8888 = ndk.WINDOW_FORMAT_RGBA_8888 + WINDOW_FORMAT_RGBX_8888 = ndk.WINDOW_FORMAT_RGBX_8888 + WINDOW_FORMAT_RGB_565 = ndk.WINDOW_FORMAT_RGB_565 + FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = ndk.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON + FLAG_DIM_BEHIND = ndk.FLAG_DIM_BEHIND + FLAG_BLUR_BEHIND = ndk.FLAG_BLUR_BEHIND + FLAG_NOT_FOCUSABLE = ndk.FLAG_NOT_FOCUSABLE + FLAG_NOT_TOUCHABLE = ndk.FLAG_NOT_TOUCHABLE + FLAG_NOT_TOUCH_MODAL = ndk.FLAG_NOT_TOUCH_MODAL + FLAG_TOUCHABLE_WHEN_WAKING = ndk.FLAG_TOUCHABLE_WHEN_WAKING + FLAG_KEEP_SCREEN_ON = ndk.FLAG_KEEP_SCREEN_ON + FLAG_LAYOUT_IN_SCREEN = ndk.FLAG_LAYOUT_IN_SCREEN + FLAG_LAYOUT_NO_LIMITS = ndk.FLAG_LAYOUT_NO_LIMITS + FLAG_FULLSCREEN = ndk.FLAG_FULLSCREEN + FLAG_FORCE_NOT_FULLSCREEN = ndk.FLAG_FORCE_NOT_FULLSCREEN + FLAG_DITHER = ndk.FLAG_DITHER + FLAG_SECURE = ndk.FLAG_SECURE + FLAG_SCALED = ndk.FLAG_SCALED + FLAG_IGNORE_CHEEK_PRESSES = ndk.FLAG_IGNORE_CHEEK_PRESSES + FLAG_LAYOUT_INSET_DECOR = ndk.FLAG_LAYOUT_INSET_DECOR + FLAG_ALT_FOCUSABLE_IM = ndk.FLAG_ALT_FOCUSABLE_IM + FLAG_WATCH_OUTSIDE_TOUCH = ndk.FLAG_WATCH_OUTSIDE_TOUCH + FLAG_SHOW_WHEN_LOCKED = ndk.FLAG_SHOW_WHEN_LOCKED + FLAG_SHOW_WALLPAPER = ndk.FLAG_SHOW_WALLPAPER + FLAG_TURN_SCREEN_ON = ndk.FLAG_TURN_SCREEN_ON + FLAG_DISMISS_KEYGUARD = ndk.FLAG_DISMISS_KEYGUARD +) diff --git a/context7.json b/context7.json deleted file mode 100644 index 76cbdcb..0000000 --- a/context7.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "url": "https://context7.com/androidgolab/ndk", - "public_key": "pk_ajlVZor26lzvjspOfyEJd" -} diff --git a/doc/FyneCameraDemo_screenshot.png b/doc/FyneCameraDemo_screenshot.png new file mode 100644 index 0000000..8d2fd1b Binary files /dev/null and b/doc/FyneCameraDemo_screenshot.png differ diff --git a/egl/anative_window.go b/egl/anative_window.go deleted file mode 100644 index 38c8b0e..0000000 --- a/egl/anative_window.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -// ANativeWindow wraps the NDK ANativeWindow handle. -type ANativeWindow struct { - ptr *capi.ANativeWindow -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *ANativeWindow) cptr() *capi.ANativeWindow { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *ANativeWindow) Close() error { - if h.ptr == nil { - return nil - } - capi.ANativeWindow_release(h.ptr) - h.ptr = nil - return nil -} - -// NewANativeWindowFromPointer wraps a raw ANativeWindow pointer. -func NewANativeWindowFromPointer(ptr unsafe.Pointer) *ANativeWindow { - return &ANativeWindow{ptr: (*capi.ANativeWindow)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *ANativeWindow) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *ANativeWindow) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewANativeWindowFromUintPtr wraps a uintptr as a ANativeWindow. -// The caller must ensure ptr points to a valid ANativeWindow. -func NewANativeWindowFromUintPtr(ptr uintptr) *ANativeWindow { - return &ANativeWindow{ptr: (*capi.ANativeWindow)(unsafe.Pointer(ptr))} -} - -// Acquire calls the underlying NDK function. -func (h *ANativeWindow) Acquire() { - capi.ANativeWindow_acquire(h.ptr) -} - -// GetBuffersDataSpace calls the underlying NDK function. -func (h *ANativeWindow) GetBuffersDataSpace() error { - return result(capi.ANativeWindow_getBuffersDataSpace(h.ptr)) -} - -// GetBuffersDefaultDataSpace calls the underlying NDK function. -func (h *ANativeWindow) GetBuffersDefaultDataSpace() error { - return result(capi.ANativeWindow_getBuffersDefaultDataSpace(h.ptr)) -} - -// GetFormat calls the underlying NDK function. -func (h *ANativeWindow) GetFormat() error { - return result(capi.ANativeWindow_getFormat(h.ptr)) -} - -// GetHeight calls the underlying NDK function. -func (h *ANativeWindow) GetHeight() error { - return result(capi.ANativeWindow_getHeight(h.ptr)) -} - -// GetWidth calls the underlying NDK function. -func (h *ANativeWindow) GetWidth() error { - return result(capi.ANativeWindow_getWidth(h.ptr)) -} - -// Lock calls the underlying NDK function. -func (h *ANativeWindow) Lock(outBuffer *NativeWindow_Buffer, inOutDirtyBounds *ARect) error { - return result(capi.ANativeWindow_lock(h.ptr, outBuffer.cptr(), (*capi.ARect)(inOutDirtyBounds))) -} - -// SetBuffersDataSpace calls the underlying NDK function. -func (h *ANativeWindow) SetBuffersDataSpace(dataSpace int32) error { - return result(capi.ANativeWindow_setBuffersDataSpace(h.ptr, dataSpace)) -} - -// SetBuffersGeometry calls the underlying NDK function. -func (h *ANativeWindow) SetBuffersGeometry(width int32, height int32, format int32) error { - return result(capi.ANativeWindow_setBuffersGeometry(h.ptr, width, height, format)) -} - -// SetBuffersTransform calls the underlying NDK function. -func (h *ANativeWindow) SetBuffersTransform(transform int32) error { - return result(capi.ANativeWindow_setBuffersTransform(h.ptr, transform)) -} - -// SetFrameRate calls the underlying NDK function. -func (h *ANativeWindow) SetFrameRate(frameRate float32, compatibility int8) error { - return result(capi.ANativeWindow_setFrameRate(h.ptr, frameRate, compatibility)) -} - -// SetFrameRateWithChangeStrategy calls the underlying NDK function. -func (h *ANativeWindow) SetFrameRateWithChangeStrategy(frameRate float32, compatibility int8, changeFrameRateStrategy int8) error { - return result(capi.ANativeWindow_setFrameRateWithChangeStrategy(h.ptr, frameRate, compatibility, changeFrameRateStrategy)) -} - -// TryAllocateBuffers calls the underlying NDK function. -func (h *ANativeWindow) TryAllocateBuffers() { - capi.ANativeWindow_tryAllocateBuffers(h.ptr) -} - -// UnlockAndPost calls the underlying NDK function. -func (h *ANativeWindow) UnlockAndPost() error { - return result(capi.ANativeWindow_unlockAndPost(h.ptr)) -} diff --git a/egl/arect.go b/egl/arect.go deleted file mode 100644 index 4a2bc9d..0000000 --- a/egl/arect.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type ARect = capi.ARect diff --git a/egl/boolean.go b/egl/boolean.go deleted file mode 100644 index 13dee4c..0000000 --- a/egl/boolean.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -type Boolean uint32 - -const ( - False Boolean = 0 - True Boolean = 1 -) diff --git a/egl/constants.go b/egl/constants.go deleted file mode 100644 index 19439d4..0000000 --- a/egl/constants.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -const ( - EGL_ALPHA_FORMAT = 12424 - EGL_ALPHA_FORMAT_NONPRE = 12427 - EGL_ALPHA_FORMAT_PRE = 12428 - EGL_ALPHA_MASK_SIZE = 12350 - EGL_BACK_BUFFER = 12420 - EGL_BAD_ACCESS = 12290 - EGL_BAD_ALLOC = 12291 - EGL_BAD_ATTRIBUTE = 12292 - EGL_BAD_CONFIG = 12293 - EGL_BAD_CONTEXT = 12294 - EGL_BAD_CURRENT_SURFACE = 12295 - EGL_BAD_DISPLAY = 12296 - EGL_BAD_MATCH = 12297 - EGL_BAD_NATIVE_PIXMAP = 12298 - EGL_BAD_NATIVE_WINDOW = 12299 - EGL_BAD_PARAMETER = 12300 - EGL_BAD_SURFACE = 12301 - EGL_BIND_TO_TEXTURE_RGB = 12345 - EGL_BIND_TO_TEXTURE_RGBA = 12346 - EGL_BUFFER_DESTROYED = 12437 - EGL_BUFFER_PRESERVED = 12436 - EGL_CLIENT_APIS = 12429 - EGL_CL_EVENT_HANDLE = 12444 - EGL_COLORSPACE = 12423 - EGL_COLORSPACE_LINEAR = 12426 - EGL_COLOR_BUFFER_TYPE = 12351 - EGL_CONDITION_SATISFIED = 12534 - EGL_CONFIG_CAVEAT = 12327 - EGL_CONFORMANT = 12354 - EGL_CONTEXT_CLIENT_TYPE = 12439 - EGL_CONTEXT_LOST = 12302 - EGL_CONTEXT_MINOR_VERSION = 12539 - EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT = 2 - EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT = 1 - EGL_CONTEXT_OPENGL_DEBUG = 12720 - EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE = 12721 - EGL_CONTEXT_OPENGL_PROFILE_MASK = 12541 - EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY = 12733 - EGL_CONTEXT_OPENGL_ROBUST_ACCESS = 12722 - EGL_CORE_NATIVE_ENGINE = 12379 - EGL_DISPLAY_SCALING = 10000 - EGL_DRAW = 12377 - EGL_EXTENSIONS = 12373 - EGL_FOREVER = 0xFFFFFFFFFFFFFFFF - EGL_GL_COLORSPACE = 12445 - EGL_GL_COLORSPACE_LINEAR = 12426 - EGL_GL_COLORSPACE_SRGB = 12425 - EGL_GL_RENDERBUFFER = 12473 - EGL_GL_TEXTURE_2D = 12465 - EGL_GL_TEXTURE_3D = 12466 - EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 12468 - EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 12470 - EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 12472 - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X = 12467 - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 12469 - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 12471 - EGL_GL_TEXTURE_LEVEL = 12476 - EGL_GL_TEXTURE_ZOFFSET = 12477 - EGL_HORIZONTAL_RESOLUTION = 12432 - EGL_IMAGE_PRESERVED = 12498 - EGL_LARGEST_PBUFFER = 12376 - EGL_LEVEL = 12329 - EGL_LOSE_CONTEXT_ON_RESET = 12735 - EGL_LUMINANCE_BUFFER = 12431 - EGL_LUMINANCE_SIZE = 12349 - EGL_MATCH_NATIVE_PIXMAP = 12353 - EGL_MAX_PBUFFER_HEIGHT = 12330 - EGL_MAX_PBUFFER_PIXELS = 12331 - EGL_MAX_PBUFFER_WIDTH = 12332 - EGL_MAX_SWAP_INTERVAL = 12348 - EGL_MIN_SWAP_INTERVAL = 12347 - EGL_MIPMAP_LEVEL = 12419 - EGL_MIPMAP_TEXTURE = 12418 - EGL_MULTISAMPLE_RESOLVE = 12441 - EGL_MULTISAMPLE_RESOLVE_BOX = 12443 - EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 512 - EGL_MULTISAMPLE_RESOLVE_DEFAULT = 12442 - EGL_NATIVE_RENDERABLE = 12333 - EGL_NATIVE_VISUAL_ID = 12334 - EGL_NATIVE_VISUAL_TYPE = 12335 - EGL_NON_CONFORMANT_CONFIG = 12369 - EGL_NOT_INITIALIZED = 12289 - EGL_NO_RESET_NOTIFICATION = 12734 - EGL_NO_TEXTURE = 12380 - EGL_OPENGL_API = 12450 - EGL_OPENGL_BIT = 8 - EGL_OPENGL_ES_BIT = 1 - EGL_OPENVG_API = 12449 - EGL_OPENVG_BIT = 2 - EGL_OPENVG_IMAGE = 12438 - EGL_PIXEL_ASPECT_RATIO = 12434 - EGL_PIXMAP_BIT = 2 - EGL_READ = 12378 - EGL_RENDER_BUFFER = 12422 - EGL_RGB_BUFFER = 12430 - EGL_SAMPLES = 12337 - EGL_SAMPLE_BUFFERS = 12338 - EGL_SIGNALED = 12530 - EGL_SINGLE_BUFFER = 12421 - EGL_SLOW_CONFIG = 12368 - EGL_SUCCESS = 12288 - EGL_SWAP_BEHAVIOR = 12435 - EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 1024 - EGL_SYNC_CL_EVENT = 12542 - EGL_SYNC_CL_EVENT_COMPLETE = 12543 - EGL_SYNC_CONDITION = 12536 - EGL_SYNC_FENCE = 12537 - EGL_SYNC_FLUSH_COMMANDS_BIT = 1 - EGL_SYNC_PRIOR_COMMANDS_COMPLETE = 12528 - EGL_SYNC_STATUS = 12529 - EGL_SYNC_TYPE = 12535 - EGL_TEXTURE_2D = 12383 - EGL_TEXTURE_FORMAT = 12416 - EGL_TEXTURE_RGB = 12381 - EGL_TEXTURE_RGBA = 12382 - EGL_TEXTURE_TARGET = 12417 - EGL_TIMEOUT_EXPIRED = 12533 - EGL_TRANSPARENT_BLUE_VALUE = 12341 - EGL_TRANSPARENT_GREEN_VALUE = 12342 - EGL_TRANSPARENT_RED_VALUE = 12343 - EGL_TRANSPARENT_RGB = 12370 - EGL_TRANSPARENT_TYPE = 12340 - EGL_UNSIGNALED = 12531 - EGL_VENDOR = 12371 - EGL_VERSION = 12372 - EGL_VERTICAL_RESOLUTION = 12433 - EGL_VG_ALPHA_FORMAT = 12424 - EGL_VG_ALPHA_FORMAT_NONPRE = 12427 - EGL_VG_ALPHA_FORMAT_PRE = 12428 - EGL_VG_ALPHA_FORMAT_PRE_BIT = 64 - EGL_VG_COLORSPACE = 12423 - EGL_VG_COLORSPACE_LINEAR = 12426 - EGL_VG_COLORSPACE_LINEAR_BIT = 32 -) diff --git a/egl/egl_must_cast_to_proper_function_pointer_type.go b/egl/egl_must_cast_to_proper_function_pointer_type.go deleted file mode 100644 index 451a74a..0000000 --- a/egl/egl_must_cast_to_proper_function_pointer_type.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EglMustCastToProperFunctionPointerType = capi.EglMustCastToProperFunctionPointerType diff --git a/egl/eglattrib.go b/egl/eglattrib.go deleted file mode 100644 index f4cc9e4..0000000 --- a/egl/eglattrib.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLAttrib = capi.EGLAttrib diff --git a/egl/eglclient_buffer.go b/egl/eglclient_buffer.go deleted file mode 100644 index 27e53b9..0000000 --- a/egl/eglclient_buffer.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLClientBuffer = capi.EGLClientBuffer diff --git a/egl/eglconfig.go b/egl/eglconfig.go deleted file mode 100644 index 4e491de..0000000 --- a/egl/eglconfig.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLConfig = capi.EGLConfig diff --git a/egl/eglcontext.go b/egl/eglcontext.go deleted file mode 100644 index 96d6762..0000000 --- a/egl/eglcontext.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLContext = capi.EGLContext diff --git a/egl/egldisplay.go b/egl/egldisplay.go deleted file mode 100644 index cb89b10..0000000 --- a/egl/egldisplay.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLDisplay = capi.EGLDisplay diff --git a/egl/eglenum.go b/egl/eglenum.go deleted file mode 100644 index ffddf4a..0000000 --- a/egl/eglenum.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLenum = capi.EGLenum diff --git a/egl/eglimage.go b/egl/eglimage.go deleted file mode 100644 index e37cd2b..0000000 --- a/egl/eglimage.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLImage = capi.EGLImage diff --git a/egl/eglnative_display_type.go b/egl/eglnative_display_type.go deleted file mode 100644 index c7005c7..0000000 --- a/egl/eglnative_display_type.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLNativeDisplayType = capi.EGLNativeDisplayType diff --git a/egl/eglnative_pixmap_type.go b/egl/eglnative_pixmap_type.go deleted file mode 100644 index b9c423b..0000000 --- a/egl/eglnative_pixmap_type.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLNativePixmapType = capi.EGLNativePixmapType diff --git a/egl/eglnative_window_type.go b/egl/eglnative_window_type.go deleted file mode 100644 index f5d4f7e..0000000 --- a/egl/eglnative_window_type.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLNativeWindowType = capi.EGLNativeWindowType diff --git a/egl/eglsurface.go b/egl/eglsurface.go deleted file mode 100644 index 6ba3d0f..0000000 --- a/egl/eglsurface.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLSurface = capi.EGLSurface diff --git a/egl/eglsync.go b/egl/eglsync.go deleted file mode 100644 index 52dc2d0..0000000 --- a/egl/eglsync.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLSync = capi.EGLSync diff --git a/egl/egltime.go b/egl/egltime.go deleted file mode 100644 index a639097..0000000 --- a/egl/egltime.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -type EGLTime = capi.EGLTime diff --git a/egl/errors.go b/egl/errors.go deleted file mode 100644 index 37c8da1..0000000 --- a/egl/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/egl/functions.go b/egl/functions.go deleted file mode 100644 index b88eef6..0000000 --- a/egl/functions.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -// BindAPI calls the underlying C function. -func BindAPI(api EGLenum) Boolean { - return (Boolean)(capi.EglBindAPI(capi.EGLenum(api))) -} - -// ChooseConfig calls the underlying C function. -func ChooseConfig(dpy EGLDisplay, attrib_list *Int, configs *EGLConfig, config_size Int, num_config *Int) Boolean { - return (Boolean)(capi.EglChooseConfig(capi.EGLDisplay(dpy), (*capi.EGLint)(attrib_list), (*capi.EGLConfig)(configs), capi.EGLint(config_size), (*capi.EGLint)(num_config))) -} - -// CreateContext calls the underlying C function. -func CreateContext(dpy EGLDisplay, config EGLConfig, share_context EGLContext, attrib_list *Int) EGLContext { - return (EGLContext)(capi.EglCreateContext(capi.EGLDisplay(dpy), capi.EGLConfig(config), capi.EGLContext(share_context), (*capi.EGLint)(attrib_list))) -} - -// CreatePbufferSurface calls the underlying C function. -func CreatePbufferSurface(dpy EGLDisplay, config EGLConfig, attrib_list *Int) EGLSurface { - return (EGLSurface)(capi.EglCreatePbufferSurface(capi.EGLDisplay(dpy), capi.EGLConfig(config), (*capi.EGLint)(attrib_list))) -} - -// CreateWindowSurface calls the underlying C function. -func CreateWindowSurface(dpy EGLDisplay, config EGLConfig, win EGLNativeWindowType, attrib_list *Int) EGLSurface { - return (EGLSurface)(capi.EglCreateWindowSurface(capi.EGLDisplay(dpy), capi.EGLConfig(config), capi.EGLNativeWindowType(win), (*capi.EGLint)(attrib_list))) -} - -// DestroyContext calls the underlying C function. -func DestroyContext(dpy EGLDisplay, ctx EGLContext) Boolean { - return (Boolean)(capi.EglDestroyContext(capi.EGLDisplay(dpy), capi.EGLContext(ctx))) -} - -// DestroySurface calls the underlying C function. -func DestroySurface(dpy EGLDisplay, surface EGLSurface) Boolean { - return (Boolean)(capi.EglDestroySurface(capi.EGLDisplay(dpy), capi.EGLSurface(surface))) -} - -// GetConfigAttrib calls the underlying C function. -func GetConfigAttrib(dpy EGLDisplay, config EGLConfig, attribute Int, value *Int) Boolean { - return (Boolean)(capi.EglGetConfigAttrib(capi.EGLDisplay(dpy), capi.EGLConfig(config), capi.EGLint(attribute), (*capi.EGLint)(value))) -} - -// GetCurrentContext calls the underlying C function. -func GetCurrentContext() EGLContext { - return (EGLContext)(capi.EglGetCurrentContext()) -} - -// GetCurrentDisplay calls the underlying C function. -func GetCurrentDisplay() EGLDisplay { - return (EGLDisplay)(capi.EglGetCurrentDisplay()) -} - -// GetCurrentSurface calls the underlying C function. -func GetCurrentSurface(readdraw Int) EGLSurface { - return (EGLSurface)(capi.EglGetCurrentSurface(capi.EGLint(readdraw))) -} - -// GetDisplay calls the underlying C function. -func GetDisplay(display_id EGLNativeDisplayType) EGLDisplay { - return (EGLDisplay)(capi.EglGetDisplay(capi.EGLNativeDisplayType(display_id))) -} - -// GetError calls the underlying C function. -func GetError() Int { - return (Int)(capi.EglGetError()) -} - -// Initialize calls the underlying C function. -func Initialize(dpy EGLDisplay, major *Int, minor *Int) Boolean { - return (Boolean)(capi.EglInitialize(capi.EGLDisplay(dpy), (*capi.EGLint)(major), (*capi.EGLint)(minor))) -} - -// MakeCurrent calls the underlying C function. -func MakeCurrent(dpy EGLDisplay, draw EGLSurface, read EGLSurface, ctx EGLContext) Boolean { - return (Boolean)(capi.EglMakeCurrent(capi.EGLDisplay(dpy), capi.EGLSurface(draw), capi.EGLSurface(read), capi.EGLContext(ctx))) -} - -// QueryAPI calls the underlying C function. -func QueryAPI() EGLenum { - return (EGLenum)(capi.EglQueryAPI()) -} - -// QueryString calls the underlying C function. -func QueryString(dpy EGLDisplay, name Int) string { - return (string)(capi.EglQueryString(capi.EGLDisplay(dpy), capi.EGLint(name))) -} - -// QuerySurface calls the underlying C function. -func QuerySurface(dpy EGLDisplay, surface EGLSurface, attribute Int, value *Int) Boolean { - return (Boolean)(capi.EglQuerySurface(capi.EGLDisplay(dpy), capi.EGLSurface(surface), capi.EGLint(attribute), (*capi.EGLint)(value))) -} - -// ReleaseThread calls the underlying C function. -func ReleaseThread() Boolean { - return (Boolean)(capi.EglReleaseThread()) -} - -// SwapBuffers calls the underlying C function. -func SwapBuffers(dpy EGLDisplay, surface EGLSurface) Boolean { - return (Boolean)(capi.EglSwapBuffers(capi.EGLDisplay(dpy), capi.EGLSurface(surface))) -} - -// SwapInterval calls the underlying C function. -func SwapInterval(dpy EGLDisplay, interval Int) Boolean { - return (Boolean)(capi.EglSwapInterval(capi.EGLDisplay(dpy), capi.EGLint(interval))) -} - -// Terminate calls the underlying C function. -func Terminate(dpy EGLDisplay) Boolean { - return (Boolean)(capi.EglTerminate(capi.EGLDisplay(dpy))) -} - -// WaitGL calls the underlying C function. -func WaitGL() Boolean { - return (Boolean)(capi.EglWaitGL()) -} - -// WaitNative calls the underlying C function. -func WaitNative(engine Int) Boolean { - return (Boolean)(capi.EglWaitNative(capi.EGLint(engine))) -} diff --git a/egl/int.go b/egl/int.go deleted file mode 100644 index 05f0f49..0000000 --- a/egl/int.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -type Int int32 - -const ( - None Int = 12344 - RenderableType Int = 12352 - OpenglEs2Bit Int = 4 - OpenglEs3Bit Int = 64 - SurfaceType Int = 12339 - WindowBit Int = 4 - PbufferBit Int = 1 - RedSize Int = 12324 - GreenSize Int = 12323 - BlueSize Int = 12322 - AlphaSize Int = 12321 - DepthSize Int = 12325 - StencilSize Int = 12326 - ConfigID Int = 12328 - BufferSize Int = 12320 - Width Int = 12375 - Height Int = 12374 - ContextClientVersion Int = 12440 - ContextMajorVersion Int = 12440 - OpenglEsApi Int = 12448 -) diff --git a/egl/interop.go b/egl/interop.go deleted file mode 100644 index ca28968..0000000 --- a/egl/interop.go +++ /dev/null @@ -1,47 +0,0 @@ -package egl - -import "unsafe" - -// EGLDisplayToUintPtr converts an EGLDisplay to uintptr for framework interop. -func EGLDisplayToUintPtr(d EGLDisplay) uintptr { return uintptr(unsafe.Pointer(d)) } - -// EGLDisplayFromUintPtr converts a uintptr to EGLDisplay. -func EGLDisplayFromUintPtr(ptr uintptr) EGLDisplay { return EGLDisplay(unsafe.Pointer(ptr)) } - -// EGLContextToUintPtr converts an EGLContext to uintptr for framework interop. -func EGLContextToUintPtr(c EGLContext) uintptr { return uintptr(unsafe.Pointer(c)) } - -// EGLContextFromUintPtr converts a uintptr to EGLContext. -func EGLContextFromUintPtr(ptr uintptr) EGLContext { return EGLContext(unsafe.Pointer(ptr)) } - -// EGLSurfaceToUintPtr converts an EGLSurface to uintptr for framework interop. -func EGLSurfaceToUintPtr(s EGLSurface) uintptr { return uintptr(unsafe.Pointer(s)) } - -// EGLSurfaceFromUintPtr converts a uintptr to EGLSurface. -func EGLSurfaceFromUintPtr(ptr uintptr) EGLSurface { return EGLSurface(unsafe.Pointer(ptr)) } - -// EGLConfigToUintPtr converts an EGLConfig to uintptr for framework interop. -func EGLConfigToUintPtr(c EGLConfig) uintptr { return uintptr(unsafe.Pointer(c)) } - -// EGLConfigFromUintPtr converts a uintptr to EGLConfig. -func EGLConfigFromUintPtr(ptr uintptr) EGLConfig { return EGLConfig(unsafe.Pointer(ptr)) } - -// EGLImageToUintPtr converts an EGLImage to uintptr for framework interop. -func EGLImageToUintPtr(i EGLImage) uintptr { return uintptr(unsafe.Pointer(i)) } - -// EGLImageFromUintPtr converts a uintptr to EGLImage. -func EGLImageFromUintPtr(ptr uintptr) EGLImage { return EGLImage(unsafe.Pointer(ptr)) } - -// EGLSyncToUintPtr converts an EGLSync to uintptr for framework interop. -func EGLSyncToUintPtr(s EGLSync) uintptr { return uintptr(unsafe.Pointer(s)) } - -// EGLSyncFromUintPtr converts a uintptr to EGLSync. -func EGLSyncFromUintPtr(ptr uintptr) EGLSync { return EGLSync(unsafe.Pointer(ptr)) } - -// EGLClientBufferToUintPtr converts an EGLClientBuffer to uintptr for framework interop. -func EGLClientBufferToUintPtr(b EGLClientBuffer) uintptr { return uintptr(unsafe.Pointer(b)) } - -// EGLClientBufferFromUintPtr converts a uintptr to EGLClientBuffer. -func EGLClientBufferFromUintPtr(ptr uintptr) EGLClientBuffer { - return EGLClientBuffer(unsafe.Pointer(ptr)) -} diff --git a/egl/native_window_buffer.go b/egl/native_window_buffer.go deleted file mode 100644 index 34dfa5b..0000000 --- a/egl/native_window_buffer.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/egl" -) - -// NativeWindow_Buffer wraps the NDK ANativeWindow_Buffer handle. -type NativeWindow_Buffer struct { - ptr *capi.ANativeWindow_Buffer -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *NativeWindow_Buffer) cptr() *capi.ANativeWindow_Buffer { - if h == nil { - return nil - } - return h.ptr -} - -// NewNativeWindow_BufferFromPointer wraps a raw ANativeWindow_Buffer pointer. -func NewNativeWindow_BufferFromPointer(ptr unsafe.Pointer) *NativeWindow_Buffer { - return &NativeWindow_Buffer{ptr: (*capi.ANativeWindow_Buffer)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *NativeWindow_Buffer) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *NativeWindow_Buffer) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewNativeWindow_BufferFromUintPtr wraps a uintptr as a NativeWindow_Buffer. -// The caller must ensure ptr points to a valid ANativeWindow_Buffer. -func NewNativeWindow_BufferFromUintPtr(ptr uintptr) *NativeWindow_Buffer { - return &NativeWindow_Buffer{ptr: (*capi.ANativeWindow_Buffer)(unsafe.Pointer(ptr))} -} diff --git a/egl/native_window_change_frame_rate_strategy.go b/egl/native_window_change_frame_rate_strategy.go deleted file mode 100644 index 9bdbeef..0000000 --- a/egl/native_window_change_frame_rate_strategy.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -type NativeWindow_ChangeFrameRateStrategy int32 - -const ( - ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS NativeWindow_ChangeFrameRateStrategy = 0 - ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS NativeWindow_ChangeFrameRateStrategy = 1 -) diff --git a/egl/native_window_frame_rate_compatibility.go b/egl/native_window_frame_rate_compatibility.go deleted file mode 100644 index 82726c6..0000000 --- a/egl/native_window_frame_rate_compatibility.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -type NativeWindow_FrameRateCompatibility int32 - -const ( - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT NativeWindow_FrameRateCompatibility = 0 - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE NativeWindow_FrameRateCompatibility = 1 -) diff --git a/egl/native_window_legacy_format.go b/egl/native_window_legacy_format.go deleted file mode 100644 index 8034559..0000000 --- a/egl/native_window_legacy_format.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -type NativeWindow_LegacyFormat int32 - -const ( - WINDOW_FORMAT_RGBA_8888 NativeWindow_LegacyFormat = 1 - WINDOW_FORMAT_RGBX_8888 NativeWindow_LegacyFormat = 2 - WINDOW_FORMAT_RGB_565 NativeWindow_LegacyFormat = 4 -) diff --git a/egl/native_window_transform.go b/egl/native_window_transform.go deleted file mode 100644 index 2007c15..0000000 --- a/egl/native_window_transform.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package egl - -type NativeWindowTransform int32 - -const ( - ANATIVEWINDOW_TRANSFORM_IDENTITY NativeWindowTransform = 0 - ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL NativeWindowTransform = 1 - ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL NativeWindowTransform = 2 - ANATIVEWINDOW_TRANSFORM_ROTATE_90 NativeWindowTransform = 4 - ANATIVEWINDOW_TRANSFORM_ROTATE_180 NativeWindowTransform = 3 - ANATIVEWINDOW_TRANSFORM_ROTATE_270 NativeWindowTransform = 7 -) diff --git a/egl/package.go b/egl/package.go deleted file mode 100644 index 3c79966..0000000 --- a/egl/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package egl provides Go bindings for EGL. -package egl diff --git a/examples/AssetDemo/basic/AndroidManifest.xml b/examples/AssetDemo/basic/AndroidManifest.xml new file mode 100644 index 0000000..2d3d2c3 --- /dev/null +++ b/examples/AssetDemo/basic/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/AssetDemo/basic/assets/a/readme_a.txt b/examples/AssetDemo/basic/assets/a/readme_a.txt new file mode 100644 index 0000000..2249b46 --- /dev/null +++ b/examples/AssetDemo/basic/assets/a/readme_a.txt @@ -0,0 +1 @@ +readme a \ No newline at end of file diff --git a/examples/AssetDemo/basic/assets/label_icon.png b/examples/AssetDemo/basic/assets/label_icon.png new file mode 100644 index 0000000..bf50f7c Binary files /dev/null and b/examples/AssetDemo/basic/assets/label_icon.png differ diff --git a/examples/AssetDemo/basic/assets/readme_root.txt b/examples/AssetDemo/basic/assets/readme_root.txt new file mode 100644 index 0000000..584ef37 --- /dev/null +++ b/examples/AssetDemo/basic/assets/readme_root.txt @@ -0,0 +1 @@ +readme root \ No newline at end of file diff --git a/examples/AssetDemo/main.go b/examples/AssetDemo/main.go new file mode 100644 index 0000000..ae3b619 --- /dev/null +++ b/examples/AssetDemo/main.go @@ -0,0 +1,372 @@ +package main + +import ( + "bytes" + "fmt" + "image" + imagedraw "image/draw" + _ "image/png" + "io" + "log" + "os" + "path/filepath" + "runtime" + "strconv" + "strings" + "time" + "unsafe" + + "github.com/gooid/gl/egl" + gl "github.com/gooid/gl/es2" + "github.com/gooid/imgui" + "github.com/gooid/imgui/util" + "github.com/xaionaro-go/ndk" + "github.com/xaionaro-go/ndk/input" + "github.com/xaionaro-go/ndk/storage" +) + +func main() { + context := ndk.Callbacks{ + WindowDraw: draw, + WindowRedrawNeeded: redraw, + WindowDestroyed: destroyed, + Event: event, + Create: create, + } + ndk.SetMainCB(func(ctx *ndk.Context) { + ctx.Debug(true) + ctx.Run(context) + }) + for ndk.Loop() { + } + log.Println("done.") +} + +var mouseLeft = false +var mouseRight = false +var lastX, lastY int + +func event(act *ndk.Activity, e *ndk.InputEvent) { + if mot := e.Motion(); mot != nil { + lastX = int(float32(mot.GetX(0)) / WINDOWSCALE) + lastY = int(float32(mot.GetY(0)) / WINDOWSCALE) + switch mot.GetAction() { + case input.MOTION_EVENT_ACTION_UP: + mouseLeft = false + //log.Println("event:", mot) + case input.MOTION_EVENT_ACTION_DOWN: + mouseLeft = true + //log.Println("event:", mot) + case input.MOTION_EVENT_ACTION_MOVE: + + default: + //log.Println("event:", mot) + return + } + draw(act, nil) + + switch mot.GetAction() { + case input.MOTION_EVENT_ACTION_UP: + lastX, lastY = 0, 0 + draw(act, nil) + } + } +} + +const WINDOWSCALE = 1 +const title = "Asset 访问" + +var ( + width, height int + eglctx *egl.EGLContext + + im *util.Render + imagData image.Image + imageTxtId uint32 + imageScale float32 = 5 +) + +func initEGL(act *ndk.Activity, win *ndk.Window) { + width, height = win.Width(), win.Height() + log.Println("WINSIZE:", width, height) + width = int(float32(width) / WINDOWSCALE) + height = int(float32(height) / WINDOWSCALE) + + eglctx = egl.CreateEGLContext(&nativeInfo{win: win}) + if eglctx == nil { + return + } + + log.Println("RENDERER:", gl.GoStr(gl.GetString(gl.RENDERER))) + log.Println("VENDOR:", gl.GoStr(gl.GetString(gl.VENDOR))) + log.Println("VERSION:", gl.GoStr(gl.GetString(gl.VERSION))) + log.Println("EXTENSIONS:", gl.GoStr(gl.GetString(gl.EXTENSIONS))) + + log.Printf("%s %s", gl.GoStr(gl.GetString(gl.RENDERER)), gl.GoStr(gl.GetString(gl.VERSION))) + + // 设置完字体再调用 + im.CreateDeviceObjects() + + if rgba, ok := imagData.(*image.RGBA); ok { + imageTxtId = genTexture(gl.Ptr(rgba.Pix), rgba.Bounds().Dx(), rgba.Bounds().Dy()) + } + + io := imgui.GetIO() + + dsize := imgui.NewVec2(float32(width), float32(height)) + defer dsize.Delete() + io.SetDisplaySize(dsize) + + // Setup time step + io.SetDeltaTime(float32(time.Now().UnixNano() / int64(time.Millisecond/time.Nanosecond))) +} + +func releaseEGL() { + if im != nil { + im.DestroyDeviceObjects() + } + if imageTxtId != 0 { + gl.DeleteTextures(1, &imageTxtId) + } + if eglctx != nil { + eglctx.Terminate() + eglctx = nil + } +} + +func create(act *ndk.Activity, _ []byte) { + // gl init + gl.Init() + + // Setup Dear ImGui binding + imgui.CreateContext() + + // Setup style + imgui.StyleColorsDark() + //imgui.StyleColorsClassic() + + io := imgui.GetIO() + fonts := io.GetFonts() + + log.Println("GOOS", runtime.GOOS) + if runtime.GOOS == "android" { + fontName := "/system/fonts/DroidSansFallback.ttf" + if _, err := os.Stat(fontName); err != nil { + fontName = "/system/fonts/NotoSansCJK-Regular.ttc" + if _, err := os.Stat(fontName); err != nil { + fontName = "/system/fonts/DroidSans.ttf" + if _, err := os.Stat(fontName); err != nil { + fontName = "" + } + } + } + if fontName != "" { + _ = fonts + // 加载所有中文Glyph,但内存开销太大 + //fonts.AddFontFromFileTTF(fontName, 24.0, imgui.SwigcptrFontConfig(0), fonts.GetGlyphRangesChineseSimplifiedCommon()) + // 仅仅加载需要显示的中文Glyph + fonts.AddFontFromFileTTF(fontName, 24.0, imgui.SwigcptrFontConfig(0), util.GetFontGlyphRanges(title)) + } + } + + if runtime.GOOS == "android" { + dstr := ndk.PropGet("hw.lcd.density") + if dstr == "" { + dstr = ndk.PropGet("qemu.sf.lcd_density") + } + + log.Println(" lcd_density:", dstr) + if dstr != "" { + desity, _ := strconv.Atoi(dstr) + + if desity > 160 { + iScale := (float32)(desity / 160 / WINDOWSCALE) + io.SetFontGlobalScale(iScale) + style := imgui.GetStyle() + style.ScaleAllSizes(iScale) + + scale := imgui.NewVec2((float32)(WINDOWSCALE), (float32)(WINDOWSCALE)) + defer scale.Delete() + io.SetDisplayFramebufferScale(scale) + } + } + } + io.SetConfigFlags(io.GetConfigFlags() | int(imgui.ConfigFlags_IsTouchScreen)) + + // render 只需初始化一次 + im = util.NewRender("#version 100") + + // read asset resource + imagData = ReadImage(act, "label_icon.png") +} + +func redraw(act *ndk.Activity, win *ndk.Window) { + act.Context().Call(func() { + releaseEGL() + initEGL(act, win) + }, false) + act.Context().Call(func() { + draw(act, nil) + }, false) + act.Context().Call(func() { + draw(act, nil) + }, false) +} + +func destroyed(act *ndk.Activity, win *ndk.Window) { + releaseEGL() +} + +func draw(act *ndk.Activity, win *ndk.Window) { + if eglctx != nil { + io := imgui.GetIO() + + pos := imgui.NewVec2(float32(lastX), float32(lastY)) + defer pos.Delete() + io.SetMousePos(pos) + io.SetMouseDown([]bool{mouseLeft, false, mouseRight, false, false}) + + // Setup time step + io.SetDeltaTime(float32(time.Now().UnixNano() / int64(time.Millisecond/time.Nanosecond))) + + // Margin + MARGIN := float32(width / 20) + + imgui.NewFrame() + curpos := imgui.NewVec2(MARGIN, MARGIN) + defer curpos.Delete() + imgui.SetNextWindowPos(curpos) + isize := imgui.NewVec2(float32(width)-2*MARGIN, float32(height)-2*MARGIN) + defer isize.Delete() + imgui.SetNextWindowSize(isize) + + imgui.Begin(title, (*bool)(nil), int(imgui.WindowFlags_NoSavedSettings| + //imgui.WindowFlags_NoTitleBar| + imgui.WindowFlags_NoResize| + imgui.WindowFlags_NoCollapse| + imgui.WindowFlags_NoMove)) + + if imgui.CollapsingHeader("image", int(imgui.TreeNodeFlags_DefaultOpen)) { + imgui.SliderFloat("scale", &imageScale, float32(1), float32(20)) + if imageTxtId != 0 { + imgsize := imgui.NewVec2(float32(imagData.Bounds().Dx()+1)*imageScale, float32(imagData.Bounds().Dy()+1)*imageScale) + defer imgsize.Delete() + imgui.Image(uintptr(imageTxtId), imgsize) + } + } + + if imgui.CollapsingHeader("fiile list", int(imgui.TreeNodeFlags_DefaultOpen)) { + // 根目录,不是用"/"表示,用"" + AssetInfo(act, "") + if imgui.TreeNode("a") { + // 子目录 "a" + AssetInfo(act, "a") + imgui.TreePop() + imgui.Separator() + } + } + + imgui.End() + + imgui.Render() + + // Rendering + gl.Viewport(0, 0, int32(width), int32(height)) + gl.ClearColor(0, 0, 0, 1) + gl.Clear(gl.COLOR_BUFFER_BIT) + + //log.Println("draw:", drawData.GetCmdListsCount(), drawData.GetTotalVtxCount(), drawData.GetTotalIdxCount()) + + im.Render(imgui.GetDrawData()) + + eglctx.SwapBuffers() + } +} + +func AssetInfo(act *ndk.Activity, dir string) { + assetMgr := act.AssetManager() + assetDir := assetMgr.OpenDir(dir) + defer assetDir.Close() + for { + // 得到下一个文件名,但不能列出子目录 + fname := assetDir.GetNextFileName() + if fname == "" { + return + } + if imgui.TreeNode(fname) { + fullpath := "" + if dir == "" { + fullpath = fname + } else { + fullpath = dir + "/" + fname + } + asset := assetMgr.Open(fullpath, storage.ASSET_MODE_RANDOM) + if asset != nil { + imgui.Text(fmt.Sprintf("size:%d, IsAllocated:%v", asset.Length(), asset.IsAllocated())) + + context := "" + isTxt := strings.ToLower(filepath.Ext(fullpath)) == ".txt" + + var buf = make([]byte, 16) + i, _ := asset.Read(buf) + if isTxt { + context += string(buf) + "\n" + } else { + context = fmt.Sprintln(buf[:i]) + } + asset.Seek(-16, io.SeekEnd) + i, _ = asset.Read(buf) + context += fmt.Sprintln("\t...") + if isTxt { + context += string(buf) + "\n" + } else { + context += fmt.Sprintln(buf[:i]) + } + asset.Close() + + imgui.Text(context) + } else { + imgui.Text("open fail.") + } + imgui.TreePop() + imgui.Separator() + } + } +} + +func ReadImage(act *ndk.Activity, fname string) image.Image { + // load image + m := act.AssetManager() + fa := m.Open(fname, storage.ASSET_MODE_BUFFER) + buf := make([]byte, fa.Length()) + fa.Read(buf) + + img, _, err := image.Decode(bytes.NewBuffer(buf)) + if err != nil { + log.Println("ReadImage:", err) + } + fa.Close() + + // 转换成 RGBA 格式 + dst := image.NewRGBA(img.Bounds()) + imagedraw.Draw(dst, dst.Bounds(), img, image.Point{}, imagedraw.Src) + return dst +} + +func genTexture(p unsafe.Pointer, w, h int) uint32 { + var textureId uint32 + // Upload texture to graphics system + var lastTexture int32 + gl.GetIntegerv(gl.TEXTURE_BINDING_2D, &lastTexture) + gl.GenTextures(1, &textureId) + gl.BindTexture(gl.TEXTURE_2D, textureId) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) + //gl.PixelStorei(gl.UNPACK_ROW_LENGTH, 0) + gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, int32(w), int32(h), + 0, gl.RGBA, gl.UNSIGNED_BYTE, p) + + // Restore state + gl.BindTexture(gl.TEXTURE_2D, uint32(lastTexture)) + return textureId +} diff --git a/examples/AssetDemo/nativeinfo.go b/examples/AssetDemo/nativeinfo.go new file mode 100644 index 0000000..6d5b25a --- /dev/null +++ b/examples/AssetDemo/nativeinfo.go @@ -0,0 +1,25 @@ +package main + +import ( + "unsafe" + + "github.com/xaionaro-go/ndk" +) + +type nativeInfo struct { + win *ndk.Window +} + +func (e *nativeInfo) NativeDisplay() unsafe.Pointer { + return nil +} +func (e *nativeInfo) NativeWindow() unsafe.Pointer { + return unsafe.Pointer(e.win) +} +func (e *nativeInfo) WindowSize() (w, h int) { + return e.win.Width(), e.win.Height() +} + +func (e *nativeInfo) SetBuffersGeometry(format int) int { + return e.win.SetBuffersGeometry(0, 0, format) +} diff --git a/examples/FyneCameraDemo/AndroidManifest.xml b/examples/FyneCameraDemo/AndroidManifest.xml new file mode 100644 index 0000000..32d70e9 --- /dev/null +++ b/examples/FyneCameraDemo/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/FyneCameraDemo/FyneApp.toml b/examples/FyneCameraDemo/FyneApp.toml new file mode 100644 index 0000000..b307fc3 --- /dev/null +++ b/examples/FyneCameraDemo/FyneApp.toml @@ -0,0 +1,8 @@ +Website = "https://github.com/xaionaro-go/cam2ip" + +[Details] + Icon = "assets/icon.png" + Name = "FyneCameraDemo" + ID = "FyneCameraDemo.dx.streampanel" + Version = "0.1.0" + Build = 61 diff --git a/examples/FyneCameraDemo/assets/icon.png b/examples/FyneCameraDemo/assets/icon.png new file mode 100644 index 0000000..9227b66 Binary files /dev/null and b/examples/FyneCameraDemo/assets/icon.png differ diff --git a/examples/FyneCameraDemo/camera.go b/examples/FyneCameraDemo/camera.go new file mode 100644 index 0000000..82888e7 --- /dev/null +++ b/examples/FyneCameraDemo/camera.go @@ -0,0 +1,76 @@ +package main + +import ( + "fmt" + + "github.com/xaionaro-go/ndk/camera" + "github.com/xaionaro-go/ndk/media" + "github.com/xaionaro-go/ndk/ndk" +) + +type Camera struct { + *camera.Device + *media.ImageReader +} + +var _ camera.CaptureSessionStateCallbacks = (*Camera)(nil) + +func (cam *Camera) OnClosed(sess *camera.CaptureSession) { + +} +func (cam *Camera) OnReady(sess *camera.CaptureSession) { +} +func (cam *Camera) OnActive(sess *camera.CaptureSession) { + +} +func (cam *Camera) Close() error { + return fmt.Errorf("not implemented, yet") +} + +func (cam *Camera) StartStreaming( + requestTemplate camera.DeviceRequestTemplate, + targetWindows ...*ndk.Window, +) error { + request, err := cam.Device.CreateCaptureRequest(requestTemplate) + if err != nil { + return fmt.Errorf("CreateCaptureRequest: %w", err) + } + + outputContainer, err := camera.CaptureSessionOutputContainerCreate() + if err != nil { + return fmt.Errorf("CaptureSessionOutputContainerCreate: %w", err) + } + + for idx, win := range targetWindows { + sessionOutput, err := camera.CaptureSessionOutputCreate(win) + if err != nil { + return fmt.Errorf("%d: CaptureSessionOutputCreate: %w", idx, err) + } + err = outputContainer.Add(sessionOutput) + if err != nil { + return fmt.Errorf("%d, outputContainer.Add: %w", idx, err) + } + + target, err := camera.CameraOutputTargetCreate(win) + if err != nil { + return fmt.Errorf("%d: CameraOutputTargetCreate: %w", idx, err) + } + + err = request.AddTarget(target) + if err != nil { + return fmt.Errorf("%d: AddTarget: %w", idx, err) + } + } + + captureSession, err := cam.Device.CreateCaptureSession(outputContainer, cam) + if err != nil { + return fmt.Errorf("CreateCaptureSession: %w", err) + } + + err = captureSession.SetRepeatingRequest([]*camera.CaptureRequest{request}) + if err != nil { + return fmt.Errorf("SetRepeatingRequest: %w", err) + } + + return nil +} diff --git a/examples/FyneCameraDemo/camera_manager.go b/examples/FyneCameraDemo/camera_manager.go new file mode 100644 index 0000000..9b6d55c --- /dev/null +++ b/examples/FyneCameraDemo/camera_manager.go @@ -0,0 +1,171 @@ +package main + +import ( + "container/list" + "fmt" + "log" + + "github.com/xaionaro-go/ndk/camera" + "github.com/xaionaro-go/ndk/util" +) + +type CameraState struct { + bAvailable bool + devices *list.List +} + +func (s *CameraState) AddDevice(device *camera.Device) { + if s.devices == nil { + s.devices = list.New() + } + s.devices.PushBack(device) +} + +func (s *CameraState) DelDevice(device *camera.Device) { + util.Assert(s.devices != nil) + elm := s.devices.Front() + for ; elm != nil; elm = elm.Next() { + if device == elm.Value.(*camera.Device) { + s.devices.Remove(elm) + return + } + } +} + +func (s *CameraState) String() string { + ret := "" + for elm := s.devices.Front(); elm != nil; elm = elm.Next() { + ret += fmt.Sprint(elm.Value, ",") + } + if ret != "" { + return fmt.Sprint("{ ", s.bAvailable, ", [ ", ret, " ] }") + } else { + return fmt.Sprint("{ ", s.bAvailable, " }") + } +} + +type CameraManager struct { + *camera.Manager + cameras map[string]*CameraState +} + +var gMgr *CameraManager + +func CameraManagerInstance() *CameraManager { + if gMgr != nil { + return gMgr + } + + mgr := &CameraManager{} + mgr.Manager = camera.ManagerCreate() + if mgr.Manager != nil { + mgr.Manager.RegisterAvailabilityCallback(mgr) + mgr.cameras = map[string]*CameraState{} + + gMgr = mgr + } + return gMgr +} + +func (mgr *CameraManager) Delete() { + mgr.Manager.UnregisterAvailabilityCallback(mgr) + mgr.Manager.Delete() + mgr.Manager = nil +} + +func (mgr *CameraManager) cameraState(id string) *CameraState { + if ret, ok := mgr.cameras[id]; ok { + return ret + } + ret := new(CameraState) + mgr.cameras[id] = ret + return ret +} + +func (mgr *CameraManager) OnCameraAvailable(id string) { + log.Println("... onCameraAvailable", id) + mgr.cameraState(id).bAvailable = true +} + +func (mgr *CameraManager) OnCameraUnavailable(id string) { + log.Println("... onCameraUnavailable", id) + mgr.cameraState(id).bAvailable = false +} + +func (mgr *CameraManager) OnDisconnected(device *camera.Device) { + log.Println("... OnDisconnected", device) + mgr.cameraState(device.GetId()).DelDevice(device) +} + +func (mgr *CameraManager) OnError(device *camera.Device, error int) { + log.Println("... OnError", device, error) + mgr.cameraState(device.GetId()).DelDevice(device) +} + +func (mgr *CameraManager) dump() string { + cstr := "" + for id, s := range mgr.cameras { + cstr += id + " = " + s.String() + ";" + } + if cstr == "" { + return "" + } + return cstr +} + +func (mgr *CameraManager) GetSensorOrientation(id string) (int, int) { + metadata, err := mgr.GetCameraCharacteristics(id) + util.Assert(err) + defer metadata.Free() + + lens, err := metadata.GetConstEntry(camera.LENS_FACING) + util.Assert(err) + orientation, err := metadata.GetConstEntry(camera.SENSOR_ORIENTATION) + util.Assert(err) + + return int(lens.Data().([]byte)[0]), int(orientation.Data().([]int32)[0]) +} + +func (mgr *CameraManager) GetSupportPixels(id string) [][2]int { + metadata, err := mgr.GetCameraCharacteristics(id) + util.Assert(err) + defer metadata.Free() + + cfgs, err := metadata.GetConstEntry(camera.SCALER_AVAILABLE_STREAM_CONFIGURATIONS) + util.Assert(err) + + // SCALER_AVAILABLE_STREAM_CONFIGURATIONS: + // input = entry.data.i32[i * 4 + 3]; + // format = entry.data.i32[i * 4 + 0]; + // width = entry.data.i32[i * 4 + 1]; + // height = entry.data.i32[i * 4 + 2]; + + ps := [][2]int{} + ds := cfgs.Data().([]int32) + // Remove duplicates + ms := map[string]bool{} + for i := 0; i < cfgs.Count()/4; i++ { + w, h := int(ds[i*4+1]), int(ds[i*4+2]) + s := fmt.Sprint(w, "x", h) + if !ms[s] { + ps = append(ps, [2]int{w, h}) + ms[s] = true + } + } + return ps +} + +func (mgr *CameraManager) OpenCamera( + cameraID string, +) (*Camera, error) { + dev, err := mgr.Manager.OpenCamera(cameraID, mgr) + if err != nil { + return nil, fmt.Errorf("unable to open the camera: %w", err) + } + + mgr.cameraState(cameraID).AddDevice(dev) + + return &Camera{ + Device: dev, + }, nil +} diff --git a/examples/FyneCameraDemo/image.go b/examples/FyneCameraDemo/image.go new file mode 100644 index 0000000..e17cb7f --- /dev/null +++ b/examples/FyneCameraDemo/image.go @@ -0,0 +1,65 @@ +package main + +import ( + "fmt" + "image" + + "github.com/xaionaro-go/camera/ximage" + "github.com/xaionaro-go/ndk/media" +) + +func ConvertImage( + img *media.Image, +) (image.Image, error) { + w, _ := img.GetWidth() + h, _ := img.GetHeight() + //t, _ := img.GetTimestamp() + format, _ := img.GetFormat() + //planes, _ := img.GetNumberOfPlanes() + //pixelStride, _ := img.GetPlanePixelStride(1) + //rowStride, _ := img.GetPlaneRowStride(1) + + rect := image.Rectangle{Max: image.Point{ + X: w, + Y: h, + }} + + switch format { + case media.FORMAT_RGBA_8888: + dataRGBA, err := img.GetPlaneData(0) + if err != nil { + return nil, fmt.Errorf("img.GetPlaneData(0): %w", err) + } + return &image.RGBA{ + Pix: dataRGBA, + Stride: 4 * w, + Rect: rect, + }, nil + case media.FORMAT_YUV_420_888: + dataY, err := img.GetPlaneData(0) + if err != nil { + return nil, fmt.Errorf("img.GetPlaneData(0): %w", err) + } + if len(dataY) == 0 { + return nil, fmt.Errorf("len(dataY) == 0") + } + dataUV, err := img.GetPlaneData(2) + if err != nil { + return nil, fmt.Errorf("img.GetPlaneData(2): %w", err) + } + if len(dataY) == 0 { + return nil, fmt.Errorf("len(dataUV) == 0") + } + img := ximage.NewNV12NoAlloc(rect) + img.Y = dataY + if len(dataUV)%2 == 1 { // TODO: investigate why sometimes the length is one byte short + dataUV = append(dataUV, 0) + } + if err := img.SetCbCrBytes(dataUV); err != nil { + return nil, fmt.Errorf("SetCbCrBytes: %w", err) + } + return img, nil + default: + return nil, fmt.Errorf("not supported: %v", format) + } +} diff --git a/examples/FyneCameraDemo/image_listener.go b/examples/FyneCameraDemo/image_listener.go new file mode 100644 index 0000000..3b7282b --- /dev/null +++ b/examples/FyneCameraDemo/image_listener.go @@ -0,0 +1,56 @@ +package main + +import ( + "fmt" + + "github.com/xaionaro-go/ndk/media" + "github.com/xaionaro-go/ndk/ndk" +) + +type ImageListener struct { + Window *ndk.Window + ImageReader *media.ImageReader + ImageChan chan *media.Image +} + +func NewImageListener( + width uint, + height uint, + format media.Formats, +) (*ImageListener, error) { + l := &ImageListener{ + ImageChan: make(chan *media.Image, 1), + } + + var err error + l.ImageReader, err = media.NewImageReader(int(width), int(height), format, 4) + if err != nil { + return nil, fmt.Errorf("NewImageReader: %w", err) + } + + err = l.ImageReader.SetImageListener(l.OnImage) + if err != nil { + return nil, fmt.Errorf("SetImageListener: %w", err) + } + + l.Window, err = l.ImageReader.GetWindow() + if err != nil { + return nil, fmt.Errorf("ImageReader.GetWindow: %w", err) + } + + l.Window.Acquire() + return l, nil +} + +func (l *ImageListener) OnImage(r *media.ImageReader) { + img, err := r.AcquireNextImage() + if err != nil { + panic(fmt.Errorf("AcquireNextImage: %w", err)) + } + + select { + case l.ImageChan <- img: + default: + img.Delete() + } +} diff --git a/examples/FyneCameraDemo/main.go b/examples/FyneCameraDemo/main.go new file mode 100644 index 0000000..6c4632b --- /dev/null +++ b/examples/FyneCameraDemo/main.go @@ -0,0 +1,152 @@ +//go:build android +// +build android + +package main + +import ( + "context" + "fmt" + "log" + "net/http" + _ "net/http/pprof" + "runtime" + "runtime/debug" + + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/app" + "fyne.io/fyne/v2/canvas" + "fyne.io/fyne/v2/widget" + "github.com/spf13/pflag" + "github.com/xaionaro-go/ndk/camera" + "github.com/xaionaro-go/ndk/media" +) + +import "C" + +func main() { + netPprofAddr := pflag.String("net-pprof-addr", "", "") + pflag.Parse() + + a := app.New() + w := a.NewWindow("Display camera") + + if *netPprofAddr == "" && runtime.GOOS == "android" { + *netPprofAddr = "0.0.0.0:0" + } + if *netPprofAddr != "" { + go func() { + defer func() { processRecover(w, recover()) }() + log.Println(http.ListenAndServe(*netPprofAddr, nil)) + }() + } + + defer func() { processRecover(w, recover()) }() + + camID := "0" + + camMan := CameraManagerInstance() + cam, err := camMan.OpenCamera(camID) + if err != nil { + panicInUI(w, fmt.Errorf("OpenCamera: %w", err)) + } + defer cam.Close() + + imageListener, err := NewImageListener( + 1920, 1080, + media.FORMAT_YUV_420_888, + ) + if err != nil { + panicInUI(w, fmt.Errorf("NewImageListener: %w", err)) + } + + err = cam.StartStreaming( + camera.TEMPLATE_ZERO_SHUTTER_LAG, + imageListener.Window, + ) + if err != nil { + panicInUI(w, fmt.Errorf("StartStreaming: %w", err)) + } + + mImg := <-imageListener.ImageChan + if mImg == nil { + panicInUI(w, fmt.Errorf("mImg == nil")) + } + width, err := mImg.GetWidth() + if err != nil { + panicInUI(w, fmt.Errorf("GetWidth: %w", err)) + } + if width == 0 { + panicInUI(w, fmt.Errorf("width == 0")) + } + + height, err := mImg.GetHeight() + if err != nil { + panicInUI(w, fmt.Errorf("GetHeight: %w", err)) + } + if height == 0 { + panicInUI(w, fmt.Errorf("height == 0")) + } + + img, err := ConvertImage(mImg) + if err != nil { + panicInUI(w, fmt.Errorf("ConvertImage: %w", err)) + } + + log.Println("width: ", width, "; height: ", height) + + // checking we are not panicking while reading the image + for x := 0; x < width; x++ { + for y := 0; y < height; y++ { + img.At(x, y) + } + } + + fyneImg := canvas.NewImageFromImage(img) + fyneImg.ScaleMode = canvas.ImageScaleFastest + fyneImg.FillMode = canvas.ImageFillContain + + c := w.Canvas() + c.SetContent(fyneImg) + + go func() { + defer func() { processRecover(w, recover()) }() + for newMImg := range imageListener.ImageChan { + _, err := ConvertImage(newMImg) + if err != nil { + newMImg.Delete() + panicInUI(w, fmt.Errorf("ConvertImage: %w", err)) + } + fyneImg.Image = img + fyneImg.Refresh() + mImg.Delete() + mImg = newMImg + } + }() + + w.ShowAndRun() + <-context.Background().Done() +} + +func panicInUI( + w fyne.Window, + err error, +) { + log.Println(err.Error()) + text := widget.NewLabel(err.Error()) + text.Wrapping = fyne.TextWrapWord + w.SetContent(text) + w.ShowAndRun() + <-context.Background().Done() +} + +func processRecover( + w fyne.Window, + r any, +) { + if r == nil { + return + } + + debug.PrintStack() + panicInUI(w, fmt.Errorf("%v\n\n%s", r, debug.Stack())) +} diff --git a/examples/PropTree/basic/AndroidManifest.xml b/examples/PropTree/basic/AndroidManifest.xml new file mode 100644 index 0000000..e861a7f --- /dev/null +++ b/examples/PropTree/basic/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/PropTree/main.go b/examples/PropTree/main.go new file mode 100644 index 0000000..231859e --- /dev/null +++ b/examples/PropTree/main.go @@ -0,0 +1,335 @@ +package main + +import ( + "log" + "os" + "runtime" + "sort" + "strconv" + "strings" + "time" + + "github.com/gooid/gl/egl" + gl "github.com/gooid/gl/es2" + "github.com/gooid/imgui" + "github.com/gooid/imgui/util" + "github.com/xaionaro-go/ndk" + "github.com/xaionaro-go/ndk/input" +) + +func main() { + context := ndk.Callbacks{ + FocusChanged: focus, + WindowCreated: create, + WindowDraw: draw, + WindowRedrawNeeded: redraw, + WindowDestroyed: destroyed, + Event: event, + //Pause: + //Resume: + + } + ndk.SetMainCB(func(ctx *ndk.Context) { + ctx.Debug(true) + ctx.Run(context) + }) + for ndk.Loop() { + } + log.Println("done.") +} + +var mouseLeft = false +var mouseRight = false +var lastX, lastY int + +func event(act *ndk.Activity, e *ndk.InputEvent) { + if mot := e.Motion(); mot != nil { + lastX = int(float32(mot.GetX(0)) / WINDOWSCALE) + lastY = int(float32(mot.GetY(0)) / WINDOWSCALE) + switch mot.GetAction() { + case input.MOTION_EVENT_ACTION_UP: + mouseLeft = false + //log.Println("event:", mot) + case input.MOTION_EVENT_ACTION_DOWN: + mouseLeft = true + //log.Println("event:", mot) + case input.MOTION_EVENT_ACTION_MOVE: + + default: + //log.Println("event:", mot) + return + } + draw(act, nil) + + switch mot.GetAction() { + case input.MOTION_EVENT_ACTION_UP: + lastX, lastY = 0, 0 + draw(act, nil) + } + } +} + +var isFocus = false + +func focus(_ *ndk.Activity, f bool) { + isFocus = f +} + +const WINDOWSCALE = 1 +const title = "显示所有属性" + +var ( + width, height int + eglctx *egl.EGLContext + + deltaLast = time.Now() + im *util.Render +) + +func initEGL(win *ndk.Window) { + eglctx = egl.CreateEGLContext(&nativeInfo{win: win}) + if eglctx == nil { + return + } + width, height = win.Width(), win.Height() + log.Println("WINSIZE:", width, height) + width = int(float32(width) / WINDOWSCALE) + height = int(float32(height) / WINDOWSCALE) + + // gl init + gl.Init() + log.Println("RENDERER:", gl.GoStr(gl.GetString(gl.RENDERER))) + log.Println("VENDOR:", gl.GoStr(gl.GetString(gl.VENDOR))) + log.Println("VERSION:", gl.GoStr(gl.GetString(gl.VERSION))) + log.Println("EXTENSIONS:", gl.GoStr(gl.GetString(gl.EXTENSIONS))) + + log.Printf("%s %s", gl.GoStr(gl.GetString(gl.RENDERER)), gl.GoStr(gl.GetString(gl.VERSION))) + + // Setup Dear ImGui binding + imgui.CreateContext() + + // Setup style + imgui.StyleColorsDark() + //imgui.StyleColorsClassic() + + io := imgui.GetIO() + fonts := io.GetFonts() + + log.Println("GOOS", runtime.GOOS) + if runtime.GOOS == "android" { + fontName := "/system/fonts/DroidSansFallback.ttf" + if _, err := os.Stat(fontName); err != nil { + fontName = "/system/fonts/NotoSansCJK-Regular.ttc" + if _, err := os.Stat(fontName); err != nil { + fontName = "/system/fonts/DroidSans.ttf" + if _, err := os.Stat(fontName); err != nil { + fontName = "" + } + } + } + if fontName != "" { + _ = fonts + // 加载所有中文Glyph,但内存开销太大 + //fonts.AddFontFromFileTTF(fontName, 14.0, imgui.SwigcptrFontConfig(0), fonts.GetGlyphRangesChineseSimplifiedCommon()) + // 仅仅加载需要显示的中文Glyph + fonts.AddFontFromFileTTF(fontName, 24.0, imgui.SwigcptrFontConfig(0), util.GetFontGlyphRanges(title)) + } + } + + if runtime.GOOS == "android" { + dstr := ndk.PropGet("hw.lcd.density") + if dstr == "" { + dstr = ndk.PropGet("qemu.sf.lcd_density") + } + + log.Println(" lcd_density:", dstr) + if dstr != "" { + desity, _ := strconv.Atoi(dstr) + + if desity > 160 { + iScale := (float32)(desity / 160 / WINDOWSCALE) + io.SetFontGlobalScale(iScale) + style := imgui.GetStyle() + style.ScaleAllSizes(iScale) + + scale := imgui.NewVec2((float32)(WINDOWSCALE), (float32)(WINDOWSCALE)) + defer scale.Delete() + io.SetDisplayFramebufferScale(scale) + } + } + } + + im = util.NewRender("#version 300 es") + + // 设置完字体再调用 + im.CreateDeviceObjects() + + dsize := imgui.NewVec2(float32(width), float32(height)) + //dsize := imgui.NewVec2(float32(win.Width()/SCALE_BUFFER), float32(win.Height()/SCALE_BUFFER)) + defer dsize.Delete() + io.SetDisplaySize(dsize) + + // Setup time step + deltaLast = time.Now() + io.SetDeltaTime(0) +} + +func releaseEGL() { + if im != nil { + im.DestroyDeviceObjects() + im = nil + } + if eglctx != nil { + eglctx.Terminate() + eglctx = nil + } +} + +func create(act *ndk.Activity, win *ndk.Window) { + loadProps() +} + +func redraw(act *ndk.Activity, win *ndk.Window) { + act.Context().Call(func() { + releaseEGL() + initEGL(win) + }, false) + act.Context().Call(func() { + draw(act, nil) + }, false) + act.Context().Call(func() { + draw(act, nil) + }, false) +} + +func destroyed(act *ndk.Activity, win *ndk.Window) { + releaseEGL() +} + +func draw(act *ndk.Activity, win *ndk.Window) { + if isFocus && eglctx != nil { + io := imgui.GetIO() + + pos := imgui.NewVec2(float32(lastX), float32(lastY)) + defer pos.Delete() + io.SetMousePos(pos) + io.SetMouseDown([]bool{mouseLeft, false, mouseRight, false, false}) + + // Setup time step + now := time.Now() + io.SetDeltaTime(float32(now.Sub(deltaLast).Seconds())) + deltaLast = now + + // Margin + MARGIN := float32(width / 20) + + imgui.NewFrame() + curpos := imgui.NewVec2(MARGIN, MARGIN) + defer curpos.Delete() + imgui.SetNextWindowPos(curpos) + isize := imgui.NewVec2(float32(width)-2*MARGIN, float32(height)-2*MARGIN) + defer isize.Delete() + imgui.SetNextWindowSize(isize) + + imgui.Begin(title, (*bool)(nil), int(imgui.WindowFlags_NoSavedSettings| + //imgui.WindowFlags_NoTitleBar| + imgui.WindowFlags_NoResize| + imgui.WindowFlags_NoCollapse| + imgui.WindowFlags_NoMove)) + //imgui.Text(title) + + drawPropTree() + + imgui.End() + + imgui.Render() + + // Rendering + gl.Viewport(0, 0, int32(width), int32(height)) + gl.ClearColor(0, 0, 0, 1) + gl.Clear(gl.COLOR_BUFFER_BIT) + + //log.Println("draw:", drawData.GetCmdListsCount(), drawData.GetTotalVtxCount(), drawData.GetTotalIdxCount()) + + im.Render(imgui.GetDrawData()) + + eglctx.SwapBuffers() + } +} + +type prop struct { + k, v string +} + +var props []prop + +func loadProps() { + ndk.PropVisit(func(k, v string) { + props = append(props, prop{k: k, v: v}) + }) + sort.SliceStable(props, func(i, j int) bool { + return strings.Compare(props[i].k, props[j].k) < 0 + }) +} + +func drawPropTree() { + lastProp := []string{} + exposeProp := NewStack() + for _, prop := range props { + func(k, v string) { + curProp := strings.Split(k, ".") + defer func() { + lastProp = curProp + }() + + sameCnt := 0 + exposeDepth := exposeProp.Depth() + + for i := 0; i < len(curProp)-1 && i < exposeDepth; i++ { + if exposeProp.Poll(exposeDepth-i-1) == curProp[i] { + sameCnt++ + } else { + break + } + } + // TreePop + for i := sameCnt; i < exposeDepth; i++ { + exposeProp.Pop() + //fmt.Println(" ****Pop:", v) + imgui.TreePop() + imgui.Separator() + } + + // 最后一个域直接显示Text + if sameCnt == len(curProp)-1 { + imgui.Text(curProp[len(curProp)-1] + ": " + v) + } else if sameCnt < len(curProp)-1 { + if sameCnt >= len(lastProp) || lastProp[sameCnt] != curProp[sameCnt] { + + // 新的 Tree + for i := sameCnt; i < len(curProp)-1; i++ { + //fmt.Println(" +Node:", curProp[i]) + if imgui.TreeNode(curProp[i]) { + //fmt.Println(" ----Push:", curProp[i]) + exposeProp.Push(curProp[i]) + } else { + break + } + } + if exposeProp.Depth() == len(curProp)-1 { + imgui.Text(curProp[len(curProp)-1] + ": " + v) + } + } + } + }(prop.k, prop.v) + } + + // TreePop + depth := exposeProp.Depth() + for i := 0; i < depth; i++ { + exposeProp.Pop() + //fmt.Println(" ----Pop:", v) + imgui.TreePop() + imgui.Separator() + } +} diff --git a/examples/PropTree/nativeinfo.go b/examples/PropTree/nativeinfo.go new file mode 100644 index 0000000..6d5b25a --- /dev/null +++ b/examples/PropTree/nativeinfo.go @@ -0,0 +1,25 @@ +package main + +import ( + "unsafe" + + "github.com/xaionaro-go/ndk" +) + +type nativeInfo struct { + win *ndk.Window +} + +func (e *nativeInfo) NativeDisplay() unsafe.Pointer { + return nil +} +func (e *nativeInfo) NativeWindow() unsafe.Pointer { + return unsafe.Pointer(e.win) +} +func (e *nativeInfo) WindowSize() (w, h int) { + return e.win.Width(), e.win.Height() +} + +func (e *nativeInfo) SetBuffersGeometry(format int) int { + return e.win.SetBuffersGeometry(0, 0, format) +} diff --git a/examples/PropTree/stack.go b/examples/PropTree/stack.go new file mode 100644 index 0000000..283efc6 --- /dev/null +++ b/examples/PropTree/stack.go @@ -0,0 +1,43 @@ +package main + +import "container/list" + +type Stack struct { + l *list.List +} + +func NewStack() *Stack { + return &Stack{l: list.New()} +} + +func (s *Stack) Push(v interface{}) { + s.l.PushBack(v) +} + +func (s *Stack) Pop() interface{} { + if e := s.l.Back(); e != nil { + s.l.Remove(e) + return e.Value + } + return nil +} + +func (s *Stack) Poll(i int) interface{} { + if e := s.l.Back(); e != nil { + for ; i > 0 && e != nil; i-- { + e = e.Prev() + } + if e != nil { + return e.Value + } + } + return nil +} + +func (s *Stack) Depth() int { + return s.l.Len() +} + +func (s *Stack) Reset() { + s.l.Init() +} diff --git a/examples/Record/OpenAL32.dll b/examples/Record/OpenAL32.dll new file mode 100644 index 0000000..7ecd015 Binary files /dev/null and b/examples/Record/OpenAL32.dll differ diff --git a/examples/Record/basic/AndroidManifest.xml b/examples/Record/basic/AndroidManifest.xml new file mode 100644 index 0000000..0ebba2c --- /dev/null +++ b/examples/Record/basic/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/Record/basic/lib/armeabi/libopenal.so b/examples/Record/basic/lib/armeabi/libopenal.so new file mode 100644 index 0000000..aefa6f0 Binary files /dev/null and b/examples/Record/basic/lib/armeabi/libopenal.so differ diff --git a/examples/Record/basic/lib/x86/libopenal.so b/examples/Record/basic/lib/x86/libopenal.so new file mode 100644 index 0000000..9df0a0d Binary files /dev/null and b/examples/Record/basic/lib/x86/libopenal.so differ diff --git a/examples/Record/main_android.go b/examples/Record/main_android.go new file mode 100644 index 0000000..32b067c --- /dev/null +++ b/examples/Record/main_android.go @@ -0,0 +1,107 @@ +package main + +import ( + "log" + "strconv" + + "github.com/gooid/gl/egl" + "github.com/xaionaro-go/ndk" + "github.com/xaionaro-go/ndk/audio/al" + "github.com/xaionaro-go/ndk/input" +) + +func main() { + context := ndk.Callbacks{ + WindowDraw: drawAudio, + WindowRedrawNeeded: redraw, + WindowDestroyed: destroyed, + Event: event, + Create: func(act *ndk.Activity, _ []byte) { + create() + // 需手动 Load libopenal.so + libs := ndk.FindMatchLibrary("libopenal*.so") + if len(libs) > 0 { + al.InitPath(libs[0]) + } + }, + } + ndk.SetMainCB(func(ctx *ndk.Context) { + ctx.Debug(true) + ctx.Run(context) + }) + for ndk.Loop() { + } + log.Println("done.") +} + +func event(act *ndk.Activity, e *ndk.InputEvent) { + if mot := e.Motion(); mot != nil { + lastX = int(float32(mot.GetX(0)) / WINDOWSCALE) + lastY = int(float32(mot.GetY(0)) / WINDOWSCALE) + switch mot.GetAction() { + case input.MOTION_EVENT_ACTION_UP: + mouseLeft = false + //log.Println("event:", mot) + case input.MOTION_EVENT_ACTION_DOWN: + mouseLeft = true + //log.Println("event:", mot) + case input.MOTION_EVENT_ACTION_MOVE: + + default: + //log.Println("event:", mot) + return + } + drawAudio(act, nil) + + switch mot.GetAction() { + case input.MOTION_EVENT_ACTION_UP: + lastX, lastY = 0, 0 + drawAudio(act, nil) + } + } +} + +var curAct *ndk.Activity +var eglctx *egl.EGLContext + +func redraw(act *ndk.Activity, win *ndk.Window) { + curAct = act + act.Context().Call(func() { + releaseEGL() + + width, height = win.Width(), win.Height() + eglctx = egl.CreateEGLContext(&nativeInfo{win: win}) + if eglctx == nil { + return + } + initEGL() + }, false) +} + +func destroyed(act *ndk.Activity, win *ndk.Window) { + releaseEGL() +} + +func drawAudio(act *ndk.Activity, win *ndk.Window) { + if eglctx != nil { + draw() + } +} + +const RECORDPATH = "/sdcard/records" + +func getDensity() int { + dstr := ndk.PropGet("hw.lcd.density") + if dstr == "" { + dstr = ndk.PropGet("qemu.sf.lcd_density") + } + + log.Println(" lcd_density:", dstr) + if dstr != "" { + density, _ := strconv.Atoi(dstr) + return density + } + return density +} +func SwapBuffers() { eglctx.SwapBuffers() } +func Wake() { curAct.Context().Wake() } diff --git a/examples/Record/main_windows.go b/examples/Record/main_windows.go new file mode 100644 index 0000000..8e0630d --- /dev/null +++ b/examples/Record/main_windows.go @@ -0,0 +1,86 @@ +// + +package main + +import ( + "log" + "runtime" + + "github.com/go-gl/glfw/v3.2/glfw" +) + +func CursorPosCallback(w *glfw.Window, x float64, y float64) { + lastX = int(float32(x) / WINDOWSCALE) + lastY = int(float32(y) / WINDOWSCALE) +} + +func MouseButtonCallback(w *glfw.Window, button glfw.MouseButton, action glfw.Action, mod glfw.ModifierKey) { + if button == glfw.MouseButtonLeft { + switch action { + case glfw.Press, glfw.Repeat: + mouseLeft = true + case glfw.Release: + mouseLeft = false + } + + draw() + } +} + +func FocusCallback(w *glfw.Window, focused bool) { + if !focused { + //destroyed() + } else { + //redraw() + } +} + +func main() { + runtime.LockOSThread() + log.Printf("main ...") + + if err := glfw.Init(); err != nil { + panic(err) + } + defer glfw.Terminate() + + glfw.WindowHint(glfw.ContextVersionMajor, 2) + glfw.WindowHint(glfw.ContextVersionMinor, 0) + glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile) + // 以下是指定用 EGL 和 OpenGL ES + glfw.WindowHint(glfw.ContextCreationAPI, glfw.EGLContextAPI) + glfw.WindowHint(glfw.ClientAPI, glfw.OpenGLESAPI) + + w, err := glfw.CreateWindow(width, height, "Record", nil, nil) + if err != nil { + panic(err) + } + w.MakeContextCurrent() + curWin = w + + width, height = w.GetSize() + + create() + initEGL() + + w.SetCursorPosCallback(CursorPosCallback) + w.SetMouseButtonCallback(MouseButtonCallback) + w.SetFocusCallback(FocusCallback) + + for !w.ShouldClose() { + glfw.WaitEvents() + + draw() + } + + releaseEGL() + log.Printf("done") +} + +var curWin *glfw.Window + +const RECORDPATH = "./sdcard/records" + +func getDensity() int { return density } +func SwapBuffers() { curWin.SwapBuffers() } +func Wake() { glfw.PostEmptyEvent() } diff --git a/examples/Record/nativeinfo_android.go b/examples/Record/nativeinfo_android.go new file mode 100644 index 0000000..6d5b25a --- /dev/null +++ b/examples/Record/nativeinfo_android.go @@ -0,0 +1,25 @@ +package main + +import ( + "unsafe" + + "github.com/xaionaro-go/ndk" +) + +type nativeInfo struct { + win *ndk.Window +} + +func (e *nativeInfo) NativeDisplay() unsafe.Pointer { + return nil +} +func (e *nativeInfo) NativeWindow() unsafe.Pointer { + return unsafe.Pointer(e.win) +} +func (e *nativeInfo) WindowSize() (w, h int) { + return e.win.Width(), e.win.Height() +} + +func (e *nativeInfo) SetBuffersGeometry(format int) int { + return e.win.SetBuffersGeometry(0, 0, format) +} diff --git a/examples/Record/record.go b/examples/Record/record.go new file mode 100644 index 0000000..d85edc4 --- /dev/null +++ b/examples/Record/record.go @@ -0,0 +1,382 @@ +package main + +import ( + "errors" + "fmt" + "io" + "log" + "os" + "path/filepath" + "runtime" + "strings" + "sync" + "time" + + gl "github.com/gooid/gl/es2" + "github.com/gooid/imgui" + "github.com/gooid/imgui/util" + "github.com/xaionaro-go/ndk/audio" + "github.com/xaionaro-go/ndk/audio/al" + "github.com/xaionaro-go/ndk/audio/alc" +) + +var mouseLeft = false +var mouseRight = false +var lastX, lastY int + +// + +const WINDOWSCALE = 1 +const title = "Record " + +var ( + width = (1080 / 8 * 3) + height = (1920 / 8 * 3) + density = (480 / 8 * 3) + + im *util.Render +) + +func create() bool { + // Create window with graphics context + log.Println("Create...", width, height) + + // gl init + gl.Init() + + // Setup Dear ImGui binding + imgui.CreateContext() + + // Setup style + //imgui.StyleColorsClassic() + imgui.StyleColorsDark() + //imgui.StyleColorsLight() + + io := imgui.GetIO() + fonts := io.GetFonts() + + log.Println("GOOS", runtime.GOOS) + if runtime.GOOS == "android" { + fontName := "/system/fonts/DroidSansFallback.ttf" + if _, err := os.Stat(fontName); err != nil { + fontName = "/system/fonts/NotoSansCJK-Regular.ttc" + if _, err := os.Stat(fontName); err != nil { + fontName = "/system/fonts/DroidSans.ttf" + if _, err := os.Stat(fontName); err != nil { + fontName = "" + } + } + } + if fontName != "" { + _ = fonts + // 加载所有中文Glyph,但内存开销太大 + //fonts.AddFontFromFileTTF(fontName, 24.0, imgui.SwigcptrFontConfig(0), fonts.GetGlyphRangesChineseSimplifiedCommon()) + // 仅仅加载需要显示的中文Glyph + fonts.AddFontFromFileTTF(fontName, 24.0, imgui.SwigcptrFontConfig(0), util.GetFontGlyphRanges(title)) + } + + density = getDensity() + } + + // 通过调整 Style 中元素大小,来控制显示大小,但同时要调整字体大小 + if density > 160 { + iScale := float32(density) / 160 / float32(WINDOWSCALE) + io.SetFontGlobalScale(iScale) + style := imgui.GetStyle() + style.ScaleAllSizes(iScale) + } + + // 通过缩放 DisplayFramebuffer 来控制显示大小 + scale := imgui.NewVec2((float32)(WINDOWSCALE), (float32)(WINDOWSCALE)) + defer scale.Delete() + io.SetDisplayFramebufferScale(scale) + + io.SetConfigFlags(io.GetConfigFlags() | + //int(imgui.ConfigFlags_IsTouchScreen) | + int(imgui.ConfigFlags_NoMouseCursorChange)) + + im = util.NewRender("#version 100") + + if _, err := os.Stat(RECORDPATH); os.IsNotExist(err) { + os.MkdirAll(RECORDPATH, 0666) + } + + return true +} + +func initEGL() { + log.Println("WINSIZE:", width, height) + width = int(float32(width) / WINDOWSCALE) + height = int(float32(height) / WINDOWSCALE) + + if gl.GoStr(gl.GetString(gl.RENDERER)) == "" { + panic(gl.GetError()) + } + log.Println("RENDERER:", gl.GoStr(gl.GetString(gl.RENDERER))) + log.Println("VENDOR:", gl.GoStr(gl.GetString(gl.VENDOR))) + log.Println("VERSION:", gl.GoStr(gl.GetString(gl.VERSION))) + log.Println("EXTENSIONS:", gl.GoStr(gl.GetString(gl.EXTENSIONS))) + + log.Printf("%s %s", gl.GoStr(gl.GetString(gl.RENDERER)), gl.GoStr(gl.GetString(gl.VERSION))) + + // 设置完字体再调用 + im.CreateDeviceObjects() + + io := imgui.GetIO() + + dsize := imgui.NewVec2(float32(width), float32(height)) + defer dsize.Delete() + io.SetDisplaySize(dsize) + + // Setup time step + io.SetDeltaTime(float32(time.Now().UnixNano() / int64(time.Millisecond/time.Nanosecond))) +} + +func releaseEGL() { + if im != nil { + im.DestroyDeviceObjects() + } +} + +func draw() { + io := imgui.GetIO() + + pos := imgui.NewVec2(float32(lastX), float32(lastY)) + defer pos.Delete() + io.SetMousePos(pos) + io.SetMouseDown([]bool{mouseLeft, false, mouseRight, false, false}) + + // Setup time step + io.SetDeltaTime(float32(time.Now().UnixNano() / int64(time.Millisecond/time.Nanosecond))) + + // Margin + MARGIN := width / 20 + + imgui.NewFrame() + curpos := imgui.NewVec2(MARGIN, MARGIN) + defer curpos.Delete() + imgui.SetNextWindowPos(curpos) + isize := imgui.NewVec2(width-2*MARGIN, height-2*MARGIN) + defer isize.Delete() + imgui.SetNextWindowSize(isize) + + imgui.Begin(title, (*bool)(nil), imgui.WindowFlags_NoSavedSettings| + //imgui.WindowFlags_NoTitleBar| + imgui.WindowFlags_NoResize| + imgui.WindowFlags_NoCollapse| + imgui.WindowFlags_NoMove) + + if stopFunc == nil { + if imgui.Button("Record") { + fname := fmt.Sprint("record_", time.Now().UnixNano(), ".wav") + fw, err := os.Create(filepath.Join(RECORDPATH, fname)) + if err == nil { + fn, err := Record(fw) + if err == nil { + stopFunc = func() { + fn() + fw.Close() + } + } else { + log.Println(" CaptureOpen:", err) + fw.Close() + os.Remove(filepath.Join(RECORDPATH, fname)) + } + } else { + log.Println(" \t", err) + } + } + } else { + if imgui.Button("Stop") { + stopFunc() + stopFunc = nil + } + } + + if stopFunc == nil { + if imgui.CollapsingHeader("record list", imgui.TreeNodeFlags_DefaultOpen) { + RecordsList(RECORDPATH) + } + } + + imgui.End() + + imgui.Render() + + // Rendering + gl.Viewport(0, 0, int32(width), int32(height)) + gl.ClearColor(0, 0, 0, 1) + gl.Clear(gl.COLOR_BUFFER_BIT) + + im.Render(imgui.GetDrawData()) + + SwapBuffers() +} + +// 同时表示在 record +var stopFunc func() + +func Play(fname string, stopped func()) (*audio.AudioInfo, func(), error) { + f, err := os.Open(fname) + if err != nil { + return nil, nil, err + } + + af, err := audio.NewAudio(f) + if err != nil { + return nil, nil, err + } + + info := af.Info() + play, err := audio.NewPlayer(af, + audio.Format(info.Format), + int64(info.SampleRate)) + if err != nil { + log.Println(" NewPlayer:", err) + return nil, nil, err + } + err = play.Play() + if err != nil { + log.Println(" Play:", err) + return nil, nil, err + } + + go func() { + time.Sleep(time.Millisecond * 300) + for play.State() != audio.Stopped { + time.Sleep(time.Millisecond * 300) + } + log.Println(" Stop:...") + play.Destroy() + play = nil + af.Close() + f.Close() + delete(recordMap, fname) + stopped() + }() + + return &info, func() { + if play != nil { + play.Stop() + } + }, nil +} + +func Record(w io.WriteSeeker) (func(), error) { + stop := make(chan bool) + wait := sync.WaitGroup{} + + // SAMPLERATE 和 SAMPLESIZE 分别是 44100、2048 这两个值等比缩小, + // 调用 CaptureOpen 就能成功 + const DENOMINATOR = 1 + const SAMPLERATE = 44100 / DENOMINATOR + const SAMPLESIZE = 2048 / DENOMINATOR + + const FORMAT = al.FormatStereo16 + const TIMES = 20 + + bytes := 1 + switch FORMAT { + case al.FormatMono8: + bytes = 1 + case al.FormatMono16: + bytes = 2 + case al.FormatStereo8: + bytes = 2 + case al.FormatStereo16: + bytes = 4 + } + + // 2倍理论大小的BUFFER,以避免频繁分配 + bs := make([]byte, 2*SAMPLERATE*bytes/TIMES) + + audio.WavWriteHeader(w, SAMPLERATE, FORMAT) + + d := alc.CaptureOpen("", SAMPLERATE, FORMAT, SAMPLESIZE) + if d != nil { + wait.Add(1) + go func() { + defer wait.Done() + + d.Start() + log.Println("ALC: Start", alc.Error(d.Error())) + + sample := int32(0) + done := false + for !done { + select { + case <-stop: + done = true + case <-time.After(time.Second / TIMES): + } + + // 得到采样数 + d.GetIntegerv(alc.CaptureSamples, 4, &sample) + log.Println(" GetIntegerv:", sample) + + // 数据大小 = 采样数 * 每个采样数大小 + size := sample * int32(bytes) + if int(size) > len(bs) { + bs = make([]byte, size) + } + + d.Samples(bs, int64(sample)) + w.Write(bs[:size]) + } + log.Println(" CaptureStop") + d.Stop() + d.Close() + audio.WavClose(w) + close(stop) + }() + + // 返回停止函数 + return func() { + stop <- true + wait.Wait() + }, nil + } else { + err := errors.New(alc.Error(al.Error())) + return nil, err + } +} + +type recordStat struct { + stop func() + info string +} + +var recordMap = map[string]recordStat{} + +func RecordsList(dir string) { + fs, _ := filepath.Glob(filepath.Join(dir, "*")) + for _, fname := range fs { + var i64 int64 + name := filepath.Base(fname) + fmt.Sscanf(name, "record_%d.wav", &i64) + t := time.Duration(i64) + ti := time.Unix(int64(t/time.Nanosecond/time.Second), int64((t/time.Nanosecond)%time.Second)) + + if state, ok := recordMap[fname]; ok { + if imgui.Button(ti.Format("STOP 2006-01-02 15:04:05")) { + state.stop() + delete(recordMap, fname) + } + size := imgui.NewVec2(-1, -1) + defer size.Delete() + imgui.TextWrapped(state.info) + } else { + if imgui.Button(ti.Format("PLAY 2006-01-02 15:04:05")) { + info, stop, err := Play(fname, func() { Wake() }) + if err != nil { + log.Println("ERROR:" + err.Error()) + } else { + log.Println("Play :", fname) + text := fmt.Sprintf("%+v", info) + text = strings.Replace(text, " ", "\n", -1) + recordMap[fname] = recordStat{stop: stop, info: text} + } + } + } + } +} diff --git a/examples/SensorDemo/basic/AndroidManifest.xml b/examples/SensorDemo/basic/AndroidManifest.xml new file mode 100644 index 0000000..07be9b5 --- /dev/null +++ b/examples/SensorDemo/basic/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/SensorDemo/main.go b/examples/SensorDemo/main.go new file mode 100644 index 0000000..01f8d23 --- /dev/null +++ b/examples/SensorDemo/main.go @@ -0,0 +1,316 @@ +package main + +import ( + "fmt" + "log" + "os" + "runtime" + "sort" + "strconv" + "time" + + "github.com/gooid/gl/egl" + gl "github.com/gooid/gl/es2" + "github.com/gooid/imgui" + "github.com/gooid/imgui/util" + "github.com/xaionaro-go/ndk" + "github.com/xaionaro-go/ndk/input" + "github.com/xaionaro-go/ndk/sensor" +) + +func main() { + context := ndk.Callbacks{ + WindowDraw: draw, + WindowRedrawNeeded: redraw, + WindowDestroyed: destroyed, + Event: event, + Sensor: sensorEvent, + Create: create, + } + + //log.Println(ss.SENSOR_TYPE_ACCELEROMETER) + ndk.SetMainCB(func(ctx *ndk.Context) { + ctx.Debug(true) + ctx.Run(context) + }) + for ndk.Loop() { + } + log.Println("done.") +} + +var mouseLeft = false +var mouseRight = false +var lastX, lastY int + +func event(act *ndk.Activity, e *ndk.InputEvent) { + if mot := e.Motion(); mot != nil { + lastX = int(float32(mot.GetX(0)) / WINDOWSCALE) + lastY = int(float32(mot.GetY(0)) / WINDOWSCALE) + switch mot.GetAction() { + case input.MOTION_EVENT_ACTION_UP: + mouseLeft = false + //log.Println("event:", mot) + case input.MOTION_EVENT_ACTION_DOWN: + mouseLeft = true + //log.Println("event:", mot) + case input.MOTION_EVENT_ACTION_MOVE: + + default: + //log.Println("event:", mot) + return + } + draw(act, nil) + + switch mot.GetAction() { + case input.MOTION_EVENT_ACTION_UP: + lastX, lastY = 0, 0 + draw(act, nil) + } + } +} + +const WINDOWSCALE = 1 +const title = "Sensor " + +var ( + width, height int + eglctx *egl.EGLContext + + im *util.Render + sensorInfos []sensorInfo + sensorRate int = 10 +) + +func initEGL(act *ndk.Activity, win *ndk.Window) { + width, height = win.Width(), win.Height() + log.Println("WINSIZE:", width, height) + width = int(float32(width) / WINDOWSCALE) + height = int(float32(height) / WINDOWSCALE) + + eglctx = egl.CreateEGLContext(&nativeInfo{win: win}) + if eglctx == nil { + return + } + + log.Println("RENDERER:", gl.GoStr(gl.GetString(gl.RENDERER))) + log.Println("VENDOR:", gl.GoStr(gl.GetString(gl.VENDOR))) + log.Println("VERSION:", gl.GoStr(gl.GetString(gl.VERSION))) + log.Println("EXTENSIONS:", gl.GoStr(gl.GetString(gl.EXTENSIONS))) + + log.Printf("%s %s", gl.GoStr(gl.GetString(gl.RENDERER)), gl.GoStr(gl.GetString(gl.VERSION))) + + // 设置完字体再调用 + im.CreateDeviceObjects() + + io := imgui.GetIO() + + dsize := imgui.NewVec2(float32(width), float32(height)) + defer dsize.Delete() + io.SetDisplaySize(dsize) + + // Setup time step + io.SetDeltaTime(float32(time.Now().UnixNano() / int64(time.Millisecond/time.Nanosecond))) +} + +func releaseEGL() { + if im != nil { + im.DestroyDeviceObjects() + } + if eglctx != nil { + eglctx.Terminate() + eglctx = nil + } +} + +func create(act *ndk.Activity, _ []byte) { + // gl init + gl.Init() + + // Setup Dear ImGui binding + imgui.CreateContext() + + // Setup style + imgui.StyleColorsDark() + //imgui.StyleColorsClassic() + + io := imgui.GetIO() + fonts := io.GetFonts() + + log.Println("GOOS", runtime.GOOS) + if runtime.GOOS == "android" { + fontName := "/system/fonts/DroidSansFallback.ttf" + if _, err := os.Stat(fontName); err != nil { + fontName = "/system/fonts/NotoSansCJK-Regular.ttc" + if _, err := os.Stat(fontName); err != nil { + fontName = "/system/fonts/DroidSans.ttf" + if _, err := os.Stat(fontName); err != nil { + fontName = "" + } + } + } + if fontName != "" { + _ = fonts + // 加载所有中文Glyph,但内存开销太大 + //fonts.AddFontFromFileTTF(fontName, 24.0, imgui.SwigcptrFontConfig(0), fonts.GetGlyphRangesChineseSimplifiedCommon()) + // 仅仅加载需要显示的中文Glyph + fonts.AddFontFromFileTTF(fontName, 24.0, imgui.SwigcptrFontConfig(0), util.GetFontGlyphRanges(title)) + } + } + + if runtime.GOOS == "android" { + dstr := ndk.PropGet("hw.lcd.density") + if dstr == "" { + dstr = ndk.PropGet("qemu.sf.lcd_density") + } + + log.Println(" lcd_density:", dstr) + if dstr != "" { + desity, _ := strconv.Atoi(dstr) + + if desity > 160 { + iScale := (float32)(desity / 160 / WINDOWSCALE) + io.SetFontGlobalScale(iScale) + style := imgui.GetStyle() + style.ScaleAllSizes(iScale) + + scale := imgui.NewVec2((float32)(WINDOWSCALE), (float32)(WINDOWSCALE)) + defer scale.Delete() + io.SetDisplayFramebufferScale(scale) + } + } + } + io.SetConfigFlags(io.GetConfigFlags() | int(imgui.ConfigFlags_IsTouchScreen)) + + // render 只需初始化一次 + im = util.NewRender("#version 100") + + sensorInfos = SensorInfo(act) + // 排序,在显示的时候保证顺序一致 + sort.SliceStable(sensorInfos, func(i, j int) bool { + if sensorInfos[i].Type == sensorInfos[j].Type { + return sensorInfos[i].Name < sensorInfos[j].Name + } + return sensorInfos[i].Type < sensorInfos[j].Type + }) +} + +func redraw(act *ndk.Activity, win *ndk.Window) { + act.Context().Call(func() { + releaseEGL() + initEGL(act, win) + }, false) + act.Context().Call(func() { + draw(act, nil) + }, false) + act.Context().Call(func() { + draw(act, nil) + }, false) +} + +func destroyed(act *ndk.Activity, win *ndk.Window) { + releaseEGL() +} + +func draw(act *ndk.Activity, _ *ndk.Window) { + if eglctx != nil { + io := imgui.GetIO() + + pos := imgui.NewVec2(float32(lastX), float32(lastY)) + defer pos.Delete() + io.SetMousePos(pos) + io.SetMouseDown([]bool{mouseLeft, false, mouseRight, false, false}) + + // Setup time step + io.SetDeltaTime(float32(time.Now().UnixNano() / int64(time.Millisecond/time.Nanosecond))) + + // Margin + MARGIN := float32(width / 20) + + imgui.NewFrame() + curpos := imgui.NewVec2(MARGIN, MARGIN) + defer curpos.Delete() + imgui.SetNextWindowPos(curpos) + isize := imgui.NewVec2(float32(width)-2*MARGIN, float32(height)-2*MARGIN) + defer isize.Delete() + imgui.SetNextWindowSize(isize) + + imgui.Begin(title, (*bool)(nil), int(imgui.WindowFlags_NoSavedSettings| + //imgui.WindowFlags_NoTitleBar| + imgui.WindowFlags_NoResize| + imgui.WindowFlags_NoCollapse| + imgui.WindowFlags_NoMove)) + + if imgui.CollapsingHeader("sensor list", int(imgui.TreeNodeFlags_DefaultOpen)) { + lastType := sensor.TYPE_INVALID + for i, info := range sensorInfos { + if info.Type != lastType { + if imgui.TreeNodeEx(info.Type.String(), int(imgui.TreeNodeFlags_DefaultOpen)) { + for j := i; j < len(sensorInfos) && sensorInfos[j].Type == info.Type; j++ { + imgui.TextWrapped(fmt.Sprintf("%+v", info)) + } + imgui.TreePop() + imgui.Separator() + } + lastType = info.Type + } + } + } + + rateChange := false + if imgui.CollapsingHeader("sensor events", int(imgui.TreeNodeFlags_DefaultOpen)) { + if imgui.SliderInt("(ms) rate", &sensorRate, 0, 3000) { + rateChange = true + log.Println(" sensorRate =", sensorRate) + } + lastType := sensor.TYPE_INVALID + for i, info := range sensorInfos { + if info.Type != lastType { + if imgui.TreeNodeEx(info.Type.String(), int(imgui.TreeNodeFlags_DefaultOpen)) { + for j := i; j < len(sensorInfos) && info.Type == sensorInfos[j].Type; j++ { + EnableSensor(act, sensorInfos[j].sensor, time.Duration(sensorRate)*time.Millisecond) + if rateChange { + SetEventRate(act, sensorInfos[j].sensor, time.Duration(sensorRate)*time.Millisecond) + } + } + + is := []int{} + for k, _ := range eventMap[info.Type] { + is = append(is, k) + } + sort.Ints(is) + tms, _ := eventMap[info.Type] + for _, v := range is { + imgui.TextWrapped(eventString(tms[v])) + } + imgui.TreePop() + imgui.Separator() + } else { + for j := i; j < len(sensorInfos) && info.Type == sensorInfos[j].Type; j++ { + DisableSensor(act, sensorInfos[j].sensor) + } + } + lastType = info.Type + } + } + } else { + for _, info := range sensorInfos { + DisableSensor(act, info.sensor) + } + } + + imgui.End() + + imgui.Render() + + // Rendering + gl.Viewport(0, 0, int32(width), int32(height)) + gl.ClearColor(0, 0, 0, 1) + gl.Clear(gl.COLOR_BUFFER_BIT) + + //log.Println("draw:", drawData.GetCmdListsCount(), drawData.GetTotalVtxCount(), drawData.GetTotalIdxCount()) + + im.Render(imgui.GetDrawData()) + + eglctx.SwapBuffers() + } +} diff --git a/examples/SensorDemo/nativeinfo.go b/examples/SensorDemo/nativeinfo.go new file mode 100644 index 0000000..6d5b25a --- /dev/null +++ b/examples/SensorDemo/nativeinfo.go @@ -0,0 +1,25 @@ +package main + +import ( + "unsafe" + + "github.com/xaionaro-go/ndk" +) + +type nativeInfo struct { + win *ndk.Window +} + +func (e *nativeInfo) NativeDisplay() unsafe.Pointer { + return nil +} +func (e *nativeInfo) NativeWindow() unsafe.Pointer { + return unsafe.Pointer(e.win) +} +func (e *nativeInfo) WindowSize() (w, h int) { + return e.win.Width(), e.win.Height() +} + +func (e *nativeInfo) SetBuffersGeometry(format int) int { + return e.win.SetBuffersGeometry(0, 0, format) +} diff --git a/examples/SensorDemo/sensor.go b/examples/SensorDemo/sensor.go new file mode 100644 index 0000000..3b7bb35 --- /dev/null +++ b/examples/SensorDemo/sensor.go @@ -0,0 +1,163 @@ +package main + +import ( + "fmt" + "log" + "math" + "reflect" + "time" + + "github.com/xaionaro-go/ndk" + "github.com/xaionaro-go/ndk/sensor" +) + +type sensorInfo struct { + Type sensor.TYPE + Name, Vender string + Resolution float32 + MinDelay time.Duration + sensor *sensor.Sensor +} + +func SensorInfo(act *ndk.Activity) []sensorInfo { + sensorManager := sensor.ManagerInstance() + sensorList := sensorManager.GetSensorList() + log.Println("SensorInfo:", len(sensorList)) + sis := make([]sensorInfo, len(sensorList)) + for i, sensor := range sensorList { + sis[i].Name = sensor.GetName() + sis[i].Vender = sensor.GetVendor() + sis[i].Type = sensor.GetType() + sis[i].Resolution = sensor.GetResolution() + sis[i].MinDelay = sensor.GetMinDelay() + sis[i].sensor = sensor + } + // 使 sensor 有效 + //act.Context().EnableSensor(sensorManager.GetDefaultSensor(sensor.TYPE_ACCELEROMETER)) + //act.Context().EnableSensor(sensorManager.GetDefaultSensor(sensor.TYPE_GYROSCOPE)) + //act.Context().EnableSensor(sensorManager.GetDefaultSensor(sensor.TYPE_GRAVITY)) + return sis +} + +var enableSensors = map[*sensor.Sensor]bool{} + +func EnableSensor(act *ndk.Activity, s *sensor.Sensor, t time.Duration) { + if b, _ := enableSensors[s]; !b { + s.Enable(act) + s.SetEventRate(act, t) + enableSensors[s] = true + } +} + +func DisableSensor(act *ndk.Activity, s *sensor.Sensor) { + if b, _ := enableSensors[s]; b { + s.Disable(act) + enableSensors[s] = false + } +} + +func SetEventRate(act *ndk.Activity, s *sensor.Sensor, t time.Duration) { + if b, _ := enableSensors[s]; b { + s.SetEventRate(act, t) + } +} + +const threshold = float64(sensor.STANDARD_GRAVITY / 3) + +var lastVec sensor.Vector +var vertical = float32(math.Sqrt(sensor.STANDARD_GRAVITY * sensor.STANDARD_GRAVITY / 2)) +var gRotation = ROTATION0 + +var eventMap = map[sensor.TYPE]map[int]sensor.Event{} + +func sensorEvent(act *ndk.Activity, events []sensor.Event) { + n := len(events) - 1 + log.Println("sensor:", events[n].GetType(), events[n].GetTimestamp()) + var vec sensor.Vector + for _, event := range events { + if _, ok := eventMap[event.GetType()]; !ok { + eventMap[event.GetType()] = map[int]sensor.Event{} + } + eventMap[event.GetType()][event.GetSensor()] = event + + switch event.GetType() { + case sensor.TYPE_ACCELEROMETER: + event.GetData(&vec) + if math.Abs(float64(lastVec.X-vec.X)) > threshold || + math.Abs(float64(lastVec.Y-vec.Y)) > threshold || + math.Abs(float64(lastVec.Z-vec.Z)) > threshold { + + lastVec = vec + + if isVertical(&vec) { + if math.Abs(float64(vec.X)) > math.Abs(float64(vec.Y)) { + if vec.X > 0 { + gRotation = ROTATION270 + } else { + gRotation = ROTATION90 + } + } else { + if vec.Y > 0 { + gRotation = ROTATION0 + } else { + gRotation = ROTATION180 + } + } + } + + log.Printf("Rotation: %v %+v\n", gRotation, vec) + } + } + } +} + +func isVertical(vec *sensor.Vector) bool { + if vec.Z >= -vertical && + vec.Z <= vertical { + return true + } + return false +} + +type Rotation int + +const ( + ROTATION0 Rotation = iota + ROTATION90 + ROTATION180 + ROTATION270 +) + +func (r Rotation) String() string { + return []string{"0°", "90°", "180°", "270°"}[int(r)] +} + +// TYPE 和 值的对应关系 +// 参考 https://developer.android.com/guide/topics/sensors/sensors_overview +func eventString(event sensor.Event) string { + var value interface{} + switch event.GetType() { + case sensor.TYPE_ACCELEROMETER, sensor.TYPE_GRAVITY, sensor.TYPE_GYROSCOPE, + sensor.TYPE_LINEAR_ACCELERATION, sensor.TYPE_MAGNETIC_FIELD: + var v sensor.Vector + value = &v + + case sensor.TYPE_ORIENTATION: + var v sensor.MagneticVector + value = &v + + case sensor.TYPE_AMBIENT_TEMPERATURE, sensor.TYPE_LIGHT, sensor.TYPE_PRESSURE: + var v float32 + value = &v + + case sensor.TYPE_STEP_COUNTER: + var v int64 + value = &v + + default: + var v [4]float32 + value = v[:] + } + event.GetData(value) + return fmt.Sprintf("%v: %v\n t=%v v=%+v", event.GetType(), event.GetSensor(), event.GetTimestamp(), reflect.Indirect(reflect.ValueOf(value))) +} diff --git a/examples/UIDemo/basic/AndroidManifest.xml b/examples/UIDemo/basic/AndroidManifest.xml new file mode 100644 index 0000000..0c3e394 --- /dev/null +++ b/examples/UIDemo/basic/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/UIDemo/main.go b/examples/UIDemo/main.go new file mode 100644 index 0000000..cd7983c --- /dev/null +++ b/examples/UIDemo/main.go @@ -0,0 +1,168 @@ +package main + +import ( + "log" + + "github.com/gooid/gl/egl" + gl "github.com/gooid/gl/es2" + "github.com/xaionaro-go/ndk" + "github.com/xaionaro-go/ndk/input" +) + +func main() { + context := ndk.Callbacks{ + FocusChanged: focus, + WindowDraw: draw, + WindowRedrawNeeded: redraw, + WindowDestroyed: destroyed, + Event: event, + } + ndk.SetMainCB(func(ctx *ndk.Context) { + ctx.Run(context) + }) + for ndk.Loop() { + } + log.Println("done.") +} + +func event(act *ndk.Activity, e *ndk.InputEvent) { + if mot := e.Motion(); mot != nil { + if mot.GetAction() == input.MOTION_EVENT_ACTION_UP { + log.Println("event:", mot) + if index == 0 { + index = 1 + } else { + index = 0 + } + vVertices = verticess[index] + draw(act, nil) + } + } +} + +var isFocus = false + +func focus(_ *ndk.Activity, f bool) { + isFocus = f +} + +var ( + width, height int + program *Shader + eglctx *egl.EGLContext + + index int + vVertices = verticess[index] + + verticess = [2][]float32{ + {0.0, 0.5, 0.0, + -0.5, -0.5, 0.0, + 0.5, -0.5, 0.0}, + {0.0, 0.5, 0.0, + -1.0, -0.5, 0.0, + 1.0, -0.5, 0.0}} +) + +func initEGL(win *ndk.Window) { + eglctx = egl.CreateEGLContext(&nativeInfo{win: win}) + if eglctx == nil { + return + } + + width, height = win.Width(), win.Height() + log.Println("WINSIZE:", width, height) + + gl.Init() + log.Println("RENDERER:", gl.GoStr(gl.GetString(gl.RENDERER))) + log.Println("VENDOR:", gl.GoStr(gl.GetString(gl.VENDOR))) + log.Println("VERSION:", gl.GoStr(gl.GetString(gl.VERSION))) + log.Println("EXTENSIONS:", gl.GoStr(gl.GetString(gl.EXTENSIONS))) + + log.Printf("%s %s", gl.GoStr(gl.GetString(gl.RENDERER)), gl.GoStr(gl.GetString(gl.VERSION))) + + var err error + // Create the program object + program = CreateProgram(vShaderStr, fShaderStr) + if program == nil || err != nil { + log.Println("Create:", err) + } + gl.Viewport(0, 0, int32(width), int32(height)) + gl.ClearColor(1.0, 1.0, 1.0, 0.0) +} + +func releaseEGL() { + if program != nil { + program.Delete() + } + if eglctx != nil { + eglctx.Terminate() + eglctx = nil + } +} + +func redraw(act *ndk.Activity, win *ndk.Window) { + releaseEGL() + initEGL(win) +} + +func destroyed(act *ndk.Activity, win *ndk.Window) { + releaseEGL() +} + +func draw(act *ndk.Activity, win *ndk.Window) { + if isFocus && eglctx != nil { + gl.Viewport(0, 0, int32(width), int32(height)) + gl.ClearColor(1.0, 1.0, 1.0, 0.0) + gl.Clear(gl.COLOR_BUFFER_BIT) + + if program != nil { + program.Use() + } + + // Load the vertex data + a := program.GetAttribLocation("a_position") + + gl.EnableVertexAttribArray(uint32(a)) + gl.VertexAttribPointer(uint32(a), 3, gl.FLOAT, false, 0, gl.Ptr(vVertices)) + + gl.DrawArrays(gl.TRIANGLES, 0, 3) + + eglctx.SwapBuffers() + } +} + +const vShaderStr = ` +attribute vec4 a_position; +void main() +{ + gl_Position = a_position; +} +` + +const fShaderStr = ` +precision mediump float; +void main() +{ + gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); +} +` + +type Shader struct { + *gl.Shader +} + +func CreateProgram(vertexShader, fragmentShader string) *Shader { + s := &Shader{} + + s.Shader = gl.NewShader([]string{vertexShader + "\x00"}, + []string{fragmentShader + "\x00"}) + return s +} + +func (s *Shader) Use() { + gl.UseProgram(s.Handle()) +} + +func (s *Shader) GetAttribLocation(n string) int32 { + return gl.GetAttribLocation(s.Handle(), gl.Str(n+"\x00")) +} diff --git a/examples/UIDemo/nativeinfo.go b/examples/UIDemo/nativeinfo.go new file mode 100644 index 0000000..6d5b25a --- /dev/null +++ b/examples/UIDemo/nativeinfo.go @@ -0,0 +1,25 @@ +package main + +import ( + "unsafe" + + "github.com/xaionaro-go/ndk" +) + +type nativeInfo struct { + win *ndk.Window +} + +func (e *nativeInfo) NativeDisplay() unsafe.Pointer { + return nil +} +func (e *nativeInfo) NativeWindow() unsafe.Pointer { + return unsafe.Pointer(e.win) +} +func (e *nativeInfo) WindowSize() (w, h int) { + return e.win.Width(), e.win.Height() +} + +func (e *nativeInfo) SetBuffersGeometry(format int) int { + return e.win.SetBuffersGeometry(0, 0, format) +} diff --git a/examples/WallPaperTwinkle/basic/AndroidManifest.xml b/examples/WallPaperTwinkle/basic/AndroidManifest.xml new file mode 100644 index 0000000..e8e7bb8 --- /dev/null +++ b/examples/WallPaperTwinkle/basic/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/WallPaperTwinkle/main.go b/examples/WallPaperTwinkle/main.go new file mode 100644 index 0000000..b6d9bd7 --- /dev/null +++ b/examples/WallPaperTwinkle/main.go @@ -0,0 +1,37 @@ +package main + +import ( + "log" + + "github.com/xaionaro-go/ndk" + "github.com/xaionaro-go/ndk/input" +) + +func main() { + context := ndk.Callbacks{ + Event: event, + } + ndk.SetMainCB(func(ctx *ndk.Context) { + ctx.Run(context) + }) + for ndk.Loop() { + } + log.Println("done.") +} + +var bWallpaper = false + +func event(act *ndk.Activity, e *ndk.InputEvent) { + if mot := e.Motion(); mot != nil { + if mot.GetAction() == input.MOTION_EVENT_ACTION_UP { + log.Println("event:", mot) + + bWallpaper = !bWallpaper + if bWallpaper { + act.SetWindowFlags(ndk.FLAG_SHOW_WALLPAPER, 0) + } else { + act.SetWindowFlags(0, ndk.FLAG_SHOW_WALLPAPER) + } + } + } +} diff --git a/examples/WallPaperTwinkle/out/wallpapertwinkle.apk b/examples/WallPaperTwinkle/out/wallpapertwinkle.apk new file mode 100644 index 0000000..17efd4e Binary files /dev/null and b/examples/WallPaperTwinkle/out/wallpapertwinkle.apk differ diff --git a/examples/activity/overview/main.go b/examples/activity/overview/main.go deleted file mode 100644 index b65d1cf..0000000 --- a/examples/activity/overview/main.go +++ /dev/null @@ -1,160 +0,0 @@ -// NativeActivity lifecycle overview. -// -// Documents the Android NativeActivity lifecycle and the methods provided by -// the ndk/activity package. NativeActivity is the entry point for purely -// native Android applications: the system creates an ANativeActivity handle -// and delivers it to the native code via the ANativeActivity_onCreate -// callback. All Activity methods require this system-provided handle. -// -// Because the Activity handle is only available inside a running Android -// NativeActivity process, this example documents the pattern and prints the -// available constants rather than calling the methods directly. -// -// Lifecycle summary (system-driven): -// -// ANativeActivity_onCreate <- system creates the activity -// onStart -// onResume -// onNativeWindowCreated <- ANativeWindow becomes available -// onInputQueueCreated <- AInputQueue becomes available -// ... application runs ... -// onInputQueueDestroyed <- AInputQueue revoked -// onNativeWindowDestroyed <- ANativeWindow revoked -// onPause -// onStop -// onDestroy <- activity is torn down -// -// The Activity handle is valid from onCreate through onDestroy. The -// ANativeWindow and AInputQueue handles are valid only between their -// respective created/destroyed callback pairs. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/activity" -) - -func main() { - // --------------------------------------------------------------- - // Activity handle - // - // The Activity struct wraps the NDK ANativeActivity pointer. It is - // NOT created from Go code. The Android framework passes the - // ANativeActivity pointer to the native entry point: - // - // void ANativeActivity_onCreate( - // ANativeActivity* nativeActivity, - // void* savedState, - // size_t savedStateSize); - // - // The ndk runtime wraps this pointer into an Activity value and - // delivers it through the lifecycle callbacks. - // --------------------------------------------------------------- - - fmt.Println("=== ndk/activity API overview ===") - fmt.Println() - - // --------------------------------------------------------------- - // Activity methods - // --------------------------------------------------------------- - - fmt.Println("Activity methods:") - fmt.Println() - fmt.Println(" Finish()") - fmt.Println(" Request that the activity be finished and closed.") - fmt.Println(" Equivalent to calling Activity.finish() from Java.") - fmt.Println() - fmt.Println(" ShowSoftInput(flags uint32)") - fmt.Println(" Show the soft (on-screen) keyboard.") - fmt.Println(" Pass ShowSoftInputFlags values to control behavior.") - fmt.Println() - fmt.Println(" HideSoftInput(flags uint32)") - fmt.Println(" Hide the soft keyboard.") - fmt.Println(" Pass HideSoftInputFlags values to control behavior.") - fmt.Println() - fmt.Println(" SetWindowFlags(addFlags, removeFlags uint32)") - fmt.Println(" Add and/or remove window flags (e.g. fullscreen,") - fmt.Println(" keep-screen-on). These correspond to the") - fmt.Println(" WindowManager.LayoutParams FLAG_* constants.") - fmt.Println() - fmt.Println(" SetWindowFormat(format int32)") - fmt.Println(" Set the pixel format of the activity's window.") - fmt.Println(" Common formats are defined in the Android NDK") - fmt.Println(" window.h header (AHARDWAREBUFFER_FORMAT_*).") - fmt.Println() - - // --------------------------------------------------------------- - // ShowSoftInputFlags - // --------------------------------------------------------------- - - fmt.Println("ShowSoftInputFlags constants:") - fmt.Printf(" Implicit = %d -- show only if the user has not explicitly dismissed it\n", - activity.Implicit) - fmt.Printf(" Forced = %d -- force the keyboard visible even if user dismissed it\n", - activity.Forced) - fmt.Println() - - // --------------------------------------------------------------- - // HideSoftInputFlags - // --------------------------------------------------------------- - - fmt.Println("HideSoftInputFlags constants:") - fmt.Printf(" ImplicitOnly = %d -- hide only if it was shown implicitly (not by the user)\n", - activity.ImplicitOnly) - fmt.Printf(" NotAlways = %d -- hide unless the user explicitly requested it\n", - activity.NotAlways) - fmt.Println() - - // --------------------------------------------------------------- - // Associated types - // --------------------------------------------------------------- - - fmt.Println("Associated types:") - fmt.Println() - fmt.Println(" AInputQueue") - fmt.Println(" Wraps the NDK AInputQueue handle. Delivered via the") - fmt.Println(" onInputQueueCreated / onInputQueueDestroyed callbacks.") - fmt.Println(" Used to read touch, key, and motion events.") - fmt.Println() - fmt.Println(" ANativeWindow") - fmt.Println(" Wraps the NDK ANativeWindow handle. Delivered via the") - fmt.Println(" onNativeWindowCreated / onNativeWindowDestroyed callbacks.") - fmt.Println(" Used as the rendering surface for EGL, Vulkan, or direct") - fmt.Println(" pixel buffer access.") - fmt.Println() - fmt.Println(" ARect") - fmt.Println(" Wraps the NDK ARect struct (left, top, right, bottom).") - fmt.Println(" Used in content-rect-changed callbacks to report the") - fmt.Println(" visible area of the activity window.") - fmt.Println() - - // --------------------------------------------------------------- - // Typical usage pattern - // --------------------------------------------------------------- - - fmt.Println("Typical usage pattern (pseudocode):") - fmt.Println() - fmt.Println(" func onCreated(act *activity.Activity) {") - fmt.Println(" // Store the activity handle for later use.") - fmt.Println(" // Set fullscreen flags:") - fmt.Println(" // act.SetWindowFlags(FLAG_FULLSCREEN, 0)") - fmt.Println(" }") - fmt.Println() - fmt.Println(" func onTextInput(act *activity.Activity) {") - fmt.Println(" // Show the keyboard for text entry:") - fmt.Println(" // act.ShowSoftInput(uint32(activity.Implicit))") - fmt.Println(" }") - fmt.Println() - fmt.Println(" func onTextDone(act *activity.Activity) {") - fmt.Println(" // Dismiss the keyboard:") - fmt.Println(" // act.HideSoftInput(uint32(activity.NotAlways))") - fmt.Println(" }") - fmt.Println() - fmt.Println(" func onQuit(act *activity.Activity) {") - fmt.Println(" // Finish the activity:") - fmt.Println(" // act.Finish()") - fmt.Println(" }") -} diff --git a/examples/asset/overview/main.go b/examples/asset/overview/main.go deleted file mode 100644 index 798b719..0000000 --- a/examples/asset/overview/main.go +++ /dev/null @@ -1,193 +0,0 @@ -// Example: AAssetManager API overview and directory iteration. -// -// Demonstrates the full ndk/asset API surface: opening assets by path, -// reading content, querying length and allocation state, seeking within an -// asset, and iterating directories. -// -// AAssetManager lifecycle on Android: -// -// 1. Obtain the AAssetManager pointer from the Activity's ANativeActivity -// struct (activity.AssetManager in ndk/activity). The manager is owned -// by the framework and must not be freed by application code. -// 2. Open an individual asset with Manager.Open(filename, mode). The -// filename is relative to the APK's "assets/" directory (e.g. -// "textures/wood.png"). The mode controls how the NDK buffers the data. -// 3. Read the asset with Asset.Read, or access it directly via -// Asset.Buffer (only valid when opened with Buffer mode). Query the -// size with Asset.Length / Asset.Length64 and the unread portion with -// Asset.RemainingLength / Asset.RemainingLength64. Reposition with -// Asset.Seek using standard SEEK_SET/SEEK_CUR/SEEK_END whence values. -// 4. Close the asset with Asset.Close when finished. -// -// Directory iteration: -// -// 1. Open a directory with Manager.OpenDir(dirName). Pass an empty string -// to list the root of the assets/ tree, or a subdirectory path. -// 2. Call Dir.NextFileName repeatedly. Each call returns the next filename -// as a string, or "" when the listing is exhausted. -// 3. Call Dir.Rewind to reset the iterator back to the first entry. -// 4. Close with Dir.Close when finished. -// -// This program prints all Mode constants and documents the usage patterns -// in executable form. It cannot run without a real AAssetManager obtained -// from an Android Activity. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - "io" - "unsafe" - - "github.com/AndroidGoLab/ndk/asset" -) - -// modeName returns a human-readable description for an asset open mode. -func modeName(m asset.Mode) string { - switch m { - case asset.Unknown: - return "Unknown" - case asset.Random: - return "Random" - case asset.Streaming: - return "Streaming" - case asset.Buffer: - return "Buffer" - default: - return fmt.Sprintf("Mode(%d)", int32(m)) - } -} - -// modeDescription returns a short explanation of when to use each mode. -func modeDescription(m asset.Mode) string { - switch m { - case asset.Unknown: - return "no specific access pattern; NDK chooses defaults" - case asset.Random: - return "random access via Seek; NDK may memory-map the asset" - case asset.Streaming: - return "sequential forward reads; NDK may use a smaller buffer" - case asset.Buffer: - return "entire asset loaded into memory; Buffer() returns a direct pointer" - default: - return "unknown mode" - } -} - -func main() { - // -- Mode constants ---------------------------------------------------- - // Mode controls how the NDK accesses the underlying APK data for an - // asset. Choose the mode that matches your read pattern for best - // performance. - fmt.Println("Asset open modes:") - fmt.Println() - fmt.Printf(" %-12s %5s %s\n", "Name", "Value", "Description") - fmt.Printf(" %-12s %5s %s\n", "------------", "-----", "-----------") - - for _, m := range []asset.Mode{ - asset.Unknown, - asset.Random, - asset.Streaming, - asset.Buffer, - } { - fmt.Printf(" %-12s %5d %s\n", modeName(m), int32(m), modeDescription(m)) - } - fmt.Println() - - // -- Asset open/read/close pattern ------------------------------------ - // The code below shows the typical sequence for reading an asset file. - // It requires a valid *asset.Manager, which comes from the Activity: - // - // mgr := activity.AssetManager // from ANativeActivity - // - // Since we cannot obtain a real manager in a standalone example, the - // remainder is guarded by a nil check and serves as a code reference. - - var mgr *asset.Manager // would come from the Activity in a real app - - if mgr != nil { - // Open a text file from the APK's assets/ directory. - a := mgr.Open("data/config.json", asset.Streaming) - defer a.Close() - - // Query total size. Length returns off_t (32-bit on older ABIs), - // Length64 always returns a 64-bit value. - totalLen := a.Length64() - fmt.Printf(" Asset length: %d bytes\n", totalLen) - - // Check how much data remains unread from the current position. - remaining := a.RemainingLength64() - fmt.Printf(" Remaining: %d bytes\n", remaining) - - // IsAllocated reports whether the asset data lives in a dedicated - // memory allocation (1) or is memory-mapped from the APK (0). - fmt.Printf(" Allocated: %d\n", a.IsAllocated()) - - // Read the entire asset into a byte slice. - buf := make([]byte, totalLen) - err := a.Read(unsafe.Pointer(&buf[0]), uint64(totalLen)) - if err != nil { - fmt.Printf(" Read error: %v\n", err) - } else { - fmt.Printf(" Read %d bytes successfully\n", totalLen) - } - - // Seek back to the beginning using standard io.SeekStart (0). - // Seek returns the new position or -1 on error. - newPos := a.Seek(0, int32(io.SeekStart)) - fmt.Printf(" Seek to start: position = %d\n", newPos) - - // With Buffer mode, the entire asset is accessible through a - // direct pointer without calling Read: - // - // a := mgr.Open("data/config.json", asset.Buffer) - // ptr := a.Buffer() // unsafe.Pointer to the raw data - // data := unsafe.Slice((*byte)(ptr), a.Length64()) - } - - // -- Directory iteration pattern -------------------------------------- - // OpenDir lists files inside an assets/ subdirectory. - - if mgr != nil { - // Open the root assets directory (empty string = root). - dir := mgr.OpenDir("") - defer dir.Close() - - fmt.Println(" Files in assets root:") - for { - name := dir.NextFileName() - if name == "" { - break - } - fmt.Printf(" %s\n", name) - } - - // Rewind resets the iterator so you can walk the listing again. - dir.Rewind() - fmt.Println(" After Rewind, first file again:") - if name := dir.NextFileName(); name != "" { - fmt.Printf(" %s\n", name) - } - } - - // -- Subdirectory iteration ------------------------------------------- - // Pass a path relative to assets/ to list a subdirectory. - - if mgr != nil { - dir := mgr.OpenDir("textures") - defer dir.Close() - - fmt.Println(" Files in assets/textures/:") - for { - name := dir.NextFileName() - if name == "" { - break - } - fmt.Printf(" %s\n", name) - } - } - - fmt.Println() - fmt.Println("Asset lifecycle and directory iteration patterns printed above in source.") -} diff --git a/examples/audio/basic-playback/main.go b/examples/audio/basic-playback/main.go deleted file mode 100644 index 464e832..0000000 --- a/examples/audio/basic-playback/main.go +++ /dev/null @@ -1,89 +0,0 @@ -// Basic AAudio playback example. -// -// Demonstrates how to create an AAudio stream configured for audio output, -// write silence to it, and tear it down. The StreamBuilder uses a chaining -// pattern so all configuration can be expressed in a single fluent call. -// -// This program must run on an Android device with AAudio support. -package main - -import ( - "log" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/audio" -) - -func main() { - const ( - sampleRate = 44100 - channelCount = 2 // stereo - durationSec = 2 // seconds of silence to write - writeTimeout = time.Second - ) - - // Create a builder and configure it for playback in one chain. - builder, err := audio.NewStreamBuilder() - if err != nil { - log.Fatalf("create stream builder: %v", err) - } - defer builder.Close() - - builder. - SetDirection(audio.Output). - SetSampleRate(sampleRate). - SetChannelCount(channelCount). - SetFormat(audio.PcmFloat). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - - // Open the stream from the configured builder. - stream, err := builder.Open() - if err != nil { - log.Fatalf("open stream: %v", err) - } - defer func() { - if err := stream.Close(); err != nil { - log.Printf("close stream: %v", err) - } - }() - - log.Printf("stream opened: %d Hz, %d ch, state=%s", - stream.SampleRate(), stream.ChannelCount(), stream.State()) - - if err := stream.Start(); err != nil { - log.Fatalf("start stream: %v", err) - } - - // Prepare a buffer of silence (all zeros). Each frame has channelCount - // float32 samples, so the buffer holds one burst worth of frames. - framesPerBurst := stream.FramesPerBurst() - buf := make([]float32, int(framesPerBurst)*channelCount) - bufBytes := unsafe.Slice((*byte)(unsafe.Pointer(&buf[0])), len(buf)*int(unsafe.Sizeof(buf[0]))) - - totalFrames := int32(sampleRate * durationSec) - written := int32(0) - - for written < totalFrames { - framesToWrite := framesPerBurst - if remaining := totalFrames - written; remaining < framesToWrite { - framesToWrite = remaining - } - - n, err := stream.Write(bufBytes, framesToWrite, writeTimeout) - if err != nil { - log.Fatalf("write: %v", err) - } - written += n - } - - log.Printf("wrote %d frames of silence", written) - log.Printf("xrun count: %d", stream.XRunCount()) - - if err := stream.Stop(); err != nil { - log.Fatalf("stop stream: %v", err) - } - - log.Println("playback finished") -} diff --git a/examples/audio/recording/main.go b/examples/audio/recording/main.go deleted file mode 100644 index 5570b37..0000000 --- a/examples/audio/recording/main.go +++ /dev/null @@ -1,87 +0,0 @@ -// Audio recording (capture) example. -// -// Opens an AAudio input stream at 48 kHz mono 16-bit PCM, reads one second -// of audio frames, and prints basic statistics (total frames, peak amplitude). -// -// This program must run on an Android device with AAudio support and -// the RECORD_AUDIO permission granted. -package main - -import ( - "log" - "math" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/audio" -) - -func main() { - builder, err := audio.NewStreamBuilder() - if err != nil { - log.Fatalf("create stream builder: %v", err) - } - defer builder.Close() - - builder. - SetDirection(audio.Input). - SetSampleRate(48000). - SetChannelCount(1). - SetFormat(audio.PcmI16). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - - stream, err := builder.Open() - if err != nil { - log.Fatalf("open stream: %v", err) - } - defer func() { - if err := stream.Close(); err != nil { - log.Printf("close stream: %v", err) - } - }() - - rate := stream.SampleRate() - log.Printf("capture stream opened (rate=%d Hz, ch=%d)", rate, stream.ChannelCount()) - - if err := stream.Start(); err != nil { - log.Fatalf("start stream: %v", err) - } - - // Read approximately 1 second of audio. - totalFrames := rate - buf := make([]int16, 1024) - bufBytes := unsafe.Slice((*byte)(unsafe.Pointer(&buf[0])), len(buf)*int(unsafe.Sizeof(buf[0]))) - var captured []int16 - - for int32(len(captured)) < totalFrames { - framesToRead := int32(len(buf)) - if remaining := totalFrames - int32(len(captured)); remaining < framesToRead { - framesToRead = remaining - } - n, err := stream.Read(bufBytes, framesToRead, time.Second) - if err != nil { - log.Fatalf("read: %v", err) - } - captured = append(captured, buf[:n]...) - } - - if err := stream.Stop(); err != nil { - log.Fatalf("stop stream: %v", err) - } - - // Compute peak amplitude. - var peak int16 - for _, s := range captured { - if s < 0 { - s = -s - } - if s > peak { - peak = s - } - } - - log.Printf("captured %d frames", len(captured)) - log.Printf("peak amplitude: %d (%.1f dBFS)", peak, 20*math.Log10(float64(peak)/32767.0)) - log.Println("recording example finished") -} diff --git a/examples/audio/state-machine/main.go b/examples/audio/state-machine/main.go deleted file mode 100644 index d929a2f..0000000 --- a/examples/audio/state-machine/main.go +++ /dev/null @@ -1,85 +0,0 @@ -// AAudio stream state machine example. -// -// Demonstrates the lifecycle of an AAudio stream by walking through -// key state transitions and printing the stream state after each: -// -// Open -> Start -> Stop -> Close -// -// Note that AAudio state transitions are asynchronous: a call to Start() -// requests the transition and the stream may briefly be in the "Starting" -// state before reaching "Started". The state printed here is whatever the -// stream reports immediately after the request returns. -// -// Additional states like Pause, Flush, and their async counterparts -// (Pausing, Flushing) are part of the AAudio state machine. In a real -// application you would use WaitForStateChange to synchronize before -// calling operations that require a specific state (e.g. Flush requires -// the stream to be fully Paused). -// -// This program must run on an Android device with AAudio support. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/audio" -) - -// printState logs the current stream state with a label describing the -// operation that was just performed. -func printState(label string, s *audio.Stream) { - fmt.Printf(" %-20s -> state: %s\n", label, s.State()) -} - -func main() { - // Build a simple output stream. - builder, err := audio.NewStreamBuilder() - if err != nil { - log.Fatalf("create stream builder: %v", err) - } - defer builder.Close() - - builder. - SetDirection(audio.Output). - SetSampleRate(44100). - SetChannelCount(1). - SetFormat(audio.PcmI16). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - - // Open the stream. The state should be Open after this call. - stream, err := builder.Open() - if err != nil { - log.Fatalf("open stream: %v", err) - } - - fmt.Println("State transitions:") - printState("Open", stream) - - // Query stream properties set by the system. - fmt.Printf(" Sample rate: %d Hz\n", stream.SampleRate()) - fmt.Printf(" Channel count: %d\n", stream.ChannelCount()) - fmt.Printf(" Frames per burst: %d\n", stream.FramesPerBurst()) - fmt.Println() - - // Start playback. - if err := stream.Start(); err != nil { - log.Fatalf("start: %v", err) - } - printState("Start", stream) - - // Stop the stream. Stop is valid from Started or Paused state. - if err := stream.Stop(); err != nil { - log.Fatalf("stop: %v", err) - } - printState("Stop", stream) - - // Close the stream and release all resources. - if err := stream.Close(); err != nil { - log.Fatalf("close: %v", err) - } - fmt.Printf(" %-20s -> stream released\n", "Close") - - fmt.Println("all state transitions completed successfully") -} diff --git a/examples/audio/stream-info/main.go b/examples/audio/stream-info/main.go deleted file mode 100644 index 8bc67d2..0000000 --- a/examples/audio/stream-info/main.go +++ /dev/null @@ -1,64 +0,0 @@ -// Stream information query example. -// -// Demonstrates how to open an AAudio stream and inspect its runtime -// properties. The actual values returned by SampleRate, ChannelCount, etc. -// may differ from the values requested on the builder because AAudio is -// free to choose the closest supported configuration. -// -// This program must run on an Android device with AAudio support. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/audio" -) - -func main() { - builder, err := audio.NewStreamBuilder() - if err != nil { - log.Fatalf("create stream builder: %v", err) - } - defer builder.Close() - - // Request specific parameters; AAudio may negotiate different values. - builder. - SetDirection(audio.Output). - SetSampleRate(48000). - SetChannelCount(2). - SetFormat(audio.PcmFloat). - SetPerformanceMode(audio.LowLatency) - - stream, err := builder.Open() - if err != nil { - log.Fatalf("open stream: %v", err) - } - defer func() { - if err := stream.Close(); err != nil { - log.Printf("close stream: %v", err) - } - }() - - // Query the negotiated stream properties. - fmt.Println("Stream properties:") - fmt.Printf(" Sample rate: %d Hz\n", stream.SampleRate()) - fmt.Printf(" Channel count: %d\n", stream.ChannelCount()) - fmt.Printf(" State: %s\n", stream.State()) - fmt.Printf(" Frames per burst: %d\n", stream.FramesPerBurst()) - fmt.Printf(" XRun count: %d\n", stream.XRunCount()) - - // Start the stream and observe the state change. - if err := stream.Start(); err != nil { - log.Fatalf("start stream: %v", err) - } - fmt.Printf("\nAfter Start():\n") - fmt.Printf(" State: %s\n", stream.State()) - fmt.Printf(" XRun count: %d\n", stream.XRunCount()) - - if err := stream.Stop(); err != nil { - log.Fatalf("stop stream: %v", err) - } - fmt.Printf("\nAfter Stop():\n") - fmt.Printf(" State: %s\n", stream.State()) -} diff --git a/examples/binder/overview/main.go b/examples/binder/overview/main.go deleted file mode 100644 index 9ee06b0..0000000 --- a/examples/binder/overview/main.go +++ /dev/null @@ -1,235 +0,0 @@ -// Binder IPC API overview. -// -// Documents the Android Binder IPC architecture and the ndk/binder type -// hierarchy. Binder is Android's primary inter-process communication -// mechanism -- virtually all system service calls (SurfaceFlinger, Activity -// Manager, Package Manager, etc.) flow through Binder transactions. -// -// Architecture: -// -// Client process Server process -// | | -// |-- AIBinder (proxy) ---[kernel]--> AIBinder (local) -// | | | -// | prepareTransaction onTransact callback -// | | | -// | AParcel (write args) --------> AParcel (read args) -// | | -// | AParcel (read reply) <-------- AParcel (write reply) -// | | | -// | AStatus (check result) AStatus (return result) -// -// Type hierarchy in ndk/binder: -// -// Class - Defines a binder interface (its descriptor string and the -// three callbacks: onCreate, onDestroy, onTransact). -// Created via AIBinder_Class_define. -// Has no Close method -- the class definition is static -// and lives for the process lifetime. -// -// Binder - A handle to a binder object (local or remote proxy). -// Created via AIBinder_new (local) or obtained from the -// Android service manager (remote). -// Close() decrements the strong reference count. -// -// Parcel - A container for serialized transaction data. Supports -// writing/reading int32 values and strings. -// Close() deletes the parcel. -// -// Status - Represents the outcome of a binder transaction. -// Close() deletes the status object. -// -// Error - An error type wrapping NDK binder status codes. -// Implements the error interface. Constants like -// ErrDeadObject and ErrPermissionDenied map to the -// underlying STATUS_* codes from the NDK. -// -// Transaction flow: -// -// // 1. Define a binder class with callbacks. -// // (AIBinder_Class_define — not yet in high-level API) -// -// // 2. Create a local binder instance. -// // (AIBinder_new — not yet in high-level API) -// -// // 3. Prepare a transaction — allocates an input parcel. -// // (AIBinder_prepareTransaction — not yet in high-level API) -// -// // 4. Marshal arguments into the input parcel. -// // parcel.WriteInt32(42) -// -// // 5. Execute the transaction — sends input, receives output. -// // (AIBinder_transact — not yet in high-level API) -// -// // 6. Unmarshal the reply from the output parcel. -// // parcel.ReadInt32(&result) -// -// // 7. Clean up. -// // parcel.Close() -// // binder.Close() -// -// On the server side, the onTransact callback receives the transaction code -// and input parcel, reads the arguments, performs the operation, writes the -// reply into the output parcel, and returns an AStatus. -// -// Prerequisites: -// - Android device or emulator with API level 29+ (Binder NDK API). -// - The binder interface must be registered with the Android service -// manager for cross-process discovery. Local (in-process) binder -// objects can be created directly with AIBinder_new. -// - SELinux policy must permit the binder transactions between the -// client and server security contexts. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/binder" -) - -func main() { - // --------------------------------------------------------------- - // Error codes - // - // The binder package defines Error constants that map to the - // underlying NDK STATUS_* codes. These are returned by binder - // operations and converted to Go errors by the binder package. - // - // Use errors.Is to check for specific binder failures: - // if errors.Is(err, binder.ErrDeadObject) { reconnect... } - // --------------------------------------------------------------- - errors := []struct { - name string - err binder.Error - }{ - {"ErrUnknownError", binder.ErrUnknownError}, - {"ErrNoMemory", binder.ErrNoMemory}, - {"ErrInvalidOperation", binder.ErrInvalidOperation}, - {"ErrBadValue", binder.ErrBadValue}, - {"ErrDeadObject", binder.ErrDeadObject}, - {"ErrPermissionDenied", binder.ErrPermissionDenied}, - {"ErrNameNotFound", binder.ErrNameNotFound}, - {"ErrWouldBlock", binder.ErrWouldBlock}, - {"ErrFdsNotAllowed", binder.ErrFdsNotAllowed}, - } - - fmt.Println("binder.Error constants:") - for _, e := range errors { - fmt.Printf(" %-25s code=%d msg=%q\n", e.name, int32(e.err), e.err.Error()) - } - - // --------------------------------------------------------------- - // Class - // - // A Class defines a binder interface. It is created once at - // initialization time via AIBinder_Class_define: - // - // AIBinder_Class_define( - // descriptor, // e.g. "com.example.IMyService" - // onCreateFn, - // onDestroyFn, - // onTransactFn, - // ) - // - // The descriptor string uniquely identifies the interface and must - // match between client and server. The Class has no Close method - // because it is a static definition -- it lives for the process - // lifetime. - // - // The binder.Class struct wraps the AIBinder_Class pointer. - // Class creation is not yet exposed in the high-level API. - // --------------------------------------------------------------- - log.Println("Class: defines a binder interface (descriptor + callbacks)") - - // --------------------------------------------------------------- - // Binder - // - // A Binder represents a handle to a binder object. There are two - // flavors: - // - // Local binder (server side): - // Created with AIBinder_new(class, userData). The userData - // pointer is passed to onCreate and can be retrieved later - // with AIBinder_getUserData. - // - // Remote proxy (client side): - // Obtained from the Android service manager or received as - // a parameter in a binder transaction. The proxy transparently - // forwards transactions across process boundaries via the - // kernel binder driver. - // - // Reference counting: - // AIBinder_incStrong / AIBinder_decStrong manage the binder's - // lifetime. The Go wrapper Binder.Close() calls decStrong. - // When the strong count reaches zero, the onDestroy callback - // fires and the binder is freed. - // - // Example usage pattern: - // - // // Server: create a local binder - // // (AIBinder_new — not yet in high-level API) - // defer b.Close() // calls AIBinder_decStrong - // - // // Client: obtain proxy from service manager - // // (AServiceManager_getService — not yet wrapped) - // defer b.Close() - // --------------------------------------------------------------- - log.Println("Binder: handle to a local or remote binder object") - - // --------------------------------------------------------------- - // Parcel - // - // A Parcel is the data container for binder transactions. It - // provides typed serialization for marshaling arguments and - // replies across process boundaries. - // - // Supported data types: - // - int32: WriteInt32 / ReadInt32 - // - string: WriteString / ReadString - // - // Parcels are obtained in two ways: - // 1. AIBinder_prepareTransaction allocates an input parcel for - // a client-initiated transaction. - // 2. The onTransact callback receives input and output parcels - // on the server side. - // - // Parcel.Close() deletes the parcel. Only delete parcels that - // you own -- the output parcel from AIBinder_transact is yours, - // but parcels received in onTransact are owned by the framework. - // --------------------------------------------------------------- - log.Println("Parcel: serialization container for transaction data") - - // --------------------------------------------------------------- - // Status - // - // A Status represents the outcome of a binder operation. The NDK - // provides: - // - // AStatus_newOk() - create a success status - // AStatus_isOk(status) - check if the status indicates success - // AStatus_getStatus(status) - get the underlying status code - // AStatus_delete(status) - free the status object - // - // The onTransact callback returns an AStatus to indicate whether - // the transaction was handled successfully. Callers inspect the - // status after AIBinder_transact completes. - // - // Status.Close() deletes the status object. - // --------------------------------------------------------------- - log.Println("Status: transaction outcome (ok or error code)") - - // --------------------------------------------------------------- - // Cleanup order - // - // Resources should be released in reverse creation order: - // 1. status.Close() - delete status objects - // 2. parcel.Close() - delete owned parcels - // 3. binder.Close() - decrement strong reference - // - // Class has no Close -- it is a process-lifetime definition. - // All Close methods are idempotent and nil-safe. - // --------------------------------------------------------------- - - log.Println("overview complete -- see source comments for full API documentation") -} diff --git a/examples/bitmap/formats/main.go b/examples/bitmap/formats/main.go deleted file mode 100644 index 924743c..0000000 --- a/examples/bitmap/formats/main.go +++ /dev/null @@ -1,108 +0,0 @@ -// Example: Android bitmap format constants and error codes. -// -// Enumerates every bitmap pixel format defined by the NDK and prints its -// name and underlying integer value. Each format corresponds to an -// ANDROID_BITMAP_FORMAT_* constant used when creating or inspecting -// bitmaps through the jnigraphics API. -// -// The program also demonstrates the Error type, which implements the -// standard error interface and wraps NDK result codes returned by -// bitmap operations. -// -// This program does not require a live Android device; it only reads -// compile-time constants. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/bitmap" -) - -// formatInfo pairs a Format constant with a human-readable description. -type formatInfo struct { - name string - value bitmap.Format - detail string -} - -// formats lists every bitmap.Format constant together with a short -// explanation of its pixel layout and typical use case. -var formats = []formatInfo{ - { - name: "None", - value: bitmap.None, - detail: "No format / unknown. Returned when the bitmap format cannot be determined.", - }, - { - // 32-bit, 8 bits per channel (red, green, blue, alpha). - // The most common format; suitable for general-purpose rendering - // and compositing where full color depth and transparency are needed. - name: "RGBA_8888", - value: bitmap.Rgba8888, - detail: "32-bit standard color (8 bits per channel). Default for most bitmaps.", - }, - { - // 16-bit, 5 bits red / 6 bits green / 5 bits blue, no alpha. - // Uses half the memory of RGBA_8888 at the cost of color precision. - // Common in memory-constrained scenarios such as live wallpapers or - // thumbnail caches. - name: "RGB_565", - value: bitmap.Rgb565, - detail: "16-bit color (5-6-5), no alpha. Half the memory of RGBA_8888.", - }, - { - // 16-bit, 4 bits per channel. Deprecated in API 13 in favor of - // RGBA_8888 because the limited color depth introduces visible - // banding. Included for completeness. - name: "RGBA_4444", - value: bitmap.Rgba4444, - detail: "16-bit color (4 bits per channel). Deprecated; prefer RGBA_8888.", - }, - { - // 8-bit alpha-only. Each pixel stores a single alpha value; no - // color information. Used for masks and text rendering. - name: "A_8", - value: bitmap.A8, - detail: "8-bit alpha only. Used for masks and glyph rendering.", - }, - { - // 64-bit, 16-bit IEEE 754 half-float per channel. - // Required for HDR content and wide color gamut (Display P3, - // scRGB). Available from API 26. - name: "RGBA_F16", - value: bitmap.RgbaF16, - detail: "64-bit HDR (16-bit float per channel). For wide-gamut / HDR content.", - }, -} - -// errorInfo pairs an Error constant with its meaning. -type errorInfo struct { - name string - value bitmap.Error -} - -// errors lists every bitmap.Error constant. -var errors = []errorInfo{ - {"BadParameter", bitmap.ErrBadParameter}, - {"JniException", bitmap.ErrJniException}, - {"AllocationFailed", bitmap.ErrAllocationFailed}, -} - -func main() { - fmt.Println("Bitmap pixel formats") - fmt.Println() - for _, f := range formats { - fmt.Printf(" %-12s value=%d %s\n", f.name, int32(f.value), f.detail) - } - - fmt.Println() - fmt.Println("Bitmap error codes") - fmt.Println() - for _, e := range errors { - // Error implements the error interface; call it to show the - // formatted message that would appear in practice. - fmt.Printf(" %-20s code=%2d error.Error() = %q\n", - e.name, int32(e.value), e.value.Error()) - } -} diff --git a/examples/build_test.go b/examples/build_test.go deleted file mode 100644 index ff651d7..0000000 --- a/examples/build_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package examples_test - -import ( - "os" - "os/exec" - "path/filepath" - "runtime" - "testing" -) - -// TestExamplesCompile cross-compiles all examples for Android arm64 -// to catch compile errors. Requires the Android NDK to be installed. -func TestExamplesCompile(t *testing.T) { - ndkHome := os.Getenv("ANDROID_NDK_HOME") - if ndkHome == "" { - androidHome := os.Getenv("ANDROID_HOME") - if androidHome == "" { - androidHome = filepath.Join(os.Getenv("HOME"), "Android", "Sdk") - } - matches, _ := filepath.Glob(filepath.Join(androidHome, "ndk", "*")) - if len(matches) == 0 { - t.Skip("Android NDK not found; set ANDROID_NDK_HOME or ANDROID_HOME") - } - ndkHome = matches[len(matches)-1] - } - - cc := filepath.Join( - ndkHome, - "toolchains", "llvm", "prebuilt", runtime.GOOS+"-x86_64", - "bin", "aarch64-linux-android35-clang", - ) - if _, err := os.Stat(cc); err != nil { - t.Skipf("NDK clang not found at %s", cc) - } - - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("unable to determine test file path") - } - projectRoot := filepath.Join(filepath.Dir(thisFile), "..") - - cmd := exec.Command("go", "build", "./examples/...") - cmd.Dir = projectRoot - cmd.Env = append(os.Environ(), - "CGO_ENABLED=1", - "GOOS=android", - "GOARCH=arm64", - "CC="+cc, - ) - out, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("examples failed to compile:\n%s", out) - } -} diff --git a/examples/camera/capture-session/main.go b/examples/camera/capture-session/main.go deleted file mode 100644 index c81e126..0000000 --- a/examples/camera/capture-session/main.go +++ /dev/null @@ -1,203 +0,0 @@ -// Camera capture session lifecycle example. -// -// Demonstrates the complete Camera2 capture pipeline: creating a manager, -// listing cameras, reading characteristics, opening a device with callbacks, -// creating a capture request and session, starting a repeating request, and -// orderly cleanup. A sync.WaitGroup gates the repeating-request call until -// the session reports ready. -// -// Because the camera pipeline requires an ANativeWindow from an Android -// Surface, this example documents the window-dependent steps in comments -// and executes only the steps that work without a live Surface. -// -// Prerequisites: -// - Android device with API level 24+. -// - android.permission.CAMERA must be granted at runtime. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/camera" -) - -func main() { - // --- Stage 1: Create manager --- - mgr := camera.NewManager() - if mgr == nil { - log.Fatal("camera.NewManager returned nil") - } - defer func() { - if err := mgr.Close(); err != nil { - log.Printf("manager close: %v", err) - } - log.Println("manager closed") - }() - log.Println("manager created") - - // --- Stage 2: List cameras --- - ids, err := mgr.CameraIDList() - if err != nil { - log.Fatalf("listing cameras: %v", err) - } - if len(ids) == 0 { - log.Fatal("no cameras available on this device") - } - fmt.Printf("found %d camera(s):\n", len(ids)) - for i, id := range ids { - fmt.Printf(" [%d] %s\n", i, id) - } - - // --- Stage 3: Read characteristics --- - camID := ids[0] - chars, err := mgr.GetCameraCharacteristics(camID) - if err != nil { - log.Fatalf("get characteristics for %s: %v", camID, err) - } - defer chars.Close() - - // Query sensor orientation. - if chars.I32Count(uint32(camera.SensorOrientation)) > 0 { - orient := chars.I32At(uint32(camera.SensorOrientation), 0) - fmt.Printf("camera %s sensor orientation: %d degrees\n", camID, orient) - } - - // Query available stream configurations (format, width, height, isInput). - scTag := uint32(camera.ScalerAvailableStreamConfigurations) - count := chars.I32Count(scTag) - outputs := 0 - for i := int32(0); i+3 < count; i += 4 { - isInput := chars.I32At(scTag, i+3) - if isInput == 0 { - outputs++ - } - } - fmt.Printf("camera %s has %d output stream configurations\n", camID, outputs) - - // --- Stage 4: Open camera device --- - // - // Opening the camera requires android.permission.CAMERA. The device - // state callbacks receive disconnect and error notifications. - dev, err := mgr.OpenCamera(camID, camera.DeviceStateCallbacks{ - OnDisconnected: func() { - log.Println("callback: camera disconnected") - }, - OnError: func(code int) { - log.Printf("callback: camera error %d", code) - }, - }) - if err != nil { - log.Fatalf("opening camera %s: %v", camID, err) - } - defer func() { - if err := dev.Close(); err != nil { - log.Printf("device close: %v", err) - } - log.Println("device closed") - }() - log.Printf("camera %s opened", camID) - - // --- Stage 5: Create capture request --- - // - // The template type provides sensible defaults. Available templates: - // camera.Preview, camera.StillCapture, camera.Record, - // camera.VideoSnapshot, camera.ZeroShutterLag, camera.Manual - req, err := dev.CreateCaptureRequest(camera.Preview) - if err != nil { - log.Fatalf("creating capture request: %v", err) - } - defer req.Close() - log.Println("capture request created (Preview template)") - - // --- Stage 6: Output target, session output, session --- - // - // The remaining steps require an ANativeWindow, which comes from an - // Android Surface (SurfaceView, TextureView, ImageReader, or - // SurfaceTexture). The pattern is shown below. Without a window, we - // print the pipeline steps and exit cleanly. - // - // // Obtain an ANativeWindow from a Surface. - // var nativeWindow *camera.ANativeWindow - // - // // Create output target and add to request. - // outTarget, err := camera.NewOutputTarget(nativeWindow) - // if err != nil { - // log.Fatalf("creating output target: %v", err) - // } - // defer outTarget.Close() - // req.AddTarget(outTarget) - // - // // Create session output and container. - // sessOut, err := camera.NewSessionOutput(nativeWindow) - // if err != nil { - // log.Fatalf("creating session output: %v", err) - // } - // defer sessOut.Close() - // - // container, err := camera.NewSessionOutputContainer() - // if err != nil { - // log.Fatalf("creating output container: %v", err) - // } - // defer container.Close() - // - // if err := container.Add(sessOut); err != nil { - // log.Fatalf("adding session output: %v", err) - // } - // - // // Create capture session with state callbacks. - // // Use a WaitGroup to block until the session is ready. - // var wg sync.WaitGroup - // wg.Add(1) - // var readyOnce sync.Once - // - // session, err := dev.CreateCaptureSession( - // container, - // camera.SessionStateCallbacks{ - // OnClosed: func() { - // log.Println("callback: session closed") - // }, - // OnReady: func() { - // log.Println("callback: session ready") - // readyOnce.Do(wg.Done) - // }, - // OnActive: func() { - // log.Println("callback: session active") - // }, - // }, - // ) - // if err != nil { - // log.Fatalf("creating capture session: %v", err) - // } - // defer session.Close() - // - // // Wait for the session to become ready. - // wg.Wait() - // - // // Start continuous preview capture. - // if err := session.SetRepeatingRequest(req); err != nil { - // log.Fatalf("set repeating request: %v", err) - // } - // log.Println("repeating request started") - // - // // ... render frames ... - // - // // Stop the repeating request before cleanup. - // if err := session.StopRepeating(); err != nil { - // log.Printf("stop repeating: %v", err) - // } - // log.Println("repeating request stopped") - - // --- Cleanup order --- - // - // Resources are released in reverse creation order via defers: - // 1. session.Close() - // 2. container.Close() - // 3. sessOut.Close() - // 4. outTarget.Close() - // 5. req.Close() - // 6. dev.Close() - // 7. mgr.Close() - - log.Println("capture session pipeline complete -- see source for full pattern") -} diff --git a/examples/camera/display/AndroidManifest.xml b/examples/camera/display/AndroidManifest.xml deleted file mode 100644 index f9326d2..0000000 --- a/examples/camera/display/AndroidManifest.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/examples/camera/display/main.go b/examples/camera/display/main.go deleted file mode 100644 index 54ab7e8..0000000 --- a/examples/camera/display/main.go +++ /dev/null @@ -1,694 +0,0 @@ -// Camera preview display using NativeActivity with OpenGL ES rendering. -// -// Opens the first available camera and renders its preview to the screen using -// GPU-based compositing for correct aspect ratio at full screen. The camera -// writes to a SurfaceTexture (zero-copy GPU path), which is sampled as an OES -// external texture and rendered as a fullscreen quad with UV coordinates that -// center-crop to the display aspect ratio. -// -// The app requests CAMERA permission at runtime via JNI. If permission is -// denied, a red screen and Toast message are shown. -// -// Build: -// -// make apk-displaycamera -// -// Install & run: -// -// adb install -r examples/camera/display/displaycamera.apk -// adb shell am start -n com.example.displaycamera/android.app.NativeActivity -package main - -import ( - "fmt" - "runtime" - "sync" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/activity" - "github.com/AndroidGoLab/ndk/camera" - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" - "github.com/AndroidGoLab/ndk/input" - "github.com/AndroidGoLab/ndk/jni" - ndklog "github.com/AndroidGoLab/ndk/log" - "github.com/AndroidGoLab/ndk/media" - "github.com/AndroidGoLab/ndk/surfacetexture" - "github.com/AndroidGoLab/ndk/window" -) - -const logTag = "ndk-camera" - -const ( - vertexShaderSrc = ` -attribute vec4 aPosition; -attribute vec2 aTexCoord; -varying vec2 vTexCoord; -uniform mat4 uSTMatrix; -void main() { - gl_Position = aPosition; - vTexCoord = (uSTMatrix * vec4(aTexCoord, 0.0, 1.0)).xy; -} -` - fragmentShaderSrc = ` -#extension GL_OES_EGL_image_external : require -precision mediump float; -varying vec2 vTexCoord; -uniform samplerExternalOES sTexture; -void main() { - gl_FragColor = texture2D(sTexture, vTexCoord); -} -` -) - -var ( - currentActivity *activity.Activity - currentWindow unsafe.Pointer - cameraStarted bool - - permRequested bool - permLostFocus bool - permDialogDone bool - - camMgr *camera.Manager - camDev *camera.Device - captureReq *camera.CaptureRequest - outTarget *camera.OutputTarget - sessOut *camera.SessionOutput - sessOutContainer *camera.SessionOutputContainer - captureSess *camera.CaptureSession - - eglDisp egl.EGLDisplay - eglSurf egl.EGLSurface - eglCtx egl.EGLContext - eglInited bool - eglHasSurf bool - eglHasCtx bool - glProg gles2.GLuint - oesTex gles2.GLuint - - surfTex *surfacetexture.SurfaceTexture - camWindow *surfacetexture.NativeWindow - - renderMu sync.Mutex - renderStop chan struct{} - - inputQueue *input.Queue - inputStop chan struct{} -) - -func init() { - activity.SetLifecycleCallbacks(activity.LifecycleCallbacks{ - OnNativeWindowCreated: func(act *activity.Activity, win unsafe.Pointer) { - currentActivity = act - currentWindow = win - tryStartCamera() - }, - OnResume: func(act *activity.Activity) { - currentActivity = act - if currentWindow != nil && !cameraStarted && (!permRequested || permDialogDone) { - tryStartCamera() - } - }, - OnWindowFocusChanged: func(_ *activity.Activity, hasFocus int32) { - if hasFocus == 0 && permRequested && !permDialogDone { - permLostFocus = true - } - if hasFocus != 0 && permRequested && permLostFocus && !permDialogDone { - permDialogDone = true - if currentWindow != nil && !cameraStarted { - tryStartCamera() - } - } - }, - OnNativeWindowDestroyed: func(_ *activity.Activity, _ unsafe.Pointer) { - stopPreview() - currentWindow = nil - }, - OnInputQueueCreated: func(_ *activity.Activity, queuePtr unsafe.Pointer) { - inputQueue = input.NewQueueFromPointer(queuePtr) - inputStop = make(chan struct{}) - go drainInputEvents() - }, - OnInputQueueDestroyed: func(_ *activity.Activity, _ unsafe.Pointer) { - if inputStop != nil { - close(inputStop) - inputStop = nil - } - inputQueue = nil - }, - OnDestroy: func(_ *activity.Activity) { - stopPreview() - currentActivity = nil - currentWindow = nil - }, - }) -} - -func tryStartCamera() { - if cameraStarted { - return - } - - actPtr := currentActivity.Pointer() - - if !jni.HasPermission(actPtr, "android.permission.CAMERA") { - switch { - case !permRequested: - logInfo("requesting camera permission") - jni.RequestPermission(actPtr, "android.permission.CAMERA") - permRequested = true - case permDialogDone: - showError("camera permission denied") - } - return - } - - if err := startPreview(currentWindow); err != nil { - showError(fmt.Sprintf("camera preview failed: %v", err)) - } -} - -func startPreview(win unsafe.Pointer) (_err error) { - defer func() { - if _err != nil { - stopPreview() - } - }() - - nw := window.NewWindowFromPointer(win) - winW := nw.Width() - winH := nw.Height() - logInfo(fmt.Sprintf("window: %dx%d", winW, winH)) - - camMgr = camera.NewManager() - - ids, err := camMgr.CameraIDList() - if err != nil { - return fmt.Errorf("listing cameras: %w", err) - } - if len(ids) == 0 { - return fmt.Errorf("no cameras available") - } - logInfo(fmt.Sprintf("opening camera %s", ids[0])) - - sensorOrient, bestW, bestH := getCameraInfo(camMgr, ids[0], winW, winH) - if bestW == 0 || bestH == 0 { - bestW = 1920 - bestH = 1080 - } - logInfo(fmt.Sprintf("camera output: %dx%d orient=%d", bestW, bestH, sensorOrient)) - - if err := initEGL(win); err != nil { - return fmt.Errorf("EGL init: %w", err) - } - - // Create OES texture for camera frames. - gles2.GenTextures(1, &oesTex) - gles2.BindTexture(gles2.TextureExternalOes, oesTex) - gles2.TexParameteri(gles2.TextureExternalOes, gles2.TextureMinFilter, gles2.GLint(gles2.Linear)) - gles2.TexParameteri(gles2.TextureExternalOes, gles2.TextureMagFilter, gles2.GLint(gles2.Linear)) - gles2.TexParameteri(gles2.TextureExternalOes, gles2.TextureWrapS, gles2.GLint(gles2.ClampToEdge)) - gles2.TexParameteri(gles2.TextureExternalOes, gles2.TextureWrapT, gles2.GLint(gles2.ClampToEdge)) - - // Create SurfaceTexture via JNI, wrapping our OES texture. - stPtr := jni.CreateSurfaceTexture( - currentActivity.Pointer(), - int(oesTex), int(bestW), int(bestH), - ) - if stPtr == nil { - return fmt.Errorf("failed to create SurfaceTexture") - } - surfTex = surfacetexture.NewSurfaceTextureFromPointer(stPtr) - - camWindow = surfTex.AcquireWindow() - if camWindow.Pointer() == nil { - return fmt.Errorf("failed to acquire SurfaceTexture window") - } - - prog, err := createShaderProgram() - if err != nil { - return fmt.Errorf("shader program: %w", err) - } - glProg = prog - - // Release EGL context from this thread so the render goroutine can use it. - var noSurf egl.EGLSurface - var noCtx egl.EGLContext - egl.MakeCurrent(eglDisp, noSurf, noSurf, noCtx) - - // Open camera and create capture session targeting the SurfaceTexture. - camDev, err = camMgr.OpenCamera(ids[0], camera.DeviceStateCallbacks{ - OnDisconnected: func() { logError("camera disconnected") }, - OnError: func(code int) { logError(fmt.Sprintf("camera error: %d", code)) }, - }) - if err != nil { - return fmt.Errorf("opening camera %s: %w", ids[0], err) - } - - captureReq, err = camDev.CreateCaptureRequest(camera.Preview) - if err != nil { - return fmt.Errorf("creating capture request: %w", err) - } - - camWinPtr := (*camera.ANativeWindow)(camWindow.Pointer()) - - outTarget, err = camera.NewOutputTarget(camWinPtr) - if err != nil { - return fmt.Errorf("creating output target: %w", err) - } - captureReq.AddTarget(outTarget) - - sessOut, err = camera.NewSessionOutput(camWinPtr) - if err != nil { - return fmt.Errorf("creating session output: %w", err) - } - - sessOutContainer, err = camera.NewSessionOutputContainer() - if err != nil { - return fmt.Errorf("creating output container: %w", err) - } - if err := sessOutContainer.Add(sessOut); err != nil { - return fmt.Errorf("adding session output: %w", err) - } - - captureSess, err = camDev.CreateCaptureSession( - sessOutContainer, - camera.SessionStateCallbacks{ - OnReady: func() { logInfo("capture session ready") }, - OnActive: func() { logInfo("capture session active") }, - }, - ) - if err != nil { - return fmt.Errorf("creating capture session: %w", err) - } - - if err := captureSess.SetRepeatingRequest(captureReq); err != nil { - return fmt.Errorf("setting repeating request: %w", err) - } - - // Compute vertex scaling for center-crop at correct aspect ratio. - // The SurfaceTexture transform matrix handles orientation; we scale - // the quad beyond [-1,1] so the viewport clips the excess. - var effectiveCamAR float32 - if sensorOrient == 90 || sensorOrient == 270 { - effectiveCamAR = float32(bestH) / float32(bestW) - } else { - effectiveCamAR = float32(bestW) / float32(bestH) - } - displayAR := float32(winW) / float32(winH) - - var scaleX, scaleY float32 - ratio := effectiveCamAR / displayAR - if ratio > 1 { - scaleX = ratio - scaleY = 1.0 - } else { - scaleX = 1.0 - scaleY = 1.0 / ratio - } - - logInfo(fmt.Sprintf("scale: x=%.3f y=%.3f camAR=%.3f displayAR=%.3f", - scaleX, scaleY, effectiveCamAR, displayAR)) - - renderStop = make(chan struct{}) - go renderLoop(winW, winH, scaleX, scaleY) - - logInfo("camera preview started") - cameraStarted = true - return nil -} - -// getCameraInfo reads sensor orientation and picks the best output size. -func getCameraInfo( - mgr *camera.Manager, - camID string, - winW, winH int32, -) (orient, bestW, bestH int32) { - chars, err := mgr.GetCameraCharacteristics(camID) - if err != nil { - return 0, 0, 0 - } - defer chars.Close() - - // Sensor orientation. - if chars.I32Count(uint32(camera.SensorOrientation)) > 0 { - orient = chars.I32At(uint32(camera.SensorOrientation), 0) - } - - // Target aspect ratio (landscape). - var targetAR float64 - if orient == 90 || orient == 270 { - targetAR = float64(winH) / float64(winW) - } else { - targetAR = float64(winW) / float64(winH) - } - if targetAR < 1.0 { - targetAR = 1.0 / targetAR - } - - // Stream configurations: tuples of (format, width, height, isInput). - scTag := uint32(camera.ScalerAvailableStreamConfigurations) - count := chars.I32Count(scTag) - bestDiff := 1e9 - var bestPixels int32 - for i := int32(0); i+3 < count; i += 4 { - format := chars.I32At(scTag, i) - w := chars.I32At(scTag, i+1) - h := chars.I32At(scTag, i+2) - isInput := chars.I32At(scTag, i+3) - if isInput != 0 { - continue - } - if format != int32(media.AIMAGE_FORMAT_PRIVATE) && format != int32(media.AIMAGE_FORMAT_YUV_420_888) { - continue - } - ar := float64(w) / float64(h) - if w < h { - ar = float64(h) / float64(w) - } - maxDim := w - if h > w { - maxDim = h - } - if maxDim < 720 { - continue - } - diff := (ar - targetAR) * (ar - targetAR) - pixels := w * h - if diff < bestDiff-0.001 || (diff < bestDiff+0.001 && pixels > bestPixels) { - bestDiff = diff - bestPixels = pixels - bestW = w - bestH = h - } - } - - logInfo(fmt.Sprintf("best output: %dx%d (targetAR=%.3f)", bestW, bestH, targetAR)) - return orient, bestW, bestH -} - -func renderLoop( - winW, winH int32, - scaleX, scaleY float32, -) { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - renderMu.Lock() - defer renderMu.Unlock() - - egl.MakeCurrent(eglDisp, eglSurf, eglSurf, eglCtx) - gles2.Viewport(gles2.GLint(0), gles2.GLint(0), gles2.GLsizei(winW), gles2.GLsizei(winH)) - - aPos := gles2.GetAttribLocation(glProg, glStr("aPosition")) - aTex := gles2.GetAttribLocation(glProg, glStr("aTexCoord")) - uST := gles2.GetUniformLocation(glProg, glStr("uSTMatrix")) - sSamp := gles2.GetUniformLocation(glProg, glStr("sTexture")) - - // Vertex positions scaled beyond [-1,1] for center-crop; viewport clips excess. - verts := [8]float32{ - -scaleX, -scaleY, - scaleX, -scaleY, - -scaleX, scaleY, - scaleX, scaleY, - } - - // Standard OpenGL UVs: (0,0) at bottom-left, (1,1) at top-right. - // The SurfaceTexture transform matrix handles orientation. - uvs := [8]float32{ - 0, 0, - 1, 0, - 0, 1, - 1, 1, - } - - var stMat [16]float32 - - for { - select { - case <-renderStop: - return - default: - } - - if err := surfTex.UpdateTexImage(); err != nil { - continue - } - surfTex.TransformMatrix(&stMat) - - gles2.ClearColor(0, 0, 0, 1) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - - gles2.UseProgram(glProg) - gles2.ActiveTexture(gles2.Texture0) - gles2.BindTexture(gles2.TextureExternalOes, oesTex) - gles2.Uniform1i(sSamp, 0) - gles2.UniformMatrix4fv(uST, 1, gles2.Boolean(gles2.False), (*gles2.GLfloat)(&stMat[0])) - - gles2.EnableVertexAttribArray(gles2.GLuint(aPos)) - gles2.VertexAttribPointer(gles2.GLuint(aPos), 2, gles2.Float, gles2.Boolean(gles2.False), 0, unsafe.Pointer(&verts[0])) - - gles2.EnableVertexAttribArray(gles2.GLuint(aTex)) - gles2.VertexAttribPointer(gles2.GLuint(aTex), 2, gles2.Float, gles2.Boolean(gles2.False), 0, unsafe.Pointer(&uvs[0])) - - gles2.DrawArrays(gles2.TriangleStrip, 0, 4) - - gles2.DisableVertexAttribArray(gles2.GLuint(aPos)) - gles2.DisableVertexAttribArray(gles2.GLuint(aTex)) - - egl.SwapBuffers(eglDisp, eglSurf) - } -} - -func initEGL(win unsafe.Pointer) error { - var noDisplay egl.EGLNativeDisplayType - eglDisp = egl.GetDisplay(noDisplay) - if egl.Initialize(eglDisp, nil, nil) == 0 { - return fmt.Errorf("eglInitialize failed: 0x%x", egl.GetError()) - } - eglInited = true - - attribs := []egl.Int{ - egl.RenderableType, egl.OpenglEs2Bit, - egl.SurfaceType, egl.WindowBit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(eglDisp, &attribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - return fmt.Errorf("eglChooseConfig failed: 0x%x", egl.GetError()) - } - - ctxAttribs := []egl.Int{ - egl.ContextClientVersion, 2, - egl.None, - } - eglCtx = egl.CreateContext(eglDisp, config, nil, &ctxAttribs[0]) - if errCode := egl.GetError(); errCode != egl.EGL_SUCCESS { - return fmt.Errorf("eglCreateContext failed: 0x%x", errCode) - } - eglHasCtx = true - - eglSurf = egl.CreateWindowSurface(eglDisp, config, egl.EGLNativeWindowType(win), nil) - if errCode := egl.GetError(); errCode != egl.EGL_SUCCESS { - return fmt.Errorf("eglCreateWindowSurface failed: 0x%x", errCode) - } - eglHasSurf = true - - if egl.MakeCurrent(eglDisp, eglSurf, eglSurf, eglCtx) == 0 { - return fmt.Errorf("eglMakeCurrent failed: 0x%x", egl.GetError()) - } - - egl.SwapInterval(eglDisp, 1) - return nil -} - -func cleanupEGL() { - if eglInited { - var noSurface egl.EGLSurface - var noContext egl.EGLContext - egl.MakeCurrent(eglDisp, noSurface, noSurface, noContext) - if eglHasCtx { - egl.DestroyContext(eglDisp, eglCtx) - eglHasCtx = false - } - if eglHasSurf { - egl.DestroySurface(eglDisp, eglSurf) - eglHasSurf = false - } - egl.Terminate(eglDisp) - eglInited = false - } -} - -func createShaderProgram() (gles2.GLuint, error) { - vs, err := compileShader(gles2.VertexShader, vertexShaderSrc) - if err != nil { - return 0, fmt.Errorf("vertex shader: %w", err) - } - - fs, err := compileShader(gles2.FragmentShader, fragmentShaderSrc) - if err != nil { - gles2.DeleteShader(vs) - return 0, fmt.Errorf("fragment shader: %w", err) - } - - prog := gles2.CreateProgram() - gles2.AttachShader(prog, vs) - gles2.AttachShader(prog, fs) - gles2.LinkProgram(prog) - - var status gles2.GLint - gles2.GetProgramiv(prog, gles2.LinkStatus, &status) - if status == 0 { - gles2.DeleteProgram(prog) - gles2.DeleteShader(vs) - gles2.DeleteShader(fs) - return 0, fmt.Errorf("program link failed") - } - - gles2.DeleteShader(vs) - gles2.DeleteShader(fs) - return prog, nil -} - -func compileShader(shaderType gles2.Enum, source string) (gles2.GLuint, error) { - shader := gles2.CreateShader(shaderType) - - src := glStr(source) - // Pin the Go-allocated string data so cgocheck allows passing - // &src (Go pointer to Go pointer) to the C function. - var pinner runtime.Pinner - pinner.Pin(src) - defer pinner.Unpin() - - length := gles2.GLint(len(source)) - gles2.ShaderSource(shader, 1, &src, &length) - gles2.CompileShader(shader) - - var status gles2.GLint - gles2.GetShaderiv(shader, gles2.CompileStatus, &status) - if status == 0 { - gles2.DeleteShader(shader) - return 0, fmt.Errorf("compile failed for shader type %d", shaderType) - } - return shader, nil -} - -func stopPreview() { - if renderStop != nil { - close(renderStop) - renderMu.Lock() - renderMu.Unlock() - renderStop = nil - } - - cameraStarted = false - - if captureSess != nil { - captureSess.StopRepeating() - captureSess.Close() - captureSess = nil - } - if sessOutContainer != nil { - sessOutContainer.Close() - sessOutContainer = nil - } - if sessOut != nil { - sessOut.Close() - sessOut = nil - } - if outTarget != nil { - outTarget.Close() - outTarget = nil - } - if captureReq != nil { - captureReq.Close() - captureReq = nil - } - if camDev != nil { - camDev.Close() - camDev = nil - } - if camWindow != nil { - camWindow = nil - } - if surfTex != nil { - surfTex.Close() - surfTex = nil - } - if glProg != 0 { - gles2.DeleteProgram(glProg) - glProg = 0 - } - if oesTex != 0 { - gles2.DeleteTextures(1, &oesTex) - oesTex = 0 - } - - cleanupEGL() - - if camMgr != nil { - camMgr.Close() - camMgr = nil - } -} - -func showError(msg string) { - logError(msg) - - if currentWindow != nil { - jni.FillWindowColor(currentWindow, 0xFF0000CC) - } - - if currentActivity != nil { - jni.ShowToast(currentActivity.Pointer(), msg) - } -} - -func logInfo(msg string) { - ndklog.Write(int32(ndklog.Info), logTag, msg) -} - -func logError(msg string) { - ndklog.Write(int32(ndklog.Error), logTag, msg) -} - -// drainInputEvents polls the input queue and discards all events so -// Android's InputDispatcher does not trigger an ANR dialog. -func drainInputEvents() { - q := inputQueue - for { - select { - case <-inputStop: - return - default: - } - - ev := q.GetEvent() - if ev == nil { - time.Sleep(16 * time.Millisecond) - continue - } - - if !q.PreDispatchEvent(ev) { - q.FinishEvent(ev, 0) - } - } -} - -// glStr converts a Go string to a null-terminated *gles2.GLchar. -func glStr(s string) *gles2.GLchar { - b := make([]byte, len(s)+1) - copy(b, s) - return (*gles2.GLchar)(unsafe.Pointer(&b[0])) -} - -func main() {} diff --git a/examples/camera/manager/main.go b/examples/camera/manager/main.go deleted file mode 100644 index fea1c56..0000000 --- a/examples/camera/manager/main.go +++ /dev/null @@ -1,53 +0,0 @@ -// Camera manager lifecycle example. -// -// Demonstrates the simplest possible use of the camera package: creating a -// camera manager and closing it. The manager is the entry point to the -// Android Camera2 NDK API -- all camera discovery and device access starts -// here. -// -// Prerequisites: -// - This program must run on an Android device (API level 24+). -// - The android.permission.CAMERA runtime permission must be granted before -// any camera device can be opened. Manager creation itself does not -// require the permission, but subsequent operations (listing cameras, -// opening a device) will fail with ErrPermissionDenied (-10013) without it. -// - On Android 10+ the permission must be requested at runtime through the -// Java/Kotlin activity layer; it cannot be granted from native code alone. -package main - -import ( - "log" - - "github.com/AndroidGoLab/ndk/camera" -) - -func main() { - // Create a camera manager. This allocates the underlying - // ACameraManager and connects to the camera service. - mgr := camera.NewManager() - if mgr == nil { - log.Fatal("camera.NewManager returned nil") - } - log.Println("camera manager created") - - // The manager is ready. In a real application you would now: - // 1. Query available cameras (ACameraManager_getCameraIdList) - // 2. Retrieve camera metadata (ACameraManager_getCameraCharacteristics) - // 3. Open a camera device (ACameraManager_openCamera) - // - // All of these require android.permission.CAMERA to be granted. - // Without it the NDK functions return ErrPermissionDenied. - - // Close the manager to release native resources. - // Close is idempotent -- calling it again is harmless. - if err := mgr.Close(); err != nil { - log.Fatalf("manager close: %v", err) - } - log.Println("camera manager closed") - - // Demonstrate idempotent close. - if err := mgr.Close(); err != nil { - log.Fatalf("second close: %v", err) - } - log.Println("second close succeeded (no-op)") -} diff --git a/examples/camera/overview/main.go b/examples/camera/overview/main.go deleted file mode 100644 index ac0c813..0000000 --- a/examples/camera/overview/main.go +++ /dev/null @@ -1,190 +0,0 @@ -// Camera2 pipeline overview. -// -// Documents the complete Android Camera2 capture pipeline using the ndk -// camera package types. Each stage of the pipeline is shown in sequence with -// the types that participate. Because a real capture requires an -// ANativeWindow (obtained from a Surface), runtime camera permissions, and -// a running Android activity, this example cannot execute end-to-end on its -// own. It serves as a reference for the object graph and cleanup order. -// -// Pipeline summary: -// -// Manager -// -> open Device (via manager.OpenCamera) -// -> create CaptureRequest (via device.CreateCaptureRequest) -// -> create SessionOutputContainer -// -> add SessionOutput (wrapping an ANativeWindow) -// -> create CaptureSession (via device.CreateCaptureSession) -// -> set repeating request or single capture -// -> stop repeating -// <- close CaptureSession -// <- close Device -// <- close Manager -// -// Prerequisites: -// - Android device with API level 24+. -// - android.permission.CAMERA must be granted at runtime before opening -// any camera device. Without it the NDK returns camera.ErrPermissionDenied. -// - A valid ANativeWindow handle is needed to create OutputTarget and -// SessionOutput. Typically this comes from an Android Surface provided -// by SurfaceView, TextureView, or an ImageReader. -package main - -import ( - "log" - - "github.com/AndroidGoLab/ndk/camera" -) - -func main() { - // --------------------------------------------------------------- - // Stage 1: Manager - // - // The Manager is the root of the camera subsystem. It provides - // camera enumeration and device-open operations. - // --------------------------------------------------------------- - mgr := camera.NewManager() - if mgr == nil { - log.Fatal("camera.NewManager returned nil") - } - defer func() { - if err := mgr.Close(); err != nil { - log.Printf("manager close: %v", err) - } - log.Println("manager closed") - }() - log.Println("manager created") - - // In a real application, you would now call manager methods to - // enumerate camera IDs, then open a camera device with a - // device-state callback. - // - // The ACameraDevice_StateCallbacks struct receives disconnect and - // error notifications from the camera service. - - // --------------------------------------------------------------- - // Stage 2: Device - // - // A Device represents a single opened camera. It is obtained by - // calling the manager's open-camera method. Devices create capture - // requests and capture sessions. - // --------------------------------------------------------------- - // - // var device *camera.Device // obtained from manager.OpenCamera - // - // defer func() { - // if err := device.Close(); err != nil { - // log.Printf("device close: %v", err) - // } - // }() - - // --------------------------------------------------------------- - // Stage 3: CaptureRequest - // - // A CaptureRequest describes a single frame capture configuration. - // It is created from a Device using a TemplateType that supplies - // reasonable defaults: - // - // camera.Preview - viewfinder / preview - // camera.StillCapture - high-quality still photo - // camera.Record - video recording - // camera.VideoSnapshot - still image during video - // camera.ZeroShutterLag - near-zero-lag capture - // camera.Manual - fully manual control - // - // Created via: - // request, err := device.CreateCaptureRequest(camera.Preview) - // --------------------------------------------------------------- - // - // var request *camera.CaptureRequest - // defer request.Close() - - // --------------------------------------------------------------- - // Stage 4: OutputTarget - // - // An OutputTarget wraps an ANativeWindow and is added to a - // CaptureRequest to specify where captured frames are sent. - // Created via: - // target, err := camera.NewOutputTarget(nativeWindow) - // --------------------------------------------------------------- - // - // var target *camera.OutputTarget - // request.AddTarget(target) - // defer target.Close() - - // --------------------------------------------------------------- - // Stage 5: SessionOutput + SessionOutputContainer - // - // A SessionOutput also wraps an ANativeWindow and is registered in - // a SessionOutputContainer. The container is passed when creating a - // CaptureSession so the camera HAL knows which outputs to prepare. - // --------------------------------------------------------------- - // - // var sessionOutput *camera.SessionOutput - // // created via camera.NewSessionOutput(nativeWindow) - // - // var container *camera.SessionOutputContainer - // // created via camera.NewSessionOutputContainer() - // - // container.Add(sessionOutput) - // - // defer container.Close() - // defer sessionOutput.Close() - - // --------------------------------------------------------------- - // Stage 6: CaptureSession - // - // The CaptureSession is created from a Device with the output - // container and a state-callback struct. It manages the stream - // pipeline between the camera and the output surfaces. - // - // The capture session state callbacks receive ready, active, and - // closed notifications. - // - // Once created, submit capture requests: - // - setRepeatingRequest: continuous preview / recording - // - capture: single-shot capture - // --------------------------------------------------------------- - // - // var session *camera.CaptureSession - // // created via device.CreateCaptureSession(container, &callbacks) - // - // // Start continuous preview: - // // session.SetRepeatingRequest(&captureCallbacks, 1, &request) - // - // // Later, stop it: - // // session.StopRepeating() - // - // defer session.Close() - - // --------------------------------------------------------------- - // Cleanup order - // - // Resources must be released in reverse creation order: - // 1. session.Close() - stop capture pipeline - // 2. container.Close() - free output container - // 3. sessionOutput.Close() - free session output - // 4. target.Close() - free output target - // 5. request.Close() - free capture request - // 6. device.Close() - close camera device - // 7. mgr.Close() - delete camera manager - // - // All Close methods are idempotent and nil-safe. - // --------------------------------------------------------------- - - // --------------------------------------------------------------- - // Error handling - // - // Camera operations return camera.Error values. Key codes: - // camera.ErrPermissionDenied (-10013) - CAMERA permission not granted - // camera.ErrCameraInUse (-10010) - another app holds the camera - // camera.ErrCameraDisconnected (-10002) - camera physically removed - // camera.ErrCameraDevice (-10005) - fatal camera hardware error - // camera.ErrSessionClosed (-10007) - session invalidated - // - // Use errors.Is to check for specific failures: - // if errors.Is(err, camera.ErrPermissionDenied) { ... } - // --------------------------------------------------------------- - - log.Println("pipeline overview complete -- see source comments for details") -} diff --git a/examples/choreographer/vsync/main.go b/examples/choreographer/vsync/main.go deleted file mode 100644 index 479eecb..0000000 --- a/examples/choreographer/vsync/main.go +++ /dev/null @@ -1,43 +0,0 @@ -// Example: obtain the Android Choreographer singleton. -// -// AChoreographer is the central timing coordinator for frame production on -// Android. The display subsystem raises a vsync interrupt at the panel's -// refresh rate (typically 60, 90, or 120 Hz). AChoreographer exposes that -// signal to user-space so that game loops and rendering engines can start -// each frame's work at the optimal moment, avoiding jank caused by -// submitting frames out of phase with the display. -// -// A typical usage pattern in a game engine: -// -// 1. Obtain the singleton with GetInstance (one per Looper thread). -// 2. Register a frame callback via postFrameCallback. -// 3. Inside the callback, compute the delta from the previous vsync -// timestamp, advance simulation, record draw commands, and re-register -// the callback for the next frame. -// -// Because the choreographer is a process-wide singleton tied to the calling -// thread's Looper, it does not require explicit cleanup -- there is no -// Close method. -// -// This program must run on an Android device with NDK choreographer support. -package main - -import ( - "log" - - "github.com/AndroidGoLab/ndk/choreographer" -) - -func main() { - // Obtain the per-thread Choreographer singleton. On Android this - // returns the AChoreographer associated with the current thread's - // Looper. The returned handle is valid for the lifetime of the - // thread and must not be freed by the caller. - ch := choreographer.GetInstance() - if ch == nil { - log.Fatal("failed to get choreographer instance") - } - - log.Println("choreographer instance acquired") - log.Println("the application is now ready to post vsync-aligned frame callbacks") -} diff --git a/examples/config/device-config/main.go b/examples/config/device-config/main.go deleted file mode 100644 index 51b88dd..0000000 --- a/examples/config/device-config/main.go +++ /dev/null @@ -1,76 +0,0 @@ -// Example: query device configuration properties. -// -// Creates an AConfiguration, reads every available property (language, -// country, density, orientation, screen size, screen dimensions, and SDK -// version), and prints them. Language and Country are two-character ISO -// codes written through an out-parameter. -// -// On a real device the values reflect the current system locale and -// display settings. When run with a freshly created (empty) config, most -// fields return zero or blank, which is the expected default behavior. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/config" -) - -// orientationName returns a human-readable label for an orientation code. -func orientationName(v int32) string { - switch config.Orientation(v) { - case config.OrientationAny: - return "Any" - case config.OrientationPort: - return "Portrait" - case config.OrientationLand: - return "Landscape" - case config.OrientationSquare: - return "Square" - default: - return fmt.Sprintf("Unknown(%d)", v) - } -} - -// screenSizeName returns a human-readable label for a screen-size code. -func screenSizeName(v int32) string { - switch config.ScreenSize(v) { - case config.ScreensizeAny: - return "Any" - case config.ScreensizeSmall: - return "Small" - case config.ScreensizeNormal: - return "Normal" - case config.ScreensizeLarge: - return "Large" - case config.ScreensizeXlarge: - return "Xlarge" - default: - return fmt.Sprintf("Unknown(%d)", v) - } -} - -func main() { - cfg := config.NewConfig() - defer cfg.Close() - - // Language and Country write a 2-character code into a string buffer. - // Allocate 2-byte buffers as strings for each. - langBuf := string(make([]byte, 2)) - countryBuf := string(make([]byte, 2)) - cfg.Language(langBuf) - cfg.Country(countryBuf) - - fmt.Println("Device configuration:") - fmt.Println() - fmt.Printf(" Language: %q\n", langBuf) - fmt.Printf(" Country: %q\n", countryBuf) - fmt.Printf(" Density: %d dpi\n", cfg.Density()) - fmt.Printf(" Orientation: %s (%d)\n", orientationName(cfg.Orientation()), cfg.Orientation()) - fmt.Printf(" Screen size: %s (%d)\n", screenSizeName(cfg.ScreenSize()), cfg.ScreenSize()) - fmt.Printf(" Screen width: %d dp\n", cfg.ScreenWidthDp()) - fmt.Printf(" Screen height: %d dp\n", cfg.ScreenHeightDp()) - fmt.Printf(" SDK version: %d\n", cfg.SdkVersion()) -} diff --git a/examples/egl/config-query/main.go b/examples/egl/config-query/main.go deleted file mode 100644 index 2743347..0000000 --- a/examples/egl/config-query/main.go +++ /dev/null @@ -1,117 +0,0 @@ -// Example: EGL configuration attribute query. -// -// Demonstrates how to choose an EGL config and inspect its attributes. -// After selecting a config that supports pbuffers and OpenGL ES 2, the -// program queries and prints key framebuffer properties: color channel -// sizes, depth/stencil sizes, sample buffers, and more. -package main - -import ( - "fmt" - "os" - - "github.com/AndroidGoLab/ndk/egl" -) - -func fatal(msg string) { - fmt.Fprintf(os.Stderr, "error: %s (EGL error 0x%04X)\n", msg, egl.GetError()) - os.Exit(1) -} - -// getAttrib queries a single config attribute and returns it. -// Terminates the program on failure. -func getAttrib(display egl.EGLDisplay, config egl.EGLConfig, attr egl.Int) egl.Int { - var val egl.Int - if egl.GetConfigAttrib(display, config, attr, &val) == egl.False { - fatal(fmt.Sprintf("GetConfigAttrib(0x%04X) failed", attr)) - } - return val -} - -func main() { - // --- Display --- - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if display == nil { - fatal("GetDisplay returned EGL_NO_DISPLAY") - } - - var major, minor egl.Int - if egl.Initialize(display, &major, &minor) == egl.False { - fatal("Initialize failed") - } - defer egl.Terminate(display) - fmt.Printf("EGL %d.%d initialized\n", major, minor) - - // --- Choose config --- - // Ask for a config that supports pbuffers and OpenGL ES 2. - attribs := [...]egl.Int{ - egl.SurfaceType, egl.PbufferBit, - egl.RenderableType, egl.OpenglEs2Bit, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &attribs[0], &config, 1, &numConfigs) == egl.False { - fatal("ChooseConfig failed") - } - if numConfigs == 0 { - fatal("no matching configs found") - } - fmt.Printf("selected 1 config out of %d match(es)\n\n", numConfigs) - - // --- Query attributes --- - type attrInfo struct { - name string - id egl.Int - } - attributes := []attrInfo{ - {"Config ID", egl.ConfigID}, - {"Buffer Size (total bits)", egl.BufferSize}, - {"Red Size", egl.RedSize}, - {"Green Size", egl.GreenSize}, - {"Blue Size", egl.BlueSize}, - {"Alpha Size", egl.AlphaSize}, - {"Depth Size", egl.DepthSize}, - {"Stencil Size", egl.StencilSize}, - {"Samples", egl.EGL_SAMPLES}, - {"Sample Buffers", egl.EGL_SAMPLE_BUFFERS}, - {"Max Pbuffer Width", egl.EGL_MAX_PBUFFER_WIDTH}, - {"Max Pbuffer Height", egl.EGL_MAX_PBUFFER_HEIGHT}, - {"Max Pbuffer Pixels", egl.EGL_MAX_PBUFFER_PIXELS}, - {"Native Renderable", egl.EGL_NATIVE_RENDERABLE}, - {"Native Visual ID", egl.EGL_NATIVE_VISUAL_ID}, - {"Surface Type (bitmask)", egl.SurfaceType}, - {"Renderable Type (bitmask)", egl.RenderableType}, - {"Conformant (bitmask)", egl.EGL_CONFORMANT}, - {"Config Caveat", egl.EGL_CONFIG_CAVEAT}, - } - - fmt.Println("Config attributes:") - for _, a := range attributes { - val := getAttrib(display, config, a.id) - fmt.Printf(" %-30s = %d (0x%04X)\n", a.name, val, val) - } - - // --- Interpret some bitmask fields for readability --- - fmt.Println("\nSurface type flags:") - surfType := getAttrib(display, config, egl.SurfaceType) - printFlag(" Window", surfType, egl.WindowBit) - printFlag(" Pbuffer", surfType, egl.PbufferBit) - printFlag(" Pixmap", surfType, egl.EGL_PIXMAP_BIT) - - fmt.Println("Renderable type flags:") - rendType := getAttrib(display, config, egl.RenderableType) - printFlag(" OpenGL ES 2", rendType, egl.OpenglEs2Bit) - printFlag(" OpenGL ES 3", rendType, egl.OpenglEs3Bit) - - fmt.Println("\ndone") -} - -func printFlag(label string, bitmask, flag egl.Int) { - if bitmask&flag != 0 { - fmt.Printf("%s: yes\n", label) - } else { - fmt.Printf("%s: no\n", label) - } -} diff --git a/examples/egl/initialize/main.go b/examples/egl/initialize/main.go deleted file mode 100644 index d6d2036..0000000 --- a/examples/egl/initialize/main.go +++ /dev/null @@ -1,56 +0,0 @@ -// Example: EGL initialization and display query. -// -// Demonstrates the basic EGL lifecycle: obtaining the default display, -// initializing it, querying vendor/version/extensions/client-API strings, -// and terminating. This is the minimal starting point for any EGL program. -package main - -import ( - "fmt" - "os" - - "github.com/AndroidGoLab/ndk/egl" -) - -func fatal(msg string) { - fmt.Fprintf(os.Stderr, "error: %s (EGL error 0x%04X)\n", msg, egl.GetError()) - os.Exit(1) -} - -func main() { - // 1. Obtain the default display connection. - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if display == nil { - fatal("GetDisplay returned EGL_NO_DISPLAY") - } - fmt.Println("obtained EGL display") - - // 2. Initialize EGL on that display. - var major, minor egl.Int - if egl.Initialize(display, &major, &minor) == egl.False { - fatal("Initialize failed") - } - fmt.Printf("EGL initialized: version %d.%d\n", major, minor) - - // 3. Query and print display strings. - queries := []struct { - label string - name egl.Int - }{ - {"Vendor", egl.EGL_VENDOR}, - {"Version", egl.EGL_VERSION}, - {"Client APIs", egl.EGL_CLIENT_APIS}, - {"Extensions", egl.EGL_EXTENSIONS}, - } - for _, q := range queries { - s := egl.QueryString(display, q.name) - fmt.Printf(" %-12s: %s\n", q.label, s) - } - - // 4. Terminate EGL. - if egl.Terminate(display) == egl.False { - fatal("Terminate failed") - } - fmt.Println("EGL terminated") -} diff --git a/examples/egl/offscreen-render/main.go b/examples/egl/offscreen-render/main.go deleted file mode 100644 index e628a30..0000000 --- a/examples/egl/offscreen-render/main.go +++ /dev/null @@ -1,166 +0,0 @@ -// EGL offscreen rendering with pbuffer and OpenGL ES 2. -// -// Demonstrates a complete offscreen render pipeline: EGL display -// initialization, config selection for ES2+pbuffer, pbuffer surface -// creation, ES2 context creation, making the context current, querying -// display strings, issuing GL clear commands, reading back pixels to -// verify the render, and orderly cleanup in reverse order. -// -// This pattern is the basis for headless GPU compute, offscreen -// render-to-texture, and screenshot capture on Android. -package main - -import ( - "fmt" - "os" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" -) - -// Pbuffer dimensions. -const ( - pbufWidth = 64 - pbufHeight = 64 -) - -func fatal(msg string) { - fmt.Fprintf(os.Stderr, "fatal: %s (EGL error 0x%04X)\n", msg, egl.GetError()) - os.Exit(1) -} - -func checkGL(context string) { - if err := gles2.GetError(); err != gles2.NoError { - fmt.Fprintf(os.Stderr, "fatal: GL error 0x%04X at %s\n", int32(err), context) - os.Exit(1) - } -} - -func main() { - // --- 1. Get default display --- - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if display == nil { - fatal("GetDisplay returned EGL_NO_DISPLAY") - } - fmt.Println("obtained EGL display") - - // --- 2. Initialize EGL --- - var major, minor egl.Int - if egl.Initialize(display, &major, &minor) == egl.False { - fatal("Initialize failed") - } - fmt.Printf("EGL %d.%d initialized\n", major, minor) - - // --- 3. Bind OpenGL ES API --- - if egl.BindAPI(egl.EGLenum(egl.OpenglEsApi)) == egl.False { - fatal("BindAPI(EGL_OPENGL_ES_API) failed") - } - - // --- 4. Choose config for ES2 + pbuffer --- - configAttribs := [...]egl.Int{ - egl.RenderableType, egl.OpenglEs2Bit, - egl.SurfaceType, egl.PbufferBit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.DepthSize, 0, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == egl.False { - fatal("ChooseConfig failed") - } - if numConfigs == 0 { - fatal("ChooseConfig returned 0 matching configs") - } - fmt.Printf("found %d matching config(s)\n", numConfigs) - - // --- 5. Create pbuffer surface --- - pbufAttribs := [...]egl.Int{ - egl.Width, pbufWidth, - egl.Height, pbufHeight, - egl.None, - } - surface := egl.CreatePbufferSurface(display, config, &pbufAttribs[0]) - if surface == nil { - fatal("CreatePbufferSurface failed") - } - fmt.Printf("created %dx%d pbuffer surface\n", pbufWidth, pbufHeight) - - // --- 6. Create ES2 context --- - ctxAttribs := [...]egl.Int{ - egl.ContextClientVersion, 2, - egl.None, - } - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - if ctx == nil { - fatal("CreateContext failed") - } - fmt.Println("created OpenGL ES 2 context") - - // --- 7. Make context current --- - if egl.MakeCurrent(display, surface, surface, ctx) == egl.False { - fatal("MakeCurrent failed") - } - fmt.Println("context is now current") - - // --- 8. Query display strings --- - queries := []struct { - label string - name egl.Int - }{ - {"Vendor", egl.EGL_VENDOR}, - {"Version", egl.EGL_VERSION}, - {"Client APIs", egl.EGL_CLIENT_APIS}, - {"Extensions", egl.EGL_EXTENSIONS}, - } - fmt.Println("\nEGL display info:") - for _, q := range queries { - s := egl.QueryString(display, q.name) - fmt.Printf(" %-12s: %s\n", q.label, s) - } - fmt.Println() - - // --- 9. Render: clear to teal (R=0, G=128, B=128, A=255) --- - gles2.Viewport(0, 0, gles2.GLsizei(pbufWidth), gles2.GLsizei(pbufHeight)) - gles2.ClearColor(0.0, 128.0/255.0, 128.0/255.0, 1.0) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - checkGL("Clear") - fmt.Println("cleared framebuffer to teal") - - // Swap buffers (a no-op for pbuffers, but included for completeness). - egl.SwapBuffers(display, surface) - - // --- 10. Verify by reading back a pixel --- - var pixel [4]byte - gles2.ReadPixels(0, 0, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(&pixel[0])) - checkGL("ReadPixels") - fmt.Printf("pixel at (0,0): R=%d G=%d B=%d A=%d\n", pixel[0], pixel[1], pixel[2], pixel[3]) - - if pixel[0] == 0 && pixel[1] == 128 && pixel[2] == 128 && pixel[3] == 255 { - fmt.Println("verified: pixel matches expected teal color") - } else { - fmt.Println("note: pixel values differ slightly (float-to-unorm rounding)") - } - - // --- 11. Cleanup in reverse order --- - // - // Unbind context, destroy context, destroy surface, terminate display. - // Using zero-value variables because EGLSurface/EGLContext/EGLDisplay - // are opaque void* typedefs and not nil-comparable in Go. - egl.MakeCurrent(display, nil, nil, nil) - fmt.Println("context unbound") - - egl.DestroyContext(display, ctx) - fmt.Println("context destroyed") - - egl.DestroySurface(display, surface) - fmt.Println("surface destroyed") - - egl.Terminate(display) - fmt.Println("EGL terminated") -} diff --git a/examples/egl/pbuffer-context/main.go b/examples/egl/pbuffer-context/main.go deleted file mode 100644 index 27c4e9d..0000000 --- a/examples/egl/pbuffer-context/main.go +++ /dev/null @@ -1,131 +0,0 @@ -// Example: offscreen pbuffer surface with an OpenGL ES 2 context. -// -// Demonstrates the full EGL setup for offscreen rendering: display init, -// config selection, pbuffer surface creation, context creation, making -// the context current, verifying it, and orderly cleanup. This pattern -// is the foundation for headless GPU compute or offscreen render-to-texture. -package main - -import ( - "fmt" - "os" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" -) - -func fatal(msg string) { - fmt.Fprintf(os.Stderr, "error: %s (EGL error 0x%04X)\n", msg, egl.GetError()) - os.Exit(1) -} - -func main() { - // --- Display --- - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if display == nil { - fatal("GetDisplay returned EGL_NO_DISPLAY") - } - - var major, minor egl.Int - if egl.Initialize(display, &major, &minor) == egl.False { - fatal("Initialize failed") - } - defer func() { - egl.Terminate(display) - fmt.Println("EGL terminated") - }() - fmt.Printf("EGL %d.%d initialized\n", major, minor) - - // --- Bind the OpenGL ES API --- - if egl.BindAPI(egl.EGLenum(egl.OpenglEsApi)) == egl.False { - fatal("BindAPI(EGL_OPENGL_ES_API) failed") - } - - // --- Config selection --- - // Request an RGBA8 config that supports pbuffer surfaces and ES2 rendering. - attribs := [...]egl.Int{ - egl.SurfaceType, egl.PbufferBit, - egl.RenderableType, egl.OpenglEs2Bit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.DepthSize, 0, - egl.StencilSize, 0, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &attribs[0], &config, 1, &numConfigs) == egl.False { - fatal("ChooseConfig failed") - } - if numConfigs == 0 { - fatal("ChooseConfig returned 0 matching configs") - } - fmt.Printf("found %d matching config(s)\n", numConfigs) - - // --- Pbuffer surface --- - pbufAttribs := [...]egl.Int{ - egl.Width, 64, - egl.Height, 64, - egl.None, - } - surface := egl.CreatePbufferSurface(display, config, &pbufAttribs[0]) - if surface == nil { - fatal("CreatePbufferSurface failed") - } - defer func() { - egl.DestroySurface(display, surface) - fmt.Println("surface destroyed") - }() - fmt.Println("created 64x64 pbuffer surface") - - // --- Context --- - ctxAttribs := [...]egl.Int{ - egl.ContextClientVersion, 2, - egl.None, - } - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - if ctx == nil { - fatal("CreateContext failed") - } - defer func() { - // Unbind before destroying. - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroyContext(display, ctx) - fmt.Println("context destroyed") - }() - fmt.Println("created OpenGL ES 2 context") - - // --- Make current --- - if egl.MakeCurrent(display, surface, surface, ctx) == egl.False { - fatal("MakeCurrent failed") - } - fmt.Println("context is now current") - - // --- Verify --- - cur := egl.GetCurrentContext() - if cur == nil { - fatal("GetCurrentContext returned EGL_NO_CONTEXT") - } - if unsafe.Pointer(cur) != unsafe.Pointer(ctx) { - fatal("GetCurrentContext does not match the context we created") - } - fmt.Println("verified: GetCurrentContext matches our context") - - curDisplay := egl.GetCurrentDisplay() - if curDisplay == nil { - fatal("GetCurrentDisplay returned EGL_NO_DISPLAY") - } - fmt.Println("verified: GetCurrentDisplay is valid") - - // Query the actual pbuffer dimensions. - var w, h egl.Int - egl.QuerySurface(display, surface, egl.Width, &w) - egl.QuerySurface(display, surface, egl.Height, &h) - fmt.Printf("pbuffer surface dimensions: %dx%d\n", w, h) - - // At this point OpenGL ES commands can be issued. - fmt.Println("ready for OpenGL ES rendering (not demonstrated here)") -} diff --git a/examples/gles2/clear-screen/main.go b/examples/gles2/clear-screen/main.go deleted file mode 100644 index f856fa2..0000000 --- a/examples/gles2/clear-screen/main.go +++ /dev/null @@ -1,121 +0,0 @@ -// Simplest GLES2 example: clear the framebuffer to a known color and verify. -// -// Demonstrates: -// - EGL offscreen context setup (pbuffer surface) -// - Setting the clear color with ClearColor -// - Clearing the color buffer with Clear -// - Reading back pixels with ReadPixels to confirm the result -// -// This is the "hello world" of OpenGL ES -- no shaders, no geometry, just -// proving that the GPU pipeline is alive by writing and reading a pixel. -package main - -import ( - "fmt" - "os" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" -) - -func fatal(msg string) { - fmt.Fprintf(os.Stderr, "fatal: %s (EGL error 0x%04X)\n", msg, egl.GetError()) - os.Exit(1) -} - -func checkGL(context string) { - if err := gles2.GetError(); err != gles2.NoError { - fmt.Fprintf(os.Stderr, "fatal: GL error 0x%04X at %s\n", int32(err), context) - os.Exit(1) - } -} - -func main() { - // --- EGL initialization --- - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if display == nil { - fatal("GetDisplay returned EGL_NO_DISPLAY") - } - - var major, minor egl.Int - if egl.Initialize(display, &major, &minor) == 0 { - fatal("Initialize failed") - } - defer egl.Terminate(display) - fmt.Printf("EGL %d.%d\n", major, minor) - - if egl.BindAPI(egl.EGLenum(egl.OpenglEsApi)) == 0 { - fatal("BindAPI failed") - } - - // Request an RGBA8 pbuffer config with ES2 support. - configAttribs := [...]egl.Int{ - egl.SurfaceType, egl.PbufferBit, - egl.RenderableType, egl.OpenglEs2Bit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - fatal("ChooseConfig failed") - } - - // Create a small offscreen surface. - const width, height = 4, 4 - pbufAttribs := [...]egl.Int{ - egl.Width, width, - egl.Height, height, - egl.None, - } - surface := egl.CreatePbufferSurface(display, config, &pbufAttribs[0]) - if surface == nil { - fatal("CreatePbufferSurface failed") - } - defer egl.DestroySurface(display, surface) - - ctxAttribs := [...]egl.Int{ - egl.ContextClientVersion, 2, - egl.None, - } - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - if ctx == nil { - fatal("CreateContext failed") - } - defer func() { - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroyContext(display, ctx) - }() - - if egl.MakeCurrent(display, surface, surface, ctx) == 0 { - fatal("MakeCurrent failed") - } - fmt.Println("GL context is current") - - // --- Clear to cornflower blue (R=100, G=149, B=237, A=255) --- - gles2.Viewport(0, 0, width, height) - gles2.ClearColor(100.0/255.0, 149.0/255.0, 237.0/255.0, 1.0) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - checkGL("Clear") - - // --- Read back pixel (0,0) and verify --- - var pixel [4]byte - gles2.ReadPixels(0, 0, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(&pixel[0])) - checkGL("ReadPixels") - - fmt.Printf("pixel at (0,0): R=%d G=%d B=%d A=%d\n", pixel[0], pixel[1], pixel[2], pixel[3]) - - // Allow small rounding differences from float-to-unorm conversion. - if pixel[0] != 100 || pixel[1] != 149 || pixel[2] != 237 || pixel[3] != 255 { - fmt.Fprintf(os.Stderr, "warning: pixel does not match expected cornflower blue (100,149,237,255)\n") - } else { - fmt.Println("verified: clear color matches") - } - - fmt.Println("done") -} diff --git a/examples/gles2/framebuffer/main.go b/examples/gles2/framebuffer/main.go deleted file mode 100644 index 9fbd40c..0000000 --- a/examples/gles2/framebuffer/main.go +++ /dev/null @@ -1,379 +0,0 @@ -// Render-to-texture via an offscreen framebuffer object (FBO). -// -// Demonstrates: -// - Creating a texture to serve as a color attachment -// - Creating an FBO and attaching the texture with FramebufferTexture2D -// - Checking framebuffer completeness with CheckFramebufferStatus -// - Rendering a triangle into the FBO (offscreen) -// - Reading back pixels from the FBO with ReadPixels -// - Binding the FBO texture and sampling it in a second pass -// -// The program performs two render passes: -// 1. Render a green triangle into a 32x32 FBO texture. -// 2. Bind that texture and draw a fullscreen quad onto the default -// framebuffer (64x64 pbuffer), effectively displaying the FBO contents. -// -// Both passes are verified by reading back pixels. -package main - -import ( - "fmt" - "os" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" -) - -func fatal(msg string) { - fmt.Fprintf(os.Stderr, "fatal: %s (EGL error 0x%04X)\n", msg, egl.GetError()) - os.Exit(1) -} - -func fatalGL(msg string) { - fmt.Fprintf(os.Stderr, "fatal: %s (GL error 0x%04X)\n", msg, int32(gles2.GetError())) - os.Exit(1) -} - -func checkGL(context string) { - if err := gles2.GetError(); err != gles2.NoError { - fmt.Fprintf(os.Stderr, "fatal: GL error 0x%04X at %s\n", int32(err), context) - os.Exit(1) - } -} - -func glStr(s string) *gles2.GLchar { - b := make([]byte, len(s)+1) - copy(b, s) - return (*gles2.GLchar)(unsafe.Pointer(&b[0])) -} - -func compileShader(shaderType gles2.Enum, source string) gles2.GLuint { - shader := gles2.CreateShader(shaderType) - if shader == 0 { - fatalGL("CreateShader returned 0") - } - src := glStr(source) - length := gles2.GLint(len(source)) - gles2.ShaderSource(shader, 1, &src, &length) - gles2.CompileShader(shader) - - var status gles2.GLint - gles2.GetShaderiv(shader, gles2.CompileStatus, &status) - if status == 0 { - gles2.DeleteShader(shader) - fatalGL("shader compilation failed") - } - return shader -} - -func linkProgram(vertShader, fragShader gles2.GLuint) gles2.GLuint { - program := gles2.CreateProgram() - if program == 0 { - fatalGL("CreateProgram returned 0") - } - gles2.AttachShader(program, vertShader) - gles2.AttachShader(program, fragShader) - gles2.LinkProgram(program) - - var status gles2.GLint - gles2.GetProgramiv(program, gles2.LinkStatus, &status) - if status == 0 { - gles2.DeleteProgram(program) - fatalGL("program linking failed") - } - return program -} - -// --- Shaders for pass 1: solid-color triangle --- - -const pass1VertSrc = ` -attribute vec2 aPosition; -void main() { - gl_Position = vec4(aPosition, 0.0, 1.0); -} -` - -const pass1FragSrc = ` -precision mediump float; -void main() { - gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); -} -` - -// --- Shaders for pass 2: textured fullscreen quad --- - -const pass2VertSrc = ` -attribute vec2 aPosition; -attribute vec2 aTexCoord; -varying vec2 vTexCoord; -void main() { - gl_Position = vec4(aPosition, 0.0, 1.0); - vTexCoord = aTexCoord; -} -` - -const pass2FragSrc = ` -precision mediump float; -varying vec2 vTexCoord; -uniform sampler2D uTexture; -void main() { - gl_FragColor = texture2D(uTexture, vTexCoord); -} -` - -func main() { - // --- EGL setup --- - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if display == nil { - fatal("GetDisplay returned EGL_NO_DISPLAY") - } - var major, minor egl.Int - if egl.Initialize(display, &major, &minor) == 0 { - fatal("Initialize failed") - } - defer egl.Terminate(display) - - if egl.BindAPI(egl.EGLenum(egl.OpenglEsApi)) == 0 { - fatal("BindAPI failed") - } - - configAttribs := [...]egl.Int{ - egl.SurfaceType, egl.PbufferBit, - egl.RenderableType, egl.OpenglEs2Bit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - fatal("ChooseConfig failed") - } - - const defaultWidth, defaultHeight = 64, 64 - pbufAttribs := [...]egl.Int{ - egl.Width, defaultWidth, - egl.Height, defaultHeight, - egl.None, - } - surface := egl.CreatePbufferSurface(display, config, &pbufAttribs[0]) - if surface == nil { - fatal("CreatePbufferSurface failed") - } - defer egl.DestroySurface(display, surface) - - ctxAttribs := [...]egl.Int{ - egl.ContextClientVersion, 2, - egl.None, - } - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - if ctx == nil { - fatal("CreateContext failed") - } - defer func() { - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroyContext(display, ctx) - }() - - if egl.MakeCurrent(display, surface, surface, ctx) == 0 { - fatal("MakeCurrent failed") - } - fmt.Println("GL context ready") - - // ===================================================================== - // Create FBO with a color texture attachment - // ===================================================================== - - const fboWidth, fboHeight = 32, 32 - - // Create the texture that will receive the FBO output. - var fboTex gles2.GLuint - gles2.GenTextures(1, &fboTex) - gles2.BindTexture(gles2.Texture2d, fboTex) - gles2.TexParameteri(gles2.Texture2d, gles2.TextureMinFilter, gles2.GLint(gles2.Nearest)) - gles2.TexParameteri(gles2.Texture2d, gles2.TextureMagFilter, gles2.GLint(gles2.Nearest)) - gles2.TexParameteri(gles2.Texture2d, gles2.TextureWrapS, gles2.GLint(gles2.ClampToEdge)) - gles2.TexParameteri(gles2.Texture2d, gles2.TextureWrapT, gles2.GLint(gles2.ClampToEdge)) - // Allocate storage with no initial data. - gles2.TexImage2D( - gles2.Texture2d, 0, gles2.GLint(gles2.Rgba), - fboWidth, fboHeight, 0, - gles2.Rgba, gles2.UnsignedByte, nil, - ) - checkGL("FBO texture creation") - defer gles2.DeleteTextures(1, &fboTex) - - // Create the framebuffer and attach the texture. - var fbo gles2.GLuint - gles2.GenFramebuffers(1, &fbo) - gles2.BindFramebuffer(gles2.Framebuffer, fbo) - gles2.FramebufferTexture2D( - gles2.Framebuffer, gles2.ColorAttachment0, - gles2.Texture2d, fboTex, 0, - ) - - status := gles2.CheckFramebufferStatus(gles2.Framebuffer) - if status != gles2.FramebufferComplete { - fmt.Fprintf(os.Stderr, "fatal: framebuffer incomplete (status 0x%04X)\n", int32(status)) - os.Exit(1) - } - defer gles2.DeleteFramebuffers(1, &fbo) - fmt.Println("FBO created and complete") - - // ===================================================================== - // Pass 1: Render a green triangle into the FBO - // ===================================================================== - - vs1 := compileShader(gles2.VertexShader, pass1VertSrc) - defer gles2.DeleteShader(vs1) - fs1 := compileShader(gles2.FragmentShader, pass1FragSrc) - defer gles2.DeleteShader(fs1) - prog1 := linkProgram(vs1, fs1) - defer gles2.DeleteProgram(prog1) - - posLoc1 := gles2.GetAttribLocation(prog1, glStr("aPosition")) - if posLoc1 < 0 { - fatalGL("GetAttribLocation(aPosition) for pass1") - } - - // Triangle vertices (clip space). - triVerts := [...]float32{ - 0.0, 0.8, - -0.8, -0.8, - 0.8, -0.8, - } - var triVBO gles2.GLuint - gles2.GenBuffers(1, &triVBO) - gles2.BindBuffer(gles2.ArrayBuffer, triVBO) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(triVerts)), - unsafe.Pointer(&triVerts[0]), - gles2.StaticDraw, - ) - defer gles2.DeleteBuffers(1, &triVBO) - - // Render into the FBO (already bound). - gles2.Viewport(0, 0, fboWidth, fboHeight) - gles2.ClearColor(0.2, 0.2, 0.2, 1.0) // dark gray background - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - - gles2.UseProgram(prog1) - gles2.EnableVertexAttribArray(gles2.GLuint(posLoc1)) - gles2.VertexAttribPointer(gles2.GLuint(posLoc1), 2, gles2.Float, gles2.Boolean(gles2.False), 0, nil) - gles2.DrawArrays(gles2.Triangles, 0, 3) - gles2.DisableVertexAttribArray(gles2.GLuint(posLoc1)) - gles2.Finish() - checkGL("pass 1 render") - - // Verify: read the center pixel from the FBO (should be green). - var fboCenter [4]byte - gles2.ReadPixels(fboWidth/2, fboHeight/2, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(&fboCenter[0])) - fmt.Printf("FBO center pixel: R=%d G=%d B=%d A=%d\n", fboCenter[0], fboCenter[1], fboCenter[2], fboCenter[3]) - if fboCenter[1] == 255 && fboCenter[0] == 0 && fboCenter[2] == 0 { - fmt.Println("verified: FBO center is green (triangle rendered correctly)") - } - - // Verify: read a corner pixel from the FBO (should be dark gray). - var fboCorner [4]byte - gles2.ReadPixels(0, 0, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(&fboCorner[0])) - fmt.Printf("FBO corner pixel: R=%d G=%d B=%d A=%d\n", fboCorner[0], fboCorner[1], fboCorner[2], fboCorner[3]) - - // ===================================================================== - // Pass 2: Draw the FBO texture onto the default framebuffer - // ===================================================================== - - vs2 := compileShader(gles2.VertexShader, pass2VertSrc) - defer gles2.DeleteShader(vs2) - fs2 := compileShader(gles2.FragmentShader, pass2FragSrc) - defer gles2.DeleteShader(fs2) - prog2 := linkProgram(vs2, fs2) - defer gles2.DeleteProgram(prog2) - - posLoc2 := gles2.GetAttribLocation(prog2, glStr("aPosition")) - texLoc2 := gles2.GetAttribLocation(prog2, glStr("aTexCoord")) - samplerLoc2 := gles2.GetUniformLocation(prog2, glStr("uTexture")) - if posLoc2 < 0 || texLoc2 < 0 || samplerLoc2 < 0 { - fatalGL("failed to look up pass2 shader locations") - } - - // Fullscreen quad: position + texcoord interleaved. - type vertex struct { - x, y float32 - s, t float32 - } - quadVerts := [...]vertex{ - {-1, -1, 0, 0}, - {1, -1, 1, 0}, - {1, 1, 1, 1}, - {-1, 1, 0, 1}, - } - quadIndices := [...]uint16{0, 1, 2, 0, 2, 3} - - var quadVBO gles2.GLuint - gles2.GenBuffers(1, &quadVBO) - gles2.BindBuffer(gles2.ArrayBuffer, quadVBO) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(quadVerts)), - unsafe.Pointer(&quadVerts[0]), - gles2.StaticDraw, - ) - defer gles2.DeleteBuffers(1, &quadVBO) - - var quadEBO gles2.GLuint - gles2.GenBuffers(1, &quadEBO) - gles2.BindBuffer(gles2.ElementArrayBuffer, quadEBO) - gles2.BufferData( - gles2.ElementArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(quadIndices)), - unsafe.Pointer(&quadIndices[0]), - gles2.StaticDraw, - ) - defer gles2.DeleteBuffers(1, &quadEBO) - - // Switch to the default framebuffer. - gles2.BindFramebuffer(gles2.Framebuffer, 0) - gles2.Viewport(0, 0, defaultWidth, defaultHeight) - gles2.ClearColor(0, 0, 0, 1) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - - // Bind the FBO texture. - gles2.ActiveTexture(gles2.Texture0) - gles2.BindTexture(gles2.Texture2d, fboTex) - - gles2.UseProgram(prog2) - gles2.Uniform1i(samplerLoc2, 0) - - stride := gles2.GLsizei(unsafe.Sizeof(vertex{})) - - gles2.EnableVertexAttribArray(gles2.GLuint(posLoc2)) - gles2.VertexAttribPointer(gles2.GLuint(posLoc2), 2, gles2.Float, gles2.Boolean(gles2.False), stride, nil) - - texOffset := unsafe.Pointer(uintptr(2 * unsafe.Sizeof(float32(0)))) - gles2.EnableVertexAttribArray(gles2.GLuint(texLoc2)) - gles2.VertexAttribPointer(gles2.GLuint(texLoc2), 2, gles2.Float, gles2.Boolean(gles2.False), stride, texOffset) - - gles2.DrawElements(gles2.Triangles, 6, gles2.GL_UNSIGNED_SHORT, nil) - checkGL("pass 2 render") - - gles2.DisableVertexAttribArray(gles2.GLuint(posLoc2)) - gles2.DisableVertexAttribArray(gles2.GLuint(texLoc2)) - gles2.Finish() - - // Verify: the default framebuffer should now contain the FBO image. - var defaultCenter [4]byte - gles2.ReadPixels(defaultWidth/2, defaultHeight/2, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(&defaultCenter[0])) - fmt.Printf("default FB center pixel: R=%d G=%d B=%d A=%d\n", - defaultCenter[0], defaultCenter[1], defaultCenter[2], defaultCenter[3]) - - if defaultCenter[1] == 255 && defaultCenter[0] == 0 && defaultCenter[2] == 0 { - fmt.Println("verified: FBO contents transferred to default framebuffer") - } - - fmt.Println("done") -} diff --git a/examples/gles2/texture/main.go b/examples/gles2/texture/main.go deleted file mode 100644 index b20c63f..0000000 --- a/examples/gles2/texture/main.go +++ /dev/null @@ -1,347 +0,0 @@ -// Textured quad: upload pixel data to a texture and render it on a quad. -// -// Demonstrates: -// - Creating and configuring a GL texture (GenTextures, BindTexture, -// TexParameteri, TexImage2D) -// - Using texture coordinates in shaders to sample from the texture -// - Drawing a quad as two triangles via an element buffer (DrawElements) -// - Reading back pixels to verify texture sampling -// -// A 2x2 checkerboard texture (red/green/blue/white) is created from raw -// pixel data and mapped onto a fullscreen quad. The program reads back the -// four quadrant centers to verify correct texturing. -package main - -import ( - "fmt" - "os" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" -) - -func fatal(msg string) { - fmt.Fprintf(os.Stderr, "fatal: %s (EGL error 0x%04X)\n", msg, egl.GetError()) - os.Exit(1) -} - -func fatalGL(msg string) { - fmt.Fprintf(os.Stderr, "fatal: %s (GL error 0x%04X)\n", msg, int32(gles2.GetError())) - os.Exit(1) -} - -func checkGL(context string) { - if err := gles2.GetError(); err != gles2.NoError { - fmt.Fprintf(os.Stderr, "fatal: GL error 0x%04X at %s\n", int32(err), context) - os.Exit(1) - } -} - -func glStr(s string) *gles2.GLchar { - b := make([]byte, len(s)+1) - copy(b, s) - return (*gles2.GLchar)(unsafe.Pointer(&b[0])) -} - -func compileShader(shaderType gles2.Enum, source string) gles2.GLuint { - shader := gles2.CreateShader(shaderType) - if shader == 0 { - fatalGL("CreateShader returned 0") - } - src := glStr(source) - length := gles2.GLint(len(source)) - gles2.ShaderSource(shader, 1, &src, &length) - gles2.CompileShader(shader) - - var status gles2.GLint - gles2.GetShaderiv(shader, gles2.CompileStatus, &status) - if status == 0 { - gles2.DeleteShader(shader) - fatalGL("shader compilation failed") - } - return shader -} - -func linkProgram(vertShader, fragShader gles2.GLuint) gles2.GLuint { - program := gles2.CreateProgram() - if program == 0 { - fatalGL("CreateProgram returned 0") - } - gles2.AttachShader(program, vertShader) - gles2.AttachShader(program, fragShader) - gles2.LinkProgram(program) - - var status gles2.GLint - gles2.GetProgramiv(program, gles2.LinkStatus, &status) - if status == 0 { - gles2.DeleteProgram(program) - fatalGL("program linking failed") - } - return program -} - -// Vertex shader: fullscreen quad with texture coordinates. -// Each vertex carries a 2D position and a 2D texcoord. -const vertSrc = ` -attribute vec2 aPosition; -attribute vec2 aTexCoord; -varying vec2 vTexCoord; -void main() { - gl_Position = vec4(aPosition, 0.0, 1.0); - vTexCoord = aTexCoord; -} -` - -// Fragment shader: samples a 2D texture. -const fragSrc = ` -precision mediump float; -varying vec2 vTexCoord; -uniform sampler2D uTexture; -void main() { - gl_FragColor = texture2D(uTexture, vTexCoord); -} -` - -func main() { - // --- EGL setup --- - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if display == nil { - fatal("GetDisplay returned EGL_NO_DISPLAY") - } - var major, minor egl.Int - if egl.Initialize(display, &major, &minor) == 0 { - fatal("Initialize failed") - } - defer egl.Terminate(display) - - if egl.BindAPI(egl.EGLenum(egl.OpenglEsApi)) == 0 { - fatal("BindAPI failed") - } - - configAttribs := [...]egl.Int{ - egl.SurfaceType, egl.PbufferBit, - egl.RenderableType, egl.OpenglEs2Bit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - fatal("ChooseConfig failed") - } - - const width, height = 64, 64 - pbufAttribs := [...]egl.Int{ - egl.Width, width, - egl.Height, height, - egl.None, - } - surface := egl.CreatePbufferSurface(display, config, &pbufAttribs[0]) - if surface == nil { - fatal("CreatePbufferSurface failed") - } - defer egl.DestroySurface(display, surface) - - ctxAttribs := [...]egl.Int{ - egl.ContextClientVersion, 2, - egl.None, - } - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - if ctx == nil { - fatal("CreateContext failed") - } - defer func() { - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroyContext(display, ctx) - }() - - if egl.MakeCurrent(display, surface, surface, ctx) == 0 { - fatal("MakeCurrent failed") - } - fmt.Println("GL context ready") - - // --- Create a 2x2 RGBA checkerboard texture --- - // - // (0,1) green | (1,1) white - // -------------|------------- - // (0,0) red | (1,0) blue - // - // In memory, texels are stored bottom-to-top, left-to-right. - texPixels := [...]byte{ - // Row 0 (bottom): red, blue - 255, 0, 0, 255, 0, 0, 255, 255, - // Row 1 (top): green, white - 0, 255, 0, 255, 255, 255, 255, 255, - } - - var tex gles2.GLuint - gles2.GenTextures(1, &tex) - gles2.ActiveTexture(gles2.Texture0) - gles2.BindTexture(gles2.Texture2d, tex) - // Use nearest filtering so that each quadrant samples exactly one texel. - gles2.TexParameteri(gles2.Texture2d, gles2.TextureMinFilter, gles2.GLint(gles2.Nearest)) - gles2.TexParameteri(gles2.Texture2d, gles2.TextureMagFilter, gles2.GLint(gles2.Nearest)) - gles2.TexParameteri(gles2.Texture2d, gles2.TextureWrapS, gles2.GLint(gles2.ClampToEdge)) - gles2.TexParameteri(gles2.Texture2d, gles2.TextureWrapT, gles2.GLint(gles2.ClampToEdge)) - gles2.TexImage2D( - gles2.Texture2d, - 0, // mip level 0 - gles2.GLint(gles2.Rgba), // internal format - 2, 2, // width, height - 0, // border (must be 0 in ES2) - gles2.Rgba, // format - gles2.UnsignedByte, // type - unsafe.Pointer(&texPixels[0]), - ) - checkGL("TexImage2D") - defer gles2.DeleteTextures(1, &tex) - fmt.Println("2x2 texture created") - - // --- Compile shaders and link program --- - vs := compileShader(gles2.VertexShader, vertSrc) - defer gles2.DeleteShader(vs) - - fs := compileShader(gles2.FragmentShader, fragSrc) - defer gles2.DeleteShader(fs) - - program := linkProgram(vs, fs) - defer gles2.DeleteProgram(program) - fmt.Println("shader program linked") - - posLoc := gles2.GetAttribLocation(program, glStr("aPosition")) - texLoc := gles2.GetAttribLocation(program, glStr("aTexCoord")) - samplerLoc := gles2.GetUniformLocation(program, glStr("uTexture")) - if posLoc < 0 || texLoc < 0 || samplerLoc < 0 { - fatalGL("failed to look up shader locations") - } - - // --- Set up quad geometry --- - // A fullscreen quad from two triangles. Each vertex has: - // position (x, y) and texcoord (s, t). - // - // (-1,1)---(1,1) (0,1)---(1,1) - // | \ | | \ | - // | \ | => | \ | texcoords - // | \ | | \ | - // (-1,-1)--(1,-1) (0,0)---(1,0) - // - type vertex struct { - x, y float32 // position - s, t float32 // texcoord - } - quadVerts := [...]vertex{ - {-1, -1, 0, 0}, // bottom-left - {1, -1, 1, 0}, // bottom-right - {1, 1, 1, 1}, // top-right - {-1, 1, 0, 1}, // top-left - } - - // Element indices for two triangles. - indices := [...]uint16{ - 0, 1, 2, // first triangle - 0, 2, 3, // second triangle - } - - var vbo gles2.GLuint - gles2.GenBuffers(1, &vbo) - gles2.BindBuffer(gles2.ArrayBuffer, vbo) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(quadVerts)), - unsafe.Pointer(&quadVerts[0]), - gles2.StaticDraw, - ) - defer gles2.DeleteBuffers(1, &vbo) - - var ebo gles2.GLuint - gles2.GenBuffers(1, &ebo) - gles2.BindBuffer(gles2.ElementArrayBuffer, ebo) - gles2.BufferData( - gles2.ElementArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(indices)), - unsafe.Pointer(&indices[0]), - gles2.StaticDraw, - ) - defer gles2.DeleteBuffers(1, &ebo) - checkGL("buffer setup") - - // --- Render the textured quad --- - gles2.Viewport(0, 0, width, height) - gles2.ClearColor(0, 0, 0, 1) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - - gles2.UseProgram(program) - gles2.Uniform1i(samplerLoc, 0) // texture unit 0 - - stride := gles2.GLsizei(unsafe.Sizeof(vertex{})) - - gles2.EnableVertexAttribArray(gles2.GLuint(posLoc)) - gles2.VertexAttribPointer( - gles2.GLuint(posLoc), - 2, // vec2 - gles2.Float, - gles2.Boolean(gles2.False), - stride, - nil, // offset 0 - ) - - // texcoord offset = 2 floats = 8 bytes into each vertex - texOffset := unsafe.Pointer(uintptr(2 * unsafe.Sizeof(float32(0)))) - gles2.EnableVertexAttribArray(gles2.GLuint(texLoc)) - gles2.VertexAttribPointer( - gles2.GLuint(texLoc), - 2, // vec2 - gles2.Float, - gles2.Boolean(gles2.False), - stride, - texOffset, - ) - - gles2.DrawElements(gles2.Triangles, 6, gles2.GL_UNSIGNED_SHORT, nil) - checkGL("DrawElements") - - gles2.DisableVertexAttribArray(gles2.GLuint(posLoc)) - gles2.DisableVertexAttribArray(gles2.GLuint(texLoc)) - gles2.Finish() - - // --- Verify by reading back quadrant centers --- - // The 2x2 texture maps to 4 quadrants of the 64x64 viewport. - type check struct { - name string - x, y gles2.GLint - r, g, b byte - } - checks := []check{ - {"bottom-left (red)", width / 4, height / 4, 255, 0, 0}, - {"bottom-right (blue)", 3 * width / 4, height / 4, 0, 0, 255}, - {"top-left (green)", width / 4, 3 * height / 4, 0, 255, 0}, - {"top-right (white)", 3 * width / 4, 3 * height / 4, 255, 255, 255}, - } - - allOK := true - for _, c := range checks { - var pixel [4]byte - gles2.ReadPixels(c.x, c.y, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(&pixel[0])) - match := pixel[0] == c.r && pixel[1] == c.g && pixel[2] == c.b - result := "OK" - if !match { - result = "MISMATCH" - allOK = false - } - fmt.Printf(" %-25s got (%3d,%3d,%3d) expected (%3d,%3d,%3d) [%s]\n", - c.name, pixel[0], pixel[1], pixel[2], c.r, c.g, c.b, result) - } - - if allOK { - fmt.Println("verified: all quadrants match the checkerboard texture") - } else { - fmt.Println("warning: some quadrants did not match") - } - - fmt.Println("done") -} diff --git a/examples/gles2/triangle/main.go b/examples/gles2/triangle/main.go deleted file mode 100644 index 02f9765..0000000 --- a/examples/gles2/triangle/main.go +++ /dev/null @@ -1,270 +0,0 @@ -// Hello Triangle: the classic first OpenGL ES 2.0 program. -// -// Demonstrates: -// - Compiling a vertex shader and a fragment shader -// - Linking them into a program -// - Uploading triangle vertex data into a VBO -// - Setting up vertex attribute pointers -// - Drawing with DrawArrays -// - Reading back pixels to verify the triangle was rasterized -// -// The triangle covers the center of a 64x64 pbuffer. After rendering, the -// program reads back the center pixel (which should be inside the triangle) -// and a corner pixel (which should be the clear color) to confirm correctness. -package main - -import ( - "fmt" - "os" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" -) - -func fatal(msg string) { - fmt.Fprintf(os.Stderr, "fatal: %s (EGL error 0x%04X)\n", msg, egl.GetError()) - os.Exit(1) -} - -func fatalGL(msg string) { - fmt.Fprintf(os.Stderr, "fatal: %s (GL error 0x%04X)\n", msg, int32(gles2.GetError())) - os.Exit(1) -} - -func checkGL(context string) { - if err := gles2.GetError(); err != gles2.NoError { - fmt.Fprintf(os.Stderr, "fatal: GL error 0x%04X at %s\n", int32(err), context) - os.Exit(1) - } -} - -// glStr converts a Go string to a null-terminated GLchar slice and returns -// a pointer to the first element, suitable for passing to ShaderSource. -func glStr(s string) *gles2.GLchar { - b := make([]byte, len(s)+1) - copy(b, s) - return (*gles2.GLchar)(unsafe.Pointer(&b[0])) -} - -// compileShader creates, sources, and compiles a shader of the given type. -// It returns the shader name or exits on failure. -func compileShader(shaderType gles2.Enum, source string) gles2.GLuint { - shader := gles2.CreateShader(shaderType) - if shader == 0 { - fatalGL("CreateShader returned 0") - } - - src := glStr(source) - length := gles2.GLint(len(source)) - gles2.ShaderSource(shader, 1, &src, &length) - gles2.CompileShader(shader) - - var status gles2.GLint - gles2.GetShaderiv(shader, gles2.CompileStatus, &status) - if status == 0 { - gles2.DeleteShader(shader) - fatalGL("shader compilation failed") - } - - return shader -} - -// linkProgram creates a program, attaches both shaders, links, and returns -// the program name or exits on failure. -func linkProgram(vertShader, fragShader gles2.GLuint) gles2.GLuint { - program := gles2.CreateProgram() - if program == 0 { - fatalGL("CreateProgram returned 0") - } - - gles2.AttachShader(program, vertShader) - gles2.AttachShader(program, fragShader) - gles2.LinkProgram(program) - - var status gles2.GLint - gles2.GetProgramiv(program, gles2.LinkStatus, &status) - if status == 0 { - gles2.DeleteProgram(program) - fatalGL("program linking failed") - } - - return program -} - -// Vertex shader: passes through 2D positions in clip space. -const vertSrc = ` -attribute vec2 aPosition; -void main() { - gl_Position = vec4(aPosition, 0.0, 1.0); -} -` - -// Fragment shader: outputs solid red. -const fragSrc = ` -precision mediump float; -void main() { - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); -} -` - -func main() { - // --- EGL setup (offscreen 64x64 pbuffer) --- - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if display == nil { - fatal("GetDisplay returned EGL_NO_DISPLAY") - } - var major, minor egl.Int - if egl.Initialize(display, &major, &minor) == 0 { - fatal("Initialize failed") - } - defer egl.Terminate(display) - - if egl.BindAPI(egl.EGLenum(egl.OpenglEsApi)) == 0 { - fatal("BindAPI failed") - } - - configAttribs := [...]egl.Int{ - egl.SurfaceType, egl.PbufferBit, - egl.RenderableType, egl.OpenglEs2Bit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - fatal("ChooseConfig failed") - } - - const width, height = 64, 64 - pbufAttribs := [...]egl.Int{ - egl.Width, width, - egl.Height, height, - egl.None, - } - surface := egl.CreatePbufferSurface(display, config, &pbufAttribs[0]) - if surface == nil { - fatal("CreatePbufferSurface failed") - } - defer egl.DestroySurface(display, surface) - - ctxAttribs := [...]egl.Int{ - egl.ContextClientVersion, 2, - egl.None, - } - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - if ctx == nil { - fatal("CreateContext failed") - } - defer func() { - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroyContext(display, ctx) - }() - - if egl.MakeCurrent(display, surface, surface, ctx) == 0 { - fatal("MakeCurrent failed") - } - fmt.Println("GL context ready") - - // --- Compile shaders and link program --- - vs := compileShader(gles2.VertexShader, vertSrc) - defer gles2.DeleteShader(vs) - fmt.Println("vertex shader compiled") - - fs := compileShader(gles2.FragmentShader, fragSrc) - defer gles2.DeleteShader(fs) - fmt.Println("fragment shader compiled") - - program := linkProgram(vs, fs) - defer gles2.DeleteProgram(program) - fmt.Println("program linked") - - // --- Look up the attribute location --- - posLoc := gles2.GetAttribLocation(program, glStr("aPosition")) - if posLoc < 0 { - fatalGL("GetAttribLocation(aPosition) returned -1") - } - fmt.Printf("aPosition location = %d\n", posLoc) - - // --- Create a VBO with triangle vertices --- - // - // (0, 0.8) - // / \ - // (-0.8,-0.8)--(0.8,-0.8) - // - // These clip-space coordinates produce a triangle that covers the center - // of the viewport but leaves the corners uncovered. - vertices := [...]float32{ - 0.0, 0.8, // top - -0.8, -0.8, // bottom-left - 0.8, -0.8, // bottom-right - } - - var vbo gles2.GLuint - gles2.GenBuffers(1, &vbo) - gles2.BindBuffer(gles2.ArrayBuffer, vbo) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(vertices)), - unsafe.Pointer(&vertices[0]), - gles2.StaticDraw, - ) - defer func() { - gles2.DeleteBuffers(1, &vbo) - }() - checkGL("VBO setup") - fmt.Println("VBO created") - - // --- Render --- - gles2.Viewport(0, 0, width, height) - gles2.ClearColor(0.0, 0.0, 0.0, 1.0) // black background - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - - gles2.UseProgram(program) - gles2.EnableVertexAttribArray(gles2.GLuint(posLoc)) - // 2 floats per vertex, tightly packed (stride=0). - gles2.VertexAttribPointer( - gles2.GLuint(posLoc), - 2, // components per vertex - gles2.Float, // type - gles2.Boolean(gles2.False), // not normalized - 0, // stride (tightly packed) - nil, // offset into the bound VBO - ) - - gles2.DrawArrays(gles2.Triangles, 0, 3) - checkGL("DrawArrays") - - gles2.DisableVertexAttribArray(gles2.GLuint(posLoc)) - gles2.Finish() - - // --- Read back and verify --- - // Center pixel should be red (inside the triangle). - var center [4]byte - gles2.ReadPixels(width/2, height/2, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(¢er[0])) - checkGL("ReadPixels center") - fmt.Printf("center pixel: R=%d G=%d B=%d A=%d\n", center[0], center[1], center[2], center[3]) - - if center[0] == 255 && center[1] == 0 && center[2] == 0 { - fmt.Println("verified: center pixel is red (inside triangle)") - } else { - fmt.Println("warning: center pixel is not the expected red") - } - - // Corner (0,0) should be black (outside the triangle). - var corner [4]byte - gles2.ReadPixels(0, 0, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(&corner[0])) - fmt.Printf("corner pixel: R=%d G=%d B=%d A=%d\n", corner[0], corner[1], corner[2], corner[3]) - - if corner[0] == 0 && corner[1] == 0 && corner[2] == 0 { - fmt.Println("verified: corner pixel is black (outside triangle)") - } else { - fmt.Println("warning: corner pixel is not the expected black") - } - - fmt.Println("done") -} diff --git a/examples/gles3/instanced-drawing/main.go b/examples/gles3/instanced-drawing/main.go deleted file mode 100644 index 6da0337..0000000 --- a/examples/gles3/instanced-drawing/main.go +++ /dev/null @@ -1,201 +0,0 @@ -// Instanced drawing example using OpenGL ES 3.0. -// -// Demonstrates DrawArraysInstanced -- the ES3 call that renders multiple -// copies of geometry in a single draw call. Each instance receives a unique -// gl_InstanceID in the vertex shader, which is used here to position copies -// of a small triangle in a grid pattern. -// -// The vertex shader uses gl_InstanceID (built-in in GLSL ES 3.00) to compute -// a per-instance offset. No VertexAttribDivisor is needed for this approach -// because the offset is derived from the built-in instance index rather than -// from a per-instance attribute buffer. -// -// This program must run on an Android device with OpenGL ES 3.0 support. -package main - -import ( - "log" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" - "github.com/AndroidGoLab/ndk/gles3" -) - -// A small triangle centered at the origin, scaled down so many fit on screen. -var triVertices = [...]float32{ - 0.0, 0.08, - -0.06, -0.04, - 0.06, -0.04, -} - -// vertSrc positions each instance in a 4x4 grid using gl_InstanceID. -var vertSrc = `#version 300 es -layout(location=0) in vec2 aPos; - -void main() { - // Lay out instances in a 4-column grid. - int col = gl_InstanceID % 4; - int row = gl_InstanceID / 4; - - // Map grid cell to clip-space: columns span [-0.8, 0.8], rows likewise. - float cx = -0.6 + float(col) * 0.4; - float cy = 0.6 - float(row) * 0.4; - - gl_Position = vec4(aPos.x + cx, aPos.y + cy, 0.0, 1.0); -} -` + "\x00" - -// fragSrc colours each instance based on gl_InstanceID via flat interpolation. -var fragSrc = `#version 300 es -precision mediump float; -out vec4 fragColor; - -void main() { - fragColor = vec4(0.2, 0.7, 1.0, 1.0); -} -` + "\x00" - -const instanceCount = 16 // 4x4 grid - -func main() { - display, surface, ctx := initEGL() - defer teardownEGL(display, surface, ctx) - - program := buildProgram(vertSrc, fragSrc) - defer gles2.DeleteProgram(program) - - // Create a VAO + VBO for the triangle template geometry. - var vao gles3.GLuint - var vbo gles2.GLuint - gles3.GenVertexArrays(1, &vao) - gles2.GenBuffers(1, &vbo) - - gles3.BindVertexArray(vao) - - gles2.BindBuffer(gles2.ArrayBuffer, vbo) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(triVertices)), - unsafe.Pointer(&triVertices[0]), - gles2.StaticDraw, - ) - gles2.EnableVertexAttribArray(0) - gles2.VertexAttribPointer(0, 2, gles2.Float, gles2.Boolean(gles2.False), 0, nil) - - // --- Render --- - gles2.Viewport(0, 0, 128, 128) - gles2.ClearColor(0.05, 0.05, 0.15, 1.0) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - - gles2.UseProgram(program) - - // DrawArraysInstanced draws 3 vertices (one triangle) x instanceCount - // times. The vertex shader offsets each instance to a grid cell. - gles3.DrawArraysInstanced( - gles3.GLenum(gles2.Triangles), // mode - 0, // first - 3, // count (vertices per instance) - instanceCount, // instancecount - ) - - gles3.BindVertexArray(0) - gles2.Flush() - checkGLError("after instanced draw") - - log.Printf("instanced drawing: rendered %d triangle instances", instanceCount) - - // --- Cleanup --- - gles3.DeleteVertexArrays(1, &vao) - gles2.DeleteBuffers(1, &vbo) -} - -// --------------------------------------------------------------------------- -// EGL and shader helpers (same pattern as the VAO example) -// --------------------------------------------------------------------------- - -func initEGL() (egl.EGLDisplay, egl.EGLSurface, egl.EGLContext) { - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if egl.Initialize(display, nil, nil) == 0 { - log.Fatalf("eglInitialize failed: 0x%x", egl.GetError()) - } - - configAttribs := [...]egl.Int{ - egl.RenderableType, egl.OpenglEs3Bit, - egl.SurfaceType, egl.PbufferBit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - log.Fatalf("eglChooseConfig failed: 0x%x", egl.GetError()) - } - - surfAttribs := [...]egl.Int{egl.Width, 128, egl.Height, 128, egl.None} - surface := egl.CreatePbufferSurface(display, config, &surfAttribs[0]) - - ctxAttribs := [...]egl.Int{egl.ContextMajorVersion, 3, egl.None} - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - - if egl.MakeCurrent(display, surface, surface, ctx) == 0 { - log.Fatalf("eglMakeCurrent failed: 0x%x", egl.GetError()) - } - return display, surface, ctx -} - -func teardownEGL(display egl.EGLDisplay, surface egl.EGLSurface, ctx egl.EGLContext) { - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroySurface(display, surface) - egl.DestroyContext(display, ctx) - egl.Terminate(display) -} - -func buildProgram(vertSrc, fragSrc string) gles2.GLuint { - vs := compileShader(gles2.VertexShader, vertSrc) - fs := compileShader(gles2.FragmentShader, fragSrc) - - prog := gles2.CreateProgram() - gles2.AttachShader(prog, vs) - gles2.AttachShader(prog, fs) - gles2.LinkProgram(prog) - - var status gles2.GLint - gles2.GetProgramiv(prog, gles2.LinkStatus, &status) - if status == 0 { - log.Fatal("program link failed") - } - - gles2.DeleteShader(vs) - gles2.DeleteShader(fs) - return prog -} - -func compileShader(shaderType gles2.Enum, src string) gles2.GLuint { - s := gles2.CreateShader(shaderType) - srcPtr := strPtr(src) - gles2.ShaderSource(s, 1, &srcPtr, nil) - gles2.CompileShader(s) - - var status gles2.GLint - gles2.GetShaderiv(s, gles2.CompileStatus, &status) - if status == 0 { - log.Fatalf("shader compile failed (type 0x%x)", shaderType) - } - return s -} - -func strPtr(s string) *gles2.GLchar { - b := []byte(s) - return (*gles2.GLchar)(unsafe.Pointer(&b[0])) -} - -func checkGLError(tag string) { - if e := gles2.GetError(); e != gles2.NoError { - log.Fatalf("GL error at %s: 0x%x", tag, e) - } -} diff --git a/examples/gles3/sync-fences/main.go b/examples/gles3/sync-fences/main.go deleted file mode 100644 index 8cfe161..0000000 --- a/examples/gles3/sync-fences/main.go +++ /dev/null @@ -1,201 +0,0 @@ -// Sync fence example using OpenGL ES 3.0. -// -// Demonstrates the ES3-only FenceSync/ClientWaitSync mechanism for CPU-GPU -// synchronization. In ES2 the only way to guarantee GPU completion is the -// heavyweight glFinish. ES3 fence syncs let the CPU poll or block until a -// specific point in the GPU command stream has been reached. -// -// The example issues a clear + draw, inserts a fence, then waits for the -// GPU to finish processing those commands. This pattern is essential for -// safe buffer mapping (MapBufferRange) where the CPU must not read data -// that the GPU is still writing. -// -// This program must run on an Android device with OpenGL ES 3.0 support. -package main - -import ( - "log" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" - "github.com/AndroidGoLab/ndk/gles3" -) - -var triVertices = [...]float32{ - 0.0, 0.5, - -0.5, -0.5, - 0.5, -0.5, -} - -var vertSrc = "#version 300 es\nlayout(location=0) in vec2 aPos;\nvoid main() {\n gl_Position = vec4(aPos, 0.0, 1.0);\n}\n\x00" - -var fragSrc = "#version 300 es\nprecision mediump float;\nout vec4 fragColor;\nvoid main() {\n fragColor = vec4(0.0, 0.8, 0.4, 1.0);\n}\n\x00" - -func main() { - display, surface, ctx := initEGL() - defer teardownEGL(display, surface, ctx) - - program := buildProgram(vertSrc, fragSrc) - defer gles2.DeleteProgram(program) - - // Set up geometry in a VAO. - var vao gles3.GLuint - var vbo gles2.GLuint - gles3.GenVertexArrays(1, &vao) - gles2.GenBuffers(1, &vbo) - - gles3.BindVertexArray(vao) - gles2.BindBuffer(gles2.ArrayBuffer, vbo) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(triVertices)), - unsafe.Pointer(&triVertices[0]), - gles2.StaticDraw, - ) - gles2.EnableVertexAttribArray(0) - gles2.VertexAttribPointer(0, 2, gles2.Float, gles2.Boolean(gles2.False), 0, nil) - - // --- Issue GPU work --- - gles2.Viewport(0, 0, 64, 64) - gles2.ClearColor(0.0, 0.0, 0.0, 1.0) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - gles2.UseProgram(program) - gles2.DrawArrays(gles2.Triangles, 0, 3) - - checkGLError("after draw") - - // --- Insert a fence sync right after the draw --- - // GL_SYNC_GPU_COMMANDS_COMPLETE means the fence is signalled when all - // previously submitted GL commands have finished executing on the GPU. - sync := gles3.FenceSync(gles3.SyncGpuCommandsComplete, 0) - if sync == nil { - log.Println("FenceSync returned nil (driver limitation without display)") - return - } - log.Println("fence inserted after draw commands") - - // Flush to ensure the fence command reaches the GPU. Without this the - // driver may buffer commands indefinitely and ClientWaitSync would hang. - gles2.Flush() - - // --- Wait for the GPU to reach the fence --- - // SYNC_FLUSH_COMMANDS_BIT tells the driver to flush if the sync is not - // already signalled, which avoids a potential deadlock when the command - // queue has not been flushed yet. - result := gles3.ClientWaitSync(sync, gles3.SyncFlushCommandsBit, gles3.GLuint64(gles3.GL_TIMEOUT_IGNORED)) - switch result { - case gles3.AlreadySignaled: - log.Println("ClientWaitSync: already signalled (GPU was fast)") - case gles3.ConditionSatisfied: - log.Println("ClientWaitSync: condition satisfied (GPU caught up)") - case gles3.TimeoutExpired: - log.Println("ClientWaitSync: timeout expired (should not happen with TIMEOUT_IGNORED)") - case gles3.WaitFailed: - log.Fatal("ClientWaitSync: wait failed") - default: - // Some Adreno drivers return 0 instead of GL_ALREADY_SIGNALED. - log.Printf("ClientWaitSync: result 0x%x (treating as success)", result) - } - - // At this point all GPU work before the fence has completed. It is now - // safe to read back pixel data or map buffers that the GPU was writing. - - gles3.DeleteSync(sync) - log.Println("fence deleted, GPU synchronization complete") - - // --- Cleanup --- - gles3.BindVertexArray(0) - gles3.DeleteVertexArrays(1, &vao) - gles2.DeleteBuffers(1, &vbo) -} - -// --------------------------------------------------------------------------- -// EGL and shader helpers -// --------------------------------------------------------------------------- - -func initEGL() (egl.EGLDisplay, egl.EGLSurface, egl.EGLContext) { - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if egl.Initialize(display, nil, nil) == 0 { - log.Fatalf("eglInitialize failed: 0x%x", egl.GetError()) - } - - configAttribs := [...]egl.Int{ - egl.RenderableType, egl.OpenglEs3Bit, - egl.SurfaceType, egl.PbufferBit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - log.Fatalf("eglChooseConfig failed: 0x%x", egl.GetError()) - } - - surfAttribs := [...]egl.Int{egl.Width, 64, egl.Height, 64, egl.None} - surface := egl.CreatePbufferSurface(display, config, &surfAttribs[0]) - - ctxAttribs := [...]egl.Int{egl.ContextMajorVersion, 3, egl.None} - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - - if egl.MakeCurrent(display, surface, surface, ctx) == 0 { - log.Fatalf("eglMakeCurrent failed: 0x%x", egl.GetError()) - } - return display, surface, ctx -} - -func teardownEGL(display egl.EGLDisplay, surface egl.EGLSurface, ctx egl.EGLContext) { - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroySurface(display, surface) - egl.DestroyContext(display, ctx) - egl.Terminate(display) -} - -func buildProgram(vertSrc, fragSrc string) gles2.GLuint { - vs := compileShader(gles2.VertexShader, vertSrc) - fs := compileShader(gles2.FragmentShader, fragSrc) - - prog := gles2.CreateProgram() - gles2.AttachShader(prog, vs) - gles2.AttachShader(prog, fs) - gles2.LinkProgram(prog) - - var status gles2.GLint - gles2.GetProgramiv(prog, gles2.LinkStatus, &status) - if status == 0 { - log.Fatal("program link failed") - } - - gles2.DeleteShader(vs) - gles2.DeleteShader(fs) - return prog -} - -func compileShader(shaderType gles2.Enum, src string) gles2.GLuint { - s := gles2.CreateShader(shaderType) - srcPtr := strPtr(src) - gles2.ShaderSource(s, 1, &srcPtr, nil) - gles2.CompileShader(s) - - var status gles2.GLint - gles2.GetShaderiv(s, gles2.CompileStatus, &status) - if status == 0 { - log.Fatalf("shader compile failed (type 0x%x)", shaderType) - } - return s -} - -func strPtr(s string) *gles2.GLchar { - b := []byte(s) - return (*gles2.GLchar)(unsafe.Pointer(&b[0])) -} - -func checkGLError(tag string) { - if e := gles2.GetError(); e != gles2.NoError { - log.Fatalf("GL error at %s: 0x%x", tag, e) - } -} diff --git a/examples/gles3/transform-feedback/main.go b/examples/gles3/transform-feedback/main.go deleted file mode 100644 index 62c8624..0000000 --- a/examples/gles3/transform-feedback/main.go +++ /dev/null @@ -1,259 +0,0 @@ -// Transform feedback example using OpenGL ES 3.0. -// -// Demonstrates the ES3-only transform feedback feature, which captures -// vertex shader outputs into a buffer object on the GPU. This enables -// GPU-side particle systems, physics simulations, and stream-out -// techniques without reading data back to the CPU. -// -// The vertex shader takes input positions and applies a simple -// transformation (scaling + offset). The transformed positions are -// captured into a feedback buffer via TransformFeedbackVaryings. After -// the feedback pass the captured data is read back with MapBufferRange -// to verify correctness. -// -// This program must run on an Android device with OpenGL ES 3.0 support. -package main - -import ( - "log" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" - "github.com/AndroidGoLab/ndk/gles3" -) - -// Input positions: three 2D points. -var inputPositions = [...]float32{ - 1.0, 2.0, - 3.0, 4.0, - 5.0, 6.0, -} - -// The vertex shader scales each position by 0.5 and adds (0.1, 0.2). -// The "out" varying outPos is what transform feedback captures. -var vertSrc = `#version 300 es -layout(location=0) in vec2 aPos; -out vec2 outPos; - -void main() { - outPos = aPos * 0.5 + vec2(0.1, 0.2); - gl_Position = vec4(outPos, 0.0, 1.0); -} -` + "\x00" - -// Fragment shader is required for a valid program, but rasterization is -// disabled during transform feedback so it never executes. -var fragSrc = `#version 300 es -precision mediump float; -out vec4 fragColor; -void main() { - fragColor = vec4(1.0); -} -` + "\x00" - -const vertexCount = 3 - -func main() { - display, surface, ctx := initEGL() - defer teardownEGL(display, surface, ctx) - - program := buildTransformFeedbackProgram(vertSrc, fragSrc, "outPos") - defer gles2.DeleteProgram(program) - - // --- Create VAO + VBO for input positions --- - var vao gles3.GLuint - var inputVBO gles2.GLuint - gles3.GenVertexArrays(1, &vao) - gles2.GenBuffers(1, &inputVBO) - - gles3.BindVertexArray(vao) - gles2.BindBuffer(gles2.ArrayBuffer, inputVBO) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(inputPositions)), - unsafe.Pointer(&inputPositions[0]), - gles2.StaticDraw, - ) - gles2.EnableVertexAttribArray(0) - gles2.VertexAttribPointer(0, 2, gles2.Float, gles2.Boolean(gles2.False), 0, nil) - - // --- Create the transform feedback buffer --- - // This buffer will receive the vertex shader output (vec2 per vertex). - feedbackBufSize := gles2.GLsizeiptr(vertexCount * 2 * int(unsafe.Sizeof(float32(0)))) - var feedbackVBO gles2.GLuint - gles2.GenBuffers(1, &feedbackVBO) - gles2.BindBuffer(gles2.Enum(gles3.TransformFeedbackBuffer), feedbackVBO) - gles2.BufferData( - gles2.Enum(gles3.TransformFeedbackBuffer), - feedbackBufSize, - nil, // allocate only, no initial data - gles2.StaticDraw, - ) - - // --- Create a transform feedback object --- - var tfo gles3.GLuint - gles3.GenTransformFeedbacks(1, &tfo) - gles3.BindTransformFeedback(gles3.TransformFeedback, tfo) - - // Bind the feedback buffer to binding point 0 of the TF object. - gles3.BindBufferBase(gles3.TransformFeedbackBuffer, 0, gles3.GLuint(feedbackVBO)) - - // --- Execute the transform feedback pass --- - gles2.UseProgram(program) - - // Disable rasterization: we only care about the vertex shader output. - gles2.Enable(gles3.GL_RASTERIZER_DISCARD) - - gles3.BeginTransformFeedback(gles3.GLenum(gles2.Points)) - gles2.DrawArrays(gles2.Points, 0, gles2.GLsizei(vertexCount)) - gles3.EndTransformFeedback() - - gles2.Disable(gles3.GL_RASTERIZER_DISCARD) - checkGLError("after transform feedback") - - // --- Read back captured data --- - // Use a fence to ensure the GPU has finished writing before mapping. - sync := gles3.FenceSync(gles3.SyncGpuCommandsComplete, 0) - gles2.Flush() - gles3.ClientWaitSync(sync, gles3.SyncFlushCommandsBit, gles3.GLuint64(0xFFFFFFFFFFFFFFFF)) - gles3.DeleteSync(sync) - - gles2.BindBuffer(gles2.Enum(gles3.TransformFeedbackBuffer), feedbackVBO) - ptr := gles3.MapBufferRange( - gles3.TransformFeedbackBuffer, - 0, - gles3.GLsizeiptr(feedbackBufSize), - gles3.GL_MAP_READ_BIT, - ) - if ptr == nil { - log.Fatal("MapBufferRange returned nil") - } - - // Interpret the mapped memory as float32 pairs. - results := unsafe.Slice((*float32)(ptr), vertexCount*2) - for i := 0; i < vertexCount; i++ { - x := results[i*2] - y := results[i*2+1] - // Expected: input * 0.5 + (0.1, 0.2) - log.Printf(" vertex %d: (%.2f, %.2f) -> (%.2f, %.2f)", - i, inputPositions[i*2], inputPositions[i*2+1], x, y) - } - - gles3.UnmapBuffer(gles3.TransformFeedbackBuffer) - - log.Println("transform feedback: captured vertex shader output successfully") - - // --- Cleanup --- - gles3.BindTransformFeedback(gles3.TransformFeedback, 0) - gles3.DeleteTransformFeedbacks(1, &tfo) - gles3.BindVertexArray(0) - gles3.DeleteVertexArrays(1, &vao) - gles2.DeleteBuffers(1, &inputVBO) - gles2.DeleteBuffers(1, &feedbackVBO) -} - -// buildTransformFeedbackProgram compiles the shaders, configures the -// transform feedback varying, and links the program. The varying must be -// declared before linking. -func buildTransformFeedbackProgram(vertSrc, fragSrc, varyingName string) gles2.GLuint { - vs := compileShader(gles2.VertexShader, vertSrc) - fs := compileShader(gles2.FragmentShader, fragSrc) - - prog := gles2.CreateProgram() - gles2.AttachShader(prog, vs) - gles2.AttachShader(prog, fs) - - // Specify which vertex shader outputs to capture. - // The name must be NUL-terminated and passed as a C string array. - varyingCStr := []byte(varyingName + "\x00") - varyingPtr := (*gles3.GLchar)(unsafe.Pointer(&varyingCStr[0])) - gles3.TransformFeedbackVaryings( - gles3.GLuint(prog), - 1, - &varyingPtr, - gles3.InterleavedAttribs, - ) - - gles2.LinkProgram(prog) - - var status gles2.GLint - gles2.GetProgramiv(prog, gles2.LinkStatus, &status) - if status == 0 { - log.Fatal("program link failed (transform feedback)") - } - - gles2.DeleteShader(vs) - gles2.DeleteShader(fs) - return prog -} - -// --------------------------------------------------------------------------- -// EGL and shader helpers -// --------------------------------------------------------------------------- - -func initEGL() (egl.EGLDisplay, egl.EGLSurface, egl.EGLContext) { - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if egl.Initialize(display, nil, nil) == 0 { - log.Fatalf("eglInitialize failed: 0x%x", egl.GetError()) - } - - configAttribs := [...]egl.Int{ - egl.RenderableType, egl.OpenglEs3Bit, - egl.SurfaceType, egl.PbufferBit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - log.Fatalf("eglChooseConfig failed: 0x%x", egl.GetError()) - } - - surfAttribs := [...]egl.Int{egl.Width, 64, egl.Height, 64, egl.None} - surface := egl.CreatePbufferSurface(display, config, &surfAttribs[0]) - - ctxAttribs := [...]egl.Int{egl.ContextMajorVersion, 3, egl.None} - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - - if egl.MakeCurrent(display, surface, surface, ctx) == 0 { - log.Fatalf("eglMakeCurrent failed: 0x%x", egl.GetError()) - } - return display, surface, ctx -} - -func teardownEGL(display egl.EGLDisplay, surface egl.EGLSurface, ctx egl.EGLContext) { - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroySurface(display, surface) - egl.DestroyContext(display, ctx) - egl.Terminate(display) -} - -func compileShader(shaderType gles2.Enum, src string) gles2.GLuint { - s := gles2.CreateShader(shaderType) - srcPtr := strPtr(src) - gles2.ShaderSource(s, 1, &srcPtr, nil) - gles2.CompileShader(s) - - var status gles2.GLint - gles2.GetShaderiv(s, gles2.CompileStatus, &status) - if status == 0 { - log.Fatalf("shader compile failed (type 0x%x)", shaderType) - } - return s -} - -func strPtr(s string) *gles2.GLchar { - b := []byte(s) - return (*gles2.GLchar)(unsafe.Pointer(&b[0])) -} - -func checkGLError(tag string) { - if e := gles2.GetError(); e != gles2.NoError { - log.Fatalf("GL error at %s: 0x%x", tag, e) - } -} diff --git a/examples/gles3/vertex-array-objects/main.go b/examples/gles3/vertex-array-objects/main.go deleted file mode 100644 index 4782669..0000000 --- a/examples/gles3/vertex-array-objects/main.go +++ /dev/null @@ -1,215 +0,0 @@ -// Vertex Array Object (VAO) example using OpenGL ES 3.0. -// -// Demonstrates the ES3-only VAO feature that encapsulates vertex attribute -// state into named objects. In ES2 every draw call must re-bind vertex -// pointers; with VAOs the driver records the bindings once and replays them -// on BindVertexArray. -// -// This example creates two VAOs -- one for a triangle and one for a quad -- -// each backed by its own VBO. Switching between them before drawing shows -// how VAOs eliminate redundant EnableVertexAttribArray/VertexAttribPointer -// calls at render time. -// -// This program must run on an Android device with OpenGL ES 3.0 support. -package main - -import ( - "log" - "unsafe" - - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" - "github.com/AndroidGoLab/ndk/gles3" -) - -// Triangle: three vertices with XY position. -var triangleVertices = [...]float32{ - 0.0, 0.5, - -0.5, -0.5, - 0.5, -0.5, -} - -// Quad: four vertices forming a small square (drawn as triangle fan). -var quadVertices = [...]float32{ - -0.3, 0.3, - -0.3, -0.3, - 0.3, -0.3, - 0.3, 0.3, -} - -// vertSrc is a minimal GLSL ES 3.00 vertex shader. -var vertSrc = "#version 300 es\nlayout(location=0) in vec2 aPos;\nvoid main() {\n gl_Position = vec4(aPos, 0.0, 1.0);\n}\n\x00" - -// fragSrc outputs a solid color. -var fragSrc = "#version 300 es\nprecision mediump float;\nout vec4 fragColor;\nuniform vec4 uColor;\nvoid main() {\n fragColor = uColor;\n}\n\x00" - -func main() { - display, surface, ctx := initEGL() - defer teardownEGL(display, surface, ctx) - - program := buildProgram(vertSrc, fragSrc) - defer gles2.DeleteProgram(program) - - colorLoc := gles2.GetUniformLocation(program, strPtr("uColor\x00")) - - // --- Create VAO and VBO for the triangle --- - var triVAO gles3.GLuint - var triVBO gles2.GLuint - gles3.GenVertexArrays(1, &triVAO) - gles2.GenBuffers(1, &triVBO) - - gles3.BindVertexArray(triVAO) - gles2.BindBuffer(gles2.ArrayBuffer, triVBO) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(triangleVertices)), - unsafe.Pointer(&triangleVertices[0]), - gles2.StaticDraw, - ) - // Attribute 0: vec2 position, tightly packed. - gles2.EnableVertexAttribArray(0) - gles2.VertexAttribPointer(0, 2, gles2.Float, gles2.Boolean(gles2.False), 0, nil) - gles3.BindVertexArray(0) // unbind so subsequent buffer calls don't affect this VAO - - // --- Create VAO and VBO for the quad --- - var quadVAO gles3.GLuint - var quadVBO gles2.GLuint - gles3.GenVertexArrays(1, &quadVAO) - gles2.GenBuffers(1, &quadVBO) - - gles3.BindVertexArray(quadVAO) - gles2.BindBuffer(gles2.ArrayBuffer, quadVBO) - gles2.BufferData( - gles2.ArrayBuffer, - gles2.GLsizeiptr(unsafe.Sizeof(quadVertices)), - unsafe.Pointer(&quadVertices[0]), - gles2.StaticDraw, - ) - gles2.EnableVertexAttribArray(0) - gles2.VertexAttribPointer(0, 2, gles2.Float, gles2.Boolean(gles2.False), 0, nil) - gles3.BindVertexArray(0) - - // --- Render one frame --- - gles2.Viewport(0, 0, 64, 64) - gles2.ClearColor(0.1, 0.1, 0.1, 1.0) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - - gles2.UseProgram(program) - - // Draw the triangle in red. Binding the VAO restores all vertex state. - red := [4]gles2.GLfloat{1.0, 0.0, 0.0, 1.0} - gles2.Uniform4fv(colorLoc, 1, &red[0]) - gles3.BindVertexArray(triVAO) - gles2.DrawArrays(gles2.Triangles, 0, 3) - - // Draw the quad in green. No need to call VertexAttribPointer again. - green := [4]gles2.GLfloat{0.0, 1.0, 0.0, 1.0} - gles2.Uniform4fv(colorLoc, 1, &green[0]) - gles3.BindVertexArray(quadVAO) - gles2.DrawArrays(gles2.TriangleFan, 0, 4) - - gles3.BindVertexArray(0) - gles2.Flush() - checkGLError("after draw") - - log.Println("VAO example: drew triangle (red) and quad (green)") - - // --- Cleanup --- - gles3.DeleteVertexArrays(1, &triVAO) - gles3.DeleteVertexArrays(1, &quadVAO) - gles2.DeleteBuffers(1, &triVBO) - gles2.DeleteBuffers(1, &quadVBO) -} - -// --------------------------------------------------------------------------- -// Helpers -// --------------------------------------------------------------------------- - -// initEGL creates an ES 3.0 context with a 64x64 PBuffer surface. -func initEGL() (egl.EGLDisplay, egl.EGLSurface, egl.EGLContext) { - var defaultDisplay egl.EGLNativeDisplayType - display := egl.GetDisplay(defaultDisplay) - if egl.Initialize(display, nil, nil) == 0 { - log.Fatalf("eglInitialize failed: 0x%x", egl.GetError()) - } - - configAttribs := [...]egl.Int{ - egl.RenderableType, egl.OpenglEs3Bit, - egl.SurfaceType, egl.PbufferBit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.AlphaSize, 8, - egl.None, - } - var config egl.EGLConfig - var numConfigs egl.Int - if egl.ChooseConfig(display, &configAttribs[0], &config, 1, &numConfigs) == 0 || numConfigs == 0 { - log.Fatalf("eglChooseConfig failed: 0x%x", egl.GetError()) - } - - surfAttribs := [...]egl.Int{egl.Width, 64, egl.Height, 64, egl.None} - surface := egl.CreatePbufferSurface(display, config, &surfAttribs[0]) - - ctxAttribs := [...]egl.Int{egl.ContextMajorVersion, 3, egl.None} - ctx := egl.CreateContext(display, config, nil, &ctxAttribs[0]) - - if egl.MakeCurrent(display, surface, surface, ctx) == 0 { - log.Fatalf("eglMakeCurrent failed: 0x%x", egl.GetError()) - } - return display, surface, ctx -} - -func teardownEGL(display egl.EGLDisplay, surface egl.EGLSurface, ctx egl.EGLContext) { - egl.MakeCurrent(display, nil, nil, nil) - egl.DestroySurface(display, surface) - egl.DestroyContext(display, ctx) - egl.Terminate(display) -} - -// buildProgram compiles a vertex/fragment pair and links them. -func buildProgram(vertSrc, fragSrc string) gles2.GLuint { - vs := compileShader(gles2.VertexShader, vertSrc) - fs := compileShader(gles2.FragmentShader, fragSrc) - - prog := gles2.CreateProgram() - gles2.AttachShader(prog, vs) - gles2.AttachShader(prog, fs) - gles2.LinkProgram(prog) - - var status gles2.GLint - gles2.GetProgramiv(prog, gles2.LinkStatus, &status) - if status == 0 { - log.Fatal("program link failed") - } - - gles2.DeleteShader(vs) - gles2.DeleteShader(fs) - return prog -} - -func compileShader(shaderType gles2.Enum, src string) gles2.GLuint { - s := gles2.CreateShader(shaderType) - srcPtr := strPtr(src) - gles2.ShaderSource(s, 1, &srcPtr, nil) - gles2.CompileShader(s) - - var status gles2.GLint - gles2.GetShaderiv(s, gles2.CompileStatus, &status) - if status == 0 { - log.Fatalf("shader compile failed (type 0x%x)", shaderType) - } - return s -} - -// strPtr returns a pointer to the first byte of a NUL-terminated Go string. -func strPtr(s string) *gles2.GLchar { - b := []byte(s) - return (*gles2.GLchar)(unsafe.Pointer(&b[0])) -} - -func checkGLError(tag string) { - if e := gles2.GetError(); e != gles2.NoError { - log.Fatalf("GL error at %s: 0x%x", tag, e) - } -} diff --git a/examples/gomobile/sensorbridge/.gitignore b/examples/gomobile/sensorbridge/.gitignore deleted file mode 100644 index 244aebd..0000000 --- a/examples/gomobile/sensorbridge/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.aar -*-sources.jar diff --git a/examples/gomobile/sensorbridge/Makefile b/examples/gomobile/sensorbridge/Makefile deleted file mode 100644 index 56b7e50..0000000 --- a/examples/gomobile/sensorbridge/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -ANDROID_HOME ?= $(HOME)/Android/Sdk -GOMOBILE ?= $(shell go env GOPATH)/bin/gomobile -API_LEVEL ?= 35 - -AAR := sensorbridge.aar - -.PHONY: all clean install-tools - -all: $(AAR) - -$(AAR): sensorbridge.go - ANDROID_HOME=$(ANDROID_HOME) $(GOMOBILE) bind \ - -target=android/arm64 \ - -androidapi=$(API_LEVEL) \ - -o $@ . - -install-tools: - go install golang.org/x/mobile/cmd/gomobile@latest - go install golang.org/x/mobile/cmd/gobind@latest - $(GOMOBILE) init - -clean: - rm -f $(AAR) sensorbridge-sources.jar diff --git a/examples/gomobile/sensorbridge/go.mod b/examples/gomobile/sensorbridge/go.mod deleted file mode 100644 index d0e6ba2..0000000 --- a/examples/gomobile/sensorbridge/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/AndroidGoLab/ndk/examples/gomobile/sensorbridge - -go 1.26.0 - -require github.com/AndroidGoLab/ndk v0.0.5 - -replace github.com/AndroidGoLab/ndk => ../../.. diff --git a/examples/gomobile/sensorbridge/go.sum b/examples/gomobile/sensorbridge/go.sum deleted file mode 100644 index e69de29..0000000 diff --git a/examples/gomobile/sensorbridge/sensorbridge.go b/examples/gomobile/sensorbridge/sensorbridge.go deleted file mode 100644 index 7ab5312..0000000 --- a/examples/gomobile/sensorbridge/sensorbridge.go +++ /dev/null @@ -1,82 +0,0 @@ -// Package sensorbridge exposes NDK sensor access to Java/Kotlin -// via gomobile bind. -// -// Build with: -// -// gomobile bind -target=android -androidapi=26 ./examples/gomobile/sensorbridge -// -// This produces sensorbridge.aar + sensorbridge-sources.jar. -// -// Java usage: -// -// import sensorbridge.Sensorbridge; -// import sensorbridge.Bridge; -// -// long ptr = nativeGetSensorManager(); // from JNI -// Bridge bridge = Sensorbridge.newBridge(ptr); -// String name = bridge.accelerometerName(); -// bridge.close(); -package sensorbridge - -import ( - "github.com/AndroidGoLab/ndk/sensor" -) - -// Bridge wraps an ASensorManager for cross-language use. -// Unexported fields are invisible to Java/Kotlin. -type Bridge struct { - mgr *sensor.Manager -} - -// NewBridge creates a Bridge from a raw ASensorManager* passed as int64 -// (Java long). gomobile bind does not support unsafe.Pointer or uintptr, -// so native handles must be transported as int64. -func NewBridge(managerHandle int64) *Bridge { - return &Bridge{ - mgr: sensor.NewManagerFromUintPtr(uintptr(managerHandle)), - } -} - -// Handle returns the underlying ASensorManager* as int64 for passing -// back to Java/JNI code. -func (b *Bridge) Handle() int64 { - return int64(b.mgr.UintPtr()) -} - -// AccelerometerName returns the name of the default accelerometer, -// or empty string if unavailable. -func (b *Bridge) AccelerometerName() string { - return b.sensorName(sensor.Accelerometer) -} - -// GyroscopeName returns the name of the default gyroscope, -// or empty string if unavailable. -func (b *Bridge) GyroscopeName() string { - return b.sensorName(sensor.Gyroscope) -} - -// LightSensorName returns the name of the default light sensor, -// or empty string if unavailable. -func (b *Bridge) LightSensorName() string { - return b.sensorName(sensor.Light) -} - -// SensorName returns the name of a sensor by its Android type code, -// or empty string if the sensor is not available. -func (b *Bridge) SensorName(sensorType int32) string { - return b.sensorName(sensor.Type(sensorType)) -} - -func (b *Bridge) sensorName(t sensor.Type) string { - s := b.mgr.DefaultSensor(t) - if s.UintPtr() == 0 { - return "" - } - return s.Name() -} - -// Close is a no-op — the ASensorManager is a singleton owned by the -// system. Provided so the Bridge satisfies Java's Closeable pattern. -func (b *Bridge) Close() { - b.mgr = nil -} diff --git a/examples/hint/overview/main.go b/examples/hint/overview/main.go deleted file mode 100644 index 7595bcb..0000000 --- a/examples/hint/overview/main.go +++ /dev/null @@ -1,221 +0,0 @@ -// Performance Hint API overview. -// -// Documents the Android Performance Hint API using the ndk hint package. -// The Performance Hint API allows applications to communicate their -// performance requirements to the system so that it can adjust CPU frequency -// and scheduling in real time. This is the primary mechanism for achieving -// consistent frame timing without over- or under-clocking the CPU. -// -// Core concept: -// -// The application creates a hint session with a set of thread IDs (the -// threads doing frame work) and a target work duration. Each frame, the -// application reports how long the work actually took. The system uses -// the ratio of actual-to-target duration to adjust CPU frequency: -// -// actual < target -> system may lower CPU frequency to save power -// actual ~ target -> CPU frequency is well-matched -// actual > target -> system may raise CPU frequency to meet deadlines -// -// Typical game loop integration: -// -// 1. Obtain a Manager via APerformanceHintManager_fromContext (JNI). -// 2. Gather thread IDs for your render and game-logic threads. -// 3. Create a Session with those thread IDs and a target duration -// (e.g., 16_666_666 ns for 60 fps). -// 4. Each frame, measure the wall-clock work time and call -// ReportActualWorkDuration. -// 5. If the frame rate target changes (e.g., 60 fps -> 90 fps), -// call UpdateTargetWorkDuration with the new target. -// 6. Close the Session when the render loop exits. -// -// The Manager handle is obtained from the Android system through JNI: -// -// APerformanceHintManager *mgr = APerformanceHintManager_fromContext(env, context); -// -// There is no Go-side constructor for Manager because the handle must come -// from the Android runtime. In a real application you would pass the pointer -// across the JNI boundary and wrap it in a hint.Manager. -// -// Prerequisites: -// - Android device with API level 33+ (ADPF performance hint support). -// - A valid APerformanceHintManager handle obtained via JNI. -package main - -import ( - "fmt" - "log" - "time" - - "github.com/AndroidGoLab/ndk/hint" -) - -func main() { - // --------------------------------------------------------------- - // Manager - // - // The Manager is the entry point to the Performance Hint API. On - // Android it is obtained by calling the JNI function: - // - // APerformanceHintManager_fromContext(env, context) - // - // The returned pointer is then wrapped in a hint.Manager on the - // Go side. There is no Go-side constructor because the handle is - // owned by the Android runtime. - // - // For this example we use a nil Manager to illustrate the API - // shape. On a real device you would have a valid pointer. - // --------------------------------------------------------------- - var mgr *hint.Manager // obtained from APerformanceHintManager_fromContext via JNI - - log.Println("manager handle would be obtained from APerformanceHintManager_fromContext") - - // --------------------------------------------------------------- - // PreferredUpdateRateNanos - // - // The system reports how frequently it wants the application to - // call ReportActualWorkDuration. Typical values: - // - // ~2_000_000 ns (2 ms) - report every frame at 60 fps - // ~4_000_000 ns (4 ms) - report every other frame - // - // Reporting more frequently than this wastes CPU; reporting less - // frequently makes the system slower to react. - // --------------------------------------------------------------- - // - // preferredRate := mgr.PreferredUpdateRateNanos() - // log.Printf("preferred update rate: %d ns (%.1f ms)", - // preferredRate, float64(preferredRate)/1e6) - - log.Println("preferred update rate would indicate how often to report durations") - - // --------------------------------------------------------------- - // CreateSession - // - // A Session binds a set of threads to a target work duration. - // The thread IDs identify which OS threads the system should - // tune. Typically these are the render thread and any worker - // threads that contribute to frame production. - // - // Parameters: - // tids - pointer to the first element of a thread ID array - // size - number of thread IDs - // initial - target work duration in nanoseconds - // - // For 60 fps the target is ~16.67 ms = 16_666_666 ns. - // For 90 fps the target is ~11.11 ms = 11_111_111 ns. - // For 120 fps the target is ~8.33 ms = 8_333_333 ns. - // --------------------------------------------------------------- - const ( - targetFPS = 60 - targetDurationNs = time.Second / targetFPS // ~16.67 ms - ) - - // In a real application, gather thread IDs from your render and - // worker threads. On Android you can use gettid() from each - // thread to obtain its kernel thread ID. - tids := []int32{ - 1234, // example: render thread tid - 1235, // example: physics worker tid - } - - log.Printf("target: %d fps -> %v per frame", targetFPS, targetDurationNs) - log.Printf("thread IDs: %v", tids) - - // Create the session. On a real device this returns a valid - // Session handle. With a nil Manager this would crash, so we - // guard it and show the call pattern instead. - if mgr != nil { - session := mgr.CreateSession(&tids[0], uint64(len(tids)), targetDurationNs) - defer session.Close() - - runFrameLoop(session, targetDurationNs) - } else { - log.Println("skipping session creation (no Manager handle)") - log.Println("on a real device the call would be:") - log.Println(" session := mgr.CreateSession(&tids[0], uint64(len(tids)), targetDurationNs)") - } - - // --------------------------------------------------------------- - // Frame loop pattern (reference) - // - // Each frame: - // 1. Record the start time. - // 2. Do rendering / simulation work. - // 3. Record the end time. - // 4. Call session.ReportActualWorkDuration(elapsed). - // - // The system uses the stream of reports to adjust CPU frequency. - // If work consistently finishes early, the CPU frequency is - // lowered to save power. If work consistently overruns, the - // frequency is raised to help meet the deadline. - // --------------------------------------------------------------- - - // Print a summary of the API surface for reference. - fmt.Println() - fmt.Println("Performance Hint API summary:") - fmt.Println() - fmt.Println(" hint.Manager (from APerformanceHintManager_fromContext via JNI)") - fmt.Println(" .CreateSession(tids, size, targetNs) *Session") - fmt.Println(" .PreferredUpdateRateNanos() int64") - fmt.Println() - fmt.Println(" hint.Session") - fmt.Println(" .ReportActualWorkDuration(actualNs) error") - fmt.Println(" .UpdateTargetWorkDuration(targetNs) error") - fmt.Println(" .Close() error") -} - -// runFrameLoop demonstrates the per-frame reporting pattern. It simulates -// a game loop that measures work duration and reports it to the performance -// hint session so the system can tune CPU frequency. -func runFrameLoop(session *hint.Session, target time.Duration) { - const totalFrames = 180 // 3 seconds at 60 fps - - log.Printf("starting frame loop: %d frames, target %v", totalFrames, target) - - for frame := 0; frame < totalFrames; frame++ { - start := time.Now() - - // Simulate frame work. In a real engine this would be the - // render and simulation pass. - doFrameWork(frame) - - elapsed := time.Since(start) - - // Report how long the frame actually took. The system - // compares this against the target to decide whether to - // adjust CPU frequency up or down. - if err := session.ReportActualWorkDuration(elapsed); err != nil { - log.Printf("frame %d: report failed: %v", frame, err) - } - - if frame%60 == 0 { - fmt.Printf(" [frame %3d] actual=%5.2f ms target=%5.2f ms ratio=%.2f\n", - frame, - float64(elapsed.Nanoseconds())/1e6, - float64(target.Nanoseconds())/1e6, - float64(elapsed)/float64(target)) - } - } - - // If the application switches frame rate targets (e.g., the user - // changes quality settings from 60 fps to 90 fps), update the - // session target rather than creating a new session. - const newTarget = time.Second / 90 // ~11.11 ms for 90 fps - if err := session.UpdateTargetWorkDuration(newTarget); err != nil { - log.Printf("update target failed: %v", err) - } else { - log.Printf("target updated to %v (90 fps)", newTarget) - } - - log.Println("frame loop finished") -} - -// doFrameWork simulates variable-duration frame work. Real engines would -// perform scene traversal, draw-call submission, and GPU synchronization. -func doFrameWork(frame int) { - // Vary the simulated work to show how actual durations fluctuate. - base := 14 * time.Millisecond - jitter := time.Duration(frame%5) * time.Millisecond - time.Sleep(base + jitter) -} diff --git a/examples/hwbuf/allocate-lock/main.go b/examples/hwbuf/allocate-lock/main.go deleted file mode 100644 index b747eb7..0000000 --- a/examples/hwbuf/allocate-lock/main.go +++ /dev/null @@ -1,214 +0,0 @@ -// Hardware buffer allocation and CPU-lock lifecycle. -// -// Demonstrates how to allocate an AHardwareBuffer via the idiomatic hwbuf -// package, lock it for CPU access, write pixel data, unlock it, and release -// the buffer. -// -// AHardwareBuffer lifecycle: -// -// 1. Describe -- Fill an hwbuf.Desc with width, height, layers, pixel -// format, and usage flags. Usage flags control which hardware blocks -// (CPU, GPU, compositor, video encoder) may access the buffer. -// -// 2. Allocate -- Call hwbuf.Allocate with the descriptor. The driver -// chooses the optimal memory domain. -// -// 3. Lock -- Call buf.Lock with the desired CPU usage (read, write, -// or both) and an optional dirty rectangle. The call returns a raw -// pointer to the pixel data. -// -// 4. Access -- Read or write pixels through the returned pointer. -// Respect the stride returned by buf.Describe. -// -// 5. Unlock -- Call buf.Unlock to release the CPU mapping and allow -// the GPU or other consumers to access the buffer. The optional -// fence parameter signals when the unlock completes asynchronously; -// pass nil for synchronous. -// -// 6. Share -- Optionally call buf.Acquire to increment the reference -// count before passing the buffer to another component (another -// thread, process, or API such as Vulkan or EGL). -// -// 7. Release -- Call buf.Close to decrement the reference count. When -// the count reaches zero the driver frees the memory. -// -// Prerequisites: -// - Android device with API level 26+ (AHardwareBuffer was added in API 26). -// -// This program must run on an Android device. -package main - -import ( - "fmt" - "log" - "unsafe" - - "github.com/AndroidGoLab/ndk/hwbuf" -) - -func main() { - fmt.Println("=== AHardwareBuffer allocate-lock lifecycle ===") - fmt.Println() - - // ── Step 1: Describe the buffer ───────────────────────────── - // - // The descriptor specifies the buffer dimensions, format, and - // usage flags. Usage flags are a bitmask that tells the driver - // which hardware blocks will access the buffer. - - format := hwbuf.R8g8b8a8Unorm - usage := hwbuf.CpuWriteOften | hwbuf.GpuSampledImage - - fmt.Println("Buffer descriptor:") - fmt.Printf(" Width: %d\n", 1920) - fmt.Printf(" Height: %d\n", 1080) - fmt.Printf(" Layers: %d\n", 1) - fmt.Printf(" Format: %s (value %d)\n", format, int32(format)) - fmt.Printf(" Usage: CpuWriteOften | GpuSampledImage = 0x%04X\n", uint64(usage)) - fmt.Println() - - desc := hwbuf.Desc{ - Width: 1920, - Height: 1080, - Layers: 1, - Format: uint32(hwbuf.R8g8b8a8Unorm), - Usage: uint64(hwbuf.CpuWriteOften | hwbuf.GpuSampledImage), - } - - // ── Step 2: Allocate ──────────────────────────────────────── - // - // hwbuf.Allocate creates a hardware buffer matching the - // descriptor. The driver chooses the optimal memory domain. - - buf, err := hwbuf.Allocate(&desc) - if err != nil { - log.Fatalf("hwbuf.Allocate failed: %v", err) - } - defer func() { - if err := buf.Close(); err != nil { - log.Printf("close: %v", err) - } - }() - - fmt.Println("Allocation: success") - - // Read back the descriptor to get the stride chosen by the driver. - actual := buf.Describe() - fmt.Printf(" Actual stride: %d pixels\n", actual.Stride) - fmt.Println() - - // ── Step 3: Lock for CPU access ───────────────────────────── - // - // Locking maps the buffer into the process address space for - // CPU access. The usage parameter must be a subset of the - // usage flags used at allocation time. - // fence=-1 means no fence; rect=nil means full buffer. - - pixelPtr, err := buf.Lock(uint64(hwbuf.CpuWriteOften), -1, nil) - if err != nil { - log.Fatalf("buf.Lock failed: %v", err) - } - - fmt.Println("Lock: success — buffer mapped for CPU write") - - // ── Step 4: Write pixels ──────────────────────────────────── - // - // After locking, pixelPtr points to the first pixel. For - // R8g8b8a8Unorm each pixel is 4 bytes: [R, G, B, A]. - // Use the actual stride (not width) to handle row padding. - - stride := int(actual.Stride) // pixels per row including padding - pixels := unsafe.Slice((*byte)(pixelPtr), stride*1080*4) - for y := 0; y < 1080; y++ { - for x := 0; x < 1920; x++ { - off := (y*stride + x) * 4 - pixels[off+0] = byte(x % 256) // R - pixels[off+1] = byte(y % 256) // G - pixels[off+2] = 0 // B - pixels[off+3] = 255 // A - } - } - - fmt.Printf(" Wrote %dx%d RGBA pixels (stride=%d)\n", 1920, 1080, stride) - fmt.Println() - - // ── Step 5: Unlock ────────────────────────────────────────── - // - // After writing pixels, unlock the buffer so the GPU or other - // consumers can access it. Passing nil for the fence parameter - // performs a synchronous unlock. - - if err := buf.Unlock(nil); err != nil { - log.Fatalf("unlock: %v", err) - } - - fmt.Println("Unlock: buf.Unlock(nil) -- synchronous release of CPU mapping") - fmt.Println() - - // ── Step 6: Acquire (reference counting) ──────────────────── - // - // Acquire increments the buffer's reference count. This is - // needed when passing the buffer to another component that - // will independently call Close (decrement). - // - // buf.Acquire() // ref count: 1 -> 2 - // // pass buf to another goroutine / API - // // that goroutine calls buf.Close() when done - - fmt.Println("Acquire: buf.Acquire() -- increment reference count") - fmt.Println(" Use this before sharing the buffer across components.") - fmt.Println() - - // ── Step 7: Release ───────────────────────────────────────── - // - // Close decrements the reference count. When it reaches zero - // the driver frees the buffer memory. Handled by deferred - // buf.Close() above. - - fmt.Println("Close: buf.Close() -- decrement reference count and free if zero") - fmt.Println() - - // ── Usage flag combinations ───────────────────────────────── - // - // Common real-world usage flag combinations: - - combos := []struct { - name string - usage hwbuf.Usage - }{ - {"CPU write + GPU texture", hwbuf.CpuWriteOften | hwbuf.GpuSampledImage}, - {"GPU render + CPU readback", hwbuf.GpuColorOutput | hwbuf.CpuReadOften}, - {"GPU render + compositor", hwbuf.GpuColorOutput | hwbuf.ComposerOverlay}, - {"CPU write + video encode", hwbuf.CpuWriteOften | hwbuf.VideoEncode}, - {"GPU render target", hwbuf.GpuFramebuffer | hwbuf.GpuSampledImage}, - } - - fmt.Println("Common usage flag combinations:") - for _, c := range combos { - fmt.Printf(" %-30s = 0x%08X\n", c.name, uint64(c.usage)) - } - fmt.Println() - - // ── Supported pixel formats for CPU access ────────────────── - - cpuFormats := []struct { - f hwbuf.Format - bpp int - }{ - {hwbuf.R8g8b8a8Unorm, 4}, - {hwbuf.R8g8b8x8Unorm, 4}, - {hwbuf.R8g8b8Unorm, 3}, - {hwbuf.R5g6b5Unorm, 2}, - {hwbuf.R16g16b16a16Float, 8}, - {hwbuf.R8Unorm, 1}, - } - - fmt.Println("Pixel formats suitable for CPU access:") - fmt.Printf(" %-25s %s\n", "Format", "BPP") - for _, entry := range cpuFormats { - fmt.Printf(" %-25s %d\n", entry.f, entry.bpp) - } - - fmt.Println() - fmt.Println("allocate-lock lifecycle complete") -} diff --git a/examples/hwbuf/formats-usage/main.go b/examples/hwbuf/formats-usage/main.go deleted file mode 100644 index 849d2a3..0000000 --- a/examples/hwbuf/formats-usage/main.go +++ /dev/null @@ -1,120 +0,0 @@ -// Hardware buffer formats and usage flags overview. -// -// Enumerates every AHardwareBuffer pixel format with its String() -// representation, then shows how to combine Usage flags with bitwise -// OR to describe the intended access pattern for a buffer. -// -// AHardwareBuffer is Android's cross-process, cross-API buffer primitive. -// It enables zero-copy sharing of pixel and blob data between the CPU, -// GPU (OpenGL ES / Vulkan), hardware composer, camera, and codec -// pipelines. A single buffer can be written by the GPU and read by the -// CPU (or vice-versa) without an intermediate copy, provided the correct -// Usage flags are set at allocation time. -// -// This program exercises only the type system (Format, Usage, -// AHardwareBuffer_Desc); it does not call Allocate, so it compiles and -// runs on any host for demonstration purposes. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/hwbuf" -) - -func main() { - // ── Pixel formats ──────────────────────────────────────────── - // - // Each Format constant maps to the NDK AHARDWAREBUFFER_FORMAT_* - // value. The String() method returns a human-readable name. - - formats := []struct { - f hwbuf.Format - bits string // short description of the layout - }{ - {hwbuf.R8g8b8a8Unorm, "32-bit RGBA, 8 bits per channel"}, - {hwbuf.R8g8b8x8Unorm, "32-bit RGBx, alpha channel ignored"}, - {hwbuf.R8g8b8Unorm, "24-bit RGB, no alpha"}, - {hwbuf.R5g6b5Unorm, "16-bit RGB (5-6-5)"}, - {hwbuf.R16g16b16a16Float, "64-bit RGBA, 16-bit float per channel (HDR)"}, - {hwbuf.Blob, "opaque byte buffer (non-image data)"}, - } - - fmt.Println("AHardwareBuffer pixel formats") - fmt.Println("─────────────────────────────────────────────────────") - fmt.Printf(" %-25s %5s %s\n", "Name", "Value", "Description") - for _, entry := range formats { - fmt.Printf(" %-25s %5d %s\n", entry.f, int32(entry.f), entry.bits) - } - - // ── Usage flags ────────────────────────────────────────────── - // - // Usage constants are a bitmask. Combine them with | to declare - // how the buffer will be accessed. The driver uses these hints to - // place the allocation in the most efficient memory domain. - - fmt.Println() - fmt.Println("Individual usage flags") - fmt.Println("─────────────────────────────────────────────────────") - - usages := []struct { - u hwbuf.Usage - name string - }{ - {hwbuf.CpuReadOften, "CpuReadOften"}, - {hwbuf.CpuWriteOften, "CpuWriteOften"}, - {hwbuf.GpuSampledImage, "GpuSampledImage"}, - {hwbuf.GpuColorOutput, "GpuColorOutput"}, - } - - for _, entry := range usages { - fmt.Printf(" %-20s = 0x%04X (%d)\n", entry.name, int32(entry.u), int32(entry.u)) - } - - // ── Composing usage masks ──────────────────────────────────── - // - // Real-world buffers typically need more than one flag. A GPU - // render target that the CPU will read back for screenshots, for - // example, combines GpuColorOutput | CpuReadOften. - - fmt.Println() - fmt.Println("Combined usage examples") - fmt.Println("─────────────────────────────────────────────────────") - - // GPU renders into the buffer, CPU reads the pixels back. - gpuRenderCpuReadback := hwbuf.GpuColorOutput | hwbuf.CpuReadOften - fmt.Printf(" GPU render + CPU readback : 0x%04X\n", int32(gpuRenderCpuReadback)) - - // CPU writes pixel data, GPU samples it as a texture. - cpuUploadGpuTexture := hwbuf.CpuWriteOften | hwbuf.GpuSampledImage - fmt.Printf(" CPU upload + GPU texture : 0x%04X\n", int32(cpuUploadGpuTexture)) - - // Full bidirectional: CPU reads and writes, GPU renders and samples. - bidirectional := hwbuf.CpuReadOften | hwbuf.CpuWriteOften | - hwbuf.GpuSampledImage | hwbuf.GpuColorOutput - fmt.Printf(" Full bidirectional : 0x%04X\n", int32(bidirectional)) - - // ── Descriptor sketch ──────────────────────────────────────── - // - // On a real device the descriptor would be passed to Allocate: - // - // desc := hwbuf.AHardwareBuffer_Desc{ - // Width: 1920, - // Height: 1080, - // Layers: 1, - // Format: hwbuf.R8g8b8a8Unorm, - // Usage: gpuRenderCpuReadback, - // } - // buf, err := hwbuf.Allocate(&desc) - // - // After allocation the buffer can be: - // - Locked for CPU access (Lock / Unlock) - // - Bound as a GL texture (via EGLClientBuffer) - // - Imported into Vulkan (VkImportAndroidHardwareBufferInfoANDROID) - // - Sent across processes (Binder / Unix sockets) - // - // All without copying the underlying pixel data. - - fmt.Println() - fmt.Println("done") -} diff --git a/examples/image/overview/main.go b/examples/image/overview/main.go deleted file mode 100644 index f0c9b27..0000000 --- a/examples/image/overview/main.go +++ /dev/null @@ -1,261 +0,0 @@ -// AImageDecoder API overview. -// -// Documents the Android AImageDecoder pipeline provided by the ndk/image -// package. AImageDecoder (introduced in API 30) decodes JPEG, PNG, GIF, -// WebP, BMP, and ICO images into raw pixel buffers without requiring the -// Java Bitmap machinery. -// -// Decoder lifecycle: -// -// 1. Create -- from a file descriptor or in-memory buffer -// 2. Inspect -- query header info (width, height, MIME type) -// 3. Configure (optional) -- set target size for downscaling -// 4. Stride -- call MinimumStride to learn the row byte count -// 5. Allocate -- create a pixel buffer of stride * height bytes -// 6. Decode -- fill the buffer with decoded pixel data -// 7. Close -- release the decoder -// -// The Decoder cannot be created directly from Go: it requires either a -// POSIX file descriptor (AImageDecoder_createFromFd) or an in-memory -// buffer (AImageDecoder_createFromBuffer). These factory functions are -// not yet exposed in the high-level image package; they can be accessed -// through the raw NDK layer when needed. -// -// Creation pattern (pseudocode): -// -// var decoder *image.Decoder -// fd := openImageFile() // POSIX file descriptor -// // create decoder from fd (factory not yet in high-level API) -// defer decoder.Close() -// -// Once the Decoder is obtained, the high-level API takes over. -// -// This program must run on an Android device with API 30+. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/image" -) - -// errorInfo pairs an Error constant with its name and meaning. -type errorInfo struct { - name string - value image.Error - detail string -} - -// errors lists every image.Error constant with a description of when it -// is returned by the NDK. -var errors = []errorInfo{ - { - name: "Incomplete", - value: image.ErrIncomplete, - detail: "The input data was truncated. The decoder may have partially decoded the image.", - }, - { - name: "Error", - value: image.ErrError, - detail: "Generic decoding error. Returned when no more specific code applies.", - }, - { - name: "InvalidConversion", - value: image.ErrInvalidConversion, - detail: "The requested pixel format conversion is not supported.", - }, - { - name: "InvalidScale", - value: image.ErrInvalidScale, - detail: "The target size set via SetTargetSize is invalid (e.g. zero or negative).", - }, - { - name: "BadParameter", - value: image.ErrBadParameter, - detail: "A nil pointer or otherwise invalid argument was passed.", - }, - { - name: "InvalidInput", - value: image.ErrInvalidInput, - detail: "The input data is not a recognized image format.", - }, - { - name: "SeekError", - value: image.ErrSeekError, - detail: "The data source does not support seeking, which is required for decoding.", - }, - { - name: "InternalError", - value: image.ErrInternalError, - detail: "An unexpected internal error occurred in the decoder.", - }, - { - name: "UnsupportedFormat", - value: image.ErrUnsupportedFormat, - detail: "The image format is recognized but not supported for decoding.", - }, - { - name: "Finished", - value: image.ErrFinished, - detail: "The decoder has already finished decoding (e.g. single-frame image decoded twice).", - }, - { - name: "InvalidState", - value: image.ErrInvalidState, - detail: "The decoder is in a state that does not allow the requested operation.", - }, -} - -func main() { - fmt.Println("=== ndk/image API overview ===") - fmt.Println() - - // --------------------------------------------------------------- - // Decoder creation - // - // The Decoder struct wraps an NDK AImageDecoder pointer. It is - // NOT created directly from Go. The Android NDK provides two - // factory functions: - // - // AImageDecoder_createFromFd(fd, out) - // Creates a decoder from a POSIX file descriptor. The fd - // must be open for reading and seekable. The caller retains - // ownership of the fd and must close it after the decoder - // is finished. - // - // AImageDecoder_createFromBuffer(buf, length, out) - // Creates a decoder from an in-memory buffer. The buffer - // must remain valid for the lifetime of the decoder. - // - // Both return 0 (ANDROID_IMAGE_DECODER_SUCCESS) on success, or a - // negative error code that can be converted to image.Error. - // - // These factory functions are not yet wrapped in the high-level - // image package; they are available in the raw NDK layer. - // --------------------------------------------------------------- - - fmt.Println("Decoder creation:") - fmt.Println() - fmt.Println(" From file descriptor:") - fmt.Println(" AImageDecoder_createFromFd(int32(fd), &decoder)") - fmt.Println() - fmt.Println(" From memory buffer:") - fmt.Println(" AImageDecoder_createFromBuffer(ptr, length, &decoder)") - fmt.Println() - - // --------------------------------------------------------------- - // Decoder methods - // --------------------------------------------------------------- - - fmt.Println("Decoder methods:") - fmt.Println() - fmt.Println(" MinimumStride() int32") - fmt.Println(" Returns the minimum number of bytes per row in the") - fmt.Println(" decoded output. This depends on the image width and") - fmt.Println(" the output pixel format (RGBA_8888 by default, so") - fmt.Println(" stride = width * 4). Call this after any SetTargetSize") - fmt.Println(" to get the stride for the configured dimensions.") - fmt.Println() - fmt.Println(" SetTargetSize(width, height int32) error") - fmt.Println(" Request the decoder to scale the output to the given") - fmt.Println(" dimensions. Both values must be positive and no larger") - fmt.Println(" than the original image size. Returns ErrInvalidScale") - fmt.Println(" if the dimensions are invalid. This is optional; by") - fmt.Println(" default the image is decoded at its original size.") - fmt.Println() - fmt.Println(" Decode(pixels unsafe.Pointer, stride int64, size int64) error") - fmt.Println(" Decode the image into the provided pixel buffer.") - fmt.Println(" - pixels: pointer to the output buffer") - fmt.Println(" - stride: bytes per row (>= MinimumStride())") - fmt.Println(" - size: total buffer size in bytes (>= stride * height)") - fmt.Println(" Returns nil on success, or an Error on failure.") - fmt.Println() - fmt.Println(" Close() error") - fmt.Println(" Release the underlying AImageDecoder. Safe to call") - fmt.Println(" multiple times (idempotent). Must be called when") - fmt.Println(" decoding is complete to free native resources.") - fmt.Println() - - // --------------------------------------------------------------- - // HeaderInfo - // - // After creating a decoder, the header can be queried through the - // NDK functions: - // - // AImageDecoder_getHeaderInfo(decoder) -> *AImageDecoderHeaderInfo - // AImageDecoderHeaderInfo_getWidth(info) -> int32 - // AImageDecoderHeaderInfo_getHeight(info) -> int32 - // AImageDecoderHeaderInfo_getMimeType(info) -> *byte - // - // The HeaderInfo pointer is owned by the decoder; it is valid - // until the decoder is deleted and must NOT be freed separately. - // - // These functions are not yet wrapped in the high-level image - // package; they are available in the raw NDK layer. - // --------------------------------------------------------------- - - fmt.Println("HeaderInfo (via NDK layer):") - fmt.Println() - fmt.Println(" AImageDecoder_getHeaderInfo(decoder) -> *AImageDecoderHeaderInfo") - fmt.Println(" Returns a pointer to the header info. Owned by the decoder.") - fmt.Println() - fmt.Println(" AImageDecoderHeaderInfo_getWidth(info) -> int32") - fmt.Println(" Original image width in pixels.") - fmt.Println() - fmt.Println(" AImageDecoderHeaderInfo_getHeight(info) -> int32") - fmt.Println(" Original image height in pixels.") - fmt.Println() - fmt.Println(" AImageDecoderHeaderInfo_getMimeType(info) -> *byte") - fmt.Println(" MIME type string (e.g. \"image/png\"). Null-terminated,") - fmt.Println(" owned by the decoder.") - fmt.Println() - - // --------------------------------------------------------------- - // Complete decode pattern (pseudocode) - // --------------------------------------------------------------- - - fmt.Println("Complete decode pattern (pseudocode):") - fmt.Println() - fmt.Println(" // 1. Open the image file.") - fmt.Println(" fd, _ := syscall.Open(\"photo.jpg\", syscall.O_RDONLY, 0)") - fmt.Println(" defer syscall.Close(fd)") - fmt.Println() - fmt.Println(" // 2. Create the decoder from the fd.") - fmt.Println(" // (factory function not yet in high-level image package)") - fmt.Println() - fmt.Println(" // 3. Query image dimensions from the header.") - fmt.Println(" // (header info not yet in high-level image package)") - fmt.Println() - fmt.Println(" // 4. (Optional) Downscale to half size.") - fmt.Println(" decoder.SetTargetSize(width/2, height/2)") - fmt.Println() - fmt.Println(" // 5. Query the stride for the (possibly resized) output.") - fmt.Println(" stride := decoder.MinimumStride()") - fmt.Println() - fmt.Println(" // 6. Allocate the pixel buffer.") - fmt.Println(" // For RGBA_8888 at half size: stride * (height/2) bytes.") - fmt.Println(" pixels := make([]byte, int64(stride)*int64(height/2))") - fmt.Println() - fmt.Println(" // 7. Decode into the buffer.") - fmt.Println(" err := decoder.Decode(") - fmt.Println(" unsafe.Pointer(&pixels[0]),") - fmt.Println(" int64(stride),") - fmt.Println(" int64(len(pixels)),") - fmt.Println(" )") - fmt.Println(" // check err == nil") - fmt.Println() - fmt.Println(" // 8. Clean up.") - fmt.Println(" decoder.Close()") - fmt.Println() - - // --------------------------------------------------------------- - // Error constants - // --------------------------------------------------------------- - - fmt.Println("Error constants:") - fmt.Println() - for _, e := range errors { - fmt.Printf(" %-20s code=%3d %s\n", - e.name, int32(e.value), e.detail) - } -} diff --git a/examples/input/event-types/main.go b/examples/input/event-types/main.go deleted file mode 100644 index db55659..0000000 --- a/examples/input/event-types/main.go +++ /dev/null @@ -1,124 +0,0 @@ -// Example: input event type system and processing pattern. -// -// Prints all enum types in the ndk/input package -- event types, key actions, -// input sources, and motion actions -- together with their integer values and -// human-readable string representations. This demonstrates the full set of -// constants that classify input events on Android. -// -// Input events flow through the system in four steps: -// -// 1. The Activity receives an AInputQueue from the framework. -// 2. The Queue is polled for pending events (Queue.HasEvents). -// 3. Each Event is inspected: Event.Type tells you whether it is a Key or -// Motion event, and the remaining accessors (KeyAction, KeyCode, -// MotionAction, X, Y, Pressure, etc.) provide the details. -// 4. After processing, the event must be returned to the system with -// Queue.FinishEvent so Android knows whether the app handled it. -// -// Actually receiving events requires an AInputQueue obtained from an Android -// Activity, so this example focuses on the type system and documents the -// processing pattern in code comments. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/input" -) - -func main() { - // -- Event types ------------------------------------------------------- - // EventType distinguishes the two broad categories of input events. - // Key events come from physical or virtual keys; motion events come from - // touch, mouse, or joystick input. - fmt.Println("Event types:") - for _, et := range []input.EventType{input.Key, input.Motion} { - fmt.Printf(" %-8s = %d\n", et, int32(et)) - } - fmt.Println() - - // -- Key actions ------------------------------------------------------- - // KeyAction tells you what phase a key event is in. Down fires when the - // key is first pressed, Up when released, and Multiple for repeated - // character generation (soft keyboard). - fmt.Println("Key actions:") - for _, ka := range []input.KeyAction{input.Down, input.Up, input.Multiple} { - fmt.Printf(" %-10s = %d\n", ka, int32(ka)) - } - fmt.Println() - - // -- Input sources ----------------------------------------------------- - // Source identifies the hardware class that produced the event. - // Keyboard covers both physical keys and soft input methods. - // Touchscreen is the primary source for finger-driven motion events. - // Mouse covers USB or Bluetooth mice (and trackpads in mouse mode). - // Joystick covers game controllers. - fmt.Println("Input sources:") - for _, src := range []input.Source{ - input.Keyboard, - input.Touchscreen, - input.Mouse, - input.Joystick, - } { - fmt.Printf(" %-14s = %d\n", src, int32(src)) - } - fmt.Println() - - // -- Motion actions ---------------------------------------------------- - // MotionAction describes the gesture phase. ActionDown / ActionUp mark - // the first and last finger touching the screen. ActionMove fires as the - // finger moves. ActionCancel means the gesture was cancelled by the - // system. ActionPointerDown / ActionPointerUp track secondary fingers in - // a multi-touch gesture. - fmt.Println("Motion actions:") - for _, ma := range []input.MotionAction{ - input.ActionDown, - input.ActionUp, - input.ActionMove, - input.ActionCancel, - input.ActionPointerDown, - input.ActionPointerUp, - } { - fmt.Printf(" %-20s = %d\n", ma, int32(ma)) - } - fmt.Println() - - // -- Processing pattern (pseudo-code) ---------------------------------- - // The code below illustrates the typical event loop. It cannot run - // without a real AInputQueue, so it is guarded by a false constant. - // - // // Assume queue is an *input.Queue obtained from the Activity. - // if err := queue.HasEvents(); err == nil { - // // Retrieve the next event (via looper poll, not shown). - // var event *input.Event - // eventType := input.EventType(event.Type()) - // - // switch eventType { - // case input.Key: - // action := input.KeyAction(event.KeyAction()) - // code := event.KeyCode() - // repeat := event.RepeatCount() - // fmt.Printf("key: action=%s code=%d repeat=%d\n", action, code, repeat) - // - // case input.Motion: - // action := input.MotionAction(event.MotionAction()) - // source := input.Source(event.Source()) - // count := event.PointerCount() - // for i := int64(0); i < int64(count); i++ { - // x, y := event.X(i), event.Y(i) - // pressure := event.Pressure(i) - // fmt.Printf("motion: action=%s source=%s pointer=%d (%.1f, %.1f) pressure=%.2f\n", - // action, source, i, x, y, pressure) - // } - // } - // - // // Return the event to the system. Pass 1 if handled, 0 otherwise. - // queue.FinishEvent(event, 1) - // } - // - // // When the Activity's input queue is being destroyed: - // queue.DetachLooper() - fmt.Println("Event processing pattern printed above in source comments.") -} diff --git a/examples/input/touch-handling/main.go b/examples/input/touch-handling/main.go deleted file mode 100644 index da8ba1d..0000000 --- a/examples/input/touch-handling/main.go +++ /dev/null @@ -1,254 +0,0 @@ -// Touch and key input event handling example. -// -// Demonstrates the complete input event processing pipeline using the -// ndk/input package. On Android, input events (touches, key presses) -// are delivered through an AInputQueue that the framework attaches to -// the Activity. This example shows: -// -// - How to wrap a raw AInputQueue pointer into an input.Queue. -// - The full event polling loop: HasEvents -> GetEvent -> -// PreDispatchEvent -> handle -> FinishEvent. -// - Dispatching key events (action, keycode, repeat count). -// - Dispatching motion/touch events (action, pointer count, -// per-pointer x/y coordinates and pressure). -// - How to integrate the input queue with an ALooper for -// continuous event-driven processing (documented in comments). -// -// The event loop runs against a nil queue pointer in this example, so -// HasEvents returns an error immediately and no events are delivered. -// In a real NativeActivity the queue pointer comes from the framework -// via the onInputQueueCreated callback. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - "log" - "runtime" - "unsafe" - - "github.com/AndroidGoLab/ndk/input" -) - -// looperIdent is the identifier returned by ALooper_pollOnce when the -// input queue has pending events. Any positive integer works; this -// value must match the ident passed to AInputQueue_attachLooper. -const looperIdent = 2 - -func main() { - // Lock to the OS thread. Both ALooper and AInputQueue are - // thread-local on Android, so all calls must happen on the same - // OS thread that prepared the looper. - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - // --------------------------------------------------------------- - // Step 1: Obtain the input queue - // - // In a NativeActivity the framework delivers an AInputQueue* - // through the onInputQueueCreated callback. Wrap it with - // input.NewQueueFromPointer to get an *input.Queue. - // - // For this example we use a nil pointer. The first HasEvents call - // will return an error, which causes the loop to exit cleanly. - // --------------------------------------------------------------- - - var rawQueuePtr unsafe.Pointer // would come from onInputQueueCreated - queue := input.NewQueueFromPointer(rawQueuePtr) - - fmt.Println("=== Input event handling example ===") - fmt.Println() - fmt.Println("Queue created from pointer:", queue.Pointer()) - fmt.Println() - - // --------------------------------------------------------------- - // Step 2: Looper integration (documented pattern) - // - // Before polling for events, the queue must be attached to an - // ALooper so that the looper wakes up when input is available. - // The idiomatic looper package provides Prepare and PollOnce: - // - // import "github.com/AndroidGoLab/ndk/looper" - // - // lp := looper.Prepare(int32(looper.ALOOPER_PREPARE_ALLOW_NON_CALLBACKS)) - // defer lp.Close() - // - // Attaching the queue to the looper is done at the the low-level layer level - // (the idiomatic binding does not yet expose AttachLooper): - // - // AInputQueue_attachLooper( - // (*AInputQueue)(queue.Pointer()), - // (*ALooper)(lp.Pointer()), - // looperIdent, // returned by PollOnce when events are ready - // nil, // no C callback; use poll-based reading - // nil, // no user data - // ) - // - // Then the main loop becomes: - // - // for { - // ident := looper.PollOnce(-1, nil, nil, nil) - // if ident == looperIdent { - // processInputEvents(queue) - // } - // } - // - // When the Activity's input queue is being destroyed - // (onInputQueueDestroyed), detach and stop polling: - // - // queue.DetachLooper() - // --------------------------------------------------------------- - - // --------------------------------------------------------------- - // Step 3: Event polling loop - // - // processInputEvents drains all pending events from the queue. - // In a real app this function is called each time the looper - // returns the input queue's ident. - // --------------------------------------------------------------- - - if queue.Pointer() == nil { - fmt.Println("No real AInputQueue available (nil pointer).") - fmt.Println("In a NativeActivity, the queue comes from onInputQueueCreated.") - } else { - processInputEvents(queue) - } - - fmt.Println() - fmt.Println("See main.go source for the full processing pattern.") -} - -// processInputEvents drains all pending input events from the queue, -// dispatches them based on type (key or motion), and returns each -// event to the system. -func processInputEvents(queue *input.Queue) { - for { - // Check whether the queue has pending events. - if err := queue.HasEvents(); err != nil { - log.Printf("HasEvents: %v (no more events or queue unavailable)", err) - return - } - - // Retrieve the next event. GetEvent returns nil when the - // internal AInputQueue_getEvent call fails (e.g. no events). - event := queue.GetEvent() - if event == nil { - log.Println("GetEvent returned nil, stopping") - return - } - - // Pre-dispatch gives the system (e.g. the IME) a chance to - // consume the event before the app sees it. If it returns - // true the event was consumed and must NOT be passed to - // FinishEvent. - if queue.PreDispatchEvent(event) { - log.Println("event consumed by pre-dispatch (e.g. IME)") - continue - } - - // Dispatch based on event type. - handled := handleEvent(event) - - // Return the event to the system. Pass 1 if the app handled - // it, 0 to let the system perform the default action. - var handledFlag int32 - if handled { - handledFlag = 1 - } - queue.FinishEvent(event, handledFlag) - } -} - -// handleEvent inspects the event type and delegates to the -// appropriate handler. Returns true if the event was handled. -func handleEvent(event *input.Event) bool { - eventType := input.EventType(event.Type()) - source := input.Source(event.Source()) - - switch eventType { - case input.Key: - return handleKeyEvent(event, source) - - case input.Motion: - return handleMotionEvent(event, source) - - default: - fmt.Printf("unknown event type: %s (source=%s)\n", eventType, source) - return false - } -} - -// handleKeyEvent processes a key press/release event. -func handleKeyEvent(event *input.Event, source input.Source) bool { - action := input.KeyAction(event.KeyAction()) - keyCode := event.KeyCode() - repeatCount := event.RepeatCount() - - fmt.Printf("KEY event: action=%-8s keycode=%-4d repeat=%-2d source=%s\n", - action, keyCode, repeatCount, source) - - // Example: treat Down and Up as handled, ignore Multiple. - switch action { - case input.Down: - fmt.Printf(" -> key %d pressed\n", keyCode) - return true - - case input.Up: - fmt.Printf(" -> key %d released\n", keyCode) - return true - - case input.Multiple: - fmt.Printf(" -> key %d repeated %d times\n", keyCode, repeatCount) - return true - - default: - return false - } -} - -// handleMotionEvent processes touch, mouse, or stylus motion events. -func handleMotionEvent(event *input.Event, source input.Source) bool { - action := input.MotionAction(event.MotionAction()) - - // The raw action value encodes both the action and (for - // pointer-down/up) the pointer index in the upper bits. - // Mask out the action to get the gesture phase. - maskedAction := input.MotionAction(int32(action) & int32(input.ActionMask)) - - pointerCount := event.PointerCount() - - fmt.Printf("MOTION event: action=%-18s pointers=%-2d source=%s\n", - maskedAction, pointerCount, source) - - // Print per-pointer coordinates and pressure. - for i := uint64(0); i < pointerCount; i++ { - x := event.X(i) - y := event.Y(i) - pressure := event.Pressure(i) - fmt.Printf(" pointer[%d]: x=%8.2f y=%8.2f pressure=%.3f\n", - i, x, y, pressure) - } - - switch maskedAction { - case input.ActionDown: - fmt.Println(" -> first finger touched the screen") - - case input.ActionUp: - fmt.Println(" -> last finger lifted from the screen") - - case input.ActionMove: - fmt.Println(" -> finger(s) moved") - - case input.ActionCancel: - fmt.Println(" -> gesture cancelled by the system") - - case input.ActionPointerDown: - fmt.Println(" -> additional finger touched the screen") - - case input.ActionPointerUp: - fmt.Println(" -> non-primary finger lifted") - } - - return true -} diff --git a/examples/log/priorities/main.go b/examples/log/priorities/main.go deleted file mode 100644 index fa2681f..0000000 --- a/examples/log/priorities/main.go +++ /dev/null @@ -1,103 +0,0 @@ -// Example: Android log priority levels and their string representations. -// -// Enumerates every Priority constant exported by ndk/log and prints -// its name, integer value, and the equivalent Android logcat letter. -// -// The NDK function __android_log_write(int prio, const char *tag, -// const char *text) accepts these priority values as its first argument. -// In Go code using ndk you would pass androidlog.Debug, androidlog.Info, -// etc. to any API that requires a log priority. -// -// Priority levels from lowest to highest: -// -// Unknown (0) – should not normally appear in output -// Default (1) – the default priority; logcat maps it to the minimum -// Verbose (2) – extremely detailed, usually disabled in production -// Debug (3) – development diagnostics -// Info (4) – normal operational messages -// Warn (5) – unexpected but recoverable situations -// Error (6) – failures that need attention -// Fatal (7) – unrecoverable errors; typically followed by abort -// Silent (8) – suppresses all output; used only as a filter, never for writing -// -// This program runs on the host (no Android device required) because -// it only inspects the constant values without calling into the NDK. -package main - -import ( - "fmt" - - androidlog "github.com/AndroidGoLab/ndk/log" -) - -// logcatLetter returns the single-character abbreviation that logcat -// uses for each priority level (e.g. "V" for Verbose, "D" for Debug). -func logcatLetter(p androidlog.Priority) string { - switch p { - case androidlog.Verbose: - return "V" - case androidlog.Debug: - return "D" - case androidlog.Info: - return "I" - case androidlog.Warn: - return "W" - case androidlog.Error: - return "E" - case androidlog.Fatal: - return "F" - case androidlog.Silent: - return "S" - default: - return "?" - } -} - -func main() { - // Every priority constant in ascending order. - priorities := []androidlog.Priority{ - androidlog.Unknown, - androidlog.Default, - androidlog.Verbose, - androidlog.Debug, - androidlog.Info, - androidlog.Warn, - androidlog.Error, - androidlog.Fatal, - androidlog.Silent, - } - - fmt.Println("Android log priority levels:") - fmt.Println() - fmt.Printf(" %-10s %5s %s\n", "Name", "Value", "Logcat") - fmt.Printf(" %-10s %5s %s\n", "----------", "-----", "------") - - for _, p := range priorities { - fmt.Printf(" %-10s %5d %s\n", p.String(), int(p), logcatLetter(p)) - } - - // Demonstrate that the String() method handles out-of-range values. - fmt.Println() - fmt.Printf(" Out-of-range value: %s\n", androidlog.Priority(42)) - - // Show typical usage: choosing a minimum log level for filtering. - // - // On Android, logcat filters by priority. For example, setting the - // minimum to Warn suppresses Verbose, Debug, and Info messages: - // - // adb logcat *:W - // - // In application code the same comparison decides whether to emit - // a message: - // - // if msgPriority >= minPriority { /* write to log */ } - fmt.Println() - minLevel := androidlog.Warn - fmt.Printf(" Filter example: minimum level = %s (%d)\n", minLevel, int(minLevel)) - - for _, p := range priorities { - if p >= minLevel && p != androidlog.Silent { - fmt.Printf(" %s would be printed\n", p) - } - } -} diff --git a/examples/looper/basic-loop/main.go b/examples/looper/basic-loop/main.go deleted file mode 100644 index cfa82a9..0000000 --- a/examples/looper/basic-loop/main.go +++ /dev/null @@ -1,75 +0,0 @@ -// Basic ALooper event loop example. -// -// Demonstrates how to prepare an ALooper for the current thread, wake it from -// a separate goroutine, and poll for the wake event. This is the fundamental -// pattern for any ALooper-based event loop on Android. -// -// This program must run on an Android device with NDK looper support. -package main - -import ( - "log" - "runtime" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/looper" -) - -func main() { - // Lock this goroutine to its OS thread. ALooper is thread-local, so the - // prepare and poll calls must happen on the same OS thread. - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - // Prepare a looper for the current thread. The non-callbacks flag allows - // PollOnce to return file descriptor events directly instead of requiring - // a C callback. - lp := looper.Prepare(int32(looper.ALOOPER_PREPARE_ALLOW_NON_CALLBACKS)) - if lp == nil { - log.Fatal("failed to prepare looper") - } - defer func() { - if err := lp.Close(); err != nil { - log.Printf("close looper: %v", err) - } - }() - - log.Println("looper prepared, acquiring extra reference for wake goroutine") - - // Acquire an extra reference so the wake goroutine can safely call Wake - // while the main goroutine still owns the looper. - lp.Acquire() - - // Launch a goroutine that wakes the looper after a short delay. - go func() { - time.Sleep(100 * time.Millisecond) - log.Println("goroutine: waking looper") - lp.Wake() - }() - - log.Println("entering poll loop (blocking until wake)") - - // Poll with an indefinite timeout (-1). PollOnce blocks until an event - // arrives or the looper is woken. - var fd, events int32 - var data unsafe.Pointer - - result := looper.LOOPER_POLL(looper.PollOnce(-1, &fd, &events, &data)) - - switch result { - case looper.ALOOPER_POLL_WAKE: - log.Println("poll returned: WAKE -- looper was woken successfully") - case looper.ALOOPER_POLL_CALLBACK: - log.Println("poll returned: CALLBACK") - case looper.ALOOPER_POLL_TIMEOUT: - log.Println("poll returned: TIMEOUT (unexpected with infinite wait)") - case looper.ALOOPER_POLL_ERROR: - log.Fatal("poll returned: ERROR") - default: - // A non-negative value is a file descriptor that has events. - log.Printf("poll returned fd=%d events=%d", result, events) - } - - log.Println("basic loop finished") -} diff --git a/examples/looper/timeout-poll/main.go b/examples/looper/timeout-poll/main.go deleted file mode 100644 index 20ea34e..0000000 --- a/examples/looper/timeout-poll/main.go +++ /dev/null @@ -1,89 +0,0 @@ -// Timeout-based ALooper polling example. -// -// Demonstrates how to use PollOnce with a finite timeout so the event loop -// returns periodically even when no events are pending. This pattern is useful -// for performing periodic work (heartbeats, progress checks, housekeeping) -// alongside event-driven I/O. -// -// This program must run on an Android device with NDK looper support. -package main - -import ( - "log" - "runtime" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/looper" -) - -func pollResultString(r looper.LOOPER_POLL) string { - switch r { - case looper.ALOOPER_POLL_WAKE: - return "WAKE" - case looper.ALOOPER_POLL_CALLBACK: - return "CALLBACK" - case looper.ALOOPER_POLL_TIMEOUT: - return "TIMEOUT" - case looper.ALOOPER_POLL_ERROR: - return "ERROR" - default: - return "FD_EVENT" - } -} - -func main() { - // Lock this goroutine to its OS thread because ALooper is thread-local. - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - lp := looper.Prepare(int32(looper.ALOOPER_PREPARE_ALLOW_NON_CALLBACKS)) - if lp == nil { - log.Fatal("failed to prepare looper") - } - defer func() { - if err := lp.Close(); err != nil { - log.Printf("close looper: %v", err) - } - }() - - const ( - timeout = 200 * time.Millisecond // poll timeout - iterations = 5 // number of poll cycles to run - ) - - log.Printf("polling %d times with %v timeout", iterations, timeout) - - var fd, events int32 - var data unsafe.Pointer - - for i := 1; i <= iterations; i++ { - result := looper.LOOPER_POLL(looper.PollOnce(timeout, &fd, &events, &data)) - log.Printf("poll %d/%d: result=%s (%d)", i, iterations, - pollResultString(result), result) - - if result == looper.ALOOPER_POLL_TIMEOUT { - // No events arrived within the timeout window. This is the - // expected path in this example since nothing is waking the - // looper or registering file descriptors. - log.Printf(" -> timeout elapsed, performing periodic work") - continue - } - - if result == looper.ALOOPER_POLL_WAKE { - log.Printf(" -> looper was woken externally") - continue - } - - if result == looper.ALOOPER_POLL_ERROR { - log.Fatal(" -> poll error, exiting") - } - - // Non-negative result means a monitored fd has events. - if result >= 0 { - log.Printf(" -> fd=%d events=%d", result, events) - } - } - - log.Println("timeout poll finished") -} diff --git a/examples/media/codec-lifecycle/main.go b/examples/media/codec-lifecycle/main.go deleted file mode 100644 index af0121f..0000000 --- a/examples/media/codec-lifecycle/main.go +++ /dev/null @@ -1,128 +0,0 @@ -// MediaCodec full lifecycle example. -// -// Demonstrates the complete AMediaCodec state machine for an H.264 video -// decoder: create, configure, start, the buffer processing loop pattern, -// flush, stop, and close. The codec transitions through these states: -// -// Created -> Configured -> Started -> (processing) -> Flushed -> Started -> Stopped -> Released -// -// The configure and start steps require an Activity context, so they are -// skipped here. The buffer processing loop is shown as commented-out code -// using the idiomatic media.DequeueInputBuffer, media.DequeueOutputBuffer, -// and media.BufferInfo APIs. -// -// This program must run on an Android device with NDK media support. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/media" -) - -func main() { - // State: (none) -> Created - // Create an H.264 decoder. - codec := media.NewDecoder("video/avc") - if codec == nil { - log.Fatal("NewDecoder returned nil: H.264 decoder not available") - } - defer func() { - if err := codec.Close(); err != nil { - log.Printf("close codec: %v", err) - } - }() - fmt.Println("state: Created") - - // Build the format describing the compressed input stream. - format := media.NewFormat() - defer func() { - if err := format.Close(); err != nil { - log.Printf("close format: %v", err) - } - }() - - format. - SetString("mime", "video/avc"). - SetInt32("width", 1920). - SetInt32("height", 1080) - - // Verify format properties were stored correctly. - var width, height int32 - if !format.GetInt32("width", &width) || !format.GetInt32("height", &height) { - log.Fatal("failed to read back format properties") - } - fmt.Printf("format: video/avc %dx%d\n", width, height) - - // State: Created -> Configured - // Configure the decoder without a surface (buffer-mode) and without DRM. - // Note: AMediaCodec_configure may crash with SIGSEGV on some devices - // when called outside a proper Activity context (no display surface). - // In a real app, configure is called from the NativeActivity thread. - fmt.Println("state: Configured (skipped — requires Activity context)") - - // State: Configured -> Started - // codec.Start() also requires prior Configure, so it is skipped here. - // In a real NativeActivity app: - // if err := codec.Configure(format, nil, nil, 0); err != nil { ... } - // if err := codec.Start(); err != nil { ... } - fmt.Println("state: Started (skipped — requires Activity context)") - - // -- Buffer processing loop (documented pattern) -- - // - // In a real application the loop uses the idiomatic media package: - // - // const timeoutUs int64 = 10000 // 10ms - // - // for { - // // 1. Dequeue an input buffer. - // idx := codec.DequeueInputBuffer(timeoutUs) - // if idx < 0 { - // continue // no buffer available yet - // } - // - // // 2. Fill the buffer with compressed data (NAL units for H.264). - // var bufSize uint64 - // buf := codec.GetInputBuffer(uint64(idx), &bufSize) - // data := unsafe.Slice(buf, bufSize) - // n := copy(data, nalUnit) - // - // // 3. Queue the filled buffer for decoding. - // codec.QueueInputBuffer(uint64(idx), 0, uint64(n), presentationTimeUs, 0) - // // For end-of-stream, pass uint32(media.AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) as flags. - // - // // 4. Dequeue an output buffer using media.BufferInfo. - // var info media.BufferInfo - // outIdx := codec.DequeueOutputBuffer(&info, timeoutUs) - // if outIdx == int64(media.AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) { - // continue // output format changed, query new format - // } - // if outIdx < 0 { - // continue // try again - // } - // - // // 5. Consume the decoded frame from the output buffer. - // // info.Offset, info.Size, info.PresentationTimeUs, info.Flags - // // describe the output buffer contents. - // var outSize uint64 - // outBuf := codec.GetOutputBuffer(uint64(outIdx), &outSize) - // outData := unsafe.Slice(outBuf, outSize) - // processFrame(outData) - // - // // 6. Release the output buffer back to the codec. - // codec.ReleaseOutputBuffer(uint64(outIdx), false) - // } - fmt.Println("state: Started (buffer loop would run here)") - - // The following lifecycle steps require a properly configured and - // started codec, which needs an Activity context. Documented here: - // - // codec.Flush() // Started -> Flushed (discard pending buffers) - // // After flush, codec stays in Started state, ready for new input. - // codec.Stop() // Started -> Stopped - // codec.Close() // Stopped -> Released (free all resources) - fmt.Println("state: Released (via deferred Close)") - - fmt.Println("codec lifecycle complete") -} diff --git a/examples/media/decoder-setup/main.go b/examples/media/decoder-setup/main.go deleted file mode 100644 index 5db050c..0000000 --- a/examples/media/decoder-setup/main.go +++ /dev/null @@ -1,64 +0,0 @@ -// Video decoder setup example. -// -// Demonstrates how to create an H.264 video decoder using AMediaCodec, -// build a format describing the input stream, and configure the codec. -// The codec is configured without a surface (nil window) and without -// DRM (zero-value Crypto), which is the pattern for buffer-mode decoding. -// -// On a real device this would be followed by Start(), the input/output -// buffer loop (QueueInputBuffer / DequeueOutputBuffer / ReleaseOutputBuffer), -// and finally Stop(). Here we stop at Configure to illustrate the setup -// pattern without requiring an actual bitstream or display surface. -// -// This program must run on an Android device with NDK media support. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/media" -) - -func main() { - // 1. Create a decoder for H.264. - codec := media.NewDecoder("video/avc") - if codec == nil { - log.Fatal("NewDecoder returned nil: H.264 decoder not available") - } - defer func() { - if err := codec.Close(); err != nil { - log.Printf("close codec: %v", err) - } - }() - fmt.Println("H.264 decoder created") - - // 2. Build the input format describing the compressed video. - format := media.NewFormat() - defer func() { - if err := format.Close(); err != nil { - log.Printf("close format: %v", err) - } - }() - - format. - SetString("mime", "video/avc"). - SetInt32("width", 1280). - SetInt32("height", 720) - - // 3. Configure the codec. - // - window: nil (no surface, buffer-mode decoding) - // - crypto: zero-value Crypto (no DRM) - // - flags: 0 (decoder; use 1 for encoder) - // Note: AMediaCodec_configure may crash with SIGSEGV outside an Activity - // context. In a real app, configure is called from the NativeActivity thread. - fmt.Println("configured (skipped — requires Activity context)") - fmt.Println("codec configured for 1280x720 H.264 decoding") - - // 4. In a real application the next steps would be: - // codec.Start() - // ... dequeue input buffers, fill with NAL units, queue them ... - // ... dequeue output buffers, consume decoded frames, release them ... - // codec.Stop() - fmt.Println("decoder setup complete (not started, no bitstream available)") -} diff --git a/examples/media/format-create/main.go b/examples/media/format-create/main.go deleted file mode 100644 index 5f91580..0000000 --- a/examples/media/format-create/main.go +++ /dev/null @@ -1,61 +0,0 @@ -// Media format creation and property access example. -// -// Demonstrates how to create an AMediaFormat, populate it with MIME type, -// resolution, and bitrate using the chaining API, and then query values -// back with GetInt32. The idiomatic API accepts Go strings for key names. -// -// This program must run on an Android device with NDK media support. -package main - -import ( - "fmt" - "log" - "os" - - "github.com/AndroidGoLab/ndk/media" -) - -func main() { - // NDK format keys as Go strings. - keyWidth := "width" - keyHeight := "height" - keyBitrate := "bitrate" - keyFrameRate := "frame-rate" - - // Create a format and configure it with chaining. - format := media.NewFormat() - defer func() { - if err := format.Close(); err != nil { - log.Printf("close format: %v", err) - } - }() - - format. - SetString("mime", "video/avc"). - SetInt32(keyWidth, 1920). - SetInt32(keyHeight, 1080). - SetInt32(keyBitrate, 5_000_000). // 5 Mbps - SetInt32(keyFrameRate, 30) - - // Read properties back to verify they were stored. - queries := []struct { - label string - key string - }{ - {"Width", keyWidth}, - {"Height", keyHeight}, - {"Bitrate", keyBitrate}, - {"Frame rate", keyFrameRate}, - } - - fmt.Fprintf(os.Stdout, "Format properties:\n") - for _, q := range queries { - var val int32 - if ok := format.GetInt32(q.key, &val); !ok { - log.Fatalf("GetInt32(%s): key not found", q.label) - } - fmt.Fprintf(os.Stdout, " %-12s: %d\n", q.label, val) - } - - fmt.Println("format created and verified successfully") -} diff --git a/examples/media/muxer-tracks/main.go b/examples/media/muxer-tracks/main.go deleted file mode 100644 index 45128d2..0000000 --- a/examples/media/muxer-tracks/main.go +++ /dev/null @@ -1,118 +0,0 @@ -// Muxer track format preparation example. -// -// Demonstrates how to build AMediaFormat objects for audio and video tracks -// using the chaining API, query properties back with GetInt32, and documents -// how these formats feed into the AMediaMuxer track-addition workflow. -// -// The muxer itself requires a valid file descriptor and encoded media data, -// so this example focuses on the format construction and property verification -// steps that precede muxing. The muxer workflow is documented in comments. -// -// This program must run on an Android device with NDK media support. -package main - -import ( - "fmt" - "log" - "os" - - "github.com/AndroidGoLab/ndk/media" -) - -func main() { - // -- Video track format -- - videoFormat := media.NewFormat() - defer func() { - if err := videoFormat.Close(); err != nil { - log.Printf("close video format: %v", err) - } - }() - - videoFormat. - SetString("mime", "video/avc"). - SetInt32("width", 1920). - SetInt32("height", 1080). - SetInt32("bitrate", 8_000_000). // 8 Mbps - SetInt32("frame-rate", 30). - SetInt32("i-frame-interval", 2) // keyframe every 2 seconds - - fmt.Println("Video track format:") - printInt32Props(videoFormat, []prop{ - {" MIME", "mime"}, // SetString, not readable via GetInt32 - {" Width", "width"}, - {" Height", "height"}, - {" Bitrate", "bitrate"}, - {" Frame rate", "frame-rate"}, - {" I-frame interval", "i-frame-interval"}, - }) - - // -- Audio track format -- - audioFormat := media.NewFormat() - defer func() { - if err := audioFormat.Close(); err != nil { - log.Printf("close audio format: %v", err) - } - }() - - audioFormat. - SetString("mime", "audio/mp4a-latm"). - SetInt32("channel-count", 2). - SetInt32("sample-rate", 44100). - SetInt32("bitrate", 128_000) // 128 kbps - - fmt.Println("Audio track format:") - printInt32Props(audioFormat, []prop{ - {" Channel count", "channel-count"}, - {" Sample rate", "sample-rate"}, - {" Bitrate", "bitrate"}, - }) - - // -- Muxer workflow (documented) -- - // - // In a real application the steps after format creation are: - // - // 1. Open an output file and obtain its file descriptor. - // fd, _ := syscall.Open("output.mp4", syscall.O_WRONLY|syscall.O_CREAT, 0644) - // - // 2. Create a muxer with the desired container format. - // muxer := media.NewMuxer(fd, media.OutputFormatMPEG4) - // - // 3. Add tracks using the formats built above. - // videoTrackIdx := muxer.AddTrack(videoFormat) - // audioTrackIdx := muxer.AddTrack(audioFormat) - // - // 4. Start the muxer (no more tracks can be added after this). - // muxer.Start() - // - // 5. Write encoded samples from the encoder/extractor. - // muxer.WriteSampleData(videoTrackIdx, encodedFrame, bufferInfo) - // muxer.WriteSampleData(audioTrackIdx, encodedAudio, bufferInfo) - // - // 6. Stop and close the muxer to finalize the file. - // muxer.Stop() - // muxer.Close() - - fmt.Println("track formats created and verified successfully") -} - -type prop struct { - label string - key string -} - -// printInt32Props queries each int32 property and prints its value. -// Properties set via SetString are silently skipped since GetInt32 -// cannot read them. -func printInt32Props( - format *media.Format, - props []prop, -) { - for _, p := range props { - var val int32 - if !format.GetInt32(p.key, &val) { - // Not an int32 property (e.g. MIME is a string). - continue - } - fmt.Fprintf(os.Stdout, "%-22s: %d\n", p.label, val) - } -} diff --git a/examples/midi/overview/main.go b/examples/midi/overview/main.go deleted file mode 100644 index a442cc3..0000000 --- a/examples/midi/overview/main.go +++ /dev/null @@ -1,252 +0,0 @@ -// MIDI API overview and reference example. -// -// Demonstrates the full device-to-port lifecycle of the ndk/midi package, -// which wraps Android's native MIDI API (AMidi). The example shows how to: -// -// - Obtain an AMidiDevice handle from the Java MidiManager via JNI -// - Inspect the number of input and output ports on the device -// - Open an input port and send MIDI messages (Note On, Note Off, -// Control Change, Program Change) -// - Construct MIDI messages as byte arrays with the correct status bytes -// - Close ports and the device in the correct order -// -// # Obtaining the AMidiDevice handle -// -// The Android NDK does not provide a way to discover or open MIDI devices -// from C/native code. Device discovery happens on the Java side through -// android.media.midi.MidiManager. A typical pattern is: -// -// 1. In Java/Kotlin, use MidiManager.openDevice() to get a MidiDevice. -// 2. Call AMidiDevice_fromJava(env, javaMidiDevice) via JNI to obtain the -// native AMidiDevice pointer. -// 3. Pass that pointer to Go (e.g. via a cgo bridge or as an unsafe.Pointer -// stored in a global). -// -// Because this example cannot run standalone (it requires a live Android -// MIDI device obtained through JNI), it prints reference information about -// MIDI message formats and demonstrates the API calls that would be made -// once a Device handle is available. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - "unsafe" - - "github.com/AndroidGoLab/ndk/midi" -) - -// MIDI status byte constants (channel voice messages, channel 0). -const ( - noteOff = 0x80 // Note Off, channel 0 - noteOn = 0x90 // Note On, channel 0 - controlChange = 0xB0 // Control Change, channel 0 - programChange = 0xC0 // Program Change, channel 0 -) - -// MIDI note and controller constants used in the examples below. -const ( - middleC = 60 // MIDI note number for Middle C (C4) - velocity = 100 // Note velocity (0-127) - velocityOff = 0 // Velocity 0 acts as Note Off in many contexts - - ccModWheel = 1 // Control Change number: Modulation Wheel - ccVolume = 7 // Control Change number: Channel Volume - ccSustain = 64 // Control Change number: Sustain Pedal - ccAllNotesOff = 123 // Control Change number: All Notes Off -) - -// midiMsg is a convenience alias for building short MIDI messages. -type midiMsg = [3]byte - -// noteOnMsg constructs a 3-byte Note On message. -// Channel is 0-15, note is 0-127, vel is 0-127. -func noteOnMsg(channel, note, vel byte) midiMsg { - return midiMsg{noteOn | (channel & 0x0F), note & 0x7F, vel & 0x7F} -} - -// noteOffMsg constructs a 3-byte Note Off message. -func noteOffMsg(channel, note, vel byte) midiMsg { - return midiMsg{noteOff | (channel & 0x0F), note & 0x7F, vel & 0x7F} -} - -// ccMsg constructs a 3-byte Control Change message. -func ccMsg(channel, controller, value byte) midiMsg { - return midiMsg{controlChange | (channel & 0x0F), controller & 0x7F, value & 0x7F} -} - -// printMsgTable prints a reference table of MIDI message formats. -func printMsgTable() { - fmt.Println("MIDI channel voice message format (channel 0):") - fmt.Println() - fmt.Printf(" %-18s Status Data1 Data2\n", "Message") - fmt.Printf(" %-18s ------ ---------- ----------\n", repeatByte(18, '-')) - fmt.Printf(" %-18s 0x%02X note 0-127 vel 0-127\n", "Note Off", noteOff) - fmt.Printf(" %-18s 0x%02X note 0-127 vel 0-127\n", "Note On", noteOn) - fmt.Printf(" %-18s 0x%02X cc# 0-127 val 0-127\n", "Control Change", controlChange) - fmt.Printf(" %-18s 0x%02X pgm 0-127 (none)\n", "Program Change", programChange) - fmt.Println() - fmt.Println(" Status byte high nibble selects the message type.") - fmt.Println(" Status byte low nibble selects the MIDI channel (0-15).") - fmt.Println() -} - -// repeatByte returns a string of n copies of byte c. Used for table formatting. -func repeatByte(n int, c byte) string { - b := make([]byte, n) - for i := range b { - b[i] = c - } - return string(b) -} - -// sendMsg sends a MIDI message through an InputPort. InputPort.Send takes a -// pointer to the first byte and the message length. -func sendMsg(port *midi.InputPort, msg []byte) error { - return port.Send(&msg[0], uint64(len(msg))) -} - -// showDeviceInfo prints port counts for a MIDI device. -func showDeviceInfo(dev *midi.Device) { - fmt.Printf(" Input ports: %d (send MIDI data TO the device)\n", dev.NumInputPorts()) - fmt.Printf(" Output ports: %d (receive MIDI data FROM the device)\n", dev.NumOutputPorts()) - fmt.Println() -} - -// demonstrateLifecycle shows the full open-send-close sequence on a device. -// In production code the Device would be obtained via JNI; here we accept -// it as a parameter to document the API calls. -func demonstrateLifecycle(dev *midi.Device) error { - showDeviceInfo(dev) - - if dev.NumInputPorts() == 0 { - fmt.Println(" Device has no input ports; skipping send demo.") - return nil - } - - // Open the first input port (port 0). An "input port" from the NDK's - // perspective is a port that accepts data sent FROM the app TO the - // device (e.g. a synthesizer receiving note events). - port, err := dev.OpenInputPort(0) - if err != nil { - return fmt.Errorf("open input port 0: %w", err) - } - defer port.Close() - - fmt.Println(" Opened input port 0.") - - // Build and send example MIDI messages. - messages := []struct { - label string - data midiMsg - }{ - {"Note On (Middle C, vel 100)", noteOnMsg(0, middleC, velocity)}, - {"CC Mod Wheel = 64", ccMsg(0, ccModWheel, 64)}, - {"CC Volume = 100", ccMsg(0, ccVolume, 100)}, - {"Note Off (Middle C)", noteOffMsg(0, middleC, 0)}, - {"CC All Notes Off", ccMsg(0, ccAllNotesOff, 0)}, - } - - for _, m := range messages { - msg := m.data[:] - fmt.Printf(" Send %-32s [% 02X]\n", m.label, msg) - if err := sendMsg(port, msg); err != nil { - return fmt.Errorf("send %s: %w", m.label, err) - } - } - - // Program Change is a 2-byte message (status + program number). - pc := []byte{programChange, 0} // select program 0 - fmt.Printf(" Send %-32s [% 02X]\n", "Program Change 0", pc) - if err := sendMsg(port, pc); err != nil { - return fmt.Errorf("send program change: %w", err) - } - - fmt.Println() - fmt.Println(" All messages sent. Closing port.") - return nil -} - -func main() { - fmt.Println("github.com/AndroidGoLab/ndk/midi API Overview") - fmt.Println("=======================") - fmt.Println() - - // -- Reference: MIDI message format table -- - printMsgTable() - - // -- Reference: constructing MIDI messages as byte arrays -- - fmt.Println("Example MIDI messages as Go byte arrays:") - fmt.Println() - - on := noteOnMsg(0, middleC, velocity) - off := noteOffMsg(0, middleC, 0) - cc := ccMsg(0, ccSustain, 127) - pc := [2]byte{programChange, 42} - - fmt.Printf(" Note On (C4, vel %d): [% 02X]\n", velocity, on[:]) - fmt.Printf(" Note Off (C4): [% 02X]\n", off[:]) - fmt.Printf(" CC Sustain Pedal On: [% 02X]\n", cc[:]) - fmt.Printf(" Program Change 42: [% 02X]\n", pc[:]) - fmt.Println() - - // -- Reference: the JNI bridge pattern -- - fmt.Println("Obtaining a Device handle (JNI bridge pattern):") - fmt.Println() - fmt.Println(" // Java side:") - fmt.Println(" // MidiManager mgr = (MidiManager) getSystemService(MIDI_SERVICE);") - fmt.Println(" // mgr.openDevice(deviceInfo, device -> {") - fmt.Println(" // nativeOnDeviceOpened(device); // JNI call into C/Go") - fmt.Println(" // }, handler);") - fmt.Println() - fmt.Println(" // C/Go JNI bridge (cgo or hand-written):") - fmt.Println(" // AMidiDevice *nativeDevice;") - fmt.Println(" // media_status_t status = AMidiDevice_fromJava(env, javaMidiDevice, &nativeDevice);") - fmt.Println(" //") - fmt.Println(" // The resulting AMidiDevice pointer is wrapped by midi.Device.") - fmt.Println(" // In Go, you would store it via unsafe.Pointer and construct") - fmt.Println(" // the Device value on the Go side.") - fmt.Println() - - // -- Reference: device lifecycle -- - fmt.Println("Device lifecycle (requires a live Android MIDI device):") - fmt.Println() - fmt.Println(" dev := obtainDeviceViaJNI() // see pattern above") - fmt.Println(" defer dev.Close()") - fmt.Println() - fmt.Println(" port, err := dev.OpenInputPort(0)") - fmt.Println(" if err != nil { log.Fatal(err) }") - fmt.Println(" defer port.Close()") - fmt.Println() - fmt.Println(" msg := []byte{0x90, 60, 100} // Note On, C4, velocity 100") - fmt.Println(" err = port.Send(&msg[0], uint64(len(msg)))") - fmt.Println() - - // -- Demonstrate the full API with a nil device guard -- - // In a real app, pass a Device obtained via JNI. Here we show what - // the code would look like; calling demonstrateLifecycle with an - // actual device is left to the integrator. - fmt.Println("InputPort.Send signature:") - fmt.Printf(" func (h *InputPort) Send(buffer *uint8, numBytes uint64) error\n") - fmt.Println() - fmt.Println(" buffer: pointer to the first byte of the MIDI message") - fmt.Println(" numBytes: length of the message in bytes") - fmt.Println() - - // Show how unsafe.Pointer can convert a slice for the Send call. - fmt.Println("Converting a Go slice for Send():") - fmt.Println() - buf := []byte{noteOn, middleC, velocity} - ptr := &buf[0] - fmt.Printf(" buf = %v\n", buf) - fmt.Printf(" &buf[0] is %T (value %p)\n", ptr, unsafe.Pointer(ptr)) - fmt.Printf(" port.Send(&buf[0], %d)\n", len(buf)) - fmt.Println() - - fmt.Println("Error codes:") - fmt.Printf(" midi.ErrUnknown = %d\n", midi.ErrUnknown) - fmt.Printf(" midi.ErrWouldBlock = %d\n", midi.ErrWouldBlock) - fmt.Println() - fmt.Println("Done.") -} diff --git a/examples/permission/check-permissions/main.go b/examples/permission/check-permissions/main.go deleted file mode 100644 index 1dd9272..0000000 --- a/examples/permission/check-permissions/main.go +++ /dev/null @@ -1,55 +0,0 @@ -// Check common Android permissions for the current process. -// -// Queries the Android Permission Manager for four commonly requested -// permissions -- INTERNET, CAMERA, RECORD_AUDIO, and ACCESS_FINE_LOCATION -- -// using the calling process's own PID and UID. For each permission the -// program prints whether it is currently granted or denied. -// -// The result tells you what the system would allow right now; a "denied" -// result means the app either never declared the permission in its manifest -// or the user has not yet granted it at runtime. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - "syscall" - - "github.com/AndroidGoLab/ndk/permission" -) - -func main() { - pid := permission.Pid_t(syscall.Getpid()) - uid := permission.Uid_t(syscall.Getuid()) - - fmt.Printf("Checking permissions for PID %d, UID %d\n\n", pid, uid) - - permissions := []struct { - label string - name string - }{ - {"INTERNET", "android.permission.INTERNET"}, - {"CAMERA", "android.permission.CAMERA"}, - {"RECORD_AUDIO", "android.permission.RECORD_AUDIO"}, - {"ACCESS_FINE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, - } - - for _, p := range permissions { - var result int32 - status := permission.CheckPermission(p.name, pid, uid, &result) - if status != 0 { - fmt.Printf(" %-24s error (status %d)\n", p.label+":", status) - continue - } - - switch permission.Result(result) { - case permission.Granted: - fmt.Printf(" %-24s granted\n", p.label+":") - case permission.Denied: - fmt.Printf(" %-24s denied\n", p.label+":") - default: - fmt.Printf(" %-24s unknown result (%d)\n", p.label+":", result) - } - } -} diff --git a/examples/persistablebundle/overview/main.go b/examples/persistablebundle/overview/main.go deleted file mode 100644 index 2bbbe83..0000000 --- a/examples/persistablebundle/overview/main.go +++ /dev/null @@ -1,134 +0,0 @@ -// PersistableBundle API overview. -// -// Demonstrates the Android PersistableBundle NDK API, which provides a -// type-safe key-value container that can be serialized to a Parcel for -// IPC. PersistableBundles support boolean, int32, int64, float64, and -// string values, as well as nested PersistableBundles. -// -// Available since Android API level 35 (Android 15). -// -// Operations demonstrated: -// -// - Create a new PersistableBundle -// - Put and get scalar values (bool, int32, int64, float64, string) -// - Query the bundle size -// - Duplicate a bundle and compare with IsEqual -// - Nest one bundle inside another -// - Erase a key -// - Clean up with Close -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/persistablebundle" -) - -func main() { - // --------------------------------------------------------------- - // Create a new PersistableBundle. - // --------------------------------------------------------------- - pb := persistablebundle.NewPersistableBundle() - defer pb.Close() - - // --------------------------------------------------------------- - // Put scalar values of each supported type. - // --------------------------------------------------------------- - pb.PutBoolean("debug_enabled", true) - pb.PutInt("retry_count", 3) - pb.PutLong("session_id", 1234567890123) - pb.PutDouble("threshold", 0.95) - pb.PutString("app_name", "MyAndroidApp") - - fmt.Printf("bundle size after inserting 5 keys: %d\n", pb.Size()) - - // --------------------------------------------------------------- - // Get each value back. - // - // Get* methods return true if the key was found. - // --------------------------------------------------------------- - var boolVal bool - if pb.GetBoolean("debug_enabled", &boolVal) { - fmt.Printf(" debug_enabled = %v\n", boolVal) - } else { - log.Fatal("expected key 'debug_enabled' to exist") - } - - var intVal int32 - if pb.GetInt("retry_count", &intVal) { - fmt.Printf(" retry_count = %d\n", intVal) - } else { - log.Fatal("expected key 'retry_count' to exist") - } - - var longVal int64 - if pb.GetLong("session_id", &longVal) { - fmt.Printf(" session_id = %d\n", longVal) - } else { - log.Fatal("expected key 'session_id' to exist") - } - - var doubleVal float64 - if pb.GetDouble("threshold", &doubleVal) { - fmt.Printf(" threshold = %.2f\n", doubleVal) - } else { - log.Fatal("expected key 'threshold' to exist") - } - - // Note: GetString requires a C string allocator callback, - // so it is only available via the capi package. - - // --------------------------------------------------------------- - // Duplicate the bundle and verify equality. - // --------------------------------------------------------------- - pbCopy := pb.Dup() - defer pbCopy.Close() - - fmt.Printf("original == copy: %v\n", pb.IsEqual(pbCopy)) - - // --------------------------------------------------------------- - // Nested bundles. - // - // PersistableBundles can contain other PersistableBundles, - // enabling hierarchical configuration structures. - // --------------------------------------------------------------- - inner := persistablebundle.NewPersistableBundle() - inner.PutInt("inner_value", 42) - - pb.PutPersistableBundle("nested", inner) - // The inner bundle has been copied into pb, so we can close ours. - inner.Close() - - fmt.Printf("bundle size after adding nested bundle: %d\n", pb.Size()) - - retrieved, ok := pb.GetPersistableBundle("nested") - if !ok { - log.Fatal("expected key 'nested' to exist") - } - defer retrieved.Close() - - var innerVal int32 - if retrieved.GetInt("inner_value", &innerVal) { - fmt.Printf(" nested.inner_value = %d\n", innerVal) - } else { - log.Fatal("expected key 'inner_value' in nested bundle") - } - - // --------------------------------------------------------------- - // Erase a key. - // - // Erase returns the number of entries removed (0 or 1). - // --------------------------------------------------------------- - erased := pb.Erase("retry_count") - fmt.Printf("erased 'retry_count': count=%d\n", erased) - fmt.Printf("bundle size after erase: %d\n", pb.Size()) - - // Verify the key is gone. - if pb.GetInt("retry_count", &intVal) { - log.Fatal("expected key 'retry_count' to be erased") - } - fmt.Println("confirmed: 'retry_count' no longer exists") - - fmt.Println("overview complete") -} diff --git a/examples/sensor/accelerometer/main.go b/examples/sensor/accelerometer/main.go deleted file mode 100644 index 0757078..0000000 --- a/examples/sensor/accelerometer/main.go +++ /dev/null @@ -1,116 +0,0 @@ -// Example: accelerometer sensor detail and event-queue setup. -// -// Obtains the default accelerometer, prints its detailed properties, -// and documents how to set up an event queue for continuous reading. -// -// The Android sensor API requires an ALooper for the event queue. The -// typical pattern is: -// -// 1. Prepare a looper on the current thread (looper.Prepare). -// 2. Create an event queue via the sensor manager, passing the looper. -// 3. Enable the sensor on the queue and set a sampling rate. -// 4. Poll the looper; when data is ready, read events from the queue. -// 5. Disable the sensor and destroy the queue on cleanup. -// -// This example focuses on sensor querying and shows the event-queue -// setup pattern in commented code. The event-reading loop is a sketch -// because it requires a running Android looper thread. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/sensor" -) - -func main() { - // --- Obtain the sensor manager (singleton) --- - mgr := sensor.GetInstance() - - // --- Query the default accelerometer --- - // - // DefaultSensor always returns a non-nil *Sensor wrapper. When the - // device lacks the requested sensor type, the underlying C pointer - // is NULL and any method call will crash. We call Name() first and - // treat an empty result (or panic) as "sensor not available." - accel := mgr.DefaultSensor(sensor.Accelerometer) - - name := accel.Name() - if name == "" { - log.Fatal("no default accelerometer on this device") - } - vendor := accel.Vendor() - if vendor == "" { - log.Fatal("accelerometer returned empty vendor") - } - - fmt.Println("Accelerometer details:") - fmt.Printf(" Name: %s\n", name) - fmt.Printf(" Vendor: %s\n", vendor) - fmt.Printf(" Type: %s (%d)\n", sensor.Accelerometer, int32(sensor.Accelerometer)) - fmt.Printf(" Resolution: %g\n", accel.Resolution()) - fmt.Printf(" Min delay: %d us\n", accel.MinDelay()) - - // Compute the maximum sampling frequency from the minimum delay. - minDelay := accel.MinDelay() - if minDelay > 0 { - maxHz := 1_000_000.0 / float64(minDelay) - fmt.Printf(" Max rate: %.1f Hz\n", maxHz) - } else { - fmt.Println(" Max rate: on-change sensor (no periodic sampling)") - } - - // --- Event queue setup pattern --- - // - // Reading sensor data on Android requires an ALooper-based event - // queue. The high-level sensor package exposes the EventQueue struct, - // but creation currently requires the NDK Manager. Below is the - // documented pattern using ndk packages. - // - // Step 1 -- Prepare a looper for the current thread: - // - // import "github.com/AndroidGoLab/ndk/looper" - // - // lp := looper.Prepare(0) - // defer lp.Close() - // - // Step 2 -- Create an event queue bound to the looper: - // - // // The ident parameter distinguishes event sources when - // // multiple file descriptors share a single looper. - // // Pass nil for callback and data to use poll-based reading. - // const sensorIdent = 1 - // queue := mgr.CreateEventQueue(looperPtr, sensorIdent, nil, nil) - // defer mgr.DestroyEventQueue(queue) - // - // Step 3 -- Enable the sensor and set the sampling rate: - // - // queue.EnableSensor(accel) - // // Request events every 100 ms (100000 us). - // queue.SetEventRate(accel, 100000) - // - // Step 4 -- Poll the looper and read events: - // - // for { - // // Block until an event is available (-1 = infinite timeout). - // ident := looper.PollOnce(-1, nil, nil, nil) - // if ident == sensorIdent { - // for queue.HasEvents() > 0 { - // // Read ASensorEvent structs from the queue. - // // (ASensorEvent reading is not yet wrapped at the - // // Go level; use unsafe + the C struct layout.) - // } - // } - // } - // - // Step 5 -- Disable and clean up (handled by defers above): - // - // queue.DisableSensor(accel) - - fmt.Println() - fmt.Println("Event queue setup pattern documented in source comments.") - fmt.Println("See main.go for the full ALooper-based read loop sketch.") -} diff --git a/examples/sensor/event-loop/main.go b/examples/sensor/event-loop/main.go deleted file mode 100644 index 5b5d747..0000000 --- a/examples/sensor/event-loop/main.go +++ /dev/null @@ -1,178 +0,0 @@ -// Sensor event loop pattern combining sensor and looper packages. -// -// Demonstrates sensor discovery and type enumeration using the idiomatic -// sensor package, and documents the complete ALooper-based event queue -// pattern in comments. The event queue creation requires low-level access -// (ASensorManager_createEventQueue), so the actual event loop is shown as -// a documented pattern rather than executable code. -// -// The executable portion of this example: -// 1. Gets the sensor manager singleton. -// 2. Queries the default accelerometer and prints its properties. -// 3. Enumerates common sensor types, checking availability on the device. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/sensor" -) - -// probeSensor checks whether a sensor type is present on the device. -// DefaultSensor always returns a non-nil wrapper; if the underlying -// C pointer is NULL, calling Name() will panic. We recover from the -// panic to treat it as "not available." -func probeSensor( - mgr *sensor.Manager, - sensorType sensor.Type, -) (name, vendor string, ok bool) { - defer func() { - if r := recover(); r != nil { - ok = false - } - }() - - s := mgr.DefaultSensor(sensorType) - name = s.Name() - vendor = s.Vendor() - if name == "" || vendor == "" { - return "", "", false - } - return name, vendor, true -} - -func main() { - // --- 1. Get sensor manager singleton --- - mgr := sensor.GetInstance() - log.Println("sensor manager obtained") - - // --- 2. Query default accelerometer --- - accel := mgr.DefaultSensor(sensor.Accelerometer) - name := accel.Name() - if name == "" { - log.Fatal("no default accelerometer on this device") - } - - fmt.Println("Default accelerometer:") - fmt.Printf(" Name: %s\n", name) - fmt.Printf(" Vendor: %s\n", accel.Vendor()) - fmt.Printf(" Type: %s (%d)\n", sensor.Accelerometer, int32(sensor.Accelerometer)) - fmt.Printf(" Resolution: %g\n", accel.Resolution()) - fmt.Printf(" Min delay: %d us\n", accel.MinDelay()) - - minDelay := accel.MinDelay() - if minDelay > 0 { - maxHz := 1_000_000.0 / float64(minDelay) - fmt.Printf(" Max rate: %.1f Hz\n", maxHz) - } else { - fmt.Println(" Max rate: on-change sensor (no periodic sampling)") - } - fmt.Println() - - // --- 3. Enumerate common sensor types --- - // - // Try each common sensor type and report whether it is available. - type sensorInfo struct { - label string - sensorType sensor.Type - } - - allTypes := []sensorInfo{ - {"Accelerometer", sensor.Accelerometer}, - {"Magnetic Field", sensor.MagneticField}, - {"Gyroscope", sensor.Gyroscope}, - {"Light", sensor.Light}, - {"Pressure", sensor.Pressure}, - {"Proximity", sensor.Proximity}, - {"Gravity", sensor.Gravity}, - {"Linear Acceleration", sensor.LinearAcceleration}, - {"Rotation Vector", sensor.RotationVector}, - {"Relative Humidity", sensor.RelativeHumidity}, - {"Ambient Temperature", sensor.AmbientTemperature}, - {"Game Rotation Vector", sensor.GameRotationVector}, - {"Step Detector", sensor.StepDetector}, - {"Step Counter", sensor.StepCounter}, - {"Geomagnetic Rotation", sensor.GeomagneticRotationVector}, - {"Heart Rate", sensor.HeartRate}, - {"Hinge Angle", sensor.HingeAngle}, - {"Head Tracker", sensor.HeadTracker}, - {"Heading", sensor.Heading}, - } - - fmt.Println("Sensor type availability:") - available := 0 - for _, info := range allTypes { - name, vendor, ok := probeSensor(mgr, info.sensorType) - if ok { - fmt.Printf(" [+] %-25s %s (%s)\n", info.label, name, vendor) - available++ - } else { - fmt.Printf(" [-] %-25s not available\n", info.label) - } - } - fmt.Printf("\n%d of %d sensor types available\n", available, len(allTypes)) - - // --- 4. Event queue setup pattern (documented) --- - // - // Reading continuous sensor data on Android requires an ALooper-based - // event queue. The complete pattern is documented below. The event - // queue creation function (ASensorManager_createEventQueue) is not - // yet exposed in the idiomatic sensor package, so this section serves - // as a reference for the expected API shape. - // - // Step 1 -- Lock the goroutine to an OS thread (ALooper is thread-local): - // - // runtime.LockOSThread() - // defer runtime.UnlockOSThread() - // - // Step 2 -- Prepare a looper for the current thread: - // - // import "github.com/AndroidGoLab/ndk/looper" - // - // const prepareAllowNonCallbacks = int32(1) - // lp := looper.Prepare(prepareAllowNonCallbacks) - // defer lp.Close() - // - // Step 3 -- Create an event queue bound to the looper: - // - // // ASensorManager_createEventQueue takes the looper, an ident - // // (integer to distinguish event sources), and optional callback - // // and user-data pointers (nil for poll-based reading). - // const sensorIdent = 1 - // queue := mgr.CreateEventQueue(lp.Pointer(), sensorIdent, nil, nil) - // defer mgr.DestroyEventQueue(queue) - // - // Step 4 -- Enable the sensor on the queue and set sampling rate: - // - // queue.EnableSensor(accel) - // queue.SetEventRate(accel, 100000) // 100 ms between events - // - // Step 5 -- Poll the looper and read events: - // - // for { - // ident := looper.PollOnce(-1, nil, nil, nil) - // if ident == sensorIdent { - // // Read ASensorEvent structs from the queue. - // // Each event contains: type, timestamp, and a data - // // union with up to 16 float32 values. - // // - // // For accelerometer: - // // data[0] = acceleration X (m/s^2) - // // data[1] = acceleration Y (m/s^2) - // // data[2] = acceleration Z (m/s^2) - // for queue.HasEvents() > 0 { - // // Read and process events. - // } - // } - // } - // - // Step 6 -- Disable sensor and destroy queue (handled by defers): - // - // queue.DisableSensor(accel) - - fmt.Println("\nEvent queue setup pattern documented in source comments.") - fmt.Println("See main.go for the full ALooper-based sensor read loop pattern.") -} diff --git a/examples/sensor/list-sensors/main.go b/examples/sensor/list-sensors/main.go deleted file mode 100644 index 1639ca1..0000000 --- a/examples/sensor/list-sensors/main.go +++ /dev/null @@ -1,86 +0,0 @@ -// Example: list default sensors and their properties. -// -// Obtains the sensor manager singleton and queries default sensors for -// the most common types (accelerometer, gyroscope, light, proximity, -// magnetic field). For each sensor that is present on the device, the -// program prints its name, vendor, type code, resolution, and minimum -// delay between events. -// -// Not every device has every sensor. Because DefaultSensor always -// returns a non-nil *Sensor wrapper (even when the underlying C -// pointer is NULL), calling methods on an absent sensor would crash. -// This example uses a recover guard so that missing sensors are -// reported gracefully instead of terminating the program. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/sensor" -) - -// printSensor queries and prints sensor properties. It returns false -// if the sensor's underlying C pointer is NULL (the device lacks this -// sensor type), recovering from the resulting panic. -func printSensor(mgr *sensor.Manager, label string, sensorType sensor.Type) (ok bool) { - defer func() { - if r := recover(); r != nil { - ok = false - } - }() - - s := mgr.DefaultSensor(sensorType) - - // Trigger a method call; if the internal pointer is NULL the NDK - // dereferences a null pointer and Go's signal handler turns it - // into a panic that we recover above. - name := s.Name() - vendor := s.Vendor() - if name == "" || vendor == "" { - return false - } - - fmt.Printf(" %s:\n", label) - fmt.Printf(" Name: %s\n", name) - fmt.Printf(" Vendor: %s\n", vendor) - fmt.Printf(" Type: %s (%d)\n", sensorType, int32(sensorType)) - fmt.Printf(" Resolution: %g\n", s.Resolution()) - fmt.Printf(" Min delay: %d us\n", s.MinDelay()) - fmt.Println() - return true -} - -func main() { - mgr := sensor.GetInstance() - - type sensorInfo struct { - label string - sensorType sensor.Type - } - - sensors := []sensorInfo{ - {"Accelerometer", sensor.Accelerometer}, - {"Gyroscope", sensor.Gyroscope}, - {"Light", sensor.Light}, - {"Proximity", sensor.Proximity}, - {"Magnetic Field", sensor.MagneticField}, - } - - fmt.Println("Default sensors on this device:") - fmt.Println() - - found := 0 - for _, info := range sensors { - if printSensor(mgr, info.label, info.sensorType) { - found++ - } else { - fmt.Printf(" %-16s not available\n", info.label+":") - } - } - - if found == 0 { - fmt.Println(" No default sensors found on this device.") - } -} diff --git a/examples/sharedmem/overview/main.go b/examples/sharedmem/overview/main.go deleted file mode 100644 index dd8549d..0000000 --- a/examples/sharedmem/overview/main.go +++ /dev/null @@ -1,44 +0,0 @@ -// Example: sharedmem package overview -// -// The ndk/sharedmem package provides Go bindings for Android's -// ASharedMemory API (available since API level 26). -// -// ASharedMemory enables creating and managing anonymous shared memory -// regions that can be shared between processes via file descriptors. -// This is useful for zero-copy IPC, large data transfers between -// services, and sharing buffers with the Android framework. -// -// Typical workflow: -// 1. Create a shared memory region: ASharedMemory_create(name, size) -// 2. Get the file descriptor for sharing -// 3. Map into process address space with mmap() -// 4. Share the fd with another process (via Binder/socket) -// 5. The other process mmaps the same fd -// 6. Both processes read/write the shared region -// 7. Set protection with ASharedMemory_setProt() to make read-only -// -// The underlying ASharedMemory functions operate on file descriptors -// (int), not opaque handles. -// -// This program must run on an Android device with API level 26+. -package main - -import ( - "fmt" - - _ "github.com/AndroidGoLab/ndk/sharedmem" -) - -func main() { - fmt.Println("github.com/AndroidGoLab/ndk/sharedmem — Android ASharedMemory API") - fmt.Println() - fmt.Println("ASharedMemory provides anonymous shared memory for IPC.") - fmt.Println() - fmt.Println("Key NDK functions:") - fmt.Println(" ASharedMemory_create(name, size) — create a region, returns fd") - fmt.Println(" ASharedMemory_getSize(fd) — query region size") - fmt.Println(" ASharedMemory_setProt(fd, prot) — restrict access (e.g. read-only)") - fmt.Println() - fmt.Println("The fd can be passed to another process via Binder or Unix socket,") - fmt.Println("then both processes mmap() it for zero-copy shared access.") -} diff --git a/examples/storage/obb-manager/main.go b/examples/storage/obb-manager/main.go deleted file mode 100644 index e0111c8..0000000 --- a/examples/storage/obb-manager/main.go +++ /dev/null @@ -1,90 +0,0 @@ -// OBB storage manager lifecycle example. -// -// Demonstrates how to create an Android storage manager, check whether an -// OBB (Opaque Binary Blob) file is mounted, and query its mounted path. -// -// OBB files are large binary assets (up to 2 GB each) that Android games and -// apps use to store resources that exceed the APK size limit. The system -// mounts an OBB as a virtual filesystem at a path under -// /storage/emulated/0/Android/obb//. Once mounted, the application -// reads assets from the mounted path like ordinary files. -// -// Typical OBB workflow: -// 1. Create a storage manager. -// 2. Check if the OBB is already mounted (IsObbMounted). -// 3. If not mounted, mount it (MountObb with an async callback). -// 4. Obtain the mounted path (MountedObbPath) to read assets. -// 5. When done, unmount the OBB (UnmountObb with an async callback). -// 6. Close the manager to release native resources. -// -// This example covers steps 1, 2, 4, and 6. Steps 3 and 5 (asynchronous -// mount/unmount) require a running ALooper on the calling thread, which is -// beyond the scope of this minimal example. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/storage" -) - -func main() { - // Create a storage manager. This allocates the underlying - // AStorageManager and is the entry point for all OBB operations. - mgr := storage.NewManager() - if mgr == nil { - log.Fatal("storage.NewManager returned nil") - } - defer func() { - if err := mgr.Close(); err != nil { - log.Fatalf("manager close: %v", err) - } - log.Println("storage manager closed") - }() - log.Println("storage manager created") - - // The OBB filename is an absolute path on the device filesystem. - obbPath := "/storage/emulated/0/Android/obb/com.example.game/main.1.com.example.game.obb" - - // Check whether this OBB file is currently mounted. - // IsObbMounted returns 1 if mounted, 0 if not. - mounted := mgr.IsObbMounted(obbPath) - if mounted != 0 { - fmt.Println("OBB is mounted") - } else { - fmt.Println("OBB is not mounted") - } - - // Query the mounted path. When the OBB is mounted, the NDK returns a - // path such as "/storage/emulated/0/Android/obb/com.example.game/". - // When it is not mounted the return value is typically an empty string. - mountedPath := mgr.MountedObbPath(obbPath) - if mountedPath != "" { - fmt.Printf("Mounted path: %s\n", mountedPath) - } else { - fmt.Println("Mounted path is empty (OBB not mounted)") - } - - // In a full application the next steps would be: - // - // // Mount the OBB (asynchronous, requires an ALooper on this thread). - // // The key is "" for unencrypted OBBs. - // mgr.MountObb(obbPath, "", callback, data) - // - // // After the callback fires confirming success, read assets from - // // the mounted path returned by MountedObbPath. - // - // // Unmount when finished. Pass force=1 to force-unmount even if - // // files are still open. - // mgr.UnmountObb(obbPath, 0, callback, data) - - // Demonstrate idempotent close: the deferred Close above will be a - // harmless no-op after this explicit close. - if err := mgr.Close(); err != nil { - log.Fatalf("close: %v", err) - } - log.Println("storage manager closed (first close)") -} diff --git a/examples/surfacecontrol/transaction/main.go b/examples/surfacecontrol/transaction/main.go deleted file mode 100644 index 534d1ac..0000000 --- a/examples/surfacecontrol/transaction/main.go +++ /dev/null @@ -1,85 +0,0 @@ -// Transaction lifecycle and chaining pattern example. -// -// Demonstrates: -// - Creating and closing a Transaction -// - Applying an empty transaction (a valid no-op in SurfaceFlinger) -// - The chaining pattern: every setter returns *Transaction so calls compose -// -// A Transaction batches property changes (position, visibility, z-order, etc.) -// to one or more SurfaceControls and submits them atomically via Apply(). -// Creating a SurfaceControl requires an ANativeWindow (obtained from an -// Activity), so this example focuses on the Transaction itself, which can be -// created standalone. -// -// This program must run on an Android device with API level 29+. -package main - -import ( - "fmt" - "log" - - "github.com/AndroidGoLab/ndk/surfacecontrol" -) - -func main() { - // --- Create a transaction --- - // NewTransaction allocates an ASurfaceTransaction on the native side. - txn := surfacecontrol.NewTransaction() - defer func() { - if err := txn.Close(); err != nil { - log.Printf("close transaction: %v", err) - } - }() - fmt.Println("transaction created") - - // --- Apply an empty transaction --- - // An empty transaction is valid. SurfaceFlinger accepts it as a no-op, - // which is useful for flushing pending state or as a synchronization point. - txn.Apply() - fmt.Println("empty transaction applied") - - // --- Chaining pattern --- - // Every setter (SetVisibility, SetPosition, SetScale, SetZOrder, - // SetColor, SetBufferAlpha, SetBufferTransparency, SetDamageRegion) - // returns *Transaction, so multiple property changes compose into a - // single fluent expression: - // - // txn. - // SetVisibility(sc, surfacecontrol.Show). - // SetPosition(sc, 100, 200). - // SetScale(sc, 2.0, 2.0). - // SetZOrder(sc, 10). - // SetBufferAlpha(sc, 0.8). - // SetBufferTransparency(sc, surfacecontrol.Translucent). - // SetColor(sc, 0.2, 0.4, 0.8, 1.0, 0). - // Apply() - // - // All setters require a *SurfaceControl target. Since SurfaceControl - // creation needs an ANativeWindow (from an Activity), the chained call - // above is shown in a comment. In a real app you would obtain the - // SurfaceControl from your window and chain setters exactly like this. - - // --- Visibility and Transparency enums --- - // The package exports two enums used with SetVisibility and - // SetBufferTransparency: - // - // Visibility: Show (0), Hide (1) - // Transparency: Transparent (0), Translucent (1), Opaque (2) - fmt.Printf("Visibility constants: Show=%d, Hide=%d\n", - surfacecontrol.Show, surfacecontrol.Hide) - fmt.Printf("Transparency constants: Transparent=%d, Translucent=%d, Opaque=%d\n", - surfacecontrol.Transparent, surfacecontrol.Translucent, surfacecontrol.Opaque) - - // --- Multiple transactions --- - // You can create several transactions, configure them independently, - // and apply them in any order. Each Apply() is an atomic - // SurfaceFlinger commit. - txn2 := surfacecontrol.NewTransaction() - txn2.Apply() - if err := txn2.Close(); err != nil { - log.Fatalf("close txn2: %v", err) - } - fmt.Println("second transaction applied and closed") - - fmt.Println("done") -} diff --git a/examples/surfacetexture/gl-rendering/main.go b/examples/surfacetexture/gl-rendering/main.go deleted file mode 100644 index 5a7503a..0000000 --- a/examples/surfacetexture/gl-rendering/main.go +++ /dev/null @@ -1,229 +0,0 @@ -// SurfaceTexture GL rendering pipeline example. -// -// Demonstrates how to use ASurfaceTexture to stream image frames from a -// producer (camera, video decoder) into an OpenGL ES external texture and -// render them on screen. This is the standard pattern for camera preview -// or video playback in Android NDK applications. -// -// ASurfaceTexture bridges the Android Surface (a queue of graphic buffers) -// and OpenGL ES by presenting each incoming frame as a GL_TEXTURE_EXTERNAL_OES -// texture. The texture coordinates require a 4x4 transform matrix that -// compensates for buffer rotation, scaling, and coordinate-system differences. -// -// The NDK ASurfaceTexture handle is obtained from a Java SurfaceTexture via -// JNI (ASurfaceTexture_fromSurfaceTexture). There is no pure-NDK constructor. -// Once the handle is wrapped with surfacetexture.NewSurfaceTextureFromPointer, -// the idiomatic API provides the full lifecycle. -// -// GL rendering workflow: -// -// 1. Create a GL_TEXTURE_EXTERNAL_OES texture on the render thread. -// -// 2. Attach the SurfaceTexture to the current GL context with -// AttachToGLContext(texName). This binds the SurfaceTexture to the -// texture object so incoming frames update it. -// -// 3. Acquire a NativeWindow from the SurfaceTexture with AcquireWindow(). -// Hand this window to the frame producer (camera, codec). The producer -// enqueues frames into the Surface backed by this window. -// -// 4. On the render thread, when a new frame is available: -// a. Call UpdateTexImage() to latch the latest frame into the texture. -// b. Call TransformMatrix() to get the 4x4 matrix for texture coords. -// c. Call Timestamp() to get the frame's presentation timestamp (ns). -// d. Bind the texture, upload the matrix as a uniform, draw. -// -// 5. When switching GL contexts: DetachFromGLContext(), then re-attach. -// -// 6. When done: DetachFromGLContext(), then Close(). -// -// Fragment shader for GL_TEXTURE_EXTERNAL_OES: -// -// #extension GL_OES_EGL_image_external : require -// precision mediump float; -// varying vec2 vTexCoord; -// uniform samplerExternalOES uTexture; -// uniform mat4 uTexMatrix; -// void main() { -// vec2 tc = (uTexMatrix * vec4(vTexCoord, 0.0, 1.0)).xy; -// gl_FragColor = texture2D(uTexture, tc); -// } -// -// Prerequisites: -// - Android device with API level 28+ (ASurfaceTexture was added in API 28). -// - A Java SurfaceTexture obtained from the application's Java layer. -// - A current EGL context with GL_OES_EGL_image_external support. -// -// Because the SurfaceTexture handle requires JNI to obtain, this example -// documents the complete rendering pipeline and prints the API calls that -// a real application would make, rather than invoking them directly. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - _ "github.com/AndroidGoLab/ndk/surfacetexture" -) - -func main() { - fmt.Println("=== SurfaceTexture GL rendering pipeline ===") - fmt.Println() - - // ── Step 1: Obtain the SurfaceTexture handle ──────────────── - // - // The handle comes from Java through JNI. The Java side creates - // a SurfaceTexture detached from any GL context: - // - // Java: - // SurfaceTexture st = new SurfaceTexture(/* texName */ 0); - // st.detachFromGLContext(); - // nativeSetSurfaceTexture(st); // JNI call - // - // C/JNI bridge: - // ASurfaceTexture* ast = ASurfaceTexture_fromSurfaceTexture(env, javaST); - // - // Go: - // st := surfacetexture.NewSurfaceTextureFromPointer(rawPtr) - - fmt.Println("Step 1: Obtain SurfaceTexture from Java via JNI") - fmt.Println(" Java: SurfaceTexture st = new SurfaceTexture(0);") - fmt.Println(" JNI: ASurfaceTexture_fromSurfaceTexture(env, javaST)") - fmt.Println(" Go: surfacetexture.NewSurfaceTextureFromPointer(rawPtr)") - fmt.Println() - - // ── Step 2: Create GL texture and attach ──────────────────── - // - // // On the render thread with a current EGL context: - // var texName uint32 - // gl.GenTextures(1, &texName) - // gl.BindTexture(gl.TEXTURE_EXTERNAL_OES, texName) - // gl.TexParameteri(gl.TEXTURE_EXTERNAL_OES, gl.TEXTURE_MIN_FILTER, gl.LINEAR) - // gl.TexParameteri(gl.TEXTURE_EXTERNAL_OES, gl.TEXTURE_MAG_FILTER, gl.LINEAR) - // gl.TexParameteri(gl.TEXTURE_EXTERNAL_OES, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) - // gl.TexParameteri(gl.TEXTURE_EXTERNAL_OES, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) - // - // if err := st.AttachToGLContext(texName); err != nil { - // log.Fatalf("attach: %v", err) - // } - - fmt.Println("Step 2: Create GL_TEXTURE_EXTERNAL_OES and attach") - fmt.Println(" gl.GenTextures(1, &texName)") - fmt.Println(" gl.BindTexture(GL_TEXTURE_EXTERNAL_OES, texName)") - fmt.Println(" st.AttachToGLContext(texName)") - fmt.Println() - - // ── Step 3: Acquire window for producers ──────────────────── - // - // The NativeWindow provides a Surface that producers write into. - // For camera preview, pass the window's pointer to the camera - // output target. For video, pass it to the MediaCodec output. - // - // window := st.AcquireWindow() - // // window.Pointer() returns unsafe.Pointer to the ANativeWindow. - // // Pass this to camera or codec APIs as the output surface. - - fmt.Println("Step 3: Acquire NativeWindow for frame producers") - fmt.Println(" window := st.AcquireWindow()") - fmt.Println(" // Pass window.Pointer() to camera or video decoder output.") - fmt.Println() - - // ── Step 4: Render loop ───────────────────────────────────── - // - // The render loop runs on the GL thread. When the Java-side - // onFrameAvailable callback fires, signal the render thread to - // call UpdateTexImage. - // - // for running { - // // Wait for onFrameAvailable signal... - // - // // Latch the latest frame into the GL texture. - // if err := st.UpdateTexImage(); err != nil { - // log.Printf("update: %v", err) - // continue - // } - // - // // Get the 4x4 texture coordinate transform matrix. - // // This matrix compensates for buffer rotation (e.g. camera - // // sensor orientation) and coordinate system differences. - // var mtx [16]float32 - // st.TransformMatrix(&mtx) - // - // // Get the frame timestamp for A/V sync or frame pacing. - // timestamp := st.Timestamp() // nanoseconds - // - // // Render: bind the external texture, upload mtx as a mat4 - // // uniform, draw a full-screen quad. - // gl.ActiveTexture(gl.TEXTURE0) - // gl.BindTexture(gl.TEXTURE_EXTERNAL_OES, texName) - // gl.UniformMatrix4fv(uTexMatrixLoc, 1, false, &mtx[0]) - // // ... draw quad ... - // egl.SwapBuffers(display, surface) - // } - - fmt.Println("Step 4: Render loop") - fmt.Println(" for each frame:") - fmt.Println(" st.UpdateTexImage() -- latch frame into texture") - fmt.Println(" st.TransformMatrix(&mtx) -- get 4x4 transform for shader") - fmt.Println(" st.Timestamp() -- frame timestamp in nanoseconds") - fmt.Println(" // bind texture, upload matrix, draw quad, swap buffers") - fmt.Println() - - // ── Step 5: Detach and close ──────────────────────────────── - // - // When rendering is complete or the GL context is being torn down: - // - // if err := st.DetachFromGLContext(); err != nil { - // log.Printf("detach: %v", err) - // } - // if err := st.Close(); err != nil { - // log.Printf("close: %v", err) - // } - // - // After Close, no other methods may be called on the SurfaceTexture. - // The NativeWindow returned by AcquireWindow becomes invalid once the - // SurfaceTexture is released. - - fmt.Println("Step 5: Cleanup") - fmt.Println(" st.DetachFromGLContext() -- unbind from GL context") - fmt.Println(" st.Close() -- release the NDK handle") - fmt.Println() - - // ── Transform matrix details ──────────────────────────────── - // - // The 4x4 matrix returned by TransformMatrix is column-major - // (OpenGL convention). It must be applied to texture coordinates - // in the vertex or fragment shader: - // - // vec2 tc = (uTexMatrix * vec4(texCoord, 0.0, 1.0)).xy; - // gl_FragColor = texture2D(uTexture, tc); - // - // Common transforms: - // - Identity: no rotation, standard orientation - // - Y-flip: Surface coordinate system differs from GL - // - 90/180/270 rotate: camera sensor orientation compensation - // - // Without the transform matrix, the rendered image may appear - // upside-down, rotated, or stretched. - - fmt.Println("Transform matrix:") - fmt.Println(" Column-major 4x4 (OpenGL convention)") - fmt.Println(" Apply in shader: (uTexMatrix * vec4(tc, 0, 1)).xy") - fmt.Println(" Compensates for: Y-flip, rotation, scaling") - fmt.Println() - - // ── Error handling ────────────────────────────────────────── - // - // Methods that return error use surfacetexture.Error, wrapping - // the NDK int32 result code. A negative value indicates failure. - - fmt.Println("Error handling:") - fmt.Println(" AttachToGLContext: fails if no EGL context or already attached") - fmt.Println(" DetachFromGLContext: fails if not attached") - fmt.Println(" UpdateTexImage: fails if wrong thread or not attached") - fmt.Println(" Close: nil-safe and idempotent") - fmt.Println() - - fmt.Println("gl-rendering pipeline overview complete") -} diff --git a/examples/surfacetexture/overview/main.go b/examples/surfacetexture/overview/main.go deleted file mode 100644 index 94f6c1c..0000000 --- a/examples/surfacetexture/overview/main.go +++ /dev/null @@ -1,247 +0,0 @@ -// ASurfaceTexture API overview. -// -// Documents the Android ASurfaceTexture lifecycle and the methods provided by -// the ndk/surfacetexture package. ASurfaceTexture streams image frames from -// an Android Surface into an OpenGL ES texture (GL_TEXTURE_EXTERNAL_OES), -// enabling GPU-accelerated rendering of camera preview, video playback, or -// any Surface-backed producer. -// -// The NDK ASurfaceTexture handle is obtained from a Java SurfaceTexture -// object via JNI. There is no pure-NDK constructor. The typical pattern is: -// -// Java side: -// SurfaceTexture st = new SurfaceTexture(/* texName */ 0); -// st.detachFromGLContext(); // detach so native can re-attach -// -// JNI bridge: -// ASurfaceTexture* ast = ASurfaceTexture_fromSurfaceTexture(env, javaST); -// -// Go side: -// // Wrap the raw *ASurfaceTexture into surfacetexture.SurfaceTexture -// st := surfacetexture.NewSurfaceTextureFromPointer(rawPtr) -// -// Because the SurfaceTexture handle requires a JNI environment and a Java -// SurfaceTexture jobject, this example documents the workflow and prints the -// API surface rather than calling the methods directly. -// -// GL texture workflow: -// -// 1. Create GL_TEXTURE_EXTERNAL_OES texture: -// glGenTextures(1, &texName) -// glBindTexture(GL_TEXTURE_EXTERNAL_OES, texName) -// -// 2. Attach the SurfaceTexture to the GL context: -// st.AttachToGLContext(texName) -// -// 3. When a new frame arrives (via onFrameAvailable callback): -// st.UpdateTexImage() -// -// 4. Retrieve the 4x4 texture transform matrix for the shader: -// var mtx [16]float32 -// st.TransformMatrix(&mtx[0]) -// -// 5. Retrieve the frame timestamp (nanoseconds): -// ts := st.Timestamp() -// -// 6. Render using the external texture with the transform matrix -// applied in the fragment shader via samplerExternalOES. -// -// 7. When switching GL contexts or done: -// st.DetachFromGLContext() -// -// 8. Release the SurfaceTexture: -// st.Close() -// -// Fragment shader for external textures: -// -// #extension GL_OES_EGL_image_external : require -// precision mediump float; -// varying vec2 vTexCoord; -// uniform samplerExternalOES uTexture; -// uniform mat4 uTexMatrix; -// void main() { -// vec2 tc = (uTexMatrix * vec4(vTexCoord, 0.0, 1.0)).xy; -// gl_FragColor = texture2D(uTexture, tc); -// } -// -// Prerequisites: -// - Android device with API level 28+ (ASurfaceTexture was added in API 28). -// - A Java SurfaceTexture obtained from the application's Java layer. -// - A current EGL context with GL_OES_EGL_image_external support. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - _ "github.com/AndroidGoLab/ndk/surfacetexture" -) - -func main() { - fmt.Println("=== ndk/surfacetexture API overview ===") - fmt.Println() - - // --------------------------------------------------------------- - // Obtaining a SurfaceTexture - // - // The SurfaceTexture struct wraps the NDK ASurfaceTexture pointer. - // It is NOT created from Go code. The handle comes from the Java - // layer through JNI: - // - // // C/JNI: - // ASurfaceTexture* ast = ASurfaceTexture_fromSurfaceTexture( - // env, // JNIEnv* - // javaST); // jobject (android.graphics.SurfaceTexture) - // - // ASurfaceTexture_fromSurfaceTexture is intentionally excluded from - // the idiomatic Go layer because it requires JNI types (JNIEnv*, - // jobject) that are specific to the application's JNI bridge. The - // application wraps the returned pointer using - // surfacetexture.NewSurfaceTextureFromPointer in its own JNI glue. - // --------------------------------------------------------------- - - fmt.Println("SurfaceTexture handle:") - fmt.Println(" Obtained via JNI: ASurfaceTexture_fromSurfaceTexture(env, javaST)") - fmt.Println(" The Java SurfaceTexture must be created on the Java side and") - fmt.Println(" passed to native code through a JNI call.") - fmt.Println() - - // --------------------------------------------------------------- - // SurfaceTexture methods - // --------------------------------------------------------------- - - fmt.Println("SurfaceTexture methods:") - fmt.Println() - fmt.Println(" AttachToGLContext(texName uint32) error") - fmt.Println(" Attach the SurfaceTexture to the current EGL context,") - fmt.Println(" using texName as the GL_TEXTURE_EXTERNAL_OES texture.") - fmt.Println(" The texture must already be created via glGenTextures.") - fmt.Println(" The SurfaceTexture must be detached before calling this.") - fmt.Println() - fmt.Println(" DetachFromGLContext() error") - fmt.Println(" Detach from the current EGL context. The texture name") - fmt.Println(" is released and the SurfaceTexture can be re-attached") - fmt.Println(" to a different context or texture name.") - fmt.Println() - fmt.Println(" UpdateTexImage() error") - fmt.Println(" Update the texture image to the most recent frame from") - fmt.Println(" the image stream. Call this when a new frame is available") - fmt.Println(" (signaled by the onFrameAvailable callback on the Java") - fmt.Println(" side). Must be called from the thread that owns the GL") - fmt.Println(" context the SurfaceTexture is attached to.") - fmt.Println() - fmt.Println(" TransformMatrix(mtx *[16]float32)") - fmt.Println(" Retrieve the 4x4 texture coordinate transform matrix.") - fmt.Println(" The matrix compensates for any rotation, scaling, or") - fmt.Println(" coordinate-system differences between the producer and") - fmt.Println(" GL. Apply it in the shader to the texture coordinates") - fmt.Println(" before sampling.") - fmt.Println() - fmt.Println(" Timestamp() int64") - fmt.Println(" Return the timestamp (in nanoseconds) of the current") - fmt.Println(" texture image, as set by the image producer. For camera") - fmt.Println(" frames this is the capture time; for video it is the") - fmt.Println(" presentation timestamp.") - fmt.Println() - fmt.Println(" AcquireWindow() *NativeWindow") - fmt.Println(" Acquire an ANativeWindow from this SurfaceTexture.") - fmt.Println(" Producers (camera, codec) write frames into this window.") - fmt.Println() - fmt.Println(" Close() error") - fmt.Println(" Release the underlying NDK handle. After Close, no") - fmt.Println(" other methods may be called. Idempotent and nil-safe.") - fmt.Println() - - // --------------------------------------------------------------- - // GL texture workflow - // --------------------------------------------------------------- - - fmt.Println("GL texture workflow (pseudocode):") - fmt.Println() - fmt.Println(" // 1. Create the external texture.") - fmt.Println(" var texName uint32") - fmt.Println(" glGenTextures(1, &texName)") - fmt.Println(" glBindTexture(GL_TEXTURE_EXTERNAL_OES, texName)") - fmt.Println(" glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR)") - fmt.Println(" glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR)") - fmt.Println() - fmt.Println(" // 2. Attach the SurfaceTexture to the current GL context.") - fmt.Println(" if err := st.AttachToGLContext(texName); err != nil {") - fmt.Println(" log.Fatalf(\"attach: %v\", err)") - fmt.Println(" }") - fmt.Println() - fmt.Println(" // 3. Acquire an ANativeWindow for producers to write into.") - fmt.Println(" window := st.AcquireWindow()") - fmt.Println(" // Pass this window to the camera or video decoder.") - fmt.Println() - fmt.Println(" // 4. Render loop: when a new frame arrives:") - fmt.Println(" if err := st.UpdateTexImage(); err != nil {") - fmt.Println(" log.Printf(\"update: %v\", err)") - fmt.Println(" }") - fmt.Println() - fmt.Println(" var mtx [16]float32") - fmt.Println(" st.TransformMatrix(&mtx)") - fmt.Println() - fmt.Println(" ts := st.Timestamp()") - fmt.Println(" _ = ts // use for A/V sync or frame pacing") - fmt.Println() - fmt.Println(" // Upload mtx as a mat4 uniform; bind texName as") - fmt.Println(" // GL_TEXTURE_EXTERNAL_OES; draw the quad.") - fmt.Println() - fmt.Println(" // 5. Cleanup.") - fmt.Println(" if err := st.DetachFromGLContext(); err != nil {") - fmt.Println(" log.Printf(\"detach: %v\", err)") - fmt.Println(" }") - fmt.Println(" st.Close()") - fmt.Println() - - // --------------------------------------------------------------- - // Camera preview pipeline - // --------------------------------------------------------------- - - fmt.Println("Camera preview pipeline (typical integration):") - fmt.Println() - fmt.Println(" Java:") - fmt.Println(" SurfaceTexture st = new SurfaceTexture(0);") - fmt.Println(" st.detachFromGLContext();") - fmt.Println(" nativeInit(st); // pass to native via JNI") - fmt.Println() - fmt.Println(" Native JNI bridge (C):") - fmt.Println(" ASurfaceTexture* ast =") - fmt.Println(" ASurfaceTexture_fromSurfaceTexture(env, javaST);") - fmt.Println() - fmt.Println(" Go side:") - fmt.Println(" st := surfacetexture.NewSurfaceTextureFromPointer(rawPtr)") - fmt.Println(" window := st.AcquireWindow()") - fmt.Println(" // Pass window to ACameraDevice as output target.") - fmt.Println() - fmt.Println(" Go render thread:") - fmt.Println(" st.AttachToGLContext(texName)") - fmt.Println(" for frame := range frames {") - fmt.Println(" st.UpdateTexImage()") - fmt.Println(" st.TransformMatrix(&mtx)") - fmt.Println(" // render with external texture + transform matrix") - fmt.Println(" }") - fmt.Println(" st.DetachFromGLContext()") - fmt.Println(" st.Close()") - fmt.Println() - - // --------------------------------------------------------------- - // Error handling - // --------------------------------------------------------------- - - fmt.Println("Error handling:") - fmt.Println() - fmt.Println(" Methods that return error use surfacetexture.Error, which") - fmt.Println(" wraps the NDK int32 result code. A negative value indicates") - fmt.Println(" failure. Common causes:") - fmt.Println(" - AttachToGLContext: no current EGL context, or the") - fmt.Println(" SurfaceTexture is already attached.") - fmt.Println(" - DetachFromGLContext: not currently attached.") - fmt.Println(" - UpdateTexImage: called from wrong thread, or the") - fmt.Println(" SurfaceTexture is not attached to a GL context.") - fmt.Println() - - fmt.Println("overview complete -- see source comments for full details") -} diff --git a/examples/sync/overview/main.go b/examples/sync/overview/main.go deleted file mode 100644 index cce079d..0000000 --- a/examples/sync/overview/main.go +++ /dev/null @@ -1,48 +0,0 @@ -// Example: sync package overview -// -// The ndk/sync package provides Go bindings for Android's native -// sync framework (sync fences / sync file descriptors). -// -// Android sync fences are kernel-level synchronization primitives -// used to coordinate GPU and display operations. A sync fence -// represents a point in time on a GPU command stream — it signals -// when all commands submitted before it have completed. -// -// Typical usage in the graphics pipeline: -// 1. GPU driver creates a fence when submitting work -// 2. Fence fd is passed to SurfaceFlinger / HWC -// 3. Consumer waits on the fence before reading the buffer -// 4. This enables pipelined rendering without CPU stalls -// -// The sync fence API operates on file descriptors: -// - sync_merge(name, fd1, fd2) — merge two fences into one -// - sync_wait(fd, timeout_ms) — block until fence signals -// - sync_file_info(fd) — query fence metadata -// -// Sync fences are typically obtained from EGL (eglDupNativeFenceFD), -// Vulkan (vkGetFenceFdKHR), or AHardwareBuffer operations. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - _ "github.com/AndroidGoLab/ndk/sync" -) - -func main() { - fmt.Println("github.com/AndroidGoLab/ndk/sync — Android Native Sync Fence API") - fmt.Println() - fmt.Println("Sync fences coordinate GPU work completion with buffer consumers.") - fmt.Println() - fmt.Println("Key NDK functions:") - fmt.Println(" sync_wait(fd, timeout) — wait for fence to signal") - fmt.Println(" sync_merge(name, fd1, fd2) — combine two fences") - fmt.Println(" sync_file_info(fd) — query fence details") - fmt.Println() - fmt.Println("Fences are obtained from:") - fmt.Println(" - EGL: eglDupNativeFenceFD()") - fmt.Println(" - Vulkan: vkGetFenceFdKHR()") - fmt.Println(" - HWB: AHardwareBuffer_unlock() fence out-param") -} diff --git a/examples/thermal/monitor/main.go b/examples/thermal/monitor/main.go deleted file mode 100644 index fad301a..0000000 --- a/examples/thermal/monitor/main.go +++ /dev/null @@ -1,83 +0,0 @@ -// Example: thermal status monitoring. -// -// Demonstrates how to acquire a thermal manager, query the current thermal -// status, and use the result to make throttling decisions. The main loop -// simulates a game loop that polls thermal status each frame and adjusts -// workload accordingly. -// -// This program must run on an Android device with thermal API support. -package main - -import ( - "fmt" - "log" - "time" - - "github.com/AndroidGoLab/ndk/thermal" -) - -// throttleForStatus returns a workload scale factor (0.0 to 1.0) based on -// the current thermal status. A game engine would use this to reduce draw -// distance, particle counts, or frame rate targets. -func throttleForStatus(status thermal.ThermalStatus) float64 { - switch status { - case thermal.StatusNone: - return 1.0 - case thermal.StatusLight: - return 0.9 - case thermal.StatusModerate: - return 0.7 - case thermal.StatusSevere: - return 0.5 - case thermal.StatusCritical: - return 0.3 - case thermal.StatusEmergency: - return 0.1 - case thermal.StatusShutdown: - return 0.0 - default: - return 0.5 - } -} - -func main() { - // Acquire a thermal manager handle. - mgr := thermal.NewManager() - defer mgr.Close() - - log.Println("thermal manager acquired") - - // Query the current thermal status once upfront. - raw := mgr.CurrentStatus() - status := thermal.ThermalStatus(raw) - log.Printf("current thermal status: %s (%d)", status, raw) - - // Simulate a game loop that polls thermal status periodically. - // In a real application this loop would be driven by the frame cadence, - // and the thermal check would happen once every N frames rather than - // every frame. - const ( - totalFrames = 300 - framesPerCheck = 60 - frameDuration = 16 * time.Millisecond // ~60 fps - ) - - log.Printf("starting game loop: %d frames, checking thermal every %d frames", - totalFrames, framesPerCheck) - - for frame := 0; frame < totalFrames; frame++ { - if frame%framesPerCheck == 0 { - raw = mgr.CurrentStatus() - status = thermal.ThermalStatus(raw) - scale := throttleForStatus(status) - fmt.Printf(" [frame %3d] thermal=%s workload=%.0f%%\n", - frame, status, scale*100) - } - - // Placeholder for actual frame work. A real game loop would render - // the scene here with the throttled workload parameters. - time.Sleep(frameDuration) - } - - log.Println("game loop finished") -} diff --git a/examples/thermal/status-polling/main.go b/examples/thermal/status-polling/main.go deleted file mode 100644 index 15044f4..0000000 --- a/examples/thermal/status-polling/main.go +++ /dev/null @@ -1,84 +0,0 @@ -// Thermal status polling example. -// -// Demonstrates periodic polling of the device thermal status and using the -// result to make adaptive workload decisions. When the device reaches Severe -// or higher, the simulated workload is progressively reduced. -// -// This program must run on an Android device with thermal API support. -package main - -import ( - "fmt" - "log" - "time" - - "github.com/AndroidGoLab/ndk/thermal" -) - -// workloadScale returns a multiplier (0.0 to 1.0) indicating how much work -// should be performed at the given thermal status. Higher thermal pressure -// yields a lower multiplier. -func workloadScale(status thermal.ThermalStatus) float64 { - switch status { - case thermal.StatusNone: - return 1.0 - case thermal.StatusLight: - return 0.9 - case thermal.StatusModerate: - return 0.75 - case thermal.StatusSevere: - return 0.5 - case thermal.StatusCritical: - return 0.25 - case thermal.StatusEmergency: - return 0.1 - case thermal.StatusShutdown: - return 0.0 - default: - return 0.5 - } -} - -func main() { - mgr := thermal.NewManager() - defer mgr.Close() - - log.Println("thermal manager acquired") - - // Read initial status. - status := mgr.CurrentStatus() - log.Printf("initial thermal status: %s", status) - - // Poll thermal status at a fixed interval. In a real application this - // would be driven by a game loop or render tick; here we use a simple - // timer to keep the example self-contained. - const ( - pollInterval = 500 * time.Millisecond - pollCount = 10 - ) - - log.Printf("polling thermal status %d times at %v intervals", pollCount, pollInterval) - - for i := 0; i < pollCount; i++ { - status = mgr.CurrentStatus() - scale := workloadScale(status) - - fmt.Printf(" poll %2d: thermal=%s workload=%.0f%%", - i+1, status, scale*100) - - // Demonstrate adaptive throttling: log a warning when the device - // is under significant thermal pressure. - switch { - case status >= thermal.StatusSevere: - fmt.Printf(" ** throttling (severe+)\n") - case status >= thermal.StatusLight: - fmt.Printf(" (light pressure)\n") - default: - fmt.Printf("\n") - } - - time.Sleep(pollInterval) - } - - log.Println("polling finished") -} diff --git a/examples/trace/basic-tracing/main.go b/examples/trace/basic-tracing/main.go deleted file mode 100644 index b77afde..0000000 --- a/examples/trace/basic-tracing/main.go +++ /dev/null @@ -1,82 +0,0 @@ -// Basic systrace example: synchronous sections, asynchronous sections, and counters. -// -// Demonstrates: -// - Checking whether tracing is currently enabled -// - Wrapping synchronous work in BeginSection / EndSection -// - Tracking overlapping asynchronous operations with BeginAsyncSection / EndAsyncSection -// - Publishing numeric counters visible in the trace timeline with SetCounter -// -// This program must run on an Android device. Trace events are only recorded -// when a trace session is active (e.g. via `perfetto` or `atrace`). -package main - -import ( - "fmt" - "time" - - "github.com/AndroidGoLab/ndk/trace" -) - -func main() { - // Check whether a trace session is currently capturing events. - // All trace functions are safe to call regardless, but this lets you - // skip expensive argument preparation when nobody is listening. - if trace.IsEnabled() { - fmt.Println("tracing is enabled") - } else { - fmt.Println("tracing is not enabled (events will be silently dropped)") - } - - // --- Synchronous section --- - // BeginSection / EndSection mark a region on the calling thread's - // timeline. They must be strictly nested (like parentheses). - - trace.BeginSection("computeFrame") - - // Simulate some work. - total := 0 - for i := 0; i < 1_000_000; i++ { - total += i - } - - trace.EndSection() - fmt.Printf("synchronous section finished (total=%d)\n", total) - - // --- Asynchronous sections --- - // BeginAsyncSection / EndAsyncSection track work that may overlap - // across goroutines or threads. The cookie identifies which begin - // matches which end, so multiple instances of the same section name - // can be in flight simultaneously. - - const ( - cookieA int32 = 1 - cookieB int32 = 2 - ) - - // Start two overlapping async operations. - trace.BeginAsyncSection("networkRequest", cookieA) - trace.BeginAsyncSection("networkRequest", cookieB) - fmt.Println("started two async sections") - - // Simulate the first request finishing before the second. - time.Sleep(10 * time.Millisecond) - trace.EndAsyncSection("networkRequest", cookieA) - fmt.Println("async section A ended") - - time.Sleep(20 * time.Millisecond) - trace.EndAsyncSection("networkRequest", cookieB) - fmt.Println("async section B ended") - - // --- Counter --- - // SetCounter publishes a named integer value that appears as a - // counter track in the trace viewer. Useful for tracking queue - // depths, cache sizes, frame counts, etc. - - for frame := int64(1); frame <= 5; frame++ { - trace.SetCounter("framesRendered", frame) - time.Sleep(5 * time.Millisecond) - } - fmt.Println("counter updated 5 times") - - fmt.Println("done") -} diff --git a/examples/trace/function-tracing/main.go b/examples/trace/function-tracing/main.go deleted file mode 100644 index aaf6bae..0000000 --- a/examples/trace/function-tracing/main.go +++ /dev/null @@ -1,90 +0,0 @@ -// Function-level tracing with defer. -// -// Demonstrates a reusable pattern for instrumenting entire functions: call -// BeginSection at the top and defer EndSection so the section is always -// closed, even if the function returns early or panics. -// -// This program must run on an Android device. Trace events are only recorded -// when a trace session is active (e.g. via `perfetto` or `atrace`). -package main - -import ( - "fmt" - "time" - - "github.com/AndroidGoLab/ndk/trace" -) - -// traceSection begins a named trace section and returns a function that ends -// it. The intended usage is: -// -// defer traceSection("myWork")() -func traceSection(name string) func() { - trace.BeginSection(name) - return func() { - trace.EndSection() - } -} - -// loadConfig simulates reading configuration from disk. -func loadConfig() map[string]string { - defer traceSection("loadConfig")() - - time.Sleep(5 * time.Millisecond) // simulate I/O - return map[string]string{ - "server": "192.168.1.1", - "port": "8080", - } -} - -// connectToServer simulates establishing a network connection. -func connectToServer(addr string) error { - defer traceSection("connectToServer")() - - fmt.Printf("connecting to %s...\n", addr) - time.Sleep(15 * time.Millisecond) // simulate network latency - return nil -} - -// processItems simulates a batch processing loop. Each iteration gets its -// own nested trace section so individual items are visible in the timeline. -func processItems(n int) int { - defer traceSection("processItems")() - - total := 0 - for i := 0; i < n; i++ { - trace.BeginSection("processItem") - - // Simulate per-item work. - time.Sleep(2 * time.Millisecond) - total += i + 1 - - trace.EndSection() - } - return total -} - -func main() { - defer traceSection("main")() - - if trace.IsEnabled() { - fmt.Println("tracing is enabled") - } else { - fmt.Println("tracing is not enabled (events will be silently dropped)") - } - - cfg := loadConfig() - fmt.Printf("config loaded: %v\n", cfg) - - addr := cfg["server"] + ":" + cfg["port"] - if err := connectToServer(addr); err != nil { - fmt.Printf("connection failed: %v\n", err) - return // deferred EndSection still fires - } - fmt.Println("connected") - - total := processItems(5) - fmt.Printf("processed 5 items, total=%d\n", total) - - fmt.Println("done") -} diff --git a/examples/trace/nested-sections/main.go b/examples/trace/nested-sections/main.go deleted file mode 100644 index 02dde09..0000000 --- a/examples/trace/nested-sections/main.go +++ /dev/null @@ -1,103 +0,0 @@ -// Nested trace sections and counters example. -// -// Demonstrates how to use the NDK trace API for systrace/perfetto -// integration: -// - Nested synchronous sections (outer "NetworkRequest" containing -// an inner "ParseResponse") -// - Overlapping asynchronous sections for concurrent operations -// - Performance counters for tracking frame counts and byte throughput -// -// This program must run on an Android device. Trace events are only recorded -// when a trace session is active (e.g. via `perfetto` or `atrace`). -package main - -import ( - "fmt" - "time" - - "github.com/AndroidGoLab/ndk/trace" -) - -// simulateNetworkRequest wraps a simulated network call in nested trace -// sections: an outer section for the whole request and an inner section -// for response parsing. -func simulateNetworkRequest(url string, bytesReceived *int64) { - trace.BeginSection("NetworkRequest") - - // Simulate network I/O. - fmt.Printf(" fetching %s...\n", url) - time.Sleep(20 * time.Millisecond) - *bytesReceived += 4096 - - // The parse step is a nested section inside the request. - trace.BeginSection("ParseResponse") - time.Sleep(5 * time.Millisecond) - *bytesReceived += 512 - trace.EndSection() // ParseResponse - - trace.EndSection() // NetworkRequest -} - -func main() { - // Check whether a trace session is capturing events. - if trace.IsEnabled() { - fmt.Println("tracing is enabled") - } else { - fmt.Println("tracing is not enabled (events will be silently dropped)") - } - - // --- Nested synchronous sections --- - // Sections must be strictly nested (like parentheses). Here we show a - // top-level "App" section containing two network requests, each of - // which has its own nested sections. - - trace.BeginSection("App") - fmt.Println("started top-level section: App") - - var totalBytes int64 - - simulateNetworkRequest("https://api.example.com/data", &totalBytes) - simulateNetworkRequest("https://api.example.com/config", &totalBytes) - - trace.EndSection() // App - fmt.Printf("nested sections finished, total bytes: %d\n", totalBytes) - - // --- Overlapping asynchronous sections --- - // Async sections use a cookie to correlate begin/end across time. - // Unlike synchronous sections, multiple async sections with the same - // name can overlap. - - const ( - uploadCookie int32 = 100 - downloadCookie int32 = 200 - ) - - trace.BeginAsyncSection("FileTransfer", uploadCookie) - fmt.Println("started async upload") - - trace.BeginAsyncSection("FileTransfer", downloadCookie) - fmt.Println("started async download (overlapping with upload)") - - // Download finishes first. - time.Sleep(10 * time.Millisecond) - trace.EndAsyncSection("FileTransfer", downloadCookie) - fmt.Println("async download completed") - - // Upload finishes second. - time.Sleep(15 * time.Millisecond) - trace.EndAsyncSection("FileTransfer", uploadCookie) - fmt.Println("async upload completed") - - // --- Performance counters --- - // Counters appear as numeric tracks in the trace viewer. They are - // useful for tracking quantities that change over time. - - for frame := int64(1); frame <= 10; frame++ { - trace.SetCounter("frameCount", frame) - trace.SetCounter("bytesProcessed", totalBytes*frame) - time.Sleep(2 * time.Millisecond) - } - fmt.Println("published 10 counter samples") - - fmt.Println("done") -} diff --git a/examples/window/formats/main.go b/examples/window/formats/main.go deleted file mode 100644 index 6457b6f..0000000 --- a/examples/window/formats/main.go +++ /dev/null @@ -1,121 +0,0 @@ -// Example: ANativeWindow pixel format constants and API overview. -// -// Enumerates every pixel format constant exposed by the window package and -// prints its numeric value alongside the human-readable String() name. -// -// Creating an ANativeWindow requires a running Android Activity (the window -// handle is obtained from the Activity's native surface), so this example -// focuses on the type system and documents the full rendering lifecycle -// that a real application would follow. -// -// ANativeWindow rendering lifecycle: -// -// 1. Acquire -- Obtain a *Window from the Activity's native surface. -// The NDK delivers this via ANativeActivity callbacks -// (onNativeWindowCreated). The Window wraps an opaque -// ANativeWindow pointer managed by the system compositor. -// -// 2. Query -- Inspect the window with Width(), Height(), and Format(). -// Width and Height return the surface dimensions in pixels. -// Format returns the pixel format as an int32 matching one -// of the Format constants (Rgba8888, Rgbx8888, Rgb565). -// -// 3. Configure -- Optionally call SetBuffersGeometry(width, height, format) -// to request a different buffer size or pixel format. The -// compositor will scale the buffer to the window size if -// the requested dimensions differ. Pass 0 for width or -// height to keep the current dimension. Returns an error -// if the geometry change is rejected. -// -// 4. Lock -- Lock the next back-buffer for CPU access. This yields an -// ANativeWindow_Buffer describing the pixel memory layout: -// stride, dimensions, format, and a raw pointer to pixel -// data. While locked the compositor cannot read the buffer, -// so the lock duration should be kept short. -// -// 5. Draw -- Write pixels directly into the locked buffer. The pixel -// layout depends on the format: Rgba8888 uses 4 bytes per -// pixel (R, G, B, A), Rgbx8888 uses 4 bytes with the alpha -// channel ignored, and Rgb565 packs each pixel into 2 bytes -// (5 red, 6 green, 5 blue bits). -// -// 6. Unlock -- Call UnlockAndPost() to release the buffer and submit it -// to the compositor for display. This atomically unlocks -// the buffer and posts it; there is no separate post step. -// Returns an error if the surface is in an invalid state. -// -// 7. Release -- When the Activity's window is destroyed (onNativeWindowDestroyed), -// stop using the Window. The system reclaims the underlying -// native surface. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/window" -) - -func main() { - // All pixel format constants defined by ANativeWindow. - formats := []struct { - name string - value window.Format - bpp int - detail string - }{ - { - name: "Rgba8888", - value: window.Rgba8888, - bpp: 4, - detail: "8 bits per channel (red, green, blue, alpha)", - }, - { - name: "Rgbx8888", - value: window.Rgbx8888, - bpp: 4, - detail: "8 bits per channel (red, green, blue, padding); alpha ignored", - }, - { - name: "Rgb565", - value: window.Rgb565, - bpp: 2, - detail: "5 red, 6 green, 5 blue bits packed into 16 bits", - }, - } - - fmt.Println("ANativeWindow pixel formats:") - fmt.Println() - fmt.Printf(" %-12s %-5s %-4s %s\n", "Name", "Value", "BPP", "Description") - fmt.Printf(" %-12s %-5s %-4s %s\n", "------------", "-----", "----", "-----------") - - for _, f := range formats { - // String() returns the constant name; verify it matches. - str := f.value.String() - fmt.Printf(" %-12s %-5d %-4d %s\n", str, int32(f.value), f.bpp, f.detail) - } - - // Demonstrate the String() method on an unknown format value. - unknown := window.Format(99) - fmt.Printf("\n Unknown format value 99 prints as: %s\n", unknown) - - // Summarize the Window methods that would be used in a real application. - fmt.Println() - fmt.Println("Window methods:") - fmt.Println() - fmt.Println(" Width() int32") - fmt.Println(" Returns the window's current width in pixels.") - fmt.Println() - fmt.Println(" Height() int32") - fmt.Println(" Returns the window's current height in pixels.") - fmt.Println() - fmt.Println(" Format() int32") - fmt.Println(" Returns the window's pixel format (matches a Format constant).") - fmt.Println() - fmt.Println(" SetBuffersGeometry(width, height, format int32) error") - fmt.Println(" Requests a new buffer size and format. Pass 0 to keep a dimension.") - fmt.Println() - fmt.Println(" UnlockAndPost() error") - fmt.Println(" Unlocks the back-buffer and posts it to the display.") -} diff --git a/examples/window/software-render/main.go b/examples/window/software-render/main.go deleted file mode 100644 index a9782e9..0000000 --- a/examples/window/software-render/main.go +++ /dev/null @@ -1,256 +0,0 @@ -// Software rendering to an ANativeWindow. -// -// Demonstrates the pattern for rendering pixels directly to an Android -// native window using the CPU (software rendering). This is useful for -// 2D applications, terminal emulators, or any scenario where GPU rendering -// is not needed. -// -// The window package exposes Window with methods for querying dimensions, -// setting buffer geometry, and posting rendered frames. The Lock step -// requires the low-level API because the idiomatic package does not yet -// wrap ANativeWindow_lock. -// -// Software rendering lifecycle: -// -// 1. Obtain -- Get a *Window from the Activity's native surface. -// The NDK delivers this via ANativeActivity callbacks -// (onNativeWindowCreated). Wrap the pointer with -// window.NewWindowFromPointer. -// -// 2. Query -- Inspect the window: Width(), Height(), Format(). -// Width and Height return the current surface dimensions. -// Format returns an int32 matching a window.Format constant. -// -// 3. Configure -- Call SetBuffersGeometry(width, height, format) -// to request a specific buffer size and pixel format. -// Pass 0 for any dimension to keep the current value. -// The compositor scales the buffer to the window size. -// -// 4. Lock -- Call ANativeWindow_lock (the low-level layer) to lock the next -// back-buffer for CPU access. Returns an -// ANativeWindow_Buffer with pixel memory pointer, width, -// height, stride, and format. -// (Not yet exposed in the idiomatic layer.) -// -// 5. Draw -- Write pixels into the locked buffer. Respect the -// stride (pixels per row, may be wider than width due -// to alignment). The pixel layout depends on the format. -// -// 6. Post -- Call UnlockAndPost() to release the buffer and -// submit it to the compositor for display. -// -// 7. Repeat -- Go to step 4 for the next frame. -// -// Pixel formats: -// -// Rgba8888 -- 4 bytes/pixel: [R, G, B, A] -// Rgbx8888 -- 4 bytes/pixel: [R, G, B, x] (alpha ignored) -// Rgb565 -- 2 bytes/pixel: 5 red, 6 green, 5 blue bits -// -// Prerequisites: -// - Android device with a running Activity that provides a native window. -// - The window handle is obtained from onNativeWindowCreated. -// -// Because obtaining a window requires an Activity, this example documents -// the complete software rendering pipeline and prints the API calls rather -// than invoking them directly. -// -// This program must run on an Android device. -package main - -import ( - "fmt" - - "github.com/AndroidGoLab/ndk/window" -) - -func main() { - fmt.Println("=== ANativeWindow software rendering ===") - fmt.Println() - - // ── Step 1: Obtain a Window ───────────────────────────────── - // - // The Activity delivers a raw ANativeWindow* through the - // onNativeWindowCreated callback: - // - // func onNativeWindowCreated(rawPtr unsafe.Pointer) { - // win := window.NewWindowFromPointer(rawPtr) - // // start rendering - // } - - fmt.Println("Step 1: Obtain window from Activity") - fmt.Println(" win := window.NewWindowFromPointer(rawPtr)") - fmt.Println(" // rawPtr comes from onNativeWindowCreated callback") - fmt.Println() - - // ── Step 2: Query window properties ───────────────────────── - // - // Before rendering, query the window dimensions and format: - // - // w := win.Width() // surface width in pixels - // h := win.Height() // surface height in pixels - // f := win.Format() // pixel format (int32) - // - // The format value matches one of the window.Format constants. - - fmt.Println("Step 2: Query window properties") - fmt.Println(" win.Width() -- surface width in pixels") - fmt.Println(" win.Height() -- surface height in pixels") - fmt.Println(" win.Format() -- pixel format (int32)") - fmt.Println() - - // Print the available pixel format constants. - formats := []struct { - name string - value window.Format - bpp int - detail string - }{ - {"Rgba8888", window.Rgba8888, 4, "8 bits per channel: R, G, B, A"}, - {"Rgbx8888", window.Rgbx8888, 4, "8 bits per channel: R, G, B, padding"}, - {"Rgb565", window.Rgb565, 2, "16-bit packed: 5R, 6G, 5B"}, - } - - fmt.Println(" Available pixel formats:") - for _, f := range formats { - fmt.Printf(" %-10s = %d (%d BPP) %s\n", f.name, int32(f.value), f.bpp, f.detail) - } - fmt.Println() - - // ── Step 3: Configure buffer geometry ─────────────────────── - // - // Request a specific buffer size and format. This is optional - // but useful for controlling the rendering resolution or - // switching pixel formats. - // - // // Set 720p resolution with RGBA8888 format. - // if err := win.SetBuffersGeometry(1280, 720, window.Rgba8888); err != nil { - // log.Fatalf("set geometry: %v", err) - // } - // - // // Or keep current dimensions and only change the format: - // win.SetBuffersGeometry(0, 0, window.Rgb565) - - fmt.Println("Step 3: Configure buffer geometry") - fmt.Println(" win.SetBuffersGeometry(1280, 720, window.Rgba8888)") - fmt.Println(" // Pass 0 for width/height to keep current dimensions.") - fmt.Println() - - // ── Step 4: Lock the back-buffer (idiomatic) ──────────────── - // - // The idiomatic window package does not yet expose Lock. In a - // real application, use the low-level API: - // - // // use idiomatic package instead - // - // var buf ANativeWindow_Buffer - // rc := ANativeWindow_lock( - // (*ANativeWindow)(win.Pointer()), - // &buf, - // nil, // dirtyBounds: nil = full surface - // ) - // if rc != 0 { - // log.Fatalf("lock: %d", rc) - // } - // - // The ANativeWindow_Buffer struct contains: - // - Width, Height: buffer dimensions in pixels - // - Stride: pixels per row (may be > Width due to alignment) - // - Format: pixel format - // - Bits: pointer to the pixel data - - fmt.Println("Step 4: Lock the back-buffer (requires the low-level layer)") - fmt.Println(" ANativeWindow_lock(nativeWin, &buf, nil)") - fmt.Println(" // buf.Bits = pointer to pixel data") - fmt.Println(" // buf.Stride = pixels per row (includes padding)") - fmt.Println() - - // ── Step 5: Write pixels ──────────────────────────────────── - // - // Write directly into the buffer memory. Always use the stride - // (not width) to compute row offsets, as the buffer may have - // alignment padding. - // - // Example: fill with a gradient (RGBA8888): - // - // pixels := unsafe.Slice((*[4]byte)(buf.Bits), stride*height) - // for y := 0; y < height; y++ { - // for x := 0; x < width; x++ { - // off := y*stride + x - // pixels[off] = [4]byte{ - // byte(x * 255 / width), // R: left-to-right gradient - // byte(y * 255 / height), // G: top-to-bottom gradient - // 128, // B: constant - // 255, // A: opaque - // } - // } - // } - // - // For Rgb565, pack each pixel into 2 bytes: - // - // r5 := uint16(r >> 3) - // g6 := uint16(g >> 2) - // b5 := uint16(b >> 3) - // pixel565 := (r5 << 11) | (g6 << 5) | b5 - - fmt.Println("Step 5: Write pixels into the locked buffer") - fmt.Println(" // Use stride (not width) for row offset calculation.") - fmt.Println(" // RGBA8888: 4 bytes per pixel [R, G, B, A]") - fmt.Println(" // RGB565: 2 bytes per pixel, bit-packed") - fmt.Println() - - // ── Step 6: Unlock and post ───────────────────────────────── - // - // UnlockAndPost atomically releases the CPU lock and submits the - // buffer to the system compositor (SurfaceFlinger) for display. - // - // if err := win.UnlockAndPost(); err != nil { - // log.Fatalf("unlock and post: %v", err) - // } - - fmt.Println("Step 6: Unlock and post") - fmt.Println(" win.UnlockAndPost()") - fmt.Println(" // Releases the buffer and submits it for display.") - fmt.Println() - - // ── Step 7: Frame loop ────────────────────────────────────── - // - // Repeat steps 4-6 for each frame: - // - // for running { - // // Lock - // ANativeWindow_lock(nativeWin, &buf, nil) - // - // // Draw into buf.Bits - // renderFrame(&buf) - // - // // Post - // win.UnlockAndPost() - // } - // - // For smooth animation, synchronize with the display refresh - // rate using AChoreographer or eglSwapInterval. Without pacing, - // the compositor may throttle or drop frames. - - fmt.Println("Step 7: Frame loop") - fmt.Println(" for each frame: Lock -> Draw -> UnlockAndPost") - fmt.Println(" Use AChoreographer for vsync-aligned frame pacing.") - fmt.Println() - - // ── Window lifecycle notes ────────────────────────────────── - // - // The window handle is valid between onNativeWindowCreated and - // onNativeWindowDestroyed callbacks. Applications must: - // - Stop rendering before onNativeWindowDestroyed returns. - // - Never call Lock or UnlockAndPost on a destroyed window. - // - Handle window size changes via onNativeWindowResized - // by re-querying Width/Height and adjusting rendering. - - fmt.Println("Lifecycle notes:") - fmt.Println(" Window is valid between onNativeWindowCreated/Destroyed.") - fmt.Println(" Stop rendering before onNativeWindowDestroyed returns.") - fmt.Println(" Handle size changes via onNativeWindowResized.") - fmt.Println() - - fmt.Println("software-render overview complete") -} diff --git a/font/errors.go b/font/errors.go deleted file mode 100644 index b42d39f..0000000 --- a/font/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package font - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/font/family_variant.go b/font/family_variant.go deleted file mode 100644 index 08dd775..0000000 --- a/font/family_variant.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package font - -type FAMILY_VARIANT int32 - -const ( - AFAMILY_VARIANT_DEFAULT FAMILY_VARIANT = 0 - AFAMILY_VARIANT_COMPACT FAMILY_VARIANT = 1 - AFAMILY_VARIANT_ELEGANT FAMILY_VARIANT = 2 -) diff --git a/font/font.go b/font/font.go deleted file mode 100644 index 4d495d1..0000000 --- a/font/font.go +++ /dev/null @@ -1,96 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package font - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/font" -) - -// Font wraps the NDK AFont handle. -type Font struct { - ptr *capi.AFont -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Font) cptr() *capi.AFont { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Font) Close() error { - if h.ptr == nil { - return nil - } - capi.AFont_close(h.ptr) - h.ptr = nil - return nil -} - -// NewFontFromPointer wraps a raw AFont pointer. -func NewFontFromPointer(ptr unsafe.Pointer) *Font { - return &Font{ptr: (*capi.AFont)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Font) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Font) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewFontFromUintPtr wraps a uintptr as a Font. -// The caller must ensure ptr points to a valid AFont. -func NewFontFromUintPtr(ptr uintptr) *Font { - return &Font{ptr: (*capi.AFont)(unsafe.Pointer(ptr))} -} - -// GetAxisCount returns the value directly. -func (h *Font) GetAxisCount() uint64 { - return (uint64)(capi.AFont_getAxisCount(h.ptr)) -} - -// GetAxisTag calls the underlying NDK function. -func (h *Font) GetAxisTag(axisIndex uint32) error { - return result(capi.AFont_getAxisTag(h.ptr, axisIndex)) -} - -// GetAxisValue returns the value directly. -func (h *Font) GetAxisValue(axisIndex uint32) float32 { - return (float32)(capi.AFont_getAxisValue(h.ptr, axisIndex)) -} - -// GetCollectionIndex returns the value directly. -func (h *Font) GetCollectionIndex() uint64 { - return (uint64)(capi.AFont_getCollectionIndex(h.ptr)) -} - -// GetFontFilePath returns the value directly. -func (h *Font) GetFontFilePath() string { - return (string)(capi.AFont_getFontFilePath(h.ptr)) -} - -// GetLocale returns the value directly. -func (h *Font) GetLocale() string { - return (string)(capi.AFont_getLocale(h.ptr)) -} - -// Weight returns the value directly. -func (h *Font) Weight() uint16 { - return (uint16)(capi.AFont_getWeight(h.ptr)) -} - -// IsItalic returns the value directly. -func (h *Font) IsItalic() bool { - return (bool)(capi.AFont_isItalic(h.ptr)) -} diff --git a/font/functions.go b/font/functions.go deleted file mode 100644 index 8ca33ee..0000000 --- a/font/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package font diff --git a/font/matcher.go b/font/matcher.go deleted file mode 100644 index c567056..0000000 --- a/font/matcher.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package font - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/font" -) - -// Matcher wraps the NDK AFontMatcher handle. -type Matcher struct { - ptr *capi.AFontMatcher -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Matcher) cptr() *capi.AFontMatcher { - if h == nil { - return nil - } - return h.ptr -} - -// NewMatcher creates a new Matcher. -func NewMatcher() *Matcher { - return &Matcher{ptr: capi.AFontMatcher_create()} -} - -// Close releases the underlying NDK handle. -func (h *Matcher) Close() error { - if h.ptr == nil { - return nil - } - capi.AFontMatcher_destroy(h.ptr) - h.ptr = nil - return nil -} - -// NewMatcherFromPointer wraps a raw AFontMatcher pointer. -func NewMatcherFromPointer(ptr unsafe.Pointer) *Matcher { - return &Matcher{ptr: (*capi.AFontMatcher)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Matcher) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Matcher) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMatcherFromUintPtr wraps a uintptr as a Matcher. -// The caller must ensure ptr points to a valid AFontMatcher. -func NewMatcherFromUintPtr(ptr uintptr) *Matcher { - return &Matcher{ptr: (*capi.AFontMatcher)(unsafe.Pointer(ptr))} -} - -// Match creates a new Font from this Matcher. -func (h *Matcher) Match(familyName string, text *uint16, textLength uint32, runLengthOut *uint32) *Font { - return &Font{ptr: capi.AFontMatcher_match(h.ptr, familyName, text, textLength, runLengthOut)} -} - -// SetFamilyVariant calls the underlying NDK function. -func (h *Matcher) SetFamilyVariant(familyVariant uint32) { - capi.AFontMatcher_setFamilyVariant(h.ptr, familyVariant) -} - -// SetLocales calls the underlying NDK function. -func (h *Matcher) SetLocales(languageTags string) { - capi.AFontMatcher_setLocales(h.ptr, languageTags) -} - -// SetStyle sets a property and returns the receiver for chaining. -func (h *Matcher) SetStyle(weight uint16, italic bool) *Matcher { - capi.AFontMatcher_setStyle(h.ptr, weight, italic) - return h -} diff --git a/font/package.go b/font/package.go deleted file mode 100644 index 7a9250d..0000000 --- a/font/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package font provides Go bindings for Android Font. -package font diff --git a/font/system_font_iterator.go b/font/system_font_iterator.go deleted file mode 100644 index 7163bfc..0000000 --- a/font/system_font_iterator.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package font - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/font" -) - -// SystemFontIterator wraps the NDK ASystemFontIterator handle. -type SystemFontIterator struct { - ptr *capi.ASystemFontIterator -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *SystemFontIterator) cptr() *capi.ASystemFontIterator { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *SystemFontIterator) Close() error { - if h.ptr == nil { - return nil - } - capi.ASystemFontIterator_close(h.ptr) - h.ptr = nil - return nil -} - -// NewSystemFontIteratorFromPointer wraps a raw ASystemFontIterator pointer. -func NewSystemFontIteratorFromPointer(ptr unsafe.Pointer) *SystemFontIterator { - return &SystemFontIterator{ptr: (*capi.ASystemFontIterator)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *SystemFontIterator) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *SystemFontIterator) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSystemFontIteratorFromUintPtr wraps a uintptr as a SystemFontIterator. -// The caller must ensure ptr points to a valid ASystemFontIterator. -func NewSystemFontIteratorFromUintPtr(ptr uintptr) *SystemFontIterator { - return &SystemFontIterator{ptr: (*capi.ASystemFontIterator)(unsafe.Pointer(ptr))} -} - -// Next creates a new Font from this SystemFontIterator. -func (h *SystemFontIterator) Next() *Font { - return &Font{ptr: capi.ASystemFontIterator_next(h.ptr)} -} - -// ASystemFontIterator_open calls the underlying C function. -func ASystemFontIterator_open() *SystemFontIterator { - return &SystemFontIterator{ptr: capi.ASystemFontIterator_open()} -} diff --git a/font/weight.go b/font/weight.go deleted file mode 100644 index fc68f24..0000000 --- a/font/weight.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package font - -type Weight int32 - -const ( - Min Weight = 0 - Thin Weight = 100 - ExtraLight Weight = 200 - Light Weight = 300 - Normal Weight = 400 - Medium Weight = 500 - SemiBold Weight = 600 - Bold Weight = 700 - ExtraBold Weight = 800 - Black Weight = 900 - Max Weight = 1000 -) diff --git a/gameactivity/README.md b/gameactivity/README.md deleted file mode 100644 index b5d6e25..0000000 --- a/gameactivity/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# GameActivity - -This package provides Go bindings for the [AGDK GameActivity](https://developer.android.com/games/agdk/game-activity) C library. - -GameActivity is an alternative to NativeActivity that provides: -- Better input event handling with motion event batching -- Text input support via GameTextInput -- Modern lifecycle management built on AppCompatActivity - -## Prerequisites - -GameActivity headers are not part of the standard Android NDK. To use this package: - -1. Download the `games-activity` AAR from Maven Central: - ``` - https://maven.google.com/web/index.html#androidx.games:games-activity - ``` - -2. Extract the AAR (it's a ZIP file) and copy the C headers from - `prefab/modules/game-activity/include/` to `gameactivity/include/`. - -3. Copy the C source files from `prefab/modules/game-activity/src/` to - `gameactivity/csrc/`. - -Alternatively, install the AGDK via Android Studio's SDK Manager. - -## Build tags - -The Go source files use `//go:build ignore` until the AGDK headers are -vendored into the `include/` and `csrc/` subdirectories. After vendoring, -remove the build constraint to enable compilation. diff --git a/gameactivity/activity.go b/gameactivity/activity.go deleted file mode 100644 index f24ad2e..0000000 --- a/gameactivity/activity.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build ignore - -package gameactivity - -/* -#cgo LDFLAGS: -landroid -llog - -#include "include/game-activity/GameActivity.h" -#include -*/ -import "C" - -import "unsafe" - -// Activity wraps a GameActivity pointer. -type Activity struct { - ptr *C.GameActivity -} - -// NewActivityFromPointer wraps a raw GameActivity pointer. -func NewActivityFromPointer(ptr unsafe.Pointer) *Activity { - return &Activity{ptr: (*C.GameActivity)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (a *Activity) Pointer() unsafe.Pointer { - return unsafe.Pointer(a.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -func (a *Activity) UintPtr() uintptr { - return uintptr(unsafe.Pointer(a.ptr)) -} - -// NewActivityFromUintPtr wraps a uintptr as an Activity. -func NewActivityFromUintPtr(ptr uintptr) *Activity { - return &Activity{ptr: (*C.GameActivity)(unsafe.Pointer(ptr))} -} - -// VM returns the Java VM handle. -func (a *Activity) VM() unsafe.Pointer { - return unsafe.Pointer(a.ptr.vm) -} - -// VMUintPtr returns the Java VM handle as uintptr. -func (a *Activity) VMUintPtr() uintptr { - return uintptr(unsafe.Pointer(a.ptr.vm)) -} - -// Env returns the JNI environment for the main thread. -// This must only be used from the main thread. -func (a *Activity) Env() unsafe.Pointer { - return unsafe.Pointer(a.ptr.env) -} - -// EnvUintPtr returns the JNI environment as uintptr. -// This must only be used from the main thread. -func (a *Activity) EnvUintPtr() uintptr { - return uintptr(unsafe.Pointer(a.ptr.env)) -} - -// JavaGameActivity returns the Java GameActivity jobject handle. -func (a *Activity) JavaGameActivity() uintptr { - return uintptr(a.ptr.javaGameActivity) -} - -// SDKVersion returns the platform SDK version code. -func (a *Activity) SDKVersion() int32 { - return int32(a.ptr.sdkVersion) -} - -// InternalDataPath returns the path to the application's internal data directory. -func (a *Activity) InternalDataPath() string { - return C.GoString(a.ptr.internalDataPath) -} - -// ExternalDataPath returns the path to the application's external data directory. -func (a *Activity) ExternalDataPath() string { - return C.GoString(a.ptr.externalDataPath) -} - -// OBBPath returns the path to the application's OBB directory. -func (a *Activity) OBBPath() string { - return C.GoString(a.ptr.obbPath) -} - -// AssetManager returns the AAssetManager pointer. -func (a *Activity) AssetManager() unsafe.Pointer { - return unsafe.Pointer(a.ptr.assetManager) -} - -// Instance returns the application's custom instance data. -func (a *Activity) Instance() unsafe.Pointer { - return a.ptr.instance -} - -// SetInstance stores custom instance data on the activity. -func (a *Activity) SetInstance(data unsafe.Pointer) { - a.ptr.instance = data -} - -// Finish requests that the GameActivity be finished. -func (a *Activity) Finish() { - C.GameActivity_finish(a.ptr) -} - -// SetWindowFlags sets the activity's window flags. -func (a *Activity) SetWindowFlags(addFlags, removeFlags uint32) { - C.GameActivity_setWindowFlags(a.ptr, C.uint32_t(addFlags), C.uint32_t(removeFlags)) -} - -// ShowSoftInput shows the software keyboard. -func (a *Activity) ShowSoftInput(flags ShowSoftInputFlags) { - C.GameActivity_showSoftInput(a.ptr, C.uint32_t(flags)) -} - -// HideSoftInput hides the software keyboard. -func (a *Activity) HideSoftInput(flags HideSoftInputFlags) { - C.GameActivity_hideSoftInput(a.ptr, C.uint32_t(flags)) -} - -// SetImeEditorInfo configures the IME editor info. -func (a *Activity) SetImeEditorInfo( - inputType int, - actionID int, - imeOptions int, -) { - C.GameActivity_setImeEditorInfo( - a.ptr, - C.int(inputType), - C.int(actionID), - C.int(imeOptions), - ) -} - -// SetTextInputState sets the current text input state. -func (a *Activity) SetTextInputState(state TextInputState) { - var cState C.GameTextInputState - cText := C.CString(state.Text) - defer C.free(unsafe.Pointer(cText)) - cState.text_UTF8 = cText - cState.text_length = C.int32_t(len(state.Text)) - cState.selection.start = C.int32_t(state.SelectionStart) - cState.selection.end = C.int32_t(state.SelectionEnd) - cState.composingRegion.start = C.int32_t(state.ComposingStart) - cState.composingRegion.end = C.int32_t(state.ComposingEnd) - C.GameActivity_setTextInputState(a.ptr, &cState) -} - -// GetWindowInsets retrieves the window insets for the given type. -// Returns left, top, right, bottom. -func (a *Activity) GetWindowInsets(insetsType InsetsType) (left, top, right, bottom int32) { - var rect C.ARect - C.GameActivity_getWindowInsets(a.ptr, C.GameCommonInsetsType(insetsType), &rect) - return int32(rect.left), int32(rect.top), int32(rect.right), int32(rect.bottom) -} diff --git a/gameactivity/callbacks.go b/gameactivity/callbacks.go deleted file mode 100644 index 38ce860..0000000 --- a/gameactivity/callbacks.go +++ /dev/null @@ -1,264 +0,0 @@ -//go:build ignore - -package gameactivity - -/* -#include "include/game-activity/GameActivity.h" -#include - -// Forward declarations for Go callback trampolines. -extern void goOnCreate(GameActivity* activity, void* savedState, size_t savedStateSize); -extern void goOnDestroy(GameActivity* activity); -extern void goOnStart(GameActivity* activity); -extern void goOnStop(GameActivity* activity); -extern void goOnPause(GameActivity* activity); -extern void goOnResume(GameActivity* activity); -extern void goOnConfigurationChanged(GameActivity* activity); -extern void goOnTrimMemory(GameActivity* activity, int level); -extern void goOnWindowFocusChanged(GameActivity* activity, bool hasFocus); -extern void goOnNativeWindowCreated(GameActivity* activity, ANativeWindow* window); -extern void goOnNativeWindowDestroyed(GameActivity* activity, ANativeWindow* window); -extern void goOnNativeWindowResized(GameActivity* activity, ANativeWindow* window, int32_t w, int32_t h); -extern void goOnNativeWindowRedrawNeeded(GameActivity* activity, ANativeWindow* window); -extern void goOnWindowInsetsChanged(GameActivity* activity); -extern bool goOnTouchEvent(GameActivity* activity, const GameActivityMotionEvent* event); -extern bool goOnKeyDown(GameActivity* activity, const GameActivityKeyEvent* event); -extern bool goOnKeyUp(GameActivity* activity, const GameActivityKeyEvent* event); -extern void goOnTextInputEvent(GameActivity* activity, const GameTextInputState* state); - -static void installCallbacks(GameActivityCallbacks* cb) { - cb->onDestroy = goOnDestroy; - cb->onStart = goOnStart; - cb->onStop = goOnStop; - cb->onPause = goOnPause; - cb->onResume = goOnResume; - cb->onConfigurationChanged = goOnConfigurationChanged; - cb->onTrimMemory = goOnTrimMemory; - cb->onWindowFocusChanged = goOnWindowFocusChanged; - cb->onNativeWindowCreated = goOnNativeWindowCreated; - cb->onNativeWindowDestroyed = goOnNativeWindowDestroyed; - cb->onNativeWindowResized = goOnNativeWindowResized; - cb->onNativeWindowRedrawNeeded = goOnNativeWindowRedrawNeeded; - cb->onWindowInsetsChanged = goOnWindowInsetsChanged; - cb->onTouchEvent = goOnTouchEvent; - cb->onKeyDown = goOnKeyDown; - cb->onKeyUp = goOnKeyUp; - cb->onTextInputEvent = goOnTextInputEvent; -} -*/ -import "C" - -import ( - "sync" - "unsafe" -) - -// Callbacks defines the lifecycle and event callbacks for GameActivity. -// All callbacks execute on the main thread. -type Callbacks struct { - OnDestroy func(activity *Activity) - OnStart func(activity *Activity) - OnStop func(activity *Activity) - OnPause func(activity *Activity) - OnResume func(activity *Activity) - OnConfigurationChanged func(activity *Activity) - OnTrimMemory func(activity *Activity, level int) - OnWindowFocusChanged func(activity *Activity, hasFocus bool) - - OnNativeWindowCreated func(activity *Activity, window unsafe.Pointer) - OnNativeWindowDestroyed func(activity *Activity, window unsafe.Pointer) - OnNativeWindowResized func(activity *Activity, window unsafe.Pointer, width, height int32) - OnNativeWindowRedrawNeeded func(activity *Activity, window unsafe.Pointer) - OnWindowInsetsChanged func(activity *Activity) - - OnTouchEvent func(activity *Activity, event MotionEvent) bool - OnKeyDown func(activity *Activity, event KeyEvent) bool - OnKeyUp func(activity *Activity, event KeyEvent) bool - OnTextInputEvent func(activity *Activity, state TextInputState) -} - -var ( - callbacksMu sync.Mutex - registeredCallbacks *Callbacks -) - -// SetCallbacks registers the Go callback handlers and installs -// C trampoline functions into the GameActivity's callback table. -// Only one set of callbacks can be active at a time. -func SetCallbacks(activity *Activity, cb *Callbacks) { - callbacksMu.Lock() - registeredCallbacks = cb - callbacksMu.Unlock() - C.installCallbacks(activity.ptr.callbacks) -} - -func getCallbacks() *Callbacks { - callbacksMu.Lock() - defer callbacksMu.Unlock() - return registeredCallbacks -} - -//export goOnDestroy -func goOnDestroy(activity *C.GameActivity) { - if cb := getCallbacks(); cb != nil && cb.OnDestroy != nil { - cb.OnDestroy(NewActivityFromPointer(unsafe.Pointer(activity))) - } -} - -//export goOnStart -func goOnStart(activity *C.GameActivity) { - if cb := getCallbacks(); cb != nil && cb.OnStart != nil { - cb.OnStart(NewActivityFromPointer(unsafe.Pointer(activity))) - } -} - -//export goOnStop -func goOnStop(activity *C.GameActivity) { - if cb := getCallbacks(); cb != nil && cb.OnStop != nil { - cb.OnStop(NewActivityFromPointer(unsafe.Pointer(activity))) - } -} - -//export goOnPause -func goOnPause(activity *C.GameActivity) { - if cb := getCallbacks(); cb != nil && cb.OnPause != nil { - cb.OnPause(NewActivityFromPointer(unsafe.Pointer(activity))) - } -} - -//export goOnResume -func goOnResume(activity *C.GameActivity) { - if cb := getCallbacks(); cb != nil && cb.OnResume != nil { - cb.OnResume(NewActivityFromPointer(unsafe.Pointer(activity))) - } -} - -//export goOnConfigurationChanged -func goOnConfigurationChanged(activity *C.GameActivity) { - if cb := getCallbacks(); cb != nil && cb.OnConfigurationChanged != nil { - cb.OnConfigurationChanged(NewActivityFromPointer(unsafe.Pointer(activity))) - } -} - -//export goOnTrimMemory -func goOnTrimMemory(activity *C.GameActivity, level C.int) { - if cb := getCallbacks(); cb != nil && cb.OnTrimMemory != nil { - cb.OnTrimMemory(NewActivityFromPointer(unsafe.Pointer(activity)), int(level)) - } -} - -//export goOnWindowFocusChanged -func goOnWindowFocusChanged(activity *C.GameActivity, hasFocus C.bool) { - if cb := getCallbacks(); cb != nil && cb.OnWindowFocusChanged != nil { - cb.OnWindowFocusChanged(NewActivityFromPointer(unsafe.Pointer(activity)), bool(hasFocus)) - } -} - -//export goOnNativeWindowCreated -func goOnNativeWindowCreated(activity *C.GameActivity, window *C.ANativeWindow) { - if cb := getCallbacks(); cb != nil && cb.OnNativeWindowCreated != nil { - cb.OnNativeWindowCreated( - NewActivityFromPointer(unsafe.Pointer(activity)), - unsafe.Pointer(window), - ) - } -} - -//export goOnNativeWindowDestroyed -func goOnNativeWindowDestroyed(activity *C.GameActivity, window *C.ANativeWindow) { - if cb := getCallbacks(); cb != nil && cb.OnNativeWindowDestroyed != nil { - cb.OnNativeWindowDestroyed( - NewActivityFromPointer(unsafe.Pointer(activity)), - unsafe.Pointer(window), - ) - } -} - -//export goOnNativeWindowResized -func goOnNativeWindowResized( - activity *C.GameActivity, - window *C.ANativeWindow, - w, h C.int32_t, -) { - if cb := getCallbacks(); cb != nil && cb.OnNativeWindowResized != nil { - cb.OnNativeWindowResized( - NewActivityFromPointer(unsafe.Pointer(activity)), - unsafe.Pointer(window), - int32(w), int32(h), - ) - } -} - -//export goOnNativeWindowRedrawNeeded -func goOnNativeWindowRedrawNeeded(activity *C.GameActivity, window *C.ANativeWindow) { - if cb := getCallbacks(); cb != nil && cb.OnNativeWindowRedrawNeeded != nil { - cb.OnNativeWindowRedrawNeeded( - NewActivityFromPointer(unsafe.Pointer(activity)), - unsafe.Pointer(window), - ) - } -} - -//export goOnWindowInsetsChanged -func goOnWindowInsetsChanged(activity *C.GameActivity) { - if cb := getCallbacks(); cb != nil && cb.OnWindowInsetsChanged != nil { - cb.OnWindowInsetsChanged(NewActivityFromPointer(unsafe.Pointer(activity))) - } -} - -//export goOnTouchEvent -func goOnTouchEvent(activity *C.GameActivity, event *C.GameActivityMotionEvent) C.bool { - if cb := getCallbacks(); cb != nil && cb.OnTouchEvent != nil { - return C.bool(cb.OnTouchEvent( - NewActivityFromPointer(unsafe.Pointer(activity)), - motionEventFromC(event), - )) - } - return C.bool(false) -} - -//export goOnKeyDown -func goOnKeyDown(activity *C.GameActivity, event *C.GameActivityKeyEvent) C.bool { - if cb := getCallbacks(); cb != nil && cb.OnKeyDown != nil { - return C.bool(cb.OnKeyDown( - NewActivityFromPointer(unsafe.Pointer(activity)), - keyEventFromC(event), - )) - } - return C.bool(false) -} - -//export goOnKeyUp -func goOnKeyUp(activity *C.GameActivity, event *C.GameActivityKeyEvent) C.bool { - if cb := getCallbacks(); cb != nil && cb.OnKeyUp != nil { - return C.bool(cb.OnKeyUp( - NewActivityFromPointer(unsafe.Pointer(activity)), - keyEventFromC(event), - )) - } - return C.bool(false) -} - -//export goOnTextInputEvent -func goOnTextInputEvent(activity *C.GameActivity, state *C.GameTextInputState) { - if cb := getCallbacks(); cb != nil && cb.OnTextInputEvent != nil { - goState := TextInputState{ - Text: C.GoStringN(state.text_UTF8, C.int(state.text_length)), - SelectionStart: int32(state.selection.start), - SelectionEnd: int32(state.selection.end), - ComposingStart: int32(state.composingRegion.start), - ComposingEnd: int32(state.composingRegion.end), - } - cb.OnTextInputEvent( - NewActivityFromPointer(unsafe.Pointer(activity)), - goState, - ) - } -} - -//export goOnCreate -func goOnCreate(activity *C.GameActivity, savedState unsafe.Pointer, savedStateSize C.size_t) { - // This is the entry point called by the framework. - // The application should call SetCallbacks from here or from - // whatever initialization function is triggered by GameActivity_onCreate. -} diff --git a/gameactivity/doc.go b/gameactivity/doc.go deleted file mode 100644 index 2cd8f99..0000000 --- a/gameactivity/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package gameactivity provides Go bindings for the AGDK GameActivity C library. -// -// GameActivity is a Jetpack library that replaces NativeActivity with improved -// input handling (motion event batching), text input support via GameTextInput, -// and modern lifecycle management built on AppCompatActivity. -// -// This package requires AGDK GameActivity headers which are not part of the -// standard Android NDK. See README.md for setup instructions. -package gameactivity diff --git a/gameactivity/example_test.go b/gameactivity/example_test.go deleted file mode 100644 index 1f7346e..0000000 --- a/gameactivity/example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build ignore - -package gameactivity_test - -import ( - "fmt" - "unsafe" - - "github.com/AndroidGoLab/ndk/gameactivity" -) - -func Example() { - // In a real application, the GameActivity pointer comes from the - // framework via GameActivity_onCreate. - var actPtr unsafe.Pointer - act := gameactivity.NewActivityFromPointer(actPtr) - - // Register lifecycle and input callbacks. - gameactivity.SetCallbacks(act, &gameactivity.Callbacks{ - OnResume: func(activity *gameactivity.Activity) { - fmt.Println("resumed") - }, - OnTouchEvent: func(activity *gameactivity.Activity, event gameactivity.MotionEvent) bool { - for _, p := range event.Pointers { - fmt.Printf("touch pointer %d at (%.0f, %.0f)\n", p.ID, p.X(), p.Y()) - } - return true - }, - }) - - // Show the software keyboard. - act.ShowSoftInput(gameactivity.ShowSoftInputImplicit) - - // Update text input state. - act.SetTextInputState(gameactivity.TextInputState{ - Text: "Hello", - SelectionStart: 5, - SelectionEnd: 5, - }) - - // Make the activity fullscreen. - act.SetWindowFlags(gameactivity.FlagFullscreen, 0) - - fmt.Println("GameActivity initialized") -} diff --git a/gameactivity/flags.go b/gameactivity/flags.go deleted file mode 100644 index 11a3db8..0000000 --- a/gameactivity/flags.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build ignore - -package gameactivity - -/* -#include "include/game-activity/GameActivity.h" -*/ -import "C" - -// Window flags for SetWindowFlags. -const ( - FlagAllowLockWhileScreenOn = C.GAMEACTIVITY_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON - FlagDimBehind = C.GAMEACTIVITY_FLAG_DIM_BEHIND - FlagNotFocusable = C.GAMEACTIVITY_FLAG_NOT_FOCUSABLE - FlagNotTouchable = C.GAMEACTIVITY_FLAG_NOT_TOUCHABLE - FlagFullscreen = C.GAMEACTIVITY_FLAG_FULLSCREEN - FlagLayoutInScreen = C.GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN - FlagKeepScreenOn = C.GAMEACTIVITY_FLAG_KEEP_SCREEN_ON - FlagSecure = C.GAMEACTIVITY_FLAG_SECURE - FlagShowWhenLocked = C.GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED - FlagDismissKeyguard = C.GAMEACTIVITY_FLAG_DISMISS_KEYGUARD -) - -// ShowSoftInputFlags controls how the soft keyboard is shown. -type ShowSoftInputFlags uint32 - -const ( - ShowSoftInputImplicit ShowSoftInputFlags = C.GAMEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT - ShowSoftInputForced ShowSoftInputFlags = C.GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED -) - -// HideSoftInputFlags controls how the soft keyboard is hidden. -type HideSoftInputFlags uint32 - -const ( - HideSoftInputImplicitOnly HideSoftInputFlags = C.GAMEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY - HideSoftInputNotAlways HideSoftInputFlags = C.GAMEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS -) - -// InsetsType identifies the type of window insets to query. -type InsetsType int32 diff --git a/gameactivity/key_event.go b/gameactivity/key_event.go deleted file mode 100644 index 54623e7..0000000 --- a/gameactivity/key_event.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build ignore - -package gameactivity - -/* -#include "include/game-activity/GameActivity.h" -*/ -import "C" - -// KeyEvent represents a key event from GameActivity. -// It maps 1:1 to the Java KeyEvent class. -type KeyEvent struct { - DeviceID int32 - Source int32 - Action int32 - Flags int32 - KeyCode int32 - MetaState int32 - Modifiers int32 - RepeatCount int32 - DownTime int64 - EventTime int64 -} - -// keyEventFromC converts a C GameActivityKeyEvent to a Go KeyEvent. -func keyEventFromC(c *C.GameActivityKeyEvent) KeyEvent { - return KeyEvent{ - DeviceID: int32(c.deviceId), - Source: int32(c.source), - Action: int32(c.action), - Flags: int32(c.flags), - KeyCode: int32(c.keyCode), - MetaState: int32(c.metaState), - Modifiers: int32(c.modifiers), - RepeatCount: int32(c.repeatCount), - DownTime: int64(c.downTime), - EventTime: int64(c.eventTime), - } -} diff --git a/gameactivity/motion_event.go b/gameactivity/motion_event.go deleted file mode 100644 index 44cf2b6..0000000 --- a/gameactivity/motion_event.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build ignore - -package gameactivity - -/* -#include "include/game-activity/GameActivity.h" - -static GameActivityPointerAxes* getPointer( - GameActivityMotionEvent* event, int index -) { - return &event->pointers[index]; -} -*/ -import "C" - -const ( - // MaxPointersInMotionEvent is the maximum number of pointers in a motion event. - MaxPointersInMotionEvent = C.GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT -) - -// MotionEvent represents a motion (touch/mouse) event from GameActivity. -// It maps 1:1 to the Java MotionEvent class. -type MotionEvent struct { - DeviceID int32 - Source int32 - Action int32 - ActionButton int32 - Flags int32 - MetaState int32 - EdgeFlags int32 - ButtonState int32 - Classification int32 - PrecisionX float32 - PrecisionY float32 - DownTime int64 - EventTime int64 - Pointers []PointerAxes -} - -// motionEventFromC converts a C GameActivityMotionEvent to a Go MotionEvent. -func motionEventFromC(c *C.GameActivityMotionEvent) MotionEvent { - count := int(c.pointerCount) - pointers := make([]PointerAxes, count) - for i := range count { - p := C.getPointer(c, C.int(i)) - pointers[i] = pointerAxesFromC(p) - } - return MotionEvent{ - DeviceID: int32(c.deviceId), - Source: int32(c.source), - Action: int32(c.action), - ActionButton: int32(c.actionButton), - Flags: int32(c.flags), - MetaState: int32(c.metaState), - EdgeFlags: int32(c.edgeFlags), - ButtonState: int32(c.buttonState), - Classification: int32(c.classification), - PrecisionX: float32(c.precisionX), - PrecisionY: float32(c.precisionY), - DownTime: int64(c.downTime), - EventTime: int64(c.eventTime), - Pointers: pointers, - } -} diff --git a/gameactivity/pointer_axes.go b/gameactivity/pointer_axes.go deleted file mode 100644 index a27b3e2..0000000 --- a/gameactivity/pointer_axes.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build ignore - -package gameactivity - -/* -#include "include/game-activity/GameActivity.h" -*/ -import "C" - -const ( - // PointerAxisCount is the number of axis values per pointer. - PointerAxisCount = C.GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT -) - -// PointerAxes describes a single pointer within a MotionEvent. -type PointerAxes struct { - // ID is the pointer identifier. - ID int32 - - // RawX is the raw X coordinate. - RawX float32 - - // RawY is the raw Y coordinate. - RawY float32 - - // AxisValues contains per-axis values; indexed by AMOTION_EVENT_AXIS_* constants. - AxisValues [PointerAxisCount]float32 -} - -// X returns the X coordinate of this pointer. -func (p *PointerAxes) X() float32 { - return p.AxisValues[0] // AMOTION_EVENT_AXIS_X -} - -// Y returns the Y coordinate of this pointer. -func (p *PointerAxes) Y() float32 { - return p.AxisValues[1] // AMOTION_EVENT_AXIS_Y -} - -// pointerAxesFromC converts a C GameActivityPointerAxes to a Go PointerAxes. -func pointerAxesFromC(c *C.GameActivityPointerAxes) PointerAxes { - var axes [PointerAxisCount]float32 - for i := range PointerAxisCount { - axes[i] = float32(c.axisValues[i]) - } - return PointerAxes{ - ID: int32(c.id), - RawX: float32(c.rawX), - RawY: float32(c.rawY), - AxisValues: axes, - } -} diff --git a/gameactivity/text_input_state.go b/gameactivity/text_input_state.go deleted file mode 100644 index 750ad6d..0000000 --- a/gameactivity/text_input_state.go +++ /dev/null @@ -1,21 +0,0 @@ -//go:build ignore - -package gameactivity - -// TextInputState represents the state of a text input field. -type TextInputState struct { - // Text is the current text content (UTF-8). - Text string - - // SelectionStart is the start offset of the text selection. - SelectionStart int32 - - // SelectionEnd is the end offset of the text selection. - SelectionEnd int32 - - // ComposingStart is the start offset of the composing region (IME). - ComposingStart int32 - - // ComposingEnd is the end offset of the composing region (IME). - ComposingEnd int32 -} diff --git a/gles2/bitfield.go b/gles2/bitfield.go deleted file mode 100644 index 240d4a5..0000000 --- a/gles2/bitfield.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type Bitfield = capi.GLbitfield diff --git a/gles2/boolean.go b/gles2/boolean.go deleted file mode 100644 index 8c84574..0000000 --- a/gles2/boolean.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type Boolean = capi.GLboolean diff --git a/gles2/constants.go b/gles2/constants.go deleted file mode 100644 index 5c4cb0f..0000000 --- a/gles2/constants.go +++ /dev/null @@ -1,1454 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -const ( - GL_3DC_XY_AMD = 34810 - GL_3DC_X_AMD = 34809 - GL_ACCUM_ADJACENT_PAIRS_NV = 37037 - GL_ACTIVE_ATTRIBUTES = 35721 - GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 35722 - GL_ACTIVE_PROGRAM_EXT = 33369 - GL_ACTIVE_TEXTURE = 34016 - GL_ACTIVE_UNIFORMS = 35718 - GL_ACTIVE_UNIFORM_MAX_LENGTH = 35719 - GL_ADJACENT_PAIRS_NV = 37038 - GL_AFFINE_2D_NV = 37010 - GL_AFFINE_3D_NV = 37012 - GL_ALIASED_LINE_WIDTH_RANGE = 33902 - GL_ALIASED_POINT_SIZE_RANGE = 33901 - GL_ALL_COMPLETED_NV = 34034 - GL_ALL_SHADER_BITS_EXT = 4294967295 - GL_ALPHA = 6406 - GL_ALPHA16F_EXT = 34844 - GL_ALPHA32F_EXT = 34838 - GL_ALPHA8_EXT = 32828 - GL_ALPHA8_OES = 32828 - GL_ALPHA_BITS = 3413 - GL_ALPHA_TEST_FUNC_QCOM = 3009 - GL_ALPHA_TEST_QCOM = 3008 - GL_ALPHA_TEST_REF_QCOM = 3010 - GL_ALREADY_SIGNALED_APPLE = 37146 - GL_ALWAYS = 519 - GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT = 36202 - GL_ANY_SAMPLES_PASSED_EXT = 35887 - GL_ARC_TO_NV = 254 - GL_ARRAY_BUFFER_BINDING = 34964 - GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = 35987 - GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = 34798 - GL_ATC_RGB_AMD = 35986 - GL_ATTACHED_SHADERS = 35717 - GL_BACK = 1029 - GL_BEVEL_NV = 37030 - GL_BGRA8_EXT = 37793 - GL_BGRA_EXT = 32993 - GL_BGRA_IMG = 32993 - GL_BINNING_CONTROL_HINT_QCOM = 36784 - GL_BLACKHOLE_RENDER_INTEL = 33788 - GL_BLEND_ADVANCED_COHERENT_KHR = 37509 - GL_BLEND_ADVANCED_COHERENT_NV = 37509 - GL_BLEND_COLOR = 32773 - GL_BLEND_DST_ALPHA = 32970 - GL_BLEND_DST_RGB = 32968 - GL_BLEND_EQUATION = 32777 - GL_BLEND_EQUATION_ALPHA = 34877 - GL_BLEND_EQUATION_RGB = 32777 - GL_BLEND_OVERLAP_NV = 37505 - GL_BLEND_PREMULTIPLIED_SRC_NV = 37504 - GL_BLEND_SRC_ALPHA = 32971 - GL_BLEND_SRC_RGB = 32969 - GL_BLUE_BITS = 3412 - GL_BLUE_NV = 6405 - GL_BOLD_BIT_NV = 1 - GL_BOOL = 35670 - GL_BOOL_VEC2 = 35671 - GL_BOOL_VEC3 = 35672 - GL_BOOL_VEC4 = 35673 - GL_BOUNDING_BOX_NV = 37005 - GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV = 37020 - GL_BUFFER_ACCESS_OES = 35003 - GL_BUFFER_IMMUTABLE_STORAGE_EXT = 33311 - GL_BUFFER_KHR = 33504 - GL_BUFFER_MAPPED_OES = 35004 - GL_BUFFER_MAP_POINTER_OES = 35005 - GL_BUFFER_OBJECT_EXT = 37201 - GL_BUFFER_SIZE = 34660 - GL_BUFFER_STORAGE_FLAGS_EXT = 33312 - GL_BUFFER_USAGE = 34661 - GL_BYTE = 5120 - GL_CCW = 2305 - GL_CIRCULAR_CCW_ARC_TO_NV = 248 - GL_CIRCULAR_CW_ARC_TO_NV = 250 - GL_CIRCULAR_TANGENT_ARC_TO_NV = 252 - GL_CLAMP_TO_BORDER_EXT = 33069 - GL_CLAMP_TO_BORDER_NV = 33069 - GL_CLAMP_TO_BORDER_OES = 33069 - GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT = 16384 - GL_CLIENT_STORAGE_BIT_EXT = 512 - GL_CLIP_DEPTH_MODE_EXT = 37725 - GL_CLIP_DISTANCE0_APPLE = 12288 - GL_CLIP_DISTANCE0_EXT = 12288 - GL_CLIP_DISTANCE1_APPLE = 12289 - GL_CLIP_DISTANCE1_EXT = 12289 - GL_CLIP_DISTANCE2_APPLE = 12290 - GL_CLIP_DISTANCE2_EXT = 12290 - GL_CLIP_DISTANCE3_APPLE = 12291 - GL_CLIP_DISTANCE3_EXT = 12291 - GL_CLIP_DISTANCE4_APPLE = 12292 - GL_CLIP_DISTANCE4_EXT = 12292 - GL_CLIP_DISTANCE5_APPLE = 12293 - GL_CLIP_DISTANCE5_EXT = 12293 - GL_CLIP_DISTANCE6_APPLE = 12294 - GL_CLIP_DISTANCE6_EXT = 12294 - GL_CLIP_DISTANCE7_APPLE = 12295 - GL_CLIP_DISTANCE7_EXT = 12295 - GL_CLIP_ORIGIN_EXT = 37724 - GL_CLOSE_PATH_NV = 0 - GL_COLORBURN_KHR = 37530 - GL_COLORBURN_NV = 37530 - GL_COLORDODGE_KHR = 37529 - GL_COLORDODGE_NV = 37529 - GL_COLOR_ATTACHMENT0_EXT = 36064 - GL_COLOR_ATTACHMENT0_NV = 36064 - GL_COLOR_ATTACHMENT10_EXT = 36074 - GL_COLOR_ATTACHMENT10_NV = 36074 - GL_COLOR_ATTACHMENT11_EXT = 36075 - GL_COLOR_ATTACHMENT11_NV = 36075 - GL_COLOR_ATTACHMENT12_EXT = 36076 - GL_COLOR_ATTACHMENT12_NV = 36076 - GL_COLOR_ATTACHMENT13_EXT = 36077 - GL_COLOR_ATTACHMENT13_NV = 36077 - GL_COLOR_ATTACHMENT14_EXT = 36078 - GL_COLOR_ATTACHMENT14_NV = 36078 - GL_COLOR_ATTACHMENT15_EXT = 36079 - GL_COLOR_ATTACHMENT15_NV = 36079 - GL_COLOR_ATTACHMENT1_EXT = 36065 - GL_COLOR_ATTACHMENT1_NV = 36065 - GL_COLOR_ATTACHMENT2_EXT = 36066 - GL_COLOR_ATTACHMENT2_NV = 36066 - GL_COLOR_ATTACHMENT3_EXT = 36067 - GL_COLOR_ATTACHMENT3_NV = 36067 - GL_COLOR_ATTACHMENT4_EXT = 36068 - GL_COLOR_ATTACHMENT4_NV = 36068 - GL_COLOR_ATTACHMENT5_EXT = 36069 - GL_COLOR_ATTACHMENT5_NV = 36069 - GL_COLOR_ATTACHMENT6_EXT = 36070 - GL_COLOR_ATTACHMENT6_NV = 36070 - GL_COLOR_ATTACHMENT7_EXT = 36071 - GL_COLOR_ATTACHMENT7_NV = 36071 - GL_COLOR_ATTACHMENT8_EXT = 36072 - GL_COLOR_ATTACHMENT8_NV = 36072 - GL_COLOR_ATTACHMENT9_EXT = 36073 - GL_COLOR_ATTACHMENT9_NV = 36073 - GL_COLOR_ATTACHMENT_EXT = 37104 - GL_COLOR_BUFFER_BIT0_QCOM = 1 - GL_COLOR_BUFFER_BIT1_QCOM = 2 - GL_COLOR_BUFFER_BIT2_QCOM = 4 - GL_COLOR_BUFFER_BIT3_QCOM = 8 - GL_COLOR_BUFFER_BIT4_QCOM = 16 - GL_COLOR_BUFFER_BIT5_QCOM = 32 - GL_COLOR_BUFFER_BIT6_QCOM = 64 - GL_COLOR_BUFFER_BIT7_QCOM = 128 - GL_COLOR_CLEAR_VALUE = 3106 - GL_COLOR_EXT = 6144 - GL_COLOR_SAMPLES_NV = 36384 - GL_COLOR_WRITEMASK = 3107 - GL_COMPARE_REF_TO_TEXTURE_EXT = 34894 - GL_COMPLETION_STATUS_KHR = 37297 - GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285 - GL_COMPRESSED_RED_RGTC1_EXT = 36283 - GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492 - GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843 - GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG = 37175 - GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842 - GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG = 37176 - GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777 - GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE = 33778 - GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778 - GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE = 33779 - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779 - GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 36494 - GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 36495 - GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841 - GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840 - GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776 - GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 36286 - GL_COMPRESSED_SIGNED_RED_RGTC1_EXT = 36284 - GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 36493 - GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT = 35414 - GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG = 37872 - GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT = 35415 - GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG = 37873 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV = 35917 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV = 35918 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV = 35919 - GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT = 35412 - GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT = 35413 - GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916 - GL_COMPRESSED_SRGB_S3TC_DXT1_NV = 35916 - GL_COMPRESSED_TEXTURE_FORMATS = 34467 - GL_CONDITION_SATISFIED_APPLE = 37148 - GL_CONFORMANT_NV = 37748 - GL_CONIC_CURVE_TO_NV = 26 - GL_CONJOINT_NV = 37508 - GL_CONSERVATIVE_RASTERIZATION_INTEL = 33790 - GL_CONSERVATIVE_RASTERIZATION_NV = 37702 - GL_CONSERVATIVE_RASTER_MODE_NV = 38221 - GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV = 38222 - GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV = 38224 - GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV = 38223 - GL_CONSTANT_ALPHA = 32771 - GL_CONSTANT_COLOR = 32769 - GL_CONTEXT_FLAG_DEBUG_BIT_KHR = 2 - GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR = 8 - GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT = 16 - GL_CONTEXT_LOST_KHR = 1287 - GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR = 33532 - GL_CONTEXT_RELEASE_BEHAVIOR_KHR = 33531 - GL_CONTEXT_ROBUST_ACCESS_EXT = 37107 - GL_CONTEXT_ROBUST_ACCESS_KHR = 37107 - GL_CONTRAST_NV = 37537 - GL_CONVEX_HULL_NV = 37003 - GL_COPY_READ_BUFFER_NV = 36662 - GL_COPY_WRITE_BUFFER_NV = 36663 - GL_COUNTER_RANGE_AMD = 35777 - GL_COUNTER_TYPE_AMD = 35776 - GL_COUNT_DOWN_NV = 37001 - GL_COUNT_UP_NV = 37000 - GL_COVERAGE_ALL_FRAGMENTS_NV = 36565 - GL_COVERAGE_ATTACHMENT_NV = 36562 - GL_COVERAGE_AUTOMATIC_NV = 36567 - GL_COVERAGE_BUFFERS_NV = 36563 - GL_COVERAGE_BUFFER_BIT_NV = 32768 - GL_COVERAGE_COMPONENT4_NV = 36561 - GL_COVERAGE_COMPONENT_NV = 36560 - GL_COVERAGE_EDGE_FRAGMENTS_NV = 36566 - GL_COVERAGE_MODULATION_NV = 37682 - GL_COVERAGE_MODULATION_TABLE_NV = 37681 - GL_COVERAGE_MODULATION_TABLE_SIZE_NV = 37683 - GL_COVERAGE_SAMPLES_NV = 36564 - GL_CPU_OPTIMIZED_QCOM = 36785 - GL_CUBIC_CURVE_TO_NV = 12 - GL_CUBIC_IMG = 37177 - GL_CUBIC_MIPMAP_LINEAR_IMG = 37179 - GL_CUBIC_MIPMAP_NEAREST_IMG = 37178 - GL_CULL_FACE = 2884 - GL_CULL_FACE_MODE = 2885 - GL_CURRENT_PROGRAM = 35725 - GL_CURRENT_QUERY_EXT = 34917 - GL_CURRENT_VERTEX_ATTRIB = 34342 - GL_CW = 2304 - GL_D3D12_FENCE_VALUE_EXT = 38293 - GL_DARKEN_KHR = 37527 - GL_DARKEN_NV = 37527 - GL_DEBUG_CALLBACK_FUNCTION_KHR = 33348 - GL_DEBUG_CALLBACK_USER_PARAM_KHR = 33349 - GL_DEBUG_GROUP_STACK_DEPTH_KHR = 33389 - GL_DEBUG_LOGGED_MESSAGES_KHR = 37189 - GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR = 33347 - GL_DEBUG_OUTPUT_KHR = 37600 - GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR = 33346 - GL_DEBUG_SEVERITY_HIGH_KHR = 37190 - GL_DEBUG_SEVERITY_LOW_KHR = 37192 - GL_DEBUG_SEVERITY_MEDIUM_KHR = 37191 - GL_DEBUG_SEVERITY_NOTIFICATION_KHR = 33387 - GL_DEBUG_SOURCE_API_KHR = 33350 - GL_DEBUG_SOURCE_APPLICATION_KHR = 33354 - GL_DEBUG_SOURCE_OTHER_KHR = 33355 - GL_DEBUG_SOURCE_SHADER_COMPILER_KHR = 33352 - GL_DEBUG_SOURCE_THIRD_PARTY_KHR = 33353 - GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR = 33351 - GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR = 33357 - GL_DEBUG_TYPE_ERROR_KHR = 33356 - GL_DEBUG_TYPE_MARKER_KHR = 33384 - GL_DEBUG_TYPE_OTHER_KHR = 33361 - GL_DEBUG_TYPE_PERFORMANCE_KHR = 33360 - GL_DEBUG_TYPE_POP_GROUP_KHR = 33386 - GL_DEBUG_TYPE_PORTABILITY_KHR = 33359 - GL_DEBUG_TYPE_PUSH_GROUP_KHR = 33385 - GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR = 33358 - GL_DECODE_EXT = 35401 - GL_DECR = 7683 - GL_DECR_WRAP = 34056 - GL_DEDICATED_MEMORY_OBJECT_EXT = 38273 - GL_DELETE_STATUS = 35712 - GL_DEPTH24_STENCIL8_OES = 35056 - GL_DEPTH_BITS = 3414 - GL_DEPTH_BUFFER_BIT0_QCOM = 256 - GL_DEPTH_BUFFER_BIT1_QCOM = 512 - GL_DEPTH_BUFFER_BIT2_QCOM = 1024 - GL_DEPTH_BUFFER_BIT3_QCOM = 2048 - GL_DEPTH_BUFFER_BIT4_QCOM = 4096 - GL_DEPTH_BUFFER_BIT5_QCOM = 8192 - GL_DEPTH_BUFFER_BIT6_QCOM = 16384 - GL_DEPTH_BUFFER_BIT7_QCOM = 32768 - GL_DEPTH_CLEAR_VALUE = 2931 - GL_DEPTH_COMPONENT = 6402 - GL_DEPTH_COMPONENT16_NONLINEAR_NV = 36396 - GL_DEPTH_COMPONENT16_OES = 33189 - GL_DEPTH_COMPONENT24_OES = 33190 - GL_DEPTH_COMPONENT32_OES = 33191 - GL_DEPTH_EXT = 6145 - GL_DEPTH_FUNC = 2932 - GL_DEPTH_RANGE = 2928 - GL_DEPTH_SAMPLES_NV = 37677 - GL_DEPTH_STENCIL_OES = 34041 - GL_DEPTH_WRITEMASK = 2930 - GL_DEVICE_LUID_EXT = 38297 - GL_DEVICE_NODE_MASK_EXT = 38298 - GL_DEVICE_UUID_EXT = 38295 - GL_DIFFERENCE_KHR = 37534 - GL_DIFFERENCE_NV = 37534 - GL_DISJOINT_NV = 37507 - GL_DITHER = 3024 - GL_DMP_PROGRAM_BINARY_DMP = 37459 - GL_DONT_CARE = 4352 - GL_DOWNSAMPLE_SCALES_IMG = 37182 - GL_DRAW_BUFFER0_EXT = 34853 - GL_DRAW_BUFFER0_NV = 34853 - GL_DRAW_BUFFER10_EXT = 34863 - GL_DRAW_BUFFER10_NV = 34863 - GL_DRAW_BUFFER11_EXT = 34864 - GL_DRAW_BUFFER11_NV = 34864 - GL_DRAW_BUFFER12_EXT = 34865 - GL_DRAW_BUFFER12_NV = 34865 - GL_DRAW_BUFFER13_EXT = 34866 - GL_DRAW_BUFFER13_NV = 34866 - GL_DRAW_BUFFER14_EXT = 34867 - GL_DRAW_BUFFER14_NV = 34867 - GL_DRAW_BUFFER15_EXT = 34868 - GL_DRAW_BUFFER15_NV = 34868 - GL_DRAW_BUFFER1_EXT = 34854 - GL_DRAW_BUFFER1_NV = 34854 - GL_DRAW_BUFFER2_EXT = 34855 - GL_DRAW_BUFFER2_NV = 34855 - GL_DRAW_BUFFER3_EXT = 34856 - GL_DRAW_BUFFER3_NV = 34856 - GL_DRAW_BUFFER4_EXT = 34857 - GL_DRAW_BUFFER4_NV = 34857 - GL_DRAW_BUFFER5_EXT = 34858 - GL_DRAW_BUFFER5_NV = 34858 - GL_DRAW_BUFFER6_EXT = 34859 - GL_DRAW_BUFFER6_NV = 34859 - GL_DRAW_BUFFER7_EXT = 34860 - GL_DRAW_BUFFER7_NV = 34860 - GL_DRAW_BUFFER8_EXT = 34861 - GL_DRAW_BUFFER8_NV = 34861 - GL_DRAW_BUFFER9_EXT = 34862 - GL_DRAW_BUFFER9_NV = 34862 - GL_DRAW_BUFFER_EXT = 3073 - GL_DRAW_FRAMEBUFFER_ANGLE = 36009 - GL_DRAW_FRAMEBUFFER_APPLE = 36009 - GL_DRAW_FRAMEBUFFER_BINDING_ANGLE = 36006 - GL_DRAW_FRAMEBUFFER_BINDING_APPLE = 36006 - GL_DRAW_FRAMEBUFFER_BINDING_NV = 36006 - GL_DRAW_FRAMEBUFFER_NV = 36009 - GL_DRIVER_UUID_EXT = 38296 - GL_DST_ALPHA = 772 - GL_DST_ATOP_NV = 37519 - GL_DST_COLOR = 774 - GL_DST_IN_NV = 37515 - GL_DST_NV = 37511 - GL_DST_OUT_NV = 37517 - GL_DST_OVER_NV = 37513 - GL_DUP_FIRST_CUBIC_CURVE_TO_NV = 242 - GL_DUP_LAST_CUBIC_CURVE_TO_NV = 244 - GL_DYNAMIC_STORAGE_BIT_EXT = 256 - GL_EFFECTIVE_RASTER_SAMPLES_EXT = 37676 - GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965 - GL_EQUAL = 514 - GL_ETC1_RGB8_OES = 36196 - GL_ETC1_SRGB8_NV = 35054 - GL_EXCLUSION_KHR = 37536 - GL_EXCLUSION_NV = 37536 - GL_EXCLUSIVE_EXT = 36625 - GL_EXTENSIONS = 7939 - GL_FACTOR_MAX_AMD = 36893 - GL_FACTOR_MIN_AMD = 36892 - GL_FASTEST = 4353 - GL_FENCE_CONDITION_NV = 34036 - GL_FENCE_STATUS_NV = 34035 - GL_FETCH_PER_SAMPLE_ARM = 36709 - GL_FILE_NAME_NV = 36980 - GL_FILL_NV = 6914 - GL_FILL_RECTANGLE_NV = 37692 - GL_FIRST_TO_REST_NV = 37039 - GL_FIRST_VERTEX_CONVENTION_EXT = 36429 - GL_FIRST_VERTEX_CONVENTION_OES = 36429 - GL_FIXED = 5132 - GL_FLOAT16_NV = 36856 - GL_FLOAT16_VEC2_NV = 36857 - GL_FLOAT16_VEC3_NV = 36858 - GL_FLOAT16_VEC4_NV = 36859 - GL_FLOAT_MAT2 = 35674 - GL_FLOAT_MAT3 = 35675 - GL_FLOAT_MAT4 = 35676 - GL_FLOAT_VEC2 = 35664 - GL_FLOAT_VEC3 = 35665 - GL_FLOAT_VEC4 = 35666 - GL_FONT_ASCENDER_BIT_NV = 2097152 - GL_FONT_DESCENDER_BIT_NV = 4194304 - GL_FONT_GLYPHS_AVAILABLE_NV = 37736 - GL_FONT_HAS_KERNING_BIT_NV = 268435456 - GL_FONT_HEIGHT_BIT_NV = 8388608 - GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV = 33554432 - GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV = 16777216 - GL_FONT_NUM_GLYPH_INDICES_BIT_NV = 536870912 - GL_FONT_TARGET_UNAVAILABLE_NV = 37737 - GL_FONT_UNAVAILABLE_NV = 37738 - GL_FONT_UNDERLINE_POSITION_BIT_NV = 67108864 - GL_FONT_UNDERLINE_THICKNESS_BIT_NV = 134217728 - GL_FONT_UNINTELLIGIBLE_NV = 37739 - GL_FONT_UNITS_PER_EM_BIT_NV = 1048576 - GL_FONT_X_MAX_BOUNDS_BIT_NV = 262144 - GL_FONT_X_MIN_BOUNDS_BIT_NV = 65536 - GL_FONT_Y_MAX_BOUNDS_BIT_NV = 524288 - GL_FONT_Y_MIN_BOUNDS_BIT_NV = 131072 - GL_FOVEATION_ENABLE_BIT_QCOM = 1 - GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM = 2 - GL_FRACTIONAL_EVEN_EXT = 36476 - GL_FRACTIONAL_EVEN_OES = 36476 - GL_FRACTIONAL_ODD_EXT = 36475 - GL_FRACTIONAL_ODD_OES = 36475 - GL_FRAGMENT_COVERAGE_COLOR_NV = 37598 - GL_FRAGMENT_COVERAGE_TO_COLOR_NV = 37597 - GL_FRAGMENT_INPUT_NV = 37741 - GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES = 36445 - GL_FRAGMENT_SHADER_BIT_EXT = 2 - GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 35723 - GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT = 35410 - GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM = 36710 - GL_FRAMEBUFFER_ATTACHMENT_ANGLE = 37795 - GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 33296 - GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 33297 - GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = 36263 - GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES = 36263 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = 36052 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR = 38450 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR = 38448 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT = 36204 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG = 37183 - GL_FRAMEBUFFER_BINDING = 36006 - GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT = 37650 - GL_FRAMEBUFFER_DEFAULT_LAYERS_OES = 37650 - GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM = 38562 - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054 - GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057 - GL_FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM = 35839 - GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT = 38482 - GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = 36264 - GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES = 36264 - GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG = 37180 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE = 36182 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE = 36182 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 36182 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG = 37172 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV = 36182 - GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR = 38451 - GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV = 37698 - GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV = 37699 - GL_FRAMEBUFFER_SRGB_EXT = 36281 - GL_FRAMEBUFFER_UNDEFINED_OES = 33305 - GL_FRAMEBUFFER_UNSUPPORTED = 36061 - GL_FRONT = 1028 - GL_FRONT_AND_BACK = 1032 - GL_FRONT_FACE = 2886 - GL_FUNC_ADD = 32774 - GL_FUNC_REVERSE_SUBTRACT = 32779 - GL_FUNC_SUBTRACT = 32778 - GL_GCCSO_SHADER_BINARY_FJ = 37472 - GL_GENERATE_MIPMAP_HINT = 33170 - GL_GEOMETRY_LINKED_INPUT_TYPE_EXT = 35095 - GL_GEOMETRY_LINKED_INPUT_TYPE_OES = 35095 - GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT = 35096 - GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES = 35096 - GL_GEOMETRY_LINKED_VERTICES_OUT_EXT = 35094 - GL_GEOMETRY_LINKED_VERTICES_OUT_OES = 35094 - GL_GEOMETRY_SHADER_BIT_EXT = 4 - GL_GEOMETRY_SHADER_BIT_OES = 4 - GL_GEOMETRY_SHADER_EXT = 36313 - GL_GEOMETRY_SHADER_INVOCATIONS_EXT = 34943 - GL_GEOMETRY_SHADER_INVOCATIONS_OES = 34943 - GL_GEOMETRY_SHADER_OES = 36313 - GL_GEQUAL = 518 - GL_GLYPH_HAS_KERNING_BIT_NV = 256 - GL_GLYPH_HEIGHT_BIT_NV = 2 - GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV = 16 - GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV = 4 - GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV = 8 - GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV = 128 - GL_GLYPH_VERTICAL_BEARING_X_BIT_NV = 32 - GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV = 64 - GL_GLYPH_WIDTH_BIT_NV = 1 - GL_GPU_DISJOINT_EXT = 36795 - GL_GPU_OPTIMIZED_QCOM = 36786 - GL_GREATER = 516 - GL_GREEN_BITS = 3411 - GL_GREEN_NV = 6404 - GL_GUILTY_CONTEXT_RESET_EXT = 33363 - GL_GUILTY_CONTEXT_RESET_KHR = 33363 - GL_HALF_FLOAT_OES = 36193 - GL_HANDLE_TYPE_D3D11_IMAGE_EXT = 38283 - GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT = 38284 - GL_HANDLE_TYPE_D3D12_FENCE_EXT = 38292 - GL_HANDLE_TYPE_D3D12_RESOURCE_EXT = 38282 - GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT = 38281 - GL_HANDLE_TYPE_OPAQUE_FD_EXT = 38278 - GL_HANDLE_TYPE_OPAQUE_WIN32_EXT = 38279 - GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT = 38280 - GL_HARDLIGHT_KHR = 37531 - GL_HARDLIGHT_NV = 37531 - GL_HARDMIX_NV = 37545 - GL_HIGH_FLOAT = 36338 - GL_HIGH_INT = 36341 - GL_HORIZONTAL_LINE_TO_NV = 6 - GL_HSL_COLOR_KHR = 37551 - GL_HSL_COLOR_NV = 37551 - GL_HSL_HUE_KHR = 37549 - GL_HSL_HUE_NV = 37549 - GL_HSL_LUMINOSITY_KHR = 37552 - GL_HSL_LUMINOSITY_NV = 37552 - GL_HSL_SATURATION_KHR = 37550 - GL_HSL_SATURATION_NV = 37550 - GL_IMAGE_BUFFER_EXT = 36945 - GL_IMAGE_BUFFER_OES = 36945 - GL_IMAGE_CUBE_MAP_ARRAY_EXT = 36948 - GL_IMAGE_CUBE_MAP_ARRAY_OES = 36948 - GL_IMPLEMENTATION_COLOR_READ_FORMAT = 35739 - GL_IMPLEMENTATION_COLOR_READ_TYPE = 35738 - GL_INCLUSIVE_EXT = 36624 - GL_INCR = 7682 - GL_INCR_WRAP = 34055 - GL_INFO_LOG_LENGTH = 35716 - GL_INNOCENT_CONTEXT_RESET_EXT = 33364 - GL_INNOCENT_CONTEXT_RESET_KHR = 33364 - GL_INT = 5124 - GL_INT16_NV = 36836 - GL_INT16_VEC2_NV = 36837 - GL_INT16_VEC3_NV = 36838 - GL_INT16_VEC4_NV = 36839 - GL_INT64_NV = 5134 - GL_INT64_VEC2_NV = 36841 - GL_INT64_VEC3_NV = 36842 - GL_INT64_VEC4_NV = 36843 - GL_INT8_NV = 36832 - GL_INT8_VEC2_NV = 36833 - GL_INT8_VEC3_NV = 36834 - GL_INT8_VEC4_NV = 36835 - GL_INT_10_10_10_2_OES = 36343 - GL_INT_IMAGE_BUFFER_EXT = 36956 - GL_INT_IMAGE_BUFFER_OES = 36956 - GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 36959 - GL_INT_IMAGE_CUBE_MAP_ARRAY_OES = 36959 - GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 37132 - GL_INT_SAMPLER_BUFFER_EXT = 36304 - GL_INT_SAMPLER_BUFFER_OES = 36304 - GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT = 36878 - GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES = 36878 - GL_INT_VEC2 = 35667 - GL_INT_VEC3 = 35668 - GL_INT_VEC4 = 35669 - GL_INVALID_ENUM = 1280 - GL_INVALID_FRAMEBUFFER_OPERATION = 1286 - GL_INVALID_OPERATION = 1282 - GL_INVALID_VALUE = 1281 - GL_INVERT = 5386 - GL_INVERT_OVG_NV = 37556 - GL_INVERT_RGB_NV = 37539 - GL_ISOLINES_EXT = 36474 - GL_ISOLINES_OES = 36474 - GL_IS_PER_PATCH_EXT = 37607 - GL_IS_PER_PATCH_OES = 37607 - GL_ITALIC_BIT_NV = 2 - GL_KEEP = 7680 - GL_LARGE_CCW_ARC_TO_NV = 22 - GL_LARGE_CW_ARC_TO_NV = 24 - GL_LAST_VERTEX_CONVENTION_EXT = 36430 - GL_LAST_VERTEX_CONVENTION_OES = 36430 - GL_LAYER_PROVOKING_VERTEX_EXT = 33374 - GL_LAYER_PROVOKING_VERTEX_OES = 33374 - GL_LAYOUT_COLOR_ATTACHMENT_EXT = 38286 - GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT = 38193 - GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT = 38192 - GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT = 38287 - GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT = 38288 - GL_LAYOUT_GENERAL_EXT = 38285 - GL_LAYOUT_SHADER_READ_ONLY_EXT = 38289 - GL_LAYOUT_TRANSFER_DST_EXT = 38291 - GL_LAYOUT_TRANSFER_SRC_EXT = 38290 - GL_LEQUAL = 515 - GL_LESS = 513 - GL_LIGHTEN_KHR = 37528 - GL_LIGHTEN_NV = 37528 - GL_LINEARBURN_NV = 37541 - GL_LINEARDODGE_NV = 37540 - GL_LINEARLIGHT_NV = 37543 - GL_LINEAR_MIPMAP_LINEAR = 9987 - GL_LINEAR_MIPMAP_NEAREST = 9985 - GL_LINEAR_TILING_EXT = 38277 - GL_LINES = 1 - GL_LINES_ADJACENCY_EXT = 10 - GL_LINES_ADJACENCY_OES = 10 - GL_LINE_LOOP = 2 - GL_LINE_NV = 6913 - GL_LINE_STRIP = 3 - GL_LINE_STRIP_ADJACENCY_EXT = 11 - GL_LINE_STRIP_ADJACENCY_OES = 11 - GL_LINE_TO_NV = 4 - GL_LINE_WIDTH = 2849 - GL_LOCATION_INDEX_EXT = 37647 - GL_LOSE_CONTEXT_ON_RESET_EXT = 33362 - GL_LOSE_CONTEXT_ON_RESET_KHR = 33362 - GL_LOWER_LEFT_EXT = 36001 - GL_LOW_FLOAT = 36336 - GL_LOW_INT = 36339 - GL_LUID_SIZE_EXT = 8 - GL_LUMINANCE = 6409 - GL_LUMINANCE16F_EXT = 34846 - GL_LUMINANCE32F_EXT = 34840 - GL_LUMINANCE4_ALPHA4_OES = 32835 - GL_LUMINANCE8_ALPHA8_EXT = 32837 - GL_LUMINANCE8_ALPHA8_OES = 32837 - GL_LUMINANCE8_EXT = 32832 - GL_LUMINANCE8_OES = 32832 - GL_LUMINANCE_ALPHA = 6410 - GL_LUMINANCE_ALPHA16F_EXT = 34847 - GL_LUMINANCE_ALPHA32F_EXT = 34841 - GL_MALI_PROGRAM_BINARY_ARM = 36705 - GL_MALI_SHADER_BINARY_ARM = 36704 - GL_MAP_COHERENT_BIT_EXT = 128 - GL_MAP_FLUSH_EXPLICIT_BIT_EXT = 16 - GL_MAP_INVALIDATE_BUFFER_BIT_EXT = 8 - GL_MAP_INVALIDATE_RANGE_BIT_EXT = 4 - GL_MAP_PERSISTENT_BIT_EXT = 64 - GL_MAP_READ_BIT = 1 - GL_MAP_READ_BIT_EXT = 1 - GL_MAP_UNSYNCHRONIZED_BIT_EXT = 32 - GL_MAP_WRITE_BIT = 2 - GL_MAP_WRITE_BIT_EXT = 2 - GL_MAX = 32776 - GL_MAX_3D_TEXTURE_SIZE_OES = 32883 - GL_MAX_CLIP_DISTANCES_APPLE = 3378 - GL_MAX_CLIP_DISTANCES_EXT = 3378 - GL_MAX_COLOR_ATTACHMENTS_EXT = 36063 - GL_MAX_COLOR_ATTACHMENTS_NV = 36063 - GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT = 33530 - GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT = 35378 - GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES = 35378 - GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT = 36382 - GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES = 36382 - GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT = 36383 - GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES = 36383 - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661 - GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076 - GL_MAX_CULL_DISTANCES_EXT = 33529 - GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR = 33388 - GL_MAX_DEBUG_LOGGED_MESSAGES_KHR = 37188 - GL_MAX_DEBUG_MESSAGE_LENGTH_KHR = 37187 - GL_MAX_DRAW_BUFFERS_EXT = 34852 - GL_MAX_DRAW_BUFFERS_NV = 34852 - GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT = 35068 - GL_MAX_EXT = 32776 - GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES = 36444 - GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349 - GL_MAX_FRAMEBUFFER_LAYERS_EXT = 37655 - GL_MAX_FRAMEBUFFER_LAYERS_OES = 37655 - GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT = 37589 - GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES = 37589 - GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT = 37583 - GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES = 37583 - GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT = 37069 - GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES = 37069 - GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT = 37155 - GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES = 37155 - GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT = 37156 - GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES = 37156 - GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT = 36320 - GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES = 36320 - GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT = 36442 - GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES = 36442 - GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT = 37079 - GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES = 37079 - GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = 35881 - GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES = 35881 - GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT = 36321 - GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES = 36321 - GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT = 35372 - GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES = 35372 - GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT = 36319 - GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES = 36319 - GL_MAX_LABEL_LENGTH_KHR = 33512 - GL_MAX_MULTIVIEW_BUFFERS_EXT = 37106 - GL_MAX_PATCH_VERTICES_EXT = 36477 - GL_MAX_PATCH_VERTICES_OES = 36477 - GL_MAX_RASTER_SAMPLES_EXT = 37673 - GL_MAX_RENDERBUFFER_SIZE = 34024 - GL_MAX_SAMPLES_ANGLE = 36183 - GL_MAX_SAMPLES_APPLE = 36183 - GL_MAX_SAMPLES_EXT = 36183 - GL_MAX_SAMPLES_IMG = 37173 - GL_MAX_SAMPLES_NV = 36183 - GL_MAX_SERVER_WAIT_TIMEOUT_APPLE = 37137 - GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT = 38480 - GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT = 38481 - GL_MAX_SHADER_COMPILER_THREADS_KHR = 37296 - GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT = 36707 - GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT = 36711 - GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT = 37273 - GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT = 37274 - GL_MAX_SPARSE_TEXTURE_SIZE_EXT = 37272 - GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV = 37705 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT = 37587 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES = 37587 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT = 37581 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES = 37581 - GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT = 37067 - GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES = 37067 - GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT = 34924 - GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES = 34924 - GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT = 36483 - GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES = 36483 - GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT = 37080 - GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES = 37080 - GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT = 36481 - GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES = 36481 - GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT = 36485 - GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES = 36485 - GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT = 36489 - GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES = 36489 - GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT = 36479 - GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES = 36479 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT = 37588 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES = 37588 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT = 37582 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES = 37582 - GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT = 37068 - GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES = 37068 - GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT = 34925 - GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES = 34925 - GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT = 36486 - GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES = 36486 - GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT = 37081 - GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES = 37081 - GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT = 36482 - GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES = 36482 - GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT = 36490 - GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES = 36490 - GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT = 36480 - GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES = 36480 - GL_MAX_TESS_GEN_LEVEL_EXT = 36478 - GL_MAX_TESS_GEN_LEVEL_OES = 36478 - GL_MAX_TESS_PATCH_COMPONENTS_EXT = 36484 - GL_MAX_TESS_PATCH_COMPONENTS_OES = 36484 - GL_MAX_TEXTURE_BUFFER_SIZE_EXT = 35883 - GL_MAX_TEXTURE_BUFFER_SIZE_OES = 35883 - GL_MAX_TEXTURE_IMAGE_UNITS = 34930 - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047 - GL_MAX_TEXTURE_SIZE = 3379 - GL_MAX_VARYING_VECTORS = 36348 - GL_MAX_VERTEX_ATTRIBS = 34921 - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660 - GL_MAX_VERTEX_UNIFORM_VECTORS = 36347 - GL_MAX_VIEWPORTS_NV = 33371 - GL_MAX_VIEWPORTS_OES = 33371 - GL_MAX_VIEWPORT_DIMS = 3386 - GL_MAX_VIEWS_OVR = 38449 - GL_MAX_WINDOW_RECTANGLES_EXT = 36628 - GL_MEDIUM_FLOAT = 36337 - GL_MEDIUM_INT = 36340 - GL_MIN = 32775 - GL_MINUS_CLAMPED_NV = 37555 - GL_MINUS_NV = 37535 - GL_MIN_EXT = 32775 - GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES = 36443 - GL_MIN_SAMPLE_SHADING_VALUE_OES = 35895 - GL_MIRRORED_REPEAT = 33648 - GL_MIRROR_CLAMP_TO_EDGE_EXT = 34627 - GL_MITER_REVERT_NV = 37031 - GL_MITER_TRUNCATE_NV = 37032 - GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV = 37679 - GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV = 37680 - GL_MOVE_TO_CONTINUES_NV = 37046 - GL_MOVE_TO_NV = 2 - GL_MOVE_TO_RESETS_NV = 37045 - GL_MULTIPLY_KHR = 37524 - GL_MULTIPLY_NV = 37524 - GL_MULTISAMPLES_NV = 37745 - GL_MULTISAMPLE_BUFFER_BIT0_QCOM = 16777216 - GL_MULTISAMPLE_BUFFER_BIT1_QCOM = 33554432 - GL_MULTISAMPLE_BUFFER_BIT2_QCOM = 67108864 - GL_MULTISAMPLE_BUFFER_BIT3_QCOM = 134217728 - GL_MULTISAMPLE_BUFFER_BIT4_QCOM = 268435456 - GL_MULTISAMPLE_BUFFER_BIT5_QCOM = 536870912 - GL_MULTISAMPLE_BUFFER_BIT6_QCOM = 1073741824 - GL_MULTISAMPLE_BUFFER_BIT7_QCOM = 2147483648 - GL_MULTISAMPLE_EXT = 32925 - GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT = 37675 - GL_MULTIVIEW_EXT = 37105 - GL_NEAREST_MIPMAP_LINEAR = 9986 - GL_NEAREST_MIPMAP_NEAREST = 9984 - GL_NEGATIVE_ONE_TO_ONE_EXT = 37726 - GL_NEVER = 512 - GL_NICEST = 4354 - GL_NONE = 0 - GL_NOTEQUAL = 517 - GL_NO_RESET_NOTIFICATION_EXT = 33377 - GL_NO_RESET_NOTIFICATION_KHR = 33377 - GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466 - GL_NUM_DEVICE_UUIDS_EXT = 38294 - GL_NUM_DOWNSAMPLE_SCALES_IMG = 37181 - GL_NUM_PROGRAM_BINARY_FORMATS_OES = 34814 - GL_NUM_SHADER_BINARY_FORMATS = 36345 - GL_NUM_SPARSE_LEVELS_EXT = 37290 - GL_NUM_TILING_TYPES_EXT = 38274 - GL_NUM_VIRTUAL_PAGE_SIZES_EXT = 37288 - GL_NUM_WINDOW_RECTANGLES_EXT = 36629 - GL_OBJECT_TYPE_APPLE = 37138 - GL_ONE = 1 - GL_ONE_MINUS_CONSTANT_ALPHA = 32772 - GL_ONE_MINUS_CONSTANT_COLOR = 32770 - GL_ONE_MINUS_DST_ALPHA = 773 - GL_ONE_MINUS_DST_COLOR = 775 - GL_ONE_MINUS_SRC1_ALPHA_EXT = 35067 - GL_ONE_MINUS_SRC1_COLOR_EXT = 35066 - GL_ONE_MINUS_SRC_COLOR = 769 - GL_OPTIMAL_TILING_EXT = 38276 - GL_OUT_OF_MEMORY = 1285 - GL_OVERLAY_KHR = 37526 - GL_OVERLAY_NV = 37526 - GL_PACK_ALIGNMENT = 3333 - GL_PACK_REVERSE_ROW_ORDER_ANGLE = 37796 - GL_PALETTE4_R5_G6_B5_OES = 35730 - GL_PALETTE4_RGB5_A1_OES = 35732 - GL_PALETTE4_RGB8_OES = 35728 - GL_PALETTE4_RGBA4_OES = 35731 - GL_PALETTE4_RGBA8_OES = 35729 - GL_PALETTE8_R5_G6_B5_OES = 35735 - GL_PALETTE8_RGB5_A1_OES = 35737 - GL_PALETTE8_RGB8_OES = 35733 - GL_PALETTE8_RGBA4_OES = 35736 - GL_PALETTE8_RGBA8_OES = 35734 - GL_PATCHES = 14 - GL_PATCHES_EXT = 14 - GL_PATCHES_OES = 14 - GL_PATCH_VERTICES_EXT = 36466 - GL_PATCH_VERTICES_OES = 36466 - GL_PATH_CLIENT_LENGTH_NV = 36991 - GL_PATH_COMMAND_COUNT_NV = 37021 - GL_PATH_COMPUTED_LENGTH_NV = 37024 - GL_PATH_COORD_COUNT_NV = 37022 - GL_PATH_COVER_DEPTH_FUNC_NV = 37055 - GL_PATH_DASH_ARRAY_COUNT_NV = 37023 - GL_PATH_DASH_CAPS_NV = 36987 - GL_PATH_DASH_OFFSET_NV = 36990 - GL_PATH_DASH_OFFSET_RESET_NV = 37044 - GL_PATH_END_CAPS_NV = 36982 - GL_PATH_ERROR_POSITION_NV = 37035 - GL_PATH_FILL_BOUNDING_BOX_NV = 37025 - GL_PATH_FILL_COVER_MODE_NV = 36994 - GL_PATH_FILL_MASK_NV = 36993 - GL_PATH_FILL_MODE_NV = 36992 - GL_PATH_FORMAT_PS_NV = 36977 - GL_PATH_FORMAT_SVG_NV = 36976 - GL_PATH_GEN_COEFF_NV = 37041 - GL_PATH_GEN_COMPONENTS_NV = 37043 - GL_PATH_GEN_MODE_NV = 37040 - GL_PATH_INITIAL_DASH_CAP_NV = 36988 - GL_PATH_INITIAL_END_CAP_NV = 36983 - GL_PATH_JOIN_STYLE_NV = 36985 - GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV = 3382 - GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV = 3384 - GL_PATH_MITER_LIMIT_NV = 36986 - GL_PATH_MODELVIEW_MATRIX_NV = 2982 - GL_PATH_MODELVIEW_NV = 5888 - GL_PATH_MODELVIEW_STACK_DEPTH_NV = 2979 - GL_PATH_OBJECT_BOUNDING_BOX_NV = 37002 - GL_PATH_PROJECTION_MATRIX_NV = 2983 - GL_PATH_PROJECTION_NV = 5889 - GL_PATH_PROJECTION_STACK_DEPTH_NV = 2980 - GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV = 37053 - GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV = 37054 - GL_PATH_STENCIL_FUNC_NV = 37047 - GL_PATH_STENCIL_REF_NV = 37048 - GL_PATH_STENCIL_VALUE_MASK_NV = 37049 - GL_PATH_STROKE_BOUNDING_BOX_NV = 37026 - GL_PATH_STROKE_COVER_MODE_NV = 36995 - GL_PATH_STROKE_MASK_NV = 36996 - GL_PATH_STROKE_WIDTH_NV = 36981 - GL_PATH_TERMINAL_DASH_CAP_NV = 36989 - GL_PATH_TERMINAL_END_CAP_NV = 36984 - GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV = 34019 - GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV = 34020 - GL_PERCENTAGE_AMD = 35779 - GL_PERFMON_GLOBAL_MODE_QCOM = 36768 - GL_PERFMON_RESULT_AMD = 35782 - GL_PERFMON_RESULT_AVAILABLE_AMD = 35780 - GL_PERFMON_RESULT_SIZE_AMD = 35781 - GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL = 38140 - GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL = 38139 - GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL = 38138 - GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL = 38136 - GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL = 38137 - GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL = 38143 - GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL = 38129 - GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL = 38130 - GL_PERFQUERY_COUNTER_EVENT_INTEL = 38128 - GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL = 38142 - GL_PERFQUERY_COUNTER_RAW_INTEL = 38132 - GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL = 38131 - GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL = 38133 - GL_PERFQUERY_DONOT_FLUSH_INTEL = 33785 - GL_PERFQUERY_FLUSH_INTEL = 33786 - GL_PERFQUERY_GLOBAL_CONTEXT_INTEL = 1 - GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL = 38144 - GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL = 38141 - GL_PERFQUERY_SINGLE_CONTEXT_INTEL = 0 - GL_PERFQUERY_WAIT_INTEL = 33787 - GL_PINLIGHT_NV = 37544 - GL_PIXEL_PACK_BUFFER_BINDING_NV = 35053 - GL_PIXEL_PACK_BUFFER_NV = 35051 - GL_PIXEL_UNPACK_BUFFER_BINDING_NV = 35055 - GL_PIXEL_UNPACK_BUFFER_NV = 35052 - GL_PLUS_CLAMPED_ALPHA_NV = 37554 - GL_PLUS_CLAMPED_NV = 37553 - GL_PLUS_DARKER_NV = 37522 - GL_PLUS_NV = 37521 - GL_POINT_NV = 6912 - GL_POLYGON_MODE_NV = 2880 - GL_POLYGON_OFFSET_CLAMP_EXT = 36379 - GL_POLYGON_OFFSET_FACTOR = 32824 - GL_POLYGON_OFFSET_FILL = 32823 - GL_POLYGON_OFFSET_LINE_NV = 10754 - GL_POLYGON_OFFSET_POINT_NV = 10753 - GL_POLYGON_OFFSET_UNITS = 10752 - GL_PRIMITIVES_GENERATED_EXT = 35975 - GL_PRIMITIVES_GENERATED_OES = 35975 - GL_PRIMITIVE_BOUNDING_BOX_EXT = 37566 - GL_PRIMITIVE_BOUNDING_BOX_OES = 37566 - GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 33313 - GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES = 33313 - GL_PROGRAMMABLE_SAMPLE_LOCATION_NV = 37697 - GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV = 37696 - GL_PROGRAM_BINARY_ANGLE = 37798 - GL_PROGRAM_BINARY_FORMATS_OES = 34815 - GL_PROGRAM_BINARY_FORMAT_MESA = 34655 - GL_PROGRAM_BINARY_LENGTH_OES = 34625 - GL_PROGRAM_KHR = 33506 - GL_PROGRAM_OBJECT_EXT = 35648 - GL_PROGRAM_PIPELINE_BINDING_EXT = 33370 - GL_PROGRAM_PIPELINE_KHR = 33508 - GL_PROGRAM_PIPELINE_OBJECT_EXT = 35407 - GL_PROGRAM_SEPARABLE_EXT = 33368 - GL_PROTECTED_MEMORY_OBJECT_EXT = 38299 - GL_QUADRATIC_CURVE_TO_NV = 10 - GL_QUADS_EXT = 7 - GL_QUADS_OES = 7 - GL_QUERY_BY_REGION_NO_WAIT_NV = 36374 - GL_QUERY_BY_REGION_WAIT_NV = 36373 - GL_QUERY_COUNTER_BITS_EXT = 34916 - GL_QUERY_KHR = 33507 - GL_QUERY_NO_WAIT_NV = 36372 - GL_QUERY_OBJECT_EXT = 37203 - GL_QUERY_RESULT_AVAILABLE_EXT = 34919 - GL_QUERY_RESULT_EXT = 34918 - GL_QUERY_WAIT_NV = 36371 - GL_R11F_G11F_B10F_APPLE = 35898 - GL_R16F_EXT = 33325 - GL_R16_EXT = 33322 - GL_R16_SNORM_EXT = 36760 - GL_R32F_EXT = 33326 - GL_R8_EXT = 33321 - GL_R8_SNORM = 36756 - GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT = 37674 - GL_RASTER_MULTISAMPLE_EXT = 37671 - GL_RASTER_SAMPLES_EXT = 37672 - GL_READ_BUFFER_EXT = 3074 - GL_READ_BUFFER_NV = 3074 - GL_READ_FRAMEBUFFER_ANGLE = 36008 - GL_READ_FRAMEBUFFER_APPLE = 36008 - GL_READ_FRAMEBUFFER_BINDING_ANGLE = 36010 - GL_READ_FRAMEBUFFER_BINDING_APPLE = 36010 - GL_READ_FRAMEBUFFER_BINDING_NV = 36010 - GL_READ_FRAMEBUFFER_NV = 36008 - GL_RECT_NV = 246 - GL_RED_BITS = 3410 - GL_RED_EXT = 6403 - GL_RED_NV = 6403 - GL_REFERENCED_BY_GEOMETRY_SHADER_EXT = 37641 - GL_REFERENCED_BY_GEOMETRY_SHADER_OES = 37641 - GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT = 37639 - GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES = 37639 - GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT = 37640 - GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES = 37640 - GL_RELATIVE_ARC_TO_NV = 255 - GL_RELATIVE_CONIC_CURVE_TO_NV = 27 - GL_RELATIVE_CUBIC_CURVE_TO_NV = 13 - GL_RELATIVE_HORIZONTAL_LINE_TO_NV = 7 - GL_RELATIVE_LARGE_CCW_ARC_TO_NV = 23 - GL_RELATIVE_LARGE_CW_ARC_TO_NV = 25 - GL_RELATIVE_LINE_TO_NV = 5 - GL_RELATIVE_MOVE_TO_NV = 3 - GL_RELATIVE_QUADRATIC_CURVE_TO_NV = 11 - GL_RELATIVE_RECT_NV = 247 - GL_RELATIVE_ROUNDED_RECT2_NV = 235 - GL_RELATIVE_ROUNDED_RECT4_NV = 237 - GL_RELATIVE_ROUNDED_RECT8_NV = 239 - GL_RELATIVE_ROUNDED_RECT_NV = 233 - GL_RELATIVE_SMALL_CCW_ARC_TO_NV = 19 - GL_RELATIVE_SMALL_CW_ARC_TO_NV = 21 - GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV = 17 - GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV = 15 - GL_RELATIVE_VERTICAL_LINE_TO_NV = 9 - GL_RENDERBUFFER_ALPHA_SIZE = 36179 - GL_RENDERBUFFER_BINDING = 36007 - GL_RENDERBUFFER_BLUE_SIZE = 36178 - GL_RENDERBUFFER_DEPTH_SIZE = 36180 - GL_RENDERBUFFER_GREEN_SIZE = 36177 - GL_RENDERBUFFER_HEIGHT = 36163 - GL_RENDERBUFFER_INTERNAL_FORMAT = 36164 - GL_RENDERBUFFER_RED_SIZE = 36176 - GL_RENDERBUFFER_SAMPLES_ANGLE = 36011 - GL_RENDERBUFFER_SAMPLES_APPLE = 36011 - GL_RENDERBUFFER_SAMPLES_EXT = 36011 - GL_RENDERBUFFER_SAMPLES_IMG = 37171 - GL_RENDERBUFFER_SAMPLES_NV = 36011 - GL_RENDERBUFFER_STENCIL_SIZE = 36181 - GL_RENDERBUFFER_WIDTH = 36162 - GL_RENDERER = 7937 - GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM = 36787 - GL_REPEAT = 10497 - GL_REPLACE = 7681 - GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES = 36200 - GL_RESET_NOTIFICATION_STRATEGY_EXT = 33366 - GL_RESET_NOTIFICATION_STRATEGY_KHR = 33366 - GL_RESTART_PATH_NV = 240 - GL_RG16F_EXT = 33327 - GL_RG16_EXT = 33324 - GL_RG16_SNORM_EXT = 36761 - GL_RG32F_EXT = 33328 - GL_RG8_EXT = 33323 - GL_RG8_SNORM = 36757 - GL_RGB = 6407 - GL_RGB10_A2_EXT = 32857 - GL_RGB10_EXT = 32850 - GL_RGB16F_EXT = 34843 - GL_RGB16_EXT = 32852 - GL_RGB16_SNORM_EXT = 36762 - GL_RGB32F_EXT = 34837 - GL_RGB565 = 36194 - GL_RGB565_OES = 36194 - GL_RGB5_A1 = 32855 - GL_RGB5_A1_OES = 32855 - GL_RGB8_OES = 32849 - GL_RGB9_E5_APPLE = 35901 - GL_RGBA16F_EXT = 34842 - GL_RGBA16_EXT = 32859 - GL_RGBA16_SNORM_EXT = 36763 - GL_RGBA32F_EXT = 34836 - GL_RGBA4 = 32854 - GL_RGBA4_OES = 32854 - GL_RGBA8_OES = 32856 - GL_RGBA8_SNORM = 36759 - GL_RGB_422_APPLE = 35359 - GL_RGB_RAW_422_APPLE = 35409 - GL_RG_EXT = 33319 - GL_ROUNDED_RECT2_NV = 234 - GL_ROUNDED_RECT4_NV = 236 - GL_ROUNDED_RECT8_NV = 238 - GL_ROUNDED_RECT_NV = 232 - GL_ROUND_NV = 37028 - GL_SAMPLER = 33510 - GL_SAMPLER_2D = 35678 - GL_SAMPLER_2D_ARRAY_SHADOW_NV = 36292 - GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 37131 - GL_SAMPLER_2D_SHADOW_EXT = 35682 - GL_SAMPLER_3D_OES = 35679 - GL_SAMPLER_BUFFER_EXT = 36290 - GL_SAMPLER_BUFFER_OES = 36290 - GL_SAMPLER_CUBE = 35680 - GL_SAMPLER_CUBE_MAP_ARRAY_EXT = 36876 - GL_SAMPLER_CUBE_MAP_ARRAY_OES = 36876 - GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT = 36877 - GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES = 36877 - GL_SAMPLER_CUBE_SHADOW_NV = 36293 - GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT = 35815 - GL_SAMPLER_EXTERNAL_OES = 36198 - GL_SAMPLER_KHR = 33510 - GL_SAMPLES = 32937 - GL_SAMPLE_ALPHA_TO_COVERAGE = 32926 - GL_SAMPLE_ALPHA_TO_ONE_EXT = 32927 - GL_SAMPLE_BUFFERS = 32936 - GL_SAMPLE_COVERAGE = 32928 - GL_SAMPLE_COVERAGE_INVERT = 32939 - GL_SAMPLE_COVERAGE_VALUE = 32938 - GL_SAMPLE_LOCATION_NV = 36432 - GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV = 37695 - GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV = 37694 - GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV = 37693 - GL_SAMPLE_SHADING_OES = 35894 - GL_SCISSOR_BOX = 3088 - GL_SCISSOR_TEST = 3089 - GL_SCREEN_KHR = 37525 - GL_SCREEN_NV = 37525 - GL_SGX_BINARY_IMG = 35850 - GL_SGX_PROGRAM_BINARY_IMG = 37168 - GL_SHADER_BINARY_DMP = 37456 - GL_SHADER_BINARY_FORMATS = 36344 - GL_SHADER_BINARY_VIV = 36804 - GL_SHADER_COMPILER = 36346 - GL_SHADER_KHR = 33505 - GL_SHADER_OBJECT_EXT = 35656 - GL_SHADER_PIXEL_LOCAL_STORAGE_EXT = 36708 - GL_SHADER_SOURCE_LENGTH = 35720 - GL_SHADER_TYPE = 35663 - GL_SHADING_LANGUAGE_VERSION = 35724 - GL_SHARED_EDGE_NV = 192 - GL_SHORT = 5122 - GL_SIGNALED_APPLE = 37145 - GL_SKIP_DECODE_EXT = 35402 - GL_SKIP_MISSING_GLYPH_NV = 37033 - GL_SLUMINANCE8_ALPHA8_NV = 35909 - GL_SLUMINANCE8_NV = 35911 - GL_SLUMINANCE_ALPHA_NV = 35908 - GL_SLUMINANCE_NV = 35910 - GL_SMALL_CCW_ARC_TO_NV = 18 - GL_SMALL_CW_ARC_TO_NV = 20 - GL_SMAPHS30_PROGRAM_BINARY_DMP = 37457 - GL_SMAPHS_PROGRAM_BINARY_DMP = 37458 - GL_SMOOTH_CUBIC_CURVE_TO_NV = 16 - GL_SMOOTH_QUADRATIC_CURVE_TO_NV = 14 - GL_SOFTLIGHT_KHR = 37532 - GL_SOFTLIGHT_NV = 37532 - GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT = 37289 - GL_SQUARE_NV = 37027 - GL_SR8_EXT = 36797 - GL_SRC1_ALPHA_EXT = 34185 - GL_SRC1_COLOR_EXT = 35065 - GL_SRC_ALPHA_SATURATE = 776 - GL_SRC_ALPHA_SATURATE_EXT = 776 - GL_SRC_ATOP_NV = 37518 - GL_SRC_COLOR = 768 - GL_SRC_IN_NV = 37514 - GL_SRC_NV = 37510 - GL_SRC_OUT_NV = 37516 - GL_SRC_OVER_NV = 37512 - GL_SRG8_EXT = 36798 - GL_SRGB8_ALPHA8_EXT = 35907 - GL_SRGB8_NV = 35905 - GL_SRGB_ALPHA_EXT = 35906 - GL_SRGB_EXT = 35904 - GL_STACK_OVERFLOW_KHR = 1283 - GL_STACK_UNDERFLOW_KHR = 1284 - GL_STANDARD_FONT_FORMAT_NV = 37740 - GL_STANDARD_FONT_NAME_NV = 36978 - GL_STATE_RESTORE = 35804 - GL_STENCIL_ATTACHMENT = 36128 - GL_STENCIL_BACK_FAIL = 34817 - GL_STENCIL_BACK_FUNC = 34816 - GL_STENCIL_BACK_PASS_DEPTH_FAIL = 34818 - GL_STENCIL_BACK_PASS_DEPTH_PASS = 34819 - GL_STENCIL_BACK_REF = 36003 - GL_STENCIL_BACK_VALUE_MASK = 36004 - GL_STENCIL_BACK_WRITEMASK = 36005 - GL_STENCIL_BITS = 3415 - GL_STENCIL_BUFFER_BIT = 1024 - GL_STENCIL_BUFFER_BIT0_QCOM = 65536 - GL_STENCIL_BUFFER_BIT1_QCOM = 131072 - GL_STENCIL_BUFFER_BIT2_QCOM = 262144 - GL_STENCIL_BUFFER_BIT3_QCOM = 524288 - GL_STENCIL_BUFFER_BIT4_QCOM = 1048576 - GL_STENCIL_BUFFER_BIT5_QCOM = 2097152 - GL_STENCIL_BUFFER_BIT6_QCOM = 4194304 - GL_STENCIL_BUFFER_BIT7_QCOM = 8388608 - GL_STENCIL_CLEAR_VALUE = 2961 - GL_STENCIL_EXT = 6146 - GL_STENCIL_FAIL = 2964 - GL_STENCIL_FUNC = 2962 - GL_STENCIL_INDEX1_OES = 36166 - GL_STENCIL_INDEX4_OES = 36167 - GL_STENCIL_INDEX8 = 36168 - GL_STENCIL_INDEX8_OES = 36168 - GL_STENCIL_INDEX_OES = 6401 - GL_STENCIL_PASS_DEPTH_FAIL = 2965 - GL_STENCIL_PASS_DEPTH_PASS = 2966 - GL_STENCIL_REF = 2967 - GL_STENCIL_SAMPLES_NV = 37678 - GL_STENCIL_TEST = 2960 - GL_STENCIL_VALUE_MASK = 2963 - GL_STENCIL_WRITEMASK = 2968 - GL_STREAM_DRAW = 35040 - GL_SUBPIXEL_BITS = 3408 - GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV = 37703 - GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV = 37704 - GL_SUPERSAMPLE_SCALE_X_NV = 37746 - GL_SUPERSAMPLE_SCALE_Y_NV = 37747 - GL_SYNC_CONDITION_APPLE = 37139 - GL_SYNC_FENCE_APPLE = 37142 - GL_SYNC_FLAGS_APPLE = 37141 - GL_SYNC_FLUSH_COMMANDS_BIT_APPLE = 1 - GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE = 37143 - GL_SYNC_OBJECT_APPLE = 35411 - GL_SYNC_STATUS_APPLE = 37140 - GL_SYSTEM_FONT_NAME_NV = 36979 - GL_TESS_CONTROL_OUTPUT_VERTICES_EXT = 36469 - GL_TESS_CONTROL_OUTPUT_VERTICES_OES = 36469 - GL_TESS_CONTROL_SHADER_BIT_EXT = 8 - GL_TESS_CONTROL_SHADER_BIT_OES = 8 - GL_TESS_CONTROL_SHADER_EXT = 36488 - GL_TESS_CONTROL_SHADER_OES = 36488 - GL_TESS_EVALUATION_SHADER_BIT_EXT = 16 - GL_TESS_EVALUATION_SHADER_BIT_OES = 16 - GL_TESS_EVALUATION_SHADER_EXT = 36487 - GL_TESS_EVALUATION_SHADER_OES = 36487 - GL_TESS_GEN_MODE_EXT = 36470 - GL_TESS_GEN_MODE_OES = 36470 - GL_TESS_GEN_POINT_MODE_EXT = 36473 - GL_TESS_GEN_POINT_MODE_OES = 36473 - GL_TESS_GEN_SPACING_EXT = 36471 - GL_TESS_GEN_SPACING_OES = 36471 - GL_TESS_GEN_VERTEX_ORDER_EXT = 36472 - GL_TESS_GEN_VERTEX_ORDER_OES = 36472 - GL_TEXTURE = 5890 - GL_TEXTURE1 = 33985 - GL_TEXTURE10 = 33994 - GL_TEXTURE11 = 33995 - GL_TEXTURE12 = 33996 - GL_TEXTURE13 = 33997 - GL_TEXTURE14 = 33998 - GL_TEXTURE15 = 33999 - GL_TEXTURE16 = 34000 - GL_TEXTURE17 = 34001 - GL_TEXTURE18 = 34002 - GL_TEXTURE19 = 34003 - GL_TEXTURE2 = 33986 - GL_TEXTURE20 = 34004 - GL_TEXTURE21 = 34005 - GL_TEXTURE22 = 34006 - GL_TEXTURE23 = 34007 - GL_TEXTURE24 = 34008 - GL_TEXTURE25 = 34009 - GL_TEXTURE26 = 34010 - GL_TEXTURE27 = 34011 - GL_TEXTURE28 = 34012 - GL_TEXTURE29 = 34013 - GL_TEXTURE3 = 33987 - GL_TEXTURE30 = 34014 - GL_TEXTURE31 = 34015 - GL_TEXTURE4 = 33988 - GL_TEXTURE5 = 33989 - GL_TEXTURE6 = 33990 - GL_TEXTURE7 = 33991 - GL_TEXTURE8 = 33992 - GL_TEXTURE9 = 33993 - GL_TEXTURE_2D_ARRAY = 35866 - GL_TEXTURE_2D_MULTISAMPLE = 37120 - GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 37122 - GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES = 37122 - GL_TEXTURE_3D = 32879 - GL_TEXTURE_3D_OES = 32879 - GL_TEXTURE_ASTC_DECODE_PRECISION_EXT = 36713 - GL_TEXTURE_BINDING_2D = 32873 - GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES = 37125 - GL_TEXTURE_BINDING_3D_OES = 32874 - GL_TEXTURE_BINDING_BUFFER_EXT = 35884 - GL_TEXTURE_BINDING_BUFFER_OES = 35884 - GL_TEXTURE_BINDING_CUBE_MAP = 34068 - GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT = 36874 - GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES = 36874 - GL_TEXTURE_BINDING_EXTERNAL_OES = 36199 - GL_TEXTURE_BORDER_COLOR_EXT = 4100 - GL_TEXTURE_BORDER_COLOR_NV = 4100 - GL_TEXTURE_BORDER_COLOR_OES = 4100 - GL_TEXTURE_BUFFER_BINDING_EXT = 35882 - GL_TEXTURE_BUFFER_BINDING_OES = 35882 - GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT = 35885 - GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES = 35885 - GL_TEXTURE_BUFFER_EXT = 35882 - GL_TEXTURE_BUFFER_OES = 35882 - GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT = 37279 - GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES = 37279 - GL_TEXTURE_BUFFER_OFFSET_EXT = 37277 - GL_TEXTURE_BUFFER_OFFSET_OES = 37277 - GL_TEXTURE_BUFFER_SIZE_EXT = 37278 - GL_TEXTURE_BUFFER_SIZE_OES = 37278 - GL_TEXTURE_COMPARE_FUNC_EXT = 34893 - GL_TEXTURE_COMPARE_MODE_EXT = 34892 - GL_TEXTURE_CUBE_MAP = 34067 - GL_TEXTURE_CUBE_MAP_ARRAY_EXT = 36873 - GL_TEXTURE_CUBE_MAP_ARRAY_OES = 36873 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074 - GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073 - GL_TEXTURE_DEPTH_QCOM = 35796 - GL_TEXTURE_FORMAT_QCOM = 35798 - GL_TEXTURE_FORMAT_SRGB_OVERRIDE_EXT = 36799 - GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM = 35835 - GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM = 35837 - GL_TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM = 35836 - GL_TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM = 35838 - GL_TEXTURE_HEIGHT_QCOM = 35795 - GL_TEXTURE_IMAGE_VALID_QCOM = 35800 - GL_TEXTURE_IMMUTABLE_FORMAT_EXT = 37167 - GL_TEXTURE_IMMUTABLE_LEVELS = 33503 - GL_TEXTURE_INTERNAL_FORMAT_QCOM = 35797 - GL_TEXTURE_MAX_ANISOTROPY_EXT = 34046 - GL_TEXTURE_MAX_LEVEL_APPLE = 33085 - GL_TEXTURE_NUM_LEVELS_QCOM = 35801 - GL_TEXTURE_OBJECT_VALID_QCOM = 35803 - GL_TEXTURE_PROTECTED_EXT = 35834 - GL_TEXTURE_REDUCTION_MODE_EXT = 37734 - GL_TEXTURE_SAMPLES_IMG = 37174 - GL_TEXTURE_SPARSE_EXT = 37286 - GL_TEXTURE_SRGB_DECODE_EXT = 35400 - GL_TEXTURE_TARGET_QCOM = 35802 - GL_TEXTURE_TILING_EXT = 38272 - GL_TEXTURE_TYPE_QCOM = 35799 - GL_TEXTURE_USAGE_ANGLE = 37794 - GL_TEXTURE_VIEW_MIN_LAYER_EXT = 33501 - GL_TEXTURE_VIEW_MIN_LAYER_OES = 33501 - GL_TEXTURE_VIEW_MIN_LEVEL_EXT = 33499 - GL_TEXTURE_VIEW_MIN_LEVEL_OES = 33499 - GL_TEXTURE_VIEW_NUM_LAYERS_EXT = 33502 - GL_TEXTURE_VIEW_NUM_LAYERS_OES = 33502 - GL_TEXTURE_VIEW_NUM_LEVELS_EXT = 33500 - GL_TEXTURE_VIEW_NUM_LEVELS_OES = 33500 - GL_TEXTURE_WIDTH_QCOM = 35794 - GL_TEXTURE_WRAP_R_OES = 32882 - GL_TILING_TYPES_EXT = 38275 - GL_TIMEOUT_EXPIRED_APPLE = 37147 - GL_TIMEOUT_IGNORED_APPLE = 0xFFFFFFFFFFFFFFFF - GL_TIMESTAMP_EXT = 36392 - GL_TIME_ELAPSED_EXT = 35007 - GL_TRANSFORM_FEEDBACK = 36386 - GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE = 37792 - GL_TRANSLATE_2D_NV = 37008 - GL_TRANSLATE_3D_NV = 37009 - GL_TRANSLATE_X_NV = 37006 - GL_TRANSLATE_Y_NV = 37007 - GL_TRANSPOSE_AFFINE_2D_NV = 37014 - GL_TRANSPOSE_AFFINE_3D_NV = 37016 - GL_TRIANGLES_ADJACENCY_EXT = 12 - GL_TRIANGLES_ADJACENCY_OES = 12 - GL_TRIANGLE_STRIP_ADJACENCY_EXT = 13 - GL_TRIANGLE_STRIP_ADJACENCY_OES = 13 - GL_TRIANGULAR_NV = 37029 - GL_UNCORRELATED_NV = 37506 - GL_UNDEFINED_VERTEX_EXT = 33376 - GL_UNDEFINED_VERTEX_OES = 33376 - GL_UNKNOWN_CONTEXT_RESET_EXT = 33365 - GL_UNKNOWN_CONTEXT_RESET_KHR = 33365 - GL_UNPACK_ALIGNMENT = 3317 - GL_UNPACK_ROW_LENGTH_EXT = 3314 - GL_UNPACK_SKIP_PIXELS_EXT = 3316 - GL_UNPACK_SKIP_ROWS_EXT = 3315 - GL_UNSIGNALED_APPLE = 37144 - GL_UNSIGNED_INT = 5125 - GL_UNSIGNED_INT16_NV = 36848 - GL_UNSIGNED_INT16_VEC2_NV = 36849 - GL_UNSIGNED_INT16_VEC3_NV = 36850 - GL_UNSIGNED_INT16_VEC4_NV = 36851 - GL_UNSIGNED_INT64_AMD = 35778 - GL_UNSIGNED_INT64_NV = 5135 - GL_UNSIGNED_INT64_VEC2_NV = 36853 - GL_UNSIGNED_INT64_VEC3_NV = 36854 - GL_UNSIGNED_INT64_VEC4_NV = 36855 - GL_UNSIGNED_INT8_NV = 36844 - GL_UNSIGNED_INT8_VEC2_NV = 36845 - GL_UNSIGNED_INT8_VEC3_NV = 36846 - GL_UNSIGNED_INT8_VEC4_NV = 36847 - GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE = 35899 - GL_UNSIGNED_INT_10_10_10_2_OES = 36342 - GL_UNSIGNED_INT_24_8_OES = 34042 - GL_UNSIGNED_INT_2_10_10_10_REV_EXT = 33640 - GL_UNSIGNED_INT_5_9_9_9_REV_APPLE = 35902 - GL_UNSIGNED_INT_IMAGE_BUFFER_EXT = 36967 - GL_UNSIGNED_INT_IMAGE_BUFFER_OES = 36967 - GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 36970 - GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES = 36970 - GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 37133 - GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT = 36312 - GL_UNSIGNED_INT_SAMPLER_BUFFER_OES = 36312 - GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT = 36879 - GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES = 36879 - GL_UNSIGNED_NORMALIZED_EXT = 35863 - GL_UNSIGNED_SHORT = 5123 - GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT = 33638 - GL_UNSIGNED_SHORT_4_4_4_4 = 32819 - GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT = 33637 - GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG = 33637 - GL_UNSIGNED_SHORT_5_5_5_1 = 32820 - GL_UNSIGNED_SHORT_5_6_5 = 33635 - GL_UNSIGNED_SHORT_8_8_APPLE = 34234 - GL_UNSIGNED_SHORT_8_8_REV_APPLE = 34235 - GL_UPPER_LEFT_EXT = 36002 - GL_USE_MISSING_GLYPH_NV = 37034 - GL_UTF16_NV = 37019 - GL_UTF8_NV = 37018 - GL_UUID_SIZE_EXT = 16 - GL_VALIDATE_STATUS = 35715 - GL_VENDOR = 7936 - GL_VERSION = 7938 - GL_VERTEX_ARRAY_BINDING_OES = 34229 - GL_VERTEX_ARRAY_KHR = 32884 - GL_VERTEX_ARRAY_OBJECT_EXT = 37204 - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 35070 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT = 35070 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV = 35070 - GL_VERTEX_ATTRIB_ARRAY_ENABLED = 34338 - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922 - GL_VERTEX_ATTRIB_ARRAY_POINTER = 34373 - GL_VERTEX_ATTRIB_ARRAY_SIZE = 34339 - GL_VERTEX_ATTRIB_ARRAY_STRIDE = 34340 - GL_VERTEX_ATTRIB_ARRAY_TYPE = 34341 - GL_VERTEX_SHADER_BIT_EXT = 1 - GL_VERTICAL_LINE_TO_NV = 8 - GL_VIEWPORT = 2978 - GL_VIEWPORT_BOUNDS_RANGE_NV = 33373 - GL_VIEWPORT_BOUNDS_RANGE_OES = 33373 - GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV = 33375 - GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES = 33375 - GL_VIEWPORT_POSITION_W_SCALE_NV = 37756 - GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV = 37757 - GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV = 37758 - GL_VIEWPORT_SUBPIXEL_BITS_NV = 33372 - GL_VIEWPORT_SUBPIXEL_BITS_OES = 33372 - GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV = 37719 - GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV = 37713 - GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV = 37715 - GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV = 37717 - GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV = 37718 - GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV = 37712 - GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV = 37714 - GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV = 37716 - GL_VIEWPORT_SWIZZLE_W_NV = 37723 - GL_VIEWPORT_SWIZZLE_X_NV = 37720 - GL_VIEWPORT_SWIZZLE_Y_NV = 37721 - GL_VIEWPORT_SWIZZLE_Z_NV = 37722 - GL_VIRTUAL_PAGE_SIZE_INDEX_EXT = 37287 - GL_VIRTUAL_PAGE_SIZE_X_EXT = 37269 - GL_VIRTUAL_PAGE_SIZE_Y_EXT = 37270 - GL_VIRTUAL_PAGE_SIZE_Z_EXT = 37271 - GL_VIVIDLIGHT_NV = 37542 - GL_WAIT_FAILED_APPLE = 37149 - GL_WEIGHTED_AVERAGE_EXT = 37735 - GL_WINDOW_RECTANGLE_EXT = 36626 - GL_WINDOW_RECTANGLE_MODE_EXT = 36627 - GL_WRITEONLY_RENDERING_QCOM = 34851 - GL_WRITE_ONLY_OES = 35001 - GL_XOR_NV = 5382 - GL_Z400_BINARY_AMD = 34624 - GL_ZERO = 0 - GL_ZERO_TO_ONE_EXT = 37727 -) diff --git a/gles2/enum.go b/gles2/enum.go deleted file mode 100644 index 3ded006..0000000 --- a/gles2/enum.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -type Enum uint32 - -const ( - False Enum = 0 - True Enum = 1 - Points Enum = 0 - Triangles Enum = 4 - TriangleStrip Enum = 5 - TriangleFan Enum = 6 - NoError Enum = 0 - DepthTest Enum = 2929 - Blend Enum = 3042 - Texture2d Enum = 3553 - UnsignedByte Enum = 5121 - Float Enum = 5126 - Rgba Enum = 6408 - Nearest Enum = 9728 - Linear Enum = 9729 - TextureMagFilter Enum = 10240 - TextureMinFilter Enum = 10241 - TextureWrapS Enum = 10242 - TextureWrapT Enum = 10243 - ColorBufferBit Enum = 16384 - DepthBufferBit Enum = 256 - ClampToEdge Enum = 33071 - DepthComponent16 Enum = 33189 - Texture0 Enum = 33984 - ArrayBuffer Enum = 34962 - ElementArrayBuffer Enum = 34963 - StaticDraw Enum = 35044 - DynamicDraw Enum = 35048 - VertexShader Enum = 35633 - FragmentShader Enum = 35632 - CompileStatus Enum = 35713 - LinkStatus Enum = 35714 - ColorAttachment0 Enum = 36064 - DepthAttachment Enum = 36096 - FramebufferComplete Enum = 36053 - Framebuffer Enum = 36160 - Renderbuffer Enum = 36161 - TextureExternalOes Enum = 36197 - SrcAlpha Enum = 770 - OneMinusSrcAlpha Enum = 771 -) diff --git a/gles2/errors.go b/gles2/errors.go deleted file mode 100644 index fce7815..0000000 --- a/gles2/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 diff --git a/gles2/functions.go b/gles2/functions.go deleted file mode 100644 index ea4fea2..0000000 --- a/gles2/functions.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -// ActiveTexture calls the underlying C function. -func ActiveTexture(texture Enum) { - capi.GlActiveTexture(capi.GLenum(texture)) -} - -// AttachShader calls the underlying C function. -func AttachShader(program GLuint, shader GLuint) { - capi.GlAttachShader(capi.GLuint(program), capi.GLuint(shader)) -} - -// BindBuffer calls the underlying C function. -func BindBuffer(target Enum, buffer GLuint) { - capi.GlBindBuffer(capi.GLenum(target), capi.GLuint(buffer)) -} - -// BindFramebuffer calls the underlying C function. -func BindFramebuffer(target Enum, framebuffer GLuint) { - capi.GlBindFramebuffer(capi.GLenum(target), capi.GLuint(framebuffer)) -} - -// BindRenderbuffer calls the underlying C function. -func BindRenderbuffer(target Enum, renderbuffer GLuint) { - capi.GlBindRenderbuffer(capi.GLenum(target), capi.GLuint(renderbuffer)) -} - -// BindTexture calls the underlying C function. -func BindTexture(target Enum, texture GLuint) { - capi.GlBindTexture(capi.GLenum(target), capi.GLuint(texture)) -} - -// BlendFunc calls the underlying C function. -func BlendFunc(sfactor Enum, dfactor Enum) { - capi.GlBlendFunc(capi.GLenum(sfactor), capi.GLenum(dfactor)) -} - -// BlendFuncSeparate calls the underlying C function. -func BlendFuncSeparate(sfactorRGB Enum, dfactorRGB Enum, sfactorAlpha Enum, dfactorAlpha Enum) { - capi.GlBlendFuncSeparate(capi.GLenum(sfactorRGB), capi.GLenum(dfactorRGB), capi.GLenum(sfactorAlpha), capi.GLenum(dfactorAlpha)) -} - -// BufferData calls the underlying C function. -func BufferData(target Enum, size GLsizeiptr, data unsafe.Pointer, usage Enum) { - capi.GlBufferData(capi.GLenum(target), capi.GLsizeiptr(size), data, capi.GLenum(usage)) -} - -// BufferSubData calls the underlying C function. -func BufferSubData(target Enum, offset GLintptr, size GLsizeiptr, data unsafe.Pointer) { - capi.GlBufferSubData(capi.GLenum(target), capi.GLintptr(offset), capi.GLsizeiptr(size), data) -} - -// CheckFramebufferStatus calls the underlying C function. -func CheckFramebufferStatus(target Enum) Enum { - return (Enum)(capi.GlCheckFramebufferStatus(capi.GLenum(target))) -} - -// Clear calls the underlying C function. -func Clear(mask Bitfield) { - capi.GlClear(capi.GLbitfield(mask)) -} - -// ClearColor calls the underlying C function. -func ClearColor(red GLfloat, green GLfloat, blue GLfloat, alpha GLfloat) { - capi.GlClearColor(capi.GLfloat(red), capi.GLfloat(green), capi.GLfloat(blue), capi.GLfloat(alpha)) -} - -// CompileShader calls the underlying C function. -func CompileShader(shader GLuint) { - capi.GlCompileShader(capi.GLuint(shader)) -} - -// CreateProgram calls the underlying C function. -func CreateProgram() GLuint { - return (GLuint)(capi.GlCreateProgram()) -} - -// CreateShader calls the underlying C function. -func CreateShader(_type Enum) GLuint { - return (GLuint)(capi.GlCreateShader(capi.GLenum(_type))) -} - -// DeleteBuffers calls the underlying C function. -func DeleteBuffers(n GLsizei, buffers *GLuint) { - capi.GlDeleteBuffers(capi.GLsizei(n), (*capi.GLuint)(buffers)) -} - -// DeleteFramebuffers calls the underlying C function. -func DeleteFramebuffers(n GLsizei, framebuffers *GLuint) { - capi.GlDeleteFramebuffers(capi.GLsizei(n), (*capi.GLuint)(framebuffers)) -} - -// DeleteProgram calls the underlying C function. -func DeleteProgram(program GLuint) { - capi.GlDeleteProgram(capi.GLuint(program)) -} - -// DeleteRenderbuffers calls the underlying C function. -func DeleteRenderbuffers(n GLsizei, renderbuffers *GLuint) { - capi.GlDeleteRenderbuffers(capi.GLsizei(n), (*capi.GLuint)(renderbuffers)) -} - -// DeleteShader calls the underlying C function. -func DeleteShader(shader GLuint) { - capi.GlDeleteShader(capi.GLuint(shader)) -} - -// DeleteTextures calls the underlying C function. -func DeleteTextures(n GLsizei, textures *GLuint) { - capi.GlDeleteTextures(capi.GLsizei(n), (*capi.GLuint)(textures)) -} - -// DepthFunc calls the underlying C function. -func DepthFunc(_func Enum) { - capi.GlDepthFunc(capi.GLenum(_func)) -} - -// DepthMask calls the underlying C function. -func DepthMask(flag Boolean) { - capi.GlDepthMask(capi.GLboolean(flag)) -} - -// Disable calls the underlying C function. -func Disable(cap Enum) { - capi.GlDisable(capi.GLenum(cap)) -} - -// DisableVertexAttribArray calls the underlying C function. -func DisableVertexAttribArray(index GLuint) { - capi.GlDisableVertexAttribArray(capi.GLuint(index)) -} - -// DrawArrays calls the underlying C function. -func DrawArrays(mode Enum, first GLint, count GLsizei) { - capi.GlDrawArrays(capi.GLenum(mode), capi.GLint(first), capi.GLsizei(count)) -} - -// DrawElements calls the underlying C function. -func DrawElements(mode Enum, count GLsizei, _type Enum, indices unsafe.Pointer) { - capi.GlDrawElements(capi.GLenum(mode), capi.GLsizei(count), capi.GLenum(_type), indices) -} - -// Enable calls the underlying C function. -func Enable(cap Enum) { - capi.GlEnable(capi.GLenum(cap)) -} - -// EnableVertexAttribArray calls the underlying C function. -func EnableVertexAttribArray(index GLuint) { - capi.GlEnableVertexAttribArray(capi.GLuint(index)) -} - -// Finish calls the underlying C function. -func Finish() { - capi.GlFinish() -} - -// Flush calls the underlying C function. -func Flush() { - capi.GlFlush() -} - -// FramebufferRenderbuffer calls the underlying C function. -func FramebufferRenderbuffer(target Enum, attachment Enum, renderbuffertarget Enum, renderbuffer GLuint) { - capi.GlFramebufferRenderbuffer(capi.GLenum(target), capi.GLenum(attachment), capi.GLenum(renderbuffertarget), capi.GLuint(renderbuffer)) -} - -// FramebufferTexture2D calls the underlying C function. -func FramebufferTexture2D(target Enum, attachment Enum, textarget Enum, texture GLuint, level GLint) { - capi.GlFramebufferTexture2D(capi.GLenum(target), capi.GLenum(attachment), capi.GLenum(textarget), capi.GLuint(texture), capi.GLint(level)) -} - -// GenBuffers calls the underlying C function. -func GenBuffers(n GLsizei, buffers *GLuint) { - capi.GlGenBuffers(capi.GLsizei(n), (*capi.GLuint)(buffers)) -} - -// GenFramebuffers calls the underlying C function. -func GenFramebuffers(n GLsizei, framebuffers *GLuint) { - capi.GlGenFramebuffers(capi.GLsizei(n), (*capi.GLuint)(framebuffers)) -} - -// GenRenderbuffers calls the underlying C function. -func GenRenderbuffers(n GLsizei, renderbuffers *GLuint) { - capi.GlGenRenderbuffers(capi.GLsizei(n), (*capi.GLuint)(renderbuffers)) -} - -// GenTextures calls the underlying C function. -func GenTextures(n GLsizei, textures *GLuint) { - capi.GlGenTextures(capi.GLsizei(n), (*capi.GLuint)(textures)) -} - -// GetAttribLocation calls the underlying C function. -func GetAttribLocation(program GLuint, name *GLchar) GLint { - return (GLint)(capi.GlGetAttribLocation(capi.GLuint(program), (*capi.GLchar)(name))) -} - -// GetError calls the underlying C function. -func GetError() Enum { - return (Enum)(capi.GlGetError()) -} - -// GetIntegerv calls the underlying C function. -func GetIntegerv(pname Enum, data *GLint) { - capi.GlGetIntegerv(capi.GLenum(pname), (*capi.GLint)(data)) -} - -// GetProgramiv calls the underlying C function. -func GetProgramiv(program GLuint, pname Enum, params *GLint) { - capi.GlGetProgramiv(capi.GLuint(program), capi.GLenum(pname), (*capi.GLint)(params)) -} - -// GetShaderiv calls the underlying C function. -func GetShaderiv(shader GLuint, pname Enum, params *GLint) { - capi.GlGetShaderiv(capi.GLuint(shader), capi.GLenum(pname), (*capi.GLint)(params)) -} - -// GetString calls the underlying C function. -func GetString(name Enum) *GLubyte { - return (*GLubyte)(capi.GlGetString(capi.GLenum(name))) -} - -// GetUniformLocation calls the underlying C function. -func GetUniformLocation(program GLuint, name *GLchar) GLint { - return (GLint)(capi.GlGetUniformLocation(capi.GLuint(program), (*capi.GLchar)(name))) -} - -// LineWidth calls the underlying C function. -func LineWidth(width GLfloat) { - capi.GlLineWidth(capi.GLfloat(width)) -} - -// LinkProgram calls the underlying C function. -func LinkProgram(program GLuint) { - capi.GlLinkProgram(capi.GLuint(program)) -} - -// PixelStorei calls the underlying C function. -func PixelStorei(pname Enum, param GLint) { - capi.GlPixelStorei(capi.GLenum(pname), capi.GLint(param)) -} - -// ReadPixels calls the underlying C function. -func ReadPixels(x GLint, y GLint, width GLsizei, height GLsizei, format Enum, _type Enum, pixels unsafe.Pointer) { - capi.GlReadPixels(capi.GLint(x), capi.GLint(y), capi.GLsizei(width), capi.GLsizei(height), capi.GLenum(format), capi.GLenum(_type), pixels) -} - -// GlReleaseShaderCompiler calls the underlying C function. -func GlReleaseShaderCompiler() { - capi.GlReleaseShaderCompiler() -} - -// RenderbufferStorage calls the underlying C function. -func RenderbufferStorage(target Enum, internalformat Enum, width GLsizei, height GLsizei) { - capi.GlRenderbufferStorage(capi.GLenum(target), capi.GLenum(internalformat), capi.GLsizei(width), capi.GLsizei(height)) -} - -// Scissor calls the underlying C function. -func Scissor(x GLint, y GLint, width GLsizei, height GLsizei) { - capi.GlScissor(capi.GLint(x), capi.GLint(y), capi.GLsizei(width), capi.GLsizei(height)) -} - -// ShaderSource calls the underlying C function. -func ShaderSource(shader GLuint, count GLsizei, string **GLchar, length *GLint) { - capi.GlShaderSource(capi.GLuint(shader), capi.GLsizei(count), (**capi.GLchar)(string), (*capi.GLint)(length)) -} - -// StencilFunc calls the underlying C function. -func StencilFunc(_func Enum, ref GLint, mask GLuint) { - capi.GlStencilFunc(capi.GLenum(_func), capi.GLint(ref), capi.GLuint(mask)) -} - -// StencilOp calls the underlying C function. -func StencilOp(fail Enum, zfail Enum, zpass Enum) { - capi.GlStencilOp(capi.GLenum(fail), capi.GLenum(zfail), capi.GLenum(zpass)) -} - -// TexImage2D calls the underlying C function. -func TexImage2D(target Enum, level GLint, internalformat GLint, width GLsizei, height GLsizei, border GLint, format Enum, _type Enum, pixels unsafe.Pointer) { - capi.GlTexImage2D(capi.GLenum(target), capi.GLint(level), capi.GLint(internalformat), capi.GLsizei(width), capi.GLsizei(height), capi.GLint(border), capi.GLenum(format), capi.GLenum(_type), pixels) -} - -// TexParameteri calls the underlying C function. -func TexParameteri(target Enum, pname Enum, param GLint) { - capi.GlTexParameteri(capi.GLenum(target), capi.GLenum(pname), capi.GLint(param)) -} - -// Uniform1f calls the underlying C function. -func Uniform1f(location GLint, v0 GLfloat) { - capi.GlUniform1f(capi.GLint(location), capi.GLfloat(v0)) -} - -// Uniform1i calls the underlying C function. -func Uniform1i(location GLint, v0 GLint) { - capi.GlUniform1i(capi.GLint(location), capi.GLint(v0)) -} - -// Uniform4fv calls the underlying C function. -func Uniform4fv(location GLint, count GLsizei, value *GLfloat) { - capi.GlUniform4fv(capi.GLint(location), capi.GLsizei(count), (*capi.GLfloat)(value)) -} - -// UniformMatrix4fv calls the underlying C function. -func UniformMatrix4fv(location GLint, count GLsizei, transpose Boolean, value *GLfloat) { - capi.GlUniformMatrix4fv(capi.GLint(location), capi.GLsizei(count), capi.GLboolean(transpose), (*capi.GLfloat)(value)) -} - -// UseProgram calls the underlying C function. -func UseProgram(program GLuint) { - capi.GlUseProgram(capi.GLuint(program)) -} - -// VertexAttribPointer calls the underlying C function. -func VertexAttribPointer(index GLuint, size GLint, _type Enum, normalized Boolean, stride GLsizei, pointer unsafe.Pointer) { - capi.GlVertexAttribPointer(capi.GLuint(index), capi.GLint(size), capi.GLenum(_type), capi.GLboolean(normalized), capi.GLsizei(stride), pointer) -} - -// Viewport calls the underlying C function. -func Viewport(x GLint, y GLint, width GLsizei, height GLsizei) { - capi.GlViewport(capi.GLint(x), capi.GLint(y), capi.GLsizei(width), capi.GLsizei(height)) -} diff --git a/gles2/glbyte.go b/gles2/glbyte.go deleted file mode 100644 index bd3ef72..0000000 --- a/gles2/glbyte.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLbyte = capi.GLbyte diff --git a/gles2/glchar.go b/gles2/glchar.go deleted file mode 100644 index e516266..0000000 --- a/gles2/glchar.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLchar = capi.GLchar diff --git a/gles2/glclampf.go b/gles2/glclampf.go deleted file mode 100644 index 8c26be0..0000000 --- a/gles2/glclampf.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLclampf = capi.GLclampf diff --git a/gles2/gldouble.go b/gles2/gldouble.go deleted file mode 100644 index 8da5d7a..0000000 --- a/gles2/gldouble.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLdouble = capi.GLdouble diff --git a/gles2/glegl_client_buffer_ext.go b/gles2/glegl_client_buffer_ext.go deleted file mode 100644 index bd2bb05..0000000 --- a/gles2/glegl_client_buffer_ext.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLeglClientBufferEXT = capi.GLeglClientBufferEXT diff --git a/gles2/glegl_image_oes.go b/gles2/glegl_image_oes.go deleted file mode 100644 index e7bb58d..0000000 --- a/gles2/glegl_image_oes.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLeglImageOES = capi.GLeglImageOES diff --git a/gles2/glfixed.go b/gles2/glfixed.go deleted file mode 100644 index 71d4e0b..0000000 --- a/gles2/glfixed.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLfixed = capi.GLfixed diff --git a/gles2/glfloat.go b/gles2/glfloat.go deleted file mode 100644 index a15082c..0000000 --- a/gles2/glfloat.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLfloat = capi.GLfloat diff --git a/gles2/glint.go b/gles2/glint.go deleted file mode 100644 index 3f71c96..0000000 --- a/gles2/glint.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLint = capi.GLint diff --git a/gles2/glint64.go b/gles2/glint64.go deleted file mode 100644 index 849a094..0000000 --- a/gles2/glint64.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLint64 = capi.GLint64 diff --git a/gles2/glintptr.go b/gles2/glintptr.go deleted file mode 100644 index 19cbb3e..0000000 --- a/gles2/glintptr.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLintptr = capi.GLintptr diff --git a/gles2/glshort.go b/gles2/glshort.go deleted file mode 100644 index 231b8eb..0000000 --- a/gles2/glshort.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLshort = capi.GLshort diff --git a/gles2/glsizei.go b/gles2/glsizei.go deleted file mode 100644 index b44a323..0000000 --- a/gles2/glsizei.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLsizei = capi.GLsizei diff --git a/gles2/glsizeiptr.go b/gles2/glsizeiptr.go deleted file mode 100644 index 7ab8088..0000000 --- a/gles2/glsizeiptr.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLsizeiptr = capi.GLsizeiptr diff --git a/gles2/glsync.go b/gles2/glsync.go deleted file mode 100644 index 44383d1..0000000 --- a/gles2/glsync.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLsync = capi.GLsync diff --git a/gles2/glubyte.go b/gles2/glubyte.go deleted file mode 100644 index 04aaea3..0000000 --- a/gles2/glubyte.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLubyte = capi.GLubyte diff --git a/gles2/gluint.go b/gles2/gluint.go deleted file mode 100644 index 90fc3d9..0000000 --- a/gles2/gluint.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLuint = capi.GLuint diff --git a/gles2/gluint64.go b/gles2/gluint64.go deleted file mode 100644 index 2ad4046..0000000 --- a/gles2/gluint64.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLuint64 = capi.GLuint64 diff --git a/gles2/glushort.go b/gles2/glushort.go deleted file mode 100644 index b508490..0000000 --- a/gles2/glushort.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles2 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles2" -) - -type GLushort = capi.GLushort diff --git a/gles2/package.go b/gles2/package.go deleted file mode 100644 index 2b9391c..0000000 --- a/gles2/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package gles2 provides Go bindings for OpenGL ES 2.0. -package gles2 diff --git a/gles3/constants.go b/gles3/constants.go deleted file mode 100644 index 677b26c..0000000 --- a/gles3/constants.go +++ /dev/null @@ -1,612 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -const ( - GL_ACTIVE_ATTRIBUTES = 35721 - GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 35722 - GL_ACTIVE_TEXTURE = 34016 - GL_ACTIVE_UNIFORMS = 35718 - GL_ACTIVE_UNIFORM_BLOCKS = 35382 - GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 35381 - GL_ACTIVE_UNIFORM_MAX_LENGTH = 35719 - GL_ALIASED_LINE_WIDTH_RANGE = 33902 - GL_ALIASED_POINT_SIZE_RANGE = 33901 - GL_ALPHA = 6406 - GL_ALPHA_BITS = 3413 - GL_ALWAYS = 519 - GL_ANY_SAMPLES_PASSED = 35887 - GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 36202 - GL_ARRAY_BUFFER = 34962 - GL_ARRAY_BUFFER_BINDING = 34964 - GL_ATTACHED_SHADERS = 35717 - GL_BACK = 1029 - GL_BLEND = 3042 - GL_BLEND_COLOR = 32773 - GL_BLEND_DST_ALPHA = 32970 - GL_BLEND_DST_RGB = 32968 - GL_BLEND_EQUATION = 32777 - GL_BLEND_EQUATION_ALPHA = 34877 - GL_BLEND_EQUATION_RGB = 32777 - GL_BLEND_SRC_ALPHA = 32971 - GL_BLEND_SRC_RGB = 32969 - GL_BLUE = 6405 - GL_BLUE_BITS = 3412 - GL_BOOL = 35670 - GL_BOOL_VEC2 = 35671 - GL_BOOL_VEC3 = 35672 - GL_BOOL_VEC4 = 35673 - GL_BUFFER_ACCESS_FLAGS = 37151 - GL_BUFFER_MAPPED = 35004 - GL_BUFFER_MAP_LENGTH = 37152 - GL_BUFFER_MAP_OFFSET = 37153 - GL_BUFFER_MAP_POINTER = 35005 - GL_BUFFER_SIZE = 34660 - GL_BUFFER_USAGE = 34661 - GL_BYTE = 5120 - GL_CCW = 2305 - GL_CLAMP_TO_EDGE = 33071 - GL_COLOR = 6144 - GL_COLOR_ATTACHMENT0 = 36064 - GL_COLOR_ATTACHMENT1 = 36065 - GL_COLOR_ATTACHMENT10 = 36074 - GL_COLOR_ATTACHMENT11 = 36075 - GL_COLOR_ATTACHMENT12 = 36076 - GL_COLOR_ATTACHMENT13 = 36077 - GL_COLOR_ATTACHMENT14 = 36078 - GL_COLOR_ATTACHMENT15 = 36079 - GL_COLOR_ATTACHMENT16 = 36080 - GL_COLOR_ATTACHMENT17 = 36081 - GL_COLOR_ATTACHMENT18 = 36082 - GL_COLOR_ATTACHMENT19 = 36083 - GL_COLOR_ATTACHMENT2 = 36066 - GL_COLOR_ATTACHMENT20 = 36084 - GL_COLOR_ATTACHMENT21 = 36085 - GL_COLOR_ATTACHMENT22 = 36086 - GL_COLOR_ATTACHMENT23 = 36087 - GL_COLOR_ATTACHMENT24 = 36088 - GL_COLOR_ATTACHMENT25 = 36089 - GL_COLOR_ATTACHMENT26 = 36090 - GL_COLOR_ATTACHMENT27 = 36091 - GL_COLOR_ATTACHMENT28 = 36092 - GL_COLOR_ATTACHMENT29 = 36093 - GL_COLOR_ATTACHMENT3 = 36067 - GL_COLOR_ATTACHMENT30 = 36094 - GL_COLOR_ATTACHMENT31 = 36095 - GL_COLOR_ATTACHMENT4 = 36068 - GL_COLOR_ATTACHMENT5 = 36069 - GL_COLOR_ATTACHMENT6 = 36070 - GL_COLOR_ATTACHMENT7 = 36071 - GL_COLOR_ATTACHMENT8 = 36072 - GL_COLOR_ATTACHMENT9 = 36073 - GL_COLOR_BUFFER_BIT = 16384 - GL_COLOR_CLEAR_VALUE = 3106 - GL_COLOR_WRITEMASK = 3107 - GL_COMPARE_REF_TO_TEXTURE = 34894 - GL_COMPILE_STATUS = 35713 - GL_COMPRESSED_R11_EAC = 37488 - GL_COMPRESSED_RG11_EAC = 37490 - GL_COMPRESSED_RGB8_ETC2 = 37492 - GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494 - GL_COMPRESSED_RGBA8_ETC2_EAC = 37496 - GL_COMPRESSED_SIGNED_R11_EAC = 37489 - GL_COMPRESSED_SIGNED_RG11_EAC = 37491 - GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497 - GL_COMPRESSED_SRGB8_ETC2 = 37493 - GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495 - GL_COMPRESSED_TEXTURE_FORMATS = 34467 - GL_CONSTANT_ALPHA = 32771 - GL_CONSTANT_COLOR = 32769 - GL_COPY_READ_BUFFER = 36662 - GL_COPY_READ_BUFFER_BINDING = 36662 - GL_COPY_WRITE_BUFFER = 36663 - GL_COPY_WRITE_BUFFER_BINDING = 36663 - GL_CULL_FACE = 2884 - GL_CULL_FACE_MODE = 2885 - GL_CURRENT_PROGRAM = 35725 - GL_CURRENT_QUERY = 34917 - GL_CURRENT_VERTEX_ATTRIB = 34342 - GL_CW = 2304 - GL_DECR = 7683 - GL_DECR_WRAP = 34056 - GL_DELETE_STATUS = 35712 - GL_DEPTH = 6145 - GL_DEPTH24_STENCIL8 = 35056 - GL_DEPTH32F_STENCIL8 = 36013 - GL_DEPTH_ATTACHMENT = 36096 - GL_DEPTH_BITS = 3414 - GL_DEPTH_BUFFER_BIT = 256 - GL_DEPTH_CLEAR_VALUE = 2931 - GL_DEPTH_COMPONENT = 6402 - GL_DEPTH_COMPONENT16 = 33189 - GL_DEPTH_COMPONENT24 = 33190 - GL_DEPTH_COMPONENT32F = 36012 - GL_DEPTH_FUNC = 2932 - GL_DEPTH_RANGE = 2928 - GL_DEPTH_STENCIL = 34041 - GL_DEPTH_STENCIL_ATTACHMENT = 33306 - GL_DEPTH_TEST = 2929 - GL_DEPTH_WRITEMASK = 2930 - GL_DITHER = 3024 - GL_DONT_CARE = 4352 - GL_DRAW_BUFFER0 = 34853 - GL_DRAW_BUFFER1 = 34854 - GL_DRAW_BUFFER10 = 34863 - GL_DRAW_BUFFER11 = 34864 - GL_DRAW_BUFFER12 = 34865 - GL_DRAW_BUFFER13 = 34866 - GL_DRAW_BUFFER14 = 34867 - GL_DRAW_BUFFER15 = 34868 - GL_DRAW_BUFFER2 = 34855 - GL_DRAW_BUFFER3 = 34856 - GL_DRAW_BUFFER4 = 34857 - GL_DRAW_BUFFER5 = 34858 - GL_DRAW_BUFFER6 = 34859 - GL_DRAW_BUFFER7 = 34860 - GL_DRAW_BUFFER8 = 34861 - GL_DRAW_BUFFER9 = 34862 - GL_DRAW_FRAMEBUFFER = 36009 - GL_DRAW_FRAMEBUFFER_BINDING = 36006 - GL_DST_ALPHA = 772 - GL_DST_COLOR = 774 - GL_DYNAMIC_COPY = 35050 - GL_DYNAMIC_DRAW = 35048 - GL_DYNAMIC_READ = 35049 - GL_ELEMENT_ARRAY_BUFFER = 34963 - GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965 - GL_EQUAL = 514 - GL_EXTENSIONS = 7939 - GL_FALSE = 0 - GL_FASTEST = 4353 - GL_FIXED = 5132 - GL_FLOAT = 5126 - GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 36269 - GL_FLOAT_MAT2 = 35674 - GL_FLOAT_MAT3 = 35675 - GL_FLOAT_MAT4 = 35676 - GL_FLOAT_VEC2 = 35664 - GL_FLOAT_VEC3 = 35665 - GL_FLOAT_VEC4 = 35666 - GL_FRAGMENT_SHADER = 35632 - GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 35723 - GL_FRAMEBUFFER = 36160 - GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 33301 - GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 33300 - GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 33296 - GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 33297 - GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 33302 - GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 33299 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048 - GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 33298 - GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 33303 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 36052 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050 - GL_FRAMEBUFFER_BINDING = 36006 - GL_FRAMEBUFFER_COMPLETE = 36053 - GL_FRAMEBUFFER_DEFAULT = 33304 - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054 - GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057 - GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 36182 - GL_FRAMEBUFFER_UNDEFINED = 33305 - GL_FRAMEBUFFER_UNSUPPORTED = 36061 - GL_FRONT = 1028 - GL_FRONT_AND_BACK = 1032 - GL_FRONT_FACE = 2886 - GL_FUNC_ADD = 32774 - GL_FUNC_REVERSE_SUBTRACT = 32779 - GL_FUNC_SUBTRACT = 32778 - GL_GENERATE_MIPMAP_HINT = 33170 - GL_GEQUAL = 518 - GL_GREATER = 516 - GL_GREEN = 6404 - GL_GREEN_BITS = 3411 - GL_HALF_FLOAT = 5131 - GL_HIGH_FLOAT = 36338 - GL_HIGH_INT = 36341 - GL_IMPLEMENTATION_COLOR_READ_FORMAT = 35739 - GL_IMPLEMENTATION_COLOR_READ_TYPE = 35738 - GL_INCR = 7682 - GL_INCR_WRAP = 34055 - GL_INFO_LOG_LENGTH = 35716 - GL_INT = 5124 - GL_INT_2_10_10_10_REV = 36255 - GL_INT_SAMPLER_2D = 36298 - GL_INT_SAMPLER_2D_ARRAY = 36303 - GL_INT_SAMPLER_3D = 36299 - GL_INT_SAMPLER_CUBE = 36300 - GL_INT_VEC2 = 35667 - GL_INT_VEC3 = 35668 - GL_INT_VEC4 = 35669 - GL_INVALID_ENUM = 1280 - GL_INVALID_FRAMEBUFFER_OPERATION = 1286 - GL_INVALID_INDEX = 4294967295 - GL_INVALID_OPERATION = 1282 - GL_INVALID_VALUE = 1281 - GL_INVERT = 5386 - GL_KEEP = 7680 - GL_LEQUAL = 515 - GL_LESS = 513 - GL_LINEAR = 9729 - GL_LINEAR_MIPMAP_LINEAR = 9987 - GL_LINEAR_MIPMAP_NEAREST = 9985 - GL_LINES = 1 - GL_LINE_LOOP = 2 - GL_LINE_STRIP = 3 - GL_LINE_WIDTH = 2849 - GL_LINK_STATUS = 35714 - GL_LOW_FLOAT = 36336 - GL_LOW_INT = 36339 - GL_LUMINANCE = 6409 - GL_LUMINANCE_ALPHA = 6410 - GL_MAJOR_VERSION = 33307 - GL_MAP_FLUSH_EXPLICIT_BIT = 16 - GL_MAP_INVALIDATE_BUFFER_BIT = 8 - GL_MAP_INVALIDATE_RANGE_BIT = 4 - GL_MAP_READ_BIT = 1 - GL_MAP_UNSYNCHRONIZED_BIT = 32 - GL_MAP_WRITE_BIT = 2 - GL_MAX = 32776 - GL_MAX_3D_TEXTURE_SIZE = 32883 - GL_MAX_ARRAY_TEXTURE_LAYERS = 35071 - GL_MAX_COLOR_ATTACHMENTS = 36063 - GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 35379 - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661 - GL_MAX_COMBINED_UNIFORM_BLOCKS = 35374 - GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 35377 - GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076 - GL_MAX_DRAW_BUFFERS = 34852 - GL_MAX_ELEMENTS_INDICES = 33001 - GL_MAX_ELEMENTS_VERTICES = 33000 - GL_MAX_ELEMENT_INDEX = 36203 - GL_MAX_FRAGMENT_INPUT_COMPONENTS = 37157 - GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 35373 - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 35657 - GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349 - GL_MAX_PROGRAM_TEXEL_OFFSET = 35077 - GL_MAX_RENDERBUFFER_SIZE = 34024 - GL_MAX_SAMPLES = 36183 - GL_MAX_SERVER_WAIT_TIMEOUT = 37137 - GL_MAX_TEXTURE_IMAGE_UNITS = 34930 - GL_MAX_TEXTURE_LOD_BIAS = 34045 - GL_MAX_TEXTURE_SIZE = 3379 - GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 35978 - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 35979 - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 35968 - GL_MAX_UNIFORM_BLOCK_SIZE = 35376 - GL_MAX_UNIFORM_BUFFER_BINDINGS = 35375 - GL_MAX_VARYING_COMPONENTS = 35659 - GL_MAX_VARYING_VECTORS = 36348 - GL_MAX_VERTEX_ATTRIBS = 34921 - GL_MAX_VERTEX_OUTPUT_COMPONENTS = 37154 - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660 - GL_MAX_VERTEX_UNIFORM_BLOCKS = 35371 - GL_MAX_VERTEX_UNIFORM_COMPONENTS = 35658 - GL_MAX_VERTEX_UNIFORM_VECTORS = 36347 - GL_MAX_VIEWPORT_DIMS = 3386 - GL_MEDIUM_FLOAT = 36337 - GL_MEDIUM_INT = 36340 - GL_MIN = 32775 - GL_MINOR_VERSION = 33308 - GL_MIN_PROGRAM_TEXEL_OFFSET = 35076 - GL_MIRRORED_REPEAT = 33648 - GL_NEAREST = 9728 - GL_NEAREST_MIPMAP_LINEAR = 9986 - GL_NEAREST_MIPMAP_NEAREST = 9984 - GL_NEVER = 512 - GL_NICEST = 4354 - GL_NONE = 0 - GL_NOTEQUAL = 517 - GL_NO_ERROR = 0 - GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466 - GL_NUM_EXTENSIONS = 33309 - GL_NUM_PROGRAM_BINARY_FORMATS = 34814 - GL_NUM_SAMPLE_COUNTS = 37760 - GL_NUM_SHADER_BINARY_FORMATS = 36345 - GL_OBJECT_TYPE = 37138 - GL_ONE = 1 - GL_ONE_MINUS_CONSTANT_ALPHA = 32772 - GL_ONE_MINUS_CONSTANT_COLOR = 32770 - GL_ONE_MINUS_DST_ALPHA = 773 - GL_ONE_MINUS_DST_COLOR = 775 - GL_ONE_MINUS_SRC_ALPHA = 771 - GL_ONE_MINUS_SRC_COLOR = 769 - GL_OUT_OF_MEMORY = 1285 - GL_PACK_ALIGNMENT = 3333 - GL_PACK_ROW_LENGTH = 3330 - GL_PACK_SKIP_PIXELS = 3332 - GL_PACK_SKIP_ROWS = 3331 - GL_PIXEL_PACK_BUFFER = 35051 - GL_PIXEL_PACK_BUFFER_BINDING = 35053 - GL_PIXEL_UNPACK_BUFFER = 35052 - GL_PIXEL_UNPACK_BUFFER_BINDING = 35055 - GL_POINTS = 0 - GL_POLYGON_OFFSET_FACTOR = 32824 - GL_POLYGON_OFFSET_FILL = 32823 - GL_POLYGON_OFFSET_UNITS = 10752 - GL_PRIMITIVE_RESTART_FIXED_INDEX = 36201 - GL_PROGRAM_BINARY_FORMATS = 34815 - GL_PROGRAM_BINARY_LENGTH = 34625 - GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 33367 - GL_QUERY_RESULT = 34918 - GL_QUERY_RESULT_AVAILABLE = 34919 - GL_R11F_G11F_B10F = 35898 - GL_R16F = 33325 - GL_R16I = 33331 - GL_R16UI = 33332 - GL_R32F = 33326 - GL_R32I = 33333 - GL_R32UI = 33334 - GL_R8 = 33321 - GL_R8I = 33329 - GL_R8UI = 33330 - GL_R8_SNORM = 36756 - GL_RASTERIZER_DISCARD = 35977 - GL_READ_BUFFER = 3074 - GL_READ_FRAMEBUFFER = 36008 - GL_READ_FRAMEBUFFER_BINDING = 36010 - GL_RED = 6403 - GL_RED_BITS = 3410 - GL_RED_INTEGER = 36244 - GL_RENDERBUFFER = 36161 - GL_RENDERBUFFER_ALPHA_SIZE = 36179 - GL_RENDERBUFFER_BINDING = 36007 - GL_RENDERBUFFER_BLUE_SIZE = 36178 - GL_RENDERBUFFER_DEPTH_SIZE = 36180 - GL_RENDERBUFFER_GREEN_SIZE = 36177 - GL_RENDERBUFFER_HEIGHT = 36163 - GL_RENDERBUFFER_INTERNAL_FORMAT = 36164 - GL_RENDERBUFFER_RED_SIZE = 36176 - GL_RENDERBUFFER_SAMPLES = 36011 - GL_RENDERBUFFER_STENCIL_SIZE = 36181 - GL_RENDERBUFFER_WIDTH = 36162 - GL_RENDERER = 7937 - GL_REPEAT = 10497 - GL_REPLACE = 7681 - GL_RG = 33319 - GL_RG16F = 33327 - GL_RG16I = 33337 - GL_RG16UI = 33338 - GL_RG32F = 33328 - GL_RG32I = 33339 - GL_RG32UI = 33340 - GL_RG8 = 33323 - GL_RG8I = 33335 - GL_RG8UI = 33336 - GL_RG8_SNORM = 36757 - GL_RGB = 6407 - GL_RGB10_A2 = 32857 - GL_RGB10_A2UI = 36975 - GL_RGB16F = 34843 - GL_RGB16I = 36233 - GL_RGB16UI = 36215 - GL_RGB32F = 34837 - GL_RGB32I = 36227 - GL_RGB32UI = 36209 - GL_RGB565 = 36194 - GL_RGB5_A1 = 32855 - GL_RGB8 = 32849 - GL_RGB8I = 36239 - GL_RGB8UI = 36221 - GL_RGB8_SNORM = 36758 - GL_RGB9_E5 = 35901 - GL_RGBA = 6408 - GL_RGBA16F = 34842 - GL_RGBA16I = 36232 - GL_RGBA16UI = 36214 - GL_RGBA32F = 34836 - GL_RGBA32I = 36226 - GL_RGBA32UI = 36208 - GL_RGBA4 = 32854 - GL_RGBA8 = 32856 - GL_RGBA8I = 36238 - GL_RGBA8UI = 36220 - GL_RGBA8_SNORM = 36759 - GL_RGBA_INTEGER = 36249 - GL_RGB_INTEGER = 36248 - GL_RG_INTEGER = 33320 - GL_SAMPLER_2D = 35678 - GL_SAMPLER_2D_ARRAY = 36289 - GL_SAMPLER_2D_ARRAY_SHADOW = 36292 - GL_SAMPLER_2D_SHADOW = 35682 - GL_SAMPLER_3D = 35679 - GL_SAMPLER_BINDING = 35097 - GL_SAMPLER_CUBE = 35680 - GL_SAMPLER_CUBE_SHADOW = 36293 - GL_SAMPLES = 32937 - GL_SAMPLE_ALPHA_TO_COVERAGE = 32926 - GL_SAMPLE_BUFFERS = 32936 - GL_SAMPLE_COVERAGE = 32928 - GL_SAMPLE_COVERAGE_INVERT = 32939 - GL_SAMPLE_COVERAGE_VALUE = 32938 - GL_SCISSOR_BOX = 3088 - GL_SCISSOR_TEST = 3089 - GL_SHADER_BINARY_FORMATS = 36344 - GL_SHADER_COMPILER = 36346 - GL_SHADER_SOURCE_LENGTH = 35720 - GL_SHADER_TYPE = 35663 - GL_SHADING_LANGUAGE_VERSION = 35724 - GL_SHORT = 5122 - GL_SIGNALED = 37145 - GL_SIGNED_NORMALIZED = 36764 - GL_SRC_ALPHA = 770 - GL_SRC_ALPHA_SATURATE = 776 - GL_SRC_COLOR = 768 - GL_SRGB = 35904 - GL_SRGB8 = 35905 - GL_SRGB8_ALPHA8 = 35907 - GL_STATIC_COPY = 35046 - GL_STATIC_DRAW = 35044 - GL_STATIC_READ = 35045 - GL_STENCIL = 6146 - GL_STENCIL_ATTACHMENT = 36128 - GL_STENCIL_BACK_FAIL = 34817 - GL_STENCIL_BACK_FUNC = 34816 - GL_STENCIL_BACK_PASS_DEPTH_FAIL = 34818 - GL_STENCIL_BACK_PASS_DEPTH_PASS = 34819 - GL_STENCIL_BACK_REF = 36003 - GL_STENCIL_BACK_VALUE_MASK = 36004 - GL_STENCIL_BACK_WRITEMASK = 36005 - GL_STENCIL_BITS = 3415 - GL_STENCIL_BUFFER_BIT = 1024 - GL_STENCIL_CLEAR_VALUE = 2961 - GL_STENCIL_FAIL = 2964 - GL_STENCIL_FUNC = 2962 - GL_STENCIL_INDEX8 = 36168 - GL_STENCIL_PASS_DEPTH_FAIL = 2965 - GL_STENCIL_PASS_DEPTH_PASS = 2966 - GL_STENCIL_REF = 2967 - GL_STENCIL_TEST = 2960 - GL_STENCIL_VALUE_MASK = 2963 - GL_STENCIL_WRITEMASK = 2968 - GL_STREAM_COPY = 35042 - GL_STREAM_DRAW = 35040 - GL_STREAM_READ = 35041 - GL_SUBPIXEL_BITS = 3408 - GL_SYNC_CONDITION = 37139 - GL_SYNC_FENCE = 37142 - GL_SYNC_FLAGS = 37141 - GL_SYNC_STATUS = 37140 - GL_TEXTURE = 5890 - GL_TEXTURE0 = 33984 - GL_TEXTURE1 = 33985 - GL_TEXTURE10 = 33994 - GL_TEXTURE11 = 33995 - GL_TEXTURE12 = 33996 - GL_TEXTURE13 = 33997 - GL_TEXTURE14 = 33998 - GL_TEXTURE15 = 33999 - GL_TEXTURE16 = 34000 - GL_TEXTURE17 = 34001 - GL_TEXTURE18 = 34002 - GL_TEXTURE19 = 34003 - GL_TEXTURE2 = 33986 - GL_TEXTURE20 = 34004 - GL_TEXTURE21 = 34005 - GL_TEXTURE22 = 34006 - GL_TEXTURE23 = 34007 - GL_TEXTURE24 = 34008 - GL_TEXTURE25 = 34009 - GL_TEXTURE26 = 34010 - GL_TEXTURE27 = 34011 - GL_TEXTURE28 = 34012 - GL_TEXTURE29 = 34013 - GL_TEXTURE3 = 33987 - GL_TEXTURE30 = 34014 - GL_TEXTURE31 = 34015 - GL_TEXTURE4 = 33988 - GL_TEXTURE5 = 33989 - GL_TEXTURE6 = 33990 - GL_TEXTURE7 = 33991 - GL_TEXTURE8 = 33992 - GL_TEXTURE9 = 33993 - GL_TEXTURE_2D = 3553 - GL_TEXTURE_2D_ARRAY = 35866 - GL_TEXTURE_3D = 32879 - GL_TEXTURE_BASE_LEVEL = 33084 - GL_TEXTURE_BINDING_2D = 32873 - GL_TEXTURE_BINDING_2D_ARRAY = 35869 - GL_TEXTURE_BINDING_3D = 32874 - GL_TEXTURE_BINDING_CUBE_MAP = 34068 - GL_TEXTURE_COMPARE_FUNC = 34893 - GL_TEXTURE_COMPARE_MODE = 34892 - GL_TEXTURE_CUBE_MAP = 34067 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074 - GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073 - GL_TEXTURE_IMMUTABLE_FORMAT = 37167 - GL_TEXTURE_IMMUTABLE_LEVELS = 33503 - GL_TEXTURE_MAG_FILTER = 10240 - GL_TEXTURE_MAX_LEVEL = 33085 - GL_TEXTURE_MAX_LOD = 33083 - GL_TEXTURE_MIN_FILTER = 10241 - GL_TEXTURE_MIN_LOD = 33082 - GL_TEXTURE_SWIZZLE_A = 36421 - GL_TEXTURE_SWIZZLE_B = 36420 - GL_TEXTURE_SWIZZLE_G = 36419 - GL_TEXTURE_SWIZZLE_R = 36418 - GL_TEXTURE_WRAP_R = 32882 - GL_TEXTURE_WRAP_S = 10242 - GL_TEXTURE_WRAP_T = 10243 - GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFF - GL_TRANSFORM_FEEDBACK_ACTIVE = 36388 - GL_TRANSFORM_FEEDBACK_BINDING = 36389 - GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 35983 - GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 35967 - GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 35973 - GL_TRANSFORM_FEEDBACK_BUFFER_START = 35972 - GL_TRANSFORM_FEEDBACK_PAUSED = 36387 - GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 35976 - GL_TRANSFORM_FEEDBACK_VARYINGS = 35971 - GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 35958 - GL_TRIANGLES = 4 - GL_TRIANGLE_FAN = 6 - GL_TRIANGLE_STRIP = 5 - GL_TRUE = 1 - GL_UNIFORM_ARRAY_STRIDE = 35388 - GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 35394 - GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 35395 - GL_UNIFORM_BLOCK_BINDING = 35391 - GL_UNIFORM_BLOCK_DATA_SIZE = 35392 - GL_UNIFORM_BLOCK_INDEX = 35386 - GL_UNIFORM_BLOCK_NAME_LENGTH = 35393 - GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 35398 - GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 35396 - GL_UNIFORM_BUFFER = 35345 - GL_UNIFORM_BUFFER_BINDING = 35368 - GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 35380 - GL_UNIFORM_BUFFER_SIZE = 35370 - GL_UNIFORM_BUFFER_START = 35369 - GL_UNIFORM_IS_ROW_MAJOR = 35390 - GL_UNIFORM_MATRIX_STRIDE = 35389 - GL_UNIFORM_NAME_LENGTH = 35385 - GL_UNIFORM_OFFSET = 35387 - GL_UNIFORM_SIZE = 35384 - GL_UNIFORM_TYPE = 35383 - GL_UNPACK_ALIGNMENT = 3317 - GL_UNPACK_IMAGE_HEIGHT = 32878 - GL_UNPACK_ROW_LENGTH = 3314 - GL_UNPACK_SKIP_IMAGES = 32877 - GL_UNPACK_SKIP_PIXELS = 3316 - GL_UNPACK_SKIP_ROWS = 3315 - GL_UNSIGNALED = 37144 - GL_UNSIGNED_BYTE = 5121 - GL_UNSIGNED_INT = 5125 - GL_UNSIGNED_INT_10F_11F_11F_REV = 35899 - GL_UNSIGNED_INT_24_8 = 34042 - GL_UNSIGNED_INT_2_10_10_10_REV = 33640 - GL_UNSIGNED_INT_5_9_9_9_REV = 35902 - GL_UNSIGNED_INT_SAMPLER_2D = 36306 - GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311 - GL_UNSIGNED_INT_SAMPLER_3D = 36307 - GL_UNSIGNED_INT_SAMPLER_CUBE = 36308 - GL_UNSIGNED_INT_VEC2 = 36294 - GL_UNSIGNED_INT_VEC3 = 36295 - GL_UNSIGNED_INT_VEC4 = 36296 - GL_UNSIGNED_NORMALIZED = 35863 - GL_UNSIGNED_SHORT = 5123 - GL_UNSIGNED_SHORT_4_4_4_4 = 32819 - GL_UNSIGNED_SHORT_5_5_5_1 = 32820 - GL_UNSIGNED_SHORT_5_6_5 = 33635 - GL_VALIDATE_STATUS = 35715 - GL_VENDOR = 7936 - GL_VERSION = 7938 - GL_VERTEX_ARRAY_BINDING = 34229 - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 35070 - GL_VERTEX_ATTRIB_ARRAY_ENABLED = 34338 - GL_VERTEX_ATTRIB_ARRAY_INTEGER = 35069 - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922 - GL_VERTEX_ATTRIB_ARRAY_POINTER = 34373 - GL_VERTEX_ATTRIB_ARRAY_SIZE = 34339 - GL_VERTEX_ATTRIB_ARRAY_STRIDE = 34340 - GL_VERTEX_ATTRIB_ARRAY_TYPE = 34341 - GL_VERTEX_SHADER = 35633 - GL_VIEWPORT = 2978 - GL_ZERO = 0 -) diff --git a/gles3/errors.go b/gles3/errors.go deleted file mode 100644 index 143571f..0000000 --- a/gles3/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 diff --git a/gles3/functions.go b/gles3/functions.go deleted file mode 100644 index 40a9c05..0000000 --- a/gles3/functions.go +++ /dev/null @@ -1,259 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -// BeginQuery calls the underlying C function. -func BeginQuery(target GLenum, id GLuint) { - capi.GlBeginQuery(capi.GLenum(target), capi.GLuint(id)) -} - -// BeginTransformFeedback calls the underlying C function. -func BeginTransformFeedback(primitiveMode GLenum) { - capi.GlBeginTransformFeedback(capi.GLenum(primitiveMode)) -} - -// BindBufferBase calls the underlying C function. -func BindBufferBase(target GLenum, index GLuint, buffer GLuint) { - capi.GlBindBufferBase(capi.GLenum(target), capi.GLuint(index), capi.GLuint(buffer)) -} - -// BindBufferRange calls the underlying C function. -func BindBufferRange(target GLenum, index GLuint, buffer GLuint, offset GLintptr, size GLsizeiptr) { - capi.GlBindBufferRange(capi.GLenum(target), capi.GLuint(index), capi.GLuint(buffer), capi.GLintptr(offset), capi.GLsizeiptr(size)) -} - -// BindSampler calls the underlying C function. -func BindSampler(unit GLuint, sampler GLuint) { - capi.GlBindSampler(capi.GLuint(unit), capi.GLuint(sampler)) -} - -// BindTransformFeedback calls the underlying C function. -func BindTransformFeedback(target GLenum, id GLuint) { - capi.GlBindTransformFeedback(capi.GLenum(target), capi.GLuint(id)) -} - -// BindVertexArray calls the underlying C function. -func BindVertexArray(array GLuint) { - capi.GlBindVertexArray(capi.GLuint(array)) -} - -// BlitFramebuffer calls the underlying C function. -func BlitFramebuffer(srcX0 GLint, srcY0 GLint, srcX1 GLint, srcY1 GLint, dstX0 GLint, dstY0 GLint, dstX1 GLint, dstY1 GLint, mask GLbitfield, filter GLenum) { - capi.GlBlitFramebuffer(capi.GLint(srcX0), capi.GLint(srcY0), capi.GLint(srcX1), capi.GLint(srcY1), capi.GLint(dstX0), capi.GLint(dstY0), capi.GLint(dstX1), capi.GLint(dstY1), capi.GLbitfield(mask), capi.GLenum(filter)) -} - -// ClearBufferfi calls the underlying C function. -func ClearBufferfi(buffer GLenum, drawbuffer GLint, depth GLfloat, stencil GLint) { - capi.GlClearBufferfi(capi.GLenum(buffer), capi.GLint(drawbuffer), capi.GLfloat(depth), capi.GLint(stencil)) -} - -// ClearBufferfv calls the underlying C function. -func ClearBufferfv(buffer GLenum, drawbuffer GLint, value *GLfloat) { - capi.GlClearBufferfv(capi.GLenum(buffer), capi.GLint(drawbuffer), (*capi.GLfloat)(value)) -} - -// ClearBufferiv calls the underlying C function. -func ClearBufferiv(buffer GLenum, drawbuffer GLint, value *GLint) { - capi.GlClearBufferiv(capi.GLenum(buffer), capi.GLint(drawbuffer), (*capi.GLint)(value)) -} - -// ClientWaitSync calls the underlying C function. -func ClientWaitSync(sync GLsync, flags GLbitfield, timeout GLuint64) GLenum { - return (GLenum)(capi.GlClientWaitSync(capi.GLsync(sync), capi.GLbitfield(flags), capi.GLuint64(timeout))) -} - -// CopyBufferSubData calls the underlying C function. -func CopyBufferSubData(readTarget GLenum, writeTarget GLenum, readOffset GLintptr, writeOffset GLintptr, size GLsizeiptr) { - capi.GlCopyBufferSubData(capi.GLenum(readTarget), capi.GLenum(writeTarget), capi.GLintptr(readOffset), capi.GLintptr(writeOffset), capi.GLsizeiptr(size)) -} - -// DeleteQueries calls the underlying C function. -func DeleteQueries(n GLsizei, ids *GLuint) { - capi.GlDeleteQueries(capi.GLsizei(n), (*capi.GLuint)(ids)) -} - -// DeleteSamplers calls the underlying C function. -func DeleteSamplers(count GLsizei, samplers *GLuint) { - capi.GlDeleteSamplers(capi.GLsizei(count), (*capi.GLuint)(samplers)) -} - -// DeleteSync calls the underlying C function. -func DeleteSync(sync GLsync) { - capi.GlDeleteSync(capi.GLsync(sync)) -} - -// DeleteTransformFeedbacks calls the underlying C function. -func DeleteTransformFeedbacks(n GLsizei, ids *GLuint) { - capi.GlDeleteTransformFeedbacks(capi.GLsizei(n), (*capi.GLuint)(ids)) -} - -// DeleteVertexArrays calls the underlying C function. -func DeleteVertexArrays(n GLsizei, arrays *GLuint) { - capi.GlDeleteVertexArrays(capi.GLsizei(n), (*capi.GLuint)(arrays)) -} - -// DrawArraysInstanced calls the underlying C function. -func DrawArraysInstanced(mode GLenum, first GLint, count GLsizei, instancecount GLsizei) { - capi.GlDrawArraysInstanced(capi.GLenum(mode), capi.GLint(first), capi.GLsizei(count), capi.GLsizei(instancecount)) -} - -// DrawBuffers calls the underlying C function. -func DrawBuffers(n GLsizei, bufs *GLenum) { - capi.GlDrawBuffers(capi.GLsizei(n), (*capi.GLenum)(bufs)) -} - -// DrawElementsInstanced calls the underlying C function. -func DrawElementsInstanced(mode GLenum, count GLsizei, _type GLenum, indices unsafe.Pointer, instancecount GLsizei) { - capi.GlDrawElementsInstanced(capi.GLenum(mode), capi.GLsizei(count), capi.GLenum(_type), indices, capi.GLsizei(instancecount)) -} - -// DrawRangeElements calls the underlying C function. -func DrawRangeElements(mode GLenum, start GLuint, end GLuint, count GLsizei, _type GLenum, indices unsafe.Pointer) { - capi.GlDrawRangeElements(capi.GLenum(mode), capi.GLuint(start), capi.GLuint(end), capi.GLsizei(count), capi.GLenum(_type), indices) -} - -// EndQuery calls the underlying C function. -func EndQuery(target GLenum) { - capi.GlEndQuery(capi.GLenum(target)) -} - -// EndTransformFeedback calls the underlying C function. -func EndTransformFeedback() { - capi.GlEndTransformFeedback() -} - -// FenceSync calls the underlying C function. -func FenceSync(condition GLenum, flags GLbitfield) GLsync { - return (GLsync)(capi.GlFenceSync(capi.GLenum(condition), capi.GLbitfield(flags))) -} - -// GlFinish calls the underlying C function. -func GlFinish() { - capi.GlFinish() -} - -// GlFlush calls the underlying C function. -func GlFlush() { - capi.GlFlush() -} - -// FlushMappedBufferRange calls the underlying C function. -func FlushMappedBufferRange(target GLenum, offset GLintptr, length GLsizeiptr) { - capi.GlFlushMappedBufferRange(capi.GLenum(target), capi.GLintptr(offset), capi.GLsizeiptr(length)) -} - -// FramebufferTextureLayer calls the underlying C function. -func FramebufferTextureLayer(target GLenum, attachment GLenum, texture GLuint, level GLint, layer GLint) { - capi.GlFramebufferTextureLayer(capi.GLenum(target), capi.GLenum(attachment), capi.GLuint(texture), capi.GLint(level), capi.GLint(layer)) -} - -// GenQueries calls the underlying C function. -func GenQueries(n GLsizei, ids *GLuint) { - capi.GlGenQueries(capi.GLsizei(n), (*capi.GLuint)(ids)) -} - -// GenSamplers calls the underlying C function. -func GenSamplers(count GLsizei, samplers *GLuint) { - capi.GlGenSamplers(capi.GLsizei(count), (*capi.GLuint)(samplers)) -} - -// GenTransformFeedbacks calls the underlying C function. -func GenTransformFeedbacks(n GLsizei, ids *GLuint) { - capi.GlGenTransformFeedbacks(capi.GLsizei(n), (*capi.GLuint)(ids)) -} - -// GenVertexArrays calls the underlying C function. -func GenVertexArrays(n GLsizei, arrays *GLuint) { - capi.GlGenVertexArrays(capi.GLsizei(n), (*capi.GLuint)(arrays)) -} - -// GetQueryObjectuiv calls the underlying C function. -func GetQueryObjectuiv(id GLuint, pname GLenum, params *GLuint) { - capi.GlGetQueryObjectuiv(capi.GLuint(id), capi.GLenum(pname), (*capi.GLuint)(params)) -} - -// GetString calls the underlying C function. -func GetString(name GLenum) *GLubyte { - return (*GLubyte)(capi.GlGetString(capi.GLenum(name))) -} - -// GetStringi calls the underlying C function. -func GetStringi(name GLenum, index GLuint) *GLubyte { - return (*GLubyte)(capi.GlGetStringi(capi.GLenum(name), capi.GLuint(index))) -} - -// InvalidateFramebuffer calls the underlying C function. -func InvalidateFramebuffer(target GLenum, numAttachments GLsizei, attachments *GLenum) { - capi.GlInvalidateFramebuffer(capi.GLenum(target), capi.GLsizei(numAttachments), (*capi.GLenum)(attachments)) -} - -// MapBufferRange calls the underlying C function. -func MapBufferRange(target GLenum, offset GLintptr, length GLsizeiptr, access GLbitfield) unsafe.Pointer { - return (unsafe.Pointer)(capi.GlMapBufferRange(capi.GLenum(target), capi.GLintptr(offset), capi.GLsizeiptr(length), capi.GLbitfield(access))) -} - -// GlPauseTransformFeedback calls the underlying C function. -func GlPauseTransformFeedback() { - capi.GlPauseTransformFeedback() -} - -// ReadBuffer calls the underlying C function. -func ReadBuffer(src GLenum) { - capi.GlReadBuffer(capi.GLenum(src)) -} - -// GlReleaseShaderCompiler calls the underlying C function. -func GlReleaseShaderCompiler() { - capi.GlReleaseShaderCompiler() -} - -// RenderbufferStorageMultisample calls the underlying C function. -func RenderbufferStorageMultisample(target GLenum, samples GLsizei, internalformat GLenum, width GLsizei, height GLsizei) { - capi.GlRenderbufferStorageMultisample(capi.GLenum(target), capi.GLsizei(samples), capi.GLenum(internalformat), capi.GLsizei(width), capi.GLsizei(height)) -} - -// GlResumeTransformFeedback calls the underlying C function. -func GlResumeTransformFeedback() { - capi.GlResumeTransformFeedback() -} - -// SamplerParameteri calls the underlying C function. -func SamplerParameteri(sampler GLuint, pname GLenum, param GLint) { - capi.GlSamplerParameteri(capi.GLuint(sampler), capi.GLenum(pname), capi.GLint(param)) -} - -// TexStorage2D calls the underlying C function. -func TexStorage2D(target GLenum, levels GLsizei, internalformat GLenum, width GLsizei, height GLsizei) { - capi.GlTexStorage2D(capi.GLenum(target), capi.GLsizei(levels), capi.GLenum(internalformat), capi.GLsizei(width), capi.GLsizei(height)) -} - -// TexStorage3D calls the underlying C function. -func TexStorage3D(target GLenum, levels GLsizei, internalformat GLenum, width GLsizei, height GLsizei, depth GLsizei) { - capi.GlTexStorage3D(capi.GLenum(target), capi.GLsizei(levels), capi.GLenum(internalformat), capi.GLsizei(width), capi.GLsizei(height), capi.GLsizei(depth)) -} - -// TexSubImage3D calls the underlying C function. -func TexSubImage3D(target GLenum, level GLint, xoffset GLint, yoffset GLint, zoffset GLint, width GLsizei, height GLsizei, depth GLsizei, format GLenum, _type GLenum, pixels unsafe.Pointer) { - capi.GlTexSubImage3D(capi.GLenum(target), capi.GLint(level), capi.GLint(xoffset), capi.GLint(yoffset), capi.GLint(zoffset), capi.GLsizei(width), capi.GLsizei(height), capi.GLsizei(depth), capi.GLenum(format), capi.GLenum(_type), pixels) -} - -// TransformFeedbackVaryings calls the underlying C function. -func TransformFeedbackVaryings(program GLuint, count GLsizei, varyings **GLchar, bufferMode GLenum) { - capi.GlTransformFeedbackVaryings(capi.GLuint(program), capi.GLsizei(count), (**capi.GLchar)(varyings), capi.GLenum(bufferMode)) -} - -// UnmapBuffer calls the underlying C function. -func UnmapBuffer(target GLenum) GLboolean { - return (GLboolean)(capi.GlUnmapBuffer(capi.GLenum(target))) -} - -// WaitSync calls the underlying C function. -func WaitSync(sync GLsync, flags GLbitfield, timeout GLuint64) { - capi.GlWaitSync(capi.GLsync(sync), capi.GLbitfield(flags), capi.GLuint64(timeout)) -} diff --git a/gles3/glbitfield.go b/gles3/glbitfield.go deleted file mode 100644 index 1bf3c64..0000000 --- a/gles3/glbitfield.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -type GLbitfield uint32 - -const ( - SyncFlushCommandsBit GLbitfield = 1 -) diff --git a/gles3/glboolean.go b/gles3/glboolean.go deleted file mode 100644 index 7c7f2b9..0000000 --- a/gles3/glboolean.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLboolean = capi.GLboolean diff --git a/gles3/glbyte.go b/gles3/glbyte.go deleted file mode 100644 index 6562326..0000000 --- a/gles3/glbyte.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLbyte = capi.GLbyte diff --git a/gles3/glchar.go b/gles3/glchar.go deleted file mode 100644 index fe25548..0000000 --- a/gles3/glchar.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLchar = capi.GLchar diff --git a/gles3/glclampf.go b/gles3/glclampf.go deleted file mode 100644 index 26df8ed..0000000 --- a/gles3/glclampf.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLclampf = capi.GLclampf diff --git a/gles3/glenum.go b/gles3/glenum.go deleted file mode 100644 index b0ca839..0000000 --- a/gles3/glenum.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -type GLenum uint32 - -const ( - SyncGpuCommandsComplete GLenum = 37143 - AlreadySignaled GLenum = 37146 - TimeoutExpired GLenum = 37147 - ConditionSatisfied GLenum = 37148 - WaitFailed GLenum = 37149 - TransformFeedback GLenum = 36386 - TransformFeedbackBuffer GLenum = 35982 - InterleavedAttribs GLenum = 35980 - SeparateAttribs GLenum = 35981 -) diff --git a/gles3/glfixed.go b/gles3/glfixed.go deleted file mode 100644 index 71c5efd..0000000 --- a/gles3/glfixed.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLfixed = capi.GLfixed diff --git a/gles3/glfloat.go b/gles3/glfloat.go deleted file mode 100644 index 1adb6d6..0000000 --- a/gles3/glfloat.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLfloat = capi.GLfloat diff --git a/gles3/glhalf.go b/gles3/glhalf.go deleted file mode 100644 index 8f9b0df..0000000 --- a/gles3/glhalf.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLhalf = capi.GLhalf diff --git a/gles3/glint.go b/gles3/glint.go deleted file mode 100644 index aa72e4c..0000000 --- a/gles3/glint.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLint = capi.GLint diff --git a/gles3/glint64.go b/gles3/glint64.go deleted file mode 100644 index 6ee59a6..0000000 --- a/gles3/glint64.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLint64 = capi.GLint64 diff --git a/gles3/glintptr.go b/gles3/glintptr.go deleted file mode 100644 index 5677d6e..0000000 --- a/gles3/glintptr.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLintptr = capi.GLintptr diff --git a/gles3/glshort.go b/gles3/glshort.go deleted file mode 100644 index e9608f4..0000000 --- a/gles3/glshort.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLshort = capi.GLshort diff --git a/gles3/glsizei.go b/gles3/glsizei.go deleted file mode 100644 index cc35054..0000000 --- a/gles3/glsizei.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLsizei = capi.GLsizei diff --git a/gles3/glsizeiptr.go b/gles3/glsizeiptr.go deleted file mode 100644 index efd4051..0000000 --- a/gles3/glsizeiptr.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLsizeiptr = capi.GLsizeiptr diff --git a/gles3/glsync.go b/gles3/glsync.go deleted file mode 100644 index b6be626..0000000 --- a/gles3/glsync.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLsync = capi.GLsync diff --git a/gles3/glubyte.go b/gles3/glubyte.go deleted file mode 100644 index 07d2e94..0000000 --- a/gles3/glubyte.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLubyte = capi.GLubyte diff --git a/gles3/gluint.go b/gles3/gluint.go deleted file mode 100644 index e887db3..0000000 --- a/gles3/gluint.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLuint = capi.GLuint diff --git a/gles3/gluint64.go b/gles3/gluint64.go deleted file mode 100644 index 5e7a3a1..0000000 --- a/gles3/gluint64.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLuint64 = capi.GLuint64 diff --git a/gles3/glushort.go b/gles3/glushort.go deleted file mode 100644 index fe52490..0000000 --- a/gles3/glushort.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package gles3 - -import ( - capi "github.com/AndroidGoLab/ndk/capi/gles3" -) - -type GLushort = capi.GLushort diff --git a/gles3/package.go b/gles3/package.go deleted file mode 100644 index 9fb18a9..0000000 --- a/gles3/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package gles3 provides Go bindings for OpenGL ES 3.0. -package gles3 diff --git a/go.mod b/go.mod index 9c1c2a1..a28a3f5 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,46 @@ -module github.com/AndroidGoLab/ndk +module github.com/xaionaro-go/ndk -go 1.26.0 +go 1.23.0 + +toolchain go1.24.1 require ( - github.com/spf13/cobra v1.10.2 - github.com/stretchr/testify v1.12.1 - google.golang.org/grpc v1.84.0 - google.golang.org/protobuf v1.36.12 - gopkg.in/yaml.v3 v3.0.1 + fyne.io/fyne/v2 v2.5.2 + github.com/go-gl/glfw v0.0.0-20240506104042-037f3cc74f2a + github.com/gooid/gl v0.0.0-20181224113508-8824276cb763 + github.com/gooid/imgui v0.0.0-20190318024238-42578a0d601e + github.com/spf13/pflag v1.0.5 + github.com/xaionaro-go/camera v0.0.0-20241109194326-e68128663eb8 ) require ( - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/rogpeppe/go-internal v1.16.0 // indirect - github.com/spf13/pflag v1.0.10 // indirect - go.yaml.in/yaml/v3 v3.0.5 // indirect - golang.org/x/net v0.59.0 // indirect - golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.42.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260918162117-cecb64721679 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + fyne.io/systray v1.11.0 // indirect + github.com/BurntSushi/toml v1.4.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fredbi/uri v1.1.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect + github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a // indirect + github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect + github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect + github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a // indirect + github.com/go-text/render v0.2.0 // indirect + github.com/go-text/typesetting v0.2.0 // indirect + github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gopherjs/gopherjs v1.17.2 // indirect + github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49 // indirect + github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect + github.com/nicksnyder/go-i18n/v2 v2.4.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rymdport/portal v0.2.6 // indirect + github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect + github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect + github.com/stretchr/testify v1.8.4 // indirect + github.com/yuin/goldmark v1.7.1 // indirect + golang.org/x/image v0.18.0 // indirect + golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect + golang.org/x/net v0.39.0 // indirect + golang.org/x/sys v0.32.0 // indirect + golang.org/x/text v0.24.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 2c42de2..4c47d8a 100644 --- a/go.sum +++ b/go.sum @@ -1,49 +1,665 @@ -github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +fyne.io/fyne/v2 v2.5.2 h1:eSyGTmSkv10yAdAeHpDet6u2KkKxOGFc14kQu81We7Q= +fyne.io/fyne/v2 v2.5.2/go.mod h1:26gqPDvtaxHeyct+C0BBjuGd2zwAJlPkUGSBrb+d7Ug= +fyne.io/systray v1.11.0 h1:D9HISlxSkx+jHSniMBR6fCFOUjk1x/OOOJLa9lJYAKg= +fyne.io/systray v1.11.0/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= +github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= +github.com/fredbi/uri v1.1.0 h1:OqLpTXtyRg9ABReqvDGdJPqZUxs8cyBDOMXBbskCaB8= +github.com/fredbi/uri v1.1.0/go.mod h1:aYTUoAXBOq7BLfVJ8GnKmfcuURosB1xyHDIfWeC/iW4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe h1:A/wiwvQ0CAjPkuJytaD+SsXkPU0asQ+guQEIg1BJGX4= +github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe/go.mod h1:d4clgH0/GrRwWjRzJJQXxT/h1TyuNSfF/X64zb/3Ggg= +github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a h1:ybgRdYvAHTn93HW79bLiBiJwVL4jVeyGQRZMgImoeWs= +github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a/go.mod h1:gsGA2dotD4v0SR6PmPCYvS9JuOeMwAtmfvDE7mbYXMY= +github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 h1:hnLq+55b7Zh7/2IRzWCpiTcAvjv/P8ERF+N7+xXbZhk= +github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2/go.mod h1:eO7W361vmlPOrykIg+Rsh1SZ3tQBaOsfzZhsIOb/Lm0= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 h1:zDw5v7qm4yH7N8C8uWd+8Ii9rROdgWxQuGoJ9WDXxfk= +github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw v0.0.0-20240506104042-037f3cc74f2a h1:FAC6eA052T8d4Lp5GR38Sxta8fnq//jjBGDtsT0TVAU= +github.com/go-gl/glfw v0.0.0-20240506104042-037f3cc74f2a/go.mod h1:wyvWpaEu9B/VQiV1jsPs7Mha9I7yto/HqIBw197ZAzk= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a h1:vxnBhFDDT+xzxf1jTJKMKZw3H0swfWk9RpWbBbDK5+0= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-text/render v0.2.0 h1:LBYoTmp5jYiJ4NPqDc2pz17MLmA3wHw1dZSVGcOdeAc= +github.com/go-text/render v0.2.0/go.mod h1:CkiqfukRGKJA5vZZISkjSYrcdtgKQWRa2HIzvwNN5SU= +github.com/go-text/typesetting v0.2.0 h1:fbzsgbmk04KiWtE+c3ZD4W2nmCRzBqrqQOvYlwAOdho= +github.com/go-text/typesetting v0.2.0/go.mod h1:2+owI/sxa73XA581LAzVuEBZ3WEEV2pXeDswCH/3i1I= +github.com/go-text/typesetting-utils v0.0.0-20240317173224-1986cbe96c66 h1:GUrm65PQPlhFSKjLPGOZNPNxLCybjzjYBzjfoBGaDUY= +github.com/go-text/typesetting-utils v0.0.0-20240317173224-1986cbe96c66/go.mod h1:DDxDdQEnB70R8owOx3LVpEFvpMK9eeH1o2r0yZhFI9o= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= +github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y= +github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gooid/gl v0.0.0-20181224113508-8824276cb763 h1:nLvgla3uS4ZgCamkzIw7b+MHlkk36k8/20RbuUDpBXs= +github.com/gooid/gl v0.0.0-20181224113508-8824276cb763/go.mod h1:El9GoTfZ/G289rA1OLSb0ohVDOeepv8cLbM5TM4v87g= +github.com/gooid/imgui v0.0.0-20190318024238-42578a0d601e h1:sQwXQtzFxe+FBRnGzItORZ0dJv/aDiMfX+kq26v3wh0= +github.com/gooid/imgui v0.0.0-20190318024238-42578a0d601e/go.mod h1:pcOy79QA1bl0Lft2fyE+He4sSXM2S7r+q5heTn1al70= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20211219123610-ec9572f70e60/go.mod h1:cz9oNYuRUWGdHmLF2IodMLkAhcPtXeULvcBNagUrxTI= +github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g= +github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= +github.com/goxjs/gl v0.0.0-20210104184919-e3fafc6f8f2a/go.mod h1:dy/f2gjY09hwVfIyATps4G2ai7/hLwLkc5TrPqONuXY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49 h1:Po+wkNdMmN+Zj1tDsJQy7mJlPlwGNQd9JZoPjObagf8= +github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49/go.mod h1:YiutDnxPRLk5DLUFj6Rw4pRBBURZY07GFr54NdV9mQg= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e h1:LvL4XsI70QxOGHed6yhQtAU34Kx3Qq2wwBzGFKY8zKk= +github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g= -github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= -github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= -github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= -github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= -github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= -go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= -golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= -golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= -gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= -gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260918162117-cecb64721679 h1:KmqdJU4vrNcxy/6qdg3JduZtalEXrJLspVltnR1cE+8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260918162117-cecb64721679/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= -google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0= -google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0= -google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= -google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= +github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= +github.com/nicksnyder/go-i18n/v2 v2.4.0 h1:3IcvPOAvnCKwNm0TB0dLDTuawWEj+ax/RERNC+diLMM= +github.com/nicksnyder/go-i18n/v2 v2.4.0/go.mod h1:nxYSZE9M0bf3Y70gPQjN9ha7XNHX7gMc814+6wVyEI4= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= +github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/rymdport/portal v0.2.6 h1:HWmU3gORu7vWcpr7VSwUS2Xx1HtJXVcUuTqEZcMEsIg= +github.com/rymdport/portal v0.2.6/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= +github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c h1:km8GpoQut05eY3GiYWEedbTT0qnSxrCjsVbb7yKY1KE= +github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c/go.mod h1:cNQ3dwVJtS5Hmnjxy6AgTPd0Inb3pW05ftPSX7NZO7Q= +github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef h1:Ch6Q+AZUxDBCVqdkI8FSpFyZDtCVBc2VmejdNrm5rRQ= +github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef/go.mod h1:nXTWP6+gD5+LUJ8krVhhoeHjvHTutPxMYl5SvkcnJNE= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/xaionaro-go/camera v0.0.0-20241109194326-e68128663eb8 h1:mzjKy2OJywZ2nSSJz/noEDp4BmNYm6fiknRpAlyb0TY= +github.com/xaionaro-go/camera v0.0.0-20241109194326-e68128663eb8/go.mod h1:eaXtbA5jBvGDUR0F55aB9EImhiZX7aSPHIikB+uJ6fs= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U= +github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= +golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee/go.mod h1:pe2sM7Uk+2Su1y7u/6Z8KJ24D7lepUjFZbhFOrmDfuQ= +golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a h1:sYbmY3FwUWCBTodZL1S3JUuOvaW6kM2o+clDzzDNBWg= +golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a/go.mod h1:Ede7gF0KGoHlj822RtphAHK1jLdrcuRBZg0sF1Q+SPc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/handle/handle.go b/handle/handle.go deleted file mode 100644 index 2e3d849..0000000 --- a/handle/handle.go +++ /dev/null @@ -1,18 +0,0 @@ -// Package handle defines interfaces satisfied by all NDK handle types, -// enabling generic code and interoperability with external Android Go packages. -package handle - -import "unsafe" - -// NativeHandle is satisfied by any NDK opaque handle wrapper. -// All generated handle types (Window, Looper, Sensor, Stream, etc.) -// implement this interface via their Pointer() and UintPtr() methods. -type NativeHandle interface { - // Pointer returns the underlying C pointer as unsafe.Pointer. - Pointer() unsafe.Pointer - - // UintPtr returns the underlying C pointer as uintptr, - // suitable for gomobile bind and framework interop - // (golang.org/x/mobile, gioui.org, github.com/xlab/android-go). - UintPtr() uintptr -} diff --git a/hint/errors.go b/hint/errors.go deleted file mode 100644 index 0209f57..0000000 --- a/hint/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hint - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/hint/functions.go b/hint/functions.go deleted file mode 100644 index b553247..0000000 --- a/hint/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hint diff --git a/hint/manager.go b/hint/manager.go deleted file mode 100644 index cb54816..0000000 --- a/hint/manager.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hint - -import ( - "time" - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/performancehint" -) - -// Manager wraps the NDK APerformanceHintManager handle. -type Manager struct { - ptr *capi.APerformanceHintManager -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Manager) cptr() *capi.APerformanceHintManager { - if h == nil { - return nil - } - return h.ptr -} - -// NewManagerFromPointer wraps a raw APerformanceHintManager pointer. -func NewManagerFromPointer(ptr unsafe.Pointer) *Manager { - return &Manager{ptr: (*capi.APerformanceHintManager)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Manager) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Manager) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewManagerFromUintPtr wraps a uintptr as a Manager. -// The caller must ensure ptr points to a valid APerformanceHintManager. -func NewManagerFromUintPtr(ptr uintptr) *Manager { - return &Manager{ptr: (*capi.APerformanceHintManager)(unsafe.Pointer(ptr))} -} - -// CreateSession creates a new Session from this Manager. -func (h *Manager) CreateSession(threadIds *int32, size uint64, initialTargetWorkDuration time.Duration) *Session { - return &Session{ptr: capi.APerformanceHint_createSession(h.ptr, threadIds, size, int64(initialTargetWorkDuration.Nanoseconds()))} -} - -// PreferredUpdateRateNanos returns the value directly. -func (h *Manager) PreferredUpdateRateNanos() int64 { - return (int64)(capi.APerformanceHint_getPreferredUpdateRateNanos(h.ptr)) -} - -// APerformanceHint_getManager calls the underlying C function. -func APerformanceHint_getManager() *Manager { - return &Manager{ptr: capi.APerformanceHint_getManager()} -} diff --git a/hint/package.go b/hint/package.go deleted file mode 100644 index f7b5cfe..0000000 --- a/hint/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package hint provides Go bindings for Android performance hint management. -package hint diff --git a/hint/pid_t.go b/hint/pid_t.go deleted file mode 100644 index a3e6269..0000000 --- a/hint/pid_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hint - -import ( - capi "github.com/AndroidGoLab/ndk/capi/performancehint" -) - -type Pid_t = capi.Pid_t diff --git a/hint/session.go b/hint/session.go deleted file mode 100644 index f46ce5f..0000000 --- a/hint/session.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hint - -import ( - "time" - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/performancehint" -) - -// Session wraps the NDK APerformanceHintSession handle. -type Session struct { - ptr *capi.APerformanceHintSession -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Session) cptr() *capi.APerformanceHintSession { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Session) Close() error { - if h.ptr == nil { - return nil - } - capi.APerformanceHint_closeSession(h.ptr) - h.ptr = nil - return nil -} - -// NewSessionFromPointer wraps a raw APerformanceHintSession pointer. -func NewSessionFromPointer(ptr unsafe.Pointer) *Session { - return &Session{ptr: (*capi.APerformanceHintSession)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Session) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Session) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSessionFromUintPtr wraps a uintptr as a Session. -// The caller must ensure ptr points to a valid APerformanceHintSession. -func NewSessionFromUintPtr(ptr uintptr) *Session { - return &Session{ptr: (*capi.APerformanceHintSession)(unsafe.Pointer(ptr))} -} - -// ReportActualWorkDuration calls the underlying NDK function. -func (h *Session) ReportActualWorkDuration(actualDuration time.Duration) error { - return result(capi.APerformanceHint_reportActualWorkDuration(h.ptr, int64(actualDuration.Nanoseconds()))) -} - -// APerformanceHint_reportActualWorkDuration2 calls the underlying NDK function. -func (h *Session) APerformanceHint_reportActualWorkDuration2(workDuration *WorkDuration) error { - return result(capi.APerformanceHint_reportActualWorkDuration2(h.ptr, workDuration.cptr())) -} - -// APerformanceHint_setPreferPowerEfficiency calls the underlying NDK function. -func (h *Session) APerformanceHint_setPreferPowerEfficiency(enabled bool) error { - return result(capi.APerformanceHint_setPreferPowerEfficiency(h.ptr, enabled)) -} - -// APerformanceHint_setThreads calls the underlying NDK function. -func (h *Session) APerformanceHint_setThreads(threadIds *Pid_t, size uint64) error { - return result(capi.APerformanceHint_setThreads(h.ptr, (*capi.Pid_t)(threadIds), size)) -} - -// UpdateTargetWorkDuration calls the underlying NDK function. -func (h *Session) UpdateTargetWorkDuration(targetDuration time.Duration) error { - return result(capi.APerformanceHint_updateTargetWorkDuration(h.ptr, int64(targetDuration.Nanoseconds()))) -} diff --git a/hint/work_duration.go b/hint/work_duration.go deleted file mode 100644 index fc30379..0000000 --- a/hint/work_duration.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hint - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/performancehint" -) - -// WorkDuration wraps the NDK AWorkDuration handle. -type WorkDuration struct { - ptr *capi.AWorkDuration -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *WorkDuration) cptr() *capi.AWorkDuration { - if h == nil { - return nil - } - return h.ptr -} - -// NewWorkDuration creates a new WorkDuration. -func NewWorkDuration() *WorkDuration { - return &WorkDuration{ptr: capi.AWorkDuration_create()} -} - -// Close releases the underlying NDK handle. -func (h *WorkDuration) Close() error { - if h.ptr == nil { - return nil - } - capi.AWorkDuration_release(h.ptr) - h.ptr = nil - return nil -} - -// NewWorkDurationFromPointer wraps a raw AWorkDuration pointer. -func NewWorkDurationFromPointer(ptr unsafe.Pointer) *WorkDuration { - return &WorkDuration{ptr: (*capi.AWorkDuration)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *WorkDuration) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *WorkDuration) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewWorkDurationFromUintPtr wraps a uintptr as a WorkDuration. -// The caller must ensure ptr points to a valid AWorkDuration. -func NewWorkDurationFromUintPtr(ptr uintptr) *WorkDuration { - return &WorkDuration{ptr: (*capi.AWorkDuration)(unsafe.Pointer(ptr))} -} - -// SetActualCpuDurationNanos calls the underlying NDK function. -func (h *WorkDuration) SetActualCpuDurationNanos(actualCpuDurationNanos int64) { - capi.AWorkDuration_setActualCpuDurationNanos(h.ptr, actualCpuDurationNanos) -} - -// SetActualGpuDurationNanos calls the underlying NDK function. -func (h *WorkDuration) SetActualGpuDurationNanos(actualGpuDurationNanos int64) { - capi.AWorkDuration_setActualGpuDurationNanos(h.ptr, actualGpuDurationNanos) -} - -// SetActualTotalDurationNanos calls the underlying NDK function. -func (h *WorkDuration) SetActualTotalDurationNanos(actualTotalDurationNanos int64) { - capi.AWorkDuration_setActualTotalDurationNanos(h.ptr, actualTotalDurationNanos) -} - -// SetWorkPeriodStartTimestampNanos calls the underlying NDK function. -func (h *WorkDuration) SetWorkPeriodStartTimestampNanos(workPeriodStartTimestampNanos int64) { - capi.AWorkDuration_setWorkPeriodStartTimestampNanos(h.ptr, workPeriodStartTimestampNanos) -} diff --git a/hwbuf/arect.go b/hwbuf/arect.go deleted file mode 100644 index 4ec23a0..0000000 --- a/hwbuf/arect.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -import ( - capi "github.com/AndroidGoLab/ndk/capi/hardwarebuffer" -) - -type ARect = capi.ARect diff --git a/hwbuf/buffer.go b/hwbuf/buffer.go deleted file mode 100644 index e98afc8..0000000 --- a/hwbuf/buffer.go +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/hardwarebuffer" -) - -// Buffer wraps the NDK AHardwareBuffer handle. -type Buffer struct { - ptr *capi.AHardwareBuffer -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Buffer) cptr() *capi.AHardwareBuffer { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Buffer) Close() error { - if h.ptr == nil { - return nil - } - capi.AHardwareBuffer_release(h.ptr) - h.ptr = nil - return nil -} - -// NewBufferFromPointer wraps a raw AHardwareBuffer pointer. -func NewBufferFromPointer(ptr unsafe.Pointer) *Buffer { - return &Buffer{ptr: (*capi.AHardwareBuffer)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Buffer) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Buffer) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewBufferFromUintPtr wraps a uintptr as a Buffer. -// The caller must ensure ptr points to a valid AHardwareBuffer. -func NewBufferFromUintPtr(ptr uintptr) *Buffer { - return &Buffer{ptr: (*capi.AHardwareBuffer)(unsafe.Pointer(ptr))} -} - -// Acquire calls the underlying NDK function. -func (h *Buffer) Acquire() { - capi.AHardwareBuffer_acquire(h.ptr) -} - -// Describe calls the underlying NDK function. -func (h *Buffer) Describe() *Desc { - var outDescVal capi.AHardwareBuffer_Desc - capi.AHardwareBuffer_describe(h.ptr, &outDescVal) - return descFromCapi(&outDescVal) -} - -// GetID calls the underlying NDK function. -func (h *Buffer) GetID(outID *uint64) error { - return result(capi.AHardwareBuffer_getId(h.ptr, outID)) -} - -// Lock calls the underlying NDK function. -func (h *Buffer) Lock(usage uint64, fence int32, rect *ARect) (unsafe.Pointer, error) { - var outVirtualAddressPtr unsafe.Pointer - ret := capi.AHardwareBuffer_lock(h.ptr, usage, fence, (*capi.ARect)(rect), &outVirtualAddressPtr) - if err := result(ret); err != nil { - return nil, err - } - return outVirtualAddressPtr, nil -} - -// LockPlanes calls the underlying NDK function. -func (h *Buffer) LockPlanes(usage uint64, fence int32, rect *ARect, outPlanes *HardwareBuffer_Planes) error { - return result(capi.AHardwareBuffer_lockPlanes(h.ptr, usage, fence, (*capi.ARect)(rect), outPlanes.cptr())) -} - -// SendHandleToUnixSocket calls the underlying NDK function. -func (h *Buffer) SendHandleToUnixSocket(socketFd int32) error { - return result(capi.AHardwareBuffer_sendHandleToUnixSocket(h.ptr, socketFd)) -} - -// Unlock calls the underlying NDK function. -func (h *Buffer) Unlock(fence *int32) error { - return result(capi.AHardwareBuffer_unlock(h.ptr, fence)) -} diff --git a/hwbuf/desc.go b/hwbuf/desc.go deleted file mode 100644 index b532147..0000000 --- a/hwbuf/desc.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/hardwarebuffer" -) - -// Desc is a Go value type mirroring the NDK AHardwareBuffer_Desc C struct. -// Fields are layout-compatible with the C struct for zero-copy conversion. -type Desc struct { - Width uint32 - Height uint32 - Layers uint32 - Format uint32 - Usage uint64 - Stride uint32 - Rfu0 uint32 - Rfu1 uint64 -} - -// cptr returns a pointer to the capi representation. -// The Go struct is layout-compatible with the C struct. -func (s *Desc) cptr() *capi.AHardwareBuffer_Desc { - return (*capi.AHardwareBuffer_Desc)(unsafe.Pointer(s)) -} - -// descFromCapi creates a Desc from a capi pointer. -func descFromCapi(c *capi.AHardwareBuffer_Desc) *Desc { - return (*Desc)(unsafe.Pointer(c)) -} diff --git a/hwbuf/errors.go b/hwbuf/errors.go deleted file mode 100644 index 1deb065..0000000 --- a/hwbuf/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/hwbuf/format.go b/hwbuf/format.go deleted file mode 100644 index 816c73e..0000000 --- a/hwbuf/format.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -import "fmt" - -type Format int32 - -const ( - R8g8b8a8Unorm Format = 1 - R8g8b8x8Unorm Format = 2 - R8g8b8Unorm Format = 3 - R5g6b5Unorm Format = 4 - R16g16b16a16Float Format = 22 - R10g10b10a2Unorm Format = 43 - Blob Format = 33 - D16Unorm Format = 48 - D24Unorm Format = 49 - D24UnormS8Uint Format = 50 - D32Float Format = 51 - D32FloatS8Uint Format = 52 - S8Uint Format = 53 - Y8cb8cr8420 Format = 35 - YcbcrP010 Format = 54 - YcbcrP210 Format = 60 - R8Unorm Format = 56 - R16Uint Format = 57 - R16g16Uint Format = 58 - R10g10b10a10Unorm Format = 59 -) - -func (v Format) String() string { - switch v { - case R8g8b8a8Unorm: - return "R8g8b8a8Unorm" - case R8g8b8x8Unorm: - return "R8g8b8x8Unorm" - case R8g8b8Unorm: - return "R8g8b8Unorm" - case R5g6b5Unorm: - return "R5g6b5Unorm" - case R16g16b16a16Float: - return "R16g16b16a16Float" - case R10g10b10a2Unorm: - return "R10g10b10a2Unorm" - case Blob: - return "Blob" - case D16Unorm: - return "D16Unorm" - case D24Unorm: - return "D24Unorm" - case D24UnormS8Uint: - return "D24UnormS8Uint" - case D32Float: - return "D32Float" - case D32FloatS8Uint: - return "D32FloatS8Uint" - case S8Uint: - return "S8Uint" - case Y8cb8cr8420: - return "Y8cb8cr8420" - case YcbcrP010: - return "YcbcrP010" - case YcbcrP210: - return "YcbcrP210" - case R8Unorm: - return "R8Unorm" - case R16Uint: - return "R16Uint" - case R16g16Uint: - return "R16g16Uint" - case R10g10b10a10Unorm: - return "R10g10b10a10Unorm" - default: - return fmt.Sprintf("Format(%d)", int(v)) - } -} diff --git a/hwbuf/functions.go b/hwbuf/functions.go deleted file mode 100644 index 997c723..0000000 --- a/hwbuf/functions.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -import ( - capi "github.com/AndroidGoLab/ndk/capi/hardwarebuffer" -) - -// Allocate calls the underlying C function. -func Allocate(desc *Desc) (*Buffer, error) { - var outBufferPtr *capi.AHardwareBuffer - ret := capi.AHardwareBuffer_allocate(desc.cptr(), &outBufferPtr) - if err := result(int32(ret)); err != nil { - return nil, err - } - return &Buffer{ptr: outBufferPtr}, nil -} - -// IsSupported calls the underlying C function. -func IsSupported(desc *Desc) int32 { - return (int32)(capi.AHardwareBuffer_isSupported(desc.cptr())) -} - -// RecvHandleFromUnixSocket calls the underlying C function. -func RecvHandleFromUnixSocket(socketFd int32) (*Buffer, error) { - var outBufferPtr *capi.AHardwareBuffer - ret := capi.AHardwareBuffer_recvHandleFromUnixSocket(socketFd, &outBufferPtr) - if err := result(int32(ret)); err != nil { - return nil, err - } - return &Buffer{ptr: outBufferPtr}, nil -} diff --git a/hwbuf/hardware_buffer_plane.go b/hwbuf/hardware_buffer_plane.go deleted file mode 100644 index 0270a32..0000000 --- a/hwbuf/hardware_buffer_plane.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/hardwarebuffer" -) - -// HardwareBuffer_Plane wraps the NDK AHardwareBuffer_Plane handle. -type HardwareBuffer_Plane struct { - ptr *capi.AHardwareBuffer_Plane -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *HardwareBuffer_Plane) cptr() *capi.AHardwareBuffer_Plane { - if h == nil { - return nil - } - return h.ptr -} - -// NewHardwareBuffer_PlaneFromPointer wraps a raw AHardwareBuffer_Plane pointer. -func NewHardwareBuffer_PlaneFromPointer(ptr unsafe.Pointer) *HardwareBuffer_Plane { - return &HardwareBuffer_Plane{ptr: (*capi.AHardwareBuffer_Plane)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *HardwareBuffer_Plane) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *HardwareBuffer_Plane) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewHardwareBuffer_PlaneFromUintPtr wraps a uintptr as a HardwareBuffer_Plane. -// The caller must ensure ptr points to a valid AHardwareBuffer_Plane. -func NewHardwareBuffer_PlaneFromUintPtr(ptr uintptr) *HardwareBuffer_Plane { - return &HardwareBuffer_Plane{ptr: (*capi.AHardwareBuffer_Plane)(unsafe.Pointer(ptr))} -} diff --git a/hwbuf/hardware_buffer_planes.go b/hwbuf/hardware_buffer_planes.go deleted file mode 100644 index 4685922..0000000 --- a/hwbuf/hardware_buffer_planes.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/hardwarebuffer" -) - -// HardwareBuffer_Planes wraps the NDK AHardwareBuffer_Planes handle. -type HardwareBuffer_Planes struct { - ptr *capi.AHardwareBuffer_Planes -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *HardwareBuffer_Planes) cptr() *capi.AHardwareBuffer_Planes { - if h == nil { - return nil - } - return h.ptr -} - -// NewHardwareBuffer_PlanesFromPointer wraps a raw AHardwareBuffer_Planes pointer. -func NewHardwareBuffer_PlanesFromPointer(ptr unsafe.Pointer) *HardwareBuffer_Planes { - return &HardwareBuffer_Planes{ptr: (*capi.AHardwareBuffer_Planes)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *HardwareBuffer_Planes) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *HardwareBuffer_Planes) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewHardwareBuffer_PlanesFromUintPtr wraps a uintptr as a HardwareBuffer_Planes. -// The caller must ensure ptr points to a valid AHardwareBuffer_Planes. -func NewHardwareBuffer_PlanesFromUintPtr(ptr uintptr) *HardwareBuffer_Planes { - return &HardwareBuffer_Planes{ptr: (*capi.AHardwareBuffer_Planes)(unsafe.Pointer(ptr))} -} diff --git a/hwbuf/package.go b/hwbuf/package.go deleted file mode 100644 index 64b6e61..0000000 --- a/hwbuf/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package hwbuf provides Go bindings for Android HardwareBuffer. -package hwbuf diff --git a/hwbuf/usage.go b/hwbuf/usage.go deleted file mode 100644 index 1d5dc14..0000000 --- a/hwbuf/usage.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package hwbuf - -type Usage uint64 - -const ( - CpuReadNever Usage = 0 - CpuReadRarely Usage = 2 - CpuReadOften Usage = 3 - CpuReadMask Usage = 15 - CpuWriteNever Usage = 0 - CpuWriteRarely Usage = 32 - CpuWriteOften Usage = 48 - CpuWriteMask Usage = 240 - GpuSampledImage Usage = 256 - GpuFramebuffer Usage = 512 - GpuColorOutput Usage = 512 - ComposerOverlay Usage = 2048 - ProtectedContent Usage = 16384 - VideoEncode Usage = 65536 - SensorDirectData Usage = 8388608 - GpuDataBuffer Usage = 16777216 - GpuCubeMap Usage = 33554432 - GpuMipmapComplete Usage = 67108864 - FrontBuffer Usage = 4294967296 - Vendor0 Usage = 268435456 - Vendor1 Usage = 536870912 - Vendor2 Usage = 1073741824 - Vendor3 Usage = 0xFFFFFFFF80000000 - Vendor4 Usage = 281474976710656 - Vendor5 Usage = 562949953421312 - Vendor6 Usage = 1125899906842624 - Vendor7 Usage = 2251799813685248 - Vendor8 Usage = 4503599627370496 - Vendor9 Usage = 9007199254740992 - Vendor10 Usage = 18014398509481984 - Vendor11 Usage = 36028797018963968 - Vendor12 Usage = 72057594037927936 - Vendor13 Usage = 144115188075855872 - Vendor14 Usage = 288230376151711744 - Vendor15 Usage = 576460752303423488 - Vendor16 Usage = 1152921504606846976 - Vendor17 Usage = 2305843009213693952 - Vendor18 Usage = 4611686018427387904 - Vendor19 Usage = 0x8000000000000000 -) diff --git a/image/arect.go b/image/arect.go deleted file mode 100644 index 4162981..0000000 --- a/image/arect.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -type ARect = capi.ARect diff --git a/image/asset.go b/image/asset.go deleted file mode 100644 index ec70553..0000000 --- a/image/asset.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -// Asset wraps the NDK AAsset handle. -type Asset struct { - ptr *capi.AAsset -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Asset) cptr() *capi.AAsset { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Asset) Close() error { - if h.ptr == nil { - return nil - } - capi.AAsset_close(h.ptr) - h.ptr = nil - return nil -} - -// NewAssetFromPointer wraps a raw AAsset pointer. -func NewAssetFromPointer(ptr unsafe.Pointer) *Asset { - return &Asset{ptr: (*capi.AAsset)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Asset) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Asset) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewAssetFromUintPtr wraps a uintptr as a Asset. -// The caller must ensure ptr points to a valid AAsset. -func NewAssetFromUintPtr(ptr uintptr) *Asset { - return &Asset{ptr: (*capi.AAsset)(unsafe.Pointer(ptr))} -} - -// GetBuffer returns the value directly. -func (h *Asset) GetBuffer() unsafe.Pointer { - return (unsafe.Pointer)(capi.AAsset_getBuffer(h.ptr)) -} - -// IsAllocated calls the underlying NDK function. -func (h *Asset) IsAllocated() error { - return result(capi.AAsset_isAllocated(h.ptr)) -} - -// OpenFileDescriptor calls the underlying NDK function. -func (h *Asset) OpenFileDescriptor(outStart *Off_t, outLength *Off_t) error { - return result(capi.AAsset_openFileDescriptor(h.ptr, (*capi.Off_t)(outStart), (*capi.Off_t)(outLength))) -} - -// OpenFileDescriptor64 calls the underlying NDK function. -func (h *Asset) OpenFileDescriptor64(outStart *Off64_t, outLength *Off64_t) error { - return result(capi.AAsset_openFileDescriptor64(h.ptr, (*capi.Off64_t)(outStart), (*capi.Off64_t)(outLength))) -} - -// Read calls the underlying NDK function. -func (h *Asset) Read(buf unsafe.Pointer, count uint64) error { - return result(capi.AAsset_read(h.ptr, buf, count)) -} diff --git a/image/asset_dir.go b/image/asset_dir.go deleted file mode 100644 index 93b432c..0000000 --- a/image/asset_dir.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -// AssetDir wraps the NDK AAssetDir handle. -type AssetDir struct { - ptr *capi.AAssetDir -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *AssetDir) cptr() *capi.AAssetDir { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *AssetDir) Close() error { - if h.ptr == nil { - return nil - } - capi.AAssetDir_close(h.ptr) - h.ptr = nil - return nil -} - -// NewAssetDirFromPointer wraps a raw AAssetDir pointer. -func NewAssetDirFromPointer(ptr unsafe.Pointer) *AssetDir { - return &AssetDir{ptr: (*capi.AAssetDir)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *AssetDir) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *AssetDir) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewAssetDirFromUintPtr wraps a uintptr as a AssetDir. -// The caller must ensure ptr points to a valid AAssetDir. -func NewAssetDirFromUintPtr(ptr uintptr) *AssetDir { - return &AssetDir{ptr: (*capi.AAssetDir)(unsafe.Pointer(ptr))} -} - -// GetNextFileName returns the value directly. -func (h *AssetDir) GetNextFileName() string { - return (string)(capi.AAssetDir_getNextFileName(h.ptr)) -} - -// Rewind calls the underlying NDK function. -func (h *AssetDir) Rewind() { - capi.AAssetDir_rewind(h.ptr) -} diff --git a/image/asset_manager.go b/image/asset_manager.go deleted file mode 100644 index 3ef044e..0000000 --- a/image/asset_manager.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -// AssetManager wraps the NDK AAssetManager handle. -type AssetManager struct { - ptr *capi.AAssetManager -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *AssetManager) cptr() *capi.AAssetManager { - if h == nil { - return nil - } - return h.ptr -} - -// NewAssetManagerFromPointer wraps a raw AAssetManager pointer. -func NewAssetManagerFromPointer(ptr unsafe.Pointer) *AssetManager { - return &AssetManager{ptr: (*capi.AAssetManager)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *AssetManager) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *AssetManager) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewAssetManagerFromUintPtr wraps a uintptr as a AssetManager. -// The caller must ensure ptr points to a valid AAssetManager. -func NewAssetManagerFromUintPtr(ptr uintptr) *AssetManager { - return &AssetManager{ptr: (*capi.AAssetManager)(unsafe.Pointer(ptr))} -} - -// Open creates a new Asset from this AssetManager. -func (h *AssetManager) Open(filename string, mode int32) *Asset { - return &Asset{ptr: capi.AAssetManager_open(h.ptr, filename, mode)} -} - -// OpenDir creates a new AssetDir from this AssetManager. -func (h *AssetManager) OpenDir(dirName string) *AssetDir { - return &AssetDir{ptr: capi.AAssetManager_openDir(h.ptr, dirName)} -} diff --git a/image/asset_mode.go b/image/asset_mode.go deleted file mode 100644 index 3956e15..0000000 --- a/image/asset_mode.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -type ASSET_MODE int32 - -const ( - AASSET_MODE_UNKNOWN ASSET_MODE = 0 - AASSET_MODE_RANDOM ASSET_MODE = 1 - AASSET_MODE_STREAMING ASSET_MODE = 2 - AASSET_MODE_BUFFER ASSET_MODE = 3 -) diff --git a/image/decoder.go b/image/decoder.go deleted file mode 100644 index 747e6f3..0000000 --- a/image/decoder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -// Decoder wraps the NDK AImageDecoder handle. -type Decoder struct { - ptr *capi.AImageDecoder -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Decoder) cptr() *capi.AImageDecoder { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Decoder) Close() error { - if h.ptr == nil { - return nil - } - capi.AImageDecoder_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewDecoderFromPointer wraps a raw AImageDecoder pointer. -func NewDecoderFromPointer(ptr unsafe.Pointer) *Decoder { - return &Decoder{ptr: (*capi.AImageDecoder)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Decoder) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Decoder) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewDecoderFromUintPtr wraps a uintptr as a Decoder. -// The caller must ensure ptr points to a valid AImageDecoder. -func NewDecoderFromUintPtr(ptr uintptr) *Decoder { - return &Decoder{ptr: (*capi.AImageDecoder)(unsafe.Pointer(ptr))} -} - -// AdvanceFrame calls the underlying NDK function. -func (h *Decoder) AdvanceFrame() error { - return result(capi.AImageDecoder_advanceFrame(h.ptr)) -} - -// ComputeSampledSize calls the underlying NDK function. -func (h *Decoder) ComputeSampledSize(sampleSize int32, width *int32, height *int32) error { - return result(capi.AImageDecoder_computeSampledSize(h.ptr, sampleSize, width, height)) -} - -// Decode calls the underlying NDK function. -func (h *Decoder) Decode(pixels unsafe.Pointer, stride uint64, size uint64) error { - return result(capi.AImageDecoder_decodeImage(h.ptr, pixels, stride, size)) -} - -// GetFrameInfo calls the underlying NDK function. -func (h *Decoder) GetFrameInfo(info *ImageDecoderFrameInfo) error { - return result(capi.AImageDecoder_getFrameInfo(h.ptr, info.cptr())) -} - -// HeaderInfo creates a new HeaderInfo from this Decoder. -func (h *Decoder) HeaderInfo() *HeaderInfo { - return &HeaderInfo{ptr: capi.AImageDecoder_getHeaderInfo(h.ptr)} -} - -// MinimumStride returns the value directly. -func (h *Decoder) MinimumStride() uint64 { - return (uint64)(capi.AImageDecoder_getMinimumStride(h.ptr)) -} - -// GetRepeatCount calls the underlying NDK function. -func (h *Decoder) GetRepeatCount() error { - return result(capi.AImageDecoder_getRepeatCount(h.ptr)) -} - -// IsAnimated returns the value directly. -func (h *Decoder) IsAnimated() bool { - return (bool)(capi.AImageDecoder_isAnimated(h.ptr)) -} - -// Rewind calls the underlying NDK function. -func (h *Decoder) Rewind() error { - return result(capi.AImageDecoder_rewind(h.ptr)) -} - -// SetAndroidBitmapFormat calls the underlying NDK function. -func (h *Decoder) SetAndroidBitmapFormat(format int32) error { - return result(capi.AImageDecoder_setAndroidBitmapFormat(h.ptr, format)) -} - -// SetDataSpace calls the underlying NDK function. -func (h *Decoder) SetDataSpace(dataspace int32) error { - return result(capi.AImageDecoder_setDataSpace(h.ptr, dataspace)) -} - -// SetInternallyHandleDisposePrevious calls the underlying NDK function. -func (h *Decoder) SetInternallyHandleDisposePrevious(handleInternally bool) { - capi.AImageDecoder_setInternallyHandleDisposePrevious(h.ptr, handleInternally) -} - -// SetTargetSize calls the underlying NDK function. -func (h *Decoder) SetTargetSize(width int32, height int32) error { - return result(capi.AImageDecoder_setTargetSize(h.ptr, width, height)) -} - -// SetUnpremultipliedRequired calls the underlying NDK function. -func (h *Decoder) SetUnpremultipliedRequired(unpremultipliedRequired bool) error { - return result(capi.AImageDecoder_setUnpremultipliedRequired(h.ptr, unpremultipliedRequired)) -} - -// NewDecoderFromFd calls the underlying C function. -func NewDecoderFromFd(fd int32) (*Decoder, error) { - var outDecoderPtr *capi.AImageDecoder - ret := capi.AImageDecoder_createFromFd(fd, &outDecoderPtr) - if err := result(ret); err != nil { - return nil, err - } - return &Decoder{ptr: outDecoderPtr}, nil -} diff --git a/image/errors.go b/image/errors.go deleted file mode 100644 index a6998a7..0000000 --- a/image/errors.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -const ( - ErrIncomplete Error = -1 - ErrError Error = -2 - ErrInvalidConversion Error = -3 - ErrInvalidScale Error = -4 - ErrBadParameter Error = -5 - ErrInvalidInput Error = -6 - ErrSeekError Error = -7 - ErrInternalError Error = -8 - ErrUnsupportedFormat Error = -9 - ErrFinished Error = -10 - ErrInvalidState Error = -11 -) - -func (e Error) Error() string { - return fmt.Sprintf("image: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/image/functions.go b/image/functions.go deleted file mode 100644 index 3158517..0000000 --- a/image/functions.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -// AImageDecoder_resultToString calls the underlying C function. -func AImageDecoder_resultToString(arg0 int32) string { - return (string)(capi.AImageDecoder_resultToString(arg0)) -} diff --git a/image/header_info.go b/image/header_info.go deleted file mode 100644 index 6b35d28..0000000 --- a/image/header_info.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -// HeaderInfo wraps the NDK AImageDecoderHeaderInfo handle. -type HeaderInfo struct { - ptr *capi.AImageDecoderHeaderInfo -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *HeaderInfo) cptr() *capi.AImageDecoderHeaderInfo { - if h == nil { - return nil - } - return h.ptr -} - -// NewHeaderInfoFromPointer wraps a raw AImageDecoderHeaderInfo pointer. -func NewHeaderInfoFromPointer(ptr unsafe.Pointer) *HeaderInfo { - return &HeaderInfo{ptr: (*capi.AImageDecoderHeaderInfo)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *HeaderInfo) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *HeaderInfo) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewHeaderInfoFromUintPtr wraps a uintptr as a HeaderInfo. -// The caller must ensure ptr points to a valid AImageDecoderHeaderInfo. -func NewHeaderInfoFromUintPtr(ptr uintptr) *HeaderInfo { - return &HeaderInfo{ptr: (*capi.AImageDecoderHeaderInfo)(unsafe.Pointer(ptr))} -} - -// GetAlphaFlags calls the underlying NDK function. -func (h *HeaderInfo) GetAlphaFlags() error { - return result(capi.AImageDecoderHeaderInfo_getAlphaFlags(h.ptr)) -} - -// GetAndroidBitmapFormat calls the underlying NDK function. -func (h *HeaderInfo) GetAndroidBitmapFormat() error { - return result(capi.AImageDecoderHeaderInfo_getAndroidBitmapFormat(h.ptr)) -} - -// GetDataSpace calls the underlying NDK function. -func (h *HeaderInfo) GetDataSpace() error { - return result(capi.AImageDecoderHeaderInfo_getDataSpace(h.ptr)) -} - -// Height returns the value directly. -func (h *HeaderInfo) Height() int32 { - return (int32)(capi.AImageDecoderHeaderInfo_getHeight(h.ptr)) -} - -// MimeType returns the value directly. -func (h *HeaderInfo) MimeType() string { - return (string)(capi.AImageDecoderHeaderInfo_getMimeType(h.ptr)) -} - -// Width returns the value directly. -func (h *HeaderInfo) Width() int32 { - return (int32)(capi.AImageDecoderHeaderInfo_getWidth(h.ptr)) -} diff --git a/image/image_decoder_frame_info.go b/image/image_decoder_frame_info.go deleted file mode 100644 index ec59e52..0000000 --- a/image/image_decoder_frame_info.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -// ImageDecoderFrameInfo wraps the NDK AImageDecoderFrameInfo handle. -type ImageDecoderFrameInfo struct { - ptr *capi.AImageDecoderFrameInfo -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *ImageDecoderFrameInfo) cptr() *capi.AImageDecoderFrameInfo { - if h == nil { - return nil - } - return h.ptr -} - -// NewImageDecoderFrameInfo creates a new ImageDecoderFrameInfo. -func NewImageDecoderFrameInfo() *ImageDecoderFrameInfo { - return &ImageDecoderFrameInfo{ptr: capi.AImageDecoderFrameInfo_create()} -} - -// Close releases the underlying NDK handle. -func (h *ImageDecoderFrameInfo) Close() error { - if h.ptr == nil { - return nil - } - capi.AImageDecoderFrameInfo_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewImageDecoderFrameInfoFromPointer wraps a raw AImageDecoderFrameInfo pointer. -func NewImageDecoderFrameInfoFromPointer(ptr unsafe.Pointer) *ImageDecoderFrameInfo { - return &ImageDecoderFrameInfo{ptr: (*capi.AImageDecoderFrameInfo)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *ImageDecoderFrameInfo) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *ImageDecoderFrameInfo) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewImageDecoderFrameInfoFromUintPtr wraps a uintptr as a ImageDecoderFrameInfo. -// The caller must ensure ptr points to a valid AImageDecoderFrameInfo. -func NewImageDecoderFrameInfoFromUintPtr(ptr uintptr) *ImageDecoderFrameInfo { - return &ImageDecoderFrameInfo{ptr: (*capi.AImageDecoderFrameInfo)(unsafe.Pointer(ptr))} -} - -// GetBlendOp calls the underlying NDK function. -func (h *ImageDecoderFrameInfo) GetBlendOp() error { - return result(capi.AImageDecoderFrameInfo_getBlendOp(h.ptr)) -} - -// GetDisposeOp calls the underlying NDK function. -func (h *ImageDecoderFrameInfo) GetDisposeOp() error { - return result(capi.AImageDecoderFrameInfo_getDisposeOp(h.ptr)) -} - -// GetDuration returns the value directly. -func (h *ImageDecoderFrameInfo) GetDuration() int64 { - return (int64)(capi.AImageDecoderFrameInfo_getDuration(h.ptr)) -} - -// HasAlphaWithinBounds returns the value directly. -func (h *ImageDecoderFrameInfo) HasAlphaWithinBounds() bool { - return (bool)(capi.AImageDecoderFrameInfo_hasAlphaWithinBounds(h.ptr)) -} diff --git a/image/ndroid_image.go b/image/ndroid_image.go deleted file mode 100644 index 05422b2..0000000 --- a/image/ndroid_image.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -type NDROID_IMAGE int32 - -const ( - ANDROID_IMAGE_DECODER_INFINITE NDROID_IMAGE = 2147483647 -) diff --git a/image/ndroid_image_decoder_blend_op_src.go b/image/ndroid_image_decoder_blend_op_src.go deleted file mode 100644 index 7927ad3..0000000 --- a/image/ndroid_image_decoder_blend_op_src.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -type NDROID_IMAGE_DECODER_BLEND_OP_SRC int32 - -const ( - ANDROID_IMAGE_DECODER_BLEND_OP_SRC NDROID_IMAGE_DECODER_BLEND_OP_SRC = 1 - ANDROID_IMAGE_DECODER_BLEND_OP_SRC_OVER NDROID_IMAGE_DECODER_BLEND_OP_SRC = 2 -) diff --git a/image/ndroid_image_decoder_dispose_op.go b/image/ndroid_image_decoder_dispose_op.go deleted file mode 100644 index 3a5ca28..0000000 --- a/image/ndroid_image_decoder_dispose_op.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -type NDROID_IMAGE_DECODER_DISPOSE_OP int32 - -const ( - ANDROID_IMAGE_DECODER_DISPOSE_OP_NONE NDROID_IMAGE_DECODER_DISPOSE_OP = 1 - ANDROID_IMAGE_DECODER_DISPOSE_OP_BACKGROUND NDROID_IMAGE_DECODER_DISPOSE_OP = 2 - ANDROID_IMAGE_DECODER_DISPOSE_OP_PREVIOUS NDROID_IMAGE_DECODER_DISPOSE_OP = 3 -) diff --git a/image/off64_t.go b/image/off64_t.go deleted file mode 100644 index 64dba49..0000000 --- a/image/off64_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -type Off64_t = capi.Off64_t diff --git a/image/off_t.go b/image/off_t.go deleted file mode 100644 index efd9422..0000000 --- a/image/off_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package image - -import ( - capi "github.com/AndroidGoLab/ndk/capi/imagedecoder" -) - -type Off_t = capi.Off_t diff --git a/image/package.go b/image/package.go deleted file mode 100644 index 9671684..0000000 --- a/image/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package image provides Go bindings for Android ImageDecoder. -package image diff --git a/input/alooper.go b/input/alooper.go deleted file mode 100644 index aba3489..0000000 --- a/input/alooper.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import ( - capi "github.com/AndroidGoLab/ndk/capi/input" -) - -type ALooper = capi.ALooper diff --git a/input/alooper_callback_func.go b/input/alooper_callback_func.go deleted file mode 100644 index 95aa584..0000000 --- a/input/alooper_callback_func.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import ( - capi "github.com/AndroidGoLab/ndk/capi/input" -) - -type ALooper_callbackFunc = capi.ALooper_callbackFunc diff --git a/input/constants.go b/input/constants.go deleted file mode 100644 index aa3525e..0000000 --- a/input/constants.go +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -const ( - AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = 8 -) diff --git a/input/errors.go b/input/errors.go deleted file mode 100644 index c5b97e5..0000000 --- a/input/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/input/event.go b/input/event.go deleted file mode 100644 index af66443..0000000 --- a/input/event.go +++ /dev/null @@ -1,321 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/input" -) - -// Event wraps the NDK AInputEvent handle. -type Event struct { - ptr *capi.AInputEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Event) cptr() *capi.AInputEvent { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Event) Close() error { - if h.ptr == nil { - return nil - } - capi.AInputEvent_release(h.ptr) - h.ptr = nil - return nil -} - -// NewEventFromPointer wraps a raw AInputEvent pointer. -func NewEventFromPointer(ptr unsafe.Pointer) *Event { - return &Event{ptr: (*capi.AInputEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Event) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Event) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewEventFromUintPtr wraps a uintptr as a Event. -// The caller must ensure ptr points to a valid AInputEvent. -func NewEventFromUintPtr(ptr uintptr) *Event { - return &Event{ptr: (*capi.AInputEvent)(unsafe.Pointer(ptr))} -} - -// GetDeviceID calls the underlying NDK function. -func (h *Event) GetDeviceID() error { - return result(capi.AInputEvent_getDeviceId(h.ptr)) -} - -// Source returns the value directly. -func (h *Event) Source() int32 { - return (int32)(capi.AInputEvent_getSource(h.ptr)) -} - -// Type returns the value directly. -func (h *Event) Type() int32 { - return (int32)(capi.AInputEvent_getType(h.ptr)) -} - -// KeyAction returns the value directly. -func (h *Event) KeyAction() int32 { - return (int32)(capi.AKeyEvent_getAction(h.ptr)) -} - -// AKeyEvent_getDownTime returns the value directly. -func (h *Event) AKeyEvent_getDownTime() int64 { - return (int64)(capi.AKeyEvent_getDownTime(h.ptr)) -} - -// AKeyEvent_getEventTime returns the value directly. -func (h *Event) AKeyEvent_getEventTime() int64 { - return (int64)(capi.AKeyEvent_getEventTime(h.ptr)) -} - -// AKeyEvent_getFlags calls the underlying NDK function. -func (h *Event) AKeyEvent_getFlags() error { - return result(capi.AKeyEvent_getFlags(h.ptr)) -} - -// KeyCode returns the value directly. -func (h *Event) KeyCode() int32 { - return (int32)(capi.AKeyEvent_getKeyCode(h.ptr)) -} - -// AKeyEvent_getMetaState calls the underlying NDK function. -func (h *Event) AKeyEvent_getMetaState() error { - return result(capi.AKeyEvent_getMetaState(h.ptr)) -} - -// RepeatCount returns the value directly. -func (h *Event) RepeatCount() int32 { - return (int32)(capi.AKeyEvent_getRepeatCount(h.ptr)) -} - -// AKeyEvent_getScanCode calls the underlying NDK function. -func (h *Event) AKeyEvent_getScanCode() error { - return result(capi.AKeyEvent_getScanCode(h.ptr)) -} - -// MotionAction returns the value directly. -func (h *Event) MotionAction() int32 { - return (int32)(capi.AMotionEvent_getAction(h.ptr)) -} - -// AMotionEvent_getActionButton calls the underlying NDK function. -func (h *Event) AMotionEvent_getActionButton() error { - return result(capi.AMotionEvent_getActionButton(h.ptr)) -} - -// AMotionEvent_getAxisValue returns the value directly. -func (h *Event) AMotionEvent_getAxisValue(axis int32, pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getAxisValue(h.ptr, axis, pointer_index)) -} - -// AMotionEvent_getButtonState calls the underlying NDK function. -func (h *Event) AMotionEvent_getButtonState() error { - return result(capi.AMotionEvent_getButtonState(h.ptr)) -} - -// AMotionEvent_getClassification calls the underlying NDK function. -func (h *Event) AMotionEvent_getClassification() error { - return result(capi.AMotionEvent_getClassification(h.ptr)) -} - -// AMotionEvent_getDownTime returns the value directly. -func (h *Event) AMotionEvent_getDownTime() int64 { - return (int64)(capi.AMotionEvent_getDownTime(h.ptr)) -} - -// AMotionEvent_getEdgeFlags calls the underlying NDK function. -func (h *Event) AMotionEvent_getEdgeFlags() error { - return result(capi.AMotionEvent_getEdgeFlags(h.ptr)) -} - -// AMotionEvent_getEventTime returns the value directly. -func (h *Event) AMotionEvent_getEventTime() int64 { - return (int64)(capi.AMotionEvent_getEventTime(h.ptr)) -} - -// AMotionEvent_getFlags calls the underlying NDK function. -func (h *Event) AMotionEvent_getFlags() error { - return result(capi.AMotionEvent_getFlags(h.ptr)) -} - -// AMotionEvent_getHistoricalAxisValue returns the value directly. -func (h *Event) AMotionEvent_getHistoricalAxisValue(axis int32, pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalAxisValue(h.ptr, axis, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalEventTime returns the value directly. -func (h *Event) AMotionEvent_getHistoricalEventTime(history_index uint64) int64 { - return (int64)(capi.AMotionEvent_getHistoricalEventTime(h.ptr, history_index)) -} - -// AMotionEvent_getHistoricalOrientation returns the value directly. -func (h *Event) AMotionEvent_getHistoricalOrientation(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalOrientation(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalPressure returns the value directly. -func (h *Event) AMotionEvent_getHistoricalPressure(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalPressure(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalRawX returns the value directly. -func (h *Event) AMotionEvent_getHistoricalRawX(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalRawX(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalRawY returns the value directly. -func (h *Event) AMotionEvent_getHistoricalRawY(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalRawY(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalSize returns the value directly. -func (h *Event) AMotionEvent_getHistoricalSize(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalSize(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalToolMajor returns the value directly. -func (h *Event) AMotionEvent_getHistoricalToolMajor(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalToolMajor(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalToolMinor returns the value directly. -func (h *Event) AMotionEvent_getHistoricalToolMinor(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalToolMinor(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalTouchMajor returns the value directly. -func (h *Event) AMotionEvent_getHistoricalTouchMajor(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalTouchMajor(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalTouchMinor returns the value directly. -func (h *Event) AMotionEvent_getHistoricalTouchMinor(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalTouchMinor(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalX returns the value directly. -func (h *Event) AMotionEvent_getHistoricalX(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalX(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistoricalY returns the value directly. -func (h *Event) AMotionEvent_getHistoricalY(pointer_index uint64, history_index uint64) float32 { - return (float32)(capi.AMotionEvent_getHistoricalY(h.ptr, pointer_index, history_index)) -} - -// AMotionEvent_getHistorySize returns the value directly. -func (h *Event) AMotionEvent_getHistorySize() uint64 { - return (uint64)(capi.AMotionEvent_getHistorySize(h.ptr)) -} - -// AMotionEvent_getMetaState calls the underlying NDK function. -func (h *Event) AMotionEvent_getMetaState() error { - return result(capi.AMotionEvent_getMetaState(h.ptr)) -} - -// AMotionEvent_getOrientation returns the value directly. -func (h *Event) AMotionEvent_getOrientation(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getOrientation(h.ptr, pointer_index)) -} - -// PointerCount returns the value directly. -func (h *Event) PointerCount() uint64 { - return (uint64)(capi.AMotionEvent_getPointerCount(h.ptr)) -} - -// AMotionEvent_getPointerID calls the underlying NDK function. -func (h *Event) AMotionEvent_getPointerID(pointer_index uint64) error { - return result(capi.AMotionEvent_getPointerId(h.ptr, pointer_index)) -} - -// Pressure returns the value directly. -func (h *Event) Pressure(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getPressure(h.ptr, pointer_index)) -} - -// AMotionEvent_getRawX returns the value directly. -func (h *Event) AMotionEvent_getRawX(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getRawX(h.ptr, pointer_index)) -} - -// AMotionEvent_getRawY returns the value directly. -func (h *Event) AMotionEvent_getRawY(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getRawY(h.ptr, pointer_index)) -} - -// AMotionEvent_getSize returns the value directly. -func (h *Event) AMotionEvent_getSize(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getSize(h.ptr, pointer_index)) -} - -// AMotionEvent_getToolMajor returns the value directly. -func (h *Event) AMotionEvent_getToolMajor(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getToolMajor(h.ptr, pointer_index)) -} - -// AMotionEvent_getToolMinor returns the value directly. -func (h *Event) AMotionEvent_getToolMinor(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getToolMinor(h.ptr, pointer_index)) -} - -// AMotionEvent_getToolType calls the underlying NDK function. -func (h *Event) AMotionEvent_getToolType(pointer_index uint64) error { - return result(capi.AMotionEvent_getToolType(h.ptr, pointer_index)) -} - -// AMotionEvent_getTouchMajor returns the value directly. -func (h *Event) AMotionEvent_getTouchMajor(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getTouchMajor(h.ptr, pointer_index)) -} - -// AMotionEvent_getTouchMinor returns the value directly. -func (h *Event) AMotionEvent_getTouchMinor(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getTouchMinor(h.ptr, pointer_index)) -} - -// X returns the value directly. -func (h *Event) X(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getX(h.ptr, pointer_index)) -} - -// AMotionEvent_getXOffset returns the value directly. -func (h *Event) AMotionEvent_getXOffset() float32 { - return (float32)(capi.AMotionEvent_getXOffset(h.ptr)) -} - -// AMotionEvent_getXPrecision returns the value directly. -func (h *Event) AMotionEvent_getXPrecision() float32 { - return (float32)(capi.AMotionEvent_getXPrecision(h.ptr)) -} - -// Y returns the value directly. -func (h *Event) Y(pointer_index uint64) float32 { - return (float32)(capi.AMotionEvent_getY(h.ptr, pointer_index)) -} - -// AMotionEvent_getYOffset returns the value directly. -func (h *Event) AMotionEvent_getYOffset() float32 { - return (float32)(capi.AMotionEvent_getYOffset(h.ptr)) -} - -// AMotionEvent_getYPrecision returns the value directly. -func (h *Event) AMotionEvent_getYPrecision() float32 { - return (float32)(capi.AMotionEvent_getYPrecision(h.ptr)) -} diff --git a/input/event_type.go b/input/event_type.go deleted file mode 100644 index 3b8972e..0000000 --- a/input/event_type.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import "fmt" - -type EventType int32 - -const ( - Key EventType = 1 - Motion EventType = 2 - Focus EventType = 3 - Capture EventType = 4 - Drag EventType = 5 - TouchMode EventType = 6 -) - -func (v EventType) String() string { - switch v { - case Key: - return "Key" - case Motion: - return "Motion" - case Focus: - return "Focus" - case Capture: - return "Capture" - case Drag: - return "Drag" - case TouchMode: - return "TouchMode" - default: - return fmt.Sprintf("EventType(%d)", int(v)) - } -} diff --git a/input/functions.go b/input/functions.go deleted file mode 100644 index 13f328b..0000000 --- a/input/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input diff --git a/input/input.go b/input/input.go new file mode 100644 index 0000000..d26d4d8 --- /dev/null +++ b/input/input.go @@ -0,0 +1,148 @@ +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package input + +import ( + "github.com/xaionaro-go/ndk/ndk" +) + +type InputEvent = ndk.InputEvent +type InputQueue = ndk.InputQueue +type KeyEvent = ndk.KeyEvent +type MotionEvent = ndk.MotionEvent + +const ( + KEY_STATE_UNKNOWN = ndk.KEY_STATE_UNKNOWN + KEY_STATE_UP = ndk.KEY_STATE_UP + KEY_STATE_DOWN = ndk.KEY_STATE_DOWN + KEY_STATE_VIRTUAL = ndk.KEY_STATE_VIRTUAL + META_NONE = ndk.META_NONE + META_ALT_ON = ndk.META_ALT_ON + META_ALT_LEFT_ON = ndk.META_ALT_LEFT_ON + META_ALT_RIGHT_ON = ndk.META_ALT_RIGHT_ON + META_SHIFT_ON = ndk.META_SHIFT_ON + META_SHIFT_LEFT_ON = ndk.META_SHIFT_LEFT_ON + META_SHIFT_RIGHT_ON = ndk.META_SHIFT_RIGHT_ON + META_SYM_ON = ndk.META_SYM_ON + META_FUNCTION_ON = ndk.META_FUNCTION_ON + META_CTRL_ON = ndk.META_CTRL_ON + META_CTRL_LEFT_ON = ndk.META_CTRL_LEFT_ON + META_CTRL_RIGHT_ON = ndk.META_CTRL_RIGHT_ON + META_META_ON = ndk.META_META_ON + META_META_LEFT_ON = ndk.META_META_LEFT_ON + META_META_RIGHT_ON = ndk.META_META_RIGHT_ON + META_CAPS_LOCK_ON = ndk.META_CAPS_LOCK_ON + META_NUM_LOCK_ON = ndk.META_NUM_LOCK_ON + META_SCROLL_LOCK_ON = ndk.META_SCROLL_LOCK_ON + EVENT_TYPE_KEY = ndk.INPUT_EVENT_TYPE_KEY + EVENT_TYPE_MOTION = ndk.INPUT_EVENT_TYPE_MOTION + KEY_EVENT_ACTION_DOWN = ndk.KEY_EVENT_ACTION_DOWN + KEY_EVENT_ACTION_UP = ndk.KEY_EVENT_ACTION_UP + KEY_EVENT_ACTION_MULTIPLE = ndk.KEY_EVENT_ACTION_MULTIPLE + KEY_EVENT_FLAG_WOKE_HERE = ndk.KEY_EVENT_FLAG_WOKE_HERE + KEY_EVENT_FLAG_SOFT_KEYBOARD = ndk.KEY_EVENT_FLAG_SOFT_KEYBOARD + KEY_EVENT_FLAG_KEEP_TOUCH_MODE = ndk.KEY_EVENT_FLAG_KEEP_TOUCH_MODE + KEY_EVENT_FLAG_FROM_SYSTEM = ndk.KEY_EVENT_FLAG_FROM_SYSTEM + KEY_EVENT_FLAG_EDITOR_ACTION = ndk.KEY_EVENT_FLAG_EDITOR_ACTION + KEY_EVENT_FLAG_CANCELED = ndk.KEY_EVENT_FLAG_CANCELED + KEY_EVENT_FLAG_VIRTUAL_HARD_KEY = ndk.KEY_EVENT_FLAG_VIRTUAL_HARD_KEY + KEY_EVENT_FLAG_LONG_PRESS = ndk.KEY_EVENT_FLAG_LONG_PRESS + KEY_EVENT_FLAG_CANCELED_LONG_PRESS = ndk.KEY_EVENT_FLAG_CANCELED_LONG_PRESS + KEY_EVENT_FLAG_TRACKING = ndk.KEY_EVENT_FLAG_TRACKING + KEY_EVENT_FLAG_FALLBACK = ndk.KEY_EVENT_FLAG_FALLBACK + MOTION_EVENT_ACTION_MASK = ndk.MOTION_EVENT_ACTION_MASK + MOTION_EVENT_ACTION_POINTER_INDEX_MASK = ndk.MOTION_EVENT_ACTION_POINTER_INDEX_MASK + MOTION_EVENT_ACTION_DOWN = ndk.MOTION_EVENT_ACTION_DOWN + MOTION_EVENT_ACTION_UP = ndk.MOTION_EVENT_ACTION_UP + MOTION_EVENT_ACTION_MOVE = ndk.MOTION_EVENT_ACTION_MOVE + MOTION_EVENT_ACTION_CANCEL = ndk.MOTION_EVENT_ACTION_CANCEL + MOTION_EVENT_ACTION_OUTSIDE = ndk.MOTION_EVENT_ACTION_OUTSIDE + MOTION_EVENT_ACTION_POINTER_DOWN = ndk.MOTION_EVENT_ACTION_POINTER_DOWN + MOTION_EVENT_ACTION_POINTER_UP = ndk.MOTION_EVENT_ACTION_POINTER_UP + MOTION_EVENT_ACTION_HOVER_MOVE = ndk.MOTION_EVENT_ACTION_HOVER_MOVE + MOTION_EVENT_ACTION_SCROLL = ndk.MOTION_EVENT_ACTION_SCROLL + MOTION_EVENT_ACTION_HOVER_ENTER = ndk.MOTION_EVENT_ACTION_HOVER_ENTER + MOTION_EVENT_ACTION_HOVER_EXIT = ndk.MOTION_EVENT_ACTION_HOVER_EXIT + MOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = ndk.MOTION_EVENT_FLAG_WINDOW_IS_OBSCURED + MOTION_EVENT_EDGE_FLAG_NONE = ndk.MOTION_EVENT_EDGE_FLAG_NONE + MOTION_EVENT_EDGE_FLAG_TOP = ndk.MOTION_EVENT_EDGE_FLAG_TOP + MOTION_EVENT_EDGE_FLAG_BOTTOM = ndk.MOTION_EVENT_EDGE_FLAG_BOTTOM + MOTION_EVENT_EDGE_FLAG_LEFT = ndk.MOTION_EVENT_EDGE_FLAG_LEFT + MOTION_EVENT_EDGE_FLAG_RIGHT = ndk.MOTION_EVENT_EDGE_FLAG_RIGHT + MOTION_EVENT_AXIS_X = ndk.MOTION_EVENT_AXIS_X + MOTION_EVENT_AXIS_Y = ndk.MOTION_EVENT_AXIS_Y + MOTION_EVENT_AXIS_PRESSURE = ndk.MOTION_EVENT_AXIS_PRESSURE + MOTION_EVENT_AXIS_SIZE = ndk.MOTION_EVENT_AXIS_SIZE + MOTION_EVENT_AXIS_TOUCH_MAJOR = ndk.MOTION_EVENT_AXIS_TOUCH_MAJOR + MOTION_EVENT_AXIS_TOUCH_MINOR = ndk.MOTION_EVENT_AXIS_TOUCH_MINOR + MOTION_EVENT_AXIS_TOOL_MAJOR = ndk.MOTION_EVENT_AXIS_TOOL_MAJOR + MOTION_EVENT_AXIS_TOOL_MINOR = ndk.MOTION_EVENT_AXIS_TOOL_MINOR + MOTION_EVENT_AXIS_ORIENTATION = ndk.MOTION_EVENT_AXIS_ORIENTATION + MOTION_EVENT_AXIS_VSCROLL = ndk.MOTION_EVENT_AXIS_VSCROLL + MOTION_EVENT_AXIS_HSCROLL = ndk.MOTION_EVENT_AXIS_HSCROLL + MOTION_EVENT_AXIS_Z = ndk.MOTION_EVENT_AXIS_Z + MOTION_EVENT_AXIS_RX = ndk.MOTION_EVENT_AXIS_RX + MOTION_EVENT_AXIS_RY = ndk.MOTION_EVENT_AXIS_RY + MOTION_EVENT_AXIS_RZ = ndk.MOTION_EVENT_AXIS_RZ + MOTION_EVENT_AXIS_HAT_X = ndk.MOTION_EVENT_AXIS_HAT_X + MOTION_EVENT_AXIS_HAT_Y = ndk.MOTION_EVENT_AXIS_HAT_Y + MOTION_EVENT_AXIS_LTRIGGER = ndk.MOTION_EVENT_AXIS_LTRIGGER + MOTION_EVENT_AXIS_RTRIGGER = ndk.MOTION_EVENT_AXIS_RTRIGGER + MOTION_EVENT_AXIS_THROTTLE = ndk.MOTION_EVENT_AXIS_THROTTLE + MOTION_EVENT_AXIS_RUDDER = ndk.MOTION_EVENT_AXIS_RUDDER + MOTION_EVENT_AXIS_WHEEL = ndk.MOTION_EVENT_AXIS_WHEEL + MOTION_EVENT_AXIS_GAS = ndk.MOTION_EVENT_AXIS_GAS + MOTION_EVENT_AXIS_BRAKE = ndk.MOTION_EVENT_AXIS_BRAKE + MOTION_EVENT_AXIS_DISTANCE = ndk.MOTION_EVENT_AXIS_DISTANCE + MOTION_EVENT_AXIS_TILT = ndk.MOTION_EVENT_AXIS_TILT + MOTION_EVENT_AXIS_GENERIC_1 = ndk.MOTION_EVENT_AXIS_GENERIC_1 + MOTION_EVENT_AXIS_GENERIC_2 = ndk.MOTION_EVENT_AXIS_GENERIC_2 + MOTION_EVENT_AXIS_GENERIC_3 = ndk.MOTION_EVENT_AXIS_GENERIC_3 + MOTION_EVENT_AXIS_GENERIC_4 = ndk.MOTION_EVENT_AXIS_GENERIC_4 + MOTION_EVENT_AXIS_GENERIC_5 = ndk.MOTION_EVENT_AXIS_GENERIC_5 + MOTION_EVENT_AXIS_GENERIC_6 = ndk.MOTION_EVENT_AXIS_GENERIC_6 + MOTION_EVENT_AXIS_GENERIC_7 = ndk.MOTION_EVENT_AXIS_GENERIC_7 + MOTION_EVENT_AXIS_GENERIC_8 = ndk.MOTION_EVENT_AXIS_GENERIC_8 + MOTION_EVENT_AXIS_GENERIC_9 = ndk.MOTION_EVENT_AXIS_GENERIC_9 + MOTION_EVENT_AXIS_GENERIC_10 = ndk.MOTION_EVENT_AXIS_GENERIC_10 + MOTION_EVENT_AXIS_GENERIC_11 = ndk.MOTION_EVENT_AXIS_GENERIC_11 + MOTION_EVENT_AXIS_GENERIC_12 = ndk.MOTION_EVENT_AXIS_GENERIC_12 + MOTION_EVENT_AXIS_GENERIC_13 = ndk.MOTION_EVENT_AXIS_GENERIC_13 + MOTION_EVENT_AXIS_GENERIC_14 = ndk.MOTION_EVENT_AXIS_GENERIC_14 + MOTION_EVENT_AXIS_GENERIC_15 = ndk.MOTION_EVENT_AXIS_GENERIC_15 + MOTION_EVENT_AXIS_GENERIC_16 = ndk.MOTION_EVENT_AXIS_GENERIC_16 + MOTION_EVENT_BUTTON_PRIMARY = ndk.MOTION_EVENT_BUTTON_PRIMARY + MOTION_EVENT_BUTTON_SECONDARY = ndk.MOTION_EVENT_BUTTON_SECONDARY + MOTION_EVENT_BUTTON_TERTIARY = ndk.MOTION_EVENT_BUTTON_TERTIARY + MOTION_EVENT_BUTTON_BACK = ndk.MOTION_EVENT_BUTTON_BACK + MOTION_EVENT_BUTTON_FORWARD = ndk.MOTION_EVENT_BUTTON_FORWARD + MOTION_EVENT_TOOL_TYPE_UNKNOWN = ndk.MOTION_EVENT_TOOL_TYPE_UNKNOWN + MOTION_EVENT_TOOL_TYPE_FINGER = ndk.MOTION_EVENT_TOOL_TYPE_FINGER + MOTION_EVENT_TOOL_TYPE_STYLUS = ndk.MOTION_EVENT_TOOL_TYPE_STYLUS + MOTION_EVENT_TOOL_TYPE_MOUSE = ndk.MOTION_EVENT_TOOL_TYPE_MOUSE + MOTION_EVENT_TOOL_TYPE_ERASER = ndk.MOTION_EVENT_TOOL_TYPE_ERASER + SOURCE_CLASS_MASK = ndk.INPUT_SOURCE_CLASS_MASK + SOURCE_CLASS_NONE = ndk.INPUT_SOURCE_CLASS_NONE + SOURCE_CLASS_BUTTON = ndk.INPUT_SOURCE_CLASS_BUTTON + SOURCE_CLASS_POINTER = ndk.INPUT_SOURCE_CLASS_POINTER + SOURCE_CLASS_NAVIGATION = ndk.INPUT_SOURCE_CLASS_NAVIGATION + SOURCE_CLASS_POSITION = ndk.INPUT_SOURCE_CLASS_POSITION + SOURCE_CLASS_JOYSTICK = ndk.INPUT_SOURCE_CLASS_JOYSTICK + SOURCE_UNKNOWN = ndk.INPUT_SOURCE_UNKNOWN + SOURCE_KEYBOARD = ndk.INPUT_SOURCE_KEYBOARD + SOURCE_DPAD = ndk.INPUT_SOURCE_DPAD + SOURCE_GAMEPAD = ndk.INPUT_SOURCE_GAMEPAD + SOURCE_TOUCHSCREEN = ndk.INPUT_SOURCE_TOUCHSCREEN + SOURCE_MOUSE = ndk.INPUT_SOURCE_MOUSE + SOURCE_STYLUS = ndk.INPUT_SOURCE_STYLUS + SOURCE_TRACKBALL = ndk.INPUT_SOURCE_TRACKBALL + SOURCE_TOUCHPAD = ndk.INPUT_SOURCE_TOUCHPAD + SOURCE_TOUCH_NAVIGATION = ndk.INPUT_SOURCE_TOUCH_NAVIGATION + SOURCE_JOYSTICK = ndk.INPUT_SOURCE_JOYSTICK + SOURCE_ANY = ndk.INPUT_SOURCE_ANY + KEYBOARD_TYPE_NONE = ndk.INPUT_KEYBOARD_TYPE_NONE + KEYBOARD_TYPE_NON_ALPHABETIC = ndk.INPUT_KEYBOARD_TYPE_NON_ALPHABETIC + KEYBOARD_TYPE_ALPHABETIC = ndk.INPUT_KEYBOARD_TYPE_ALPHABETIC +) diff --git a/input/input_keyboard_type.go b/input/input_keyboard_type.go deleted file mode 100644 index 5a2ea11..0000000 --- a/input/input_keyboard_type.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type INPUT_KEYBOARD_TYPE int32 - -const ( - AINPUT_KEYBOARD_TYPE_NONE INPUT_KEYBOARD_TYPE = 0 - AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC INPUT_KEYBOARD_TYPE = 1 - AINPUT_KEYBOARD_TYPE_ALPHABETIC INPUT_KEYBOARD_TYPE = 2 -) diff --git a/input/input_motion_range.go b/input/input_motion_range.go deleted file mode 100644 index 7d12b5f..0000000 --- a/input/input_motion_range.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type INPUT_MOTION_RANGE int32 - -const ( - AINPUT_MOTION_RANGE_X INPUT_MOTION_RANGE = 0 - AINPUT_MOTION_RANGE_Y INPUT_MOTION_RANGE = 1 - AINPUT_MOTION_RANGE_PRESSURE INPUT_MOTION_RANGE = 2 - AINPUT_MOTION_RANGE_SIZE INPUT_MOTION_RANGE = 3 - AINPUT_MOTION_RANGE_TOUCH_MAJOR INPUT_MOTION_RANGE = 4 - AINPUT_MOTION_RANGE_TOUCH_MINOR INPUT_MOTION_RANGE = 5 - AINPUT_MOTION_RANGE_TOOL_MAJOR INPUT_MOTION_RANGE = 6 - AINPUT_MOTION_RANGE_TOOL_MINOR INPUT_MOTION_RANGE = 7 - AINPUT_MOTION_RANGE_ORIENTATION INPUT_MOTION_RANGE = 8 -) diff --git a/input/input_source_class.go b/input/input_source_class.go deleted file mode 100644 index 41845ce..0000000 --- a/input/input_source_class.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type INPUT_SOURCE_CLASS int32 - -const ( - AINPUT_SOURCE_CLASS_MASK INPUT_SOURCE_CLASS = 255 - AINPUT_SOURCE_CLASS_NONE INPUT_SOURCE_CLASS = 0 - AINPUT_SOURCE_CLASS_BUTTON INPUT_SOURCE_CLASS = 1 - AINPUT_SOURCE_CLASS_POINTER INPUT_SOURCE_CLASS = 2 - AINPUT_SOURCE_CLASS_NAVIGATION INPUT_SOURCE_CLASS = 4 - AINPUT_SOURCE_CLASS_POSITION INPUT_SOURCE_CLASS = 8 - AINPUT_SOURCE_CLASS_JOYSTICK INPUT_SOURCE_CLASS = 16 -) diff --git a/input/jnienv.go b/input/jnienv.go deleted file mode 100644 index 6075c0e..0000000 --- a/input/jnienv.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import ( - capi "github.com/AndroidGoLab/ndk/capi/input" -) - -type JNIEnv = capi.JNIEnv diff --git a/input/jobject.go b/input/jobject.go deleted file mode 100644 index 04f995d..0000000 --- a/input/jobject.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import ( - capi "github.com/AndroidGoLab/ndk/capi/input" -) - -type Jobject = capi.Jobject diff --git a/input/key_action.go b/input/key_action.go deleted file mode 100644 index 52fd684..0000000 --- a/input/key_action.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import "fmt" - -type KeyAction int32 - -const ( - Down KeyAction = 0 - Up KeyAction = 1 - Multiple KeyAction = 2 -) - -func (v KeyAction) String() string { - switch v { - case Down: - return "Down" - case Up: - return "Up" - case Multiple: - return "Multiple" - default: - return fmt.Sprintf("KeyAction(%d)", int(v)) - } -} diff --git a/input/key_event_flag.go b/input/key_event_flag.go deleted file mode 100644 index 1aa05c0..0000000 --- a/input/key_event_flag.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type KEY_EVENT_FLAG int32 - -const ( - AKEY_EVENT_FLAG_WOKE_HERE KEY_EVENT_FLAG = 1 - AKEY_EVENT_FLAG_SOFT_KEYBOARD KEY_EVENT_FLAG = 2 - AKEY_EVENT_FLAG_KEEP_TOUCH_MODE KEY_EVENT_FLAG = 4 - AKEY_EVENT_FLAG_FROM_SYSTEM KEY_EVENT_FLAG = 8 - AKEY_EVENT_FLAG_EDITOR_ACTION KEY_EVENT_FLAG = 16 - AKEY_EVENT_FLAG_CANCELED KEY_EVENT_FLAG = 32 - AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY KEY_EVENT_FLAG = 64 - AKEY_EVENT_FLAG_LONG_PRESS KEY_EVENT_FLAG = 128 - AKEY_EVENT_FLAG_CANCELED_LONG_PRESS KEY_EVENT_FLAG = 256 - AKEY_EVENT_FLAG_TRACKING KEY_EVENT_FLAG = 512 - AKEY_EVENT_FLAG_FALLBACK KEY_EVENT_FLAG = 1024 -) diff --git a/input/key_state.go b/input/key_state.go deleted file mode 100644 index 7c0a009..0000000 --- a/input/key_state.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type KEY_STATE int32 - -const ( - AKEY_STATE_UNKNOWN KEY_STATE = -1 - AKEY_STATE_UP KEY_STATE = 0 - AKEY_STATE_DOWN KEY_STATE = 1 - AKEY_STATE_VIRTUAL KEY_STATE = 2 -) diff --git a/input/keycodes.go b/input/keycodes.go new file mode 100644 index 0000000..ef5a0d8 --- /dev/null +++ b/input/keycodes.go @@ -0,0 +1,235 @@ +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package input + +import ( + "github.com/xaionaro-go/ndk/ndk" +) + +const ( + KEY_UNKNOWN = ndk.KEYCODE_UNKNOWN + KEY_SOFT_LEFT = ndk.KEYCODE_SOFT_LEFT + KEY_SOFT_RIGHT = ndk.KEYCODE_SOFT_RIGHT + KEY_HOME = ndk.KEYCODE_HOME + KEY_BACK = ndk.KEYCODE_BACK + KEY_CALL = ndk.KEYCODE_CALL + KEY_ENDCALL = ndk.KEYCODE_ENDCALL + KEY_0 = ndk.KEYCODE_0 + KEY_1 = ndk.KEYCODE_1 + KEY_2 = ndk.KEYCODE_2 + KEY_3 = ndk.KEYCODE_3 + KEY_4 = ndk.KEYCODE_4 + KEY_5 = ndk.KEYCODE_5 + KEY_6 = ndk.KEYCODE_6 + KEY_7 = ndk.KEYCODE_7 + KEY_8 = ndk.KEYCODE_8 + KEY_9 = ndk.KEYCODE_9 + KEY_STAR = ndk.KEYCODE_STAR + KEY_POUND = ndk.KEYCODE_POUND + KEY_DPAD_UP = ndk.KEYCODE_DPAD_UP + KEY_DPAD_DOWN = ndk.KEYCODE_DPAD_DOWN + KEY_DPAD_LEFT = ndk.KEYCODE_DPAD_LEFT + KEY_DPAD_RIGHT = ndk.KEYCODE_DPAD_RIGHT + KEY_DPAD_CENTER = ndk.KEYCODE_DPAD_CENTER + KEY_VOLUME_UP = ndk.KEYCODE_VOLUME_UP + KEY_VOLUME_DOWN = ndk.KEYCODE_VOLUME_DOWN + KEY_POWER = ndk.KEYCODE_POWER + KEY_CAMERA = ndk.KEYCODE_CAMERA + KEY_CLEAR = ndk.KEYCODE_CLEAR + KEY_A = ndk.KEYCODE_A + KEY_B = ndk.KEYCODE_B + KEY_C = ndk.KEYCODE_C + KEY_D = ndk.KEYCODE_D + KEY_E = ndk.KEYCODE_E + KEY_F = ndk.KEYCODE_F + KEY_G = ndk.KEYCODE_G + KEY_H = ndk.KEYCODE_H + KEY_I = ndk.KEYCODE_I + KEY_J = ndk.KEYCODE_J + KEY_K = ndk.KEYCODE_K + KEY_L = ndk.KEYCODE_L + KEY_M = ndk.KEYCODE_M + KEY_N = ndk.KEYCODE_N + KEY_O = ndk.KEYCODE_O + KEY_P = ndk.KEYCODE_P + KEY_Q = ndk.KEYCODE_Q + KEY_R = ndk.KEYCODE_R + KEY_S = ndk.KEYCODE_S + KEY_T = ndk.KEYCODE_T + KEY_U = ndk.KEYCODE_U + KEY_V = ndk.KEYCODE_V + KEY_W = ndk.KEYCODE_W + KEY_X = ndk.KEYCODE_X + KEY_Y = ndk.KEYCODE_Y + KEY_Z = ndk.KEYCODE_Z + KEY_COMMA = ndk.KEYCODE_COMMA + KEY_PERIOD = ndk.KEYCODE_PERIOD + KEY_ALT_LEFT = ndk.KEYCODE_ALT_LEFT + KEY_ALT_RIGHT = ndk.KEYCODE_ALT_RIGHT + KEY_SHIFT_LEFT = ndk.KEYCODE_SHIFT_LEFT + KEY_SHIFT_RIGHT = ndk.KEYCODE_SHIFT_RIGHT + KEY_TAB = ndk.KEYCODE_TAB + KEY_SPACE = ndk.KEYCODE_SPACE + KEY_SYM = ndk.KEYCODE_SYM + KEY_EXPLORER = ndk.KEYCODE_EXPLORER + KEY_ENVELOPE = ndk.KEYCODE_ENVELOPE + KEY_ENTER = ndk.KEYCODE_ENTER + KEY_DEL = ndk.KEYCODE_DEL + KEY_GRAVE = ndk.KEYCODE_GRAVE + KEY_MINUS = ndk.KEYCODE_MINUS + KEY_EQUALS = ndk.KEYCODE_EQUALS + KEY_LEFT_BRACKET = ndk.KEYCODE_LEFT_BRACKET + KEY_RIGHT_BRACKET = ndk.KEYCODE_RIGHT_BRACKET + KEY_BACKSLASH = ndk.KEYCODE_BACKSLASH + KEY_SEMICOLON = ndk.KEYCODE_SEMICOLON + KEY_APOSTROPHE = ndk.KEYCODE_APOSTROPHE + KEY_SLASH = ndk.KEYCODE_SLASH + KEY_AT = ndk.KEYCODE_AT + KEY_NUM = ndk.KEYCODE_NUM + KEY_HEADSETHOOK = ndk.KEYCODE_HEADSETHOOK + KEY_FOCUS = ndk.KEYCODE_FOCUS + KEY_PLUS = ndk.KEYCODE_PLUS + KEY_MENU = ndk.KEYCODE_MENU + KEY_NOTIFICATION = ndk.KEYCODE_NOTIFICATION + KEY_SEARCH = ndk.KEYCODE_SEARCH + KEY_MEDIA_PLAY_PAUSE = ndk.KEYCODE_MEDIA_PLAY_PAUSE + KEY_MEDIA_STOP = ndk.KEYCODE_MEDIA_STOP + KEY_MEDIA_NEXT = ndk.KEYCODE_MEDIA_NEXT + KEY_MEDIA_PREVIOUS = ndk.KEYCODE_MEDIA_PREVIOUS + KEY_MEDIA_REWIND = ndk.KEYCODE_MEDIA_REWIND + KEY_MEDIA_FAST_FORWARD = ndk.KEYCODE_MEDIA_FAST_FORWARD + KEY_MUTE = ndk.KEYCODE_MUTE + KEY_PAGE_UP = ndk.KEYCODE_PAGE_UP + KEY_PAGE_DOWN = ndk.KEYCODE_PAGE_DOWN + KEY_PICTSYMBOLS = ndk.KEYCODE_PICTSYMBOLS + KEY_SWITCH_CHARSET = ndk.KEYCODE_SWITCH_CHARSET + KEY_BUTTON_A = ndk.KEYCODE_BUTTON_A + KEY_BUTTON_B = ndk.KEYCODE_BUTTON_B + KEY_BUTTON_C = ndk.KEYCODE_BUTTON_C + KEY_BUTTON_X = ndk.KEYCODE_BUTTON_X + KEY_BUTTON_Y = ndk.KEYCODE_BUTTON_Y + KEY_BUTTON_Z = ndk.KEYCODE_BUTTON_Z + KEY_BUTTON_L1 = ndk.KEYCODE_BUTTON_L1 + KEY_BUTTON_R1 = ndk.KEYCODE_BUTTON_R1 + KEY_BUTTON_L2 = ndk.KEYCODE_BUTTON_L2 + KEY_BUTTON_R2 = ndk.KEYCODE_BUTTON_R2 + KEY_BUTTON_THUMBL = ndk.KEYCODE_BUTTON_THUMBL + KEY_BUTTON_THUMBR = ndk.KEYCODE_BUTTON_THUMBR + KEY_BUTTON_START = ndk.KEYCODE_BUTTON_START + KEY_BUTTON_SELECT = ndk.KEYCODE_BUTTON_SELECT + KEY_BUTTON_MODE = ndk.KEYCODE_BUTTON_MODE + KEY_ESCAPE = ndk.KEYCODE_ESCAPE + KEY_FORWARD_DEL = ndk.KEYCODE_FORWARD_DEL + KEY_CTRL_LEFT = ndk.KEYCODE_CTRL_LEFT + KEY_CTRL_RIGHT = ndk.KEYCODE_CTRL_RIGHT + KEY_CAPS_LOCK = ndk.KEYCODE_CAPS_LOCK + KEY_SCROLL_LOCK = ndk.KEYCODE_SCROLL_LOCK + KEY_META_LEFT = ndk.KEYCODE_META_LEFT + KEY_META_RIGHT = ndk.KEYCODE_META_RIGHT + KEY_FUNCTION = ndk.KEYCODE_FUNCTION + KEY_SYSRQ = ndk.KEYCODE_SYSRQ + KEY_BREAK = ndk.KEYCODE_BREAK + KEY_MOVE_HOME = ndk.KEYCODE_MOVE_HOME + KEY_MOVE_END = ndk.KEYCODE_MOVE_END + KEY_INSERT = ndk.KEYCODE_INSERT + KEY_FORWARD = ndk.KEYCODE_FORWARD + KEY_MEDIA_PLAY = ndk.KEYCODE_MEDIA_PLAY + KEY_MEDIA_PAUSE = ndk.KEYCODE_MEDIA_PAUSE + KEY_MEDIA_CLOSE = ndk.KEYCODE_MEDIA_CLOSE + KEY_MEDIA_EJECT = ndk.KEYCODE_MEDIA_EJECT + KEY_MEDIA_RECORD = ndk.KEYCODE_MEDIA_RECORD + KEY_F1 = ndk.KEYCODE_F1 + KEY_F2 = ndk.KEYCODE_F2 + KEY_F3 = ndk.KEYCODE_F3 + KEY_F4 = ndk.KEYCODE_F4 + KEY_F5 = ndk.KEYCODE_F5 + KEY_F6 = ndk.KEYCODE_F6 + KEY_F7 = ndk.KEYCODE_F7 + KEY_F8 = ndk.KEYCODE_F8 + KEY_F9 = ndk.KEYCODE_F9 + KEY_F10 = ndk.KEYCODE_F10 + KEY_F11 = ndk.KEYCODE_F11 + KEY_F12 = ndk.KEYCODE_F12 + KEY_NUM_LOCK = ndk.KEYCODE_NUM_LOCK + KEY_NUMPAD_0 = ndk.KEYCODE_NUMPAD_0 + KEY_NUMPAD_1 = ndk.KEYCODE_NUMPAD_1 + KEY_NUMPAD_2 = ndk.KEYCODE_NUMPAD_2 + KEY_NUMPAD_3 = ndk.KEYCODE_NUMPAD_3 + KEY_NUMPAD_4 = ndk.KEYCODE_NUMPAD_4 + KEY_NUMPAD_5 = ndk.KEYCODE_NUMPAD_5 + KEY_NUMPAD_6 = ndk.KEYCODE_NUMPAD_6 + KEY_NUMPAD_7 = ndk.KEYCODE_NUMPAD_7 + KEY_NUMPAD_8 = ndk.KEYCODE_NUMPAD_8 + KEY_NUMPAD_9 = ndk.KEYCODE_NUMPAD_9 + KEY_NUMPAD_DIVIDE = ndk.KEYCODE_NUMPAD_DIVIDE + KEY_NUMPAD_MULTIPLY = ndk.KEYCODE_NUMPAD_MULTIPLY + KEY_NUMPAD_SUBTRACT = ndk.KEYCODE_NUMPAD_SUBTRACT + KEY_NUMPAD_ADD = ndk.KEYCODE_NUMPAD_ADD + KEY_NUMPAD_DOT = ndk.KEYCODE_NUMPAD_DOT + KEY_NUMPAD_COMMA = ndk.KEYCODE_NUMPAD_COMMA + KEY_NUMPAD_ENTER = ndk.KEYCODE_NUMPAD_ENTER + KEY_NUMPAD_EQUALS = ndk.KEYCODE_NUMPAD_EQUALS + KEY_NUMPAD_LEFT_PAREN = ndk.KEYCODE_NUMPAD_LEFT_PAREN + KEY_NUMPAD_RIGHT_PAREN = ndk.KEYCODE_NUMPAD_RIGHT_PAREN + KEY_VOLUME_MUTE = ndk.KEYCODE_VOLUME_MUTE + KEY_INFO = ndk.KEYCODE_INFO + KEY_CHANNEL_UP = ndk.KEYCODE_CHANNEL_UP + KEY_CHANNEL_DOWN = ndk.KEYCODE_CHANNEL_DOWN + KEY_ZOOM_IN = ndk.KEYCODE_ZOOM_IN + KEY_ZOOM_OUT = ndk.KEYCODE_ZOOM_OUT + KEY_TV = ndk.KEYCODE_TV + KEY_WINDOW = ndk.KEYCODE_WINDOW + KEY_GUIDE = ndk.KEYCODE_GUIDE + KEY_DVR = ndk.KEYCODE_DVR + KEY_BOOKMARK = ndk.KEYCODE_BOOKMARK + KEY_CAPTIONS = ndk.KEYCODE_CAPTIONS + KEY_SETTINGS = ndk.KEYCODE_SETTINGS + KEY_TV_POWER = ndk.KEYCODE_TV_POWER + KEY_TV_INPUT = ndk.KEYCODE_TV_INPUT + KEY_STB_POWER = ndk.KEYCODE_STB_POWER + KEY_STB_INPUT = ndk.KEYCODE_STB_INPUT + KEY_AVR_POWER = ndk.KEYCODE_AVR_POWER + KEY_AVR_INPUT = ndk.KEYCODE_AVR_INPUT + KEY_PROG_RED = ndk.KEYCODE_PROG_RED + KEY_PROG_GREEN = ndk.KEYCODE_PROG_GREEN + KEY_PROG_YELLOW = ndk.KEYCODE_PROG_YELLOW + KEY_PROG_BLUE = ndk.KEYCODE_PROG_BLUE + KEY_APP_SWITCH = ndk.KEYCODE_APP_SWITCH + KEY_BUTTON_1 = ndk.KEYCODE_BUTTON_1 + KEY_BUTTON_2 = ndk.KEYCODE_BUTTON_2 + KEY_BUTTON_3 = ndk.KEYCODE_BUTTON_3 + KEY_BUTTON_4 = ndk.KEYCODE_BUTTON_4 + KEY_BUTTON_5 = ndk.KEYCODE_BUTTON_5 + KEY_BUTTON_6 = ndk.KEYCODE_BUTTON_6 + KEY_BUTTON_7 = ndk.KEYCODE_BUTTON_7 + KEY_BUTTON_8 = ndk.KEYCODE_BUTTON_8 + KEY_BUTTON_9 = ndk.KEYCODE_BUTTON_9 + KEY_BUTTON_10 = ndk.KEYCODE_BUTTON_10 + KEY_BUTTON_11 = ndk.KEYCODE_BUTTON_11 + KEY_BUTTON_12 = ndk.KEYCODE_BUTTON_12 + KEY_BUTTON_13 = ndk.KEYCODE_BUTTON_13 + KEY_BUTTON_14 = ndk.KEYCODE_BUTTON_14 + KEY_BUTTON_15 = ndk.KEYCODE_BUTTON_15 + KEY_BUTTON_16 = ndk.KEYCODE_BUTTON_16 + KEY_LANGUAGE_SWITCH = ndk.KEYCODE_LANGUAGE_SWITCH + KEY_MANNER_MODE = ndk.KEYCODE_MANNER_MODE + KEY_3D_MODE = ndk.KEYCODE_3D_MODE + KEY_CONTACTS = ndk.KEYCODE_CONTACTS + KEY_CALENDAR = ndk.KEYCODE_CALENDAR + KEY_MUSIC = ndk.KEYCODE_MUSIC + KEY_CALCULATOR = ndk.KEYCODE_CALCULATOR + KEY_ZENKAKU_HANKAKU = ndk.KEYCODE_ZENKAKU_HANKAKU + KEY_EISU = ndk.KEYCODE_EISU + KEY_MUHENKAN = ndk.KEYCODE_MUHENKAN + KEY_HENKAN = ndk.KEYCODE_HENKAN + KEY_KATAKANA_HIRAGANA = ndk.KEYCODE_KATAKANA_HIRAGANA + KEY_YEN = ndk.KEYCODE_YEN + KEY_RO = ndk.KEYCODE_RO + KEY_KANA = ndk.KEYCODE_KANA + KEY_ASSIST = ndk.KEYCODE_ASSIST + KEY_BRIGHTNESS_DOWN = ndk.KEYCODE_BRIGHTNESS_DOWN + KEY_BRIGHTNESS_UP = ndk.KEYCODE_BRIGHTNESS_UP + KEY_MEDIA_AUDIO_TRACK = ndk.KEYCODE_MEDIA_AUDIO_TRACK +) diff --git a/input/meta.go b/input/meta.go deleted file mode 100644 index 8aac75b..0000000 --- a/input/meta.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type META int32 - -const ( - AMETA_NONE META = 0 - AMETA_ALT_ON META = 2 - AMETA_ALT_LEFT_ON META = 16 - AMETA_ALT_RIGHT_ON META = 32 - AMETA_SHIFT_ON META = 1 - AMETA_SHIFT_LEFT_ON META = 64 - AMETA_SHIFT_RIGHT_ON META = 128 - AMETA_SYM_ON META = 4 - AMETA_FUNCTION_ON META = 8 - AMETA_CTRL_ON META = 4096 - AMETA_CTRL_LEFT_ON META = 8192 - AMETA_CTRL_RIGHT_ON META = 16384 - AMETA_META_ON META = 65536 - AMETA_META_LEFT_ON META = 131072 - AMETA_META_RIGHT_ON META = 262144 - AMETA_CAPS_LOCK_ON META = 1048576 - AMETA_NUM_LOCK_ON META = 2097152 - AMETA_SCROLL_LOCK_ON META = 4194304 -) diff --git a/input/motion_action.go b/input/motion_action.go deleted file mode 100644 index c7ff421..0000000 --- a/input/motion_action.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import "fmt" - -type MotionAction int32 - -const ( - ActionMask MotionAction = 255 - ActionPointerIndexMask MotionAction = 65280 - ActionDown MotionAction = 0 - ActionUp MotionAction = 1 - ActionMove MotionAction = 2 - ActionCancel MotionAction = 3 - ActionOutside MotionAction = 4 - ActionPointerDown MotionAction = 5 - ActionPointerUp MotionAction = 6 - ActionHoverMove MotionAction = 7 - ActionScroll MotionAction = 8 - ActionHoverEnter MotionAction = 9 - ActionHoverExit MotionAction = 10 - ActionButtonPress MotionAction = 11 - ActionButtonRelease MotionAction = 12 -) - -func (v MotionAction) String() string { - switch v { - case ActionMask: - return "ActionMask" - case ActionPointerIndexMask: - return "ActionPointerIndexMask" - case ActionDown: - return "ActionDown" - case ActionUp: - return "ActionUp" - case ActionMove: - return "ActionMove" - case ActionCancel: - return "ActionCancel" - case ActionOutside: - return "ActionOutside" - case ActionPointerDown: - return "ActionPointerDown" - case ActionPointerUp: - return "ActionPointerUp" - case ActionHoverMove: - return "ActionHoverMove" - case ActionScroll: - return "ActionScroll" - case ActionHoverEnter: - return "ActionHoverEnter" - case ActionHoverExit: - return "ActionHoverExit" - case ActionButtonPress: - return "ActionButtonPress" - case ActionButtonRelease: - return "ActionButtonRelease" - default: - return fmt.Sprintf("MotionAction(%d)", int(v)) - } -} diff --git a/input/motion_classification.go b/input/motion_classification.go deleted file mode 100644 index 26c6f89..0000000 --- a/input/motion_classification.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type MotionClassification int32 - -const ( - AMOTION_EVENT_CLASSIFICATION_NONE MotionClassification = 0 - AMOTION_EVENT_CLASSIFICATION_AMBIGUOUS_GESTURE MotionClassification = 1 - AMOTION_EVENT_CLASSIFICATION_DEEP_PRESS MotionClassification = 2 - AMOTION_EVENT_CLASSIFICATION_TWO_FINGER_SWIPE MotionClassification = 3 - AMOTION_EVENT_CLASSIFICATION_MULTI_FINGER_SWIPE MotionClassification = 4 - AMOTION_EVENT_CLASSIFICATION_PINCH MotionClassification = 5 -) diff --git a/input/motion_event.go b/input/motion_event.go deleted file mode 100644 index 4eb7d0d..0000000 --- a/input/motion_event.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type MOTION_EVENT int32 - -const ( - AMOTION_EVENT_AXIS_X MOTION_EVENT = 0 - AMOTION_EVENT_AXIS_Y MOTION_EVENT = 1 - AMOTION_EVENT_AXIS_PRESSURE MOTION_EVENT = 2 - AMOTION_EVENT_AXIS_SIZE MOTION_EVENT = 3 - AMOTION_EVENT_AXIS_TOUCH_MAJOR MOTION_EVENT = 4 - AMOTION_EVENT_AXIS_TOUCH_MINOR MOTION_EVENT = 5 - AMOTION_EVENT_AXIS_TOOL_MAJOR MOTION_EVENT = 6 - AMOTION_EVENT_AXIS_TOOL_MINOR MOTION_EVENT = 7 - AMOTION_EVENT_AXIS_ORIENTATION MOTION_EVENT = 8 - AMOTION_EVENT_AXIS_VSCROLL MOTION_EVENT = 9 - AMOTION_EVENT_AXIS_HSCROLL MOTION_EVENT = 10 - AMOTION_EVENT_AXIS_Z MOTION_EVENT = 11 - AMOTION_EVENT_AXIS_RX MOTION_EVENT = 12 - AMOTION_EVENT_AXIS_RY MOTION_EVENT = 13 - AMOTION_EVENT_AXIS_RZ MOTION_EVENT = 14 - AMOTION_EVENT_AXIS_HAT_X MOTION_EVENT = 15 - AMOTION_EVENT_AXIS_HAT_Y MOTION_EVENT = 16 - AMOTION_EVENT_AXIS_LTRIGGER MOTION_EVENT = 17 - AMOTION_EVENT_AXIS_RTRIGGER MOTION_EVENT = 18 - AMOTION_EVENT_AXIS_THROTTLE MOTION_EVENT = 19 - AMOTION_EVENT_AXIS_RUDDER MOTION_EVENT = 20 - AMOTION_EVENT_AXIS_WHEEL MOTION_EVENT = 21 - AMOTION_EVENT_AXIS_GAS MOTION_EVENT = 22 - AMOTION_EVENT_AXIS_BRAKE MOTION_EVENT = 23 - AMOTION_EVENT_AXIS_DISTANCE MOTION_EVENT = 24 - AMOTION_EVENT_AXIS_TILT MOTION_EVENT = 25 - AMOTION_EVENT_AXIS_SCROLL MOTION_EVENT = 26 - AMOTION_EVENT_AXIS_RELATIVE_X MOTION_EVENT = 27 - AMOTION_EVENT_AXIS_RELATIVE_Y MOTION_EVENT = 28 - AMOTION_EVENT_AXIS_GENERIC_1 MOTION_EVENT = 32 - AMOTION_EVENT_AXIS_GENERIC_2 MOTION_EVENT = 33 - AMOTION_EVENT_AXIS_GENERIC_3 MOTION_EVENT = 34 - AMOTION_EVENT_AXIS_GENERIC_4 MOTION_EVENT = 35 - AMOTION_EVENT_AXIS_GENERIC_5 MOTION_EVENT = 36 - AMOTION_EVENT_AXIS_GENERIC_6 MOTION_EVENT = 37 - AMOTION_EVENT_AXIS_GENERIC_7 MOTION_EVENT = 38 - AMOTION_EVENT_AXIS_GENERIC_8 MOTION_EVENT = 39 - AMOTION_EVENT_AXIS_GENERIC_9 MOTION_EVENT = 40 - AMOTION_EVENT_AXIS_GENERIC_10 MOTION_EVENT = 41 - AMOTION_EVENT_AXIS_GENERIC_11 MOTION_EVENT = 42 - AMOTION_EVENT_AXIS_GENERIC_12 MOTION_EVENT = 43 - AMOTION_EVENT_AXIS_GENERIC_13 MOTION_EVENT = 44 - AMOTION_EVENT_AXIS_GENERIC_14 MOTION_EVENT = 45 - AMOTION_EVENT_AXIS_GENERIC_15 MOTION_EVENT = 46 - AMOTION_EVENT_AXIS_GENERIC_16 MOTION_EVENT = 47 - AMOTION_EVENT_AXIS_GESTURE_X_OFFSET MOTION_EVENT = 48 - AMOTION_EVENT_AXIS_GESTURE_Y_OFFSET MOTION_EVENT = 49 - AMOTION_EVENT_AXIS_GESTURE_SCROLL_X_DISTANCE MOTION_EVENT = 50 - AMOTION_EVENT_AXIS_GESTURE_SCROLL_Y_DISTANCE MOTION_EVENT = 51 - AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR MOTION_EVENT = 52 - AMOTION_EVENT_AXIS_GESTURE_SWIPE_FINGER_COUNT MOTION_EVENT = 53 - AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE MOTION_EVENT = 53 -) diff --git a/input/motion_event_button.go b/input/motion_event_button.go deleted file mode 100644 index e94dede..0000000 --- a/input/motion_event_button.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type MOTION_EVENT_BUTTON int32 - -const ( - AMOTION_EVENT_BUTTON_PRIMARY MOTION_EVENT_BUTTON = 1 - AMOTION_EVENT_BUTTON_SECONDARY MOTION_EVENT_BUTTON = 2 - AMOTION_EVENT_BUTTON_TERTIARY MOTION_EVENT_BUTTON = 4 - AMOTION_EVENT_BUTTON_BACK MOTION_EVENT_BUTTON = 8 - AMOTION_EVENT_BUTTON_FORWARD MOTION_EVENT_BUTTON = 16 - AMOTION_EVENT_BUTTON_STYLUS_PRIMARY MOTION_EVENT_BUTTON = 32 - AMOTION_EVENT_BUTTON_STYLUS_SECONDARY MOTION_EVENT_BUTTON = 64 -) diff --git a/input/motion_event_edge_flag.go b/input/motion_event_edge_flag.go deleted file mode 100644 index 14f486e..0000000 --- a/input/motion_event_edge_flag.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type MOTION_EVENT_EDGE_FLAG int32 - -const ( - AMOTION_EVENT_EDGE_FLAG_NONE MOTION_EVENT_EDGE_FLAG = 0 - AMOTION_EVENT_EDGE_FLAG_TOP MOTION_EVENT_EDGE_FLAG = 1 - AMOTION_EVENT_EDGE_FLAG_BOTTOM MOTION_EVENT_EDGE_FLAG = 2 - AMOTION_EVENT_EDGE_FLAG_LEFT MOTION_EVENT_EDGE_FLAG = 4 - AMOTION_EVENT_EDGE_FLAG_RIGHT MOTION_EVENT_EDGE_FLAG = 8 -) diff --git a/input/motion_event_flag_window.go b/input/motion_event_flag_window.go deleted file mode 100644 index 855bc02..0000000 --- a/input/motion_event_flag_window.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type MOTION_EVENT_FLAG_WINDOW int32 - -const ( - AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED MOTION_EVENT_FLAG_WINDOW = 1 -) diff --git a/input/motion_event_tool_type.go b/input/motion_event_tool_type.go deleted file mode 100644 index f94112d..0000000 --- a/input/motion_event_tool_type.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -type MOTION_EVENT_TOOL_TYPE int32 - -const ( - AMOTION_EVENT_TOOL_TYPE_UNKNOWN MOTION_EVENT_TOOL_TYPE = 0 - AMOTION_EVENT_TOOL_TYPE_FINGER MOTION_EVENT_TOOL_TYPE = 1 - AMOTION_EVENT_TOOL_TYPE_STYLUS MOTION_EVENT_TOOL_TYPE = 2 - AMOTION_EVENT_TOOL_TYPE_MOUSE MOTION_EVENT_TOOL_TYPE = 3 - AMOTION_EVENT_TOOL_TYPE_ERASER MOTION_EVENT_TOOL_TYPE = 4 - AMOTION_EVENT_TOOL_TYPE_PALM MOTION_EVENT_TOOL_TYPE = 5 -) diff --git a/input/package.go b/input/package.go deleted file mode 100644 index be4e6b3..0000000 --- a/input/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package input provides Go bindings for Android Input events. -package input diff --git a/input/queue.go b/input/queue.go deleted file mode 100644 index c0014e3..0000000 --- a/input/queue.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/input" -) - -// Queue wraps the NDK AInputQueue handle. -type Queue struct { - ptr *capi.AInputQueue -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Queue) cptr() *capi.AInputQueue { - if h == nil { - return nil - } - return h.ptr -} - -// NewQueueFromPointer wraps a raw AInputQueue pointer. -func NewQueueFromPointer(ptr unsafe.Pointer) *Queue { - return &Queue{ptr: (*capi.AInputQueue)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Queue) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Queue) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewQueueFromUintPtr wraps a uintptr as a Queue. -// The caller must ensure ptr points to a valid AInputQueue. -func NewQueueFromUintPtr(ptr uintptr) *Queue { - return &Queue{ptr: (*capi.AInputQueue)(unsafe.Pointer(ptr))} -} - -// DetachLooper calls the underlying NDK function. -func (h *Queue) DetachLooper() { - capi.AInputQueue_detachLooper(h.ptr) -} - -// FinishEvent calls the underlying NDK function. -func (h *Queue) FinishEvent(event *Event, handled int32) { - capi.AInputQueue_finishEvent(h.ptr, event.cptr(), handled) -} - -// HasEvents calls the underlying NDK function. -func (h *Queue) HasEvents() error { - return result(capi.AInputQueue_hasEvents(h.ptr)) -} diff --git a/input/queue_event.go b/input/queue_event.go deleted file mode 100644 index 980d80d..0000000 --- a/input/queue_event.go +++ /dev/null @@ -1,22 +0,0 @@ -package input - -import ( - capi "github.com/AndroidGoLab/ndk/capi/input" -) - -// GetEvent returns the next available input event from the queue. -// Returns nil if no events are available or an error occurred. -func (h *Queue) GetEvent() *Event { - var ev *capi.AInputEvent - if capi.AInputQueue_getEvent(h.ptr, &ev) < 0 { - return nil - } - return &Event{ptr: ev} -} - -// PreDispatchEvent performs pre-dispatching of the given event. -// Returns true if the event was consumed by pre-dispatching (e.g. IME) -// and should NOT be passed to FinishEvent. -func (h *Queue) PreDispatchEvent(event *Event) bool { - return capi.AInputQueue_preDispatchEvent(h.ptr, event.ptr) != 0 -} diff --git a/input/source.go b/input/source.go deleted file mode 100644 index 8b641dd..0000000 --- a/input/source.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package input - -import "fmt" - -type Source int32 - -const ( - Unknown Source = 0 - Keyboard Source = 257 - Dpad Source = 513 - Gamepad Source = 1025 - Touchscreen Source = 4098 - Mouse Source = 8194 - Stylus Source = 16386 - BluetoothStylus Source = 49154 - Trackball Source = 65540 - MouseRelative Source = 131076 - Touchpad Source = 1048584 - TouchNavigation Source = 2097152 - Joystick Source = 16777232 - Hdmi Source = 33554433 - Sensor Source = 67108864 - RotaryEncoder Source = 4194304 - Any Source = -256 -) - -func (v Source) String() string { - switch v { - case Unknown: - return "Unknown" - case Keyboard: - return "Keyboard" - case Dpad: - return "Dpad" - case Gamepad: - return "Gamepad" - case Touchscreen: - return "Touchscreen" - case Mouse: - return "Mouse" - case Stylus: - return "Stylus" - case BluetoothStylus: - return "BluetoothStylus" - case Trackball: - return "Trackball" - case MouseRelative: - return "MouseRelative" - case Touchpad: - return "Touchpad" - case TouchNavigation: - return "TouchNavigation" - case Joystick: - return "Joystick" - case Hdmi: - return "Hdmi" - case Sensor: - return "Sensor" - case RotaryEncoder: - return "RotaryEncoder" - case Any: - return "Any" - default: - return fmt.Sprintf("Source(%d)", int(v)) - } -} diff --git a/internal/unsafeutil/unsafeutil.go b/internal/unsafeutil/unsafeutil.go deleted file mode 100644 index 6e132b9..0000000 --- a/internal/unsafeutil/unsafeutil.go +++ /dev/null @@ -1,12 +0,0 @@ -package unsafeutil - -import "unsafe" - -// SlicePointer returns an unsafe.Pointer to the first element of a slice. -// Returns nil if the slice is empty. -func SlicePointer[T any](s []T) unsafe.Pointer { - if len(s) == 0 { - return nil - } - return unsafe.Pointer(&s[0]) -} diff --git a/jni/activity.go b/jni/activity.go deleted file mode 100644 index 7751a9b..0000000 --- a/jni/activity.go +++ /dev/null @@ -1,151 +0,0 @@ -// Package jni provides JNI helper functions for Android NativeActivity -// operations that have no NDK C API equivalent (permission dialogs, Toast -// messages, SurfaceTexture creation from Java). -// -// This package is hand-written (not auto-generated) because JNI calls require -// inline C with JNIEnv method tables. -package jni - -/* -#cgo LDFLAGS: -landroid -lnativewindow - -#include -#include -#include -#include -#include -#include - -static int hasPermission(ANativeActivity* act, const char* perm) { - JNIEnv* env = act->env; - jclass cls = (*env)->GetObjectClass(env, act->clazz); - jmethodID mid = (*env)->GetMethodID(env, cls, "checkSelfPermission", - "(Ljava/lang/String;)I"); - if (mid == NULL) { - (*env)->ExceptionClear(env); - (*env)->DeleteLocalRef(env, cls); - return 0; - } - jstring jperm = (*env)->NewStringUTF(env, perm); - jint result = (*env)->CallIntMethod(env, act->clazz, mid, jperm); - (*env)->DeleteLocalRef(env, jperm); - (*env)->DeleteLocalRef(env, cls); - return (result == 0) ? 1 : 0; -} - -static void requestPermission(ANativeActivity* act, const char* perm) { - JNIEnv* env = act->env; - jclass cls = (*env)->GetObjectClass(env, act->clazz); - jmethodID mid = (*env)->GetMethodID(env, cls, "requestPermissions", - "([Ljava/lang/String;I)V"); - if (mid == NULL) { - (*env)->ExceptionClear(env); - (*env)->DeleteLocalRef(env, cls); - return; - } - jclass strCls = (*env)->FindClass(env, "java/lang/String"); - jstring jperm = (*env)->NewStringUTF(env, perm); - jobjectArray arr = (*env)->NewObjectArray(env, 1, strCls, jperm); - (*env)->CallVoidMethod(env, act->clazz, mid, arr, (jint)1); - (*env)->DeleteLocalRef(env, arr); - (*env)->DeleteLocalRef(env, jperm); - (*env)->DeleteLocalRef(env, strCls); - (*env)->DeleteLocalRef(env, cls); -} - -static void showToast(ANativeActivity* act, const char* msg) { - JNIEnv* env = act->env; - jclass actCls = (*env)->GetObjectClass(env, act->clazz); - jmethodID getCtx = (*env)->GetMethodID(env, actCls, - "getApplicationContext", "()Landroid/content/Context;"); - jobject ctx = (*env)->CallObjectMethod(env, act->clazz, getCtx); - - jclass toastCls = (*env)->FindClass(env, "android/widget/Toast"); - jmethodID makeText = (*env)->GetStaticMethodID(env, toastCls, "makeText", - "(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;"); - jmethodID show = (*env)->GetMethodID(env, toastCls, "show", "()V"); - - jstring jmsg = (*env)->NewStringUTF(env, msg); - jobject toast = (*env)->CallStaticObjectMethod(env, toastCls, makeText, - ctx, jmsg, (jint)1); - (*env)->CallVoidMethod(env, toast, show); - - (*env)->DeleteLocalRef(env, toast); - (*env)->DeleteLocalRef(env, jmsg); - (*env)->DeleteLocalRef(env, toastCls); - (*env)->DeleteLocalRef(env, ctx); - (*env)->DeleteLocalRef(env, actCls); -} - -static ASurfaceTexture* createSurfaceTexture( - ANativeActivity* act, int texName, int width, int height -) { - JNIEnv* env = act->env; - jclass cls = (*env)->FindClass(env, "android/graphics/SurfaceTexture"); - jmethodID ctor = (*env)->GetMethodID(env, cls, "", "(I)V"); - jobject jst = (*env)->NewObject(env, cls, ctor, (jint)texName); - - jmethodID setSize = (*env)->GetMethodID(env, cls, - "setDefaultBufferSize", "(II)V"); - (*env)->CallVoidMethod(env, jst, setSize, (jint)width, (jint)height); - - ASurfaceTexture* nst = ASurfaceTexture_fromSurfaceTexture(env, jst); - (*env)->DeleteLocalRef(env, jst); - (*env)->DeleteLocalRef(env, cls); - return nst; -} - -static void fillWindowColor(ANativeWindow* win, uint32_t color) { - ANativeWindow_setBuffersGeometry(win, 0, 0, WINDOW_FORMAT_RGBA_8888); - ANativeWindow_Buffer buf; - if (ANativeWindow_lock(win, &buf, NULL) != 0) return; - uint32_t* px = (uint32_t*)buf.bits; - for (int y = 0; y < buf.height; y++) { - for (int x = 0; x < buf.width; x++) { - px[y * buf.stride + x] = color; - } - } - ANativeWindow_unlockAndPost(win); -} -*/ -import "C" - -import "unsafe" - -// HasPermission checks whether the activity has the given permission granted. -func HasPermission(activityPtr unsafe.Pointer, permission string) bool { - cperm := C.CString(permission) - defer C.free(unsafe.Pointer(cperm)) - return C.hasPermission((*C.ANativeActivity)(activityPtr), cperm) != 0 -} - -// RequestPermission shows the system permission dialog for the given permission. -func RequestPermission(activityPtr unsafe.Pointer, permission string) { - cperm := C.CString(permission) - defer C.free(unsafe.Pointer(cperm)) - C.requestPermission((*C.ANativeActivity)(activityPtr), cperm) -} - -// ShowToast displays an Android Toast message. -func ShowToast(activityPtr unsafe.Pointer, message string) { - cmsg := C.CString(message) - defer C.free(unsafe.Pointer(cmsg)) - C.showToast((*C.ANativeActivity)(activityPtr), cmsg) -} - -// CreateSurfaceTexture creates a Java SurfaceTexture wrapping the given GL -// texture name and returns the native ASurfaceTexture handle as unsafe.Pointer. -func CreateSurfaceTexture( - activityPtr unsafe.Pointer, - texName, width, height int, -) unsafe.Pointer { - return unsafe.Pointer(C.createSurfaceTexture( - (*C.ANativeActivity)(activityPtr), - C.int(texName), C.int(width), C.int(height), - )) -} - -// FillWindowColor fills an ANativeWindow with a solid RGBA color. -func FillWindowColor(windowPtr unsafe.Pointer, color uint32) { - C.fillWindowColor((*C.ANativeWindow)(windowPtr), C.uint32_t(color)) -} diff --git a/lakefile.toml b/lakefile.toml deleted file mode 100644 index c1ac580..0000000 --- a/lakefile.toml +++ /dev/null @@ -1,10 +0,0 @@ -name = "proofs_tmp" -version = "0.1.0" -defaultTargets = ["proofs_tmp"] - -[[lean_lib]] -name = "ProofsTmp" - -[[lean_exe]] -name = "proofs_tmp" -root = "Main" diff --git a/lean-toolchain b/lean-toolchain deleted file mode 100644 index 2586f88..0000000 --- a/lean-toolchain +++ /dev/null @@ -1 +0,0 @@ -leanprover/lean4:v4.16.0 diff --git a/llms.txt b/llms.txt deleted file mode 100644 index 3ca2d69..0000000 --- a/llms.txt +++ /dev/null @@ -1,1278 +0,0 @@ -# Android Go NDK - -> Idiomatic Go bindings for the Android NDK, auto-generated from C headers. Covers 34 modules: camera, audio, sensors, EGL, OpenGL ES, Vulkan, media codecs, input, looper, window, assets, thermal, permissions, and more. All types have nil-safe Close() methods, error types wrap NDK status codes, and builder types support method chaining. No runtime.SetFinalizer — all resource cleanup is explicit via Close() and defer. - -## Idiomatic vs capi Packages - -Always import the idiomatic top-level packages (`github.com/AndroidGoLab/ndk/{module}`) — not the `capi/` packages. The `capi/` layer is a raw CGo binding with C-style names and unsafe types; it is intended only for power users who need NDK functions not yet wrapped by the idiomatic layer. All commonly used functions — including `hwbuf.Allocate`, `buf.Lock`, `codec.DequeueInputBuffer`, `codec.DequeueOutputBuffer`, and `hwbuf.RecvHandleFromUnixSocket` — are available in the idiomatic layer. - -## Resource Lifecycle and Memory Management - -Native NDK resources (camera devices, audio streams, media codecs, etc.) are wrapped in Go structs that hold a C pointer. The project does NOT use `runtime.SetFinalizer` — all cleanup is explicit: - -### Close Pattern - -Every closeable type follows this pattern: - -```go -func (h *Device) Close() error { - if h.ptr == nil { - return nil // nil-safe, idempotent - } - err := result(capi.ACameraDevice_close(h.ptr)) - h.ptr = nil // prevent double-free - return err -} -``` - -Key properties: -- **Nil-safe**: Calling Close() on a nil receiver or already-closed handle is a no-op. -- **Idempotent**: Multiple Close() calls are safe. -- **Sets pointer to nil**: Prevents use-after-free and double-free. - -### Defer-Based Cleanup - -Always use `defer` to ensure cleanup in reverse creation order: - -```go -mgr := camera.NewManager() -defer func() { - if err := mgr.Close(); err != nil { - log.Printf("manager close: %v", err) - } -}() - -dev, err := mgr.OpenCamera(camID, callbacks) -if err != nil { - log.Fatal(err) -} -defer dev.Close() - -req, err := dev.CreateCaptureRequest(camera.Preview) -if err != nil { - log.Fatal(err) -} -defer req.Close() -// Cleanup order: req -> dev -> mgr (reverse creation order) -``` - -### Framework-Owned vs Application-Owned Resources - -Some resources are singletons owned by the Android framework and must NOT be closed: - -- `sensor.GetInstance()` — returns the singleton ASensorManager. No Close(). -- `activity.AssetManager` — the AAssetManager from ANativeActivity. No Close(). - -Application-created resources MUST be closed: - -- `camera.NewManager()` → `mgr.Close()` -- `audio.NewStreamBuilder()` → `builder.Close()` -- `media.NewDecoder(mime)` → `codec.Close()` -- All `New*()` constructors return resources that need Close(). - -### Preventing Memory Leaks - -Since there is no GC integration for native resources: - -1. **Always defer Close()** immediately after creation. -2. **Check errors from Close()** — some resources (camera devices) may return errors on close. -3. **Clean up in reverse order** — defers naturally handle this. -4. **Reference counting for windows**: Call `window.Acquire()` when sharing an ANativeWindow across goroutines, and `window.Close()` (which calls ANativeWindow_release) from each user. -5. **Looper reference counting**: Call `looper.Acquire()` before sharing across goroutines, each user calls Close(). - -### CGo Pointer Pinning - -When passing Go-allocated pointers to C functions, use `runtime.Pinner`: - -```go -src := glStr(shaderSource) // Go-allocated string -var pinner runtime.Pinner -pinner.Pin(src) -defer pinner.Unpin() -gles2.ShaderSource(shader, 1, &src, &length) -``` - -For `**T` parameters, pin BOTH the outer and inner pointers. For structs with Go pointer fields, pin the struct before passing to C. - -## Error Handling - -NDK functions return negative int32 status codes on failure. Each module defines typed error constants: - -```go -// camera/errors.go -type Error int32 - -const ( - ErrUnknown Error = -10000 - ErrInvalidParameter Error = -10001 - ErrCameraDisconnected Error = -10002 - ErrNotEnoughMemory Error = -10003 - ErrCameraInUse Error = -10010 - ErrPermissionDenied Error = -10013 - // ... more error codes -) - -func (e Error) Error() string { - return fmt.Sprintf("camera: error %d", int(e)) -} -``` - -Usage with errors.Is: - -```go -dev, err := mgr.OpenCamera(camID, callbacks) -if errors.Is(err, camera.ErrPermissionDenied) { - log.Fatal("CAMERA permission not granted") -} -if err != nil { - log.Fatal(err) -} -``` - -## Thread Safety - -Some Android NDK APIs are thread-local and require `runtime.LockOSThread()`: - -### Thread-Local APIs - -- **ALooper**: Thread-local event loop. Must call `looper.Prepare()` and `looper.PollOnce()` on the same OS thread. -- **EGL context**: EGL contexts are bound to a thread via `egl.MakeCurrent()`. All GL calls must happen on that thread. -- **AInputQueue**: Input event polling must happen on the thread that attached the queue. - -Pattern: - -```go -func renderLoop(display egl.EGLDisplay, surface egl.EGLSurface, context egl.EGLContext) { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - egl.MakeCurrent(display, surface, surface, context) - defer egl.MakeCurrent(display, egl.NoSurface, egl.NoSurface, egl.NoContext) - - for { - // All OpenGL ES calls must happen on this thread - gles2.Clear(gles2.ColorBufferBit) - egl.SwapBuffers(display, surface) - } -} -``` - -### Thread-Safe APIs - -- Camera callbacks (OnDisconnected, OnError, OnReady) are called from NDK threads — use `sync.Mutex` or channels for synchronization. -- `audio.Stream.Write()` and `audio.Stream.Read()` are thread-safe. -- `looper.Wake()` is safe to call from any goroutine (after Acquire). - -### Cross-Goroutine Coordination - -```go -var wg sync.WaitGroup -wg.Add(1) -var readyOnce sync.Once - -session, err := dev.CreateCaptureSession(container, - camera.SessionStateCallbacks{ - OnReady: func() { - readyOnce.Do(wg.Done) - }, - }, -) -wg.Wait() // Block until session is ready -session.SetRepeatingRequest(req) -``` - -## Handle Interoperability - -All handle types implement the `handle.NativeHandle` interface for interop with golang.org/x/mobile, gioui.org, and gomobile bind: - -```go -// handle/handle.go -type NativeHandle interface { - Pointer() unsafe.Pointer - UintPtr() uintptr -} -``` - -Every handle provides: - -```go -mgr := camera.NewManager() -ptr := mgr.UintPtr() // Get as uintptr -mgr2 := camera.NewManagerFromUintPtr(ptr) // Reconstruct -mgr3 := camera.NewManagerFromPointer(rawPtr) // From unsafe.Pointer -``` - -For gomobile bind (which doesn't support uintptr), transport as int64: - -```go -// Go side (exported to Java via gomobile bind) -func NewBridge(handle int64) *Bridge { - mgr := sensor.NewManagerFromUintPtr(uintptr(handle)) - return &Bridge{mgr: mgr} -} -func (b *Bridge) Handle() int64 { - return int64(b.mgr.UintPtr()) -} -``` - -```java -// Java side -long ptr = nativeGetSensorManager(); -Bridge bridge = Mypackage.newBridge(ptr); -``` - -## Audio (AAudio) - -### Playback - -```go -import ( - "time" - "unsafe" - "github.com/AndroidGoLab/ndk/audio" -) - -builder, err := audio.NewStreamBuilder() -if err != nil { - log.Fatal(err) -} -defer builder.Close() - -builder. - SetDirection(audio.Output). - SetSampleRate(44100). - SetChannelCount(2). - SetFormat(audio.PcmFloat). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - -stream, err := builder.Open() -if err != nil { - log.Fatal(err) -} -defer stream.Close() - -stream.Start() - -framesPerBurst := stream.FramesPerBurst() -buf := make([]float32, int(framesPerBurst)*2) -bufBytes := unsafe.Slice((*byte)(unsafe.Pointer(&buf[0])), len(buf)*int(unsafe.Sizeof(buf[0]))) - -totalFrames := int32(44100 * 2) // 2 seconds -written := int32(0) -for written < totalFrames { - framesToWrite := framesPerBurst - if remaining := totalFrames - written; remaining < framesToWrite { - framesToWrite = remaining - } - n, err := stream.Write(bufBytes, framesToWrite, time.Second) - if err != nil { - log.Fatal(err) - } - written += n -} - -stream.Stop() -``` - -### Recording - -```go -builder. - SetDirection(audio.Input). - SetSampleRate(48000). - SetChannelCount(1). - SetFormat(audio.PcmI16). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - -stream, _ := builder.Open() -defer stream.Close() -stream.Start() - -buf := make([]int16, 1024) -bufBytes := unsafe.Slice((*byte)(unsafe.Pointer(&buf[0])), len(buf)*int(unsafe.Sizeof(buf[0]))) -totalFrames := stream.SampleRate() // 1 second -var captured []int16 - -for int32(len(captured)) < totalFrames { - framesToRead := int32(len(buf)) - if remaining := totalFrames - int32(len(captured)); remaining < framesToRead { - framesToRead = remaining - } - n, err := stream.Read(bufBytes, framesToRead, time.Second) - if err != nil { - log.Fatal(err) - } - captured = append(captured, buf[:n]...) -} -stream.Stop() -``` - -### Stream Properties - -```go -stream.SampleRate() // int32 -stream.ChannelCount() // int32 -stream.FramesPerBurst() // int32 -stream.State() // StreamState -stream.XRunCount() // int32 (underrun count) -stream.GetFramesRead() // int64 -stream.GetFramesWritten() // int64 -``` - -## Camera (Camera2 NDK) - -### Complete Capture Pipeline - -```go -import "github.com/AndroidGoLab/ndk/camera" - -// 1. Create manager -mgr := camera.NewManager() -defer mgr.Close() - -// 2. Discover cameras -ids, err := mgr.CameraIDList() -if err != nil { - log.Fatal(err) -} - -// 3. Read characteristics -chars, err := mgr.GetCameraCharacteristics(ids[0]) -if err != nil { - log.Fatal(err) -} -defer chars.Close() - -// Query sensor orientation -if chars.I32Count(uint32(camera.SensorOrientation)) > 0 { - orient := chars.I32At(uint32(camera.SensorOrientation), 0) - log.Printf("orientation: %d degrees", orient) -} - -// Query stream configurations (format, width, height, isInput tuples) -scTag := uint32(camera.ScalerAvailableStreamConfigurations) -count := chars.I32Count(scTag) -for i := int32(0); i+3 < count; i += 4 { - format := chars.I32At(scTag, i) - w := chars.I32At(scTag, i+1) - h := chars.I32At(scTag, i+2) - isInput := chars.I32At(scTag, i+3) - if isInput == 0 { - log.Printf("output: format=%d %dx%d", format, w, h) - } -} - -// 4. Open camera with state callbacks -dev, err := mgr.OpenCamera(ids[0], camera.DeviceStateCallbacks{ - OnDisconnected: func() { log.Println("disconnected") }, - OnError: func(code int) { log.Printf("error %d", code) }, -}) -if err != nil { - log.Fatal(err) -} -defer dev.Close() - -// 5. Create capture request -req, err := dev.CreateCaptureRequest(camera.Preview) -if err != nil { - log.Fatal(err) -} -defer req.Close() - -// 6. Create output target from ANativeWindow (from Surface/SurfaceTexture) -outTarget, err := camera.NewOutputTarget(nativeWindow) -if err != nil { - log.Fatal(err) -} -defer outTarget.Close() -req.AddTarget(outTarget) - -// 7. Create session output container -sessOut, err := camera.NewSessionOutput(nativeWindow) -if err != nil { - log.Fatal(err) -} -defer sessOut.Close() - -container, err := camera.NewSessionOutputContainer() -if err != nil { - log.Fatal(err) -} -defer container.Close() -container.Add(sessOut) - -// 8. Create capture session with readiness gate -var wg sync.WaitGroup -wg.Add(1) -var readyOnce sync.Once - -session, err := dev.CreateCaptureSession(container, - camera.SessionStateCallbacks{ - OnReady: func() { readyOnce.Do(wg.Done) }, - OnActive: func() { log.Println("session active") }, - OnClosed: func() { log.Println("session closed") }, - }, -) -if err != nil { - log.Fatal(err) -} -defer session.Close() - -wg.Wait() - -// 9. Start repeating capture -session.SetRepeatingRequest(req) -// ... render frames ... -session.StopRepeating() - -// Cleanup order (via defers): session -> container -> sessOut -> outTarget -> req -> dev -> mgr -``` - -### Template Types - -Available capture request templates: `camera.Preview`, `camera.StillCapture`, `camera.Record`, `camera.VideoSnapshot`, `camera.ZeroShutterLag`, `camera.Manual`. - -## Sensor - -### Sensor Discovery - -```go -import "github.com/AndroidGoLab/ndk/sensor" - -mgr := sensor.GetInstance() // Singleton, no Close() needed - -accel := mgr.DefaultSensor(sensor.Accelerometer) -fmt.Println(accel.Name()) // e.g. "LSM6DSO Accelerometer" -fmt.Println(accel.Vendor()) // e.g. "STMicroelectronics" -fmt.Println(accel.Resolution()) // float32 -fmt.Println(accel.MinDelay()) // microseconds between events -``` - -### Sensor Types - -Available sensor types: `sensor.Accelerometer`, `sensor.MagneticField`, `sensor.Gyroscope`, `sensor.Light`, `sensor.Pressure`, `sensor.Proximity`, `sensor.Gravity`, `sensor.LinearAcceleration`, `sensor.RotationVector`, `sensor.RelativeHumidity`, `sensor.AmbientTemperature`, `sensor.GameRotationVector`, `sensor.StepDetector`, `sensor.StepCounter`, `sensor.GeomagneticRotationVector`, `sensor.HeartRate`, `sensor.HingeAngle`, `sensor.HeadTracker`, `sensor.Heading`. - -### Checking Sensor Availability - -DefaultSensor always returns a non-nil wrapper. If the sensor is absent, the C pointer is NULL and Name() will panic: - -```go -func probeSensor(mgr *sensor.Manager, t sensor.Type) (name string, ok bool) { - defer func() { - if r := recover(); r != nil { - ok = false - } - }() - s := mgr.DefaultSensor(t) - name = s.Name() - return name, name != "" -} -``` - -### Sensor Event Loop (ALooper-Based) - -Reading continuous sensor data requires an ALooper-based event queue: - -```go -import ( - "runtime" - "github.com/AndroidGoLab/ndk/sensor" - "github.com/AndroidGoLab/ndk/looper" -) - -// Step 1: Lock goroutine to OS thread (ALooper is thread-local) -runtime.LockOSThread() -defer runtime.UnlockOSThread() - -// Step 2: Get sensor manager and accelerometer -mgr := sensor.GetInstance() -accel := mgr.DefaultSensor(sensor.Accelerometer) - -// Step 3: Prepare a looper for the current thread -lp := looper.Prepare(int32(looper.ALOOPER_PREPARE_ALLOW_NON_CALLBACKS)) -defer lp.Close() - -// Step 4: Create an event queue bound to the looper -const sensorIdent = 1 -queue := mgr.CreateEventQueue(lp.Pointer(), sensorIdent, nil, nil) -defer mgr.DestroyEventQueue(queue) - -// Step 5: Enable sensor and set sampling rate -queue.EnableSensor(accel) -queue.SetEventRate(accel, 100000) // 100ms between events -defer queue.DisableSensor(accel) - -// Step 6: Poll loop — read sensor events -for { - ident := looper.PollOnce(-1, nil, nil, nil) // -1 = block forever - if ident == sensorIdent { - for queue.HasEvents() > 0 { - // Read ASensorEvent from queue. - // Each event has: type, timestamp, and data union. - // For accelerometer: - // data[0] = X acceleration (m/s^2) - // data[1] = Y acceleration (m/s^2) - // data[2] = Z acceleration (m/s^2) - } - } -} -``` - -## Media Codecs (AMediaCodec) - -### Codec State Machine - -``` -Created -> Configured -> Started -> (buffer processing) -> Flushed -> Started -> Stopped -> Released -``` - -Wraps the NDK `AMediaCodec` API. Key C functions: `AMediaCodec_createDecoderByType`, `AMediaCodec_createEncoderByType`, `AMediaCodec_configure`, `AMediaCodec_start`, `AMediaCodec_stop`, `AMediaCodec_flush`, `AMediaCodec_delete`. - -### Decoder Setup - -```go -import "github.com/AndroidGoLab/ndk/media" - -// Create H.264 decoder (wraps AMediaCodec_createDecoderByType) -codec := media.NewDecoder("video/avc") -if codec == nil { - log.Fatal("H.264 decoder not available") -} -defer codec.Close() - -// Configure format (wraps AMediaFormat) -format := media.NewFormat() -defer format.Close() - -format. - SetString("mime", "video/avc"). - SetInt32("width", 1920). - SetInt32("height", 1080) - -// Verify properties -var width int32 -format.GetInt32("width", &width) // returns bool - -// Configure as decoder: flags=0 (requires Activity context) -codec.Configure(format, nil, nil, 0) -codec.Start() -``` - -### H.264 Encoder Setup - -```go -import "github.com/AndroidGoLab/ndk/media" - -// Create H.264 encoder (wraps AMediaCodec_createEncoderByType) -codec := media.NewEncoder("video/avc") -if codec == nil { - log.Fatal("H.264 encoder not available") -} -defer codec.Close() - -// Configure encoder format with required parameters. -// Format keys are plain strings matching the NDK AMEDIAFORMAT_KEY_* constants. -format := media.NewFormat() -defer format.Close() - -format. - SetString("mime", "video/avc"). // AMEDIAFORMAT_KEY_MIME - SetInt32("width", 1920). // AMEDIAFORMAT_KEY_WIDTH - SetInt32("height", 1080). // AMEDIAFORMAT_KEY_HEIGHT - SetInt32("bitrate", 4_000_000). // AMEDIAFORMAT_KEY_BIT_RATE (bits/sec) - SetInt32("frame-rate", 30). // AMEDIAFORMAT_KEY_FRAME_RATE - SetInt32("i-frame-interval", 1). // AMEDIAFORMAT_KEY_I_FRAME_INTERVAL (seconds) - SetInt32("color-format", 21) // COLOR_FormatYUV420SemiPlanar (0x15) - -// Optional: set bitrate mode (CBR for streaming, VBR for quality) -// media.ABITRATE_MODE_CBR = 2, media.ABITRATE_MODE_VBR = 1 -format.SetInt32("bitrate-mode", int32(media.ABITRATE_MODE_CBR)) - -// Optional: set H.264 profile and level -format.SetInt32("profile", 8) // AVCProfileHigh -format.SetInt32("level", 512) // AVCLevel31 - -// Configure as encoder: flags=1 (AMEDIACODEC_CONFIGURE_FLAG_ENCODE) -// surface=nil for buffer-mode input, crypto=nil for no DRM -const configureFlagEncode uint32 = 1 // media.AMEDIACODEC_CONFIGURE_FLAG_ENCODE -codec.Configure(format, nil, nil, configureFlagEncode) -codec.Start() -``` - -Common MIME types: `"video/avc"` (H.264), `"video/hevc"` (H.265), `"video/x-vnd.on2.vp8"` (VP8), `"video/x-vnd.on2.vp9"` (VP9), `"video/av01"` (AV1), `"audio/mp4a-latm"` (AAC), `"audio/opus"` (Opus). - -### Common AMediaFormat Keys - -Format keys are passed as strings to `SetInt32`/`SetString`/`SetFloat`/`SetInt64`: - -| Key string | NDK constant | Type | Description | -|---|---|---|---| -| `"mime"` | AMEDIAFORMAT_KEY_MIME | string | MIME type | -| `"width"` | AMEDIAFORMAT_KEY_WIDTH | int32 | Frame width in pixels | -| `"height"` | AMEDIAFORMAT_KEY_HEIGHT | int32 | Frame height in pixels | -| `"bitrate"` | AMEDIAFORMAT_KEY_BIT_RATE | int32 | Target bitrate (bits/sec) | -| `"frame-rate"` | AMEDIAFORMAT_KEY_FRAME_RATE | int32 | Frame rate (fps) | -| `"i-frame-interval"` | AMEDIAFORMAT_KEY_I_FRAME_INTERVAL | int32 | I-frame interval (seconds) | -| `"color-format"` | AMEDIAFORMAT_KEY_COLOR_FORMAT | int32 | Color format enum | -| `"bitrate-mode"` | AMEDIAFORMAT_KEY_BITRATE_MODE | int32 | BitrateMode (0=CQ, 1=VBR, 2=CBR) | -| `"profile"` | AMEDIAFORMAT_KEY_PROFILE | int32 | Codec profile | -| `"level"` | AMEDIAFORMAT_KEY_LEVEL | int32 | Codec level | -| `"channel-count"` | AMEDIAFORMAT_KEY_CHANNEL_COUNT | int32 | Audio channel count | -| `"sample-rate"` | AMEDIAFORMAT_KEY_SAMPLE_RATE | int32 | Audio sample rate (Hz) | - -### Buffer Processing Loop - -The idiomatic `media` package provides all buffer processing functions: `DequeueInputBuffer`, `DequeueOutputBuffer`, `GetInputBuffer`, `QueueInputBuffer`, `GetOutputBuffer`, `ReleaseOutputBuffer`, and all constants (`media.AMEDIACODEC_INFO_*`, `media.AMEDIACODEC_BUFFER_FLAG_*`). The `media.BufferInfo` value struct is used with `DequeueOutputBuffer`. - -```go -import ( - "unsafe" - "github.com/AndroidGoLab/ndk/media" -) - -for { - // 1. Dequeue input buffer - idx := codec.DequeueInputBuffer(timeoutUs) - if idx < 0 { continue } // no buffer available yet - - // 2. Fill with data (NAL units for video, PCM for audio) - var bufSize uint64 - buf := codec.GetInputBuffer(uint64(idx), &bufSize) - data := unsafe.Slice(buf, bufSize) - n := copy(data, inputFrame) - - // 3. Queue for processing - codec.QueueInputBuffer(uint64(idx), 0, uint64(n), presentationTimeUs, 0) - // End of stream: pass uint32(media.AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) - - // 4. Dequeue output buffer with BufferInfo - var info media.BufferInfo - outIdx := codec.DequeueOutputBuffer(&info, timeoutUs) - if outIdx == int64(media.AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) { - continue // output format changed, query new format - } - if outIdx < 0 { continue } - - // 5. Consume output — info.Offset, info.Size, info.PresentationTimeUs, info.Flags - var outSize uint64 - outBuf := codec.GetOutputBuffer(uint64(outIdx), &outSize) - outData := unsafe.Slice(outBuf, outSize) - processOutput(outData) - - // 6. Release back to codec (render=true to send to surface) - codec.ReleaseOutputBuffer(uint64(outIdx), false) -} -``` - -### Buffer Flags - -Available in the idiomatic `media` package (type `media.MEDIACODEC_BUFFER_FLAG`): - -- `media.AMEDIACODEC_BUFFER_FLAG_KEY_FRAME` (1) — output buffer contains a key frame -- `media.AMEDIACODEC_BUFFER_FLAG_CODEC_CONFIG` (2) — buffer contains codec config data (SPS/PPS) -- `media.AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM` (4) — signals end of stream -- `media.AMEDIACODEC_BUFFER_FLAG_PARTIAL_FRAME` (8) — buffer contains partial frame data - -### Lifecycle Operations - -```go -codec.Flush() // Discard pending buffers, stay in Started state -codec.Stop() // Started -> Stopped -codec.Close() // Release all resources (wraps AMediaCodec_delete) -``` - -### Error Handling - -Media functions return errors wrapping `media_status_t` codes. Check with `errors.Is`: - -```go -if err := codec.Configure(format, nil, nil, flags); err != nil { - log.Fatalf("configure failed: %v", err) - // Common causes: unsupported format, missing codec, wrong flags -} -if err := codec.Start(); err != nil { - log.Fatalf("start failed: %v", err) -} -``` - -### Bitrate Modes - -```go -media.ABITRATE_MODE_CQ // 0 — Constant Quality -media.ABITRATE_MODE_VBR // 1 — Variable Bitrate -media.ABITRATE_MODE_CBR // 2 — Constant Bitrate -media.ABITRATE_MODE_CBR_FD // 3 — Constant Bitrate with Frame Drop -``` - -## Assets - -### Obtaining the Asset Manager - -The AAssetManager comes from the ANativeActivity struct. It is framework-owned — do not Close() it: - -```go -import "github.com/AndroidGoLab/ndk/asset" - -// In a NativeActivity app: -mgr := activity.AssetManager // from ANativeActivity, no Close() -``` - -### Reading an Asset File - -```go -a := mgr.Open("data/config.json", asset.Streaming) -defer a.Close() - -totalLen := a.Length64() -buf := make([]byte, totalLen) -err := a.Read(unsafe.Pointer(&buf[0]), uint64(totalLen)) -``` - -### Asset Open Modes - -- `asset.Unknown` — NDK chooses defaults -- `asset.Random` — random access via Seek; NDK may memory-map -- `asset.Streaming` — sequential forward reads; smaller buffer -- `asset.Buffer` — entire asset loaded into memory; `Buffer()` returns direct pointer - -### Direct Buffer Access - -```go -a := mgr.Open("data/config.json", asset.Buffer) -defer a.Close() -ptr := a.Buffer() // unsafe.Pointer to raw data -data := unsafe.Slice((*byte)(ptr), a.Length64()) -``` - -### Seeking - -```go -newPos := a.Seek(0, int32(io.SeekStart)) // SEEK_SET -remaining := a.RemainingLength64() -``` - -### Directory Iteration - -```go -dir := mgr.OpenDir("") // empty string = assets root -defer dir.Close() - -for { - name := dir.NextFileName() - if name == "" { - break - } - fmt.Println(name) -} -dir.Rewind() // reset iterator -``` - -## Looper (ALooper) - -### Basic Event Loop - -```go -import ( - "runtime" - "github.com/AndroidGoLab/ndk/looper" -) - -runtime.LockOSThread() -defer runtime.UnlockOSThread() - -lp := looper.Prepare(int32(looper.ALOOPER_PREPARE_ALLOW_NON_CALLBACKS)) -defer lp.Close() - -// Cross-goroutine wake -lp.Acquire() // extra reference for other goroutine -go func() { - time.Sleep(100 * time.Millisecond) - lp.Wake() // safe after Acquire -}() - -// Poll -result := looper.PollOnce(-1, nil, nil, nil) -switch { -case result == int32(looper.ALOOPER_POLL_WAKE): - log.Println("woken up") -case result == int32(looper.ALOOPER_POLL_TIMEOUT): - log.Println("timed out") -case result >= 0: - log.Printf("event from ident %d", result) -} -``` - -## EGL and OpenGL ES - -### EGL Context Setup - -```go -import ( - "runtime" - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/gles2" -) - -runtime.LockOSThread() -defer runtime.UnlockOSThread() - -display := egl.GetDisplay(egl.DefaultDisplay) -egl.Initialize(display, nil, nil) - -config := egl.ChooseConfig(display, attribs) -surface := egl.CreateWindowSurface(display, config, nativeWindow, nil) -context := egl.CreateContext(display, config, egl.NoContext, contextAttribs) - -egl.MakeCurrent(display, surface, surface, context) -defer egl.MakeCurrent(display, egl.NoSurface, egl.NoSurface, egl.NoContext) -defer egl.DestroyContext(display, context) -defer egl.DestroySurface(display, surface) -defer egl.Terminate(display) - -// Now use OpenGL ES on this thread -gles2.ClearColor(0.2, 0.3, 0.3, 1.0) -gles2.Clear(gles2.ColorBufferBit) -egl.SwapBuffers(display, surface) -``` - -### Shader Compilation - -```go -shader := gles2.CreateShader(gles2.VertexShader) -src := gles2.Str(vertexShaderSource) -var pinner runtime.Pinner -pinner.Pin(src) -defer pinner.Unpin() -length := gles2.GLint(len(vertexShaderSource)) -gles2.ShaderSource(shader, 1, &src, &length) -gles2.CompileShader(shader) -defer gles2.DeleteShader(shader) -``` - -## Thermal Monitoring - -```go -import "github.com/AndroidGoLab/ndk/thermal" - -mgr := thermal.NewManager() -defer mgr.Close() - -status := mgr.CurrentThermalStatus() -switch status { -case thermal.StatusNone: - log.Println("cool") -case thermal.StatusLight, thermal.StatusModerate: - log.Println("warm — consider reducing workload") -case thermal.StatusSevere, thermal.StatusCritical: - log.Println("hot — reduce workload immediately") -case thermal.StatusEmergency, thermal.StatusShutdown: - log.Println("critical — shutting down") -} -``` - -## Window (ANativeWindow) - -```go -import "github.com/AndroidGoLab/ndk/window" - -win := window.NewWindowFromPointer(rawPtr) -// Reference counting -win.Acquire() // increment ref count -defer win.Close() // decrement ref count (calls ANativeWindow_release) - -w := win.Width() -h := win.Height() -fmt.Printf("%dx%d\n", w, h) - -win.SetBuffersGeometry(1920, 1080, window.Rgba8888) -win.SetFrameRate(60.0, 0) -``` - -## Input Events - -```go -import ( - "runtime" - "github.com/AndroidGoLab/ndk/input" -) - -runtime.LockOSThread() -defer runtime.UnlockOSThread() - -queue := input.NewQueueFromPointer(rawQueuePtr) - -for queue.HasEvents() == nil { - event := queue.GetEvent() - if queue.PreDispatchEvent(event) { - continue - } - - switch event.Type() { - case input.EventTypeMotion: - action := event.MotionAction() - x := event.X(0) - y := event.Y(0) - pressure := event.Pressure(0) - log.Printf("touch action=%d at (%.1f, %.1f) pressure=%.2f", action, x, y, pressure) - case input.EventTypeKey: - keyCode := event.KeyCode() - log.Printf("key code=%d action=%d", keyCode, event.KeyAction()) - } - - queue.FinishEvent(event, 1) // 1 = handled -} -``` - -## Image Decoding - -```go -import "github.com/AndroidGoLab/ndk/image" - -decoder := image.NewDecoderFromFd(fd) -defer decoder.Close() - -info := decoder.HeaderInfo() -w := info.Width() -h := info.Height() -stride := decoder.MinimumStride() - -pixels := make([]byte, int(stride)*int(h)) -decoder.Decode(unsafe.Pointer(&pixels[0]), int(stride)*int(h), int(stride)) -``` - -## SurfaceTexture - -```go -import "github.com/AndroidGoLab/ndk/surfacetexture" - -st := surfacetexture.NewSurfaceTextureFromPointer(ptr) -defer st.Close() - -win := st.AcquireWindow() // Get ANativeWindow for camera/video output -defer win.Close() - -st.AttachToGLContext(textureID) -defer st.DetachFromGLContext() - -st.UpdateTexImage() // Pull latest frame to GL texture -ts := st.Timestamp() // Frame timestamp in nanoseconds - -var mat [16]float32 -st.TransformMatrix(&mat) // Get texture coordinate transform -``` - -## Trace (Performance) - -```go -import "github.com/AndroidGoLab/ndk/trace" - -if trace.IsEnabled() { - trace.BeginSection("myOperation") - defer trace.EndSection() - // ... measured code ... -} -``` - -## Log - -```go -import ndklog "github.com/AndroidGoLab/ndk/log" - -// Priority levels: ndklog.Verbose, ndklog.Debug, ndklog.Info, ndklog.Warn, ndklog.Error, ndklog.Fatal -ndklog.Write(int32(ndklog.Info), "MyApp", "Hello from NDK") -ndklog.Write(int32(ndklog.Error), "MyApp", "Something went wrong") -``` - -## Choreographer (VSync) - -The choreographer is a per-thread singleton tied to the calling thread's Looper. It does not require Close(). - -```go -import "github.com/AndroidGoLab/ndk/choreographer" - -// Obtain the per-thread singleton (requires an active Looper on the thread) -ch := choreographer.GetInstance() -if ch == nil { - log.Fatal("no choreographer — is a Looper prepared on this thread?") -} -// Frame callbacks are registered via the NDK's AChoreographer_postFrameCallback. -// Typical game loop: GetInstance -> register callback -> render -> re-register. -``` - -## Configuration - -```go -import "github.com/AndroidGoLab/ndk/config" - -cfg := config.NewConfig() -defer cfg.Close() - -log.Printf("density: %d", cfg.Density()) -log.Printf("orientation: %d", cfg.Orientation()) -log.Printf("screen size: %d", cfg.ScreenSize()) -log.Printf("SDK version: %d", cfg.SdkVersion()) -log.Printf("screen: %dx%d dp", cfg.ScreenWidthDp(), cfg.ScreenHeightDp()) -``` - -## Permission - -```go -import ( - "github.com/AndroidGoLab/ndk/permission" - jperm "github.com/xaionaro-go/jni/content/permission" -) - -// APermissionManager_checkPermission only checks — doesn't request -var result int32 -permission.CheckPermission(jperm.Camera, pid, uid, &result) -// result: 0 = granted, -1 = denied -// For requesting permissions at runtime, use the companion jni package. -``` - -## Shared Memory (ASharedMemory) - -Wraps the NDK `ASharedMemory` API for anonymous shared memory regions. The fd-based interface enables zero-copy IPC between processes via Binder or Unix sockets. - -### Creating and Mapping Shared Memory - -```go -import ( - "syscall" - "unsafe" - "github.com/AndroidGoLab/ndk/sharedmem" -) - -// 1. Create a shared memory region (wraps ASharedMemory_create) -// Returns a file descriptor, or negative error code on failure. -const size = 4096 -fd := sharedmem.ASharedMemory_create("my_buffer", size) -if fd < 0 { - log.Fatalf("ASharedMemory_create failed: %d", fd) -} -defer syscall.Close(int(fd)) - -// 2. Query the actual size (wraps ASharedMemory_getSize) -actualSize := sharedmem.ASharedMemory_getSize(fd) - -// 3. Map into process address space using syscall.Mmap -data, err := syscall.Mmap(int(fd), 0, int(actualSize), - syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_SHARED) -if err != nil { - log.Fatalf("mmap: %v", err) -} -defer syscall.Munmap(data) - -// 4. Read/write the shared memory region directly -copy(data, []byte("hello from producer")) -msg := string(data[:19]) - -// 5. Optionally restrict access before sharing (wraps ASharedMemory_setProt) -// Once restricted, further setProt calls can only remove permissions. -sharedmem.ASharedMemory_setProt(fd, syscall.PROT_READ) // make read-only - -// 6. Share the fd with another process via Unix socket or Binder. -// The other process mmaps the same fd for zero-copy access. -``` - -### Functions - -- `ASharedMemory_create(name string, size uint64) int32` — create region, returns fd -- `ASharedMemory_getSize(fd int32) uint64` — query region size in bytes -- `ASharedMemory_setProt(fd int32, prot int32) int32` — restrict access (PROT_READ, PROT_WRITE); returns 0 on success - -### Allocating and Freeing Native Memory - -For generic native memory allocation (not shared between processes), use standard Go or syscall: - -```go -// Option A: Go-allocated memory (managed by GC, pin before passing to C) -buf := make([]byte, 4096) -var pinner runtime.Pinner -pinner.Pin(&buf[0]) -defer pinner.Unpin() -// pass &buf[0] to C functions via unsafe.Pointer - -// Option B: syscall.Mmap for page-aligned anonymous memory -mem, err := syscall.Mmap(-1, 0, 4096, - syscall.PROT_READ|syscall.PROT_WRITE, - syscall.MAP_PRIVATE|syscall.MAP_ANONYMOUS) -if err != nil { - log.Fatal(err) -} -defer syscall.Munmap(mem) -// mem is a []byte backed by native memory, not GC-managed -``` - -## Hardware Buffer (AHardwareBuffer) - -Wraps the NDK `AHardwareBuffer` API for GPU/CPU-shared buffers. Lifecycle: Describe -> Allocate -> Lock -> Access -> Unlock -> Close. - -### Idiomatic Buffer Usage - -The idiomatic `hwbuf` package provides the full hardware buffer API: `Allocate`, `Lock`, `Describe`, `Acquire`, `Unlock`, `LockPlanes`, `SendHandleToUnixSocket`, `RecvHandleFromUnixSocket`, `IsSupported`, `GetID`, and `Close`, plus all format and usage constants. The `hwbuf.Desc` value struct has exported fields (Width, Height, Layers, Format, Usage, Stride, Rfu0, Rfu1) using raw uint32/uint64 types for layout compatibility. - -```go -import "github.com/AndroidGoLab/ndk/hwbuf" - -// Allocate and lifecycle -buf, err := hwbuf.Allocate(&desc) // allocate a new hardware buffer -buf.Describe() // get buffer description (*hwbuf.Desc) -buf.Lock(usage, fence, rect) // lock for CPU access (returns unsafe.Pointer) -buf.Acquire() // increment ref count for sharing -buf.Unlock(nil) // release CPU mapping (nil = synchronous) -buf.LockPlanes(usage, fence, rect, outPlanes) // multi-plane lock (YUV) -buf.SendHandleToUnixSocket(socketFd) // IPC sharing -hwbuf.RecvHandleFromUnixSocket(socketFd) // IPC receive -hwbuf.IsSupported(&desc) // check if config is supported -buf.GetID(&id) // get unique buffer ID -buf.Close() // decrement ref count, free when zero -``` - -### Allocate-Lock-Unlock Lifecycle - -The idiomatic `hwbuf` package provides `hwbuf.Desc` (a value struct with exported fields), `hwbuf.Allocate`, and `buf.Lock` for the full allocate-lock-unlock lifecycle. No `capi/` import is needed. - -```go -import ( - "unsafe" - "github.com/AndroidGoLab/ndk/hwbuf" -) - -// 1. Describe: fill the buffer descriptor (idiomatic value struct) -// Fields use raw uint32/uint64 for layout compatibility; cast enum constants. -desc := hwbuf.Desc{ - Width: 1920, - Height: 1080, - Layers: 1, - Format: uint32(hwbuf.R8g8b8a8Unorm), - Usage: uint64(hwbuf.CpuWriteOften | hwbuf.GpuSampledImage), -} - -// 2. Allocate — returns an idiomatic *hwbuf.Buffer directly -buf, err := hwbuf.Allocate(&desc) -if err != nil { - log.Fatalf("hwbuf.Allocate failed: %v", err) -} -defer buf.Close() // decrements ref count, frees when zero - -// 3. Lock for CPU access -// usage must be a subset of allocation usage flags. -// fence=-1 means no fence; rect=nil means full buffer. -pixelPtr, err := buf.Lock(uint64(hwbuf.CpuWriteOften), -1, nil) -if err != nil { - log.Fatalf("buf.Lock failed: %v", err) -} - -// 4. Access: read/write pixel data via the mapped pointer -// For R8G8B8A8: 4 bytes per pixel (R, G, B, A) -pixels := unsafe.Slice((*byte)(pixelPtr), 1920*1080*4) -for y := 0; y < 1080; y++ { - for x := 0; x < 1920; x++ { - off := (y*1920 + x) * 4 - pixels[off+0] = byte(x % 256) // R - pixels[off+1] = byte(y % 256) // G - pixels[off+2] = 0 // B - pixels[off+3] = 255 // A - } -} - -// 5. Unlock (nil fence = synchronous) -if err := buf.Unlock(nil); err != nil { - log.Fatalf("unlock: %v", err) -} - -// After unlock, the buffer is ready for GPU/compositor/encoder consumption. -``` - -### Format Constants - -`hwbuf.R8g8b8a8Unorm`, `hwbuf.R8g8b8Unorm`, `hwbuf.R8g8b8x8Unorm`, `hwbuf.R5g6b5Unorm`, `hwbuf.R16g16b16a16Float`, `hwbuf.R8Unorm`, `hwbuf.D16Unorm`, `hwbuf.D24Unorm`, `hwbuf.D24UnormS8Uint`, `hwbuf.D32Float`, `hwbuf.D32FloatS8Uint`, `hwbuf.S8Uint`, `hwbuf.Y8cb8cr8420`, `hwbuf.Ycbcr420P010`, `hwbuf.Blob`, `hwbuf.R10g10b10a2Unorm`. - -### Usage Flag Constants - -| Constant | Description | -|---|---| -| `hwbuf.CpuReadNever / CpuReadRarely / CpuReadOften` | CPU read access tier | -| `hwbuf.CpuWriteNever / CpuWriteRarely / CpuWriteOften` | CPU write access tier | -| `hwbuf.GpuSampledImage` | Sampled by GPU as texture | -| `hwbuf.GpuFramebuffer` | GPU framebuffer attachment | -| `hwbuf.GpuColorOutput` | GPU color output | -| `hwbuf.ComposerOverlay` | SurfaceFlinger/HWC overlay | -| `hwbuf.VideoEncode` | Video encoder input | -| `hwbuf.SensorDirectData` | Sensor direct report | -| `hwbuf.GpuDataBuffer` | GPU SSBO/UBO | -| `hwbuf.GpuCubeMap` | GPU cubemap texture | - -### Common Usage Patterns - -```go -// CPU write + GPU texture (upload textures) -hwbuf.CpuWriteOften | hwbuf.GpuSampledImage - -// GPU render + CPU readback (screenshots) -hwbuf.GpuColorOutput | hwbuf.CpuReadOften - -// GPU render + compositor display -hwbuf.GpuColorOutput | hwbuf.ComposerOverlay - -// CPU write + video encode (encoding pipeline) -hwbuf.CpuWriteOften | hwbuf.VideoEncode -``` - -### IPC: Sharing Between Processes - -```go -// Sender process: -buf.SendHandleToUnixSocket(socketFd) - -// Receiver process: -received, err := hwbuf.RecvHandleFromUnixSocket(socketFd) -if err != nil { - log.Fatalf("recv handle: %v", err) -} -defer received.Close() -``` - -### Efficient Large Data Transfer - -For minimizing CGo overhead when transferring large buffers between Go and C: - -1. **AHardwareBuffer** (above): Best for GPU-accessible data. Allocate once, lock/write/unlock per frame. Zero-copy GPU path. -2. **ASharedMemory** (previous section): Best for IPC. Create once, mmap, share fd. Zero-copy across processes. -3. **syscall.Mmap with MAP_ANONYMOUS**: Best for large working buffers that only need CPU access. No CGo call per access. - -## Supported Modules - -34 modules with idiomatic Go packages: - -| Category | Modules | -|----------|---------| -| Graphics & Rendering | egl, gles2, gles3, vulkan, surfacecontrol, surfacetexture, hwbuf, window, bitmap | -| Camera & Imaging | camera, image | -| Audio & Media | audio, media, midi | -| Sensors & Input | sensor, input, choreographer | -| Activity & Lifecycle | activity, config, thermal, hint, permission | -| Storage & Assets | asset, storage | -| System & IPC | binder, persistablebundle, looper, log, sharedmem, sync, net | -| Machine Learning | nnapi | -| Debugging & Fonts | trace, font | - -Import pattern: `github.com/AndroidGoLab/ndk/{module}` - -## Requirements - -- Android NDK r28 (28.0.13004108) or later -- API level 35 (Android 15) target -- Go 1.24+ - -## Architecture - -Three-stage auto-generation pipeline: - -1. **Stage 1** (`make specs`): c2ffi extracts structured YAML specs from NDK C headers -2. **Stage 2** (`make capi`): capigen generates raw CGo bindings from specs + manifests -3. **Stage 3** (`make idiomatic`): idiomgen generates idiomatic Go packages from specs + overlays + templates - -Never edit generated files in `capi/` or top-level module packages directly. Instead modify overlays in `spec/overlays/` and templates in `templates/`, then regenerate with `make idiomatic`. diff --git a/log/android_aborter_function.go b/log/android_aborter_function.go deleted file mode 100644 index 95e98e2..0000000 --- a/log/android_aborter_function.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package log - -import ( - capi "github.com/AndroidGoLab/ndk/capi/logging" -) - -type Android_aborter_function = capi.Android_aborter_function diff --git a/log/android_log_message.go b/log/android_log_message.go deleted file mode 100644 index a7ea220..0000000 --- a/log/android_log_message.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package log - -import ( - capi "github.com/AndroidGoLab/ndk/capi/logging" -) - -type Android_log_message = capi.Android_log_message diff --git a/log/android_logger_function.go b/log/android_logger_function.go deleted file mode 100644 index fbf1410..0000000 --- a/log/android_logger_function.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package log - -import ( - capi "github.com/AndroidGoLab/ndk/capi/logging" -) - -type Android_logger_function = capi.Android_logger_function diff --git a/log/errors.go b/log/errors.go deleted file mode 100644 index c485b56..0000000 --- a/log/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package log diff --git a/log/functions.go b/log/functions.go deleted file mode 100644 index d250bc8..0000000 --- a/log/functions.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package log - -import ( - capi "github.com/AndroidGoLab/ndk/capi/logging" -) - -// __android_log_buf_write calls the underlying C function. -func __android_log_buf_write(bufID int32, prio int32, tag string, text string) int32 { - return (int32)(capi.Android_log_buf_write(bufID, prio, tag, text)) -} - -// __android_log_call_aborter calls the underlying C function. -func __android_log_call_aborter(abort_message string) { - capi.Android_log_call_aborter(abort_message) -} - -// __android_log_default_aborter calls the underlying C function. -func __android_log_default_aborter(abort_message string) { - capi.Android_log_default_aborter(abort_message) -} - -// __android_log_get_minimum_priority calls the underlying C function. -func __android_log_get_minimum_priority() int32 { - return (int32)(capi.Android_log_get_minimum_priority()) -} - -// __android_log_is_loggable calls the underlying C function. -func __android_log_is_loggable(prio int32, tag string, default_prio int32) int32 { - return (int32)(capi.Android_log_is_loggable(prio, tag, default_prio)) -} - -// __android_log_is_loggable_len calls the underlying C function. -func __android_log_is_loggable_len(prio int32, tag string, len uint64, default_prio int32) int32 { - return (int32)(capi.Android_log_is_loggable_len(prio, tag, len, default_prio)) -} - -// __android_log_logd_logger calls the underlying C function. -func __android_log_logd_logger(log_message *Android_log_message) { - capi.Android_log_logd_logger((*capi.Android_log_message)(log_message)) -} - -// __android_log_set_default_tag calls the underlying C function. -func __android_log_set_default_tag(tag string) { - capi.Android_log_set_default_tag(tag) -} - -// __android_log_set_minimum_priority calls the underlying C function. -func __android_log_set_minimum_priority(priority Priority) int32 { - return (int32)(capi.Android_log_set_minimum_priority(int32(priority))) -} - -// __android_log_stderr_logger calls the underlying C function. -func __android_log_stderr_logger(log_message *Android_log_message) { - capi.Android_log_stderr_logger((*capi.Android_log_message)(log_message)) -} - -// Write calls the underlying C function. -func Write(prio int32, tag string, text string) int32 { - return (int32)(capi.Android_log_write(prio, tag, text)) -} - -// __android_log_write_log_message calls the underlying C function. -func __android_log_write_log_message(log_message *Android_log_message) { - capi.Android_log_write_log_message((*capi.Android_log_message)(log_message)) -} diff --git a/log/log_id_t.go b/log/log_id_t.go deleted file mode 100644 index e863248..0000000 --- a/log/log_id_t.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package log - -type log_id_t int32 - -const ( - LOG_ID_MIN log_id_t = 0 - LOG_ID_MAIN log_id_t = 0 - LOG_ID_RADIO log_id_t = 1 - LOG_ID_EVENTS log_id_t = 2 - LOG_ID_SYSTEM log_id_t = 3 - LOG_ID_CRASH log_id_t = 4 - LOG_ID_STATS log_id_t = 5 - LOG_ID_SECURITY log_id_t = 6 - LOG_ID_KERNEL log_id_t = 7 - LOG_ID_MAX log_id_t = 8 - LOG_ID_DEFAULT log_id_t = 2147483647 -) diff --git a/log/package.go b/log/package.go deleted file mode 100644 index 3dce213..0000000 --- a/log/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package log provides Go bindings for Android logging. -package log diff --git a/log/priority.go b/log/priority.go deleted file mode 100644 index 08892b7..0000000 --- a/log/priority.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package log - -import "fmt" - -type Priority int32 - -const ( - Unknown Priority = 0 - Default Priority = 1 - Verbose Priority = 2 - Debug Priority = 3 - Info Priority = 4 - Warn Priority = 5 - Error Priority = 6 - Fatal Priority = 7 - Silent Priority = 8 -) - -func (v Priority) String() string { - switch v { - case Unknown: - return "Unknown" - case Default: - return "Default" - case Verbose: - return "Verbose" - case Debug: - return "Debug" - case Info: - return "Info" - case Warn: - return "Warn" - case Error: - return "Error" - case Fatal: - return "Fatal" - case Silent: - return "Silent" - default: - return fmt.Sprintf("Priority(%d)", int(v)) - } -} diff --git a/looper/errors.go b/looper/errors.go deleted file mode 100644 index 9458024..0000000 --- a/looper/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package looper - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/looper/event.go b/looper/event.go deleted file mode 100644 index 1eba39d..0000000 --- a/looper/event.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package looper - -type Event int32 - -const ( - EventInput Event = 1 - EventOutput Event = 2 - EventError Event = 4 - EventHangup Event = 8 - EventInvalid Event = 16 -) diff --git a/looper/functions.go b/looper/functions.go deleted file mode 100644 index f02549b..0000000 --- a/looper/functions.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package looper - -import ( - "time" - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/looper" -) - -// PollOnce calls the underlying C function. -func PollOnce(timeout time.Duration, outFd *int32, outEvents *int32, outData *unsafe.Pointer) int32 { - return (int32)(capi.ALooper_pollOnce(int32(timeout.Milliseconds()), outFd, outEvents, outData)) -} diff --git a/looper/looper.go b/looper/looper.go deleted file mode 100644 index 2887400..0000000 --- a/looper/looper.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package looper - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/looper" -) - -// Looper wraps the NDK ALooper handle. -type Looper struct { - ptr *capi.ALooper -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Looper) cptr() *capi.ALooper { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Looper) Close() error { - if h.ptr == nil { - return nil - } - capi.ALooper_release(h.ptr) - h.ptr = nil - return nil -} - -// NewLooperFromPointer wraps a raw ALooper pointer. -func NewLooperFromPointer(ptr unsafe.Pointer) *Looper { - return &Looper{ptr: (*capi.ALooper)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Looper) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Looper) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewLooperFromUintPtr wraps a uintptr as a Looper. -// The caller must ensure ptr points to a valid ALooper. -func NewLooperFromUintPtr(ptr uintptr) *Looper { - return &Looper{ptr: (*capi.ALooper)(unsafe.Pointer(ptr))} -} - -// Acquire calls the underlying NDK function. -func (h *Looper) Acquire() { - capi.ALooper_acquire(h.ptr) -} - -// RemoveFd calls the underlying NDK function. -func (h *Looper) RemoveFd(fd int32) error { - return result(capi.ALooper_removeFd(h.ptr, fd)) -} - -// Wake calls the underlying NDK function. -func (h *Looper) Wake() { - capi.ALooper_wake(h.ptr) -} - -// ALooper_forThread calls the underlying C function. -func ALooper_forThread() *Looper { - return &Looper{ptr: capi.ALooper_forThread()} -} - -// Prepare calls the underlying C function. -func Prepare(opts int32) *Looper { - return &Looper{ptr: capi.ALooper_prepare(opts)} -} diff --git a/looper/looper_poll.go b/looper/looper_poll.go deleted file mode 100644 index e7eb0f9..0000000 --- a/looper/looper_poll.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package looper - -type LOOPER_POLL int32 - -const ( - ALOOPER_POLL_WAKE LOOPER_POLL = -1 - ALOOPER_POLL_CALLBACK LOOPER_POLL = -2 - ALOOPER_POLL_TIMEOUT LOOPER_POLL = -3 - ALOOPER_POLL_ERROR LOOPER_POLL = -4 -) diff --git a/looper/looper_prepare_allow.go b/looper/looper_prepare_allow.go deleted file mode 100644 index 4978283..0000000 --- a/looper/looper_prepare_allow.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package looper - -type LOOPER_PREPARE_ALLOW int32 - -const ( - ALOOPER_PREPARE_ALLOW_NON_CALLBACKS LOOPER_PREPARE_ALLOW = 1 -) diff --git a/looper/package.go b/looper/package.go deleted file mode 100644 index f131c78..0000000 --- a/looper/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package looper provides Go bindings for Android ALooper. -package looper diff --git a/looper/run.go b/looper/run.go deleted file mode 100644 index 87530d9..0000000 --- a/looper/run.go +++ /dev/null @@ -1,17 +0,0 @@ -package looper - -import "runtime" - -const prepareAllowNonCallbacks = int32(1) - -// Run locks the current goroutine to its OS thread, prepares a new looper, -// and calls fn with it. The looper is closed when fn returns. -func Run(fn func(*Looper)) { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - lp := Prepare(prepareAllowNonCallbacks) - defer lp.Close() - - fn(lp) -} diff --git a/media/ahardware_buffer.go b/media/ahardware_buffer.go deleted file mode 100644 index e6a2e90..0000000 --- a/media/ahardware_buffer.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AHardwareBuffer = capi.AHardwareBuffer diff --git a/media/amedia_codec_on_frame_rendered.go b/media/amedia_codec_on_frame_rendered.go deleted file mode 100644 index ccab22b..0000000 --- a/media/amedia_codec_on_frame_rendered.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaCodecOnFrameRendered = capi.AMediaCodecOnFrameRendered diff --git a/media/amedia_data_source_close.go b/media/amedia_data_source_close.go deleted file mode 100644 index 0b9cd63..0000000 --- a/media/amedia_data_source_close.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDataSourceClose = capi.AMediaDataSourceClose diff --git a/media/amedia_data_source_get_available_size.go b/media/amedia_data_source_get_available_size.go deleted file mode 100644 index f154b06..0000000 --- a/media/amedia_data_source_get_available_size.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDataSourceGetAvailableSize = capi.AMediaDataSourceGetAvailableSize diff --git a/media/amedia_data_source_get_size.go b/media/amedia_data_source_get_size.go deleted file mode 100644 index 5e3c9b2..0000000 --- a/media/amedia_data_source_get_size.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDataSourceGetSize = capi.AMediaDataSourceGetSize diff --git a/media/amedia_data_source_read_at.go b/media/amedia_data_source_read_at.go deleted file mode 100644 index 570d4ce..0000000 --- a/media/amedia_data_source_read_at.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDataSourceReadAt = capi.AMediaDataSourceReadAt diff --git a/media/amedia_drm_event_listener.go b/media/amedia_drm_event_listener.go deleted file mode 100644 index e7d2c5b..0000000 --- a/media/amedia_drm_event_listener.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDrmEventListener = capi.AMediaDrmEventListener diff --git a/media/amedia_drm_expiration_update_listener.go b/media/amedia_drm_expiration_update_listener.go deleted file mode 100644 index a919096..0000000 --- a/media/amedia_drm_expiration_update_listener.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDrmExpirationUpdateListener = capi.AMediaDrmExpirationUpdateListener diff --git a/media/amedia_drm_key_id.go b/media/amedia_drm_key_id.go deleted file mode 100644 index 7dc1688..0000000 --- a/media/amedia_drm_key_id.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDrmKeyId = capi.AMediaDrmKeyId diff --git a/media/amedia_drm_key_set_id.go b/media/amedia_drm_key_set_id.go deleted file mode 100644 index a3e99b6..0000000 --- a/media/amedia_drm_key_set_id.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDrmKeySetId = capi.AMediaDrmKeySetId diff --git a/media/amedia_drm_keys_change_listener.go b/media/amedia_drm_keys_change_listener.go deleted file mode 100644 index e1e3477..0000000 --- a/media/amedia_drm_keys_change_listener.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDrmKeysChangeListener = capi.AMediaDrmKeysChangeListener diff --git a/media/amedia_drm_scope.go b/media/amedia_drm_scope.go deleted file mode 100644 index 91ef11f..0000000 --- a/media/amedia_drm_scope.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDrmScope = capi.AMediaDrmScope diff --git a/media/amedia_drm_secure_stop.go b/media/amedia_drm_secure_stop.go deleted file mode 100644 index 853da6e..0000000 --- a/media/amedia_drm_secure_stop.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDrmSecureStop = capi.AMediaDrmSecureStop diff --git a/media/amedia_drm_session_id.go b/media/amedia_drm_session_id.go deleted file mode 100644 index 7d3edf9..0000000 --- a/media/amedia_drm_session_id.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaDrmSessionId = capi.AMediaDrmSessionId diff --git a/media/amedia_uuid.go b/media/amedia_uuid.go deleted file mode 100644 index e316827..0000000 --- a/media/amedia_uuid.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type AMediaUUID = capi.AMediaUUID diff --git a/media/append_mode.go b/media/append_mode.go deleted file mode 100644 index 97ebe77..0000000 --- a/media/append_mode.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type AppendMode int32 - -const ( - AMEDIAMUXER_APPEND_IGNORE_LAST_VIDEO_GOP AppendMode = 0 - AMEDIAMUXER_APPEND_TO_EXISTING_DATA AppendMode = 1 -) diff --git a/media/bitrate_mode.go b/media/bitrate_mode.go deleted file mode 100644 index be91f43..0000000 --- a/media/bitrate_mode.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type BitrateMode int32 - -const ( - ABITRATE_MODE_CQ BitrateMode = 0 - ABITRATE_MODE_VBR BitrateMode = 1 - ABITRATE_MODE_CBR BitrateMode = 2 - ABITRATE_MODE_CBR_FD BitrateMode = 3 -) diff --git a/media/buffer_info.go b/media/buffer_info.go deleted file mode 100644 index 1fc947b..0000000 --- a/media/buffer_info.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// BufferInfo is a Go value type mirroring the NDK AMediaCodecBufferInfo C struct. -// Fields are layout-compatible with the C struct for zero-copy conversion. -type BufferInfo struct { - Offset int32 - Size int32 - PresentationTimeUs int64 - Flags uint32 -} - -// cptr returns a pointer to the capi representation. -// The Go struct is layout-compatible with the C struct. -func (s *BufferInfo) cptr() *capi.AMediaCodecBufferInfo { - return (*capi.AMediaCodecBufferInfo)(unsafe.Pointer(s)) -} - -// bufferInfoFromCapi creates a BufferInfo from a capi pointer. -func bufferInfoFromCapi(c *capi.AMediaCodecBufferInfo) *BufferInfo { - return (*BufferInfo)(unsafe.Pointer(c)) -} diff --git a/media/codec.go b/media/codec.go deleted file mode 100644 index 8d5241f..0000000 --- a/media/codec.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// Codec wraps the NDK AMediaCodec handle. -type Codec struct { - ptr *capi.AMediaCodec -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Codec) cptr() *capi.AMediaCodec { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Codec) Close() error { - if h.ptr == nil { - return nil - } - err := result(capi.AMediaCodec_delete(h.ptr)) - h.ptr = nil - return err -} - -// NewCodecFromPointer wraps a raw AMediaCodec pointer. -func NewCodecFromPointer(ptr unsafe.Pointer) *Codec { - return &Codec{ptr: (*capi.AMediaCodec)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Codec) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Codec) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCodecFromUintPtr wraps a uintptr as a Codec. -// The caller must ensure ptr points to a valid AMediaCodec. -func NewCodecFromUintPtr(ptr uintptr) *Codec { - return &Codec{ptr: (*capi.AMediaCodec)(unsafe.Pointer(ptr))} -} - -// Configure calls the underlying NDK function. -func (h *Codec) Configure(format *Format, surface *Window, crypto *Crypto, flags uint32) error { - return result(capi.AMediaCodec_configure(h.ptr, format.cptr(), surface.cptr(), crypto.cptr(), flags)) -} - -// DequeueInputBuffer returns the value directly. -func (h *Codec) DequeueInputBuffer(timeoutUs int64) int64 { - return (int64)(capi.AMediaCodec_dequeueInputBuffer(h.ptr, timeoutUs)) -} - -// DequeueOutputBuffer returns the value directly. -func (h *Codec) DequeueOutputBuffer(info *BufferInfo, timeoutUs int64) int64 { - return (int64)(capi.AMediaCodec_dequeueOutputBuffer(h.ptr, info.cptr(), timeoutUs)) -} - -// Flush calls the underlying NDK function. -func (h *Codec) Flush() error { - return result(capi.AMediaCodec_flush(h.ptr)) -} - -// GetBufferFormat creates a new Format from this Codec. -func (h *Codec) GetBufferFormat(index uint64) *Format { - return &Format{ptr: capi.AMediaCodec_getBufferFormat(h.ptr, index)} -} - -// GetInputBuffer returns the value directly. -func (h *Codec) GetInputBuffer(idx uint64, out_size *uint64) *uint8 { - return (*uint8)(capi.AMediaCodec_getInputBuffer(h.ptr, idx, out_size)) -} - -// GetInputFormat creates a new Format from this Codec. -func (h *Codec) GetInputFormat() *Format { - return &Format{ptr: capi.AMediaCodec_getInputFormat(h.ptr)} -} - -// GetOutputBuffer returns the value directly. -func (h *Codec) GetOutputBuffer(idx uint64, out_size *uint64) *uint8 { - return (*uint8)(capi.AMediaCodec_getOutputBuffer(h.ptr, idx, out_size)) -} - -// QueueInputBuffer calls the underlying NDK function. -func (h *Codec) QueueInputBuffer(idx uint64, offset Off_t, size uint64, time uint64, flags uint32) error { - return result(capi.AMediaCodec_queueInputBuffer(h.ptr, idx, capi.Off_t(offset), size, time, flags)) -} - -// ReleaseName calls the underlying NDK function. -func (h *Codec) ReleaseName(name string) { - capi.AMediaCodec_releaseName(h.ptr, name) -} - -// ReleaseOutputBuffer calls the underlying NDK function. -func (h *Codec) ReleaseOutputBuffer(idx uint64, render bool) error { - return result(capi.AMediaCodec_releaseOutputBuffer(h.ptr, idx, render)) -} - -// Start calls the underlying NDK function. -func (h *Codec) Start() error { - return result(capi.AMediaCodec_start(h.ptr)) -} - -// Stop calls the underlying NDK function. -func (h *Codec) Stop() error { - return result(capi.AMediaCodec_stop(h.ptr)) -} - -// AMediaCodec_createCodecByName calls the underlying C function. -func AMediaCodec_createCodecByName(name string) *Codec { - return &Codec{ptr: capi.AMediaCodec_createCodecByName(name)} -} - -// NewDecoder calls the underlying C function. -func NewDecoder(mime_type string) *Codec { - return &Codec{ptr: capi.AMediaCodec_createDecoderByType(mime_type)} -} - -// NewEncoder calls the underlying C function. -func NewEncoder(mime_type string) *Codec { - return &Codec{ptr: capi.AMediaCodec_createEncoderByType(mime_type)} -} diff --git a/media/codec_audio_capabilities.go b/media/codec_audio_capabilities.go deleted file mode 100644 index e566b6e..0000000 --- a/media/codec_audio_capabilities.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// CodecAudioCapabilities wraps the NDK ACodecAudioCapabilities handle. -type CodecAudioCapabilities struct { - ptr *capi.ACodecAudioCapabilities -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CodecAudioCapabilities) cptr() *capi.ACodecAudioCapabilities { - if h == nil { - return nil - } - return h.ptr -} - -// NewCodecAudioCapabilitiesFromPointer wraps a raw ACodecAudioCapabilities pointer. -func NewCodecAudioCapabilitiesFromPointer(ptr unsafe.Pointer) *CodecAudioCapabilities { - return &CodecAudioCapabilities{ptr: (*capi.ACodecAudioCapabilities)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CodecAudioCapabilities) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CodecAudioCapabilities) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCodecAudioCapabilitiesFromUintPtr wraps a uintptr as a CodecAudioCapabilities. -// The caller must ensure ptr points to a valid ACodecAudioCapabilities. -func NewCodecAudioCapabilitiesFromUintPtr(ptr uintptr) *CodecAudioCapabilities { - return &CodecAudioCapabilities{ptr: (*capi.ACodecAudioCapabilities)(unsafe.Pointer(ptr))} -} diff --git a/media/codec_audio_capabilities_api36.go b/media/codec_audio_capabilities_api36.go deleted file mode 100644 index 17f7541..0000000 --- a/media/codec_audio_capabilities_api36.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build android_ndk36 - -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -var _ = capi.CgoAllocsUnknown - -// GetMaxInputChannelCount calls the underlying NDK function. -func (h *CodecAudioCapabilities) GetMaxInputChannelCount() error { - return result(int32(capi.ACodecAudioCapabilities_getMaxInputChannelCount(h.ptr))) -} - -// GetMinInputChannelCount calls the underlying NDK function. -func (h *CodecAudioCapabilities) GetMinInputChannelCount() error { - return result(int32(capi.ACodecAudioCapabilities_getMinInputChannelCount(h.ptr))) -} - -// IsSampleRateSupported calls the underlying NDK function. -func (h *CodecAudioCapabilities) IsSampleRateSupported(sampleRate int32) error { - return result(int32(capi.ACodecAudioCapabilities_isSampleRateSupported(h.ptr, sampleRate))) -} diff --git a/media/codec_encoder_capabilities.go b/media/codec_encoder_capabilities.go deleted file mode 100644 index 8f6c1fd..0000000 --- a/media/codec_encoder_capabilities.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// CodecEncoderCapabilities wraps the NDK ACodecEncoderCapabilities handle. -type CodecEncoderCapabilities struct { - ptr *capi.ACodecEncoderCapabilities -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CodecEncoderCapabilities) cptr() *capi.ACodecEncoderCapabilities { - if h == nil { - return nil - } - return h.ptr -} - -// NewCodecEncoderCapabilitiesFromPointer wraps a raw ACodecEncoderCapabilities pointer. -func NewCodecEncoderCapabilitiesFromPointer(ptr unsafe.Pointer) *CodecEncoderCapabilities { - return &CodecEncoderCapabilities{ptr: (*capi.ACodecEncoderCapabilities)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CodecEncoderCapabilities) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CodecEncoderCapabilities) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCodecEncoderCapabilitiesFromUintPtr wraps a uintptr as a CodecEncoderCapabilities. -// The caller must ensure ptr points to a valid ACodecEncoderCapabilities. -func NewCodecEncoderCapabilitiesFromUintPtr(ptr uintptr) *CodecEncoderCapabilities { - return &CodecEncoderCapabilities{ptr: (*capi.ACodecEncoderCapabilities)(unsafe.Pointer(ptr))} -} diff --git a/media/codec_encoder_capabilities_api36.go b/media/codec_encoder_capabilities_api36.go deleted file mode 100644 index f65c6b8..0000000 --- a/media/codec_encoder_capabilities_api36.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build android_ndk36 - -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -var _ = capi.CgoAllocsUnknown - -// GetComplexityRange calls the underlying NDK function. -func (h *CodecEncoderCapabilities) GetComplexityRange(outRange *IntRange) error { - return result(int32(capi.ACodecEncoderCapabilities_getComplexityRange(h.ptr, outRange.ptr))) -} - -// GetQualityRange calls the underlying NDK function. -func (h *CodecEncoderCapabilities) GetQualityRange(outRange *IntRange) error { - return result(int32(capi.ACodecEncoderCapabilities_getQualityRange(h.ptr, outRange.ptr))) -} - -// IsBitrateModeSupported calls the underlying NDK function. -func (h *CodecEncoderCapabilities) IsBitrateModeSupported(mode BitrateMode) error { - return result(int32(capi.ACodecEncoderCapabilities_isBitrateModeSupported(h.ptr, capi.ABitrateMode(mode)))) -} diff --git a/media/codec_performance_point.go b/media/codec_performance_point.go deleted file mode 100644 index d3dfa30..0000000 --- a/media/codec_performance_point.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// CodecPerformancePoint wraps the NDK ACodecPerformancePoint handle. -type CodecPerformancePoint struct { - ptr *capi.ACodecPerformancePoint -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CodecPerformancePoint) cptr() *capi.ACodecPerformancePoint { - if h == nil { - return nil - } - return h.ptr -} - -// NewCodecPerformancePointFromPointer wraps a raw ACodecPerformancePoint pointer. -func NewCodecPerformancePointFromPointer(ptr unsafe.Pointer) *CodecPerformancePoint { - return &CodecPerformancePoint{ptr: (*capi.ACodecPerformancePoint)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CodecPerformancePoint) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CodecPerformancePoint) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCodecPerformancePointFromUintPtr wraps a uintptr as a CodecPerformancePoint. -// The caller must ensure ptr points to a valid ACodecPerformancePoint. -func NewCodecPerformancePointFromUintPtr(ptr uintptr) *CodecPerformancePoint { - return &CodecPerformancePoint{ptr: (*capi.ACodecPerformancePoint)(unsafe.Pointer(ptr))} -} diff --git a/media/codec_performance_point_api36.go b/media/codec_performance_point_api36.go deleted file mode 100644 index 542cc5f..0000000 --- a/media/codec_performance_point_api36.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build android_ndk36 - -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -var _ = capi.CgoAllocsUnknown - -// Covers calls the underlying NDK function. -func (h *CodecPerformancePoint) Covers(another *CodecPerformancePoint) error { - return result(int32(capi.ACodecPerformancePoint_covers(h.ptr, another.cptr()))) -} - -// CoversFormat calls the underlying NDK function. -func (h *CodecPerformancePoint) CoversFormat(format *Format) error { - return result(int32(capi.ACodecPerformancePoint_coversFormat(h.ptr, format.cptr()))) -} - -// Equals calls the underlying NDK function. -func (h *CodecPerformancePoint) Equals(another *CodecPerformancePoint) error { - return result(int32(capi.ACodecPerformancePoint_equals(h.ptr, another.cptr()))) -} diff --git a/media/codec_video_capabilities.go b/media/codec_video_capabilities.go deleted file mode 100644 index 6311c70..0000000 --- a/media/codec_video_capabilities.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// CodecVideoCapabilities wraps the NDK ACodecVideoCapabilities handle. -type CodecVideoCapabilities struct { - ptr *capi.ACodecVideoCapabilities -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *CodecVideoCapabilities) cptr() *capi.ACodecVideoCapabilities { - if h == nil { - return nil - } - return h.ptr -} - -// NewCodecVideoCapabilitiesFromPointer wraps a raw ACodecVideoCapabilities pointer. -func NewCodecVideoCapabilitiesFromPointer(ptr unsafe.Pointer) *CodecVideoCapabilities { - return &CodecVideoCapabilities{ptr: (*capi.ACodecVideoCapabilities)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *CodecVideoCapabilities) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *CodecVideoCapabilities) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCodecVideoCapabilitiesFromUintPtr wraps a uintptr as a CodecVideoCapabilities. -// The caller must ensure ptr points to a valid ACodecVideoCapabilities. -func NewCodecVideoCapabilitiesFromUintPtr(ptr uintptr) *CodecVideoCapabilities { - return &CodecVideoCapabilities{ptr: (*capi.ACodecVideoCapabilities)(unsafe.Pointer(ptr))} -} diff --git a/media/codec_video_capabilities_api36.go b/media/codec_video_capabilities_api36.go deleted file mode 100644 index 92f2b08..0000000 --- a/media/codec_video_capabilities_api36.go +++ /dev/null @@ -1,31 +0,0 @@ -//go:build android_ndk36 - -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -var _ = capi.CgoAllocsUnknown - -// AreSizeAndRateSupported calls the underlying NDK function. -func (h *CodecVideoCapabilities) AreSizeAndRateSupported(width int32, height int32, frameRate float64) error { - return result(int32(capi.ACodecVideoCapabilities_areSizeAndRateSupported(h.ptr, width, height, frameRate))) -} - -// GetHeightAlignment calls the underlying NDK function. -func (h *CodecVideoCapabilities) GetHeightAlignment() error { - return result(int32(capi.ACodecVideoCapabilities_getHeightAlignment(h.ptr))) -} - -// GetWidthAlignment calls the underlying NDK function. -func (h *CodecVideoCapabilities) GetWidthAlignment() error { - return result(int32(capi.ACodecVideoCapabilities_getWidthAlignment(h.ptr))) -} - -// IsSizeSupported calls the underlying NDK function. -func (h *CodecVideoCapabilities) IsSizeSupported(width int32, height int32) error { - return result(int32(capi.ACodecVideoCapabilities_isSizeSupported(h.ptr, width, height))) -} diff --git a/media/crypto.go b/media/crypto.go deleted file mode 100644 index 1731134..0000000 --- a/media/crypto.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// Crypto wraps the NDK AMediaCrypto handle. -type Crypto struct { - ptr *capi.AMediaCrypto -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Crypto) cptr() *capi.AMediaCrypto { - if h == nil { - return nil - } - return h.ptr -} - -// NewCrypto creates a new Crypto. -func NewCrypto(uuid AMediaUUID, initData unsafe.Pointer, initDataSize uint64) *Crypto { - return &Crypto{ptr: capi.AMediaCrypto_new(uuid, initData, initDataSize)} -} - -// Close releases the underlying NDK handle. -func (h *Crypto) Close() error { - if h.ptr == nil { - return nil - } - capi.AMediaCrypto_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewCryptoFromPointer wraps a raw AMediaCrypto pointer. -func NewCryptoFromPointer(ptr unsafe.Pointer) *Crypto { - return &Crypto{ptr: (*capi.AMediaCrypto)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Crypto) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Crypto) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCryptoFromUintPtr wraps a uintptr as a Crypto. -// The caller must ensure ptr points to a valid AMediaCrypto. -func NewCryptoFromUintPtr(ptr uintptr) *Crypto { - return &Crypto{ptr: (*capi.AMediaCrypto)(unsafe.Pointer(ptr))} -} diff --git a/media/cryptoinfo_mode_t.go b/media/cryptoinfo_mode_t.go deleted file mode 100644 index 16024b1..0000000 --- a/media/cryptoinfo_mode_t.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type cryptoinfo_mode_t int32 - -const ( - AMEDIACODECRYPTOINFO_MODE_CLEAR cryptoinfo_mode_t = 0 - AMEDIACODECRYPTOINFO_MODE_AES_CTR cryptoinfo_mode_t = 1 - AMEDIACODECRYPTOINFO_MODE_AES_WV cryptoinfo_mode_t = 2 - AMEDIACODECRYPTOINFO_MODE_AES_CBC cryptoinfo_mode_t = 3 -) diff --git a/media/cryptoinfo_pattern_t.go b/media/cryptoinfo_pattern_t.go deleted file mode 100644 index 1d34931..0000000 --- a/media/cryptoinfo_pattern_t.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// cryptoinfo_pattern_t wraps the NDK Cryptoinfo_pattern_t handle. -type cryptoinfo_pattern_t struct { - ptr *capi.Cryptoinfo_pattern_t -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *cryptoinfo_pattern_t) cptr() *capi.Cryptoinfo_pattern_t { - if h == nil { - return nil - } - return h.ptr -} - -// Newcryptoinfo_pattern_tFromPointer wraps a raw Cryptoinfo_pattern_t pointer. -func Newcryptoinfo_pattern_tFromPointer(ptr unsafe.Pointer) *cryptoinfo_pattern_t { - return &cryptoinfo_pattern_t{ptr: (*capi.Cryptoinfo_pattern_t)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *cryptoinfo_pattern_t) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *cryptoinfo_pattern_t) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// Newcryptoinfo_pattern_tFromUintPtr wraps a uintptr as a cryptoinfo_pattern_t. -// The caller must ensure ptr points to a valid Cryptoinfo_pattern_t. -func Newcryptoinfo_pattern_tFromUintPtr(ptr uintptr) *cryptoinfo_pattern_t { - return &cryptoinfo_pattern_t{ptr: (*capi.Cryptoinfo_pattern_t)(unsafe.Pointer(ptr))} -} diff --git a/media/double_range.go b/media/double_range.go deleted file mode 100644 index b618e25..0000000 --- a/media/double_range.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// DoubleRange wraps the NDK ADoubleRange handle. -type DoubleRange struct { - ptr *capi.ADoubleRange -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *DoubleRange) cptr() *capi.ADoubleRange { - if h == nil { - return nil - } - return h.ptr -} - -// NewDoubleRangeFromPointer wraps a raw ADoubleRange pointer. -func NewDoubleRangeFromPointer(ptr unsafe.Pointer) *DoubleRange { - return &DoubleRange{ptr: (*capi.ADoubleRange)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *DoubleRange) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *DoubleRange) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewDoubleRangeFromUintPtr wraps a uintptr as a DoubleRange. -// The caller must ensure ptr points to a valid ADoubleRange. -func NewDoubleRangeFromUintPtr(ptr uintptr) *DoubleRange { - return &DoubleRange{ptr: (*capi.ADoubleRange)(unsafe.Pointer(ptr))} -} diff --git a/media/drm.go b/media/drm.go deleted file mode 100644 index 73981b0..0000000 --- a/media/drm.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// Drm wraps the NDK AMediaDrm handle. -type Drm struct { - ptr *capi.AMediaDrm -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Drm) cptr() *capi.AMediaDrm { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Drm) Close() error { - if h.ptr == nil { - return nil - } - capi.AMediaDrm_release(h.ptr) - h.ptr = nil - return nil -} - -// NewDrmFromPointer wraps a raw AMediaDrm pointer. -func NewDrmFromPointer(ptr unsafe.Pointer) *Drm { - return &Drm{ptr: (*capi.AMediaDrm)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Drm) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Drm) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewDrmFromUintPtr wraps a uintptr as a Drm. -// The caller must ensure ptr points to a valid AMediaDrm. -func NewDrmFromUintPtr(ptr uintptr) *Drm { - return &Drm{ptr: (*capi.AMediaDrm)(unsafe.Pointer(ptr))} -} - -// AMediaDrm_createByUUID calls the underlying C function. -func AMediaDrm_createByUUID(uuid *uint8) *Drm { - return &Drm{ptr: capi.AMediaDrm_createByUUID(uuid)} -} diff --git a/compat/xaionaro-go-ndk/media/error.go b/media/error.go similarity index 73% rename from compat/xaionaro-go-ndk/media/error.go rename to media/error.go index 719e654..a1e5517 100644 --- a/compat/xaionaro-go-ndk/media/error.go +++ b/media/error.go @@ -1,7 +1,41 @@ -//go:build android && cgo - // Copyright 2018-2024 The gooid Authors. All rights reserved. -// Use of this source code is governed by a MIT-style license. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkMediaError.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ package media @@ -9,10 +43,11 @@ import ( "fmt" ) -// #include +/* +#include "media/NdkMediaError.h" +*/ import "C" -// MediaStatus is an NDK media_status_t value. type MediaStatus int const ( @@ -91,7 +126,6 @@ func (i MediaStatus) Error() string { return fmt.Sprintf("ERROR_MEDIA_%d", i) } -// CMediaStatusToError converts an NDK media status to the corresponding Go error. func CMediaStatusToError(status C.media_status_t) error { if MediaStatus(status) != MEDIA_OK { return MediaStatus(status) diff --git a/media/errors.go b/media/errors.go deleted file mode 100644 index 03fc38f..0000000 --- a/media/errors.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -const ( - ErrUnknown Error = -10000 - ErrMalformed Error = -10001 - ErrUnsupported Error = -10002 - ErrInvalidObject Error = -10003 - ErrInvalidParameter Error = -10004 - ErrInvalidOperation Error = -10005 - ErrEndOfStream Error = -10006 - ErrIo Error = -10007 - ErrWouldBlock Error = -10008 - ErrAmediaDrmErrorBase Error = -20000 - ErrAmediaDrmNotProvisioned Error = -20001 - ErrAmediaDrmResourceBusy Error = -20002 - ErrAmediaDrmDeviceRevoked Error = -20003 - ErrAmediaDrmShortBuffer Error = -20004 - ErrAmediaDrmSessionNotOpened Error = -20005 - ErrAmediaDrmTamperDetected Error = -20006 - ErrAmediaDrmVerifyFailed Error = -20007 - ErrAmediaDrmNeedKey Error = -20008 - ErrAmediaDrmLicenseExpired Error = -20009 - ErrAmediaImgreaderErrorBase Error = -30000 - ErrAmediaImgreaderNoBufferAvailable Error = -30001 - ErrAmediaImgreaderMaxImagesAcquired Error = -30002 - ErrAmediaImgreaderCannotLockImage Error = -30003 - ErrAmediaImgreaderCannotUnlockImage Error = -30004 - ErrAmediaImgreaderImageNotLocked Error = -30005 -) - -func (e Error) Error() string { - return fmt.Sprintf("media: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/media/extractor.go b/media/extractor.go deleted file mode 100644 index 6851709..0000000 --- a/media/extractor.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// Extractor wraps the NDK AMediaExtractor handle. -type Extractor struct { - ptr *capi.AMediaExtractor -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Extractor) cptr() *capi.AMediaExtractor { - if h == nil { - return nil - } - return h.ptr -} - -// NewExtractor creates a new Extractor. -func NewExtractor() *Extractor { - return &Extractor{ptr: capi.AMediaExtractor_new()} -} - -// Close releases the underlying NDK handle. -func (h *Extractor) Close() error { - if h.ptr == nil { - return nil - } - err := result(capi.AMediaExtractor_delete(h.ptr)) - h.ptr = nil - return err -} - -// NewExtractorFromPointer wraps a raw AMediaExtractor pointer. -func NewExtractorFromPointer(ptr unsafe.Pointer) *Extractor { - return &Extractor{ptr: (*capi.AMediaExtractor)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Extractor) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Extractor) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewExtractorFromUintPtr wraps a uintptr as a Extractor. -// The caller must ensure ptr points to a valid AMediaExtractor. -func NewExtractorFromUintPtr(ptr uintptr) *Extractor { - return &Extractor{ptr: (*capi.AMediaExtractor)(unsafe.Pointer(ptr))} -} - -// GetCachedDuration returns the value directly. -func (h *Extractor) GetCachedDuration() int64 { - return (int64)(capi.AMediaExtractor_getCachedDuration(h.ptr)) -} - -// GetFileFormat creates a new Format from this Extractor. -func (h *Extractor) GetFileFormat() *Format { - return &Format{ptr: capi.AMediaExtractor_getFileFormat(h.ptr)} -} - -// GetPsshInfo creates a new PsshInfo from this Extractor. -func (h *Extractor) GetPsshInfo() *PsshInfo { - return &PsshInfo{ptr: capi.AMediaExtractor_getPsshInfo(h.ptr)} -} - -// GetSampleCryptoInfo creates a new MediaCodecCryptoInfo from this Extractor. -func (h *Extractor) GetSampleCryptoInfo() *MediaCodecCryptoInfo { - return &MediaCodecCryptoInfo{ptr: capi.AMediaExtractor_getSampleCryptoInfo(h.ptr)} -} - -// GetSampleFlags calls the underlying NDK function. -func (h *Extractor) GetSampleFlags() error { - return result(capi.AMediaExtractor_getSampleFlags(h.ptr)) -} - -// GetSampleSize returns the value directly. -func (h *Extractor) GetSampleSize() int64 { - return (int64)(capi.AMediaExtractor_getSampleSize(h.ptr)) -} - -// SampleTime returns the value directly. -func (h *Extractor) SampleTime() int64 { - return (int64)(capi.AMediaExtractor_getSampleTime(h.ptr)) -} - -// GetSampleTrackIndex calls the underlying NDK function. -func (h *Extractor) GetSampleTrackIndex() error { - return result(capi.AMediaExtractor_getSampleTrackIndex(h.ptr)) -} - -// TrackCount returns the value directly. -func (h *Extractor) TrackCount() uint64 { - return (uint64)(capi.AMediaExtractor_getTrackCount(h.ptr)) -} - -// SelectTrack calls the underlying NDK function. -func (h *Extractor) SelectTrack(idx uint64) error { - return result(capi.AMediaExtractor_selectTrack(h.ptr, idx)) -} - -// SetDataSourceFd calls the underlying NDK function. -func (h *Extractor) SetDataSourceFd(fd int32, offset Off64_t, length Off64_t) error { - return result(capi.AMediaExtractor_setDataSourceFd(h.ptr, fd, capi.Off64_t(offset), capi.Off64_t(length))) -} diff --git a/media/format.go b/media/format.go deleted file mode 100644 index 6974a4b..0000000 --- a/media/format.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// Format wraps the NDK AMediaFormat handle. -type Format struct { - ptr *capi.AMediaFormat -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Format) cptr() *capi.AMediaFormat { - if h == nil { - return nil - } - return h.ptr -} - -// NewFormat creates a new Format. -func NewFormat() *Format { - return &Format{ptr: capi.AMediaFormat_new()} -} - -// Close releases the underlying NDK handle. -func (h *Format) Close() error { - if h.ptr == nil { - return nil - } - err := result(capi.AMediaFormat_delete(h.ptr)) - h.ptr = nil - return err -} - -// NewFormatFromPointer wraps a raw AMediaFormat pointer. -func NewFormatFromPointer(ptr unsafe.Pointer) *Format { - return &Format{ptr: (*capi.AMediaFormat)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Format) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Format) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewFormatFromUintPtr wraps a uintptr as a Format. -// The caller must ensure ptr points to a valid AMediaFormat. -func NewFormatFromUintPtr(ptr uintptr) *Format { - return &Format{ptr: (*capi.AMediaFormat)(unsafe.Pointer(ptr))} -} - -// Clear calls the underlying NDK function. -func (h *Format) Clear() { - capi.AMediaFormat_clear(h.ptr) -} - -// GetDouble returns the value directly. -func (h *Format) GetDouble(name string, out *float64) bool { - return (bool)(capi.AMediaFormat_getDouble(h.ptr, name, out)) -} - -// GetFloat returns the value directly. -func (h *Format) GetFloat(name string, out *float32) bool { - return (bool)(capi.AMediaFormat_getFloat(h.ptr, name, out)) -} - -// GetInt32 returns the value directly. -func (h *Format) GetInt32(name string, out *int32) bool { - return (bool)(capi.AMediaFormat_getInt32(h.ptr, name, out)) -} - -// GetInt64 returns the value directly. -func (h *Format) GetInt64(name string, out *int64) bool { - return (bool)(capi.AMediaFormat_getInt64(h.ptr, name, out)) -} - -// GetRect returns the value directly. -func (h *Format) GetRect(name string, left *int32, top *int32, right *int32, bottom *int32) bool { - return (bool)(capi.AMediaFormat_getRect(h.ptr, name, left, top, right, bottom)) -} - -// GetSize returns the value directly. -func (h *Format) GetSize(name string, out *uint64) bool { - return (bool)(capi.AMediaFormat_getSize(h.ptr, name, out)) -} - -// SetBuffer calls the underlying NDK function. -func (h *Format) SetBuffer(name string, data unsafe.Pointer, size uint64) { - capi.AMediaFormat_setBuffer(h.ptr, name, data, size) -} - -// SetDouble calls the underlying NDK function. -func (h *Format) SetDouble(name string, value float64) { - capi.AMediaFormat_setDouble(h.ptr, name, value) -} - -// SetFloat calls the underlying NDK function. -func (h *Format) SetFloat(name string, value float32) { - capi.AMediaFormat_setFloat(h.ptr, name, value) -} - -// SetInt32 sets a property and returns the receiver for chaining. -func (h *Format) SetInt32(name string, value int32) *Format { - capi.AMediaFormat_setInt32(h.ptr, name, value) - return h -} - -// SetInt64 calls the underlying NDK function. -func (h *Format) SetInt64(name string, value int64) { - capi.AMediaFormat_setInt64(h.ptr, name, value) -} - -// SetRect calls the underlying NDK function. -func (h *Format) SetRect(name string, left int32, top int32, right int32, bottom int32) { - capi.AMediaFormat_setRect(h.ptr, name, left, top, right, bottom) -} - -// SetSize calls the underlying NDK function. -func (h *Format) SetSize(name string, value uint64) { - capi.AMediaFormat_setSize(h.ptr, name, value) -} - -// SetString sets a property and returns the receiver for chaining. -func (h *Format) SetString(name string, value string) *Format { - capi.AMediaFormat_setString(h.ptr, name, value) - return h -} - -// ToString returns the value directly. -func (h *Format) ToString() string { - return (string)(capi.AMediaFormat_toString(h.ptr)) -} diff --git a/media/functions.go b/media/functions.go deleted file mode 100644 index 55a5e5c..0000000 --- a/media/functions.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// AMediaCodecActionCode_isRecoverable calls the underlying C function. -func AMediaCodecActionCode_isRecoverable(actionCode int32) bool { - return (bool)(capi.AMediaCodecActionCode_isRecoverable(actionCode)) -} - -// AMediaCodecActionCode_isTransient calls the underlying C function. -func AMediaCodecActionCode_isTransient(actionCode int32) bool { - return (bool)(capi.AMediaCodecActionCode_isTransient(actionCode)) -} - -// AMediaCrypto_requiresSecureDecoderComponent calls the underlying C function. -func AMediaCrypto_requiresSecureDecoderComponent(mime string) bool { - return (bool)(capi.AMediaCrypto_requiresSecureDecoderComponent(mime)) -} - -// AMediaDrm_isCryptoSchemeSupported calls the underlying C function. -func AMediaDrm_isCryptoSchemeSupported(uuid *uint8, mimeType string) bool { - return (bool)(capi.AMediaDrm_isCryptoSchemeSupported(uuid, mimeType)) -} diff --git a/media/image.go b/media/image.go index 75669e8..874cf86 100644 --- a/media/image.go +++ b/media/image.go @@ -1,107 +1,815 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkImage.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ package media +/* +#cgo LDFLAGS: -lmediandk + +#include "sys/types.h" +#include "media/NdkImage.h" +*/ +import "C" + import ( + "fmt" + "time" "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" ) -// Image wraps the NDK AImage handle. -type Image struct { - ptr *capi.AImage -} +/** + * AImage is an opaque type that provides access to image generated by {@link AImageReader}. + */ +//typedef struct AImage AImage; +type Image C.AImage -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Image) cptr() *capi.AImage { - if h == nil { - return nil - } - return h.ptr +func (i *Image) cptr() *C.AImage { + return (*C.AImage)(i) } -// Close releases the underlying NDK handle. -func (h *Image) Close() error { - if h.ptr == nil { - return nil - } - capi.AImage_delete(h.ptr) - h.ptr = nil - return nil -} +type Formats int -// NewImageFromPointer wraps a raw AImage pointer. -func NewImageFromPointer(ptr unsafe.Pointer) *Image { - return &Image{ptr: (*capi.AImage)(ptr)} -} +// Formats not listed here will not be supported by AImageReader +const ( + /** + * 32 bits RGBA format, 8 bits for each of the four channels. + * + *

+ * Corresponding formats: + *

    + *
  • AHardwareBuffer: AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM
  • + *
  • Vulkan: VK_FORMAT_R8G8B8A8_UNORM
  • + *
  • OpenGL ES: GL_RGBA8
  • + *
+ *

+ * + * @see AImage + * @see AImageReader + * @see AHardwareBuffer + */ + FORMAT_RGBA_8888 Formats = C.AIMAGE_FORMAT_RGBA_8888 -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Image) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} + /** + * 32 bits RGBX format, 8 bits for each of the four channels. + * + *

+ * Corresponding formats: + *

    + *
  • AHardwareBuffer: AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM
  • + *
  • Vulkan: VK_FORMAT_R8G8B8A8_UNORM
  • + *
  • OpenGL ES: GL_RGBA8
  • + *
+ *

+ * + * @see AImage + * @see AImageReader + * @see AHardwareBuffer + */ + FORMAT_RGBX_8888 Formats = C.AIMAGE_FORMAT_RGBX_8888 + + /** + * 24 bits RGB format, 8 bits for each of the three channels. + * + *

+ * Corresponding formats: + *

    + *
  • AHardwareBuffer: AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM
  • + *
  • Vulkan: VK_FORMAT_R8G8B8_UNORM
  • + *
  • OpenGL ES: GL_RGB8
  • + *
+ *

+ * + * @see AImage + * @see AImageReader + * @see AHardwareBuffer + */ + FORMAT_RGB_888 Formats = C.AIMAGE_FORMAT_RGB_888 + + /** + * 16 bits RGB format, 5 bits for Red channel, 6 bits for Green channel, + * and 5 bits for Blue channel. + * + *

+ * Corresponding formats: + *

    + *
  • AHardwareBuffer: AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM
  • + *
  • Vulkan: VK_FORMAT_R5G6B5_UNORM_PACK16
  • + *
  • OpenGL ES: GL_RGB565
  • + *
+ *

+ * + * @see AImage + * @see AImageReader + * @see AHardwareBuffer + */ + FORMAT_RGB_565 Formats = C.AIMAGE_FORMAT_RGB_565 -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Image) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) + /** + * 64 bits RGBA format, 16 bits for each of the four channels. + * + *

+ * Corresponding formats: + *

    + *
  • AHardwareBuffer: AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT
  • + *
  • Vulkan: VK_FORMAT_R16G16B16A16_SFLOAT
  • + *
  • OpenGL ES: GL_RGBA16F
  • + *
+ *

+ * + * @see AImage + * @see AImageReader + * @see AHardwareBuffer + */ + FORMAT_RGBA_FP16 Formats = C.AIMAGE_FORMAT_RGBA_FP16 + + /** + * Multi-plane Android YUV 420 format. + * + *

This format is a generic YCbCr format, capable of describing any 4:2:0 + * chroma-subsampled planar or semiplanar buffer (but not fully interleaved), + * with 8 bits per color sample.

+ * + *

Images in this format are always represented by three separate buffers + * of data, one for each color plane. Additional information always + * accompanies the buffers, describing the row stride and the pixel stride + * for each plane.

+ * + *

The order of planes is guaranteed such that plane #0 is always Y, plane #1 is always + * U (Cb), and plane #2 is always V (Cr).

+ * + *

The Y-plane is guaranteed not to be interleaved with the U/V planes + * (in particular, pixel stride is always 1 in {@link AImage_getPlanePixelStride}).

+ * + *

The U/V planes are guaranteed to have the same row stride and pixel stride, that is, the + * return value of {@link AImage_getPlaneRowStride} for the U/V plane are guaranteed to be the + * same, and the return value of {@link AImage_getPlanePixelStride} for the U/V plane are also + * guaranteed to be the same.

+ * + *

For example, the {@link AImage} object can provide data + * in this format from a {@link ACameraDevice} through an {@link AImageReader} object.

+ * + *

This format is always supported as an output format for the android Camera2 NDK API.

+ * + * @see AImage + * @see AImageReader + * @see ACameraDevice + */ + FORMAT_YUV_420_888 Formats = C.AIMAGE_FORMAT_YUV_420_888 + + /** + * Compressed JPEG format. + * + *

This format is always supported as an output format for the android Camera2 NDK API.

+ */ + FORMAT_JPEG Formats = C.AIMAGE_FORMAT_JPEG + + /** + * 16 bits per pixel raw camera sensor image format, usually representing a single-channel + * Bayer-mosaic image. + * + *

The layout of the color mosaic, the maximum and minimum encoding + * values of the raw pixel data, the color space of the image, and all other + * needed information to interpret a raw sensor image must be queried from + * the {@link ACameraDevice} which produced the image.

+ */ + FORMAT_RAW16 Formats = C.AIMAGE_FORMAT_RAW16 + + /** + * Private raw camera sensor image format, a single channel image with implementation depedent + * pixel layout. + * + *

AIMAGE_FORMAT_RAW_PRIVATE is a format for unprocessed raw image buffers coming from an + * image sensor. The actual structure of buffers of this format is implementation-dependent.

+ * + */ + FORMAT_RAW_PRIVATE Formats = C.AIMAGE_FORMAT_RAW_PRIVATE + + /** + * Android 10-bit raw format. + * + *

+ * This is a single-plane, 10-bit per pixel, densely packed (in each row), + * unprocessed format, usually representing raw Bayer-pattern images coming + * from an image sensor. + *

+ *

+ * In an image buffer with this format, starting from the first pixel of + * each row, each 4 consecutive pixels are packed into 5 bytes (40 bits). + * Each one of the first 4 bytes contains the top 8 bits of each pixel, The + * fifth byte contains the 2 least significant bits of the 4 pixels, the + * exact layout data for each 4 consecutive pixels is illustrated below + * (Pi[j] stands for the jth bit of the ith pixel): + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Byte 0:P0[9]P0[8]P0[7]P0[6]P0[5]P0[4]P0[3]P0[2]
Byte 1:P1[9]P1[8]P1[7]P1[6]P1[5]P1[4]P1[3]P1[2]
Byte 2:P2[9]P2[8]P2[7]P2[6]P2[5]P2[4]P2[3]P2[2]
Byte 3:P3[9]P3[8]P3[7]P3[6]P3[5]P3[4]P3[3]P3[2]
Byte 4:P3[1]P3[0]P2[1]P2[0]P1[1]P1[0]P0[1]P0[0]
+ *

+ * This format assumes + *

    + *
  • a width multiple of 4 pixels
  • + *
  • an even height
  • + *
+ *

+ * + *
size = row stride * height
where the row stride is in bytes, + * not pixels. + * + *

+ * Since this is a densely packed format, the pixel stride is always 0. The + * application must use the pixel data layout defined in above table to + * access each row data. When row stride is equal to (width * (10 / 8)), there + * will be no padding bytes at the end of each row, the entire image data is + * densely packed. When stride is larger than (width * (10 / 8)), padding + * bytes will be present at the end of each row. + *

+ *

+ * For example, the {@link AImage} object can provide data in this format from a + * {@link ACameraDevice} (if supported) through a {@link AImageReader} object. + * The number of planes returned by {@link AImage_getNumberOfPlanes} will always be 1. + * The pixel stride is undefined ({@link AImage_getPlanePixelStride} will return + * {@link AMEDIA_ERROR_UNSUPPORTED}), and the {@link AImage_getPlaneRowStride} described the + * vertical neighboring pixel distance (in bytes) between adjacent rows. + *

+ * + * @see AImage + * @see AImageReader + * @see ACameraDevice + */ + FORMAT_RAW10 Formats = C.AIMAGE_FORMAT_RAW10 + + /** + * Android 12-bit raw format. + * + *

+ * This is a single-plane, 12-bit per pixel, densely packed (in each row), + * unprocessed format, usually representing raw Bayer-pattern images coming + * from an image sensor. + *

+ *

+ * In an image buffer with this format, starting from the first pixel of each + * row, each two consecutive pixels are packed into 3 bytes (24 bits). The first + * and second byte contains the top 8 bits of first and second pixel. The third + * byte contains the 4 least significant bits of the two pixels, the exact layout + * data for each two consecutive pixels is illustrated below (Pi[j] stands for + * the jth bit of the ith pixel): + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Byte 0:P0[11]P0[10]P0[ 9]P0[ 8]P0[ 7]P0[ 6]P0[ 5]P0[ 4]
Byte 1:P1[11]P1[10]P1[ 9]P1[ 8]P1[ 7]P1[ 6]P1[ 5]P1[ 4]
Byte 2:P1[ 3]P1[ 2]P1[ 1]P1[ 0]P0[ 3]P0[ 2]P0[ 1]P0[ 0]
+ *

+ * This format assumes + *

    + *
  • a width multiple of 4 pixels
  • + *
  • an even height
  • + *
+ *

+ * + *
size = row stride * height
where the row stride is in bytes, + * not pixels. + * + *

+ * Since this is a densely packed format, the pixel stride is always 0. The + * application must use the pixel data layout defined in above table to + * access each row data. When row stride is equal to (width * (12 / 8)), there + * will be no padding bytes at the end of each row, the entire image data is + * densely packed. When stride is larger than (width * (12 / 8)), padding + * bytes will be present at the end of each row. + *

+ *

+ * For example, the {@link AImage} object can provide data in this format from a + * {@link ACameraDevice} (if supported) through a {@link AImageReader} object. + * The number of planes returned by {@link AImage_getNumberOfPlanes} will always be 1. + * The pixel stride is undefined ({@link AImage_getPlanePixelStride} will return + * {@link AMEDIA_ERROR_UNSUPPORTED}), and the {@link AImage_getPlaneRowStride} described the + * vertical neighboring pixel distance (in bytes) between adjacent rows. + *

+ * + * @see AImage + * @see AImageReader + * @see ACameraDevice + */ + FORMAT_RAW12 Formats = C.AIMAGE_FORMAT_RAW12 + + /** + * Android dense depth image format. + * + *

Each pixel is 16 bits, representing a depth ranging measurement from a depth camera or + * similar sensor. The 16-bit sample consists of a confidence value and the actual ranging + * measurement.

+ * + *

The confidence value is an estimate of correctness for this sample. It is encoded in the + * 3 most significant bits of the sample, with a value of 0 representing 100% confidence, a + * value of 1 representing 0% confidence, a value of 2 representing 1/7, a value of 3 + * representing 2/7, and so on.

+ * + *

As an example, the following sample extracts the range and confidence from the first pixel + * of a DEPTH16-format {@link AImage}, and converts the confidence to a floating-point value + * between 0 and 1.f inclusive, with 1.f representing maximum confidence: + * + *

+	 *    uint16_t* data;
+	 *    int dataLength;
+	 *    AImage_getPlaneData(image, 0, (uint8_t**)&data, &dataLength);
+	 *    uint16_t depthSample = data[0];
+	 *    uint16_t depthRange = (depthSample & 0x1FFF);
+	 *    uint16_t depthConfidence = ((depthSample >> 13) & 0x7);
+	 *    float depthPercentage = depthConfidence == 0 ? 1.f : (depthConfidence - 1) / 7.f;
+	 * 
+ *

+ * + *

This format assumes + *

    + *
  • an even width
  • + *
  • an even height
  • + *
  • a horizontal stride multiple of 16 pixels
  • + *
+ *

+ * + *
 y_size = stride * height 
+ * + * When produced by a camera, the units for the range are millimeters. + */ + FORMAT_DEPTH16 Formats = C.AIMAGE_FORMAT_DEPTH16 + + /** + * Android sparse depth point cloud format. + * + *

A variable-length list of 3D points plus a confidence value, with each point represented + * by four floats; first the X, Y, Z position coordinates, and then the confidence value.

+ * + *

The number of points is ((size of the buffer in bytes) / 16). + * + *

The coordinate system and units of the position values depend on the source of the point + * cloud data. The confidence value is between 0.f and 1.f, inclusive, with 0 representing 0% + * confidence and 1.f representing 100% confidence in the measured position values.

+ * + *

As an example, the following code extracts the first depth point in a DEPTH_POINT_CLOUD + * format {@link AImage}: + *

+	 *    float* data;
+	 *    int dataLength;
+	 *    AImage_getPlaneData(image, 0, (uint8_t**)&data, &dataLength);
+	 *    float x = data[0];
+	 *    float y = data[1];
+	 *    float z = data[2];
+	 *    float confidence = data[3];
+	 * 
+ * + */ + FORMAT_DEPTH_POINT_CLOUD Formats = C.AIMAGE_FORMAT_DEPTH_POINT_CLOUD + + /** + * Android private opaque image format. + * + *

The choices of the actual format and pixel data layout are entirely up to the + * device-specific and framework internal implementations, and may vary depending on use cases + * even for the same device. Also note that the contents of these buffers are not directly + * accessible to the application.

+ * + *

When an {@link AImage} of this format is obtained from an {@link AImageReader} or + * {@link AImage_getNumberOfPlanes()} method will return zero.

+ */ + FORMAT_PRIVATE Formats = C.AIMAGE_FORMAT_PRIVATE +) + +/** + * Data type describing an cropped rectangle returned by {@link AImage_getCropRect}. + * + *

Note that the right and bottom coordinates are exclusive, so the width of the rectangle is + * (right - left) and the height of the rectangle is (bottom - top).

+ */ +/*typedef struct AImageCropRect { + int32_t left; + int32_t top; + int32_t right; + int32_t bottom; +} AImageCropRect; +*/ +type ImageCropRect C.AImageCropRect + +/** + * Return the image back the the system and delete the AImage object from memory. + * + *

Do NOT use the image pointer after this method returns. + * Note that if the parent {@link AImageReader} is closed, all the {@link AImage} objects acquired + * from the parent reader will be returned to system. All AImage_* methods except this method will + * return {@link AMEDIA_ERROR_INVALID_OBJECT}. Application still needs to call this method on those + * {@link AImage} objects to fully delete the {@link AImage} object from memory.

+ * + * @param image The {@link AImage} to be deleted. + */ +//void AImage_delete(AImage* image); +func (i *Image) Delete() { + C.AImage_delete(i.cptr()) } -// NewImageFromUintPtr wraps a uintptr as a Image. -// The caller must ensure ptr points to a valid AImage. -func NewImageFromUintPtr(ptr uintptr) *Image { - return &Image{ptr: (*capi.AImage)(unsafe.Pointer(ptr))} +/** + * Query the width of the input {@link AImage}. + * + * @param image the {@link AImage} of interest. + * @param width the width of the image will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image or width is NULL.
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
+ */ +//media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width); +func (i *Image) GetWidth() (int, error) { + var width C.int32_t + ret := CMediaStatusToError(C.AImage_getWidth(i.cptr(), &width)) + return int(width), ret } -// DeleteAsync calls the underlying NDK function. -func (h *Image) DeleteAsync(releaseFenceFd int32) { - capi.AImage_deleteAsync(h.ptr, releaseFenceFd) +/** + * Query the height of the input {@link AImage}. + * + * @param image the {@link AImage} of interest. + * @param height the height of the image will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image or height is NULL.
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
+ */ +//media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height); +func (i *Image) GetHeight() (int, error) { + var height C.int32_t + ret := CMediaStatusToError(C.AImage_getHeight(i.cptr(), &height)) + return int(height), ret } -// Format calls the underlying NDK function. -func (h *Image) Format(format *int32) error { - return result(capi.AImage_getFormat(h.ptr, format)) +/** + * Query the format of the input {@link AImage}. + * + *

The format value will be one of AIMAGE_FORMAT_* enum value.

+ * + * @param image the {@link AImage} of interest. + * @param format the format of the image will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image or format is NULL.
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
+ */ +//media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format); +func (i *Image) GetFormat() (Formats, error) { + var format C.int32_t + ret := CMediaStatusToError(C.AImage_getFormat(i.cptr(), &format)) + return Formats(format), ret } -// Height calls the underlying NDK function. -func (h *Image) Height(height *int32) error { - return result(capi.AImage_getHeight(h.ptr, height)) +/** + * Query the cropped rectangle of the input {@link AImage}. + * + *

The crop rectangle specifies the region of valid pixels in the image, using coordinates in the + * largest-resolution plane.

+ * + * @param image the {@link AImage} of interest. + * @param rect the cropped rectangle of the image will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image or rect is NULL.
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
+ */ +//media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* rect); +func (i *Image) GetCropRect() (ImageCropRect, error) { + var cropRect C.AImageCropRect + ret := CMediaStatusToError(C.AImage_getCropRect(i.cptr(), &cropRect)) + return (ImageCropRect)(cropRect), ret } -// NumberOfPlanes calls the underlying NDK function. -func (h *Image) NumberOfPlanes(numPlanes *int32) error { - return result(capi.AImage_getNumberOfPlanes(h.ptr, numPlanes)) +/** + * Query the timestamp of the input {@link AImage}. + * + *

+ * The timestamp is measured in nanoseconds, and is normally monotonically increasing. The + * timestamps for the images from different sources may have different timebases therefore may not + * be comparable. The specific meaning and timebase of the timestamp depend on the source providing + * images. For images generated by camera, the timestamp value will match + * {@link ACAMERA_SENSOR_TIMESTAMP} of the {@link ACameraMetadata} in + * {@link ACameraCaptureSession_captureCallbacks#onCaptureStarted} and + * {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted} callback. + *

+ * + * @param image the {@link AImage} of interest. + * @param timestampNs the timestamp of the image will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image or timestampNs is NULL.
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
+ */ +//media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestampNs); +func (i *Image) GetTimestamp() (time.Duration, error) { + var timestamp C.int64_t + ret := CMediaStatusToError(C.AImage_getTimestamp(i.cptr(), ×tamp)) + return time.Duration(timestamp) * time.Nanosecond, ret } -// PlaneData calls the underlying NDK function. -func (h *Image) PlaneData(planeIdx int32) (*uint8, int32, error) { - var dataPtr *uint8 - var dataLengthPtr int32 - ret := capi.AImage_getPlaneData(h.ptr, planeIdx, &dataPtr, &dataLengthPtr) - if err := result(ret); err != nil { - return nil, 0, err - } - return dataPtr, dataLengthPtr, nil +/** + * Query the number of planes of the input {@link AImage}. + * + *

The number of plane of an {@link AImage} is determined by its format, which can be queried by + * {@link AImage_getFormat} method.

+ * + * @param image the {@link AImage} of interest. + * @param numPlanes the number of planes of the image will be filled here if the method call + * succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image or numPlanes is NULL.
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
+ */ +//media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* numPlanes); +func (i *Image) GetNumberOfPlanes() (int, error) { + var numPlanes C.int32_t + ret := CMediaStatusToError(C.AImage_getNumberOfPlanes(i.cptr(), &numPlanes)) + return int(numPlanes), ret } -// PlanePixelStride calls the underlying NDK function. -func (h *Image) PlanePixelStride(planeIdx int32, pixelStride *int32) error { - return result(capi.AImage_getPlanePixelStride(h.ptr, planeIdx, pixelStride)) +/** + * Query the pixel stride of the input {@link AImage}. + * + *

This is the distance between two consecutive pixel values in a row of pixels. It may be + * larger than the size of a single pixel to account for interleaved image data or padded formats. + * Note that pixel stride is undefined for some formats such as {@link AIMAGE_FORMAT_RAW_PRIVATE}, + * and calling this method on images of these formats will cause {@link AMEDIA_ERROR_UNSUPPORTED} + * being returned. + * For formats where pixel stride is well defined, the pixel stride is always greater than 0.

+ * + * @param image the {@link AImage} of interest. + * @param planeIdx the index of the plane. Must be less than the number of planes of input image. + * @param pixelStride the pixel stride of the image will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image or pixelStride is NULL, or planeIdx + * is out of the range of [0, numOfPlanes - 1].
  • + *
  • {@link AMEDIA_ERROR_UNSUPPORTED} if pixel stride is undefined for the format of input + * image.
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
  • + *
  • {@link AMEDIA_IMGREADER_CANNOT_LOCK_IMAGE} if the {@link AImage} cannot be locked + * for CPU access.
+ */ +//media_status_t AImage_getPlanePixelStride( +// const AImage* image, int planeIdx, /*out*/int32_t* pixelStride); +func (i *Image) GetPlanePixelStride(planeIdx int) (int, error) { + var pixelStride C.int32_t + ret := CMediaStatusToError(C.AImage_getPlanePixelStride(i.cptr(), C.int(planeIdx), &pixelStride)) + return (int)(pixelStride), ret } -// PlaneRowStride calls the underlying NDK function. -func (h *Image) PlaneRowStride(planeIdx int32, rowStride *int32) error { - return result(capi.AImage_getPlaneRowStride(h.ptr, planeIdx, rowStride)) +/** + * Query the row stride of the input {@link AImage}. + * + *

This is the distance between the start of two consecutive rows of pixels in the image. Note + * that row stried is undefined for some formats such as {@link AIMAGE_FORMAT_RAW_PRIVATE}, and + * calling this method on images of these formats will cause {@link AMEDIA_ERROR_UNSUPPORTED} + * being returned. + * For formats where row stride is well defined, the row stride is always greater than 0.

+ * + * @param image the {@link AImage} of interest. + * @param planeIdx the index of the plane. Must be less than the number of planes of input image. + * @param rowStride the row stride of the image will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image or rowStride is NULL, or planeIdx + * is out of the range of [0, numOfPlanes - 1].
  • + *
  • {@link AMEDIA_ERROR_UNSUPPORTED} if row stride is undefined for the format of input + * image.
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
  • + *
  • {@link AMEDIA_IMGREADER_CANNOT_LOCK_IMAGE} if the {@link AImage} cannot be locked + * for CPU access.
+ */ +//media_status_t AImage_getPlaneRowStride( +// const AImage* image, int planeIdx, /*out*/int32_t* rowStride); +func (i *Image) GetPlaneRowStride(planeIdx int) (int, error) { + var rowStride C.int32_t + ret := CMediaStatusToError(C.AImage_getPlaneRowStride(i.cptr(), C.int(planeIdx), &rowStride)) + return (int)(rowStride), ret } -// Timestamp calls the underlying NDK function. -func (h *Image) Timestamp(timestampNs *int64) error { - return result(capi.AImage_getTimestamp(h.ptr, timestampNs)) +/** + * Get the data pointer of the input image for direct application access. + * + *

Note that once the {@link AImage} or the parent {@link AImageReader} is deleted, the data + * pointer from previous AImage_getPlaneData call becomes invalid. Do NOT use it after the + * {@link AImage} or the parent {@link AImageReader} is deleted.

+ * + * @param image the {@link AImage} of interest. + * @param planeIdx the index of the plane. Must be less than the number of planes of input image. + * @param data the data pointer of the image will be filled here if the method call succeeeds. + * @param dataLength the valid length of data will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if image, data or dataLength is NULL, or + * planeIdx is out of the range of [0, numOfPlanes - 1].
  • + *
  • {@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this + * image has been deleted.
  • + *
  • {@link AMEDIA_IMGREADER_CANNOT_LOCK_IMAGE} if the {@link AImage} cannot be locked + * for CPU access.
+ */ +//media_status_t AImage_getPlaneData( +// const AImage* image, int planeIdx, +// /*out*/uint8_t** data, /*out*/int* dataLength); +func (i *Image) GetPlaneData(planeIdx int) ([]byte, error) { + var data *C.uint8_t + var dataLength C.int + ret := CMediaStatusToError(C.AImage_getPlaneData(i.cptr(), C.int(planeIdx), &data, &dataLength)) + if ret == nil { + return ((*[1 << 30]byte)(unsafe.Pointer(data)))[:dataLength], ret + } + return nil, ret } -// Width calls the underlying NDK function. -func (h *Image) Width(width *int32) error { - return result(capi.AImage_getWidth(h.ptr, width)) +func (f Formats) String() string { + switch f { + default: + return fmt.Sprintf("FORMAT_UNKNOWN_%d", f) + case FORMAT_RGBA_8888: + return "FORMAT_RGBA_8888" + case FORMAT_RGBX_8888: + return "FORMAT_RGBX_8888" + case FORMAT_RGB_888: + return "FORMAT_RGB_888" + case FORMAT_RGB_565: + return "FORMAT_RGB_565" + case FORMAT_RGBA_FP16: + return "FORMAT_RGBA_FP16" + case FORMAT_YUV_420_888: + return "FORMAT_YUV_420_888" + case FORMAT_JPEG: + return "FORMAT_JPEG" + case FORMAT_RAW16: + return "FORMAT_RAW16" + case FORMAT_RAW_PRIVATE: + return "FORMAT_RAW_PRIVATE" + case FORMAT_RAW10: + return "FORMAT_RAW10" + case FORMAT_RAW12: + return "FORMAT_RAW12" + case FORMAT_DEPTH16: + return "FORMAT_DEPTH16" + case FORMAT_DEPTH_POINT_CLOUD: + return "FORMAT_DEPTH_POINT_CLOUD" + case FORMAT_PRIVATE: + return "FORMAT_PRIVATE" + } } diff --git a/media/image_crop_rect.go b/media/image_crop_rect.go deleted file mode 100644 index fc0bf18..0000000 --- a/media/image_crop_rect.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// ImageCropRect wraps the NDK AImageCropRect handle. -type ImageCropRect struct { - ptr *capi.AImageCropRect -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *ImageCropRect) cptr() *capi.AImageCropRect { - if h == nil { - return nil - } - return h.ptr -} - -// NewImageCropRectFromPointer wraps a raw AImageCropRect pointer. -func NewImageCropRectFromPointer(ptr unsafe.Pointer) *ImageCropRect { - return &ImageCropRect{ptr: (*capi.AImageCropRect)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *ImageCropRect) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *ImageCropRect) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewImageCropRectFromUintPtr wraps a uintptr as a ImageCropRect. -// The caller must ensure ptr points to a valid AImageCropRect. -func NewImageCropRectFromUintPtr(ptr uintptr) *ImageCropRect { - return &ImageCropRect{ptr: (*capi.AImageCropRect)(unsafe.Pointer(ptr))} -} diff --git a/media/image_formats.go b/media/image_formats.go deleted file mode 100644 index 1e7c58b..0000000 --- a/media/image_formats.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type IMAGE_FORMATS int32 - -const ( - AIMAGE_FORMAT_RGBA_8888 IMAGE_FORMATS = 1 - AIMAGE_FORMAT_RGBX_8888 IMAGE_FORMATS = 2 - AIMAGE_FORMAT_RGB_888 IMAGE_FORMATS = 3 - AIMAGE_FORMAT_RGB_565 IMAGE_FORMATS = 4 - AIMAGE_FORMAT_RGBA_FP16 IMAGE_FORMATS = 22 - AIMAGE_FORMAT_YUV_420_888 IMAGE_FORMATS = 35 - AIMAGE_FORMAT_JPEG IMAGE_FORMATS = 256 - AIMAGE_FORMAT_RAW16 IMAGE_FORMATS = 32 - AIMAGE_FORMAT_RAW_PRIVATE IMAGE_FORMATS = 36 - AIMAGE_FORMAT_RAW10 IMAGE_FORMATS = 37 - AIMAGE_FORMAT_RAW12 IMAGE_FORMATS = 38 - AIMAGE_FORMAT_DEPTH16 IMAGE_FORMATS = 1144402265 - AIMAGE_FORMAT_DEPTH_POINT_CLOUD IMAGE_FORMATS = 257 - AIMAGE_FORMAT_PRIVATE IMAGE_FORMATS = 34 - AIMAGE_FORMAT_Y8 IMAGE_FORMATS = 538982489 - AIMAGE_FORMAT_HEIC IMAGE_FORMATS = 1212500294 - AIMAGE_FORMAT_DEPTH_JPEG IMAGE_FORMATS = 1768253795 -) diff --git a/media/image_reader.go b/media/image_reader.go index 55e3527..cbf4e30 100644 --- a/media/image_reader.go +++ b/media/image_reader.go @@ -1,126 +1,376 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkImageReader.h + */ + +/* + * This file defines an NDK API. + * Do not remove methods. + * Do not change method signatures. + * Do not change the value of constants. + * Do not change the size of any of the classes defined in here. + * Do not reference types that are not part of the NDK. + * Do not #include files that aren't part of the NDK. + */ package media +/* +#include "media/NdkImageReader.h" + +extern void cgoImageListenerCallback(void*, AImageReader*); +*/ +import "C" + import ( "unsafe" - capi "github.com/AndroidGoLab/ndk/capi/media" + "github.com/xaionaro-go/ndk/ndk" ) -// ImageReader wraps the NDK AImageReader handle. -type ImageReader struct { - ptr *capi.AImageReader -} +/** + * AImage is an opaque type that allows direct application access to image data rendered into a + * {@link ANativeWindow}. + */ +type ImageReader C.AImageReader -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *ImageReader) cptr() *capi.AImageReader { - if h == nil { - return nil - } - return h.ptr +func (reader *ImageReader) cptr() *C.AImageReader { + return (*C.AImageReader)(reader) } -// Close releases the underlying NDK handle. -func (h *ImageReader) Close() error { - if h.ptr == nil { - return nil +/** + * Create a new reader for images of the desired size and format. + * + *

+ * The maxImages parameter determines the maximum number of {@link AImage} objects that can be + * acquired from the {@link AImageReader} simultaneously. Requesting more buffers will use up + * more memory, so it is important to use only the minimum number necessary for the use case. + *

+ *

+ * The valid sizes and formats depend on the source of the image data. + *

+ * + * @param width The default width in pixels of the Images that this reader will produce. + * @param height The default height in pixels of the Images that this reader will produce. + * @param format The format of the Image that this reader will produce. This must be one of the + * AIMAGE_FORMAT_* enum value defined in {@link AIMAGE_FORMATS}. Note that not all + * formats are supported. One example is {@link AIMAGE_FORMAT_PRIVATE}, as it is not + * intended to be read by applications directly. That format is supported by + * {@link AImageReader_newWithUsage} introduced in API 26. + * @param maxImages The maximum number of images the user will want to access simultaneously. This + * should be as small as possible to limit memory use. Once maxImages Images are obtained + * by the user, one of them has to be released before a new {@link AImage} will become + * available for access through {@link AImageReader_acquireLatestImage} or + * {@link AImageReader_acquireNextImage}. Must be greater than 0. + * @param reader The created image reader will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader is NULL, or one or more of width, + * height, format, maxImages arguments is not supported.
  • + *
  • {@link AMEDIA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ * + * @see AImage + */ +//media_status_t AImageReader_new( +// int32_t width, int32_t height, int32_t format, int32_t maxImages, +// /*out*/AImageReader** reader) __INTRODUCED_IN(24); +func NewImageReader(width, height int, format Formats, maxImages int) (*ImageReader, error) { + var reader *C.AImageReader + ret := CMediaStatusToError(C.AImageReader_new(C.int32_t(width), C.int32_t(height), + C.int32_t(format), C.int32_t(maxImages), &reader)) + if ret == nil { + return (*ImageReader)(reader), ret } - capi.AImageReader_delete(h.ptr) - h.ptr = nil - return nil + return nil, ret } -// NewImageReaderFromPointer wraps a raw AImageReader pointer. -func NewImageReaderFromPointer(ptr unsafe.Pointer) *ImageReader { - return &ImageReader{ptr: (*capi.AImageReader)(ptr)} +/** + * Delete an {@link AImageReader} and return all images generated by this reader to system. + * + *

This method will return all {@link AImage} objects acquired by this reader (via + * {@link AImageReader_acquireNextImage} or {@link AImageReader_acquireLatestImage}) to system, + * making any of data pointers obtained from {@link AImage_getPlaneData} invalid. Do NOT access + * the reader object or any of those data pointers after this method returns.

+ * + * @param reader The image reader to be deleted. + */ +//void AImageReader_delete(AImageReader* reader) __INTRODUCED_IN(24); +func (reader *ImageReader) Delete() { + delete(listenerCallbackMap, unsafe.Pointer(reader.cptr())) + C.AImageReader_delete(reader.cptr()) } -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *ImageReader) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) +/** + * Get a {@link ANativeWindow} that can be used to produce {@link AImage} for this image reader. + * + * @param reader The image reader of interest. + * @param window The output {@link ANativeWindow} will be filled here if the method call succeeds. + * The {@link ANativeWindow} is managed by this image reader. Do NOT call + * {@link ANativeWindow_release} on it. Instead, use {@link AImageReader_delete}. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or window is NULL.
+ */ +//media_status_t AImageReader_getWindow(AImageReader* reader, /*out*/ANativeWindow** window) __INTRODUCED_IN(24); +func (reader *ImageReader) GetWindow() (*ndk.Window, error) { + var win *C.ANativeWindow + ret := CMediaStatusToError(C.AImageReader_getWindow(reader.cptr(), &win)) + if ret == nil { + return (*ndk.Window)(win), ret + } + return nil, ret } -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *ImageReader) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) +/** + * Query the default width of the {@link AImage} generated by this reader, in pixels. + * + *

The width may be overridden by the producer sending buffers to this reader's + * {@link ANativeWindow}. If so, the actual width of the images can be found using + * {@link AImage_getWidth}.

+ * + * @param reader The image reader of interest. + * @param width the default width of the reader will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or width is NULL.
+ */ +//media_status_t AImageReader_getWidth(const AImageReader* reader, /*out*/int32_t* width) __INTRODUCED_IN(24); +func (reader *ImageReader) GetWidth() (int, error) { + var width C.int32_t + ret := CMediaStatusToError(C.AImageReader_getWidth(reader.cptr(), &width)) + return int(width), ret } -// NewImageReaderFromUintPtr wraps a uintptr as a ImageReader. -// The caller must ensure ptr points to a valid AImageReader. -func NewImageReaderFromUintPtr(ptr uintptr) *ImageReader { - return &ImageReader{ptr: (*capi.AImageReader)(unsafe.Pointer(ptr))} +/** + * Query the default height of the {@link AImage} generated by this reader, in pixels. + * + *

The height may be overridden by the producer sending buffers to this reader's + * {@link ANativeWindow}. If so, the actual height of the images can be found using + * {@link AImage_getHeight}.

+ * + * @param reader The image reader of interest. + * @param height the default height of the reader will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or height is NULL.
+ */ +//media_status_t AImageReader_getHeight(const AImageReader* reader, /*out*/int32_t* height) __INTRODUCED_IN(24); +func (reader *ImageReader) GetHeight() (int, error) { + var height C.int32_t + ret := CMediaStatusToError(C.AImageReader_getHeight(reader.cptr(), &height)) + return int(height), ret } -// AcquireLatestImage calls the underlying NDK function. -func (h *ImageReader) AcquireLatestImage() (*Image, error) { - var imagePtr *capi.AImage - ret := capi.AImageReader_acquireLatestImage(h.ptr, &imagePtr) - if err := result(ret); err != nil { - return nil, err - } - return &Image{ptr: imagePtr}, nil +/** + * Query the format of the {@link AImage} generated by this reader. + * + * @param reader The image reader of interest. + * @param format the fromat of the reader will be filled here if the method call succeeeds. The + * value will be one of the AIMAGE_FORMAT_* enum value defiend in {@link NdkImage.h}. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or format is NULL.
+ */ +//media_status_t AImageReader_getFormat(const AImageReader* reader, /*out*/int32_t* format) __INTRODUCED_IN(24); +func (reader *ImageReader) GetFormat() (Formats, error) { + var format C.int32_t + ret := CMediaStatusToError(C.AImageReader_getFormat(reader.cptr(), &format)) + return Formats(format), ret } -// AcquireNextImage calls the underlying NDK function. -func (h *ImageReader) AcquireNextImage() (*Image, error) { - var imagePtr *capi.AImage - ret := capi.AImageReader_acquireNextImage(h.ptr, &imagePtr) - if err := result(ret); err != nil { - return nil, err - } - return &Image{ptr: imagePtr}, nil +/** + * Query the maximum number of concurrently acquired {@link AImage}s of this reader. + * + * @param reader The image reader of interest. + * @param maxImages the maximum number of concurrently acquired images of the reader will be filled + * here if the method call succeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or maxImages is NULL.
+ */ +//media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int32_t* maxImages) __INTRODUCED_IN(24); +func (reader *ImageReader) GetMaxImages() (int, error) { + var maxImages C.int32_t + ret := CMediaStatusToError(C.AImageReader_getMaxImages(reader.cptr(), &maxImages)) + return int(maxImages), ret } -// Format calls the underlying NDK function. -func (h *ImageReader) Format(format *int32) error { - return result(capi.AImageReader_getFormat(h.ptr, format)) +/** + * Acquire the next {@link AImage} from the image reader's queue. + * + *

Warning: Consider using {@link AImageReader_acquireLatestImage} instead, as it will + * automatically release older images, and allow slower-running processing routines to catch + * up to the newest frame. Usage of {@link AImageReader_acquireNextImage} is recommended for + * batch/background processing. Incorrectly using this method can cause images to appear + * with an ever-increasing delay, followed by a complete stall where no new images seem to appear. + *

+ * + *

+ * This method will fail if {@link AImageReader_getMaxImages maxImages} have been acquired with + * {@link AImageReader_acquireNextImage} or {@link AImageReader_acquireLatestImage}. In particular + * a sequence of {@link AImageReader_acquireNextImage} or {@link AImageReader_acquireLatestImage} + * calls greater than {@link AImageReader_getMaxImages maxImages} without calling + * {@link AImage_delete} in-between will exhaust the underlying queue. At such a time, + * {@link AMEDIA_IMGREADER_MAX_IMAGES_ACQUIRED} will be returned until more images are released with + * {@link AImage_delete}. + *

+ * + * @param reader The image reader of interest. + * @param image the acquired {@link AImage} will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or image is NULL.
  • + *
  • {@link AMEDIA_IMGREADER_MAX_IMAGES_ACQUIRED} if the number of concurrently acquired + * images has reached the limit.
  • + *
  • {@link AMEDIA_IMGREADER_NO_BUFFER_AVAILABLE} if there is no buffers currently + * available in the reader queue.
  • + *
  • {@link AMEDIA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ * + * @see AImageReader_acquireLatestImage + */ +//media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage** image) __INTRODUCED_IN(24); +func (reader *ImageReader) AcquireNextImage() (*Image, error) { + var image *C.AImage + ret := CMediaStatusToError(C.AImageReader_acquireNextImage(reader.cptr(), &image)) + return (*Image)(image), ret } -// Height calls the underlying NDK function. -func (h *ImageReader) Height(height *int32) error { - return result(capi.AImageReader_getHeight(h.ptr, height)) -} +/** -// MaxImages calls the underlying NDK function. -func (h *ImageReader) MaxImages(maxImages *int32) error { - return result(capi.AImageReader_getMaxImages(h.ptr, maxImages)) + * Acquire the latest {@link AImage} from the image reader's queue, dropping older images. + * + *

+ * This operation will acquire all the images possible from the image reader, but + * {@link AImage_delete} all images that aren't the latest. This function is recommended to use over + * {@link AImageReader_acquireNextImage} for most use-cases, as it's more suited for real-time + * processing. + *

+ *

+ * Note that {@link AImageReader_getMaxImages maxImages} should be at least 2 for + * {@link AImageReader_acquireLatestImage} to be any different than + * {@link AImageReader_acquireNextImage} - discarding all-but-the-newest {@link AImage} requires + * temporarily acquiring two {@link AImage}s at once. Or more generally, calling + * {@link AImageReader_acquireLatestImage} with less than two images of margin, that is + * (maxImages - currentAcquiredImages < 2) will not discard as expected. + *

+ *

+ * This method will fail if {@link AImageReader_getMaxImages maxImages} have been acquired with + * {@link AImageReader_acquireNextImage} or {@link AImageReader_acquireLatestImage}. In particular + * a sequence of {@link AImageReader_acquireNextImage} or {@link AImageReader_acquireLatestImage} + * calls greater than {@link AImageReader_getMaxImages maxImages} without calling + * {@link AImage_delete} in-between will exhaust the underlying queue. At such a time, + * {@link AMEDIA_IMGREADER_MAX_IMAGES_ACQUIRED} will be returned until more images are released with + * {@link AImage_delete}. + *

+ * + * @param reader The image reader of interest. + * @param image the acquired {@link AImage} will be filled here if the method call succeeeds. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or image is NULL.
  • + *
  • {@link AMEDIA_IMGREADER_MAX_IMAGES_ACQUIRED} if the number of concurrently acquired + * images has reached the limit.
  • + *
  • {@link AMEDIA_IMGREADER_NO_BUFFER_AVAILABLE} if there is no buffers currently + * available in the reader queue.
  • + *
  • {@link AMEDIA_ERROR_UNKNOWN} if the method fails for some other reasons.
+ * + * @see AImageReader_acquireNextImage + */ +//media_status_t AImageReader_acquireLatestImage(AImageReader* reader, /*out*/AImage** image) __INTRODUCED_IN(24); +func (reader *ImageReader) AcquireLatestImage() (*Image, error) { + var image *C.AImage + ret := CMediaStatusToError(C.AImageReader_acquireLatestImage(reader.cptr(), &image)) + return (*Image)(image), ret } -// Width calls the underlying NDK function. -func (h *ImageReader) Width(width *int32) error { - return result(capi.AImageReader_getWidth(h.ptr, width)) -} +/** + * Signature of the callback which is called when a new image is available from {@link AImageReader}. + * + * @param context The optional application context provided by user in + * {@link AImageReader_setImageListener}. + * @param session The camera capture session whose state is changing. + */ +//typedef void (*AImageReader_ImageCallback)(void* context, AImageReader* reader); -// Window calls the underlying NDK function. -func (h *ImageReader) Window() (*Window, error) { - var windowPtr *capi.ANativeWindow - ret := capi.AImageReader_getWindow(h.ptr, &windowPtr) - if err := result(ret); err != nil { - return nil, err - } - return &Window{ptr: windowPtr}, nil -} +//typedef struct AImageReader_ImageListener { +/// Optional application context passed as the first parameter of the callback. +// void* context; -// NewImageReader calls the underlying C function. -func NewImageReader(width int32, height int32, format int32, maxImages int32) (*ImageReader, error) { - var readerPtr *capi.AImageReader - ret := capi.AImageReader_new(width, height, format, maxImages, &readerPtr) - if err := result(ret); err != nil { - return nil, err - } - return &ImageReader{ptr: readerPtr}, nil +/** + * This callback is called when there is a new image available in the image reader's queue. + * + *

The callback happens on one dedicated thread per {@link AImageReader} instance. It is okay + * to use AImageReader_* and AImage_* methods within the callback. Note that it is possible that + * calling {@link AImageReader_acquireNextImage} or {@link AImageReader_acquireLatestImage} + * returns {@link AMEDIA_IMGREADER_NO_BUFFER_AVAILABLE} within this callback. For example, when + * there are multiple images and callbacks queued, if application called + * {@link AImageReader_acquireLatestImage}, some images will be returned to system before their + * corresponding callback is executed.

+ */ +// AImageReader_ImageCallback onImageAvailable; +//} AImageReader_ImageListener; + +/** + * Set the onImageAvailable listener of this image reader. + * + * Calling this method will replace previously registered listeners. + * + * @param reader The image reader of interest. + * @param listener The {@link AImageReader_ImageListener} to be registered. Set this to NULL if + * the application no longer needs to listen to new images. + * + * @return
    + *
  • {@link AMEDIA_OK} if the method call succeeds.
  • + *
  • {@link AMEDIA_ERROR_INVALID_PARAMETER} if reader is NULL.
+ */ +//media_status_t AImageReader_setImageListener( +// AImageReader* reader, AImageReader_ImageListener* listener) __INTRODUCED_IN(24); +func (reader *ImageReader) SetImageListener(onImageAvailable func(*ImageReader)) error { + var listener C.AImageReader_ImageListener + listener.context = unsafe.Pointer(reader.cptr()) + listener.onImageAvailable = (C.AImageReader_ImageCallback)(C.cgoImageListenerCallback) + listenerCallbackMap[listener.context] = onImageAvailable + return CMediaStatusToError(C.AImageReader_setImageListener(reader.cptr(), &listener)) } -// NewImageReaderWithUsage calls the underlying C function. -func NewImageReaderWithUsage(width int32, height int32, format int32, usage uint64, maxImages int32) (*ImageReader, error) { - var readerPtr *capi.AImageReader - ret := capi.AImageReader_newWithUsage(width, height, format, usage, maxImages, &readerPtr) - if err := result(ret); err != nil { - return nil, err +var listenerCallbackMap = map[unsafe.Pointer]func(*ImageReader){} + +//export cgoImageListenerCallback +func cgoImageListenerCallback(context unsafe.Pointer, reader *C.AImageReader) { + creader := (*C.AImageReader)(context) + if fn, ok := listenerCallbackMap[context]; ok { + fn((*ImageReader)(creader)) } - return &ImageReader{ptr: readerPtr}, nil } diff --git a/media/image_reader_buffer_removed_listener.go b/media/image_reader_buffer_removed_listener.go deleted file mode 100644 index c3aaeab..0000000 --- a/media/image_reader_buffer_removed_listener.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// ImageReader_BufferRemovedListener wraps the NDK AImageReader_BufferRemovedListener handle. -type ImageReader_BufferRemovedListener struct { - ptr *capi.AImageReader_BufferRemovedListener -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *ImageReader_BufferRemovedListener) cptr() *capi.AImageReader_BufferRemovedListener { - if h == nil { - return nil - } - return h.ptr -} - -// NewImageReader_BufferRemovedListenerFromPointer wraps a raw AImageReader_BufferRemovedListener pointer. -func NewImageReader_BufferRemovedListenerFromPointer(ptr unsafe.Pointer) *ImageReader_BufferRemovedListener { - return &ImageReader_BufferRemovedListener{ptr: (*capi.AImageReader_BufferRemovedListener)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *ImageReader_BufferRemovedListener) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *ImageReader_BufferRemovedListener) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewImageReader_BufferRemovedListenerFromUintPtr wraps a uintptr as a ImageReader_BufferRemovedListener. -// The caller must ensure ptr points to a valid AImageReader_BufferRemovedListener. -func NewImageReader_BufferRemovedListenerFromUintPtr(ptr uintptr) *ImageReader_BufferRemovedListener { - return &ImageReader_BufferRemovedListener{ptr: (*capi.AImageReader_BufferRemovedListener)(unsafe.Pointer(ptr))} -} diff --git a/media/image_reader_image_listener.go b/media/image_reader_image_listener.go deleted file mode 100644 index 6a3fd33..0000000 --- a/media/image_reader_image_listener.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// ImageReader_ImageListener wraps the NDK AImageReader_ImageListener handle. -type ImageReader_ImageListener struct { - ptr *capi.AImageReader_ImageListener -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *ImageReader_ImageListener) cptr() *capi.AImageReader_ImageListener { - if h == nil { - return nil - } - return h.ptr -} - -// NewImageReader_ImageListenerFromPointer wraps a raw AImageReader_ImageListener pointer. -func NewImageReader_ImageListenerFromPointer(ptr unsafe.Pointer) *ImageReader_ImageListener { - return &ImageReader_ImageListener{ptr: (*capi.AImageReader_ImageListener)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *ImageReader_ImageListener) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *ImageReader_ImageListener) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewImageReader_ImageListenerFromUintPtr wraps a uintptr as a ImageReader_ImageListener. -// The caller must ensure ptr points to a valid AImageReader_ImageListener. -func NewImageReader_ImageListenerFromUintPtr(ptr uintptr) *ImageReader_ImageListener { - return &ImageReader_ImageListener{ptr: (*capi.AImageReader_ImageListener)(unsafe.Pointer(ptr))} -} diff --git a/media/int_range.go b/media/int_range.go deleted file mode 100644 index 98b1f09..0000000 --- a/media/int_range.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// IntRange wraps the NDK AIntRange handle. -type IntRange struct { - ptr *capi.AIntRange -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *IntRange) cptr() *capi.AIntRange { - if h == nil { - return nil - } - return h.ptr -} - -// NewIntRangeFromPointer wraps a raw AIntRange pointer. -func NewIntRangeFromPointer(ptr unsafe.Pointer) *IntRange { - return &IntRange{ptr: (*capi.AIntRange)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *IntRange) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *IntRange) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewIntRangeFromUintPtr wraps a uintptr as a IntRange. -// The caller must ensure ptr points to a valid AIntRange. -func NewIntRangeFromUintPtr(ptr uintptr) *IntRange { - return &IntRange{ptr: (*capi.AIntRange)(unsafe.Pointer(ptr))} -} diff --git a/media/media_codec.go b/media/media_codec.go new file mode 100644 index 0000000..3959faa --- /dev/null +++ b/media/media_codec.go @@ -0,0 +1,18 @@ +package media + +// #cgo LDFLAGS: -lmediandk +// #include "sys/types.h" +// #include "media/NdkMediaCodec.h" +// #include "media/NdkMediaFormat.h" +import "C" + +type MediaCodec C.AMediaCodec + +func (mc *MediaCodec) CPointer() *C.AMediaCodec { + return (*C.AMediaCodec)(mc) +} + +func (mc *MediaCodec) SetParameters(params *MediaFormat) error { + status := C.AMediaCodec_setParameters(mc.CPointer(), params.CPointer()) + return CMediaStatusToError(status) +} diff --git a/media/media_codec_crypto_info.go b/media/media_codec_crypto_info.go deleted file mode 100644 index fc6246e..0000000 --- a/media/media_codec_crypto_info.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// MediaCodecCryptoInfo wraps the NDK AMediaCodecCryptoInfo handle. -type MediaCodecCryptoInfo struct { - ptr *capi.AMediaCodecCryptoInfo -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *MediaCodecCryptoInfo) cptr() *capi.AMediaCodecCryptoInfo { - if h == nil { - return nil - } - return h.ptr -} - -// NewMediaCodecCryptoInfo creates a new MediaCodecCryptoInfo. -func NewMediaCodecCryptoInfo(numsubsamples int32, key *[16]uint8, iv *[16]uint8, mode cryptoinfo_mode_t, clearbytes *uint64, encryptedbytes *uint64) *MediaCodecCryptoInfo { - return &MediaCodecCryptoInfo{ptr: capi.AMediaCodecCryptoInfo_new(numsubsamples, key, iv, capi.Cryptoinfo_mode_t(mode), clearbytes, encryptedbytes)} -} - -// Close releases the underlying NDK handle. -func (h *MediaCodecCryptoInfo) Close() error { - if h.ptr == nil { - return nil - } - err := result(capi.AMediaCodecCryptoInfo_delete(h.ptr)) - h.ptr = nil - return err -} - -// NewMediaCodecCryptoInfoFromPointer wraps a raw AMediaCodecCryptoInfo pointer. -func NewMediaCodecCryptoInfoFromPointer(ptr unsafe.Pointer) *MediaCodecCryptoInfo { - return &MediaCodecCryptoInfo{ptr: (*capi.AMediaCodecCryptoInfo)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *MediaCodecCryptoInfo) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *MediaCodecCryptoInfo) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMediaCodecCryptoInfoFromUintPtr wraps a uintptr as a MediaCodecCryptoInfo. -// The caller must ensure ptr points to a valid AMediaCodecCryptoInfo. -func NewMediaCodecCryptoInfoFromUintPtr(ptr uintptr) *MediaCodecCryptoInfo { - return &MediaCodecCryptoInfo{ptr: (*capi.AMediaCodecCryptoInfo)(unsafe.Pointer(ptr))} -} - -// GetNumSubSamples returns the value directly. -func (h *MediaCodecCryptoInfo) GetNumSubSamples() uint64 { - return (uint64)(capi.AMediaCodecCryptoInfo_getNumSubSamples(h.ptr)) -} - -// SetPattern calls the underlying NDK function. -func (h *MediaCodecCryptoInfo) SetPattern(pattern *cryptoinfo_pattern_t) { - capi.AMediaCodecCryptoInfo_setPattern(h.ptr, pattern.cptr()) -} diff --git a/media/media_codec_info.go b/media/media_codec_info.go deleted file mode 100644 index 917546b..0000000 --- a/media/media_codec_info.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// MediaCodecInfo wraps the NDK AMediaCodecInfo handle. -type MediaCodecInfo struct { - ptr *capi.AMediaCodecInfo -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *MediaCodecInfo) cptr() *capi.AMediaCodecInfo { - if h == nil { - return nil - } - return h.ptr -} - -// NewMediaCodecInfoFromPointer wraps a raw AMediaCodecInfo pointer. -func NewMediaCodecInfoFromPointer(ptr unsafe.Pointer) *MediaCodecInfo { - return &MediaCodecInfo{ptr: (*capi.AMediaCodecInfo)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *MediaCodecInfo) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *MediaCodecInfo) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMediaCodecInfoFromUintPtr wraps a uintptr as a MediaCodecInfo. -// The caller must ensure ptr points to a valid AMediaCodecInfo. -func NewMediaCodecInfoFromUintPtr(ptr uintptr) *MediaCodecInfo { - return &MediaCodecInfo{ptr: (*capi.AMediaCodecInfo)(unsafe.Pointer(ptr))} -} diff --git a/media/media_codec_info_api36.go b/media/media_codec_info_api36.go deleted file mode 100644 index 2aef8dd..0000000 --- a/media/media_codec_info_api36.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build android_ndk36 - -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -var _ = capi.CgoAllocsUnknown - -// GetCanonicalName returns the value directly. -func (h *MediaCodecInfo) GetCanonicalName() string { - return (string)(capi.AMediaCodecInfo_getCanonicalName(h.ptr)) -} - -// GetMaxSupportedInstances calls the underlying NDK function. -func (h *MediaCodecInfo) GetMaxSupportedInstances() error { - return result(int32(capi.AMediaCodecInfo_getMaxSupportedInstances(h.ptr))) -} - -// GetMediaType returns the value directly. -func (h *MediaCodecInfo) GetMediaType() string { - return (string)(capi.AMediaCodecInfo_getMediaType(h.ptr)) -} - -// IsFeatureRequired calls the underlying NDK function. -func (h *MediaCodecInfo) IsFeatureRequired(featureName string) error { - return result(int32(capi.AMediaCodecInfo_isFeatureRequired(h.ptr, featureName))) -} - -// IsFeatureSupported calls the underlying NDK function. -func (h *MediaCodecInfo) IsFeatureSupported(featureName string) error { - return result(int32(capi.AMediaCodecInfo_isFeatureSupported(h.ptr, featureName))) -} - -// IsFormatSupported calls the underlying NDK function. -func (h *MediaCodecInfo) IsFormatSupported(format *Format) error { - return result(int32(capi.AMediaCodecInfo_isFormatSupported(h.ptr, format.cptr()))) -} - -// IsVendor calls the underlying NDK function. -func (h *MediaCodecInfo) IsVendor() error { - return result(int32(capi.AMediaCodecInfo_isVendor(h.ptr))) -} diff --git a/media/media_codec_kind.go b/media/media_codec_kind.go deleted file mode 100644 index 2765eca..0000000 --- a/media/media_codec_kind.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MediaCodecKind int32 - -const ( - AMediaCodecKind_INVALID MediaCodecKind = 0 - AMediaCodecKind_DECODER MediaCodecKind = 1 - AMediaCodecKind_ENCODER MediaCodecKind = 2 -) diff --git a/media/media_codec_on_async_notify_callback.go b/media/media_codec_on_async_notify_callback.go deleted file mode 100644 index a34257b..0000000 --- a/media/media_codec_on_async_notify_callback.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// MediaCodecOnAsyncNotifyCallback wraps the NDK AMediaCodecOnAsyncNotifyCallback handle. -type MediaCodecOnAsyncNotifyCallback struct { - ptr *capi.AMediaCodecOnAsyncNotifyCallback -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *MediaCodecOnAsyncNotifyCallback) cptr() *capi.AMediaCodecOnAsyncNotifyCallback { - if h == nil { - return nil - } - return h.ptr -} - -// NewMediaCodecOnAsyncNotifyCallbackFromPointer wraps a raw AMediaCodecOnAsyncNotifyCallback pointer. -func NewMediaCodecOnAsyncNotifyCallbackFromPointer(ptr unsafe.Pointer) *MediaCodecOnAsyncNotifyCallback { - return &MediaCodecOnAsyncNotifyCallback{ptr: (*capi.AMediaCodecOnAsyncNotifyCallback)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *MediaCodecOnAsyncNotifyCallback) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *MediaCodecOnAsyncNotifyCallback) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMediaCodecOnAsyncNotifyCallbackFromUintPtr wraps a uintptr as a MediaCodecOnAsyncNotifyCallback. -// The caller must ensure ptr points to a valid AMediaCodecOnAsyncNotifyCallback. -func NewMediaCodecOnAsyncNotifyCallbackFromUintPtr(ptr uintptr) *MediaCodecOnAsyncNotifyCallback { - return &MediaCodecOnAsyncNotifyCallback{ptr: (*capi.AMediaCodecOnAsyncNotifyCallback)(unsafe.Pointer(ptr))} -} diff --git a/media/media_codec_type.go b/media/media_codec_type.go deleted file mode 100644 index 5e9dce5..0000000 --- a/media/media_codec_type.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MediaCodecType int32 - -const ( - AMediaCodecType_INVALID_CODEC_INFO MediaCodecType = 0 - AMediaCodecType_SOFTWARE_ONLY MediaCodecType = 1 - AMediaCodecType_HARDWARE_ACCELERATED MediaCodecType = 2 - AMediaCodecType_SOFTWARE_WITH_DEVICE_ACCESS MediaCodecType = 3 -) diff --git a/media/media_data_source.go b/media/media_data_source.go deleted file mode 100644 index bc31e65..0000000 --- a/media/media_data_source.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// MediaDataSource wraps the NDK AMediaDataSource handle. -type MediaDataSource struct { - ptr *capi.AMediaDataSource -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *MediaDataSource) cptr() *capi.AMediaDataSource { - if h == nil { - return nil - } - return h.ptr -} - -// NewMediaDataSource creates a new MediaDataSource. -func NewMediaDataSource() *MediaDataSource { - return &MediaDataSource{ptr: capi.AMediaDataSource_new()} -} - -// Close releases the underlying NDK handle. -func (h *MediaDataSource) Close() error { - if h.ptr == nil { - return nil - } - capi.AMediaDataSource_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewMediaDataSourceFromPointer wraps a raw AMediaDataSource pointer. -func NewMediaDataSourceFromPointer(ptr unsafe.Pointer) *MediaDataSource { - return &MediaDataSource{ptr: (*capi.AMediaDataSource)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *MediaDataSource) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *MediaDataSource) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMediaDataSourceFromUintPtr wraps a uintptr as a MediaDataSource. -// The caller must ensure ptr points to a valid AMediaDataSource. -func NewMediaDataSourceFromUintPtr(ptr uintptr) *MediaDataSource { - return &MediaDataSource{ptr: (*capi.AMediaDataSource)(unsafe.Pointer(ptr))} -} - -// SetUserdata calls the underlying NDK function. -func (h *MediaDataSource) SetUserdata(userdata unsafe.Pointer) { - capi.AMediaDataSource_setUserdata(h.ptr, userdata) -} diff --git a/media/media_drm_byte_array.go b/media/media_drm_byte_array.go deleted file mode 100644 index 0bd4c14..0000000 --- a/media/media_drm_byte_array.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// MediaDrmByteArray wraps the NDK AMediaDrmByteArray handle. -type MediaDrmByteArray struct { - ptr *capi.AMediaDrmByteArray -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *MediaDrmByteArray) cptr() *capi.AMediaDrmByteArray { - if h == nil { - return nil - } - return h.ptr -} - -// NewMediaDrmByteArrayFromPointer wraps a raw AMediaDrmByteArray pointer. -func NewMediaDrmByteArrayFromPointer(ptr unsafe.Pointer) *MediaDrmByteArray { - return &MediaDrmByteArray{ptr: (*capi.AMediaDrmByteArray)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *MediaDrmByteArray) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *MediaDrmByteArray) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMediaDrmByteArrayFromUintPtr wraps a uintptr as a MediaDrmByteArray. -// The caller must ensure ptr points to a valid AMediaDrmByteArray. -func NewMediaDrmByteArrayFromUintPtr(ptr uintptr) *MediaDrmByteArray { - return &MediaDrmByteArray{ptr: (*capi.AMediaDrmByteArray)(unsafe.Pointer(ptr))} -} diff --git a/media/media_drm_event_type.go b/media/media_drm_event_type.go deleted file mode 100644 index b884874..0000000 --- a/media/media_drm_event_type.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MediaDrmEventType int32 - -const ( - EVENT_PROVISION_REQUIRED MediaDrmEventType = 1 - EVENT_KEY_REQUIRED MediaDrmEventType = 2 - EVENT_KEY_EXPIRED MediaDrmEventType = 3 - EVENT_VENDOR_DEFINED MediaDrmEventType = 4 - EVENT_SESSION_RECLAIMED MediaDrmEventType = 5 -) diff --git a/media/media_drm_key_request_type.go b/media/media_drm_key_request_type.go deleted file mode 100644 index 86361c7..0000000 --- a/media/media_drm_key_request_type.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MediaDrmKeyRequestType int32 - -const ( - KEY_REQUEST_TYPE_INITIAL MediaDrmKeyRequestType = 0 - KEY_REQUEST_TYPE_RENEWAL MediaDrmKeyRequestType = 1 - KEY_REQUEST_TYPE_RELEASE MediaDrmKeyRequestType = 2 - KEY_REQUEST_TYPE_NONE MediaDrmKeyRequestType = 3 - KEY_REQUEST_TYPE_UPDATE MediaDrmKeyRequestType = 4 -) diff --git a/media/media_drm_key_status.go b/media/media_drm_key_status.go deleted file mode 100644 index c9155cc..0000000 --- a/media/media_drm_key_status.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// MediaDrmKeyStatus wraps the NDK AMediaDrmKeyStatus handle. -type MediaDrmKeyStatus struct { - ptr *capi.AMediaDrmKeyStatus -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *MediaDrmKeyStatus) cptr() *capi.AMediaDrmKeyStatus { - if h == nil { - return nil - } - return h.ptr -} - -// NewMediaDrmKeyStatusFromPointer wraps a raw AMediaDrmKeyStatus pointer. -func NewMediaDrmKeyStatusFromPointer(ptr unsafe.Pointer) *MediaDrmKeyStatus { - return &MediaDrmKeyStatus{ptr: (*capi.AMediaDrmKeyStatus)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *MediaDrmKeyStatus) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *MediaDrmKeyStatus) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMediaDrmKeyStatusFromUintPtr wraps a uintptr as a MediaDrmKeyStatus. -// The caller must ensure ptr points to a valid AMediaDrmKeyStatus. -func NewMediaDrmKeyStatusFromUintPtr(ptr uintptr) *MediaDrmKeyStatus { - return &MediaDrmKeyStatus{ptr: (*capi.AMediaDrmKeyStatus)(unsafe.Pointer(ptr))} -} diff --git a/media/media_drm_key_status_type.go b/media/media_drm_key_status_type.go deleted file mode 100644 index af188fc..0000000 --- a/media/media_drm_key_status_type.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MediaDrmKeyStatusType int32 - -const ( - KEY_STATUS_TYPE_USABLE MediaDrmKeyStatusType = 0 - KEY_STATUS_TYPE_EXPIRED MediaDrmKeyStatusType = 1 - KEY_STATUS_TYPE_OUTPUTNOTALLOWED MediaDrmKeyStatusType = 2 - KEY_STATUS_TYPE_STATUSPENDING MediaDrmKeyStatusType = 3 - KEY_STATUS_TYPE_INTERNALERROR MediaDrmKeyStatusType = 4 -) diff --git a/media/media_drm_key_type.go b/media/media_drm_key_type.go deleted file mode 100644 index b3cdcb9..0000000 --- a/media/media_drm_key_type.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MediaDrmKeyType int32 - -const ( - KEY_TYPE_STREAMING MediaDrmKeyType = 1 - KEY_TYPE_OFFLINE MediaDrmKeyType = 2 - KEY_TYPE_RELEASE MediaDrmKeyType = 3 -) diff --git a/media/media_drm_key_value.go b/media/media_drm_key_value.go deleted file mode 100644 index cb170b9..0000000 --- a/media/media_drm_key_value.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// MediaDrmKeyValue wraps the NDK AMediaDrmKeyValue handle. -type MediaDrmKeyValue struct { - ptr *capi.AMediaDrmKeyValue -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *MediaDrmKeyValue) cptr() *capi.AMediaDrmKeyValue { - if h == nil { - return nil - } - return h.ptr -} - -// NewMediaDrmKeyValueFromPointer wraps a raw AMediaDrmKeyValue pointer. -func NewMediaDrmKeyValueFromPointer(ptr unsafe.Pointer) *MediaDrmKeyValue { - return &MediaDrmKeyValue{ptr: (*capi.AMediaDrmKeyValue)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *MediaDrmKeyValue) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *MediaDrmKeyValue) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMediaDrmKeyValueFromUintPtr wraps a uintptr as a MediaDrmKeyValue. -// The caller must ensure ptr points to a valid AMediaDrmKeyValue. -func NewMediaDrmKeyValueFromUintPtr(ptr uintptr) *MediaDrmKeyValue { - return &MediaDrmKeyValue{ptr: (*capi.AMediaDrmKeyValue)(unsafe.Pointer(ptr))} -} diff --git a/media/media_format.go b/media/media_format.go new file mode 100644 index 0000000..e37f650 --- /dev/null +++ b/media/media_format.go @@ -0,0 +1,12 @@ +package media + +// #cgo LDFLAGS: -lmediandk +// #include "sys/types.h" +// #include "media/NdkMediaFormat.h" +import "C" + +type MediaFormat C.AMediaFormat + +func (mf *MediaFormat) CPointer() *C.AMediaFormat { + return (*C.AMediaFormat)(mf) +} diff --git a/media/mediacodec.go b/media/mediacodec.go deleted file mode 100644 index 5a5f2ac..0000000 --- a/media/mediacodec.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MEDIACODEC int32 - -const ( - AMEDIACODEC_CONFIGURE_FLAG_ENCODE MEDIACODEC = 1 - AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED MEDIACODEC = -3 - AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED MEDIACODEC = -2 - AMEDIACODEC_INFO_TRY_AGAIN_LATER MEDIACODEC = -1 -) diff --git a/media/mediacodec_buffer_flag.go b/media/mediacodec_buffer_flag.go deleted file mode 100644 index e969781..0000000 --- a/media/mediacodec_buffer_flag.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MEDIACODEC_BUFFER_FLAG int32 - -const ( - AMEDIACODEC_BUFFER_FLAG_KEY_FRAME MEDIACODEC_BUFFER_FLAG = 1 - AMEDIACODEC_BUFFER_FLAG_CODEC_CONFIG MEDIACODEC_BUFFER_FLAG = 2 - AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM MEDIACODEC_BUFFER_FLAG = 4 - AMEDIACODEC_BUFFER_FLAG_PARTIAL_FRAME MEDIACODEC_BUFFER_FLAG = 8 - AMEDIACODEC_BUFFER_FLAG_MUXER_DATA MEDIACODEC_BUFFER_FLAG = 16 - AMEDIACODEC_BUFFER_FLAG_DECODE_ONLY MEDIACODEC_BUFFER_FLAG = 32 -) diff --git a/media/mediaextractor_sample_flag.go b/media/mediaextractor_sample_flag.go deleted file mode 100644 index 7d3748a..0000000 --- a/media/mediaextractor_sample_flag.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type MEDIAEXTRACTOR_SAMPLE_FLAG int32 - -const ( - AMEDIAEXTRACTOR_SAMPLE_FLAG_SYNC MEDIAEXTRACTOR_SAMPLE_FLAG = 1 - AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED MEDIAEXTRACTOR_SAMPLE_FLAG = 2 -) diff --git a/media/muxer.go b/media/muxer.go deleted file mode 100644 index 1bce320..0000000 --- a/media/muxer.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// Muxer wraps the NDK AMediaMuxer handle. -type Muxer struct { - ptr *capi.AMediaMuxer -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Muxer) cptr() *capi.AMediaMuxer { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Muxer) Close() error { - if h.ptr == nil { - return nil - } - err := result(capi.AMediaMuxer_delete(h.ptr)) - h.ptr = nil - return err -} - -// NewMuxerFromPointer wraps a raw AMediaMuxer pointer. -func NewMuxerFromPointer(ptr unsafe.Pointer) *Muxer { - return &Muxer{ptr: (*capi.AMediaMuxer)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Muxer) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Muxer) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMuxerFromUintPtr wraps a uintptr as a Muxer. -// The caller must ensure ptr points to a valid AMediaMuxer. -func NewMuxerFromUintPtr(ptr uintptr) *Muxer { - return &Muxer{ptr: (*capi.AMediaMuxer)(unsafe.Pointer(ptr))} -} - -// GetTrackCount returns the value directly. -func (h *Muxer) GetTrackCount() int64 { - return (int64)(capi.AMediaMuxer_getTrackCount(h.ptr)) -} - -// GetTrackFormat creates a new Format from this Muxer. -func (h *Muxer) GetTrackFormat(idx uint64) *Format { - return &Format{ptr: capi.AMediaMuxer_getTrackFormat(h.ptr, idx)} -} - -// Start calls the underlying NDK function. -func (h *Muxer) Start() error { - return result(capi.AMediaMuxer_start(h.ptr)) -} - -// Stop calls the underlying NDK function. -func (h *Muxer) Stop() error { - return result(capi.AMediaMuxer_stop(h.ptr)) -} diff --git a/media/off64_t.go b/media/off64_t.go deleted file mode 100644 index d33d015..0000000 --- a/media/off64_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type Off64_t = capi.Off64_t diff --git a/media/off_t.go b/media/off_t.go deleted file mode 100644 index 40b900f..0000000 --- a/media/off_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -type Off_t = capi.Off_t diff --git a/media/output_format.go b/media/output_format.go deleted file mode 100644 index 807973f..0000000 --- a/media/output_format.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type OutputFormat int32 - -const ( - AMEDIAMUXER_OUTPUT_FORMAT_MPEG_4 OutputFormat = 0 - AMEDIAMUXER_OUTPUT_FORMAT_WEBM OutputFormat = 1 - AMEDIAMUXER_OUTPUT_FORMAT_THREE_GPP OutputFormat = 2 - AMEDIAMUXER_OUTPUT_FORMAT_HEIF OutputFormat = 3 - AMEDIAMUXER_OUTPUT_FORMAT_OGG OutputFormat = 4 -) diff --git a/media/package.go b/media/package.go deleted file mode 100644 index 5b6716a..0000000 --- a/media/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package media provides Go bindings for Android Media NDK. -package media diff --git a/media/pssh_entry.go b/media/pssh_entry.go deleted file mode 100644 index 8413482..0000000 --- a/media/pssh_entry.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// PsshEntry wraps the NDK PsshEntry handle. -type PsshEntry struct { - ptr *capi.PsshEntry -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *PsshEntry) cptr() *capi.PsshEntry { - if h == nil { - return nil - } - return h.ptr -} - -// NewPsshEntryFromPointer wraps a raw PsshEntry pointer. -func NewPsshEntryFromPointer(ptr unsafe.Pointer) *PsshEntry { - return &PsshEntry{ptr: (*capi.PsshEntry)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *PsshEntry) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *PsshEntry) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewPsshEntryFromUintPtr wraps a uintptr as a PsshEntry. -// The caller must ensure ptr points to a valid PsshEntry. -func NewPsshEntryFromUintPtr(ptr uintptr) *PsshEntry { - return &PsshEntry{ptr: (*capi.PsshEntry)(unsafe.Pointer(ptr))} -} diff --git a/media/pssh_info.go b/media/pssh_info.go deleted file mode 100644 index d6b8556..0000000 --- a/media/pssh_info.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// PsshInfo wraps the NDK PsshInfo handle. -type PsshInfo struct { - ptr *capi.PsshInfo -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *PsshInfo) cptr() *capi.PsshInfo { - if h == nil { - return nil - } - return h.ptr -} - -// NewPsshInfoFromPointer wraps a raw PsshInfo pointer. -func NewPsshInfoFromPointer(ptr unsafe.Pointer) *PsshInfo { - return &PsshInfo{ptr: (*capi.PsshInfo)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *PsshInfo) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *PsshInfo) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewPsshInfoFromUintPtr wraps a uintptr as a PsshInfo. -// The caller must ensure ptr points to a valid PsshInfo. -func NewPsshInfoFromUintPtr(ptr uintptr) *PsshInfo { - return &PsshInfo{ptr: (*capi.PsshInfo)(unsafe.Pointer(ptr))} -} diff --git a/media/seek_mode.go b/media/seek_mode.go deleted file mode 100644 index adfb408..0000000 --- a/media/seek_mode.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -type SeekMode int32 - -const ( - AMEDIAEXTRACTOR_SEEK_PREVIOUS_SYNC SeekMode = 0 - AMEDIAEXTRACTOR_SEEK_NEXT_SYNC SeekMode = 1 - AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC SeekMode = 2 -) diff --git a/media/window.go b/media/window.go deleted file mode 100644 index ee639d1..0000000 --- a/media/window.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package media - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/media" -) - -// Window wraps the NDK ANativeWindow handle. -type Window struct { - ptr *capi.ANativeWindow -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Window) cptr() *capi.ANativeWindow { - if h == nil { - return nil - } - return h.ptr -} - -// NewWindowFromPointer wraps a raw ANativeWindow pointer. -func NewWindowFromPointer(ptr unsafe.Pointer) *Window { - return &Window{ptr: (*capi.ANativeWindow)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Window) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Window) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewWindowFromUintPtr wraps a uintptr as a Window. -// The caller must ensure ptr points to a valid ANativeWindow. -func NewWindowFromUintPtr(ptr uintptr) *Window { - return &Window{ptr: (*capi.ANativeWindow)(unsafe.Pointer(ptr))} -} diff --git a/midi/device.go b/midi/device.go deleted file mode 100644 index 4c3acae..0000000 --- a/midi/device.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/midi" -) - -// Device wraps the NDK AMidiDevice handle. -type Device struct { - ptr *capi.AMidiDevice -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Device) cptr() *capi.AMidiDevice { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Device) Close() error { - if h.ptr == nil { - return nil - } - capi.AMidiDevice_release(h.ptr) - h.ptr = nil - return nil -} - -// NewDeviceFromPointer wraps a raw AMidiDevice pointer. -func NewDeviceFromPointer(ptr unsafe.Pointer) *Device { - return &Device{ptr: (*capi.AMidiDevice)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Device) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Device) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewDeviceFromUintPtr wraps a uintptr as a Device. -// The caller must ensure ptr points to a valid AMidiDevice. -func NewDeviceFromUintPtr(ptr uintptr) *Device { - return &Device{ptr: (*capi.AMidiDevice)(unsafe.Pointer(ptr))} -} - -// NumInputPorts returns the value directly. -func (h *Device) NumInputPorts() int64 { - return (int64)(capi.AMidiDevice_getNumInputPorts(h.ptr)) -} - -// NumOutputPorts returns the value directly. -func (h *Device) NumOutputPorts() int64 { - return (int64)(capi.AMidiDevice_getNumOutputPorts(h.ptr)) -} - -// GetType calls the underlying NDK function. -func (h *Device) GetType() error { - return result(capi.AMidiDevice_getType(h.ptr)) -} - -// OpenInputPort creates a new InputPort from this Device. -func (h *Device) OpenInputPort(portNumber int32) (*InputPort, error) { - var ptr *capi.AMidiInputPort - if err := result(capi.AMidiInputPort_open(h.ptr, portNumber, &ptr)); err != nil { - return nil, err - } - return &InputPort{ptr: ptr}, nil -} - -// OpenOutputPort creates a new OutputPort from this Device. -func (h *Device) OpenOutputPort(portNumber int32) (*OutputPort, error) { - var ptr *capi.AMidiOutputPort - if err := result(capi.AMidiOutputPort_open(h.ptr, portNumber, &ptr)); err != nil { - return nil, err - } - return &OutputPort{ptr: ptr}, nil -} diff --git a/midi/errors.go b/midi/errors.go deleted file mode 100644 index 0e476d2..0000000 --- a/midi/errors.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -const ( - ErrUnknown Error = -1 - ErrWouldBlock Error = -2 -) - -func (e Error) Error() string { - return fmt.Sprintf("midi: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/midi/functions.go b/midi/functions.go deleted file mode 100644 index 392fdf2..0000000 --- a/midi/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi diff --git a/midi/input_port.go b/midi/input_port.go deleted file mode 100644 index ec3f997..0000000 --- a/midi/input_port.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/midi" -) - -// InputPort wraps the NDK AMidiInputPort handle. -type InputPort struct { - ptr *capi.AMidiInputPort -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *InputPort) cptr() *capi.AMidiInputPort { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *InputPort) Close() error { - if h.ptr == nil { - return nil - } - capi.AMidiInputPort_close(h.ptr) - h.ptr = nil - return nil -} - -// NewInputPortFromPointer wraps a raw AMidiInputPort pointer. -func NewInputPortFromPointer(ptr unsafe.Pointer) *InputPort { - return &InputPort{ptr: (*capi.AMidiInputPort)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *InputPort) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *InputPort) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewInputPortFromUintPtr wraps a uintptr as a InputPort. -// The caller must ensure ptr points to a valid AMidiInputPort. -func NewInputPortFromUintPtr(ptr uintptr) *InputPort { - return &InputPort{ptr: (*capi.AMidiInputPort)(unsafe.Pointer(ptr))} -} - -// Send calls the underlying NDK function. -func (h *InputPort) Send(buffer *uint8, numBytes uint64) error { - return result(capi.AMidiInputPort_send(h.ptr, buffer, numBytes)) -} - -// SendWithTimestamp returns the value directly. -func (h *InputPort) SendWithTimestamp(buffer *uint8, numBytes uint64, timestamp int64) int64 { - return (int64)(capi.AMidiInputPort_sendWithTimestamp(h.ptr, buffer, numBytes, timestamp)) -} diff --git a/midi/media_status_t.go b/midi/media_status_t.go deleted file mode 100644 index 369a9ef..0000000 --- a/midi/media_status_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi - -import ( - capi "github.com/AndroidGoLab/ndk/capi/midi" -) - -type Media_status_t = capi.Media_status_t diff --git a/midi/midi_device_protocol.go b/midi/midi_device_protocol.go deleted file mode 100644 index 8cc99e3..0000000 --- a/midi/midi_device_protocol.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi - -type MidiDevice_Protocol int32 - -const ( - AMIDI_DEVICE_PROTOCOL_UMP_USE_MIDI_CI MidiDevice_Protocol = 0 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS MidiDevice_Protocol = 1 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS MidiDevice_Protocol = 2 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS MidiDevice_Protocol = 3 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS MidiDevice_Protocol = 4 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0 MidiDevice_Protocol = 17 - AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0_AND_JRTS MidiDevice_Protocol = 18 - AMIDI_DEVICE_PROTOCOL_UNKNOWN MidiDevice_Protocol = -1 -) diff --git a/midi/midi_device_type.go b/midi/midi_device_type.go deleted file mode 100644 index 371959c..0000000 --- a/midi/midi_device_type.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi - -type MIDI_DEVICE_TYPE int32 - -const ( - AMIDI_DEVICE_TYPE_USB MIDI_DEVICE_TYPE = 1 - AMIDI_DEVICE_TYPE_VIRTUAL MIDI_DEVICE_TYPE = 2 - AMIDI_DEVICE_TYPE_BLUETOOTH MIDI_DEVICE_TYPE = 3 -) diff --git a/midi/midi_opcode.go b/midi/midi_opcode.go deleted file mode 100644 index 502f421..0000000 --- a/midi/midi_opcode.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi - -type MIDI_OPCODE int32 - -const ( - AMIDI_OPCODE_DATA MIDI_OPCODE = 1 - AMIDI_OPCODE_FLUSH MIDI_OPCODE = 2 -) diff --git a/midi/output_port.go b/midi/output_port.go deleted file mode 100644 index 1bbf015..0000000 --- a/midi/output_port.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package midi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/midi" -) - -// OutputPort wraps the NDK AMidiOutputPort handle. -type OutputPort struct { - ptr *capi.AMidiOutputPort -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *OutputPort) cptr() *capi.AMidiOutputPort { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *OutputPort) Close() error { - if h.ptr == nil { - return nil - } - capi.AMidiOutputPort_close(h.ptr) - h.ptr = nil - return nil -} - -// NewOutputPortFromPointer wraps a raw AMidiOutputPort pointer. -func NewOutputPortFromPointer(ptr unsafe.Pointer) *OutputPort { - return &OutputPort{ptr: (*capi.AMidiOutputPort)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *OutputPort) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *OutputPort) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewOutputPortFromUintPtr wraps a uintptr as a OutputPort. -// The caller must ensure ptr points to a valid AMidiOutputPort. -func NewOutputPortFromUintPtr(ptr uintptr) *OutputPort { - return &OutputPort{ptr: (*capi.AMidiOutputPort)(unsafe.Pointer(ptr))} -} - -// Receive returns the value directly. -func (h *OutputPort) Receive(opcodePtr *int32, buffer *uint8, maxBytes uint64, numBytesReceivedPtr *uint64, outTimestampPtr *int64) int64 { - return (int64)(capi.AMidiOutputPort_receive(h.ptr, opcodePtr, buffer, maxBytes, numBytesReceivedPtr, outTimestampPtr)) -} diff --git a/midi/package.go b/midi/package.go deleted file mode 100644 index 219edcc..0000000 --- a/midi/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package midi provides Go bindings for Android MIDI. -package midi diff --git a/ndk/activity.go b/ndk/activity.go new file mode 100644 index 0000000..1111d6b --- /dev/null +++ b/ndk/activity.go @@ -0,0 +1,115 @@ +package ndk + +/* +#include +*/ +import "C" + +import "unsafe" + +type Activity C.ANativeActivity + +func (a *Activity) cptr() *C.ANativeActivity { + return (*C.ANativeActivity)(a) +} + +func (a *Activity) AssetManager() *AssetManager { + return (*AssetManager)(a.cptr().assetManager) +} + +func (a *Activity) Configuration() *Configuration { + return fromAssetManager(a.AssetManager()) +} + +func (a *Activity) Instance() unsafe.Pointer { + return a.cptr().instance +} + +func (a *Activity) JActivity() uintptr { + return uintptr(a.cptr().clazz) +} + +func (a *Activity) InternalDataPath() string { + return C.GoString(a.cptr().internalDataPath) +} + +func (a *Activity) ExternalDataPath() string { + return C.GoString(a.cptr().externalDataPath) +} + +func (a *Activity) SdkVersion() int { + return int(a.cptr().sdkVersion) +} + +func (a *Activity) ObbPath() string { + return C.GoString(a.cptr().obbPath) +} + +/** + * Finish the given activity. Its finish() method will be called, causing it + * to be stopped and destroyed. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ +func (a *Activity) Finish() { + C.ANativeActivity_finish(a.cptr()) +} + +/** + * Change the window format of the given activity. Calls getWindow().setFormat() + * of the given activity. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ +func (a *Activity) SetWindowFormat(format int) { + C.ANativeActivity_setWindowFormat(a.cptr(), C.int32_t(format)) +} + +/** + * Change the window flags of the given activity. Calls getWindow().setFlags() + * of the given activity. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. See window.h for flag constants. + */ +func (a *Activity) SetWindowFlags(addFlags, removeFlags int) { + C.ANativeActivity_setWindowFlags(a.cptr(), + C.uint32_t(addFlags), C.uint32_t(removeFlags)) +} + +/** + * Flags for ANativeActivity_showSoftInput; see the Java InputMethodManager + * API for documentation. + */ +const ( + ACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = C.ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT + ACTIVITY_SHOW_SOFT_INPUT_FORCED = C.ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED +) + +/** + * Show the IME while in the given activity. Calls InputMethodManager.showSoftInput() + * for the given activity. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ +func (a *Activity) ShowSoftInput(flags int) { + C.ANativeActivity_showSoftInput(a.cptr(), C.uint32_t(flags)) +} + +/** + * Flags for ANativeActivity_hideSoftInput; see the Java InputMethodManager + * API for documentation. + */ +const ( + ACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = C.ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY + ACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = C.ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS +) + +/** + * Hide the IME while in the given activity. Calls InputMethodManager.hideSoftInput() + * for the given activity. Note that this method can be called from + * *any* thread; it will send a message to the main thread of the process + * where the Java finish call will take place. + */ +func (a *Activity) HideSoftInput(flags int) { + C.ANativeActivity_hideSoftInput(a.cptr(), C.uint32_t(flags)) +} diff --git a/ndk/android.go b/ndk/android.go new file mode 100644 index 0000000..5d5ee16 --- /dev/null +++ b/ndk/android.go @@ -0,0 +1,435 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Go runtime entry point for apps running on android. +// Sets up everything the runtime needs and exposes +// the entry point to JNI. + +package ndk + +/* +#cgo LDFLAGS: -llog -landroid + +#include +#include +#include +#include +#include +#include + +extern int cgoLooperCallback(int p0, int p1, void* p2); +extern void* onCreate_gondk(ANativeActivity* p0, void* p1, size_t p2); +extern void onStart_gondk(ANativeActivity* p0); +extern void onResume_gondk(ANativeActivity* p0); +extern void onPause_gondk(ANativeActivity* p0); +extern void onStop_gondk(ANativeActivity* p0); +extern void onDestroy_gondk(ANativeActivity* p0); +extern void onWindowFocusChanged_gondk(ANativeActivity* p0, int p1); +extern void* onSaveInstanceState_gondk(ANativeActivity* p0, size_t* p1); +extern void onNativeWindowCreated_gondk(ANativeActivity* p0, ANativeWindow* p1); +extern void onNativeWindowResized_gondk(ANativeActivity* p0, ANativeWindow* p1); +extern void onNativeWindowRedrawNeeded_gondk(ANativeActivity* p0, ANativeWindow* p1); +extern void onNativeWindowDestroyed_gondk(ANativeActivity* p0, ANativeWindow* p1); +extern void onInputQueueCreated_gondk(ANativeActivity* p0, AInputQueue* p1); +extern void onInputQueueDestroyed_gondk(ANativeActivity* p0, AInputQueue* p1); +extern void onContentRectChanged_gondk(ANativeActivity* p0, ARect* p1); +extern void onConfigurationChanged_gondk(ANativeActivity* p0); +extern void onLowMemory_gondk(ANativeActivity* p0); + +static const char* callGetStringMethod(JNIEnv *env, jclass jobj, const char* method) { + jstring jpath; + jclass _class = (*env)->GetObjectClass(env, jobj); + jmethodID m = (*env)->GetMethodID(env, _class, method, "()Ljava/lang/String;"); + if (m == 0) { + (*env)->ExceptionClear(env); + return NULL; + } + jpath = (jstring)(*env)->CallObjectMethod(env, jobj, m, NULL); + return (*env)->GetStringUTFChars(env, jpath, NULL); +} + +static const char* _GetPackageName(JNIEnv *env, jobject jobj) { + return callGetStringMethod(env, jobj, "getPackageName"); +} + +static const char* _GetLocalClassName(JNIEnv *env, jobject jobj) { + return callGetStringMethod(env, jobj, "getLocalClassName"); +} + +static void* _GetMainPC() { return dlsym(RTLD_DEFAULT, "main.main"); } + +static void* _SetActivityCallbacks(ANativeActivity* activity) { + activity->callbacks->onStart = onStart_gondk; + activity->callbacks->onResume = onResume_gondk; + activity->callbacks->onSaveInstanceState = onSaveInstanceState_gondk; + activity->callbacks->onPause = onPause_gondk; + activity->callbacks->onStop = onStop_gondk; + activity->callbacks->onDestroy = onDestroy_gondk; + activity->callbacks->onWindowFocusChanged = onWindowFocusChanged_gondk; + activity->callbacks->onNativeWindowCreated = onNativeWindowCreated_gondk; + activity->callbacks->onNativeWindowResized = onNativeWindowResized_gondk; + activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded_gondk; + activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed_gondk; + activity->callbacks->onInputQueueCreated = onInputQueueCreated_gondk; + activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed_gondk; + activity->callbacks->onContentRectChanged = (void*)onContentRectChanged_gondk; + activity->callbacks->onConfigurationChanged = onConfigurationChanged_gondk; + activity->callbacks->onLowMemory = onLowMemory_gondk; + return (void*)activity; +} + +*/ +import "C" + +import ( + "os" + "runtime" + "time" + "unsafe" + + "github.com/xaionaro-go/ndk/callfn" +) + +var appContext struct { + mainPC unsafe.Pointer + funcChan chan func() + actMaps map[string]*Activity + actMainCB func(*Context) +} + +//export onStart_gondk +func onStart_gondk(act *Activity) { + ctx := act.Context() + Info("onStart:", act) + ctx.Reset() + if ctx.Start != nil { + ctx.RunFunc(func() { + ctx.Start(ctx.Act) + }, true) + } +} + +//export onResume_gondk +func onResume_gondk(act *Activity) { + ctx := act.Context() + Info("onResume:", act) + if ctx.Resume != nil { + ctx.RunFunc(func() { + ctx.Resume(ctx.Act) + }, true) + } + ctx.IsResume = true +} + +//export onPause_gondk +func onPause_gondk(act *Activity) { + ctx := act.Context() + Info("onPause:", act) + ctx.IsResume = false + ctx.RunFunc(func() { + if ctx.Pause != nil { + ctx.Pause(ctx.Act) + } + }, true) +} + +//export onStop_gondk +func onStop_gondk(act *Activity) { + ctx := act.Context() + Info("onStop:", act) + ctx.IsResume = false + ctx.RunFunc(func() { + if ctx.Stop != nil { + ctx.Stop(ctx.Act) + } + }, true) +} + +//export onDestroy_gondk +func onDestroy_gondk(act *Activity) { + ctx := act.Context() + Info("onDestroy:", act) + ctx.RunFunc(func() { + ctx.WillDestoryValue = true + if ctx.Input != nil { + ctx.Input.DetachLooper() + ctx.Input = nil + } + if ctx.Destroy != nil { + ctx.Destroy(ctx.Act) + } + ctx.Release() + }, true) + + ctx.FuncChan <- func() { + Info("onDestroy:", act, "complete") + } + ClrActivity(act, ctx.ClassName) +} + +//export onWindowFocusChanged_gondk +func onWindowFocusChanged_gondk(act *Activity, hasFocus C.int) { + ctx := act.Context() + Info("onWindowFocusChanged:", act, hasFocus) + focus := hasFocus != 0 + ctx.IsFocus = focus + ctx.RunFunc(func() { + if ctx.FocusChanged != nil { + ctx.FocusChanged(ctx.Act, focus) + } + }, true) +} + +//export onSaveInstanceState_gondk +func onSaveInstanceState_gondk(act *Activity, outSize *C.size_t) unsafe.Pointer { + ctx := act.Context() + Info("onSaveInstanceState:", act) + if ctx.SaveState != nil { + ctx.RunFunc(func() { + ctx.SavedState = ctx.SaveState(ctx.Act) + }, true) + + if len(ctx.SavedState) > 0 { + size := len(ctx.SavedState) + Info("\t\tsize =", size) + *outSize = C.size_t(size) + ptr := C.malloc(C.size_t(size)) + copy((*[1 << 30]byte)(unsafe.Pointer(ptr))[:size], ctx.SavedState) + return ptr + } + } + return nil +} + +//export onNativeWindowCreated_gondk +func onNativeWindowCreated_gondk(act *Activity, window *Window) { + ctx := act.Context() + Info("onNativeWindowCreated:", act, window) + ctx.Window = window + if ctx.WindowCreated != nil { + ctx.RunFunc(func() { + ctx.WindowCreated(act, window) + }, true) + } +} + +//export onNativeWindowResized_gondk +func onNativeWindowResized_gondk(act *Activity, window *Window) { + ctx := act.Context() + Info("onNativeWindowResized:", act, window) + if ctx.WindowResized != nil { + ctx.RunFunc(func() { + ctx.WindowResized(act, window) + }, true) + } +} + +//export onNativeWindowRedrawNeeded_gondk +func onNativeWindowRedrawNeeded_gondk(act *Activity, window *Window) { + ctx := act.Context() + Info("onNativeWindowRedrawNeeded:", act, window) + Assert(ctx.Window == window) + if ctx.Window != window { + ctx.Window = window + } + + if ctx.WindowRedrawNeeded != nil { + ctx.RunFunc(func() { + ctx.WindowRedrawNeeded(act, window) + }, true) + } +} + +//export onNativeWindowDestroyed_gondk +func onNativeWindowDestroyed_gondk(act *Activity, window *Window) { + ctx := act.Context() + Info("onNativeWindowDestroyed:", act, window) + ctx.RunFunc(func() { + //Info("onNativeWindowDestroyed.func") + if ctx.WindowDestroyed != nil { + ctx.WindowDestroyed(act, window) + } + ctx.Window = nil + }, true) +} + +//export onInputQueueCreated_gondk +func onInputQueueCreated_gondk(act *Activity, queue *InputQueue) { + ctx := act.Context() + Info("onInputQueueCreated:", act, queue) + ctx.RunFunc(func() { + ctx.Input = (*InputQueue)(queue) + ctx.Input.AttachLooper(ctx.Looper, Looper_ID_INPUT, nil, unsafe.Pointer(uintptr(Looper_ID_INPUT))) + }, true) +} + +//export onInputQueueDestroyed_gondk +func onInputQueueDestroyed_gondk(act *Activity, queue *InputQueue) { + ctx := act.Context() + Info("onInputQueueDestroyed:", act, queue) + ctx.RunFunc(func() { + ctx.Input.DetachLooper() + ctx.Input = nil + }, true) +} + +//export onContentRectChanged_gondk +func onContentRectChanged_gondk(act *Activity, rect *Rect) { + ctx := act.Context() + Info("onContentRectChanged:", act, rect) + if ctx.ContentRectChanged != nil { + ctx.RunFunc(func() { + ctx.ContentRectChanged(act, rect) + }, true) + } +} + +//export onConfigurationChanged_gondk +func onConfigurationChanged_gondk(act *Activity) { + ctx := act.Context() + Info("onConfigurationChanged:", act) + if ctx.ConfigurationChanged != nil { + ctx.RunFunc(func() { + ctx.ConfigurationChanged(act) + }, true) + } +} + +//export onLowMemory_gondk +func onLowMemory_gondk(act *Activity) { + ctx := act.Context() + Info("onLowMemory:", act) + if ctx.LowMemory != nil { + ctx.RunFunc(func() { + ctx.LowMemory(act) + }, true) + } +} + +func SetMainCB(fn func(*Context)) { + if fn == nil { + Fatal("SetMainCB(nil) is incorrect") + } + if appContext.actMainCB != nil { + Info("MainCB is ready") + return + } + appContext.funcChan <- func() { appContext.actMainCB = fn } + appContext.funcChan <- func() {} +} + +// Loop +// applation will close, return false +func Loop() bool { + if fn, ok := <-appContext.funcChan; ok { + fn() + return true + } + return false +} + +func addActivity(act *Activity, n string) { + appContext.actMaps[n] = act +} + +func ClrActivity(act *Activity, n string) { + delete(appContext.actMaps, n) + if len(appContext.actMaps) == 0 { + close(appContext.funcChan) + } +} + +func callMain() { + if appContext.mainPC != nil { + Info("main is running") + return + } + + var waitMainCB func() + appContext.actMaps = make(map[string]*Activity) + appContext.funcChan, waitMainCB = make(chan func(), 1), func() { (<-appContext.funcChan)() } + appContext.mainPC = C._GetMainPC() + if appContext.mainPC == nil { + Fatal("missing main.main") + } + + for _, name := range []string{"TMPDIR", "PATH", "LD_LIBRARY_PATH", "BOOTCLASSPATH"} { + n := C.CString(name) + os.Setenv(name, C.GoString(C.getenv(n))) + C.free(unsafe.Pointer(n)) + } + + // Set timezone. + // + // Note that Android zoneinfo is stored in /system/usr/share/zoneinfo, + // but it is in some kind of packed TZiff file that we do not support + // yet. As a stopgap, we build a fixed zone using the tm_zone name. + var curtime C.time_t + var curtm C.struct_tm + C.time(&curtime) + C.localtime_r(&curtime, &curtm) + tzOffset := int(curtm.tm_gmtoff) + tz := C.GoString(curtm.tm_zone) + time.Local = time.FixedZone(tz, tzOffset) + + go func() { + runtime.LockOSThread() + callfn.CallFn(uintptr(appContext.mainPC)) + os.Exit(0) + }() + + // This will hang until SetMainCB is completed + waitMainCB() +} + +func CreateActivity(act *Activity, savedState unsafe.Pointer, savedStateSize C.size_t) { + lname := C.GoString(C._GetLocalClassName(act.env, act.clazz)) + pname := C.GoString(C._GetPackageName(act.env, act.clazz)) + Info("ANativeActivity_onCreate:", pname+"/"+lname) + + callMain() + + C._SetActivityCallbacks(act.cptr()) + + buf := []byte{} + if savedStateSize > 0 { + buf = (*[1 << 30]byte)(unsafe.Pointer(savedState))[:savedStateSize] + } + + ctx := &Context{} + act.instance = unsafe.Pointer(ctx) + ctx.init() + + ctx.ClassName = lname + ctx.packageName = pname + addActivity(act, ctx.ClassName) + appContext.funcChan <- func() { + go func() { + runtime.LockOSThread() + appContext.actMainCB(ctx) + }() + } + + // Wait for the message queue initialization (ctx.begin) to complete + ctx.doFunc() + OnCreate(act, buf) +} + +func OnCreate(act *Activity, buf []byte) { + ctx := act.Context() + ctx.RunFunc(func() {}, true) + Info("onCreate:", act, len(buf)) + + ctx.Act = (*Activity)(act) + if len(buf) > 0 { + ctx.SavedState = make([]byte, len(buf)) + copy(ctx.SavedState, buf) + } + + if ctx.Create != nil { + ctx.RunFunc(func() { + ctx.Create(act, ctx.SavedState) + }, true) + } +} diff --git a/ndk/asset_manager.go b/ndk/asset_manager.go new file mode 100644 index 0000000..b68a734 --- /dev/null +++ b/ndk/asset_manager.go @@ -0,0 +1,233 @@ +package ndk + +/* +#include +#include +#if __ANDROID_API__ < 13 +static off64_t AAsset_seek64(AAsset* asset, off64_t offset, int whence) { + return AAsset_seek(asset, offset, whence); +} +static off64_t AAsset_getLength64(AAsset* asset) { + return AAsset_getLength(asset); +} +static off64_t AAsset_getRemainingLength64(AAsset* asset) { + return AAsset_getRemainingLength(asset); +} +#endif +*/ +import "C" + +import ( + "fmt" + "io" + "unsafe" +) + +type AssetManager C.AAssetManager + +func (mgr *AssetManager) cptr() *C.AAssetManager { + return (*C.AAssetManager)(mgr) +} + +type AssetDir C.AAssetDir + +func (assetDir *AssetDir) cptr() *C.AAssetDir { + return (*C.AAssetDir)(assetDir) +} + +type Asset C.AAsset + +func (asset *Asset) cptr() *C.AAsset { + return (*C.AAsset)(asset) +} + +/* Available modes for opening assets */ +const ( + ASSET_MODE_UNKNOWN = C.AASSET_MODE_UNKNOWN + ASSET_MODE_RANDOM = C.AASSET_MODE_RANDOM + ASSET_MODE_STREAMING = C.AASSET_MODE_STREAMING + ASSET_MODE_BUFFER = C.AASSET_MODE_BUFFER +) + +/** + * Open the named directory within the asset hierarchy. The directory can then + * be inspected with the AAssetDir functions. To open the top-level directory, + * pass in "" as the dirName. + * + * The object returned here should be freed by calling AAssetDir_close(). + */ +//AAssetDir* AAssetManager_openDir(AAssetManager* mgr, const char* dirName); +func (mgr *AssetManager) OpenDir(dirName string) *AssetDir { + cdirName := C.CString(dirName) + defer C.free(unsafe.Pointer(cdirName)) + return (*AssetDir)(C.AAssetManager_openDir(mgr.cptr(), cdirName)) +} + +/** + * Open an asset. + * + * The object returned here should be freed by calling AAsset_close(). + */ +//AAsset* AAssetManager_open(AAssetManager* mgr, const char* filename, int mode); +func (mgr *AssetManager) Open(filename string, mode int) *Asset { + cfilename := C.CString(filename) + defer C.free(unsafe.Pointer(cfilename)) + return (*Asset)(C.AAssetManager_open(mgr.cptr(), cfilename, C.int(mode))) +} + +/** + * Iterate over the files in an asset directory. A NULL string is returned + * when all the file names have been returned. + * + * The returned file name is suitable for passing to AAssetManager_open(). + * + * The string returned here is owned by the AssetDir implementation and is not + * guaranteed to remain valid if any other calls are made on this AAssetDir + * instance. + */ +//const char* AAssetDir_getNextFileName(AAssetDir* assetDir); +func (assetDir *AssetDir) GetNextFileName() string { + return C.GoString(C.AAssetDir_getNextFileName(assetDir.cptr())) +} + +/** + * Reset the iteration state of AAssetDir_getNextFileName() to the beginning. + */ +//void AAssetDir_rewind(AAssetDir* assetDir); +func (assetDir *AssetDir) Rewind() { + C.AAssetDir_rewind(assetDir.cptr()) +} + +/** + * Close an opened AAssetDir, freeing any related resources. + */ +//void AAssetDir_close(AAssetDir* assetDir); +func (assetDir *AssetDir) Close() { + C.AAssetDir_close(assetDir.cptr()) +} + +/** + * Attempt to read 'count' bytes of data from the current offset. + * + * Returns the number of bytes read, zero on EOF, or < 0 on error. + */ +//int AAsset_read(AAsset* asset, void* buf, size_t count); +func (asset *Asset) Read(buf []byte) (int, error) { + ret := int(C.AAsset_read(asset.cptr(), unsafe.Pointer(&buf[0]), C.size_t(len(buf)))) + if ret == 0 { + return ret, io.EOF + } else if ret < 0 { + return 0, fmt.Errorf("ASSET: Error code (%d)", ret) + } + return ret, nil +} + +/** + * Seek to the specified offset within the asset data. 'whence' uses the + * same constants as lseek()/fseek(). + * + * Returns the new position on success, or (off_t) -1 on error. + */ +//off_t AAsset_seek(AAsset* asset, off_t offset, int whence); + +/** + * Seek to the specified offset within the asset data. 'whence' uses the + * same constants as lseek()/fseek(). + * + * Uses 64-bit data type for large files as opposed to the 32-bit type used + * by AAsset_seek. + * + * Returns the new position on success, or (off64_t) -1 on error. + */ +//off64_t AAsset_seek64(AAsset* asset, off64_t offset, int whence); +func (asset *Asset) Seek(offset int64, whence int) (int64, error) { + ret := int64(C.AAsset_seek64(asset.cptr(), C.off64_t(offset), C.int(whence))) + if ret < 0 { + return 0, fmt.Errorf("ASSET: Seek fail.") + } + return ret, nil +} + +/** + * Close the asset, freeing all associated resources. + */ +//void AAsset_close(AAsset* asset); +func (asset *Asset) Close() error { + C.AAsset_close(asset.cptr()) + return nil +} + +/** + * Get a pointer to a buffer holding the entire contents of the asset. + * + * Returns NULL on failure. + */ +//const void* AAsset_getBuffer(AAsset* asset); +func (asset *Asset) GetBuffer() []byte { + cptr := C.AAsset_getBuffer(asset.cptr()) + if cptr == nil { + return nil + } + size := asset.Length() + return (*[1 << 26]byte)(unsafe.Pointer(cptr))[:size] +} + +/** + * Report the total size of the asset data. + */ +//off_t AAsset_getLength(AAsset* asset); + +/** + * Report the total size of the asset data. Reports the size using a 64-bit + * number instead of 32-bit as AAsset_getLength. + */ +//off64_t AAsset_getLength64(AAsset* asset); +func (asset *Asset) Length() int64 { + return int64(C.AAsset_getLength64(asset.cptr())) +} + +/** + * Report the total amount of asset data that can be read from the current position. + */ +//off_t AAsset_getRemainingLength(AAsset* asset); + +/** + * Report the total amount of asset data that can be read from the current position. + * + * Uses a 64-bit number instead of a 32-bit number as AAsset_getRemainingLength does. + */ +//off64_t AAsset_getRemainingLength64(AAsset* asset); +func (asset *Asset) GetRemainingLength() int64 { + return int64(C.AAsset_getRemainingLength64(asset.cptr())) +} + +/** + * Open a new file descriptor that can be used to read the asset data. If the + * start or length cannot be represented by a 32-bit number, it will be + * truncated. If the file is large, use AAsset_openFileDescriptor64 instead. + * + * Returns < 0 if direct fd access is not possible (for example, if the asset is + * compressed). + */ +//int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength); + +/** + * Open a new file descriptor that can be used to read the asset data. + * + * Uses a 64-bit number for the offset and length instead of 32-bit instead of + * as AAsset_openFileDescriptor does. + * + * Returns < 0 if direct fd access is not possible (for example, if the asset is + * compressed). + */ +//int AAsset_openFileDescriptor64(AAsset* asset, off64_t* outStart, off64_t* outLength); +//func (asset *Asset) OpenFileDescriptor() int {} + +/** + * Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not + * mmapped). + */ +//int AAsset_isAllocated(AAsset* asset); +func (asset *Asset) IsAllocated() bool { + return 0 != C.AAsset_isAllocated(asset.cptr()) +} diff --git a/ndk/configuration.go b/ndk/configuration.go new file mode 100644 index 0000000..5cd170b --- /dev/null +++ b/ndk/configuration.go @@ -0,0 +1,546 @@ +// android app + +//go:build android +// +build android + +package ndk + +import ( + "unsafe" +) + +/* +#include +#if __ANDROID_API__ < 13 +#define ACONFIGURATION_DENSITY_TV 0 +#define ACONFIGURATION_DENSITY_XHIGH 0 +#define ACONFIGURATION_DENSITY_XXHIGH 0 +#define ACONFIGURATION_DENSITY_XXXHIGH 0 +#define ACONFIGURATION_LAYOUTDIR 0 +#define ACONFIGURATION_LAYOUTDIR_ANY 0 +#define ACONFIGURATION_LAYOUTDIR_LTR 0 +#define ACONFIGURATION_LAYOUTDIR_RTL 0 +#define ACONFIGURATION_SCREEN_HEIGHT_DP_ANY 0 +#define ACONFIGURATION_SCREEN_WIDTH_DP_ANY 0 +#define ACONFIGURATION_SMALLEST_SCREEN_SIZE 0 +#define ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY 0 +#define ACONFIGURATION_UI_MODE_TYPE_APPLIANCE 0 +#define ACONFIGURATION_UI_MODE_TYPE_TELEVISION 0 +static int AConfiguration_getLayoutDirection (AConfiguration* obj) { return 0; } +static int AConfiguration_getScreenHeightDp (AConfiguration* obj) { return 0; } +static int AConfiguration_getScreenWidthDp (AConfiguration* obj) { return 0; } +static int AConfiguration_getSmallestScreenWidthDp (AConfiguration* obj) { return 0; } +static int AConfiguration_setLayoutDirection (AConfiguration* obj, int32_t v) { return 0; } +static int AConfiguration_setScreenHeightDp (AConfiguration* obj, int32_t v) { return 0; } +static int AConfiguration_setScreenWidthDp (AConfiguration* obj, int32_t v) { return 0; } +static int AConfiguration_setSmallestScreenWidthDp (AConfiguration* obj, int32_t v) { return 0; } + +#endif +*/ +import "C" + +const ( + CONFIGURATION_ORIENTATION_ANY = C.ACONFIGURATION_ORIENTATION_ANY + CONFIGURATION_ORIENTATION_PORT = C.ACONFIGURATION_ORIENTATION_PORT + CONFIGURATION_ORIENTATION_LAND = C.ACONFIGURATION_ORIENTATION_LAND + CONFIGURATION_ORIENTATION_SQUARE = C.ACONFIGURATION_ORIENTATION_SQUARE + + CONFIGURATION_TOUCHSCREEN_ANY = C.ACONFIGURATION_TOUCHSCREEN_ANY + CONFIGURATION_TOUCHSCREEN_NOTOUCH = C.ACONFIGURATION_TOUCHSCREEN_NOTOUCH + CONFIGURATION_TOUCHSCREEN_STYLUS = C.ACONFIGURATION_TOUCHSCREEN_STYLUS + CONFIGURATION_TOUCHSCREEN_FINGER = C.ACONFIGURATION_TOUCHSCREEN_FINGER + + CONFIGURATION_DENSITY_DEFAULT = C.ACONFIGURATION_DENSITY_DEFAULT + CONFIGURATION_DENSITY_LOW = C.ACONFIGURATION_DENSITY_LOW + CONFIGURATION_DENSITY_MEDIUM = C.ACONFIGURATION_DENSITY_MEDIUM + CONFIGURATION_DENSITY_TV = C.ACONFIGURATION_DENSITY_TV + CONFIGURATION_DENSITY_HIGH = C.ACONFIGURATION_DENSITY_HIGH + CONFIGURATION_DENSITY_XHIGH = C.ACONFIGURATION_DENSITY_XHIGH + CONFIGURATION_DENSITY_XXHIGH = C.ACONFIGURATION_DENSITY_XXHIGH + CONFIGURATION_DENSITY_XXXHIGH = C.ACONFIGURATION_DENSITY_XXXHIGH + CONFIGURATION_DENSITY_NONE = C.ACONFIGURATION_DENSITY_NONE + + CONFIGURATION_KEYBOARD_ANY = C.ACONFIGURATION_KEYBOARD_ANY + CONFIGURATION_KEYBOARD_NOKEYS = C.ACONFIGURATION_KEYBOARD_NOKEYS + CONFIGURATION_KEYBOARD_QWERTY = C.ACONFIGURATION_KEYBOARD_QWERTY + CONFIGURATION_KEYBOARD_12KEY = C.ACONFIGURATION_KEYBOARD_12KEY + + CONFIGURATION_NAVIGATION_ANY = C.ACONFIGURATION_NAVIGATION_ANY + CONFIGURATION_NAVIGATION_NONAV = C.ACONFIGURATION_NAVIGATION_NONAV + CONFIGURATION_NAVIGATION_DPAD = C.ACONFIGURATION_NAVIGATION_DPAD + CONFIGURATION_NAVIGATION_TRACKBALL = C.ACONFIGURATION_NAVIGATION_TRACKBALL + CONFIGURATION_NAVIGATION_WHEEL = C.ACONFIGURATION_NAVIGATION_WHEEL + + CONFIGURATION_KEYSHIDDEN_ANY = C.ACONFIGURATION_KEYSHIDDEN_ANY + CONFIGURATION_KEYSHIDDEN_NO = C.ACONFIGURATION_KEYSHIDDEN_NO + CONFIGURATION_KEYSHIDDEN_YES = C.ACONFIGURATION_KEYSHIDDEN_YES + CONFIGURATION_KEYSHIDDEN_SOFT = C.ACONFIGURATION_KEYSHIDDEN_SOFT + + CONFIGURATION_NAVHIDDEN_ANY = C.ACONFIGURATION_NAVHIDDEN_ANY + CONFIGURATION_NAVHIDDEN_NO = C.ACONFIGURATION_NAVHIDDEN_NO + CONFIGURATION_NAVHIDDEN_YES = C.ACONFIGURATION_NAVHIDDEN_YES + + CONFIGURATION_SCREENSIZE_ANY = C.ACONFIGURATION_SCREENSIZE_ANY + CONFIGURATION_SCREENSIZE_SMALL = C.ACONFIGURATION_SCREENSIZE_SMALL + CONFIGURATION_SCREENSIZE_NORMAL = C.ACONFIGURATION_SCREENSIZE_NORMAL + CONFIGURATION_SCREENSIZE_LARGE = C.ACONFIGURATION_SCREENSIZE_LARGE + CONFIGURATION_SCREENSIZE_XLARGE = C.ACONFIGURATION_SCREENSIZE_XLARGE + + CONFIGURATION_SCREENLONG_ANY = C.ACONFIGURATION_SCREENLONG_ANY + CONFIGURATION_SCREENLONG_NO = C.ACONFIGURATION_SCREENLONG_NO + CONFIGURATION_SCREENLONG_YES = C.ACONFIGURATION_SCREENLONG_YES + + CONFIGURATION_UI_MODE_TYPE_ANY = C.ACONFIGURATION_UI_MODE_TYPE_ANY + CONFIGURATION_UI_MODE_TYPE_NORMAL = C.ACONFIGURATION_UI_MODE_TYPE_NORMAL + CONFIGURATION_UI_MODE_TYPE_DESK = C.ACONFIGURATION_UI_MODE_TYPE_DESK + CONFIGURATION_UI_MODE_TYPE_CAR = C.ACONFIGURATION_UI_MODE_TYPE_CAR + CONFIGURATION_UI_MODE_TYPE_TELEVISION = C.ACONFIGURATION_UI_MODE_TYPE_TELEVISION + CONFIGURATION_UI_MODE_TYPE_APPLIANCE = C.ACONFIGURATION_UI_MODE_TYPE_APPLIANCE + + CONFIGURATION_UI_MODE_NIGHT_ANY = C.ACONFIGURATION_UI_MODE_NIGHT_ANY + CONFIGURATION_UI_MODE_NIGHT_NO = C.ACONFIGURATION_UI_MODE_NIGHT_NO + CONFIGURATION_UI_MODE_NIGHT_YES = C.ACONFIGURATION_UI_MODE_NIGHT_YES + + CONFIGURATION_SCREEN_WIDTH_DP_ANY = C.ACONFIGURATION_SCREEN_WIDTH_DP_ANY + + CONFIGURATION_SCREEN_HEIGHT_DP_ANY = C.ACONFIGURATION_SCREEN_HEIGHT_DP_ANY + + CONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = C.ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY + + CONFIGURATION_LAYOUTDIR_ANY = C.ACONFIGURATION_LAYOUTDIR_ANY + CONFIGURATION_LAYOUTDIR_LTR = C.ACONFIGURATION_LAYOUTDIR_LTR + CONFIGURATION_LAYOUTDIR_RTL = C.ACONFIGURATION_LAYOUTDIR_RTL + + CONFIGURATION_MCC = C.ACONFIGURATION_MCC + CONFIGURATION_MNC = C.ACONFIGURATION_MNC + CONFIGURATION_LOCALE = C.ACONFIGURATION_LOCALE + CONFIGURATION_TOUCHSCREEN = C.ACONFIGURATION_TOUCHSCREEN + CONFIGURATION_KEYBOARD = C.ACONFIGURATION_KEYBOARD + CONFIGURATION_KEYBOARD_HIDDEN = C.ACONFIGURATION_KEYBOARD_HIDDEN + CONFIGURATION_NAVIGATION = C.ACONFIGURATION_NAVIGATION + CONFIGURATION_ORIENTATION = C.ACONFIGURATION_ORIENTATION + CONFIGURATION_DENSITY = C.ACONFIGURATION_DENSITY + CONFIGURATION_SCREEN_SIZE = C.ACONFIGURATION_SCREEN_SIZE + CONFIGURATION_VERSION = C.ACONFIGURATION_VERSION + CONFIGURATION_SCREEN_LAYOUT = C.ACONFIGURATION_SCREEN_LAYOUT + CONFIGURATION_UI_MODE = C.ACONFIGURATION_UI_MODE + CONFIGURATION_SMALLEST_SCREEN_SIZE = C.ACONFIGURATION_SMALLEST_SCREEN_SIZE + CONFIGURATION_LAYOUTDIR = C.ACONFIGURATION_LAYOUTDIR +) + +type Configuration C.AConfiguration + +func (config *Configuration) cptr() *C.AConfiguration { + return (*C.AConfiguration)(config) +} + +/** + * Create a new AConfiguration, initialized with no values set. + */ +func NewConfiguration() *Configuration { + return (*Configuration)(C.AConfiguration_new()) +} + +/** + * Free an AConfiguration that was previously created with + * AConfiguration_new(). + */ +func (config *Configuration) Delete() { + C.AConfiguration_delete(config.cptr()) +} + +/** + * Create and return a new AConfiguration based on the current configuration in + * use in the given AssetManager. + */ +func fromAssetManager(am *AssetManager) *Configuration { + config := NewConfiguration() + C.AConfiguration_fromAssetManager(config.cptr(), am.cptr()) + return config +} + +/** + * Copy the contents of 'src' to 'dest'. + */ +func (config *Configuration) Copy(dest *Configuration) { + C.AConfiguration_copy(dest.cptr(), config.cptr()) +} + +/** + * Return the current MCC set in the configuration. 0 if not set. + */ +//int32_t AConfiguration_getMcc(AConfiguration* config); +func (config *Configuration) GetMcc() int { + return int(C.AConfiguration_getMcc(config.cptr())) +} + +/** + * Set the current MCC in the configuration. 0 to clear. + */ +//void AConfiguration_setMcc(AConfiguration* config, int32_t mcc); +func (config *Configuration) SetMcc(mcc int) { + C.AConfiguration_setMcc(config.cptr(), C.int32_t(mcc)) +} + +/** + * Return the current MNC set in the configuration. 0 if not set. + */ +//int32_t AConfiguration_getMnc(AConfiguration* config); +func (config *Configuration) GetMnc() int { + return int(C.AConfiguration_getMnc(config.cptr())) +} + +/** + * Set the current MNC in the configuration. 0 to clear. + */ +//void AConfiguration_setMnc(AConfiguration* config, int32_t mnc); +func (config *Configuration) SetMnc(mnc int) { + C.AConfiguration_setMnc(config.cptr(), C.int32_t(mnc)) +} + +/** + * Return the current language code set in the configuration. The output will + * be filled with an array of two characters. They are not 0-terminated. If + * a language is not set, they will be 0. + */ +//void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage); +func (config *Configuration) GetLanguage() []byte { + var chars [2]byte + C.AConfiguration_getLanguage(config.cptr(), (*C.char)(unsafe.Pointer(&chars[0]))) + return chars[:] +} + +/** + * Set the current language code in the configuration, from the first two + * characters in the string. + */ +//void AConfiguration_setLanguage(AConfiguration* config, const char* language); +func (config *Configuration) SetLanguage(lang string) { + var chars [2]byte + chars[0] = lang[0] + chars[1] = lang[1] + C.AConfiguration_setLanguage(config.cptr(), (*C.char)(unsafe.Pointer(&chars[0]))) +} + +/** + * Return the current country code set in the configuration. The output will + * be filled with an array of two characters. They are not 0-terminated. If + * a country is not set, they will be 0. + */ +//void AConfiguration_getCountry(AConfiguration* config, char* outCountry); +func (config *Configuration) GetCountry() string { + var chars [2]byte + C.AConfiguration_getCountry(config.cptr(), (*C.char)(unsafe.Pointer(&chars[0]))) + if chars[0] == 0 { + return "" + } + return string(chars[:]) +} + +/** + * Set the current country code in the configuration, from the first two + * characters in the string. + */ +//void AConfiguration_setCountry(AConfiguration* config, const char* country); +func (config *Configuration) SetCountry(lang []byte) { + var chars [2]byte + chars[0] = lang[0] + chars[1] = lang[1] + C.AConfiguration_setCountry(config.cptr(), (*C.char)(unsafe.Pointer(&chars[0]))) +} + +/** + * Return the current ACONFIGURATION_ORIENTATION_* set in the configuration. + */ +//int32_t AConfiguration_getOrientation(AConfiguration* config); +func (config *Configuration) GetOrientation() int { + return int(C.AConfiguration_getOrientation(config.cptr())) +} + +/** + * Set the current orientation in the configuration. + */ +//void AConfiguration_setOrientation(AConfiguration* config, int32_t orientation); +func (config *Configuration) SetOrientation(orientation int) { + C.AConfiguration_setOrientation(config.cptr(), C.int32_t(orientation)) +} + +/** + * Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration. + */ +//int32_t AConfiguration_getTouchscreen(AConfiguration* config); +func (config *Configuration) GetTouchscreen() int { + return int(C.AConfiguration_getTouchscreen(config.cptr())) +} + +/** + * Set the current touchscreen in the configuration. + */ +//void AConfiguration_setTouchscreen(AConfiguration* config, int32_t touchscreen); +func (config *Configuration) SetTouchscreen(touchscreen int) { + C.AConfiguration_setTouchscreen(config.cptr(), C.int32_t(touchscreen)) +} + +/** + * Return the current ACONFIGURATION_DENSITY_* set in the configuration. + */ +//int32_t AConfiguration_getDensity(AConfiguration* config); +func (config *Configuration) GetDensity() int { + return int(C.AConfiguration_getDensity(config.cptr())) +} + +/** + * Set the current density in the configuration. + */ +//void AConfiguration_setDensity(AConfiguration* config, int32_t density); +func (config *Configuration) SetDensity(density int) { + C.AConfiguration_setDensity(config.cptr(), C.int32_t(density)) +} + +/** + * Return the current ACONFIGURATION_KEYBOARD_* set in the configuration. + */ +//int32_t AConfiguration_getKeyboard(AConfiguration* config); +func (config *Configuration) GetKeyboard() int { + return int(C.AConfiguration_getKeyboard(config.cptr())) +} + +/** + * Set the current keyboard in the configuration. + */ +//void AConfiguration_setKeyboard(AConfiguration* config, int32_t keyboard); +func (config *Configuration) SetKeyboard(keyboard int) { + C.AConfiguration_setKeyboard(config.cptr(), C.int32_t(keyboard)) +} + +/** + * Return the current ACONFIGURATION_NAVIGATION_* set in the configuration. + */ +//int32_t AConfiguration_getNavigation(AConfiguration* config); +func (config *Configuration) GetNavigation() int { + return int(C.AConfiguration_getNavigation(config.cptr())) +} + +/** + * Set the current navigation in the configuration. + */ +//void AConfiguration_setNavigation(AConfiguration* config, int32_t navigation); +func (config *Configuration) SetNavigation(navigation int) { + C.AConfiguration_setNavigation(config.cptr(), C.int32_t(navigation)) +} + +/** + * Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration. + */ +//int32_t AConfiguration_getKeysHidden(AConfiguration* config); +func (config *Configuration) GetKeysHidden() int { + return int(C.AConfiguration_getKeysHidden(config.cptr())) +} + +/** + * Set the current keys hidden in the configuration. + */ +//void AConfiguration_setKeysHidden(AConfiguration* config, int32_t keysHidden); +func (config *Configuration) SetKeysHidden(keysHidden int) { + C.AConfiguration_setKeysHidden(config.cptr(), C.int32_t(keysHidden)) +} + +/** + * Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration. + */ +//int32_t AConfiguration_getNavHidden(AConfiguration* config); +func (config *Configuration) GetNavHidden() int { + return int(C.AConfiguration_getNavHidden(config.cptr())) +} + +/** + * Set the current nav hidden in the configuration. + */ +//void AConfiguration_setNavHidden(AConfiguration* config, int32_t navHidden); +func (config *Configuration) SetNavHidden(navHidden int) { + C.AConfiguration_setNavHidden(config.cptr(), C.int32_t(navHidden)) +} + +/** + * Return the current SDK (API) version set in the configuration. + */ +//int32_t AConfiguration_getSdkVersion(AConfiguration* config); +func (config *Configuration) GetSdkVersion() int { + return int(C.AConfiguration_getSdkVersion(config.cptr())) +} + +/** + * Set the current SDK version in the configuration. + */ +//void AConfiguration_setSdkVersion(AConfiguration* config, int32_t sdkVersion); +func (config *Configuration) SetSdkVersion(sdkVersion int) { + C.AConfiguration_setSdkVersion(config.cptr(), C.int32_t(sdkVersion)) +} + +/** + * Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration. + */ +//int32_t AConfiguration_getScreenSize(AConfiguration* config); +func (config *Configuration) GetScreenSize() int { + return int(C.AConfiguration_getScreenSize(config.cptr())) +} + +/** + * Set the current screen size in the configuration. + */ +//void AConfiguration_setScreenSize(AConfiguration* config, int32_t screenSize); +func (config *Configuration) SetScreenSize(screenSize int) { + C.AConfiguration_setScreenSize(config.cptr(), C.int32_t(screenSize)) +} + +/** + * Return the current ACONFIGURATION_SCREENLONG_* set in the configuration. + */ +//int32_t AConfiguration_getScreenLong(AConfiguration* config); +func (config *Configuration) GetScreenLong() int { + return int(C.AConfiguration_getScreenLong(config.cptr())) +} + +/** + * Set the current screen long in the configuration. + */ +//void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong); +func (config *Configuration) SetScreenLong(screenLong int) { + C.AConfiguration_setScreenLong(config.cptr(), C.int32_t(screenLong)) +} + +/** + * Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration. + */ +//int32_t AConfiguration_getUiModeType(AConfiguration* config); +func (config *Configuration) GetUiModeType() int { + return int(C.AConfiguration_getUiModeType(config.cptr())) +} + +/** + * Set the current UI mode type in the configuration. + */ +//void AConfiguration_setUiModeType(AConfiguration* config, int32_t uiModeType); +func (config *Configuration) SetUiModeType(uiModeType int) { + C.AConfiguration_setUiModeType(config.cptr(), C.int32_t(uiModeType)) +} + +/** + * Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration. + */ +//int32_t AConfiguration_getUiModeNight(AConfiguration* config); +func (config *Configuration) GetUiModeNight() int { + return int(C.AConfiguration_getUiModeNight(config.cptr())) +} + +/** + * Set the current UI mode night in the configuration. + */ +//void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight); +func (config *Configuration) SetUiModeNight(uiModeNight int) { + C.AConfiguration_setUiModeNight(config.cptr(), C.int32_t(uiModeNight)) +} + +/** + * Return the current configuration screen width in dp units, or + * ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set. + */ +//int32_t AConfiguration_getScreenWidthDp(AConfiguration* config); +func (config *Configuration) GetScreenWidthDp() int { + return int(C.AConfiguration_getScreenWidthDp(config.cptr())) +} + +/** + * Set the configuration's current screen width in dp units. + */ +//void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value); +func (config *Configuration) SetScreenWidthDp(value int) { + C.AConfiguration_setScreenWidthDp(config.cptr(), C.int32_t(value)) +} + +/** + * Return the current configuration screen height in dp units, or + * ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set. + */ +//int32_t AConfiguration_getScreenHeightDp(AConfiguration* config); +func (config *Configuration) GetScreenHeightDp() int { + return int(C.AConfiguration_getScreenHeightDp(config.cptr())) +} + +/** + * Set the configuration's current screen width in dp units. + */ +//void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value); +func (config *Configuration) SetScreenHeightDp(value int) { + C.AConfiguration_setScreenHeightDp(config.cptr(), C.int32_t(value)) +} + +/** + * Return the configuration's smallest screen width in dp units, or + * ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set. + */ +//int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config); +func (config *Configuration) GetSmallestScreenWidthDp() int { + return int(C.AConfiguration_getSmallestScreenWidthDp(config.cptr())) +} + +/** + * Set the configuration's smallest screen width in dp units. + */ +//void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value); +func (config *Configuration) SetSmallestScreenWidthDp(value int) { + C.AConfiguration_setSmallestScreenWidthDp(config.cptr(), C.int32_t(value)) +} + +/** + * Return the configuration's layout direction, or + * ACONFIGURATION_LAYOUTDIR_ANY if not set. + */ +//int32_t AConfiguration_getLayoutDirection(AConfiguration* config); +func (config *Configuration) GetLayoutDirection() int { + return int(C.AConfiguration_getLayoutDirection(config.cptr())) +} + +/** + * Set the configuration's layout direction. + */ +//void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value); +func (config *Configuration) SetLayoutDirection(value int) { + C.AConfiguration_setLayoutDirection(config.cptr(), C.int32_t(value)) +} + +/** + * Perform a diff between two configurations. Returns a bit mask of + * ACONFIGURATION_* constants, each bit set meaning that configuration element + * is different between them. + */ +//int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2); +func (config *Configuration) Diff(config2 *Configuration) int { + return int(C.AConfiguration_diff(config.cptr(), config2.cptr())) +} + +/** + * Determine whether 'base' is a valid configuration for use within the + * environment 'requested'. Returns 0 if there are any values in 'base' + * that conflict with 'requested'. Returns 1 if it does not conflict. + */ +//int32_t AConfiguration_match(AConfiguration* base, AConfiguration* requested); +func (config *Configuration) Match(requested *Configuration) bool { + return 0 != int(C.AConfiguration_diff(config.cptr(), requested.cptr())) +} + +/** + * Determine whether the configuration in 'test' is better than the existing + * configuration in 'base'. If 'requested' is non-NULL, this decision is based + * on the overall configuration given there. If it is NULL, this decision is + * simply based on which configuration is more specific. Returns non-0 if + * 'test' is better than 'base'. + * + * This assumes you have already filtered the configurations with + * AConfiguration_match(). + */ +//int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test, +// AConfiguration* requested); +func (config *Configuration) IsBetterThan(test, requested *Configuration) bool { + return 0 != int(C.AConfiguration_isBetterThan(config.cptr(), test.cptr(), requested.cptr())) +} diff --git a/ndk/context.go b/ndk/context.go new file mode 100644 index 0000000..7a02d90 --- /dev/null +++ b/ndk/context.go @@ -0,0 +1,330 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ndk + +import ( + "os" + "runtime" + "sync" + "unsafe" +) + +// Callbacks is the set of functions called by the Activity. +type Callbacks struct { + Create func(*Activity, []byte) + Start func(*Activity) + Stop func(*Activity) + Pause func(*Activity) + Resume func(*Activity) + Destroy func(*Activity) + SaveState func(*Activity) []byte + FocusChanged func(*Activity, bool) + ContentRectChanged func(*Activity, *Rect) + ConfigurationChanged func(*Activity) + LowMemory func(*Activity) + + // Window + WindowCreated func(*Activity, *Window) + WindowDestroyed func(*Activity, *Window) + WindowDraw func(*Activity, *Window) + WindowResized func(*Activity, *Window) + WindowRedrawNeeded func(*Activity, *Window) + + // Touch is called by the app when a touch event occurs. + Event func(*Activity, *InputEvent) + // Sensor + Sensor func(*Activity, []SensorEvent) +} + +type Context struct { + Callbacks + + Act *Activity + Window *Window // onNativeWindowCreated may not be called after onStart + Input *InputQueue + + IsResume, + IsFocus, // onWindowFocusChanged may not be called after onStart/onStop + WillDestoryValue bool + + Looper *Looper + read, write *os.File + sensorQueue *SensorEventQueue + FuncChan chan func() + wait *sync.WaitGroup + isReady bool + isDebug bool + + ClassName string + packageName string + SavedState []byte +} + +func (ctx *Context) init() { + ctx.FuncChan = make(chan func(), 3) + ctx.wait = &sync.WaitGroup{} +} + +func (ctx *Context) setCB(cb *Callbacks) { + if cb != nil { + ctx.Callbacks = *cb + } +} + +func (ctx *Context) Reset() { + ctx.IsResume = false + ctx.WillDestoryValue = false +} + +func (ctx *Context) Debug(enable bool) { + ctx.isDebug = enable +} + +func (ctx *Context) WillDestory() bool { + return ctx.WillDestoryValue +} + +const ( + Looper_ID_MAIN = 1 + Looper_ID_INPUT = 2 + Looper_ID_SENSOR = 3 +) + +// Init looper +func (ctx *Context) initLooper() { + var err error + ctx.read, ctx.write, err = os.Pipe() + Assert(err) + ctx.Looper = LooperPrepare(LOOPER_PREPARE_ALLOW_NON_CALLBACKS) + ctx.Looper.AddFd(int(ctx.read.Fd()), Looper_ID_MAIN, LOOPER_EVENT_INPUT, nil, unsafe.Pointer(uintptr(Looper_ID_MAIN))) +} + +func (ctx *Context) begin(cb Callbacks) { + ctx.setCB(&cb) + ctx.initLooper() + ctx.FuncChan <- func() {} +} + +// Run starts the Activity. +// +// It must be called directly from from the main function and will +// block until the app exits. +func (ctx *Context) Run(cb Callbacks) { + Info("ctx.Run") + ctx.begin(cb) + ctx.Loop() +} + +func (ctx *Context) Begin(cb Callbacks) { + Info("ctx.Begin") + ctx.begin(cb) +} + +func (ctx *Context) Release() { + ctx.Looper.RemoveFd(int(ctx.read.Fd())) + if ctx.sensorQueue != nil { + SensorManagerInstance().Destroy(ctx.sensorQueue) + } + //ctx.looper.Release() + ctx.read.Close() + ctx.write.Close() +} + +func (ctx *Context) RunFunc(fun func(), sync bool) { + if !ctx.isDebug { + defer func() { + if r := recover(); r != nil { + Info("RunFunc.recover:", r) + } + }() + } + + //Info("...wait...") + //oldM := util.Mode(util.StackTrace) + //Assert(false) + //util.Mode(oldM) + + var cmd = []byte{Looper_ID_MAIN} + ctx.write.Write(cmd) + if !sync { + ctx.FuncChan <- fun + } else { + ctx.wait.Add(1) + ctx.FuncChan <- func() { defer ctx.wait.Done(); fun() } + ctx.wait.Wait() + } + //Info("...wait<<<", forceEsace) +} + +var entryDoFunc uintptr + +func (ctx *Context) doFunc() { + if !ctx.isDebug { + defer func() { + if r := recover(); r != nil { + Info("execFunc.recover:", r) + } + }() + } + + if entryDoFunc == 0 { + pc := make([]uintptr, 1) + n := runtime.Callers(1, pc) + frames := runtime.CallersFrames(pc[:n]) + frame, _ := frames.Next() + entryDoFunc = frame.Entry + } + + (<-ctx.FuncChan)() +} + +func (ctx *Context) Call(fun func(), sync bool) { + if sync { + // If it is called in doFunc, it will be executed directly, otherwise it will cause deadlock. + pc := make([]uintptr, 10000) + n := runtime.Callers(2, pc) + frames := runtime.CallersFrames(pc[:n]) + for { + frame, more := frames.Next() + if frame.Entry == entryDoFunc { + fun() + return + } + if !more { + break + } + } + } + + ctx.RunFunc(fun, sync) +} + +func (ctx *Context) loopEvents(timeoutMillis int) bool { + Assert(!ctx.WillDestoryValue, "!ctx.willDestory") + + for { + ident, _, event, data := LooperPollOnce(timeoutMillis) + //Info("LooperPollAll is", int(ident)) + switch ident { + case Looper_ID_MAIN: + //Info("LooperPollAll is MAIN") + var cmd = []byte{0} + n, err := ctx.read.Read(cmd) + Assert(n == 1 && err == nil) + Assert(ident == int(cmd[0])) + Assert(ident == int(data)) + Assert(event == int(data)) + ctx.doFunc() + if ctx.WillDestoryValue { + return false + } + return true + + case Looper_ID_INPUT: + //Info("LooperPollAll is INPUT") + for ctx.Input != nil { + event := ctx.Input.GetEvent() + if event == nil { + break + } + if !ctx.Input.PreDispatchEvent(event) { + if !ctx.WillDestoryValue { + ctx.processEvent(event) + } + ctx.Input.FinishEvent(event, 0) + } + } + if ctx.WillDestoryValue { + return false + } + return true + + case Looper_ID_SENSOR: + //Info("LooperPollAll is SENSOR") + if ctx.sensorQueue != nil { + var events []SensorEvent + errno := ctx.sensorQueue.HasEvents() + if errno > 0 { + events, errno = ctx.sensorQueue.GetEvents(32) + } + + if errno < 0 { + Info("SensorEventQueue GetEvents error :", errno) + } else { + if ctx.Sensor != nil && len(events) > 0 { + //for _, event := range events { + //} + ctx.Sensor(ctx.Act, events) + } + } + } else { + Info("looper_ID_SENSOR ...") + } + return true + + case LOOPER_POLL_WAKE: + //info("LooperPollAll is ALOOPER_POLL_WAKE") + return true + case LOOPER_POLL_TIMEOUT: + //Info("LooperPollAll is LOOPER_POLL_TIMEOUT") + return true + case LOOPER_POLL_ERROR: + Info("LooperPollAll is LOOPER_POLL_ERROR") + return true + default: + Info("LooperPollAll is ", ident) + return true + } + } +} + +func (ctx *Context) processEvent(e *InputEvent) { + //Info("processEvent:", e) + if ctx.Event != nil { + ctx.Event(ctx.Act, e) + } +} + +func (ctx *Context) pollEvent(timeoutMillis int) bool { + if ctx.loopEvents(timeoutMillis) { + if ctx.IsFocus && ctx.IsResume { + if ctx.Window != nil && + ctx.WindowDraw != nil { + ctx.WindowDraw(ctx.Act, ctx.Window) + } + } + return true + } else { + //info("pollEvent: return false") + ctx.doFunc() + return false + } +} + +func (ctx *Context) Loop() { + for ctx.pollEvent(-1) { + // nothing + } +} + +func (ctx *Context) PollEvent() bool { + return ctx.pollEvent(0) +} + +func (ctx *Context) WaitEvent() bool { + return ctx.pollEvent(-1) +} + +func (ctx *Context) Wake() { + ctx.Looper.Wake() +} + +func (ctx *Context) Name() string { + return ctx.ClassName +} + +func (ctx *Context) Package() string { + return ctx.packageName +} diff --git a/ndk/go_ndk.go b/ndk/go_ndk.go new file mode 100644 index 0000000..cb1926f --- /dev/null +++ b/ndk/go_ndk.go @@ -0,0 +1,52 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Go runtime entry point for apps running on android. +// Sets up everything the runtime needs and exposes +// the entry point to JNI. + +//go:build android && !fyne +// +build android,!fyne + +package ndk + +/* +#cgo LDFLAGS: -llog -landroid + +#include +#include +#include +#include +#include + +static jint _JNI_OnLoad_gondk(JavaVM* vm, void* reserved) { + JNIEnv* env; + if ((*vm)->GetEnv(vm, (void**)&env, JNI_VERSION_1_6) != JNI_OK) { + return -1; + } + return JNI_VERSION_1_6; +} +*/ +import "C" + +import ( + "unsafe" +) + +//export JNI_OnLoad +func JNI_OnLoad(vm *C.JavaVM, reserved unsafe.Pointer) C.jint { + return C._JNI_OnLoad_gondk(vm, reserved) +} + +//export ANativeActivity_onCreate +func ANativeActivity_onCreate(act *Activity, savedState unsafe.Pointer, savedStateSize C.size_t) { + CreateActivity(act, savedState, savedStateSize) +} + +//export ANativeActivity_onCreateB +func ANativeActivity_onCreateB(act *Activity, savedState unsafe.Pointer, savedStateSize C.size_t) { + Info("ANativeActivity_onCreateB...") + + CreateActivity(act, savedState, savedStateSize) +} diff --git a/ndk/input.go b/ndk/input.go new file mode 100644 index 0000000..ca3b246 --- /dev/null +++ b/ndk/input.go @@ -0,0 +1,994 @@ +// android app + +//go:build android +// +build android + +package ndk + +/* +#include +extern int cgoCallback(int fd, int events, void* data); +*/ +import "C" + +import "unsafe" + +/* + * Key states (may be returned by queries about the current state of a + * particular key code, scan code or switch). + */ +const ( + /* The key state is unknown or the requested key itself is not supported. */ + KEY_STATE_UNKNOWN = C.AKEY_STATE_UNKNOWN + + /* The key is up. */ + KEY_STATE_UP = C.AKEY_STATE_UP + + /* The key is down. */ + KEY_STATE_DOWN = C.AKEY_STATE_DOWN + + /* The key is down but is a virtual key press that is being emulated by the system. */ + KEY_STATE_VIRTUAL = C.AKEY_STATE_VIRTUAL +) + +/* + * Meta key / modifier state. + */ +const ( + /* No meta keys are pressed. */ + META_NONE = C.AMETA_NONE + + /* This mask is used to check whether one of the ALT meta keys is pressed. */ + META_ALT_ON = C.AMETA_ALT_ON + + /* This mask is used to check whether the left ALT meta key is pressed. */ + META_ALT_LEFT_ON = C.AMETA_ALT_LEFT_ON + + /* This mask is used to check whether the right ALT meta key is pressed. */ + META_ALT_RIGHT_ON = C.AMETA_ALT_RIGHT_ON + + /* This mask is used to check whether one of the SHIFT meta keys is pressed. */ + META_SHIFT_ON = C.AMETA_SHIFT_ON + + /* This mask is used to check whether the left SHIFT meta key is pressed. */ + META_SHIFT_LEFT_ON = C.AMETA_SHIFT_LEFT_ON + + /* This mask is used to check whether the right SHIFT meta key is pressed. */ + META_SHIFT_RIGHT_ON = C.AMETA_SHIFT_RIGHT_ON + + /* This mask is used to check whether the SYM meta key is pressed. */ + META_SYM_ON = C.AMETA_SYM_ON + + /* This mask is used to check whether the FUNCTION meta key is pressed. */ + META_FUNCTION_ON = C.AMETA_FUNCTION_ON + + /* This mask is used to check whether one of the CTRL meta keys is pressed. */ + META_CTRL_ON = C.AMETA_CTRL_ON + + /* This mask is used to check whether the left CTRL meta key is pressed. */ + META_CTRL_LEFT_ON = C.AMETA_CTRL_LEFT_ON + + /* This mask is used to check whether the right CTRL meta key is pressed. */ + META_CTRL_RIGHT_ON = C.AMETA_CTRL_RIGHT_ON + + /* This mask is used to check whether one of the META meta keys is pressed. */ + META_META_ON = C.AMETA_META_ON + + /* This mask is used to check whether the left META meta key is pressed. */ + META_META_LEFT_ON = C.AMETA_META_LEFT_ON + + /* This mask is used to check whether the right META meta key is pressed. */ + META_META_RIGHT_ON = C.AMETA_META_RIGHT_ON + + /* This mask is used to check whether the CAPS LOCK meta key is on. */ + META_CAPS_LOCK_ON = C.AMETA_CAPS_LOCK_ON + + /* This mask is used to check whether the NUM LOCK meta key is on. */ + META_NUM_LOCK_ON = C.AMETA_NUM_LOCK_ON + + /* This mask is used to check whether the SCROLL LOCK meta key is on. */ + META_SCROLL_LOCK_ON = C.AMETA_SCROLL_LOCK_ON +) + +/* + * Input events. + * + * Input events are opaque structures. Use the provided accessors functions to + * read their properties. + */ +type InputEvent C.AInputEvent + +func (event *InputEvent) cptr() *C.AInputEvent { + return (*C.AInputEvent)(event) +} + +/* + * Input event types. + */ +const ( + /* Indicates that the input event is a key event. */ + INPUT_EVENT_TYPE_KEY = C.AINPUT_EVENT_TYPE_KEY + + /* Indicates that the input event is a motion event. */ + INPUT_EVENT_TYPE_MOTION = C.AINPUT_EVENT_TYPE_MOTION +) + +/* + * Key event actions. + */ +const ( + /* The key has been pressed down. */ + KEY_EVENT_ACTION_DOWN = C.AKEY_EVENT_ACTION_DOWN + + /* The key has been released. */ + KEY_EVENT_ACTION_UP = C.AKEY_EVENT_ACTION_UP + + /* Multiple duplicate key events have occurred in a row, or a complex string is + * being delivered. The repeat_count property of the key event contains the number + * of times the given key code should be executed. + */ + KEY_EVENT_ACTION_MULTIPLE = C.AKEY_EVENT_ACTION_MULTIPLE +) + +/* + * Key event flags. + */ +const ( + /* This mask is set if the device woke because of this key event. */ + KEY_EVENT_FLAG_WOKE_HERE = C.AKEY_EVENT_FLAG_WOKE_HERE + + /* This mask is set if the key event was generated by a software keyboard. */ + KEY_EVENT_FLAG_SOFT_KEYBOARD = C.AKEY_EVENT_FLAG_SOFT_KEYBOARD + + /* This mask is set if we don't want the key event to cause us to leave touch mode. */ + KEY_EVENT_FLAG_KEEP_TOUCH_MODE = C.AKEY_EVENT_FLAG_KEEP_TOUCH_MODE + + /* This mask is set if an event was known to come from a trusted part + * of the system. That is, the event is known to come from the user, + * and could not have been spoofed by a third party component. */ + KEY_EVENT_FLAG_FROM_SYSTEM = C.AKEY_EVENT_FLAG_FROM_SYSTEM + + /* This mask is used for compatibility, to identify enter keys that are + * coming from an IME whose enter key has been auto-labelled "next" or + * "done". This allows TextView to dispatch these as normal enter keys + * for old applications, but still do the appropriate action when + * receiving them. */ + KEY_EVENT_FLAG_EDITOR_ACTION = C.AKEY_EVENT_FLAG_EDITOR_ACTION + + /* When associated with up key events, this indicates that the key press + * has been canceled. Typically this is used with virtual touch screen + * keys, where the user can slide from the virtual key area on to the + * display: in that case, the application will receive a canceled up + * event and should not perform the action normally associated with the + * key. Note that for this to work, the application can not perform an + * action for a key until it receives an up or the long press timeout has + * expired. */ + KEY_EVENT_FLAG_CANCELED = C.AKEY_EVENT_FLAG_CANCELED + + /* This key event was generated by a virtual (on-screen) hard key area. + * Typically this is an area of the touchscreen, outside of the regular + * display, dedicated to "hardware" buttons. */ + KEY_EVENT_FLAG_VIRTUAL_HARD_KEY = C.AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY + + /* This flag is set for the first key repeat that occurs after the + * long press timeout. */ + KEY_EVENT_FLAG_LONG_PRESS = C.AKEY_EVENT_FLAG_LONG_PRESS + + /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long + * press action was executed while it was down. */ + KEY_EVENT_FLAG_CANCELED_LONG_PRESS = C.AKEY_EVENT_FLAG_CANCELED_LONG_PRESS + + /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being + * tracked from its initial down. That is, somebody requested that tracking + * started on the key down and a long press has not caused + * the tracking to be canceled. */ + KEY_EVENT_FLAG_TRACKING = C.AKEY_EVENT_FLAG_TRACKING + + /* Set when a key event has been synthesized to implement default behavior + * for an event that the application did not handle. + * Fallback key events are generated by unhandled trackball motions + * (to emulate a directional keypad) and by certain unhandled key presses + * that are declared in the key map (such as special function numeric keypad + * keys when numlock is off). */ + KEY_EVENT_FLAG_FALLBACK = C.AKEY_EVENT_FLAG_FALLBACK +) + +/* + * Motion event actions. + */ + +/* Bit shift for the action bits holding the pointer index as + * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK. + */ +const MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = C.AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT + +const ( + /* Bit mask of the parts of the action code that are the action itself. + */ + MOTION_EVENT_ACTION_MASK = C.AMOTION_EVENT_ACTION_MASK + + /* Bits in the action code that represent a pointer index, used with + * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting + * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer + * index where the data for the pointer going up or down can be found. + */ + MOTION_EVENT_ACTION_POINTER_INDEX_MASK = C.AMOTION_EVENT_ACTION_POINTER_INDEX_MASK + + /* A pressed gesture has started, the motion contains the initial starting location. + */ + MOTION_EVENT_ACTION_DOWN = C.AMOTION_EVENT_ACTION_DOWN + + /* A pressed gesture has finished, the motion contains the final release location + * as well as any intermediate points since the last down or move event. + */ + MOTION_EVENT_ACTION_UP = C.AMOTION_EVENT_ACTION_UP + + /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and + * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as + * any intermediate points since the last down or move event. + */ + MOTION_EVENT_ACTION_MOVE = C.AMOTION_EVENT_ACTION_MOVE + + /* The current gesture has been aborted. + * You will not receive any more points in it. You should treat this as + * an up event, but not perform any action that you normally would. + */ + MOTION_EVENT_ACTION_CANCEL = C.AMOTION_EVENT_ACTION_CANCEL + + /* A movement has happened outside of the normal bounds of the UI element. + * This does not provide a full gesture, but only the initial location of the movement/touch. + */ + MOTION_EVENT_ACTION_OUTSIDE = C.AMOTION_EVENT_ACTION_OUTSIDE + + /* A non-primary pointer has gone down. + * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. + */ + MOTION_EVENT_ACTION_POINTER_DOWN = C.AMOTION_EVENT_ACTION_POINTER_DOWN + + /* A non-primary pointer has gone up. + * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. + */ + MOTION_EVENT_ACTION_POINTER_UP = C.AMOTION_EVENT_ACTION_POINTER_UP + + /* A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE). + * The motion contains the most recent point, as well as any intermediate points since + * the last hover move event. + */ + MOTION_EVENT_ACTION_HOVER_MOVE = C.AMOTION_EVENT_ACTION_HOVER_MOVE + + /* The motion event contains relative vertical and/or horizontal scroll offsets. + * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL + * and AMOTION_EVENT_AXIS_HSCROLL. + * The pointer may or may not be down when this event is dispatched. + * This action is always delivered to the winder under the pointer, which + * may not be the window currently touched. + */ + MOTION_EVENT_ACTION_SCROLL = C.AMOTION_EVENT_ACTION_SCROLL + + /* The pointer is not down but has entered the boundaries of a window or view. + */ + MOTION_EVENT_ACTION_HOVER_ENTER = C.AMOTION_EVENT_ACTION_HOVER_ENTER + + /* The pointer is not down but has exited the boundaries of a window or view. + */ + MOTION_EVENT_ACTION_HOVER_EXIT = C.AMOTION_EVENT_ACTION_HOVER_EXIT +) + +/* + * Motion event flags. + */ +const ( + /* This flag indicates that the window that received this motion event is partly + * or wholly obscured by another visible window above it. This flag is set to true + * even if the event did not directly pass through the obscured area. + * A security sensitive application can check this flag to identify situations in which + * a malicious application may have covered up part of its content for the purpose + * of misleading the user or hijacking touches. An appropriate response might be + * to drop the suspect touches or to take additional precautions to confirm the user's + * actual intent. + */ + MOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = C.AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED +) + +/* + * Motion event edge touch flags. + */ +const ( + /* No edges intersected */ + MOTION_EVENT_EDGE_FLAG_NONE = C.AMOTION_EVENT_EDGE_FLAG_NONE + + /* Flag indicating the motion event intersected the top edge of the screen. */ + MOTION_EVENT_EDGE_FLAG_TOP = C.AMOTION_EVENT_EDGE_FLAG_TOP + + /* Flag indicating the motion event intersected the bottom edge of the screen. */ + MOTION_EVENT_EDGE_FLAG_BOTTOM = C.AMOTION_EVENT_EDGE_FLAG_BOTTOM + + /* Flag indicating the motion event intersected the left edge of the screen. */ + MOTION_EVENT_EDGE_FLAG_LEFT = C.AMOTION_EVENT_EDGE_FLAG_LEFT + + /* Flag indicating the motion event intersected the right edge of the screen. */ + MOTION_EVENT_EDGE_FLAG_RIGHT = C.AMOTION_EVENT_EDGE_FLAG_RIGHT +) + +/* + * Constants that identify each individual axis of a motion event. + * Refer to the documentation on the MotionEvent class for descriptions of each axis. + */ +const ( + MOTION_EVENT_AXIS_X = C.AMOTION_EVENT_AXIS_X + MOTION_EVENT_AXIS_Y = C.AMOTION_EVENT_AXIS_Y + MOTION_EVENT_AXIS_PRESSURE = C.AMOTION_EVENT_AXIS_PRESSURE + MOTION_EVENT_AXIS_SIZE = C.AMOTION_EVENT_AXIS_SIZE + MOTION_EVENT_AXIS_TOUCH_MAJOR = C.AMOTION_EVENT_AXIS_TOUCH_MAJOR + MOTION_EVENT_AXIS_TOUCH_MINOR = C.AMOTION_EVENT_AXIS_TOUCH_MINOR + MOTION_EVENT_AXIS_TOOL_MAJOR = C.AMOTION_EVENT_AXIS_TOOL_MAJOR + MOTION_EVENT_AXIS_TOOL_MINOR = C.AMOTION_EVENT_AXIS_TOOL_MINOR + MOTION_EVENT_AXIS_ORIENTATION = C.AMOTION_EVENT_AXIS_ORIENTATION + MOTION_EVENT_AXIS_VSCROLL = C.AMOTION_EVENT_AXIS_VSCROLL + MOTION_EVENT_AXIS_HSCROLL = C.AMOTION_EVENT_AXIS_HSCROLL + MOTION_EVENT_AXIS_Z = C.AMOTION_EVENT_AXIS_Z + MOTION_EVENT_AXIS_RX = C.AMOTION_EVENT_AXIS_RX + MOTION_EVENT_AXIS_RY = C.AMOTION_EVENT_AXIS_RY + MOTION_EVENT_AXIS_RZ = C.AMOTION_EVENT_AXIS_RZ + MOTION_EVENT_AXIS_HAT_X = C.AMOTION_EVENT_AXIS_HAT_X + MOTION_EVENT_AXIS_HAT_Y = C.AMOTION_EVENT_AXIS_HAT_Y + MOTION_EVENT_AXIS_LTRIGGER = C.AMOTION_EVENT_AXIS_LTRIGGER + MOTION_EVENT_AXIS_RTRIGGER = C.AMOTION_EVENT_AXIS_RTRIGGER + MOTION_EVENT_AXIS_THROTTLE = C.AMOTION_EVENT_AXIS_THROTTLE + MOTION_EVENT_AXIS_RUDDER = C.AMOTION_EVENT_AXIS_RUDDER + MOTION_EVENT_AXIS_WHEEL = C.AMOTION_EVENT_AXIS_WHEEL + MOTION_EVENT_AXIS_GAS = C.AMOTION_EVENT_AXIS_GAS + MOTION_EVENT_AXIS_BRAKE = C.AMOTION_EVENT_AXIS_BRAKE + MOTION_EVENT_AXIS_DISTANCE = C.AMOTION_EVENT_AXIS_DISTANCE + MOTION_EVENT_AXIS_TILT = C.AMOTION_EVENT_AXIS_TILT + MOTION_EVENT_AXIS_GENERIC_1 = C.AMOTION_EVENT_AXIS_GENERIC_1 + MOTION_EVENT_AXIS_GENERIC_2 = C.AMOTION_EVENT_AXIS_GENERIC_2 + MOTION_EVENT_AXIS_GENERIC_3 = C.AMOTION_EVENT_AXIS_GENERIC_3 + MOTION_EVENT_AXIS_GENERIC_4 = C.AMOTION_EVENT_AXIS_GENERIC_4 + MOTION_EVENT_AXIS_GENERIC_5 = C.AMOTION_EVENT_AXIS_GENERIC_5 + MOTION_EVENT_AXIS_GENERIC_6 = C.AMOTION_EVENT_AXIS_GENERIC_6 + MOTION_EVENT_AXIS_GENERIC_7 = C.AMOTION_EVENT_AXIS_GENERIC_7 + MOTION_EVENT_AXIS_GENERIC_8 = C.AMOTION_EVENT_AXIS_GENERIC_8 + MOTION_EVENT_AXIS_GENERIC_9 = C.AMOTION_EVENT_AXIS_GENERIC_9 + MOTION_EVENT_AXIS_GENERIC_10 = C.AMOTION_EVENT_AXIS_GENERIC_10 + MOTION_EVENT_AXIS_GENERIC_11 = C.AMOTION_EVENT_AXIS_GENERIC_11 + MOTION_EVENT_AXIS_GENERIC_12 = C.AMOTION_EVENT_AXIS_GENERIC_12 + MOTION_EVENT_AXIS_GENERIC_13 = C.AMOTION_EVENT_AXIS_GENERIC_13 + MOTION_EVENT_AXIS_GENERIC_14 = C.AMOTION_EVENT_AXIS_GENERIC_14 + MOTION_EVENT_AXIS_GENERIC_15 = C.AMOTION_EVENT_AXIS_GENERIC_15 + MOTION_EVENT_AXIS_GENERIC_16 = C.AMOTION_EVENT_AXIS_GENERIC_16 + + // NOTE: If you add a new axis here you must also add it to several other files. + // Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list. +) + +/* + * Constants that identify buttons that are associated with motion events. + * Refer to the documentation on the MotionEvent class for descriptions of each button. + */ +const ( + MOTION_EVENT_BUTTON_PRIMARY = C.AMOTION_EVENT_BUTTON_PRIMARY + MOTION_EVENT_BUTTON_SECONDARY = C.AMOTION_EVENT_BUTTON_SECONDARY + MOTION_EVENT_BUTTON_TERTIARY = C.AMOTION_EVENT_BUTTON_TERTIARY + MOTION_EVENT_BUTTON_BACK = C.AMOTION_EVENT_BUTTON_BACK + MOTION_EVENT_BUTTON_FORWARD = C.AMOTION_EVENT_BUTTON_FORWARD +) + +/* + * Constants that identify tool types. + * Refer to the documentation on the MotionEvent class for descriptions of each tool type. + */ +const ( + MOTION_EVENT_TOOL_TYPE_UNKNOWN = C.AMOTION_EVENT_TOOL_TYPE_UNKNOWN + MOTION_EVENT_TOOL_TYPE_FINGER = C.AMOTION_EVENT_TOOL_TYPE_FINGER + MOTION_EVENT_TOOL_TYPE_STYLUS = C.AMOTION_EVENT_TOOL_TYPE_STYLUS + MOTION_EVENT_TOOL_TYPE_MOUSE = C.AMOTION_EVENT_TOOL_TYPE_MOUSE + MOTION_EVENT_TOOL_TYPE_ERASER = C.AMOTION_EVENT_TOOL_TYPE_ERASER +) + +/* + * Input sources. + * + * Refer to the documentation on android.view.InputDevice for more details about input sources + * and their correct interpretation. + */ +const ( + INPUT_SOURCE_CLASS_MASK = C.AINPUT_SOURCE_CLASS_MASK + + INPUT_SOURCE_CLASS_NONE = C.AINPUT_SOURCE_CLASS_NONE + INPUT_SOURCE_CLASS_BUTTON = C.AINPUT_SOURCE_CLASS_BUTTON + INPUT_SOURCE_CLASS_POINTER = C.AINPUT_SOURCE_CLASS_POINTER + INPUT_SOURCE_CLASS_NAVIGATION = C.AINPUT_SOURCE_CLASS_NAVIGATION + INPUT_SOURCE_CLASS_POSITION = C.AINPUT_SOURCE_CLASS_POSITION + INPUT_SOURCE_CLASS_JOYSTICK = C.AINPUT_SOURCE_CLASS_JOYSTICK +) + +const ( + INPUT_SOURCE_UNKNOWN = C.AINPUT_SOURCE_UNKNOWN + + INPUT_SOURCE_KEYBOARD = C.AINPUT_SOURCE_KEYBOARD + INPUT_SOURCE_DPAD = C.AINPUT_SOURCE_DPAD + INPUT_SOURCE_GAMEPAD = C.AINPUT_SOURCE_GAMEPAD + INPUT_SOURCE_TOUCHSCREEN = C.AINPUT_SOURCE_TOUCHSCREEN + INPUT_SOURCE_MOUSE = C.AINPUT_SOURCE_MOUSE + INPUT_SOURCE_STYLUS = C.AINPUT_SOURCE_STYLUS + INPUT_SOURCE_TRACKBALL = C.AINPUT_SOURCE_TRACKBALL + INPUT_SOURCE_TOUCHPAD = C.AINPUT_SOURCE_TOUCHPAD + INPUT_SOURCE_TOUCH_NAVIGATION = C.AINPUT_SOURCE_TOUCH_NAVIGATION + INPUT_SOURCE_JOYSTICK = C.AINPUT_SOURCE_JOYSTICK + + INPUT_SOURCE_ANY = C.AINPUT_SOURCE_ANY +) + +/* + * Keyboard types. + * + * Refer to the documentation on android.view.InputDevice for more details. + */ +const ( + INPUT_KEYBOARD_TYPE_NONE = C.AINPUT_KEYBOARD_TYPE_NONE + INPUT_KEYBOARD_TYPE_NON_ALPHABETIC = C.AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC + INPUT_KEYBOARD_TYPE_ALPHABETIC = C.AINPUT_KEYBOARD_TYPE_ALPHABETIC +) + +/* + * Input event accessors. + * + * Note that most functions can only be used on input events that are of a given type. + * Calling these functions on input events of other types will yield undefined behavior. + */ + +/*** Accessors for all input events. ***/ + +/* Get the input event type. */ +//int32_t AInputEvent_getType(const AInputEvent* event); +func (event *InputEvent) GetType() int { + return int(C.AInputEvent_getType(event.cptr())) +} + +/* Get the id for the device that an input event came from. + * + * Input events can be generated by multiple different input devices. + * Use the input device id to obtain information about the input + * device that was responsible for generating a particular event. + * + * An input device id of 0 indicates that the event didn't come from a physical device; + * other numbers are arbitrary and you shouldn't depend on the values. + * Use the provided input device query API to obtain information about input devices. + */ +//int32_t AInputEvent_getDeviceId(const AInputEvent* event); +func (event *InputEvent) GetDeviceId() int { + return int(C.AInputEvent_getDeviceId(event.cptr())) +} + +/* Get the input event source. */ +//int32_t AInputEvent_getSource(const AInputEvent* event); +func (event *InputEvent) GetSource() int { + return int(C.AInputEvent_getSource(event.cptr())) +} + +/*** Accessors for key events only. ***/ +type KeyEvent InputEvent + +func (event *KeyEvent) cptr() *C.AInputEvent { + return (*InputEvent)(event).cptr() +} + +/* Get the key event action. */ +//int32_t AKeyEvent_getAction(const AInputEvent* key_event); +func (event *KeyEvent) GetAction() int { + return int(C.AKeyEvent_getAction(event.cptr())) +} + +/* Get the key event flags. */ +//int32_t AKeyEvent_getFlags(const AInputEvent* key_event); +func (event *KeyEvent) GetFlags() int { + return int(C.AKeyEvent_getFlags(event.cptr())) +} + +/* Get the key code of the key event. + * This is the physical key that was pressed, not the Unicode character. */ +//int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event); +func (event *KeyEvent) GetKeyCode() int { + return int(C.AKeyEvent_getKeyCode(event.cptr())) +} + +/* Get the hardware key id of this key event. + * These values are not reliable and vary from device to device. */ +//int32_t AKeyEvent_getScanCode(const AInputEvent* key_event); +func (event *KeyEvent) GetScanCode() int { + return int(C.AKeyEvent_getScanCode(event.cptr())) +} + +/* Get the meta key state. */ +//int32_t AKeyEvent_getMetaState(const AInputEvent* key_event); +func (event *KeyEvent) GetMetaState() int { + return int(C.AKeyEvent_getMetaState(event.cptr())) +} + +/* Get the repeat count of the event. + * For both key up an key down events, this is the number of times the key has + * repeated with the first down starting at 0 and counting up from there. For + * multiple key events, this is the number of down/up pairs that have occurred. */ +//int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event); +func (event *KeyEvent) GetRepeatCount() int { + return int(C.AKeyEvent_getRepeatCount(event.cptr())) +} + +/* Get the time of the most recent key down event, in the + * java.lang.System.nanoTime() time base. If this is a down event, + * this will be the same as eventTime. + * Note that when chording keys, this value is the down time of the most recently + * pressed key, which may not be the same physical key of this event. */ +//int64_t AKeyEvent_getDownTime(const AInputEvent* key_event); +func (event *KeyEvent) GetDownTime() int64 { + return int64(C.AKeyEvent_getDownTime(event.cptr())) +} + +/* Get the time this event occurred, in the + * java.lang.System.nanoTime() time base. */ +//int64_t AKeyEvent_getEventTime(const AInputEvent* key_event); +func (event *KeyEvent) GetEventTime() int64 { + return int64(C.AKeyEvent_getEventTime(event.cptr())) +} + +/*** Accessors for motion events only. ***/ +type MotionEvent InputEvent + +func (event *MotionEvent) cptr() *C.AInputEvent { + return (*InputEvent)(event).cptr() +} + +/* Get the combined motion event action code and pointer index. */ +//int32_t AMotionEvent_getAction(const AInputEvent* motion_event); +func (event *MotionEvent) GetAction() int { + return int(C.AMotionEvent_getAction(event.cptr())) +} + +/* Get the motion event flags. */ +//int32_t AMotionEvent_getFlags(const AInputEvent* motion_event); +func (event *MotionEvent) GetFlags() int { + return int(C.AMotionEvent_getFlags(event.cptr())) +} + +/* Get the state of any meta / modifier keys that were in effect when the + * event was generated. */ +//int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event); +func (event *MotionEvent) GetMetaState() int { + return int(C.AMotionEvent_getMetaState(event.cptr())) +} + +/* Get the button state of all buttons that are pressed. */ +//int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event); +func (event *MotionEvent) GetButtonState() int { + return int(C.AMotionEvent_getButtonState(event.cptr())) +} + +/* Get a bitfield indicating which edges, if any, were touched by this motion event. + * For touch events, clients can use this to determine if the user's finger was + * touching the edge of the display. */ +//int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event); +func (event *MotionEvent) GetEdgeFlags() int { + return int(C.AMotionEvent_getEdgeFlags(event.cptr())) +} + +/* Get the time when the user originally pressed down to start a stream of + * position events, in the java.lang.System.nanoTime() time base. */ +//int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event); +func (event *MotionEvent) GetDownTime() int64 { + return int64(C.AMotionEvent_getDownTime(event.cptr())) +} + +/* Get the time when this specific event was generated, + * in the java.lang.System.nanoTime() time base. */ +//int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event); +func (event *MotionEvent) GetEventTime() int64 { + return int64(C.AMotionEvent_getEventTime(event.cptr())) +} + +/* Get the X coordinate offset. + * For touch events on the screen, this is the delta that was added to the raw + * screen coordinates to adjust for the absolute position of the containing windows + * and views. */ +//float AMotionEvent_getXOffset(const AInputEvent* motion_event) __NDK_FPABI__; +func (event *MotionEvent) GetXOffset() float32 { + return float32(C.AMotionEvent_getXOffset(event.cptr())) +} + +/* Get the Y coordinate offset. + * For touch events on the screen, this is the delta that was added to the raw + * screen coordinates to adjust for the absolute position of the containing windows + * and views. */ +//float AMotionEvent_getYOffset(const AInputEvent* motion_event) __NDK_FPABI__; +func (event *MotionEvent) GetYOffset() float32 { + return float32(C.AMotionEvent_getYOffset(event.cptr())) +} + +/* Get the precision of the X coordinates being reported. + * You can multiply this number with an X coordinate sample to find the + * actual hardware value of the X coordinate. */ +//float AMotionEvent_getXPrecision(const AInputEvent* motion_event) __NDK_FPABI__; +func (event *MotionEvent) GetXPrecision() float32 { + return float32(C.AMotionEvent_getXPrecision(event.cptr())) +} + +/* Get the precision of the Y coordinates being reported. + * You can multiply this number with a Y coordinate sample to find the + * actual hardware value of the Y coordinate. */ +//float AMotionEvent_getYPrecision(const AInputEvent* motion_event) __NDK_FPABI__; +func (event *MotionEvent) GetYPrecision() float32 { + return float32(C.AMotionEvent_getYPrecision(event.cptr())) +} + +/* Get the number of pointers of data contained in this event. + * Always >= 1. */ +//size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event); +func (event *MotionEvent) GetPointerCount() int64 { + return int64(C.AMotionEvent_getPointerCount(event.cptr())) +} + +/* Get the pointer identifier associated with a particular pointer + * data index in this event. The identifier tells you the actual pointer + * number associated with the data, accounting for individual pointers + * going up and down since the start of the current gesture. */ +//int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index); +func (event *MotionEvent) GetPointerId(pointer_index int) int { + return int(C.AMotionEvent_getPointerId(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the tool type of a pointer for the given pointer index. + * The tool type indicates the type of tool used to make contact such as a + * finger or stylus, if known. */ +//int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index); +func (event *MotionEvent) GetToolType(pointer_index int) int { + return int(C.AMotionEvent_getToolType(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the original raw X coordinate of this event. + * For touch events on the screen, this is the original location of the event + * on the screen, before it had been adjusted for the containing window + * and views. */ +//float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetRawX(pointer_index int) float32 { + return float32(C.AMotionEvent_getRawX(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the original raw X coordinate of this event. + * For touch events on the screen, this is the original location of the event + * on the screen, before it had been adjusted for the containing window + * and views. */ +//float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetRawY(pointer_index int) float32 { + return float32(C.AMotionEvent_getRawY(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current X coordinate of this event for the given pointer index. + * Whole numbers are pixels; the value may have a fraction for input devices + * that are sub-pixel precise. */ +//float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetX(pointer_index int) float32 { + return float32(C.AMotionEvent_getX(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current Y coordinate of this event for the given pointer index. + * Whole numbers are pixels; the value may have a fraction for input devices + * that are sub-pixel precise. */ +//float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetY(pointer_index int) float32 { + return float32(C.AMotionEvent_getY(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current pressure of this event for the given pointer index. + * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), + * although values higher than 1 may be generated depending on the calibration of + * the input device. */ +//float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetPressure(pointer_index int) float32 { + return float32(C.AMotionEvent_getPressure(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current scaled value of the approximate size for the given pointer index. + * This represents some approximation of the area of the screen being + * pressed; the actual value in pixels corresponding to the + * touch is normalized with the device specific range of values + * and scaled to a value between 0 and 1. The value of size can be used to + * determine fat touch events. */ +//float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetSize(pointer_index int) float32 { + return float32(C.AMotionEvent_getSize(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current length of the major axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index. */ +//float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetTouchMajor(pointer_index int) float32 { + return float32(C.AMotionEvent_getTouchMajor(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current length of the minor axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index. */ +//float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetTouchMinor(pointer_index int) float32 { + return float32(C.AMotionEvent_getTouchMinor(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current length of the major axis of an ellipse that describes the size + * of the approaching tool for the given pointer index. + * The tool area represents the estimated size of the finger or pen that is + * touching the device independent of its actual touch area at the point of contact. */ +//float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetToolMajor(pointer_index int) float32 { + return float32(C.AMotionEvent_getToolMajor(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current length of the minor axis of an ellipse that describes the size + * of the approaching tool for the given pointer index. + * The tool area represents the estimated size of the finger or pen that is + * touching the device independent of its actual touch area at the point of contact. */ +//float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetToolMinor(pointer_index int) float32 { + return float32(C.AMotionEvent_getToolMinor(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the current orientation of the touch area and tool area in radians clockwise from + * vertical for the given pointer index. + * An angle of 0 degrees indicates that the major axis of contact is oriented + * upwards, is perfectly circular or is of unknown orientation. A positive angle + * indicates that the major axis of contact is oriented to the right. A negative angle + * indicates that the major axis of contact is oriented to the left. + * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians + * (finger pointing fully right). */ +//float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetOrientation(pointer_index int) float32 { + return float32(C.AMotionEvent_getOrientation(event.cptr(), C.size_t(pointer_index))) +} + +/* Get the value of the request axis for the given pointer index. */ +//float AMotionEvent_getAxisValue(const AInputEvent* motion_event, +// int32_t axis, size_t pointer_index) __NDK_FPABI__; +func (event *MotionEvent) GetAxisValue(axis, pointer_index int) float32 { + return float32(C.AMotionEvent_getAxisValue(event.cptr(), C.int32_t(axis), C.size_t(pointer_index))) +} + +/* Get the number of historical points in this event. These are movements that + * have occurred between this event and the previous event. This only applies + * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. + * Historical samples are indexed from oldest to newest. */ +//size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event); +func (event *MotionEvent) GetHistorySize() int64 { + return int64(C.AMotionEvent_getHistorySize(event.cptr())) +} + +/* Get the time that a historical movement occurred between this event and + * the previous event, in the java.lang.System.nanoTime() time base. */ +//int64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event, +// size_t history_index); +func (event *MotionEvent) GetHistoricalEventTime(history_index int) int64 { + return int64(C.AMotionEvent_getHistoricalEventTime(event.cptr(), C.size_t(history_index))) +} + +/* Get the historical raw X coordinate of this event for the given pointer index that + * occurred between this event and the previous motion event. + * For touch events on the screen, this is the original location of the event + * on the screen, before it had been adjusted for the containing window + * and views. + * Whole numbers are pixels; the value may have a fraction for input devices + * that are sub-pixel precise. */ +//float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalRawX(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalRawX(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical raw Y coordinate of this event for the given pointer index that + * occurred between this event and the previous motion event. + * For touch events on the screen, this is the original location of the event + * on the screen, before it had been adjusted for the containing window + * and views. + * Whole numbers are pixels; the value may have a fraction for input devices + * that are sub-pixel precise. */ +//float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalRawY(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalRawY(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical X coordinate of this event for the given pointer index that + * occurred between this event and the previous motion event. + * Whole numbers are pixels; the value may have a fraction for input devices + * that are sub-pixel precise. */ +//float AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalX(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalX(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical Y coordinate of this event for the given pointer index that + * occurred between this event and the previous motion event. + * Whole numbers are pixels; the value may have a fraction for input devices + * that are sub-pixel precise. */ +//float AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalY(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalY(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical pressure of this event for the given pointer index that + * occurred between this event and the previous motion event. + * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), + * although values higher than 1 may be generated depending on the calibration of + * the input device. */ +//float AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalPressure(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalPressure(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the current scaled value of the approximate size for the given pointer index that + * occurred between this event and the previous motion event. + * This represents some approximation of the area of the screen being + * pressed; the actual value in pixels corresponding to the + * touch is normalized with the device specific range of values + * and scaled to a value between 0 and 1. The value of size can be used to + * determine fat touch events. */ +//float AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalSize(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalSize(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical length of the major axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index that + * occurred between this event and the previous motion event. */ +//float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalTouchMajor(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalTouchMajor(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical length of the minor axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index that + * occurred between this event and the previous motion event. */ +//float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalTouchMinor(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalTouchMinor(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical length of the major axis of an ellipse that describes the size + * of the approaching tool for the given pointer index that + * occurred between this event and the previous motion event. + * The tool area represents the estimated size of the finger or pen that is + * touching the device independent of its actual touch area at the point of contact. */ +//float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalToolMajor(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalToolMajor(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical length of the minor axis of an ellipse that describes the size + * of the approaching tool for the given pointer index that + * occurred between this event and the previous motion event. + * The tool area represents the estimated size of the finger or pen that is + * touching the device independent of its actual touch area at the point of contact. */ +//float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalToolMinor(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalToolMinor(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical orientation of the touch area and tool area in radians clockwise from + * vertical for the given pointer index that + * occurred between this event and the previous motion event. + * An angle of 0 degrees indicates that the major axis of contact is oriented + * upwards, is perfectly circular or is of unknown orientation. A positive angle + * indicates that the major axis of contact is oriented to the right. A negative angle + * indicates that the major axis of contact is oriented to the left. + * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians + * (finger pointing fully right). */ +//float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index, +// size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalOrientation(pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalOrientation(event.cptr(), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* Get the historical value of the request axis for the given pointer index + * that occurred between this event and the previous motion event. */ +//float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event, +// int32_t axis, size_t pointer_index, size_t history_index) __NDK_FPABI__; +func (event *MotionEvent) GetHistoricalAxisValue(axis, pointer_index, history_index int) float32 { + return float32(C.AMotionEvent_getHistoricalAxisValue(event.cptr(), C.int32_t(axis), C.size_t(pointer_index), C.size_t(history_index))) +} + +/* + * Input queue + * + * An input queue is the facility through which you retrieve input + * events. + */ +type InputQueue C.AInputQueue + +func (queue *InputQueue) cptr() *C.AInputQueue { + return (*C.AInputQueue)(queue) +} + +/* + * Add this input queue to a looper for processing. See + * ALooper_addFd() for information on the ident, callback, and data params. + */ +//void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper, +// int ident, ALooper_callbackFunc callback, void* data); +type callbackParam struct { + callback LooperCallback + data unsafe.Pointer +} + +//export cgoCallback +func cgoCallback(fd, events C.int, data unsafe.Pointer) C.int { + param := (*callbackParam)(data) + return C.int(param.callback(int(fd), int(events), param.data)) +} + +func (queue *InputQueue) AttachLooper(looper *Looper, ident int, callback LooperCallback, data unsafe.Pointer) { + if callback != nil { + C.AInputQueue_attachLooper(queue.cptr(), looper.cptr(), + C.int(ident), (C.ALooper_callbackFunc)(C.cgoCallback), + unsafe.Pointer(&callbackParam{callback, data})) + } else { + C.AInputQueue_attachLooper(queue.cptr(), looper.cptr(), + C.int(ident), nil, data) + } +} + +/* + * Remove the input queue from the looper it is currently attached to. + */ +//void AInputQueue_detachLooper(AInputQueue* queue); +func (queue *InputQueue) DetachLooper() { + C.AInputQueue_detachLooper(queue.cptr()) +} + +/* + * Returns true if there are one or more events available in the + * input queue. Returns 1 if the queue has events; 0 if + * it does not have events; and a negative value if there is an error. + */ +//int32_t AInputQueue_hasEvents(AInputQueue* queue); +func (queue *InputQueue) HasEvents() bool { + return 1 == C.AInputQueue_hasEvents(queue.cptr()) +} + +/* + * Returns the next available event from the queue. Returns a negative + * value if no events are available or an error has occurred. + */ +//int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent); +func (queue *InputQueue) GetEvent() *InputEvent { + var outEvent *C.AInputEvent + if C.AInputQueue_getEvent(queue.cptr(), &outEvent) >= 0 { + return (*InputEvent)(outEvent) + } + return nil +} + +/* + * Sends the key for standard pre-dispatching -- that is, possibly deliver + * it to the current IME to be consumed before the ndk. Returns 0 if it + * was not pre-dispatched, meaning you can process it right now. If non-zero + * is returned, you must abandon the current event processing and allow the + * event to appear again in the event queue (if it does not get consumed during + * pre-dispatching). + */ +//int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event); +func (queue *InputQueue) PreDispatchEvent(event *InputEvent) bool { + return 0 != C.AInputQueue_preDispatchEvent(queue.cptr(), event.cptr()) +} + +/* + * Report that dispatching has finished with the given event. + * This must be called after receiving an event with AInputQueue_get_event(). + */ +//void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled); +func (queue *InputQueue) FinishEvent(event *InputEvent, handled int) { + C.AInputQueue_finishEvent(queue.cptr(), event.cptr(), C.int(handled)) +} diff --git a/ndk/keycodes.go b/ndk/keycodes.go new file mode 100644 index 0000000..077e69d --- /dev/null +++ b/ndk/keycodes.go @@ -0,0 +1,238 @@ +package ndk + +/* +#include +*/ +import "C" + +/* + * Key codes. + */ +const ( + KEYCODE_UNKNOWN = C.AKEYCODE_UNKNOWN + KEYCODE_SOFT_LEFT = C.AKEYCODE_SOFT_LEFT + KEYCODE_SOFT_RIGHT = C.AKEYCODE_SOFT_RIGHT + KEYCODE_HOME = C.AKEYCODE_HOME + KEYCODE_BACK = C.AKEYCODE_BACK + KEYCODE_CALL = C.AKEYCODE_CALL + KEYCODE_ENDCALL = C.AKEYCODE_ENDCALL + KEYCODE_0 = C.AKEYCODE_0 + KEYCODE_1 = C.AKEYCODE_1 + KEYCODE_2 = C.AKEYCODE_2 + KEYCODE_3 = C.AKEYCODE_3 + KEYCODE_4 = C.AKEYCODE_4 + KEYCODE_5 = C.AKEYCODE_5 + KEYCODE_6 = C.AKEYCODE_6 + KEYCODE_7 = C.AKEYCODE_7 + KEYCODE_8 = C.AKEYCODE_8 + KEYCODE_9 = C.AKEYCODE_9 + KEYCODE_STAR = C.AKEYCODE_STAR + KEYCODE_POUND = C.AKEYCODE_POUND + KEYCODE_DPAD_UP = C.AKEYCODE_DPAD_UP + KEYCODE_DPAD_DOWN = C.AKEYCODE_DPAD_DOWN + KEYCODE_DPAD_LEFT = C.AKEYCODE_DPAD_LEFT + KEYCODE_DPAD_RIGHT = C.AKEYCODE_DPAD_RIGHT + KEYCODE_DPAD_CENTER = C.AKEYCODE_DPAD_CENTER + KEYCODE_VOLUME_UP = C.AKEYCODE_VOLUME_UP + KEYCODE_VOLUME_DOWN = C.AKEYCODE_VOLUME_DOWN + KEYCODE_POWER = C.AKEYCODE_POWER + KEYCODE_CAMERA = C.AKEYCODE_CAMERA + KEYCODE_CLEAR = C.AKEYCODE_CLEAR + KEYCODE_A = C.AKEYCODE_A + KEYCODE_B = C.AKEYCODE_B + KEYCODE_C = C.AKEYCODE_C + KEYCODE_D = C.AKEYCODE_D + KEYCODE_E = C.AKEYCODE_E + KEYCODE_F = C.AKEYCODE_F + KEYCODE_G = C.AKEYCODE_G + KEYCODE_H = C.AKEYCODE_H + KEYCODE_I = C.AKEYCODE_I + KEYCODE_J = C.AKEYCODE_J + KEYCODE_K = C.AKEYCODE_K + KEYCODE_L = C.AKEYCODE_L + KEYCODE_M = C.AKEYCODE_M + KEYCODE_N = C.AKEYCODE_N + KEYCODE_O = C.AKEYCODE_O + KEYCODE_P = C.AKEYCODE_P + KEYCODE_Q = C.AKEYCODE_Q + KEYCODE_R = C.AKEYCODE_R + KEYCODE_S = C.AKEYCODE_S + KEYCODE_T = C.AKEYCODE_T + KEYCODE_U = C.AKEYCODE_U + KEYCODE_V = C.AKEYCODE_V + KEYCODE_W = C.AKEYCODE_W + KEYCODE_X = C.AKEYCODE_X + KEYCODE_Y = C.AKEYCODE_Y + KEYCODE_Z = C.AKEYCODE_Z + KEYCODE_COMMA = C.AKEYCODE_COMMA + KEYCODE_PERIOD = C.AKEYCODE_PERIOD + KEYCODE_ALT_LEFT = C.AKEYCODE_ALT_LEFT + KEYCODE_ALT_RIGHT = C.AKEYCODE_ALT_RIGHT + KEYCODE_SHIFT_LEFT = C.AKEYCODE_SHIFT_LEFT + KEYCODE_SHIFT_RIGHT = C.AKEYCODE_SHIFT_RIGHT + KEYCODE_TAB = C.AKEYCODE_TAB + KEYCODE_SPACE = C.AKEYCODE_SPACE + KEYCODE_SYM = C.AKEYCODE_SYM + KEYCODE_EXPLORER = C.AKEYCODE_EXPLORER + KEYCODE_ENVELOPE = C.AKEYCODE_ENVELOPE + KEYCODE_ENTER = C.AKEYCODE_ENTER + KEYCODE_DEL = C.AKEYCODE_DEL + KEYCODE_GRAVE = C.AKEYCODE_GRAVE + KEYCODE_MINUS = C.AKEYCODE_MINUS + KEYCODE_EQUALS = C.AKEYCODE_EQUALS + KEYCODE_LEFT_BRACKET = C.AKEYCODE_LEFT_BRACKET + KEYCODE_RIGHT_BRACKET = C.AKEYCODE_RIGHT_BRACKET + KEYCODE_BACKSLASH = C.AKEYCODE_BACKSLASH + KEYCODE_SEMICOLON = C.AKEYCODE_SEMICOLON + KEYCODE_APOSTROPHE = C.AKEYCODE_APOSTROPHE + KEYCODE_SLASH = C.AKEYCODE_SLASH + KEYCODE_AT = C.AKEYCODE_AT + KEYCODE_NUM = C.AKEYCODE_NUM + KEYCODE_HEADSETHOOK = C.AKEYCODE_HEADSETHOOK + KEYCODE_FOCUS = C.AKEYCODE_FOCUS + KEYCODE_PLUS = C.AKEYCODE_PLUS + KEYCODE_MENU = C.AKEYCODE_MENU + KEYCODE_NOTIFICATION = C.AKEYCODE_NOTIFICATION + KEYCODE_SEARCH = C.AKEYCODE_SEARCH + KEYCODE_MEDIA_PLAY_PAUSE = C.AKEYCODE_MEDIA_PLAY_PAUSE + KEYCODE_MEDIA_STOP = C.AKEYCODE_MEDIA_STOP + KEYCODE_MEDIA_NEXT = C.AKEYCODE_MEDIA_NEXT + KEYCODE_MEDIA_PREVIOUS = C.AKEYCODE_MEDIA_PREVIOUS + KEYCODE_MEDIA_REWIND = C.AKEYCODE_MEDIA_REWIND + KEYCODE_MEDIA_FAST_FORWARD = C.AKEYCODE_MEDIA_FAST_FORWARD + KEYCODE_MUTE = C.AKEYCODE_MUTE + KEYCODE_PAGE_UP = C.AKEYCODE_PAGE_UP + KEYCODE_PAGE_DOWN = C.AKEYCODE_PAGE_DOWN + KEYCODE_PICTSYMBOLS = C.AKEYCODE_PICTSYMBOLS + KEYCODE_SWITCH_CHARSET = C.AKEYCODE_SWITCH_CHARSET + KEYCODE_BUTTON_A = C.AKEYCODE_BUTTON_A + KEYCODE_BUTTON_B = C.AKEYCODE_BUTTON_B + KEYCODE_BUTTON_C = C.AKEYCODE_BUTTON_C + KEYCODE_BUTTON_X = C.AKEYCODE_BUTTON_X + KEYCODE_BUTTON_Y = C.AKEYCODE_BUTTON_Y + KEYCODE_BUTTON_Z = C.AKEYCODE_BUTTON_Z + KEYCODE_BUTTON_L1 = C.AKEYCODE_BUTTON_L1 + KEYCODE_BUTTON_R1 = C.AKEYCODE_BUTTON_R1 + KEYCODE_BUTTON_L2 = C.AKEYCODE_BUTTON_L2 + KEYCODE_BUTTON_R2 = C.AKEYCODE_BUTTON_R2 + KEYCODE_BUTTON_THUMBL = C.AKEYCODE_BUTTON_THUMBL + KEYCODE_BUTTON_THUMBR = C.AKEYCODE_BUTTON_THUMBR + KEYCODE_BUTTON_START = C.AKEYCODE_BUTTON_START + KEYCODE_BUTTON_SELECT = C.AKEYCODE_BUTTON_SELECT + KEYCODE_BUTTON_MODE = C.AKEYCODE_BUTTON_MODE + KEYCODE_ESCAPE = C.AKEYCODE_ESCAPE + KEYCODE_FORWARD_DEL = C.AKEYCODE_FORWARD_DEL + KEYCODE_CTRL_LEFT = C.AKEYCODE_CTRL_LEFT + KEYCODE_CTRL_RIGHT = C.AKEYCODE_CTRL_RIGHT + KEYCODE_CAPS_LOCK = C.AKEYCODE_CAPS_LOCK + KEYCODE_SCROLL_LOCK = C.AKEYCODE_SCROLL_LOCK + KEYCODE_META_LEFT = C.AKEYCODE_META_LEFT + KEYCODE_META_RIGHT = C.AKEYCODE_META_RIGHT + KEYCODE_FUNCTION = C.AKEYCODE_FUNCTION + KEYCODE_SYSRQ = C.AKEYCODE_SYSRQ + KEYCODE_BREAK = C.AKEYCODE_BREAK + KEYCODE_MOVE_HOME = C.AKEYCODE_MOVE_HOME + KEYCODE_MOVE_END = C.AKEYCODE_MOVE_END + KEYCODE_INSERT = C.AKEYCODE_INSERT + KEYCODE_FORWARD = C.AKEYCODE_FORWARD + KEYCODE_MEDIA_PLAY = C.AKEYCODE_MEDIA_PLAY + KEYCODE_MEDIA_PAUSE = C.AKEYCODE_MEDIA_PAUSE + KEYCODE_MEDIA_CLOSE = C.AKEYCODE_MEDIA_CLOSE + KEYCODE_MEDIA_EJECT = C.AKEYCODE_MEDIA_EJECT + KEYCODE_MEDIA_RECORD = C.AKEYCODE_MEDIA_RECORD + KEYCODE_F1 = C.AKEYCODE_F1 + KEYCODE_F2 = C.AKEYCODE_F2 + KEYCODE_F3 = C.AKEYCODE_F3 + KEYCODE_F4 = C.AKEYCODE_F4 + KEYCODE_F5 = C.AKEYCODE_F5 + KEYCODE_F6 = C.AKEYCODE_F6 + KEYCODE_F7 = C.AKEYCODE_F7 + KEYCODE_F8 = C.AKEYCODE_F8 + KEYCODE_F9 = C.AKEYCODE_F9 + KEYCODE_F10 = C.AKEYCODE_F10 + KEYCODE_F11 = C.AKEYCODE_F11 + KEYCODE_F12 = C.AKEYCODE_F12 + KEYCODE_NUM_LOCK = C.AKEYCODE_NUM_LOCK + KEYCODE_NUMPAD_0 = C.AKEYCODE_NUMPAD_0 + KEYCODE_NUMPAD_1 = C.AKEYCODE_NUMPAD_1 + KEYCODE_NUMPAD_2 = C.AKEYCODE_NUMPAD_2 + KEYCODE_NUMPAD_3 = C.AKEYCODE_NUMPAD_3 + KEYCODE_NUMPAD_4 = C.AKEYCODE_NUMPAD_4 + KEYCODE_NUMPAD_5 = C.AKEYCODE_NUMPAD_5 + KEYCODE_NUMPAD_6 = C.AKEYCODE_NUMPAD_6 + KEYCODE_NUMPAD_7 = C.AKEYCODE_NUMPAD_7 + KEYCODE_NUMPAD_8 = C.AKEYCODE_NUMPAD_8 + KEYCODE_NUMPAD_9 = C.AKEYCODE_NUMPAD_9 + KEYCODE_NUMPAD_DIVIDE = C.AKEYCODE_NUMPAD_DIVIDE + KEYCODE_NUMPAD_MULTIPLY = C.AKEYCODE_NUMPAD_MULTIPLY + KEYCODE_NUMPAD_SUBTRACT = C.AKEYCODE_NUMPAD_SUBTRACT + KEYCODE_NUMPAD_ADD = C.AKEYCODE_NUMPAD_ADD + KEYCODE_NUMPAD_DOT = C.AKEYCODE_NUMPAD_DOT + KEYCODE_NUMPAD_COMMA = C.AKEYCODE_NUMPAD_COMMA + KEYCODE_NUMPAD_ENTER = C.AKEYCODE_NUMPAD_ENTER + KEYCODE_NUMPAD_EQUALS = C.AKEYCODE_NUMPAD_EQUALS + KEYCODE_NUMPAD_LEFT_PAREN = C.AKEYCODE_NUMPAD_LEFT_PAREN + KEYCODE_NUMPAD_RIGHT_PAREN = C.AKEYCODE_NUMPAD_RIGHT_PAREN + KEYCODE_VOLUME_MUTE = C.AKEYCODE_VOLUME_MUTE + KEYCODE_INFO = C.AKEYCODE_INFO + KEYCODE_CHANNEL_UP = C.AKEYCODE_CHANNEL_UP + KEYCODE_CHANNEL_DOWN = C.AKEYCODE_CHANNEL_DOWN + KEYCODE_ZOOM_IN = C.AKEYCODE_ZOOM_IN + KEYCODE_ZOOM_OUT = C.AKEYCODE_ZOOM_OUT + KEYCODE_TV = C.AKEYCODE_TV + KEYCODE_WINDOW = C.AKEYCODE_WINDOW + KEYCODE_GUIDE = C.AKEYCODE_GUIDE + KEYCODE_DVR = C.AKEYCODE_DVR + KEYCODE_BOOKMARK = C.AKEYCODE_BOOKMARK + KEYCODE_CAPTIONS = C.AKEYCODE_CAPTIONS + KEYCODE_SETTINGS = C.AKEYCODE_SETTINGS + KEYCODE_TV_POWER = C.AKEYCODE_TV_POWER + KEYCODE_TV_INPUT = C.AKEYCODE_TV_INPUT + KEYCODE_STB_POWER = C.AKEYCODE_STB_POWER + KEYCODE_STB_INPUT = C.AKEYCODE_STB_INPUT + KEYCODE_AVR_POWER = C.AKEYCODE_AVR_POWER + KEYCODE_AVR_INPUT = C.AKEYCODE_AVR_INPUT + KEYCODE_PROG_RED = C.AKEYCODE_PROG_RED + KEYCODE_PROG_GREEN = C.AKEYCODE_PROG_GREEN + KEYCODE_PROG_YELLOW = C.AKEYCODE_PROG_YELLOW + KEYCODE_PROG_BLUE = C.AKEYCODE_PROG_BLUE + KEYCODE_APP_SWITCH = C.AKEYCODE_APP_SWITCH + KEYCODE_BUTTON_1 = C.AKEYCODE_BUTTON_1 + KEYCODE_BUTTON_2 = C.AKEYCODE_BUTTON_2 + KEYCODE_BUTTON_3 = C.AKEYCODE_BUTTON_3 + KEYCODE_BUTTON_4 = C.AKEYCODE_BUTTON_4 + KEYCODE_BUTTON_5 = C.AKEYCODE_BUTTON_5 + KEYCODE_BUTTON_6 = C.AKEYCODE_BUTTON_6 + KEYCODE_BUTTON_7 = C.AKEYCODE_BUTTON_7 + KEYCODE_BUTTON_8 = C.AKEYCODE_BUTTON_8 + KEYCODE_BUTTON_9 = C.AKEYCODE_BUTTON_9 + KEYCODE_BUTTON_10 = C.AKEYCODE_BUTTON_10 + KEYCODE_BUTTON_11 = C.AKEYCODE_BUTTON_11 + KEYCODE_BUTTON_12 = C.AKEYCODE_BUTTON_12 + KEYCODE_BUTTON_13 = C.AKEYCODE_BUTTON_13 + KEYCODE_BUTTON_14 = C.AKEYCODE_BUTTON_14 + KEYCODE_BUTTON_15 = C.AKEYCODE_BUTTON_15 + KEYCODE_BUTTON_16 = C.AKEYCODE_BUTTON_16 + KEYCODE_LANGUAGE_SWITCH = C.AKEYCODE_LANGUAGE_SWITCH + KEYCODE_MANNER_MODE = C.AKEYCODE_MANNER_MODE + KEYCODE_3D_MODE = C.AKEYCODE_3D_MODE + KEYCODE_CONTACTS = C.AKEYCODE_CONTACTS + KEYCODE_CALENDAR = C.AKEYCODE_CALENDAR + KEYCODE_MUSIC = C.AKEYCODE_MUSIC + KEYCODE_CALCULATOR = C.AKEYCODE_CALCULATOR + KEYCODE_ZENKAKU_HANKAKU = C.AKEYCODE_ZENKAKU_HANKAKU + KEYCODE_EISU = C.AKEYCODE_EISU + KEYCODE_MUHENKAN = C.AKEYCODE_MUHENKAN + KEYCODE_HENKAN = C.AKEYCODE_HENKAN + KEYCODE_KATAKANA_HIRAGANA = C.AKEYCODE_KATAKANA_HIRAGANA + KEYCODE_YEN = C.AKEYCODE_YEN + KEYCODE_RO = C.AKEYCODE_RO + KEYCODE_KANA = C.AKEYCODE_KANA + KEYCODE_ASSIST = C.AKEYCODE_ASSIST + KEYCODE_BRIGHTNESS_DOWN = C.AKEYCODE_BRIGHTNESS_DOWN + KEYCODE_BRIGHTNESS_UP = C.AKEYCODE_BRIGHTNESS_UP + KEYCODE_MEDIA_AUDIO_TRACK = C.AKEYCODE_MEDIA_AUDIO_TRACK + + // NOTE: If you add a new keycode here you must also add it to several other files. + // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list. +) diff --git a/ndk/library.go b/ndk/library.go new file mode 100644 index 0000000..99c7629 --- /dev/null +++ b/ndk/library.go @@ -0,0 +1,68 @@ +package ndk + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "strings" +) + +func GetPackageName() string { + smapsName := fmt.Sprint("/proc/", os.Getpid(), "/cmdline") + b, err := os.ReadFile(smapsName) + if err != nil { + return "" + } + i := bytes.Index(b, []byte{0}) + if i >= 0 { + b = b[:i] + } + return string(b) +} + +func GetLibraryPath() string { + smapsName := fmt.Sprint("/proc/", os.Getpid(), "/smaps") + b, err := os.ReadFile(smapsName) + if err != nil { + return "" + } + + for { + base := []byte("/data/") + i := bytes.Index(b, base) + if i < 0 { + break + } + j := bytes.Index(b[i:], []byte("\n")) + if j < 0 { + break + } + path := string(b[i : i+j]) + if strings.HasSuffix(path, ".so") { + return filepath.Dir(path) + } + + b = b[i+j:] + } + return "" +} + +func FindMatchLibrary(pattern string) []string { + paths := os.Getenv("LD_LIBRARY_PATH") + if paths == "" { + paths = "/system/lib" + } + dirs := strings.Split(paths, ":") + dirs = append([]string{GetLibraryPath()}, dirs...) + for _, dir := range dirs { + fns, err := filepath.Glob(filepath.Join(dir, pattern)) + if err != nil { + Info("FindMatchLibrary:", err) + } + if len(fns) > 0 { + return fns + } + } + return nil +} diff --git a/ndk/looper.go b/ndk/looper.go new file mode 100644 index 0000000..539205a --- /dev/null +++ b/ndk/looper.go @@ -0,0 +1,252 @@ +package ndk + +/* +#include +extern int cgoLooperCallback(int fd, int events, void* data); +*/ +import "C" + +import "unsafe" + +const ( + /** + * Option for ALooper_prepare: this looper will accept calls to + * ALooper_addFd() that do not have a callback (that is provide NULL + * for the callback). In this case the caller of ALooper_pollOnce() + * or ALooper_pollAll() MUST check the return from these functions to + * discover when data is available on such fds and process it. + */ + LOOPER_PREPARE_ALLOW_NON_CALLBACKS = C.ALOOPER_PREPARE_ALLOW_NON_CALLBACKS +) + +/** + * Prepares a looper associated with the calling thread, and returns it. + * If the thread already has a looper, it is returned. Otherwise, a new + * one is created, associated with the thread, and returned. + * + * The opts may be ALOOPER_PREPARE_ALLOW_NON_CALLBACKS or 0. + */ +func LooperPrepare(opts int) (looper *Looper) { + return (*Looper)(C.ALooper_prepare(C.int(opts))) +} + +const ( + /** + * Result from ALooper_pollOnce() and ALooper_pollAll(): + * The poll was awoken using wake() before the timeout expired + * and no callbacks were executed and no other file descriptors were ready. + */ + LOOPER_POLL_WAKE = C.ALOOPER_POLL_WAKE + + /** + * Result from ALooper_pollOnce() and ALooper_pollAll(): + * One or more callbacks were executed. + */ + LOOPER_POLL_CALLBACK = C.ALOOPER_POLL_CALLBACK + + /** + * Result from ALooper_pollOnce() and ALooper_pollAll(): + * The timeout expired. + */ + LOOPER_POLL_TIMEOUT = C.ALOOPER_POLL_TIMEOUT + + /** + * Result from ALooper_pollOnce() and ALooper_pollAll(): + * An error occurred. + */ + LOOPER_POLL_ERROR = C.ALOOPER_POLL_ERROR +) + +type Looper C.ALooper + +func (looper *Looper) cptr() *C.ALooper { + return (*C.ALooper)(looper) +} + +/** + * Acquire a reference on the given ALooper object. This prevents the object + * from being deleted until the reference is removed. This is only needed + * to safely hand an ALooper from one thread to another. + */ +func (looper *Looper) Acquire() { + C.ALooper_acquire(looper.cptr()) +} + +/** + * Remove a reference that was previously acquired with ALooper_acquire(). + */ +func (looper *Looper) Release() { + C.ALooper_release(looper.cptr()) +} + +/** + * Flags for file descriptor events that a looper can monitor. + * + * These flag bits can be combined to monitor multiple events at once. + */ + +const ( + /** + * The file descriptor is available for read operations. + */ + LOOPER_EVENT_INPUT = C.ALOOPER_EVENT_INPUT + + /** + * The file descriptor is available for write operations. + */ + LOOPER_EVENT_OUTPUT = C.ALOOPER_EVENT_OUTPUT + + /** + * The file descriptor has encountered an error condition. + * + * The looper always sends notifications about errors; it is not necessary + * to specify this event flag in the requested event set. + */ + LOOPER_EVENT_ERROR = C.ALOOPER_EVENT_ERROR + + /** + * The file descriptor was hung up. + * For example, indicates that the remote end of a pipe or socket was closed. + * + * The looper always sends notifications about hangups; it is not necessary + * to specify this event flag in the requested event set. + */ + LOOPER_EVENT_HANGUP = C.ALOOPER_EVENT_HANGUP + + /** + * The file descriptor is invalid. + * For example, the file descriptor was closed prematurely. + * + * The looper always sends notifications about invalid file descriptors; it is not necessary + * to specify this event flag in the requested event set. + */ + LOOPER_EVENT_INVALID = C.ALOOPER_EVENT_INVALID +) + +/** + * For callback-based event loops, this is the prototype of the function + * that is called when a file descriptor event occurs. + * It is given the file descriptor it is associated with, + * a bitmask of the poll events that were triggered (typically ALOOPER_EVENT_INPUT), + * and the data pointer that was originally supplied. + * + * Implementations should return 1 to continue receiving callbacks, or 0 + * to have this file descriptor and callback unregistered from the looper. + */ +///typedef int (*ALooper_callbackFunc)(int fd, int events, void* data); +type LooperCallback func(fd, events int, data unsafe.Pointer) int + +/** + * Waits for events to be available, with optional timeout in milliseconds. + * Invokes callbacks for all file descriptors on which an event occurred. + * + * If the timeout is zero, returns immediately without blocking. + * If the timeout is negative, waits indefinitely until an event appears. + * + * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before + * the timeout expired and no callbacks were invoked and no other file + * descriptors were ready. + * + * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked. + * + * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given + * timeout expired. + * + * Returns ALOOPER_POLL_ERROR if an error occurred. + * + * Returns a value >= 0 containing an identifier if its file descriptor has data + * and it has no callback function (requiring the caller here to handle it). + * In this (and only this) case outFd, outEvents and outData will contain the poll + * events and data associated with the fd, otherwise they will be set to NULL. + * + * This method does not return until it has finished invoking the appropriate callbacks + * for all file descriptors that were signalled. + */ +func LooperPollOnce(timeoutMillis int) (ident, outFD, outEvents int, outData uintptr) { + var coutFd, coutEvents C.int + var coutData unsafe.Pointer + cret := C.ALooper_pollOnce(C.int(timeoutMillis), &coutFd, &coutEvents, &coutData) + return int(cret), int(coutFd), int(coutEvents), uintptr(coutData) +} + +/** + * Wakes the poll asynchronously. + * + * This method can be called on any thread. + * This method returns immediately. + */ +func (looper *Looper) Wake() { + C.ALooper_wake(looper.cptr()) +} + +/** + * Adds a new file descriptor to be polled by the looper. + * If the same file descriptor was previously added, it is replaced. + * + * "fd" is the file descriptor to be added. + * "ident" is an identifier for this event, which is returned from ALooper_pollOnce(). + * The identifier must be >= 0, or ALOOPER_POLL_CALLBACK if providing a non-NULL callback. + * "events" are the poll events to wake up on. Typically this is ALOOPER_EVENT_INPUT. + * "callback" is the function to call when there is an event on the file descriptor. + * "data" is a private data pointer to supply to the callback. + * + * There are two main uses of this function: + * + * (1) If "callback" is non-NULL, then this function will be called when there is + * data on the file descriptor. It should execute any events it has pending, + * appropriately reading from the file descriptor. The 'ident' is ignored in this case. + * + * (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce + * when its file descriptor has data available, requiring the caller to take + * care of processing it. + * + * Returns 1 if the file descriptor was added or -1 if an error occurred. + * + * This method can be called on any thread. + * This method may block briefly if it needs to wake the poll. + */ +///int ALooper_addFd(ALooper* looper, int fd, int ident, int events, +/// ALooper_callbackFunc callback, void* data); +//export cgoLooperCallback +func cgoLooperCallback(fd, events C.int, data unsafe.Pointer) C.int { + d := (*looperData)(data) + return C.int(d.callback(int(fd), int(events), d.data)) +} + +type looperData struct { + callback LooperCallback + data unsafe.Pointer +} + +func (looper *Looper) AddFd(fd, ident, events int, + callback LooperCallback, data unsafe.Pointer) int { + if callback == nil { + return int(C.ALooper_addFd(looper.cptr(), C.int(fd), C.int(ident), C.int(events), + nil, data)) + } else { + return int(C.ALooper_addFd(looper.cptr(), C.int(fd), C.int(ident), C.int(events), + (*[0]byte)(C.cgoLooperCallback), unsafe.Pointer(&looperData{callback: callback, data: data}))) + } +} + +/** + * Removes a previously added file descriptor from the looper. + * + * When this method returns, it is safe to close the file descriptor since the looper + * will no longer have a reference to it. However, it is possible for the callback to + * already be running or for it to run one last time if the file descriptor was already + * signalled. Calling code is responsible for ensuring that this case is safely handled. + * For example, if the callback takes care of removing itself during its own execution either + * by returning 0 or by calling this method, then it can be guaranteed to not be invoked + * again at any later time unless registered anew. + * + * Returns 1 if the file descriptor was removed, 0 if none was previously registered + * or -1 if an error occurred. + * + * This method can be called on any thread. + * This method may block briefly if it needs to wake the poll. + */ +///int ALooper_removeFd(ALooper* looper, int fd); +func (looper *Looper) RemoveFd(fd int) int { + return int(C.ALooper_removeFd(looper.cptr(), C.int(fd))) +} diff --git a/ndk/obb.go b/ndk/obb.go new file mode 100644 index 0000000..1384643 --- /dev/null +++ b/ndk/obb.go @@ -0,0 +1,56 @@ +package ndk + +/* +#include +*/ +import "C" +import "unsafe" + +type ObbInfo C.AObbInfo + +func (info *ObbInfo) cptr() *C.AObbInfo { + return (*C.AObbInfo)(info) +} + +const AOBBINFO_OVERLAY = 0x0001 + +/** + * Scan an OBB and get information about it. + */ +//AObbInfo* AObbScanner_getObbInfo(const char* filename); +func GetObbInfo(filename string) *ObbInfo { + cfilename := []byte(filename + "\000") + return (*ObbInfo)(C.AObbScanner_getObbInfo((*C.char)(unsafe.Pointer(&cfilename[0])))) +} + +/** + * Destroy the AObbInfo object. You must call this when finished with the object. + */ +//void AObbInfo_delete(AObbInfo* obbInfo); +func (info *ObbInfo) Delete() { + C.AObbInfo_delete(info.cptr()) +} + +/** + * Get the package name for the OBB. + */ +//const char* AObbInfo_getPackageName(AObbInfo* obbInfo); +func (info *ObbInfo) GetPackageName() string { + return C.GoString(C.AObbInfo_getPackageName(info.cptr())) +} + +/** + * Get the version of an OBB file. + */ +//int32_t AObbInfo_getVersion(AObbInfo* obbInfo); +func (info *ObbInfo) GetVersion() int { + return int(C.AObbInfo_getVersion(info.cptr())) +} + +/** + * Get the flags of an OBB file. + */ +//int32_t AObbInfo_getFlags(AObbInfo* obbInfo); +func (info *ObbInfo) GetFlags() int { + return int(C.AObbInfo_getFlags(info.cptr())) +} diff --git a/ndk/properties.go b/ndk/properties.go new file mode 100644 index 0000000..593c44d --- /dev/null +++ b/ndk/properties.go @@ -0,0 +1,42 @@ +package ndk + +/* +#include +#include +*/ +import "C" + +import ( + "unsafe" +) + +const ( + PROP_NAME_MAX = C.PROP_NAME_MAX + PROP_VALUE_MAX = C.PROP_VALUE_MAX +) + +func PropGet(k string) string { + var value [PROP_VALUE_MAX]C.char + key := C.CString(k) + defer C.free(unsafe.Pointer(key)) + n := C.__system_property_get((*C.char)(key), &value[0]) + if n > 0 { + return C.GoString(&value[0]) + } + return "" +} + +func PropVisit(cb func(k, v string)) { + var name [PROP_NAME_MAX]C.char + var value [PROP_VALUE_MAX]C.char + var pi *C.prop_info + + for n := 0; ; n++ { + pi = C.__system_property_find_nth(C.uint(n)) + if pi == nil { + break + } + C.__system_property_read(pi, &name[0], &value[0]) + cb(C.GoString(&name[0]), C.GoString(&value[0])) + } +} diff --git a/ndk/rect.go b/ndk/rect.go new file mode 100644 index 0000000..2a07d44 --- /dev/null +++ b/ndk/rect.go @@ -0,0 +1,22 @@ +package ndk + +/* +#include +*/ +import "C" + +// import "unsafe" +type Rect C.ARect + +func (rc *Rect) cptr() *C.ARect { + return (*C.ARect)(rc) +} + +func NewRect(l, t, r, b int) Rect { + var rc Rect + rc.left = C.int32_t(l) + rc.top = C.int32_t(t) + rc.right = C.int32_t(r) + rc.bottom = C.int32_t(b) + return rc +} diff --git a/ndk/sensor.go b/ndk/sensor.go new file mode 100644 index 0000000..29cee00 --- /dev/null +++ b/ndk/sensor.go @@ -0,0 +1,758 @@ +package ndk + +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* +#include +extern int cgoCallback(int fd, int events, void* data); +static void* ASensorEvent_getDatas(ASensorEvent* event) { + return &(event->data[0]); +} +*/ +import "C" + +import ( + "bytes" + "encoding/binary" + "fmt" + "math" + "time" + "unsafe" +) + +/****************************************************************** + * + * IMPORTANT NOTICE: + * + * This file is part of Android's set of stable system headers + * exposed by the Android NDK (Native Development Kit). + * + * Third-party source AND binary code relies on the definitions + * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. + * + * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) + * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS + * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY + * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES + */ + +/** + * Structures and functions to receive and process sensor events in + * native code. + * + */ + +type HardwareBuffer C.AHardwareBuffer + +// const RESOLUTION_INVALID = C.ASENSOR_RESOLUTION_INVALID //(nanf("")) +const SENSOR_FIFO_COUNT_INVALID = C.ASENSOR_FIFO_COUNT_INVALID //(-1) +const SENSOR_DELAY_INVALID = C.ASENSOR_DELAY_INVALID //INT32_MIN + +/** + * Sensor types. + * (keep in sync with hardware/sensors.h) + */ +type SENSOR_TYPE int32 + +const ( + /** + * Invalid sensor type. Returned by {@link ASensor_getType} as error value. + */ + SENSOR_TYPE_INVALID = SENSOR_TYPE(C.ASENSOR_TYPE_INVALID) + /** + * {@link ASENSOR_TYPE_ACCELEROMETER} + * reporting-mode: continuous + * + * All values are in SI units (m/s^2) and measure the acceleration of the + * device minus the force of gravity. + */ + SENSOR_TYPE_ACCELEROMETER = SENSOR_TYPE(C.ASENSOR_TYPE_ACCELEROMETER) + /** + * {@link ASENSOR_TYPE_MAGNETIC_FIELD} + * reporting-mode: continuous + * + * All values are in micro-Tesla (uT) and measure the geomagnetic + * field in the X, Y and Z axis. + */ + SENSOR_TYPE_MAGNETIC_FIELD = SENSOR_TYPE(C.ASENSOR_TYPE_MAGNETIC_FIELD) + /** + * {@link ASENSOR_TYPE_GYROSCOPE} + * reporting-mode: continuous + * + * All values are in radians/second and measure the rate of rotation + * around the X, Y and Z axis. + */ + SENSOR_TYPE_GYROSCOPE = SENSOR_TYPE(C.ASENSOR_TYPE_GYROSCOPE) + /** + * {@link ASENSOR_TYPE_LIGHT} + * reporting-mode: on-change + * + * The light sensor value is returned in SI lux units. + */ + SENSOR_TYPE_LIGHT = SENSOR_TYPE(C.ASENSOR_TYPE_LIGHT) + /** + * {@link ASENSOR_TYPE_PROXIMITY} + * reporting-mode: on-change + * + * The proximity sensor which turns the screen off and back on during calls is the + * wake-up proximity sensor. Implement wake-up proximity sensor before implementing + * a non wake-up proximity sensor. For the wake-up proximity sensor set the flag + * SENSOR_FLAG_WAKE_UP. + * The value corresponds to the distance to the nearest object in centimeters. + */ + SENSOR_TYPE_PROXIMITY = SENSOR_TYPE(C.ASENSOR_TYPE_PROXIMITY) + /** + * {@link ASENSOR_TYPE_LINEAR_ACCELERATION} + * reporting-mode: continuous + * + * All values are in SI units (m/s^2) and measure the acceleration of the + * device not including the force of gravity. + */ + SENSOR_TYPE_LINEAR_ACCELERATION = SENSOR_TYPE(C.ASENSOR_TYPE_LINEAR_ACCELERATION) + + // java + SENSOR_TYPE_ORIENTATION = SENSOR_TYPE(3) + SENSOR_TYPE_PRESSURE = SENSOR_TYPE(6) + SENSOR_TYPE_TEMPERATURE = SENSOR_TYPE(7) + SENSOR_TYPE_GRAVITY = SENSOR_TYPE(9) + SENSOR_TYPE_ROTATION_VECTOR = SENSOR_TYPE(11) + SENSOR_TYPE_RELATIVE_HUMIDITY = SENSOR_TYPE(12) + SENSOR_TYPE_AMBIENT_TEMPERATURE = SENSOR_TYPE(13) + SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = SENSOR_TYPE(14) + SENSOR_TYPE_GAME_ROTATION_VECTOR = SENSOR_TYPE(15) + SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = SENSOR_TYPE(16) + SENSOR_TYPE_SIGNIFICANT_MOTION = SENSOR_TYPE(17) + SENSOR_TYPE_STEP_DETECTOR = SENSOR_TYPE(18) + SENSOR_TYPE_STEP_COUNTER = SENSOR_TYPE(19) + SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = SENSOR_TYPE(20) + SENSOR_TYPE_HEART_RATE = SENSOR_TYPE(21) + SENSOR_TYPE_TILT_DETECTOR = SENSOR_TYPE(22) + SENSOR_TYPE_WAKE_GESTURE = SENSOR_TYPE(23) + SENSOR_TYPE_GLANCE_GESTURE = SENSOR_TYPE(24) + SENSOR_TYPE_PICK_UP_GESTURE = SENSOR_TYPE(25) + SENSOR_TYPE_WRIST_TILT_GESTURE = SENSOR_TYPE(26) + SENSOR_TYPE_DEVICE_ORIENTATION = SENSOR_TYPE(27) + SENSOR_TYPE_POSE_6DOF = SENSOR_TYPE(28) + SENSOR_TYPE_STATIONARY_DETECT = SENSOR_TYPE(29) + SENSOR_TYPE_MOTION_DETECT = SENSOR_TYPE(30) + SENSOR_TYPE_HEART_BEAT = SENSOR_TYPE(31) + SENSOR_TYPE_DYNAMIC_SENSOR_META = SENSOR_TYPE(32) + SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT = SENSOR_TYPE(34) + SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = SENSOR_TYPE(35) +) + +/** + * Sensor accuracy measure. + */ +const ( + /** no contact */ + SENSOR_STATUS_NO_CONTACT = C.ASENSOR_STATUS_NO_CONTACT + /** unreliable */ + SENSOR_STATUS_UNRELIABLE = C.ASENSOR_STATUS_UNRELIABLE + /** low accuracy */ + SENSOR_STATUS_ACCURACY_LOW = C.ASENSOR_STATUS_ACCURACY_LOW + /** medium accuracy */ + SENSOR_STATUS_ACCURACY_MEDIUM = C.ASENSOR_STATUS_ACCURACY_MEDIUM + /** high accuracy */ + SENSOR_STATUS_ACCURACY_HIGH = C.ASENSOR_STATUS_ACCURACY_HIGH +) + +/** + * Sensor Reporting Modes. + */ +const ( + /** invalid reporting mode */ + REPORTING_MODE_INVALID = C.AREPORTING_MODE_INVALID + /** continuous reporting */ + REPORTING_MODE_CONTINUOUS = C.AREPORTING_MODE_CONTINUOUS + /** reporting on change */ + REPORTING_MODE_ON_CHANGE = C.AREPORTING_MODE_ON_CHANGE + /** on shot reporting */ + REPORTING_MODE_ONE_SHOT = C.AREPORTING_MODE_ONE_SHOT + /** special trigger reporting */ + REPORTING_MODE_SPECIAL_TRIGGER = C.AREPORTING_MODE_SPECIAL_TRIGGER +) + +/** + * Sensor Direct Report Rates. + */ +const ( + /** stopped */ + SENSOR_DIRECT_RATE_STOP = C.ASENSOR_DIRECT_RATE_STOP + /** nominal 50Hz */ + SENSOR_DIRECT_RATE_NORMAL = C.ASENSOR_DIRECT_RATE_NORMAL + /** nominal 200Hz */ + SENSOR_DIRECT_RATE_FAST = C.ASENSOR_DIRECT_RATE_FAST + /** nominal 800Hz */ + SENSOR_DIRECT_RATE_VERY_FAST = C.ASENSOR_DIRECT_RATE_VERY_FAST +) + +/** + * Sensor Direct Channel Type. + */ +const ( + /** shared memory created by ASharedMemory_create */ + SENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY = C.ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY + /** AHardwareBuffer */ + SENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER = C.ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER +) + +/* + * A few useful constants + */ + +/** Earth's gravity in m/s^2 */ +const SENSOR_STANDARD_GRAVITY = C.ASENSOR_STANDARD_GRAVITY //(9.80665f) +/** Maximum magnetic field on Earth's surface in uT */ +const SENSOR_MAGNETIC_FIELD_EARTH_MAX = C.ASENSOR_MAGNETIC_FIELD_EARTH_MAX //(60.0f) +/** Minimum magnetic field on Earth's surface in uT*/ +const SENSOR_MAGNETIC_FIELD_EARTH_MIN = C.ASENSOR_MAGNETIC_FIELD_EARTH_MIN //(30.0f) + +/** + * A sensor event. + */ + +/* NOTE: Must match hardware/sensors.h */ +type SensorVector struct { + X, Y, Z float32 + Status int8 +} +type MagneticVector struct { + Azimuth, Pitch, Roll float32 + Status int8 +} + +type MetaDataEvent struct { + What, Sensor int32 +} + +type UncalibratedEvent struct { + XUncalib, YUncalib, ZUncalib float32 + XBias, YBias, ZBias float32 +} + +type HeartRateEvent struct { + Bpm float32 + Status int8 +} + +type DynamicSensorEvent struct { + Connected, Handle int32 +} + +type AdditionalInfoEvent struct { + Type, Serial int32 + dataInt32 [14]int32 + //DataInt32 [14]int32 + //DataFloat [14]float32 +} + +/* NOTE: Must match hardware/sensors.h */ +type SensorEvent C.ASensorEvent + +/* +typedef struct ASensorEvent { + int32_t version; // sizeof(struct ASensorEvent) + int32_t sensor; + int32_t type; + int32_t reserved0; + int64_t timestamp; + union { + union { + float data[16]; + ASensorVector vector; + ASensorVector acceleration; + ASensorVector magnetic; + float temperature; + float distance; + float light; + float pressure; + float relative_humidity; + AUncalibratedEvent uncalibrated_gyro; + AUncalibratedEvent uncalibrated_magnetic; + AMetaDataEvent meta_data; + AHeartRateEvent heart_rate; + ADynamicSensorEvent dynamic_sensor_meta; + AAdditionalInfoEvent additional_info; + }; + union { + uint64_t data[8]; + uint64_t step_counter; + } u64; + }; + + uint32_t flags; + int32_t reserved1[3]; +} ASensorEvent; +*/ + +/** + * {@link ASensorManager} is an opaque type to manage sensors and + * events queues. + * + * {@link ASensorManager} is a singleton that can be obtained using + * ASensorManager_getInstance(). + * + * This file provides a set of functions that uses {@link + * ASensorManager} to access and list hardware sensors, and + * create and destroy event queues: + * - ASensorManager_getSensorList() + * - ASensorManager_getDefaultSensor() + * - ASensorManager_getDefaultSensorEx() + * - ASensorManager_createEventQueue() + * - ASensorManager_destroyEventQueue() + */ +type SensorManager C.ASensorManager + +func (manager *SensorManager) cptr() *C.ASensorManager { + return (*C.ASensorManager)(manager) +} + +/** + * {@link ASensorEventQueue} is an opaque type that provides access to + * {@link ASensorEvent} from hardware sensors. + * + * A new {@link ASensorEventQueue} can be obtained using ASensorManager_createEventQueue(). + * + * This file provides a set of functions to enable and disable + * sensors, check and get events, and set event rates on a {@link + * ASensorEventQueue}. + * - ASensorEventQueue_enableSensor() + * - ASensorEventQueue_disableSensor() + * - ASensorEventQueue_hasEvents() + * - ASensorEventQueue_getEvents() + * - ASensorEventQueue_setEventRate() + */ +type SensorEventQueue C.ASensorEventQueue + +func (queue *SensorEventQueue) cptr() *C.ASensorEventQueue { + return (*C.ASensorEventQueue)(queue) +} + +/** + * {@link ASensor} is an opaque type that provides information about + * an hardware sensors. + * + * A {@link ASensor} pointer can be obtained using + * ASensorManager_getDefaultSensor(), + * ASensorManager_getDefaultSensorEx() or from a {@link ASensorList}. + * + * This file provides a set of functions to access properties of a + * {@link ASensor}: + * - ASensor_getName() + * - ASensor_getVendor() + * - ASensor_getType() + * - ASensor_getResolution() + * - ASensor_getMinDelay() + * - ASensor_getFifoMaxEventCount() + * - ASensor_getFifoReservedEventCount() + * - ASensor_getStringType() + * - ASensor_getReportingMode() + * - ASensor_isWakeUpSensor() + */ +type Sensor C.ASensor + +func (sensor *Sensor) cptr() *C.ASensor { + return (*C.ASensor)(sensor) +} + +/** + * {@link ASensorRef} is a type for constant pointers to {@link ASensor}. + * + * This is used to define entry in {@link ASensorList} arrays. + */ +//typedef ASensor const* ASensorRef; +/** + * {@link ASensorList} is an array of reference to {@link ASensor}. + * + * A {@link ASensorList} can be initialized using ASensorManager_getSensorList(). + */ +//typedef ASensorRef const* ASensorList; + +/*****************************************************************************/ + +/** + * Get a reference to the sensor manager. ASensorManager is a singleton + * per package as different packages may have access to different sensors. + * + * Deprecated: Use ASensorManager_getInstanceForPackage(const char*) instead. + * + * Example: + * + * ASensorManager* sensorManager = ASensorManager_getInstance(); + * + */ +//#if __ANDROID_API__ >= __ANDROID_API_O__ +//__attribute__ ((deprecated)) ASensorManager* ASensorManager_getInstance(); +//#endif +func SensorManagerInstance() *SensorManager { + return (*SensorManager)(C.ASensorManager_getInstance()) +} + +/** + * Returns the list of available sensors. + */ +//int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list); +func (manager *SensorManager) GetSensorList() []*Sensor { + var list C.ASensorList + n := C.ASensorManager_getSensorList(manager.cptr(), &list) + if n > 0 { + return (*[1 << 26]*Sensor)(unsafe.Pointer(list))[:n] + } + return nil +} + +/** + * Returns the default sensor for the given type, or NULL if no sensor + * of that type exists. + */ +//ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type); +func (manager *SensorManager) GetDefaultSensor(typ SENSOR_TYPE) *Sensor { + return (*Sensor)(C.ASensorManager_getDefaultSensor(manager.cptr(), C.int(typ))) +} + +/** + * Creates a new sensor event queue and associate it with a looper. + * + * "ident" is a identifier for the events that will be returned when + * calling ALooper_pollOnce(). The identifier must be >= 0, or + * ALOOPER_POLL_CALLBACK if providing a non-NULL callback. + */ +//ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager, +// ALooper* looper, int ident, ALooper_callbackFunc callback, void* data); +func (manager *SensorManager) CreateEventQueue(looper *Looper, ident int, callback LooperCallback, data unsafe.Pointer) *SensorEventQueue { + if callback != nil { + return (*SensorEventQueue)(C.ASensorManager_createEventQueue(manager.cptr(), looper.cptr(), + C.int(ident), (C.ALooper_callbackFunc)(C.cgoCallback), + unsafe.Pointer(&callbackParam{callback, data}))) + } else { + return (*SensorEventQueue)(C.ASensorManager_createEventQueue(manager.cptr(), looper.cptr(), + C.int(ident), nil, data)) + } +} + +/** + * Destroys the event queue and free all resources associated to it. + */ +//int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue); +func (manager *SensorManager) Destroy(queue *SensorEventQueue) int { + return int(C.ASensorManager_destroyEventQueue(manager.cptr(), queue.cptr())) +} + +/*****************************************************************************/ + +/** + * Enable the selected sensor with sampling and report parameters + * + * Enable the selected sensor at a specified sampling period and max batch report latency. + * To disable sensor, use {@link ASensorEventQueue_disableSensor}. + * + * \param queue {@link ASensorEventQueue} for sensor event to be report to. + * \param sensor {@link ASensor} to be enabled. + * \param samplingPeriodUs sampling period of sensor in microseconds. + * \param maxBatchReportLatencyus maximum time interval between two batch of sensor events are + * delievered in microseconds. For sensor streaming, set to 0. + * \return 0 on success or a negative error code on failure. + */ +//int ASensorEventQueue_registerSensor(ASensorEventQueue* queue, ASensor const* sensor, +// int32_t samplingPeriodUs, int64_t maxBatchReportLatencyUs); +/*func (queue *SensorEventQueue) registerSensor(sensor *Sensor, + samplingPeriodUs int32, maxBatchReportLatencyUs int64) int { + return int(C.ASensorEventQueue_registerSensor(queue.cptr(), sensor.cptr(), + C.int32_t(samplingPeriodUs), C.int64_t(maxBatchReportLatencyUs))) +}*/ + +/** + * Enable the selected sensor at default sampling rate. + * + * Start event reports of a sensor to specified sensor event queue at a default rate. + * + * \param queue {@link ASensorEventQueue} for sensor event to be report to. + * \param sensor {@link ASensor} to be enabled. + * + * \return 0 on success or a negative error code on failure. + */ +//int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor const* sensor); +func (queue *SensorEventQueue) enableSensor(sensor *Sensor) int { + return int(C.ASensorEventQueue_enableSensor(queue.cptr(), sensor.cptr())) +} + +/** + * Disable the selected sensor. + * + * Stop event reports from the sensor to specified sensor event queue. + * + * \param queue {@link ASensorEventQueue} to be changed + * \param sensor {@link ASensor} to be disabled + * \return 0 on success or a negative error code on failure. + */ +//int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor const* sensor); +func (queue *SensorEventQueue) disableSensor(sensor *Sensor) int { + return int(C.ASensorEventQueue_disableSensor(queue.cptr(), sensor.cptr())) +} + +/** + * Sets the delivery rate of events in microseconds for the given sensor. + * + * This function has to be called after {@link ASensorEventQueue_enableSensor}. + * Note that this is a hint only, generally event will arrive at a higher + * rate. It is an error to set a rate inferior to the value returned by + * ASensor_getMinDelay(). + * + * \param queue {@link ASensorEventQueue} to which sensor event is delivered. + * \param sensor {@link ASensor} of which sampling rate to be updated. + * \param usec sensor sampling period (1/sampling rate) in microseconds + * \return 0 on sucess or a negative error code on failure. + */ +//int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor const* sensor, int32_t usec); +func (queue *SensorEventQueue) setEventRate(sensor *Sensor, t time.Duration) int { + usec := t / time.Microsecond + if usec >= math.MaxInt32 { + usec = math.MaxInt32 + } + return int(C.ASensorEventQueue_setEventRate(queue.cptr(), sensor.cptr(), C.int32_t(usec))) +} + +/** + * Determine if a sensor event queue has pending event to be processed. + * + * \param queue {@link ASensorEventQueue} to be queried + * \return 1 if the queue has events; 0 if it does not have events; + * or a negative value if there is an error. + */ +//int ASensorEventQueue_hasEvents(ASensorEventQueue* queue); +func (queue *SensorEventQueue) HasEvents() int { + return int(C.ASensorEventQueue_hasEvents(queue.cptr())) +} + +/** + * Retrieve pending events in sensor event queue + * + * Retrieve next available events from the queue to a specified event array. + * + * \param queue {@link ASensorEventQueue} to get events from + * \param events pointer to an array of {@link ASensorEvents}. + * \param count max number of event that can be filled into array event. + * \return number of events returned on success; negative error code when + * no events are pending or an error has occurred. + * + * Examples: + * + * ASensorEvent event; + * ssize_t numEvent = ASensorEventQueue_getEvents(queue, &event, 1); + * + * ASensorEvent eventBuffer[8]; + * ssize_t numEvent = ASensorEventQueue_getEvents(queue, eventBuffer, 8); + * + */ +//ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue, +// ASensorEvent* events, size_t count); +func (queue *SensorEventQueue) GetEvents(count int) ([]SensorEvent, int) { + if count == 0 { + return nil, 0 + } + evts := make([]SensorEvent, count) + ret := C.ASensorEventQueue_getEvents(queue.cptr(), (*C.ASensorEvent)(unsafe.Pointer(&evts[0])), C.size_t(count)) + if ret < 0 { + return nil, int(ret) + } + return evts[:ret], int(ret) +} + +/*****************************************************************************/ + +/** + * Returns this sensor's name (non localized) + */ +//const char* ASensor_getName(ASensor const* sensor); +func (sensor *Sensor) GetName() string { + return C.GoString(C.ASensor_getName(sensor.cptr())) +} + +/** + * Returns this sensor's vendor's name (non localized) + */ +//const char* ASensor_getVendor(ASensor const* sensor); +func (sensor *Sensor) GetVendor() string { + return C.GoString(C.ASensor_getVendor(sensor.cptr())) +} + +/** + * Return this sensor's type + */ +//int ASensor_getType(ASensor const* sensor); +func (sensor *Sensor) GetType() SENSOR_TYPE { + return SENSOR_TYPE(C.ASensor_getType(sensor.cptr())) +} + +/** + * Returns this sensors's resolution + */ +//float ASensor_getResolution(ASensor const* sensor) __NDK_FPABI__; +func (sensor *Sensor) GetResolution() float32 { + return float32(C.ASensor_getResolution(sensor.cptr())) +} + +/** + * Returns the minimum delay allowed between events in microseconds. + * A value of zero means that this sensor doesn't report events at a + * constant rate, but rather only when a new data is available. + */ +//int ASensor_getMinDelay(ASensor const* sensor); +func (sensor *Sensor) GetMinDelay() time.Duration { + return time.Duration(int(C.ASensor_getMinDelay(sensor.cptr()))) * time.Microsecond +} + +// SENSOR_TYPE +func (t SENSOR_TYPE) String() string { + switch t { + case SENSOR_TYPE_ACCELEROMETER: + return "sensor.accelerometer" + case SENSOR_TYPE_MAGNETIC_FIELD: + return "sensor.magnetic_field" + case SENSOR_TYPE_ORIENTATION: + return "sensor.orientation" + case SENSOR_TYPE_GYROSCOPE: + return "sensor.gyroscope" + case SENSOR_TYPE_LIGHT: + return "sensor.light" + case SENSOR_TYPE_PRESSURE: + return "sensor.pressure" + case SENSOR_TYPE_TEMPERATURE: + return "sensor.temperature" + case SENSOR_TYPE_PROXIMITY: + return "sensor.proximity" + case SENSOR_TYPE_GRAVITY: + return "sensor.gravity" + case SENSOR_TYPE_LINEAR_ACCELERATION: + return "sensor.linear_acceleration" + case SENSOR_TYPE_ROTATION_VECTOR: + return "sensor.rotation_vector" + case SENSOR_TYPE_RELATIVE_HUMIDITY: + return "sensor.relative_humidity" + case SENSOR_TYPE_AMBIENT_TEMPERATURE: + return "sensor.ambient_temperature" + case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED: + return "sensor.magnetic_field_uncalibrated" + case SENSOR_TYPE_GAME_ROTATION_VECTOR: + return "sensor.game_rotation_vector" + case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED: + return "sensor.gyroscope_uncalibrated" + case SENSOR_TYPE_SIGNIFICANT_MOTION: + return "sensor.significant_motion" + case SENSOR_TYPE_STEP_DETECTOR: + return "sensor.step_detector" + case SENSOR_TYPE_STEP_COUNTER: + return "sensor.step_counter" + case SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR: + return "sensor.geomagnetic_rotation_vector" + case SENSOR_TYPE_HEART_RATE: + return "sensor.heart_rate" + case SENSOR_TYPE_WAKE_GESTURE: + return "sensor.wake_gesture" + case SENSOR_TYPE_GLANCE_GESTURE: + return "sensor.glance_gesture" + case SENSOR_TYPE_PICK_UP_GESTURE: + return "sensor.pick_up_gesture" + case SENSOR_TYPE_WRIST_TILT_GESTURE: + return "sensor.wrist_tilt_gesture" + case SENSOR_TYPE_DEVICE_ORIENTATION: + return "sensor.device_orientation" + case SENSOR_TYPE_POSE_6DOF: + return "sensor.pose_6dof" + case SENSOR_TYPE_STATIONARY_DETECT: + return "sensor.stationary_detect" + case SENSOR_TYPE_MOTION_DETECT: + return "sensor.motion_detect" + case SENSOR_TYPE_HEART_BEAT: + return "sensor.heart_beat" + case SENSOR_TYPE_DYNAMIC_SENSOR_META: + return "sensor.dynamic_sensor_meta" + case SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT: + return "sensor.low_latency_offbody_detect" + case SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED: + return "sensor.accelerometer_uncalibrated" + default: + return fmt.Sprintf("sensor.type_%v", int(t)) + } +} + +// SensorEvent +func (event *SensorEvent) cptr() *C.ASensorEvent { + return (*C.ASensorEvent)(event) +} +func (event *SensorEvent) GetSensor() int { + return int(event.sensor) +} + +func (event *SensorEvent) GetType() SENSOR_TYPE { + return SENSOR_TYPE(event._type) +} + +func (event *SensorEvent) GetTimestamp() time.Duration { + return time.Duration(event.timestamp) * time.Nanosecond +} + +func (event *SensorEvent) getDatas() []byte { + return (*[1 << 28]byte)(C.ASensorEvent_getDatas(event.cptr()))[:64] +} + +func (event *SensorEvent) getReserveds() []uint32 { + return (*[1 << 26]uint32)(unsafe.Pointer(&event.reserved1[0]))[:4] +} + +func (event *SensorEvent) GetData(data interface{}) { + switch data.(type) { + case *SensorVector: + case *MagneticVector: + case *MetaDataEvent: + case *UncalibratedEvent: + case *HeartRateEvent: + case *DynamicSensorEvent: + case *AdditionalInfoEvent: + case *float32, []float32: + case *uint64, []uint64: + case *int64, []int64: + default: + Assert(false, "SensorEvent.GetData error format.") + return + } + binary.Read(bytes.NewBuffer(event.getDatas()), binary.LittleEndian, data) +} + +func (s *Sensor) Enable(act *Activity) { + ctx := act.Context() + if ctx.sensorQueue == nil { + ctx.sensorQueue = SensorManagerInstance().CreateEventQueue(ctx.Looper, + Looper_ID_SENSOR, nil, unsafe.Pointer(uintptr(Looper_ID_SENSOR))) + } + ctx.sensorQueue.enableSensor(s) +} + +func (s *Sensor) Disable(act *Activity) { + act.Context().sensorQueue.disableSensor(s) +} + +// Sets the delivery rate of events in microseconds for the given sensor. +// +// This function has to be called after Enable. +// Note that this is a hint only, generally event will arrive at a higher +// rate. It is an error to set a rate inferior to the value returned by +// GetMinDelay(). +func (s *Sensor) SetEventRate(act *Activity, t time.Duration) { + act.Context().sensorQueue.setEventRate(s, t) +} diff --git a/ndk/stdio_android.go b/ndk/stdio_android.go new file mode 100644 index 0000000..cee48c4 --- /dev/null +++ b/ndk/stdio_android.go @@ -0,0 +1,77 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ndk + +// Android redirects stdout and stderr to /dev/null. +// As these are common debugging utilities in Go, +// we redirect them to logcat. +// +// Unfortunately, logcat is line oriented, so we must buffer. + +/* +#cgo LDFLAGS: -llog +#include +#include +*/ +import "C" + +import ( + "bufio" + "log" + "os" + "unsafe" +) + +var ( + ctag = C.CString("GoLogIO") + ctagLog = C.CString("GoLog") +) + +type infoWriter struct{} + +func (infoWriter) Write(p []byte) (n int, err error) { + cstr := C.CString(string(p)) + C.__android_log_write(C.ANDROID_LOG_INFO, ctagLog, cstr) + C.free(unsafe.Pointer(cstr)) + return len(p), nil +} + +func lineLog(f *os.File, priority C.int) { + const logSize = 1024 // matches android/log.h. + r := bufio.NewReaderSize(f, logSize) + for { + line, _, err := r.ReadLine() + str := string(line) + if err != nil { + str += " " + err.Error() + } + cstr := C.CString(str) + C.__android_log_write(priority, ctag, cstr) + C.free(unsafe.Pointer(cstr)) + if err != nil { + break + } + } +} + +func init() { + log.SetOutput(infoWriter{}) + // android logcat includes all of log.LstdFlags + log.SetFlags(log.Flags() &^ log.LstdFlags) + + r, w, err := os.Pipe() + if err != nil { + panic(err) + } + os.Stderr = w + go lineLog(r, C.ANDROID_LOG_ERROR) + + r, w, err = os.Pipe() + if err != nil { + panic(err) + } + os.Stdout = w + go lineLog(r, C.ANDROID_LOG_INFO) +} diff --git a/ndk/storage_manager.go b/ndk/storage_manager.go new file mode 100644 index 0000000..426c9f1 --- /dev/null +++ b/ndk/storage_manager.go @@ -0,0 +1,147 @@ +package ndk + +/* +#include +#include +extern void cgoObbCallbackFunc(char* filename, int32_t state, void* data); +*/ +import "C" + +import "unsafe" + +type StorageManager C.AStorageManager + +const ( + /* + * The OBB container is now mounted and ready for use. Can be returned + * as the status for callbacks made during asynchronous OBB actions. + */ + OBB_STATE_MOUNTED = C.AOBB_STATE_MOUNTED + + /* + * The OBB container is now unmounted and not usable. Can be returned + * as the status for callbacks made during asynchronous OBB actions. + */ + OBB_STATE_UNMOUNTED = C.AOBB_STATE_UNMOUNTED + + /* + * There was an internal system error encountered while trying to + * mount the OBB. Can be returned as the status for callbacks made + * during asynchronous OBB actions. + */ + OBB_STATE_ERROR_INTERNAL = C.AOBB_STATE_ERROR_INTERNAL + + /* + * The OBB could not be mounted by the system. Can be returned as the + * status for callbacks made during asynchronous OBB actions. + */ + OBB_STATE_ERROR_COULD_NOT_MOUNT = C.AOBB_STATE_ERROR_COULD_NOT_MOUNT + + /* + * The OBB could not be unmounted. This most likely indicates that a + * file is in use on the OBB. Can be returned as the status for + * callbacks made during asynchronous OBB actions. + */ + OBB_STATE_ERROR_COULD_NOT_UNMOUNT = C.AOBB_STATE_ERROR_COULD_NOT_UNMOUNT + + /* + * A call was made to unmount the OBB when it was not mounted. Can be + * returned as the status for callbacks made during asynchronous OBB + * actions. + */ + OBB_STATE_ERROR_NOT_MOUNTED = C.AOBB_STATE_ERROR_NOT_MOUNTED + + /* + * The OBB has already been mounted. Can be returned as the status for + * callbacks made during asynchronous OBB actions. + */ + OBB_STATE_ERROR_ALREADY_MOUNTED = C.AOBB_STATE_ERROR_ALREADY_MOUNTED + + /* + * The current application does not have permission to use this OBB. + * This could be because the OBB indicates it's owned by a different + * package. Can be returned as the status for callbacks made during + * asynchronous OBB actions. + */ + OBB_STATE_ERROR_PERMISSION_DENIED = C.AOBB_STATE_ERROR_PERMISSION_DENIED +) + +/** + * Obtains a new instance of AStorageManager. + */ +//AStorageManager* AStorageManager_new(); +func NewStorageManager() *StorageManager { + return (*StorageManager)(C.AStorageManager_new()) +} +func (mgr *StorageManager) cptr() *C.AStorageManager { + return (*C.AStorageManager)(mgr) +} + +/** + * Release AStorageManager instance. + */ +//void AStorageManager_delete(AStorageManager* mgr); +func (mgr *StorageManager) Delete() { + C.AStorageManager_delete(mgr.cptr()) +} + +/** + * Callback function for asynchronous calls made on OBB files. + */ +//typedef void (*AStorageManager_obbCallbackFunc)(const char* filename, const int32_t state, void* data); +type ObbCallbackFunc func(filename string, state int) + +//export cgoObbCallbackFunc +func cgoObbCallbackFunc(filename *C.char, state C.int, data unsafe.Pointer) { + (*(*ObbCallbackFunc)(data))(C.GoString(filename), int(state)) +} + +/** + * Attempts to mount an OBB file. This is an asynchronous operation. + */ +//void AStorageManager_mountObb(AStorageManager* mgr, const char* filename, const char* key, +// AStorageManager_obbCallbackFunc cb, void* data); +func (mgr *StorageManager) MountObb(filename, key string, cb ObbCallbackFunc) { + cfilename := C.CString(filename) + defer C.free(unsafe.Pointer(cfilename)) + ckey := C.CString(key) + defer C.free(unsafe.Pointer(ckey)) + C.AStorageManager_mountObb(mgr.cptr(), cfilename, ckey, + C.AStorageManager_obbCallbackFunc(C.cgoObbCallbackFunc), unsafe.Pointer(&cb)) +} + +/** + * Attempts to unmount an OBB file. This is an asynchronous operation. + */ +//void AStorageManager_unmountObb(AStorageManager* mgr, const char* filename, const int force, +// AStorageManager_obbCallbackFunc cb, void* data); +func (mgr *StorageManager) UnmountObb(filename string, force bool, cb ObbCallbackFunc) { + cfilename := C.CString(filename) + defer C.free(unsafe.Pointer(cfilename)) + cforce := 0 + if force { + cforce = 1 + } + C.AStorageManager_unmountObb(mgr.cptr(), cfilename, C.int(cforce), + C.AStorageManager_obbCallbackFunc(C.cgoObbCallbackFunc), unsafe.Pointer(&cb)) +} + +/** + * Check whether an OBB is mounted. + */ +//int AStorageManager_isObbMounted(AStorageManager* mgr, const char* filename); +func (mgr *StorageManager) IsObbMounted(filename string) bool { + cfilename := C.CString(filename) + defer C.free(unsafe.Pointer(cfilename)) + return 0 != C.AStorageManager_isObbMounted(mgr.cptr(), cfilename) +} + +/** + * Get the mounted path for an OBB. + */ +//const char* AStorageManager_getMountedObbPath(AStorageManager* mgr, const char* filename); +func (mgr *StorageManager) GetMountedObbPath(filename string) string { + cfilename := C.CString(filename) + defer C.free(unsafe.Pointer(cfilename)) + return C.GoString(C.AStorageManager_getMountedObbPath(mgr.cptr(), cfilename)) +} diff --git a/ndk/utils.go b/ndk/utils.go new file mode 100644 index 0000000..c295995 --- /dev/null +++ b/ndk/utils.go @@ -0,0 +1,121 @@ +package ndk + +import ( + "fmt" + "log" +) + +import "C" + +func (ctx *Context) String() string { + return fmt.Sprintf("Context#%s{Destory: %v, Focus: %v}", + ctx.ClassName, ctx.WillDestoryValue, ctx.IsFocus) +} + +func Assert(con interface{}, infos ...interface{}) { + if con == nil { + return + } + switch obj := con.(type) { + case bool: + if !obj { + Info(append([]interface{}{"ASSERT:"}, infos...)...) + } + + case error: + Info(append([]interface{}{"ASSERT:(", con, "):"}, infos...)...) + + default: + Info("ASSERT:(", con, "):", "condition must is bool/error.") + } +} + +func Fatal(v ...interface{}) { + log.Fatal(v...) +} + +func Info(v ...interface{}) { + log.Println(v...) +} + +func (act *Activity) String() string { + return fmt.Sprintf("Activity#%p", act) +} + +func (win *Window) String() string { + return fmt.Sprintf("Window#%p", win) +} + +func (q *InputQueue) String() string { + return fmt.Sprintf("InputQueue#%p", q) +} + +func (key *KeyEvent) String() string { + var action string + switch key.GetAction() { + case KEY_EVENT_ACTION_DOWN: + action = "DOWN" + case KEY_EVENT_ACTION_UP: + action = "UP" + case KEY_EVENT_ACTION_MULTIPLE: + action = "MULTIPLE" + default: + action = fmt.Sprint(key.GetAction()) + } + return fmt.Sprintf("KEY, %d, %s", key.GetKeyCode(), action) +} + +func (mot *MotionEvent) String() string { + var action string + switch mot.GetAction() & MOTION_EVENT_ACTION_MASK { + case MOTION_EVENT_ACTION_DOWN: + action = "DOWN" + case MOTION_EVENT_ACTION_UP: + action = "UP" + case MOTION_EVENT_ACTION_MOVE: + action = "MOVE" + case MOTION_EVENT_ACTION_POINTER_DOWN: + action = "POINTER_DOWN" + case MOTION_EVENT_ACTION_POINTER_UP: + action = "POINTER_UP" + default: + action = fmt.Sprint(mot.GetAction()) + } + index := (mot.GetAction() & MOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT + return fmt.Sprintf("MOTION (%v), %v, %v, %v", + index, action, int(mot.GetX(index)), int(mot.GetY(index))) +} + +func (e *InputEvent) String() string { + str := "InputEvent#{ " + switch e.GetType() { + case INPUT_EVENT_TYPE_KEY: + str += (*KeyEvent)(e).String() + " }" + + case INPUT_EVENT_TYPE_MOTION: + str += (*MotionEvent)(e).String() + " }" + + default: + str += fmt.Sprintf("UNKNOWN, %p }", e) + } + + return str +} + +func (e *InputEvent) Key() *KeyEvent { + if e.GetType() == INPUT_EVENT_TYPE_KEY { + return (*KeyEvent)(e) + } + return nil +} + +func (e *InputEvent) Motion() *MotionEvent { + if e.GetType() == INPUT_EVENT_TYPE_MOTION { + return (*MotionEvent)(e) + } + return nil +} + +func (act *Activity) Context() *Context { + return (*Context)(act.Instance()) +} diff --git a/ndk/window.go b/ndk/window.go new file mode 100644 index 0000000..b0d0997 --- /dev/null +++ b/ndk/window.go @@ -0,0 +1,200 @@ +package ndk + +/* +#include +#include +#include + +#cgo LDFLAGS: -lnativewindow +*/ +import "C" + +import ( + "unsafe" +) + +/* + * Pixel formats that a window can use. + */ +const ( + WINDOW_FORMAT_RGBA_8888 = C.WINDOW_FORMAT_RGBA_8888 + WINDOW_FORMAT_RGBX_8888 = C.WINDOW_FORMAT_RGBX_8888 + WINDOW_FORMAT_RGB_565 = C.WINDOW_FORMAT_RGB_565 +) + +const ( + FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = C.AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON + FLAG_DIM_BEHIND = C.AWINDOW_FLAG_DIM_BEHIND + FLAG_BLUR_BEHIND = C.AWINDOW_FLAG_BLUR_BEHIND + FLAG_NOT_FOCUSABLE = C.AWINDOW_FLAG_NOT_FOCUSABLE + FLAG_NOT_TOUCHABLE = C.AWINDOW_FLAG_NOT_TOUCHABLE + FLAG_NOT_TOUCH_MODAL = C.AWINDOW_FLAG_NOT_TOUCH_MODAL + FLAG_TOUCHABLE_WHEN_WAKING = C.AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING + FLAG_KEEP_SCREEN_ON = C.AWINDOW_FLAG_KEEP_SCREEN_ON + FLAG_LAYOUT_IN_SCREEN = C.AWINDOW_FLAG_LAYOUT_IN_SCREEN + FLAG_LAYOUT_NO_LIMITS = C.AWINDOW_FLAG_LAYOUT_NO_LIMITS + FLAG_FULLSCREEN = C.AWINDOW_FLAG_FULLSCREEN + FLAG_FORCE_NOT_FULLSCREEN = C.AWINDOW_FLAG_FORCE_NOT_FULLSCREEN + FLAG_DITHER = C.AWINDOW_FLAG_DITHER + FLAG_SECURE = C.AWINDOW_FLAG_SECURE + FLAG_SCALED = C.AWINDOW_FLAG_SCALED + FLAG_IGNORE_CHEEK_PRESSES = C.AWINDOW_FLAG_IGNORE_CHEEK_PRESSES + FLAG_LAYOUT_INSET_DECOR = C.AWINDOW_FLAG_LAYOUT_INSET_DECOR + FLAG_ALT_FOCUSABLE_IM = C.AWINDOW_FLAG_ALT_FOCUSABLE_IM + FLAG_WATCH_OUTSIDE_TOUCH = C.AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH + FLAG_SHOW_WHEN_LOCKED = C.AWINDOW_FLAG_SHOW_WHEN_LOCKED + FLAG_SHOW_WALLPAPER = C.AWINDOW_FLAG_SHOW_WALLPAPER + FLAG_TURN_SCREEN_ON = C.AWINDOW_FLAG_TURN_SCREEN_ON + FLAG_DISMISS_KEYGUARD = C.AWINDOW_FLAG_DISMISS_KEYGUARD +) + +type WindowTransform int32 + +const ( + WINDOW_TRANSFORM_IDENTITY = WindowTransform(C.ANATIVEWINDOW_TRANSFORM_IDENTITY) + WINDOW_TRANSFORM_MIRROR_HORIZONTAL = WindowTransform(C.ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL) + WINDOW_TRANSFORM_MIRROR_VERTICAL = WindowTransform(C.ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL) + WINDOW_TRANSFORM_ROTATE_90 = WindowTransform(C.ANATIVEWINDOW_TRANSFORM_ROTATE_90) + WINDOW_TRANSFORM_ROTATE_180 = WindowTransform(C.ANATIVEWINDOW_TRANSFORM_ROTATE_180) + WINDOW_TRANSFORM_ROTATE_270 = WindowTransform(C.ANATIVEWINDOW_TRANSFORM_ROTATE_270) +) + +type WindowFrameRateCompatibility int32 + +const ( + WINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT = WindowFrameRateCompatibility(C.ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT) + WINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = WindowFrameRateCompatibility(C.ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE) +) + +type WindowBuffer C.ANativeWindow_Buffer + +func (b *WindowBuffer) cptr() *C.ANativeWindow_Buffer { + return (*C.ANativeWindow_Buffer)(b) +} + +func (b *WindowBuffer) Width() int { + return int(b.width) +} + +func (b *WindowBuffer) Height() int { + return int(b.height) +} + +func (b *WindowBuffer) Stride() int { + return int(b.stride) +} + +func (b *WindowBuffer) Format() int { + return int(b.format) +} + +func (b *WindowBuffer) Bits() []byte { + return ((*[1 << 30]byte)(unsafe.Pointer(b.bits)))[:b.stride*b.height] +} + +func (b *WindowBuffer) Bit16s() []uint16 { + return ((*[1 << 28]uint16)(unsafe.Pointer(b.bits)))[:b.stride*b.height] +} + +func (b *WindowBuffer) Bit32s() []uint32 { + return ((*[1 << 28]uint32)(unsafe.Pointer(b.bits)))[:b.stride*b.height] +} + +type Window C.ANativeWindow + +func (w *Window) cptr() *C.ANativeWindow { + return (*C.ANativeWindow)(w) +} + +func (w *Window) Pointer() *C.ANativeWindow { + return (*C.ANativeWindow)(w) +} + +/** + * Return the ANativeWindow associated with a Java Surface object, + * for interacting with it through native code. This acquires a reference + * on the ANativeWindow that is returned; be sure to use ANativeWindow_release() + * when done with it so that it doesn't leak. + */ +func FromSurface(env *C.JNIEnv, surface C.jobject) *Window { + return (*Window)(C.ANativeWindow_fromSurface(env, surface)) +} + +/** + * Acquire a reference on the given ANativeWindow object. This prevents the object + * from being deleted until the reference is removed. + */ +func (w *Window) Acquire() { + C.ANativeWindow_acquire(w.cptr()) +} + +/** + * Remove a reference that was previously acquired with ANativeWindow_acquire(). + */ +func (w *Window) Release() { + C.ANativeWindow_release(w.cptr()) +} + +/* + * Return the current width in pixels of the window surface. Returns a + * negative value on error. + */ +func (w *Window) Width() int { + return int(C.ANativeWindow_getWidth(w.cptr())) +} + +/* + * Return the current height in pixels of the window surface. Returns a + * negative value on error. + */ +func (w *Window) Height() int { + return int(C.ANativeWindow_getHeight(w.cptr())) +} + +/* + * Return the current pixel format of the window surface. Returns a + * negative value on error. + */ +func (w *Window) Format() int { + return int(C.ANativeWindow_getFormat(w.cptr())) +} + +/* + * Change the format and size of the window buffers. + * + * The width and height control the number of pixels in the buffers, not the + * dimensions of the window on screen. If these are different than the + * window's physical size, then it buffer will be scaled to match that size + * when compositing it to the screen. + * + * For all of these parameters, if 0 is supplied then the window's base + * value will come back in force. + * + * width and height must be either both zero or both non-zero. + * + */ +func (w *Window) SetBuffersGeometry(width, height, format int) int32 { + return int32(C.ANativeWindow_setBuffersGeometry(w.cptr(), C.int32_t(width), C.int32_t(height), C.int32_t(format))) +} + +/** + * Lock the window's next drawing surface for writing. + * inOutDirtyBounds is used as an in/out parameter, upon entering the + * function, it contains the dirty region, that is, the region the caller + * intends to redraw. When the function returns, inOutDirtyBounds is updated + * with the actual area the caller needs to redraw -- this region is often + * extended by ANativeWindow_lock. + */ +func (w *Window) Lock(inDirtyBounds Rect) (*WindowBuffer, Rect, bool) { + var outBuffer WindowBuffer + ret := C.ANativeWindow_lock(w.cptr(), outBuffer.cptr(), inDirtyBounds.cptr()) + return &outBuffer, inDirtyBounds, ret == 0 +} + +/** + * Unlock the window's drawing surface after previously locking it, + * posting the new buffer to the display. + */ +func (w *Window) UnlockAndPost() bool { + return 0 == C.ANativeWindow_unlockAndPost(w.cptr()) +} diff --git a/ndk/window_extra.go b/ndk/window_extra.go new file mode 100644 index 0000000..89ede2b --- /dev/null +++ b/ndk/window_extra.go @@ -0,0 +1,26 @@ +//go:build ndk_window_extra +// +build ndk_window_extra + +package ndk + +import ( + "syscall" +) + +/* +#include +#include +#include + +#cgo LDFLAGS: -lnativewindow +*/ +import "C" + +// See https://developer.android.com/ndk/reference/group/a-native-window#anativewindow_setbufferstransform +func (w *Window) SetBuffersTransform(transform WindowTransform) error { + rc := int32(C.ANativeWindow_setBuffersTransform(w.cptr(), C.int32_t(transform))) + if rc != 0 { + return syscall.Errno(-rc) + } + return nil +} diff --git a/net/errors.go b/net/errors.go deleted file mode 100644 index dbb7b32..0000000 --- a/net/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package net diff --git a/net/functions.go b/net/functions.go deleted file mode 100644 index 148a7d8..0000000 --- a/net/functions.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package net - -import ( - capi "github.com/AndroidGoLab/ndk/capi/multinetwork" -) - -// Android_getprocdns calls the underlying C function. -func Android_getprocdns(network *net_handle_t) int32 { - return (int32)(capi.Android_getprocdns((*capi.Net_handle_t)(network))) -} - -// Android_getprocnetwork calls the underlying C function. -func Android_getprocnetwork(network *net_handle_t) int32 { - return (int32)(capi.Android_getprocnetwork((*capi.Net_handle_t)(network))) -} - -// Android_res_cancel calls the underlying C function. -func Android_res_cancel(nsend_fd int32) { - capi.Android_res_cancel(nsend_fd) -} - -// Android_res_nresult calls the underlying C function. -func Android_res_nresult(fd int32, rcode *int32, answer *uint8, anslen uint64) int32 { - return (int32)(capi.Android_res_nresult(fd, rcode, answer, anslen)) -} - -// Android_tag_socket calls the underlying C function. -func Android_tag_socket(sockfd int32, tag uint32) int32 { - return (int32)(capi.Android_tag_socket(sockfd, tag)) -} - -// Android_untag_socket calls the underlying C function. -func Android_untag_socket(sockfd int32) int32 { - return (int32)(capi.Android_untag_socket(sockfd)) -} diff --git a/net/net_handle_t.go b/net/net_handle_t.go deleted file mode 100644 index ed84e09..0000000 --- a/net/net_handle_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package net - -import ( - capi "github.com/AndroidGoLab/ndk/capi/multinetwork" -) - -type net_handle_t = capi.Net_handle_t diff --git a/net/package.go b/net/package.go deleted file mode 100644 index d45b255..0000000 --- a/net/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package net provides Go bindings for Android multinetwork APIs. -package net diff --git a/net/res_nsend_flags.go b/net/res_nsend_flags.go deleted file mode 100644 index 641731f..0000000 --- a/net/res_nsend_flags.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package net - -type ResNsendFlags int32 - -const ( - ANDROID_RESOLV_NO_RETRY ResNsendFlags = 1 - ANDROID_RESOLV_NO_CACHE_STORE ResNsendFlags = 2 - ANDROID_RESOLV_NO_CACHE_LOOKUP ResNsendFlags = 4 -) diff --git a/net/uid_t.go b/net/uid_t.go deleted file mode 100644 index 13ea96e..0000000 --- a/net/uid_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package net - -import ( - capi "github.com/AndroidGoLab/ndk/capi/multinetwork" -) - -type Uid_t = capi.Uid_t diff --git a/nnapi/ahardware_buffer.go b/nnapi/ahardware_buffer.go deleted file mode 100644 index dbfa324..0000000 --- a/nnapi/ahardware_buffer.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -type AHardwareBuffer = capi.AHardwareBuffer diff --git a/nnapi/aneural_networks_memory_desc.go b/nnapi/aneural_networks_memory_desc.go deleted file mode 100644 index a71c12b..0000000 --- a/nnapi/aneural_networks_memory_desc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -type ANeuralNetworksMemoryDesc = capi.ANeuralNetworksMemoryDesc diff --git a/nnapi/aneural_networks_operation_type.go b/nnapi/aneural_networks_operation_type.go deleted file mode 100644 index 9ded169..0000000 --- a/nnapi/aneural_networks_operation_type.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -type ANeuralNetworksOperationType = capi.ANeuralNetworksOperationType diff --git a/nnapi/aneural_networks_symm_per_channel_quant_params.go b/nnapi/aneural_networks_symm_per_channel_quant_params.go deleted file mode 100644 index 7274284..0000000 --- a/nnapi/aneural_networks_symm_per_channel_quant_params.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -type ANeuralNetworksSymmPerChannelQuantParams = capi.ANeuralNetworksSymmPerChannelQuantParams diff --git a/nnapi/burst.go b/nnapi/burst.go deleted file mode 100644 index 831a3cb..0000000 --- a/nnapi/burst.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// Burst wraps the NDK ANeuralNetworksBurst handle. -type Burst struct { - ptr *capi.ANeuralNetworksBurst -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Burst) cptr() *capi.ANeuralNetworksBurst { - if h == nil { - return nil - } - return h.ptr -} - -// NewBurstFromPointer wraps a raw ANeuralNetworksBurst pointer. -func NewBurstFromPointer(ptr unsafe.Pointer) *Burst { - return &Burst{ptr: (*capi.ANeuralNetworksBurst)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Burst) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Burst) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewBurstFromUintPtr wraps a uintptr as a Burst. -// The caller must ensure ptr points to a valid ANeuralNetworksBurst. -func NewBurstFromUintPtr(ptr uintptr) *Burst { - return &Burst{ptr: (*capi.ANeuralNetworksBurst)(unsafe.Pointer(ptr))} -} diff --git a/nnapi/compilation.go b/nnapi/compilation.go deleted file mode 100644 index a0cbfb4..0000000 --- a/nnapi/compilation.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// Compilation wraps the NDK ANeuralNetworksCompilation handle. -type Compilation struct { - ptr *capi.ANeuralNetworksCompilation -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Compilation) cptr() *capi.ANeuralNetworksCompilation { - if h == nil { - return nil - } - return h.ptr -} - -// NewCompilationFromPointer wraps a raw ANeuralNetworksCompilation pointer. -func NewCompilationFromPointer(ptr unsafe.Pointer) *Compilation { - return &Compilation{ptr: (*capi.ANeuralNetworksCompilation)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Compilation) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Compilation) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewCompilationFromUintPtr wraps a uintptr as a Compilation. -// The caller must ensure ptr points to a valid ANeuralNetworksCompilation. -func NewCompilationFromUintPtr(ptr uintptr) *Compilation { - return &Compilation{ptr: (*capi.ANeuralNetworksCompilation)(unsafe.Pointer(ptr))} -} - -// NewBurst creates a new Burst from this Compilation. -func (h *Compilation) NewBurst() (*Burst, error) { - var ptr *capi.ANeuralNetworksBurst - if err := result(capi.ANeuralNetworksBurst_create(h.ptr, &ptr)); err != nil { - return nil, err - } - return &Burst{ptr: ptr}, nil -} - -// Finish calls the underlying NDK function. -func (h *Compilation) Finish() error { - return result(capi.ANeuralNetworksCompilation_finish(h.ptr)) -} - -// SetCaching calls the underlying NDK function. -func (h *Compilation) SetCaching(cacheDir string, token *uint8) error { - return result(capi.ANeuralNetworksCompilation_setCaching(h.ptr, cacheDir, token)) -} - -// SetPreference calls the underlying NDK function. -func (h *Compilation) SetPreference(preference Preference) error { - return result(capi.ANeuralNetworksCompilation_setPreference(h.ptr, int32(preference))) -} - -// SetPriority calls the underlying NDK function. -func (h *Compilation) SetPriority(priority int32) error { - return result(capi.ANeuralNetworksCompilation_setPriority(h.ptr, priority)) -} - -// SetTimeout calls the underlying NDK function. -func (h *Compilation) SetTimeout(duration uint64) error { - return result(capi.ANeuralNetworksCompilation_setTimeout(h.ptr, duration)) -} - -// NewExecution creates a new Execution from this Compilation. -func (h *Compilation) NewExecution() (*Execution, error) { - var ptr *capi.ANeuralNetworksExecution - if err := result(capi.ANeuralNetworksExecution_create(h.ptr, &ptr)); err != nil { - return nil, err - } - return &Execution{ptr: ptr}, nil -} diff --git a/nnapi/compilation_close.go b/nnapi/compilation_close.go deleted file mode 100644 index 382f832..0000000 --- a/nnapi/compilation_close.go +++ /dev/null @@ -1,15 +0,0 @@ -package nnapi - -import ( - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// Close releases the underlying NDK handle. -func (h *Compilation) Close() error { - if h.ptr == nil { - return nil - } - capi.ANeuralNetworksCompilation_free(h.ptr) - h.ptr = nil - return nil -} diff --git a/nnapi/device.go b/nnapi/device.go deleted file mode 100644 index 6e81bf2..0000000 --- a/nnapi/device.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// Device wraps the NDK ANeuralNetworksDevice handle. -type Device struct { - ptr *capi.ANeuralNetworksDevice -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Device) cptr() *capi.ANeuralNetworksDevice { - if h == nil { - return nil - } - return h.ptr -} - -// NewDeviceFromPointer wraps a raw ANeuralNetworksDevice pointer. -func NewDeviceFromPointer(ptr unsafe.Pointer) *Device { - return &Device{ptr: (*capi.ANeuralNetworksDevice)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Device) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Device) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewDeviceFromUintPtr wraps a uintptr as a Device. -// The caller must ensure ptr points to a valid ANeuralNetworksDevice. -func NewDeviceFromUintPtr(ptr uintptr) *Device { - return &Device{ptr: (*capi.ANeuralNetworksDevice)(unsafe.Pointer(ptr))} -} diff --git a/nnapi/errors.go b/nnapi/errors.go deleted file mode 100644 index 21f7923..0000000 --- a/nnapi/errors.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -const ( - ErrOutOfMemory Error = 1 - ErrIncomplete Error = 2 - ErrUnexpectedNull Error = 3 - ErrBadData Error = 4 - ErrOpFailed Error = 5 - ErrBadState Error = 6 - ErrUnmappable Error = 7 - ErrOutputInsufficientSize Error = 8 - ErrUnavailableDevice Error = 9 - ErrMissedDeadlineTransient Error = 10 - ErrMissedDeadlinePersistent Error = 11 - ErrResourceExhaustedTransient Error = 12 - ErrResourceExhaustedPersistent Error = 13 - ErrDeadObject Error = 14 -) - -func (e Error) Error() string { - return fmt.Sprintf("nnapi: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/nnapi/event.go b/nnapi/event.go deleted file mode 100644 index d0b24bf..0000000 --- a/nnapi/event.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// Event wraps the NDK ANeuralNetworksEvent handle. -type Event struct { - ptr *capi.ANeuralNetworksEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Event) cptr() *capi.ANeuralNetworksEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewEventFromPointer wraps a raw ANeuralNetworksEvent pointer. -func NewEventFromPointer(ptr unsafe.Pointer) *Event { - return &Event{ptr: (*capi.ANeuralNetworksEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Event) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Event) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewEventFromUintPtr wraps a uintptr as a Event. -// The caller must ensure ptr points to a valid ANeuralNetworksEvent. -func NewEventFromUintPtr(ptr uintptr) *Event { - return &Event{ptr: (*capi.ANeuralNetworksEvent)(unsafe.Pointer(ptr))} -} - -// Wait calls the underlying NDK function. -func (h *Event) Wait() error { - return result(capi.ANeuralNetworksEvent_wait(h.ptr)) -} diff --git a/nnapi/execution.go b/nnapi/execution.go deleted file mode 100644 index 22152fb..0000000 --- a/nnapi/execution.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// Execution wraps the NDK ANeuralNetworksExecution handle. -type Execution struct { - ptr *capi.ANeuralNetworksExecution -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Execution) cptr() *capi.ANeuralNetworksExecution { - if h == nil { - return nil - } - return h.ptr -} - -// NewExecutionFromPointer wraps a raw ANeuralNetworksExecution pointer. -func NewExecutionFromPointer(ptr unsafe.Pointer) *Execution { - return &Execution{ptr: (*capi.ANeuralNetworksExecution)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Execution) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Execution) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewExecutionFromUintPtr wraps a uintptr as a Execution. -// The caller must ensure ptr points to a valid ANeuralNetworksExecution. -func NewExecutionFromUintPtr(ptr uintptr) *Execution { - return &Execution{ptr: (*capi.ANeuralNetworksExecution)(unsafe.Pointer(ptr))} -} - -// Compute calls the underlying NDK function. -func (h *Execution) Compute() error { - return result(capi.ANeuralNetworksExecution_compute(h.ptr)) -} - -// GetDuration calls the underlying NDK function. -func (h *Execution) GetDuration(durationCode int32, duration *uint64) error { - return result(capi.ANeuralNetworksExecution_getDuration(h.ptr, durationCode, duration)) -} - -// SetMeasureTiming calls the underlying NDK function. -func (h *Execution) SetMeasureTiming(measure bool) error { - return result(capi.ANeuralNetworksExecution_setMeasureTiming(h.ptr, measure)) -} - -// SetTimeout calls the underlying NDK function. -func (h *Execution) SetTimeout(duration uint64) error { - return result(capi.ANeuralNetworksExecution_setTimeout(h.ptr, duration)) -} - -// StartCompute creates a new Event from this Execution. -func (h *Execution) StartCompute() (*Event, error) { - var ptr *capi.ANeuralNetworksEvent - if err := result(capi.ANeuralNetworksExecution_startCompute(h.ptr, &ptr)); err != nil { - return nil, err - } - return &Event{ptr: ptr}, nil -} diff --git a/nnapi/functions.go b/nnapi/functions.go deleted file mode 100644 index 070dd86..0000000 --- a/nnapi/functions.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// ANeuralNetworksCompilation_getPreferredMemoryAlignmentForInput calls the underlying C function. -func ANeuralNetworksCompilation_getPreferredMemoryAlignmentForInput(compilation *Compilation, index uint32, alignment *uint32) int32 { - return (int32)(capi.ANeuralNetworksCompilation_getPreferredMemoryAlignmentForInput(compilation.cptr(), index, alignment)) -} - -// ANeuralNetworksCompilation_getPreferredMemoryAlignmentForOutput calls the underlying C function. -func ANeuralNetworksCompilation_getPreferredMemoryAlignmentForOutput(compilation *Compilation, index uint32, alignment *uint32) int32 { - return (int32)(capi.ANeuralNetworksCompilation_getPreferredMemoryAlignmentForOutput(compilation.cptr(), index, alignment)) -} - -// ANeuralNetworksCompilation_getPreferredMemoryPaddingForInput calls the underlying C function. -func ANeuralNetworksCompilation_getPreferredMemoryPaddingForInput(compilation *Compilation, index uint32, padding *uint32) int32 { - return (int32)(capi.ANeuralNetworksCompilation_getPreferredMemoryPaddingForInput(compilation.cptr(), index, padding)) -} - -// ANeuralNetworksCompilation_getPreferredMemoryPaddingForOutput calls the underlying C function. -func ANeuralNetworksCompilation_getPreferredMemoryPaddingForOutput(compilation *Compilation, index uint32, padding *uint32) int32 { - return (int32)(capi.ANeuralNetworksCompilation_getPreferredMemoryPaddingForOutput(compilation.cptr(), index, padding)) -} - -// ANeuralNetworksDevice_wait calls the underlying C function. -func ANeuralNetworksDevice_wait(device *Device) int32 { - return (int32)(capi.ANeuralNetworksDevice_wait(device.cptr())) -} - -// ANeuralNetworksEvent_getSyncFenceFd calls the underlying C function. -func ANeuralNetworksEvent_getSyncFenceFd(event *Event, sync_fence_fd *int32) int32 { - return (int32)(capi.ANeuralNetworksEvent_getSyncFenceFd(event.cptr(), sync_fence_fd)) -} - -// ANeuralNetworksExecution_burstCompute calls the underlying C function. -func ANeuralNetworksExecution_burstCompute(execution *Execution, burst *Burst) int32 { - return (int32)(capi.ANeuralNetworksExecution_burstCompute(execution.cptr(), burst.cptr())) -} - -// ANeuralNetworksExecution_enableInputAndOutputPadding calls the underlying C function. -func ANeuralNetworksExecution_enableInputAndOutputPadding(execution *Execution, enable bool) int32 { - return (int32)(capi.ANeuralNetworksExecution_enableInputAndOutputPadding(execution.cptr(), enable)) -} - -// ANeuralNetworksExecution_getOutputOperandDimensions calls the underlying C function. -func ANeuralNetworksExecution_getOutputOperandDimensions(execution *Execution, index int32, dimensions *uint32) int32 { - return (int32)(capi.ANeuralNetworksExecution_getOutputOperandDimensions(execution.cptr(), index, dimensions)) -} - -// ANeuralNetworksExecution_getOutputOperandRank calls the underlying C function. -func ANeuralNetworksExecution_getOutputOperandRank(execution *Execution, index int32, rank *uint32) int32 { - return (int32)(capi.ANeuralNetworksExecution_getOutputOperandRank(execution.cptr(), index, rank)) -} - -// ANeuralNetworksExecution_setLoopTimeout calls the underlying C function. -func ANeuralNetworksExecution_setLoopTimeout(execution *Execution, duration uint64) int32 { - return (int32)(capi.ANeuralNetworksExecution_setLoopTimeout(execution.cptr(), duration)) -} - -// ANeuralNetworksExecution_setReusable calls the underlying C function. -func ANeuralNetworksExecution_setReusable(execution *Execution, reusable bool) int32 { - return (int32)(capi.ANeuralNetworksExecution_setReusable(execution.cptr(), reusable)) -} - -// ANeuralNetworksMemoryDesc_addInputRole calls the underlying C function. -func ANeuralNetworksMemoryDesc_addInputRole(desc *ANeuralNetworksMemoryDesc, compilation *Compilation, index uint32, frequency float32) int32 { - return (int32)(capi.ANeuralNetworksMemoryDesc_addInputRole((*capi.ANeuralNetworksMemoryDesc)(desc), compilation.cptr(), index, frequency)) -} - -// ANeuralNetworksMemoryDesc_addOutputRole calls the underlying C function. -func ANeuralNetworksMemoryDesc_addOutputRole(desc *ANeuralNetworksMemoryDesc, compilation *Compilation, index uint32, frequency float32) int32 { - return (int32)(capi.ANeuralNetworksMemoryDesc_addOutputRole((*capi.ANeuralNetworksMemoryDesc)(desc), compilation.cptr(), index, frequency)) -} - -// ANeuralNetworksMemoryDesc_finish calls the underlying C function. -func ANeuralNetworksMemoryDesc_finish(desc *ANeuralNetworksMemoryDesc) int32 { - return (int32)(capi.ANeuralNetworksMemoryDesc_finish((*capi.ANeuralNetworksMemoryDesc)(desc))) -} - -// ANeuralNetworksMemoryDesc_free calls the underlying C function. -func ANeuralNetworksMemoryDesc_free(desc *ANeuralNetworksMemoryDesc) { - capi.ANeuralNetworksMemoryDesc_free((*capi.ANeuralNetworksMemoryDesc)(desc)) -} - -// ANeuralNetworksMemoryDesc_setDimensions calls the underlying C function. -func ANeuralNetworksMemoryDesc_setDimensions(desc *ANeuralNetworksMemoryDesc, rank uint32, dimensions *uint32) int32 { - return (int32)(capi.ANeuralNetworksMemoryDesc_setDimensions((*capi.ANeuralNetworksMemoryDesc)(desc), rank, dimensions)) -} - -// ANeuralNetworksMemory_copy calls the underlying C function. -func ANeuralNetworksMemory_copy(src *Memory, dst *Memory) int32 { - return (int32)(capi.ANeuralNetworksMemory_copy(src.cptr(), dst.cptr())) -} - -// ANeuralNetworksModel_setOperandSymmPerChannelQuantParams calls the underlying C function. -func ANeuralNetworksModel_setOperandSymmPerChannelQuantParams(model *Model, index int32, channelQuant *ANeuralNetworksSymmPerChannelQuantParams) int32 { - return (int32)(capi.ANeuralNetworksModel_setOperandSymmPerChannelQuantParams(model.cptr(), index, (*capi.ANeuralNetworksSymmPerChannelQuantParams)(channelQuant))) -} - -// ANeuralNetworksModel_setOperandValueFromMemory calls the underlying C function. -func ANeuralNetworksModel_setOperandValueFromMemory(model *Model, index int32, memory *Memory, offset uint64, length uint64) int32 { - return (int32)(capi.ANeuralNetworksModel_setOperandValueFromMemory(model.cptr(), index, memory.cptr(), offset, length)) -} - -// ANeuralNetworksModel_setOperandValueFromModel calls the underlying C function. -func ANeuralNetworksModel_setOperandValueFromModel(model *Model, index int32, value *Model) int32 { - return (int32)(capi.ANeuralNetworksModel_setOperandValueFromModel(model.cptr(), index, value.cptr())) -} - -// ANeuralNetworks_getDefaultLoopTimeout calls the underlying C function. -func ANeuralNetworks_getDefaultLoopTimeout() uint64 { - return (uint64)(capi.ANeuralNetworks_getDefaultLoopTimeout()) -} - -// ANeuralNetworks_getMaximumLoopTimeout calls the underlying C function. -func ANeuralNetworks_getMaximumLoopTimeout() uint64 { - return (uint64)(capi.ANeuralNetworks_getMaximumLoopTimeout()) -} - -// ANeuralNetworks_getRuntimeFeatureLevel calls the underlying C function. -func ANeuralNetworks_getRuntimeFeatureLevel() int64 { - return (int64)(capi.ANeuralNetworks_getRuntimeFeatureLevel()) -} diff --git a/nnapi/fuse_code.go b/nnapi/fuse_code.go deleted file mode 100644 index 5b49ca1..0000000 --- a/nnapi/fuse_code.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -type FuseCode int32 - -const ( - FusedNone FuseCode = 0 - FusedRelu FuseCode = 1 - FusedRelu1 FuseCode = 2 - FusedRelu6 FuseCode = 3 -) diff --git a/nnapi/memory.go b/nnapi/memory.go deleted file mode 100644 index 57c9f56..0000000 --- a/nnapi/memory.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// Memory wraps the NDK ANeuralNetworksMemory handle. -type Memory struct { - ptr *capi.ANeuralNetworksMemory -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Memory) cptr() *capi.ANeuralNetworksMemory { - if h == nil { - return nil - } - return h.ptr -} - -// NewMemoryFromPointer wraps a raw ANeuralNetworksMemory pointer. -func NewMemoryFromPointer(ptr unsafe.Pointer) *Memory { - return &Memory{ptr: (*capi.ANeuralNetworksMemory)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Memory) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Memory) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMemoryFromUintPtr wraps a uintptr as a Memory. -// The caller must ensure ptr points to a valid ANeuralNetworksMemory. -func NewMemoryFromUintPtr(ptr uintptr) *Memory { - return &Memory{ptr: (*capi.ANeuralNetworksMemory)(unsafe.Pointer(ptr))} -} diff --git a/nnapi/model.go b/nnapi/model.go deleted file mode 100644 index 914e41a..0000000 --- a/nnapi/model.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// Model wraps the NDK ANeuralNetworksModel handle. -type Model struct { - ptr *capi.ANeuralNetworksModel -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Model) cptr() *capi.ANeuralNetworksModel { - if h == nil { - return nil - } - return h.ptr -} - -// NewModelFromPointer wraps a raw ANeuralNetworksModel pointer. -func NewModelFromPointer(ptr unsafe.Pointer) *Model { - return &Model{ptr: (*capi.ANeuralNetworksModel)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Model) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Model) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewModelFromUintPtr wraps a uintptr as a Model. -// The caller must ensure ptr points to a valid ANeuralNetworksModel. -func NewModelFromUintPtr(ptr uintptr) *Model { - return &Model{ptr: (*capi.ANeuralNetworksModel)(unsafe.Pointer(ptr))} -} - -// NewCompilation creates a new Compilation from this Model. -func (h *Model) NewCompilation() (*Compilation, error) { - var ptr *capi.ANeuralNetworksCompilation - if err := result(capi.ANeuralNetworksCompilation_create(h.ptr, &ptr)); err != nil { - return nil, err - } - return &Compilation{ptr: ptr}, nil -} - -// AddOperation calls the underlying NDK function. -func (h *Model) AddOperation(_type ANeuralNetworksOperationType, inputCount uint32, inputs *uint32, outputCount uint32, outputs *uint32) error { - return result(capi.ANeuralNetworksModel_addOperation(h.ptr, capi.ANeuralNetworksOperationType(_type), inputCount, inputs, outputCount, outputs)) -} - -// Finish calls the underlying NDK function. -func (h *Model) Finish() error { - return result(capi.ANeuralNetworksModel_finish(h.ptr)) -} - -// IdentifyInputsAndOutputs calls the underlying NDK function. -func (h *Model) IdentifyInputsAndOutputs(inputCount uint32, inputs *uint32, outputCount uint32, outputs *uint32) error { - return result(capi.ANeuralNetworksModel_identifyInputsAndOutputs(h.ptr, inputCount, inputs, outputCount, outputs)) -} - -// RelaxFloat32toFloat16 calls the underlying NDK function. -func (h *Model) RelaxFloat32toFloat16(allow bool) error { - return result(capi.ANeuralNetworksModel_relaxComputationFloat32toFloat16(h.ptr, allow)) -} - -// SetOperandValue calls the underlying NDK function. -func (h *Model) SetOperandValue(index int32, buffer unsafe.Pointer, length uint64) error { - return result(capi.ANeuralNetworksModel_setOperandValue(h.ptr, index, buffer, length)) -} diff --git a/nnapi/model_add_operand.go b/nnapi/model_add_operand.go deleted file mode 100644 index de680da..0000000 --- a/nnapi/model_add_operand.go +++ /dev/null @@ -1,48 +0,0 @@ -package nnapi - -import ( - "runtime" - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// OperandTypeDesc describes the type of an operand for AddOperand. -// It mirrors the C struct ANeuralNetworksOperandType. -type OperandTypeDesc struct { - Type OperandType - Dims []uint32 - Scale float32 - ZeroPoint int32 -} - -// operandTypeC mirrors the C ANeuralNetworksOperandType struct layout. -type operandTypeC struct { - Type int32 - DimensionCount uint32 - Dimensions *uint32 - Scale float32 - ZeroPoint int32 -} - -// AddOperand adds an operand to the model with the given type descriptor. -func (h *Model) AddOperand(desc OperandTypeDesc) error { - var ct operandTypeC - ct.Type = int32(desc.Type) - ct.DimensionCount = uint32(len(desc.Dims)) - if len(desc.Dims) > 0 { - ct.Dimensions = &desc.Dims[0] - } - ct.Scale = desc.Scale - ct.ZeroPoint = desc.ZeroPoint - - var pinner runtime.Pinner - pinner.Pin(&ct) - if ct.Dimensions != nil { - pinner.Pin(ct.Dimensions) - } - defer pinner.Unpin() - - goType := (*capi.ANeuralNetworksOperandType)(unsafe.Pointer(&ct)) - return result(int32(capi.ANeuralNetworksModel_addOperand(h.ptr, goType))) -} diff --git a/nnapi/model_create.go b/nnapi/model_create.go deleted file mode 100644 index 6e51a29..0000000 --- a/nnapi/model_create.go +++ /dev/null @@ -1,24 +0,0 @@ -package nnapi - -import ( - capi "github.com/AndroidGoLab/ndk/capi/neuralnetworks" -) - -// NewModel creates a new empty neural network model. -func NewModel() (*Model, error) { - var ptr *capi.ANeuralNetworksModel - if err := result(int32(capi.ANeuralNetworksModel_create(&ptr))); err != nil { - return nil, err - } - return &Model{ptr: ptr}, nil -} - -// Close releases the underlying NDK handle. -func (h *Model) Close() error { - if h.ptr == nil { - return nil - } - capi.ANeuralNetworksModel_free(h.ptr) - h.ptr = nil - return nil -} diff --git a/nnapi/operand_type.go b/nnapi/operand_type.go deleted file mode 100644 index a3a94b2..0000000 --- a/nnapi/operand_type.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -type OperandType int32 - -const ( - Float32 OperandType = 0 - Int32 OperandType = 1 - Uint32 OperandType = 2 - TensorFloat32 OperandType = 3 - TensorInt32 OperandType = 4 - TensorQuant8Asymm OperandType = 5 - Bool OperandType = 6 - TensorQuant16Symm OperandType = 7 - TensorFloat16 OperandType = 8 - TensorBool8 OperandType = 9 - Float16 OperandType = 10 - TensorQuant8SymmPerChannel OperandType = 11 - TensorQuant16Asymm OperandType = 12 - TensorQuant8Symm OperandType = 13 - TensorQuant8AsymmSigned OperandType = 14 -) diff --git a/nnapi/operation_type.go b/nnapi/operation_type.go deleted file mode 100644 index bdec798..0000000 --- a/nnapi/operation_type.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -type OperationType int32 - -const ( - Add OperationType = 0 - Mul OperationType = 18 - Relu OperationType = 19 - Softmax OperationType = 25 - FullyConnected OperationType = 9 - Conv2d OperationType = 3 - DepthwiseConv2d OperationType = 4 - AveragePool2d OperationType = 1 - MaxPool2d OperationType = 17 - Reshape OperationType = 22 - Concatenation OperationType = 2 -) diff --git a/nnapi/package.go b/nnapi/package.go deleted file mode 100644 index 8ac6b33..0000000 --- a/nnapi/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package nnapi provides Go bindings for Android Neural Networks API (NNAPI). -package nnapi diff --git a/nnapi/preference.go b/nnapi/preference.go deleted file mode 100644 index 9da9dac..0000000 --- a/nnapi/preference.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package nnapi - -type Preference int32 - -const ( - LowPower Preference = 0 - FastSingleAnswer Preference = 1 - SustainedSpeed Preference = 2 -) diff --git a/permission/errors.go b/permission/errors.go deleted file mode 100644 index 6f84d12..0000000 --- a/permission/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package permission diff --git a/permission/functions.go b/permission/functions.go deleted file mode 100644 index 94ee12b..0000000 --- a/permission/functions.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package permission - -import ( - capi "github.com/AndroidGoLab/ndk/capi/permission" -) - -// CheckPermission calls the underlying C function. -func CheckPermission(permission string, pid Pid_t, uid Uid_t, outResult *int32) int32 { - return (int32)(capi.APermissionManager_checkPermission(permission, capi.Pid_t(pid), capi.Uid_t(uid), outResult)) -} diff --git a/permission/package.go b/permission/package.go deleted file mode 100644 index 1727b7e..0000000 --- a/permission/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package permission provides Go bindings for Android Permission Manager. -package permission diff --git a/permission/permission_manager_status.go b/permission/permission_manager_status.go deleted file mode 100644 index 92f16d3..0000000 --- a/permission/permission_manager_status.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package permission - -type PERMISSION_MANAGER_STATUS int32 - -const ( - PERMISSION_MANAGER_STATUS_OK PERMISSION_MANAGER_STATUS = 0 - PERMISSION_MANAGER_STATUS_ERROR_UNKNOWN PERMISSION_MANAGER_STATUS = -1 - PERMISSION_MANAGER_STATUS_SERVICE_UNAVAILABLE PERMISSION_MANAGER_STATUS = -2 -) diff --git a/permission/pid_t.go b/permission/pid_t.go deleted file mode 100644 index 4d9a525..0000000 --- a/permission/pid_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package permission - -import ( - capi "github.com/AndroidGoLab/ndk/capi/permission" -) - -type Pid_t = capi.Pid_t diff --git a/permission/result.go b/permission/result.go deleted file mode 100644 index aa4ba7b..0000000 --- a/permission/result.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package permission - -type Result int32 - -const ( - Granted Result = 0 - Denied Result = -1 -) diff --git a/permission/uid_t.go b/permission/uid_t.go deleted file mode 100644 index 751fade..0000000 --- a/permission/uid_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package permission - -import ( - capi "github.com/AndroidGoLab/ndk/capi/permission" -) - -type Uid_t = capi.Uid_t diff --git a/persistablebundle/aparcel.go b/persistablebundle/aparcel.go deleted file mode 100644 index 49c4544..0000000 --- a/persistablebundle/aparcel.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package persistablebundle - -import ( - capi "github.com/AndroidGoLab/ndk/capi/persistablebundle" -) - -type AParcel = capi.AParcel diff --git a/persistablebundle/binder_status_t.go b/persistablebundle/binder_status_t.go deleted file mode 100644 index dbb4182..0000000 --- a/persistablebundle/binder_status_t.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package persistablebundle - -import ( - capi "github.com/AndroidGoLab/ndk/capi/persistablebundle" -) - -type Binder_status_t = capi.Binder_status_t diff --git a/persistablebundle/errors.go b/persistablebundle/errors.go deleted file mode 100644 index ab47b2a..0000000 --- a/persistablebundle/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package persistablebundle - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/persistablebundle/functions.go b/persistablebundle/functions.go deleted file mode 100644 index 861c28c..0000000 --- a/persistablebundle/functions.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package persistablebundle - -import ( - capi "github.com/AndroidGoLab/ndk/capi/persistablebundle" -) - -// ReadFromParcel calls the underlying C function. -func ReadFromParcel(parcel *AParcel) (*PersistableBundle, error) { - var outPBundlePtr *capi.APersistableBundle - ret := capi.APersistableBundle_readFromParcel((*capi.AParcel)(parcel), &outPBundlePtr) - if err := result(int32(ret)); err != nil { - return nil, err - } - return &PersistableBundle{ptr: outPBundlePtr}, nil -} diff --git a/persistablebundle/package.go b/persistablebundle/package.go deleted file mode 100644 index ee7d041..0000000 --- a/persistablebundle/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package persistablebundle provides Go bindings for Android PersistableBundle. -package persistablebundle diff --git a/persistablebundle/persistable_bundle.go b/persistablebundle/persistable_bundle.go deleted file mode 100644 index 69e1cbc..0000000 --- a/persistablebundle/persistable_bundle.go +++ /dev/null @@ -1,186 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package persistablebundle - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/persistablebundle" -) - -// PersistableBundle wraps the NDK APersistableBundle handle. -type PersistableBundle struct { - ptr *capi.APersistableBundle -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *PersistableBundle) cptr() *capi.APersistableBundle { - if h == nil { - return nil - } - return h.ptr -} - -// NewPersistableBundle creates a new PersistableBundle. -func NewPersistableBundle() *PersistableBundle { - return &PersistableBundle{ptr: capi.APersistableBundle_new()} -} - -// Close releases the underlying NDK handle. -func (h *PersistableBundle) Close() error { - if h.ptr == nil { - return nil - } - capi.APersistableBundle_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewPersistableBundleFromPointer wraps a raw APersistableBundle pointer. -func NewPersistableBundleFromPointer(ptr unsafe.Pointer) *PersistableBundle { - return &PersistableBundle{ptr: (*capi.APersistableBundle)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *PersistableBundle) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *PersistableBundle) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewPersistableBundleFromUintPtr wraps a uintptr as a PersistableBundle. -// The caller must ensure ptr points to a valid APersistableBundle. -func NewPersistableBundleFromUintPtr(ptr uintptr) *PersistableBundle { - return &PersistableBundle{ptr: (*capi.APersistableBundle)(unsafe.Pointer(ptr))} -} - -// Dup creates a new PersistableBundle from this PersistableBundle. -func (h *PersistableBundle) Dup() *PersistableBundle { - return &PersistableBundle{ptr: capi.APersistableBundle_dup(h.ptr)} -} - -// Erase returns the value directly. -func (h *PersistableBundle) Erase(key string) int32 { - return (int32)(capi.APersistableBundle_erase(h.ptr, key)) -} - -// GetBoolean returns the value directly. -func (h *PersistableBundle) GetBoolean(key string, val *bool) bool { - return (bool)(capi.APersistableBundle_getBoolean(h.ptr, key, val)) -} - -// GetBooleanVector returns the value directly. -func (h *PersistableBundle) GetBooleanVector(key string, buffer *bool, bufferSizeBytes int32) int32 { - return (int32)(capi.APersistableBundle_getBooleanVector(h.ptr, key, buffer, bufferSizeBytes)) -} - -// GetDouble returns the value directly. -func (h *PersistableBundle) GetDouble(key string, val *float64) bool { - return (bool)(capi.APersistableBundle_getDouble(h.ptr, key, val)) -} - -// GetDoubleVector returns the value directly. -func (h *PersistableBundle) GetDoubleVector(key string, buffer *float64, bufferSizeBytes int32) int32 { - return (int32)(capi.APersistableBundle_getDoubleVector(h.ptr, key, buffer, bufferSizeBytes)) -} - -// GetInt returns the value directly. -func (h *PersistableBundle) GetInt(key string, val *int32) bool { - return (bool)(capi.APersistableBundle_getInt(h.ptr, key, val)) -} - -// GetIntVector returns the value directly. -func (h *PersistableBundle) GetIntVector(key string, buffer *int32, bufferSizeBytes int32) int32 { - return (int32)(capi.APersistableBundle_getIntVector(h.ptr, key, buffer, bufferSizeBytes)) -} - -// GetLong returns the value directly. -func (h *PersistableBundle) GetLong(key string, val *int64) bool { - return (bool)(capi.APersistableBundle_getLong(h.ptr, key, val)) -} - -// GetLongVector returns the value directly. -func (h *PersistableBundle) GetLongVector(key string, buffer *int64, bufferSizeBytes int32) int32 { - return (int32)(capi.APersistableBundle_getLongVector(h.ptr, key, buffer, bufferSizeBytes)) -} - -// GetPersistableBundle calls the underlying NDK function. -func (h *PersistableBundle) GetPersistableBundle(key string) (*PersistableBundle, bool) { - var outBundlePtr *capi.APersistableBundle - ok := capi.APersistableBundle_getPersistableBundle(h.ptr, key, &outBundlePtr) - if !ok { - return nil, false - } - return &PersistableBundle{ptr: outBundlePtr}, true -} - -// IsEqual returns the value directly. -func (h *PersistableBundle) IsEqual(rhs *PersistableBundle) bool { - return (bool)(capi.APersistableBundle_isEqual(h.ptr, rhs.cptr())) -} - -// PutBoolean calls the underlying NDK function. -func (h *PersistableBundle) PutBoolean(key string, val bool) { - capi.APersistableBundle_putBoolean(h.ptr, key, val) -} - -// PutBooleanVector calls the underlying NDK function. -func (h *PersistableBundle) PutBooleanVector(key string, vec *bool, num int32) { - capi.APersistableBundle_putBooleanVector(h.ptr, key, vec, num) -} - -// PutDouble calls the underlying NDK function. -func (h *PersistableBundle) PutDouble(key string, val float64) { - capi.APersistableBundle_putDouble(h.ptr, key, val) -} - -// PutDoubleVector calls the underlying NDK function. -func (h *PersistableBundle) PutDoubleVector(key string, vec *float64, num int32) { - capi.APersistableBundle_putDoubleVector(h.ptr, key, vec, num) -} - -// PutInt calls the underlying NDK function. -func (h *PersistableBundle) PutInt(key string, val int32) { - capi.APersistableBundle_putInt(h.ptr, key, val) -} - -// PutIntVector calls the underlying NDK function. -func (h *PersistableBundle) PutIntVector(key string, vec *int32, num int32) { - capi.APersistableBundle_putIntVector(h.ptr, key, vec, num) -} - -// PutLong calls the underlying NDK function. -func (h *PersistableBundle) PutLong(key string, val int64) { - capi.APersistableBundle_putLong(h.ptr, key, val) -} - -// PutLongVector calls the underlying NDK function. -func (h *PersistableBundle) PutLongVector(key string, vec *int64, num int32) { - capi.APersistableBundle_putLongVector(h.ptr, key, vec, num) -} - -// PutPersistableBundle calls the underlying NDK function. -func (h *PersistableBundle) PutPersistableBundle(key string, val *PersistableBundle) { - capi.APersistableBundle_putPersistableBundle(h.ptr, key, val.cptr()) -} - -// PutString calls the underlying NDK function. -func (h *PersistableBundle) PutString(key string, val string) { - capi.APersistableBundle_putString(h.ptr, key, val) -} - -// Size returns the value directly. -func (h *PersistableBundle) Size() int32 { - return (int32)(capi.APersistableBundle_size(h.ptr)) -} - -// WriteToParcel calls the underlying NDK function. -func (h *PersistableBundle) WriteToParcel(parcel *AParcel) error { - return result(capi.APersistableBundle_writeToParcel(h.ptr, (*capi.AParcel)(parcel))) -} diff --git a/persistablebundle/persistablebundle.go b/persistablebundle/persistablebundle.go deleted file mode 100644 index b115d94..0000000 --- a/persistablebundle/persistablebundle.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package persistablebundle - -type PERSISTABLEBUNDLE int32 - -const ( - APERSISTABLEBUNDLE_KEY_NOT_FOUND PERSISTABLEBUNDLE = -1 - APERSISTABLEBUNDLE_ALLOCATOR_FAILED PERSISTABLEBUNDLE = -2 -) diff --git a/proofs/.github/workflows/lean_action_ci.yml b/proofs/.github/workflows/lean_action_ci.yml deleted file mode 100644 index 09cd4ca..0000000 --- a/proofs/.github/workflows/lean_action_ci.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Lean Action CI - -on: - push: - pull_request: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: leanprover/lean-action@v1 diff --git a/proofs/.gitignore b/proofs/.gitignore deleted file mode 100644 index bfb30ec..0000000 --- a/proofs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.lake diff --git a/proofs/Main.lean b/proofs/Main.lean deleted file mode 100644 index aa9a86a..0000000 --- a/proofs/Main.lean +++ /dev/null @@ -1,70 +0,0 @@ -import Proofs - -/-! - Differential test oracle. - - Reads commands from stdin, runs the Lean spec functions, prints results. - Protocol: one command per line, tab-separated fields. - - exportName\t - stripPointers\t - commonPrefix\t\t - isConstructorFunc\t\t - isDestructorFunc\t\t - countGoParams\t - isScalarGoType\t - resolveType\t\t=,=,... - toSignedInt64\t - - Output: one result per line. --/ - -/-- Parse a comma-separated list of key=value pairs into an assoc list. -/ -def parseTypeMap (s : String) : List (String × String) := - if s.isEmpty then [] - else - let pairs := s.splitOn "," - pairs.filterMap fun pair => - match pair.splitOn "=" with - | [k, v] => some (k, v) - | _ => none - -def processLine (line : String) : IO Unit := do - let fields := line.splitOn "\t" - match fields with - | ["exportName", name] => - IO.println (exportName name) - | ["stripPointers", t] => - IO.println (stripPointers t) - | ["commonPrefix", a, b] => - IO.println (commonPrefix a b) - | ["isConstructorFunc", funcName, specTypeName] => - IO.println (toString (isConstructorFunc funcName specTypeName)) - | ["isDestructorFunc", funcName, specTypeName] => - IO.println (toString (isDestructorFunc funcName specTypeName)) - | ["countGoParams", sig] => - IO.println (toString (countGoParams sig)) - | ["isScalarGoType", t] => - IO.println (toString (isScalarGoType t)) - | ["resolveType", specType, mapStr] => - let typeMap := parseTypeMap mapStr - IO.println (resolveType specType typeMap) - | ["toSignedInt64", valStr] => - match valStr.toNat? with - | some n => IO.println (toString (toSignedInt64 (UInt64.ofNat n))) - | none => IO.println "ERROR: invalid uint64" - | _ => - IO.eprintln s!"Unknown command: {line}" - -def main : IO Unit := do - let stdin ← IO.getStdin - let mut done := false - while !done do - let line ← stdin.getLine - if line.isEmpty then - done := true - else - -- Only strip trailing newline/carriage-return, not tabs (which delimit fields). - let trimmed := line.dropRightWhile (fun c => c == '\n' || c == '\r') - if !trimmed.isEmpty then - processLine trimmed diff --git a/proofs/Proofs.lean b/proofs/Proofs.lean deleted file mode 100644 index 0fca43b..0000000 --- a/proofs/Proofs.lean +++ /dev/null @@ -1,9 +0,0 @@ --- Root of the NDK code generator correctness proofs. -import Proofs.Spec -import Proofs.ExportName -import Proofs.CommonPrefix -import Proofs.StripPointers -import Proofs.ConstructorDestructor -import Proofs.ResolveType -import Proofs.CountGoParams -import Proofs.ToSignedInt64 diff --git a/proofs/Proofs/CommonPrefix.lean b/proofs/Proofs/CommonPrefix.lean deleted file mode 100644 index 55ded2d..0000000 --- a/proofs/Proofs/CommonPrefix.lean +++ /dev/null @@ -1,68 +0,0 @@ -/- - CommonPrefix.lean — Proofs about the commonPrefix function. - - Key properties verified: - 1. Symmetry: commonPrefix a b = commonPrefix b a (structural proof) - 2. Self-identity: commonPrefix a a = a (structural proof) - 3. Empty absorption: commonPrefix "" b = "" (structural proof) - 4. Concrete test vectors (native_decide) --/ -import Proofs.Spec - -/-! ## Helper lemma: go is symmetric -/ - -private theorem go_symmetric (as bs : List Char) : - commonPrefix.go as bs = commonPrefix.go bs as := by - induction as generalizing bs with - | nil => - cases bs with - | nil => rfl - | cons _ _ => simp [commonPrefix.go] - | cons a as' ih => - cases bs with - | nil => simp [commonPrefix.go] - | cons b bs' => - simp only [commonPrefix.go] - by_cases hab : (a == b) = true - · have hba : (b == a) = true := by - simp [BEq.beq, beq_iff_eq] at hab ⊢; exact hab.symm - simp [hab, hba] - have : a = b := by simpa [BEq.beq, beq_iff_eq] using hab - subst this; exact ⟨rfl, ih bs'⟩ - · have hba : ¬((b == a) = true) := by - simp [BEq.beq, beq_iff_eq] at hab ⊢; exact fun h => hab h.symm - simp [hab, hba] - -private theorem go_self (cs : List Char) : - commonPrefix.go cs cs = cs := by - induction cs with - | nil => simp [commonPrefix.go] - | cons c rest ih => simp [commonPrefix.go, ih] - -/-! ## Main theorems -/ - -theorem commonPrefix_symmetric (a b : String) : - commonPrefix a b = commonPrefix b a := by - simp [commonPrefix] - exact congrArg String.mk (go_symmetric a.data b.data) - -theorem commonPrefix_self (s : String) : - commonPrefix s s = s := by - simp [commonPrefix] - exact congrArg String.mk (go_self s.data) - -theorem commonPrefix_empty_left (s : String) : - commonPrefix "" s = "" := by - simp [commonPrefix, commonPrefix.go] - -theorem commonPrefix_empty_right (s : String) : - commonPrefix s "" = "" := by - rw [commonPrefix_symmetric]; exact commonPrefix_empty_left s - -/-! ## Concrete test vectors -/ - -theorem commonPrefix_abc_abd : commonPrefix "abc" "abd" = "ab" := by native_decide -theorem commonPrefix_hello_help : commonPrefix "hello" "help" = "hel" := by native_decide -theorem commonPrefix_disjoint : commonPrefix "abc" "xyz" = "" := by native_decide -theorem commonPrefix_same : commonPrefix "test" "test" = "test" := by native_decide -theorem commonPrefix_prefix_of : commonPrefix "ab" "abcde" = "ab" := by native_decide diff --git a/proofs/Proofs/ConstructorDestructor.lean b/proofs/Proofs/ConstructorDestructor.lean deleted file mode 100644 index 9b33930..0000000 --- a/proofs/Proofs/ConstructorDestructor.lean +++ /dev/null @@ -1,88 +0,0 @@ -/- - ConstructorDestructor.lean — Proofs about constructor/destructor classification. - - Key properties: - 1. Disjointness: a function cannot be both constructor and destructor for the same type - 2. Detection correctness: matching suffixes are detected - 3. Non-matching names are rejected - - The disjointness property is critical for the merge logic: functions are assigned - to exactly one role. --/ -import Proofs.Spec - -set_option maxRecDepth 1024 - -/-! ## String append injectivity -/ - -private theorem string_append_left_cancel {a b c : String} (h : a ++ b = a ++ c) : b = c := by - have hd : a.data ++ b.data = a.data ++ c.data := by - rw [← String.data_append, ← String.data_append, h] - have := List.append_cancel_left hd - exact congrArg String.mk this - -/-! ## Disjointness: constructor suffixes are never destructor suffixes -/ - -private theorem ne_of_append_ne {t a b : String} (hab : a ≠ b) : t ++ a ≠ t ++ b := - fun h => absurd (string_append_left_cancel h) hab - -theorem create_not_destructor (t : String) : - isDestructorFunc (t ++ "_create") t = false := by - simp only [isDestructorFunc, destructorSuffixes, List.any_cons, List.any_nil, Bool.or_false, - Bool.or_eq_false_iff, beq_eq_false_iff_ne, ne_eq] - exact ⟨ne_of_append_ne (by decide), ne_of_append_ne (by decide), - ne_of_append_ne (by decide), ne_of_append_ne (by decide), - ne_of_append_ne (by decide)⟩ - -theorem new_not_destructor (t : String) : - isDestructorFunc (t ++ "_new") t = false := by - simp only [isDestructorFunc, destructorSuffixes, List.any_cons, List.any_nil, Bool.or_false, - Bool.or_eq_false_iff, beq_eq_false_iff_ne, ne_eq] - exact ⟨ne_of_append_ne (by decide), ne_of_append_ne (by decide), - ne_of_append_ne (by decide), ne_of_append_ne (by decide), - ne_of_append_ne (by decide)⟩ - -theorem delete_not_constructor (t : String) : - isConstructorFunc (t ++ "_delete") t = false := by - simp only [isConstructorFunc, constructorSuffixes, List.any_cons, List.any_nil, Bool.or_false, - Bool.or_eq_false_iff, beq_eq_false_iff_ne, ne_eq] - exact ⟨ne_of_append_ne (by decide), ne_of_append_ne (by decide)⟩ - -theorem free_not_constructor (t : String) : - isConstructorFunc (t ++ "_free") t = false := by - simp only [isConstructorFunc, constructorSuffixes, List.any_cons, List.any_nil, Bool.or_false, - Bool.or_eq_false_iff, beq_eq_false_iff_ne, ne_eq] - exact ⟨ne_of_append_ne (by decide), ne_of_append_ne (by decide)⟩ - -/-! ## Detection correctness -/ - -theorem constructor_create_detected (t : String) : - isConstructorFunc (t ++ "_create") t = true := by - simp [isConstructorFunc, constructorSuffixes] - -theorem constructor_new_detected (t : String) : - isConstructorFunc (t ++ "_new") t = true := by - simp [isConstructorFunc, constructorSuffixes] - -theorem destructor_delete_detected (t : String) : - isDestructorFunc (t ++ "_delete") t = true := by - simp [isDestructorFunc, destructorSuffixes] - -theorem destructor_release_detected (t : String) : - isDestructorFunc (t ++ "_release") t = true := by - simp [isDestructorFunc, destructorSuffixes] - -/-! ## Concrete test vectors -/ - -theorem ctor_ASensor_create : - isConstructorFunc "ASensor_create" "ASensor" = true := by native_decide -theorem dtor_ASensor_delete : - isDestructorFunc "ASensor_delete" "ASensor" = true := by native_decide -theorem not_ctor_ASensor_delete : - isConstructorFunc "ASensor_delete" "ASensor" = false := by native_decide -theorem not_dtor_ASensor_create : - isDestructorFunc "ASensor_create" "ASensor" = false := by native_decide -theorem not_ctor_unrelated : - isConstructorFunc "ASensor_getName" "ASensor" = false := by native_decide -theorem not_dtor_unrelated : - isDestructorFunc "ASensor_getName" "ASensor" = false := by native_decide diff --git a/proofs/Proofs/CountGoParams.lean b/proofs/Proofs/CountGoParams.lean deleted file mode 100644 index baedfbe..0000000 --- a/proofs/Proofs/CountGoParams.lean +++ /dev/null @@ -1,40 +0,0 @@ -/- - CountGoParams.lean — Proofs about the countGoParams function. - - Key properties: - 1. func() → 0 - 2. func(T) → 1 - 3. func(T, U) → 2 - 4. No parens → 0 --/ -import Proofs.Spec - -/-! ## Concrete verification -/ - -/-- Empty signature yields 0. -/ -theorem countGoParams_empty : countGoParams "" = 0 := by - native_decide - -/-- func() yields 0 parameters. -/ -theorem countGoParams_no_params : countGoParams "func()" = 0 := by - native_decide - -/-- func(int) yields 1 parameter. -/ -theorem countGoParams_one_param : countGoParams "func(int)" = 1 := by - native_decide - -/-- func(int, string) yields 2 parameters. -/ -theorem countGoParams_two_params : countGoParams "func(int, string)" = 2 := by - native_decide - -/-- func(int, string, bool) yields 3 parameters. -/ -theorem countGoParams_three_params : countGoParams "func(int, string, bool)" = 3 := by - native_decide - -/-- No parentheses yields 0. -/ -theorem countGoParams_no_parens : countGoParams "hello" = 0 := by - native_decide - -/-- func( ) with only whitespace yields 0. -/ -theorem countGoParams_whitespace : countGoParams "func( )" = 0 := by - native_decide diff --git a/proofs/Proofs/ExportName.lean b/proofs/Proofs/ExportName.lean deleted file mode 100644 index 59fb6c3..0000000 --- a/proofs/Proofs/ExportName.lean +++ /dev/null @@ -1,65 +0,0 @@ -/- - ExportName.lean — Proofs about the ExportName function. - - Key properties: - 1. Idempotency: ExportName(ExportName(x)) = ExportName(x) - 2. Non-empty output for non-empty input - 3. All-underscores returns input unchanged - 4. Concrete test vectors verified by native_decide --/ -import Proofs.Spec - -/-! ## Helper lemmas -/ - -/-- Dropping leading underscores from an already-stripped list is a no-op. -/ -theorem dropWhile_underscore_idempotent (cs : List Char) : - (cs.dropWhile (· == '_')).dropWhile (· == '_') = cs.dropWhile (· == '_') := by - induction cs with - | nil => simp [List.dropWhile] - | cons c rest ih => - simp only [List.dropWhile] - split - · exact ih - · simp [List.dropWhile, *] - -/-- stripLeadingUnderscores is idempotent. -/ -theorem stripLeadingUnderscores_idempotent (s : String) : - stripLeadingUnderscores (stripLeadingUnderscores s) = stripLeadingUnderscores s := by - simp [stripLeadingUnderscores] - exact congrArg String.mk (dropWhile_underscore_idempotent s.data) - -/-! ## Concrete test vectors -/ --- These verify the Lean model matches the Go implementation's behavior. - -theorem exportName_empty : exportName "" = "" := by native_decide -theorem exportName_underscore : exportName "_" = "_" := by native_decide -theorem exportName_double_underscore : exportName "__" = "__" := by native_decide -theorem exportName_leading_underscore : exportName "_foo" = "Foo" := by native_decide -theorem exportName_already_upper : exportName "Foo" = "Foo" := by native_decide -theorem exportName_lower_start : exportName "foo" = "Foo" := by native_decide -theorem exportName_mixed : exportName "__bar" = "Bar" := by native_decide -theorem exportName_ALooper : exportName "ALooper" = "ALooper" := by native_decide -theorem exportName_camera_status_t : exportName "camera_status_t" = "Camera_status_t" := by - native_decide - -/-! ## Idempotency via concrete verification -/ --- Since native_decide can verify concrete cases, we prove idempotency for --- representative inputs spanning all branches. - -theorem exportName_idempotent_empty : - exportName (exportName "") = exportName "" := by native_decide - -theorem exportName_idempotent_underscore : - exportName (exportName "_") = exportName "_" := by native_decide - -theorem exportName_idempotent_lower : - exportName (exportName "foo") = exportName "foo" := by native_decide - -theorem exportName_idempotent_upper : - exportName (exportName "Foo") = exportName "Foo" := by native_decide - -theorem exportName_idempotent_leading_under : - exportName (exportName "_bar") = exportName "_bar" := by native_decide - -theorem exportName_idempotent_ALooper : - exportName (exportName "ALooper") = exportName "ALooper" := by native_decide diff --git a/proofs/Proofs/ResolveType.lean b/proofs/Proofs/ResolveType.lean deleted file mode 100644 index b172bfc..0000000 --- a/proofs/Proofs/ResolveType.lean +++ /dev/null @@ -1,51 +0,0 @@ -/- - ResolveType.lean — Proofs about the resolveType function. - - Key properties: - 1. Identity for empty typeMap - 2. Direct lookup takes precedence - 3. Prefix preservation --/ -import Proofs.Spec - -/-! ## Main theorems -/ - -/-- resolveType returns the input unchanged when the typeMap is empty. -/ -theorem resolveType_empty_map (specType : String) : - resolveType specType [] = specType := by - simp [resolveType, resolveType.go] - -/-- Direct lookup takes precedence over prefix-based lookup. -/ -theorem resolveType_direct_precedence (specType goType : String) - (typeMap : List (String × String)) - (h : typeMap.lookup specType = some goType) : - resolveType specType typeMap = goType := by - simp [resolveType, h] - -/-! ## Concrete test vectors -/ - --- Direct lookup. -theorem resolveType_direct : resolveType "foo" [("foo", "bar")] = "bar" := by native_decide --- Pointer prefix preservation. -theorem resolveType_star : resolveType "*foo" [("foo", "Bar")] = "*Bar" := by native_decide --- Double pointer prefix preservation. -theorem resolveType_dstar : resolveType "**foo" [("foo", "Bar")] = "**Bar" := by native_decide --- Slice prefix preservation. -theorem resolveType_slice : resolveType "[]foo" [("foo", "Bar")] = "[]Bar" := by native_decide --- Unknown type returns unchanged. -theorem resolveType_unknown : resolveType "unknown" [("foo", "Bar")] = "unknown" := by - native_decide --- Direct lookup takes precedence over prefix. -theorem resolveType_direct_over_prefix : - resolveType "*foo" [("*foo", "Direct"), ("foo", "Prefix")] = "Direct" := by native_decide - -/-! ## Fixed-point property for concrete cases -/ - --- Resolving an already-resolved type is identity (when result is not in map). -theorem resolveType_fixedpoint_simple : - resolveType (resolveType "foo" [("foo", "Bar")]) [("foo", "Bar")] = "Bar" := by native_decide - --- Resolving an unknown type twice is identity. -theorem resolveType_fixedpoint_unknown : - resolveType (resolveType "unknown" [("foo", "Bar")]) [("foo", "Bar")] = "unknown" := by - native_decide diff --git a/proofs/Proofs/Spec.lean b/proofs/Proofs/Spec.lean deleted file mode 100644 index 4bfe560..0000000 --- a/proofs/Proofs/Spec.lean +++ /dev/null @@ -1,157 +0,0 @@ -/- - Spec.lean — Formal specifications of NDK code generator algorithms. - - Models the core pure functions from the Go codebase as Lean 4 definitions. - These are the reference implementations that the proofs verify. --/ - -/-! ## String utilities -/ - -/-- Strip all leading underscores from a string. -/ -def stripLeadingUnderscores (s : String) : String := - ⟨s.data.dropWhile (· == '_')⟩ - -/-- Capitalize the first character if it is ASCII lowercase. -/ -def capitalizeFirst (s : String) : String := - match s.data with - | [] => s - | c :: rest => - if c.val ≥ 'a'.val ∧ c.val ≤ 'z'.val then - ⟨⟨c.val - 'a'.val + 'A'.val, sorry⟩ :: rest⟩ - else s - -/-- ExportName: strip leading underscores and capitalize. - Models `capigen.ExportName` from generate.go:23-37. -/ -def exportName (name : String) : String := - let stripped := stripLeadingUnderscores name - if stripped.isEmpty then name - else capitalizeFirst stripped - -/-- Strip all leading '*' from a type string. - Models `capigen.stripPointers` from generate.go:1331-1336. -/ -def stripPointers (t : String) : String := - ⟨t.data.dropWhile (· == '*')⟩ - -/-- Check if a string is a Go scalar type. - Models `capigen.isScalarGoType` from typeconv.go:155-162. -/ -def isScalarGoType (t : String) : Bool := - t ∈ ["int8", "uint8", "int16", "uint16", "int32", "uint32", - "int64", "uint64", "float32", "float64", "bool", "int", "uint"] - -/-- Check if a string is a fixed-size array type like "[16]float32". - Models `capigen.isFixedArrayType` from typeconv.go:165-167. -/ -def isFixedArrayType (t : String) : Bool := - t.length > 2 ∧ t.get 0 == '[' ∧ t.get ⟨1⟩ != ']' - -/-! ## Common prefix -/ - -/-- Compute the longest common prefix of two strings. - Models `c2ffi.commonPrefix` from tospec.go:579-590. -/ -def commonPrefix (a b : String) : String := - ⟨go a.data b.data⟩ -where - go : List Char → List Char → List Char - | c₁ :: r₁, c₂ :: r₂ => if c₁ == c₂ then c₁ :: go r₁ r₂ else [] - | _, _ => [] - -/-! ## Constructor / destructor classification -/ - -/-- Destructor function suffixes. -/ -def destructorSuffixes : List String := - ["_delete", "_free", "_destroy", "_release", "_close"] - -/-- Constructor function suffixes. -/ -def constructorSuffixes : List String := - ["_create", "_new"] - -/-- Check if funcName is a destructor for specTypeName. - Models `idiomgen.isDestructorFunc` from merge.go:95-102. -/ -def isDestructorFunc (funcName specTypeName : String) : Bool := - destructorSuffixes.any (fun suffix => funcName == specTypeName ++ suffix) - -/-- Check if funcName is a constructor for specTypeName. - Models `idiomgen.isConstructorFunc` from merge.go:126-133. -/ -def isConstructorFunc (funcName specTypeName : String) : Bool := - constructorSuffixes.any (fun suffix => funcName == specTypeName ++ suffix) - -/-! ## toSignedInt64 -/ - -/-- The maximum value of a signed 32-bit integer. -/ -def maxInt32 : Nat := 2147483647 - -/-- The maximum value of an unsigned 32-bit integer. -/ -def maxUint32 : Nat := 4294967295 - -/-- Convert an unsigned uint64 enum value to signed int64. - Models `c2ffi.toSignedInt64` from tospec.go:470-475. - c2ffi outputs all enum values as unsigned, so -1 becomes 4294967295. -/ -def toSignedInt64 (v : UInt64) : Int64 := - if v.toNat > maxInt32 ∧ v.toNat ≤ maxUint32 then - -- Reinterpret as signed 32-bit, then extend to 64-bit. - Int64.ofInt (Int32.ofNat v.toNat).toInt - else - Int64.ofNat v.toNat - -/-! ## countGoParams -/ - -/-- Count commas in a string. -/ -def countCommas (s : String) : Nat := - s.data.filter (· == ',') |>.length - -/-- Count parameters in a Go function signature string. - Models `idiomgen.countGoParams` from merge.go:1502-1514. -/ -def countGoParams (sig : String) : Nat := - match sig.data.dropWhile (· != '(') with - | [] => 0 - | _ :: rest => - let inner := rest.takeWhile (· != ')') - let trimmed := inner.dropWhile Char.isWhitespace - if trimmed.isEmpty then 0 - else countCommas ⟨inner⟩ + 1 - -/-! ## resolveType -/ - -/-- A simple model of the typeMap-based type resolution. - Models `idiomgen.resolveType` from merge.go:1468-1482. -/ -def resolveType (specType : String) (typeMap : List (String × String)) : String := - -- Direct lookup. - match typeMap.lookup specType with - | some goType => goType - | none => - -- Try stripping prefixes. - let prefixes := ["[]", "**", "*"] - go prefixes -where - go : List String → String - | [] => specType - | pfx :: rest => - if specType.startsWith pfx then - let base := specType.drop pfx.length - match typeMap.lookup base with - | some goType => pfx ++ goType - | none => go rest - else go rest - -/-! ## stripAndTitle -/ - -/-- Capitalize the first character of a string (for toTitleCase). -/ -private def capFirst (s : String) : String := capitalizeFirst s - -/-- Convert UPPER_SNAKE_CASE to TitleCase. -/ -def toTitleCase (s : String) : String := - let lower := s.toLower - let parts := lower.splitOn "_" - let titled := parts.filterMap fun p => - if p.isEmpty then none - else some (capFirst p) - String.join titled - -/-- Strip a given constant string from the beginning of name and TitleCase the remainder. - Returns the original name if the result would be empty. - Models `idiomgen.stripAndTitle` from merge.go:1107-1116. -/ -def stripAndTitle (name pfx : String) : String := - if pfx.isEmpty then name - else - let s := if name.startsWith pfx then name.drop pfx.length else name - if s.isEmpty then name - else toTitleCase s diff --git a/proofs/Proofs/StripPointers.lean b/proofs/Proofs/StripPointers.lean deleted file mode 100644 index 7614b5c..0000000 --- a/proofs/Proofs/StripPointers.lean +++ /dev/null @@ -1,47 +0,0 @@ -/- - StripPointers.lean — Proofs about the stripPointers function. - - Key properties: - 1. Idempotency: stripPointers(stripPointers(x)) = stripPointers(x) - 2. No leading stars in result - 3. Identity on strings without leading '*' --/ -import Proofs.Spec - -/-! ## Idempotency proof -/ - -private theorem dropWhile_star_idempotent (cs : List Char) : - (cs.dropWhile (· == '*')).dropWhile (· == '*') = cs.dropWhile (· == '*') := by - induction cs with - | nil => simp [List.dropWhile] - | cons c rest ih => - simp only [List.dropWhile] - split - · exact ih - · simp [List.dropWhile, *] - -/-- stripPointers is idempotent. -/ -theorem stripPointers_idempotent (t : String) : - stripPointers (stripPointers t) = stripPointers t := by - simp [stripPointers] - exact congrArg String.mk (dropWhile_star_idempotent t.data) - -/-! ## Concrete test vectors -/ - -theorem stripPointers_empty : stripPointers "" = "" := by native_decide -theorem stripPointers_no_stars : stripPointers "ALooper" = "ALooper" := by native_decide -theorem stripPointers_one_star : stripPointers "*ALooper" = "ALooper" := by native_decide -theorem stripPointers_two_stars : stripPointers "**ALooper" = "ALooper" := by native_decide -theorem stripPointers_three_stars : stripPointers "***int32" = "int32" := by native_decide -theorem stripPointers_only_stars : stripPointers "***" = "" := by native_decide - -/-! ## Idempotency via concrete verification -/ - -theorem stripPointers_idempotent_empty : - stripPointers (stripPointers "") = stripPointers "" := by native_decide - -theorem stripPointers_idempotent_stars : - stripPointers (stripPointers "**foo") = stripPointers "**foo" := by native_decide - -theorem stripPointers_idempotent_no_stars : - stripPointers (stripPointers "bar") = stripPointers "bar" := by native_decide diff --git a/proofs/Proofs/ToSignedInt64.lean b/proofs/Proofs/ToSignedInt64.lean deleted file mode 100644 index 7a657ae..0000000 --- a/proofs/Proofs/ToSignedInt64.lean +++ /dev/null @@ -1,30 +0,0 @@ -/- - ToSignedInt64.lean — Proofs about the toSignedInt64 function. - - Key properties: - 1. Values ≤ MaxInt32 are preserved as-is - 2. Values in (MaxInt32, MaxUint32] are wrapped as signed int32 - 3. Values > MaxUint32 are preserved as uint64→int64 --/ -import Proofs.Spec - -/-! ## Concrete verification -/ - -/-- Zero maps to zero. -/ -theorem toSignedInt64_zero : toSignedInt64 0 = 0 := by native_decide - -/-- Small positive value preserved. -/ -theorem toSignedInt64_positive : toSignedInt64 42 = 42 := by native_decide - -/-- MaxInt32 (2147483647) is preserved. -/ -theorem toSignedInt64_max_int32 : toSignedInt64 2147483647 = 2147483647 := by native_decide - -/-- MaxInt32 + 1 (2147483648 = 0x80000000) wraps to -2147483648. -/ -theorem toSignedInt64_min_int32_unsigned : toSignedInt64 2147483648 = -2147483648 := by - native_decide - -/-- MaxUint32 (4294967295) wraps to -1 (c2ffi represents enum -1 as 4294967295). -/ -theorem toSignedInt64_minus_one : toSignedInt64 4294967295 = -1 := by native_decide - -/-- MaxUint32 + 1 (4294967296) is NOT in the uint32 wrap range, stays as-is. -/ -theorem toSignedInt64_above_uint32 : toSignedInt64 4294967296 = 4294967296 := by native_decide diff --git a/proofs/README.md b/proofs/README.md deleted file mode 100644 index 356efaf..0000000 --- a/proofs/README.md +++ /dev/null @@ -1 +0,0 @@ -# proofs \ No newline at end of file diff --git a/proofs/lake-manifest.json b/proofs/lake-manifest.json deleted file mode 100644 index 76920f0..0000000 --- a/proofs/lake-manifest.json +++ /dev/null @@ -1,5 +0,0 @@ -{"version": "1.1.0", - "packagesDir": ".lake/packages", - "packages": [], - "name": "proofs", - "lakeDir": ".lake"} diff --git a/proofs/lakefile.toml b/proofs/lakefile.toml deleted file mode 100644 index 4d5d759..0000000 --- a/proofs/lakefile.toml +++ /dev/null @@ -1,10 +0,0 @@ -name = "proofs" -version = "0.1.0" -defaultTargets = ["proofs"] - -[[lean_lib]] -name = "Proofs" - -[[lean_exe]] -name = "proofs" -root = "Main" diff --git a/proofs/lean-toolchain b/proofs/lean-toolchain deleted file mode 100644 index 2586f88..0000000 --- a/proofs/lean-toolchain +++ /dev/null @@ -1 +0,0 @@ -leanprover/lean4:v4.16.0 diff --git a/sensor/additional_info_event.go b/sensor/additional_info_event.go deleted file mode 100644 index 4f6215b..0000000 --- a/sensor/additional_info_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// AdditionalInfoEvent wraps the NDK AAdditionalInfoEvent handle. -type AdditionalInfoEvent struct { - ptr *capi.AAdditionalInfoEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *AdditionalInfoEvent) cptr() *capi.AAdditionalInfoEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewAdditionalInfoEventFromPointer wraps a raw AAdditionalInfoEvent pointer. -func NewAdditionalInfoEventFromPointer(ptr unsafe.Pointer) *AdditionalInfoEvent { - return &AdditionalInfoEvent{ptr: (*capi.AAdditionalInfoEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *AdditionalInfoEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *AdditionalInfoEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewAdditionalInfoEventFromUintPtr wraps a uintptr as a AdditionalInfoEvent. -// The caller must ensure ptr points to a valid AAdditionalInfoEvent. -func NewAdditionalInfoEventFromUintPtr(ptr uintptr) *AdditionalInfoEvent { - return &AdditionalInfoEvent{ptr: (*capi.AAdditionalInfoEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/alooper.go b/sensor/alooper.go deleted file mode 100644 index 0080eb7..0000000 --- a/sensor/alooper.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -type ALooper = capi.ALooper diff --git a/sensor/alooper_callback_func.go b/sensor/alooper_callback_func.go deleted file mode 100644 index 1fdad57..0000000 --- a/sensor/alooper_callback_func.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -type ALooper_callbackFunc = capi.ALooper_callbackFunc diff --git a/sensor/asensor_list.go b/sensor/asensor_list.go deleted file mode 100644 index ba41add..0000000 --- a/sensor/asensor_list.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -type ASensorList = capi.ASensorList diff --git a/sensor/asensor_ref.go b/sensor/asensor_ref.go deleted file mode 100644 index 2ba7a78..0000000 --- a/sensor/asensor_ref.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -type ASensorRef = capi.ASensorRef diff --git a/sensor/dynamic_sensor_event.go b/sensor/dynamic_sensor_event.go deleted file mode 100644 index 1901a74..0000000 --- a/sensor/dynamic_sensor_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// DynamicSensorEvent wraps the NDK ADynamicSensorEvent handle. -type DynamicSensorEvent struct { - ptr *capi.ADynamicSensorEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *DynamicSensorEvent) cptr() *capi.ADynamicSensorEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewDynamicSensorEventFromPointer wraps a raw ADynamicSensorEvent pointer. -func NewDynamicSensorEventFromPointer(ptr unsafe.Pointer) *DynamicSensorEvent { - return &DynamicSensorEvent{ptr: (*capi.ADynamicSensorEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *DynamicSensorEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *DynamicSensorEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewDynamicSensorEventFromUintPtr wraps a uintptr as a DynamicSensorEvent. -// The caller must ensure ptr points to a valid ADynamicSensorEvent. -func NewDynamicSensorEventFromUintPtr(ptr uintptr) *DynamicSensorEvent { - return &DynamicSensorEvent{ptr: (*capi.ADynamicSensorEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/errors.go b/sensor/errors.go deleted file mode 100644 index 08d992c..0000000 --- a/sensor/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/sensor/event_queue.go b/sensor/event_queue.go deleted file mode 100644 index 96d8d75..0000000 --- a/sensor/event_queue.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// EventQueue wraps the NDK ASensorEventQueue handle. -type EventQueue struct { - ptr *capi.ASensorEventQueue -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *EventQueue) cptr() *capi.ASensorEventQueue { - if h == nil { - return nil - } - return h.ptr -} - -// NewEventQueueFromPointer wraps a raw ASensorEventQueue pointer. -func NewEventQueueFromPointer(ptr unsafe.Pointer) *EventQueue { - return &EventQueue{ptr: (*capi.ASensorEventQueue)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *EventQueue) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *EventQueue) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewEventQueueFromUintPtr wraps a uintptr as a EventQueue. -// The caller must ensure ptr points to a valid ASensorEventQueue. -func NewEventQueueFromUintPtr(ptr uintptr) *EventQueue { - return &EventQueue{ptr: (*capi.ASensorEventQueue)(unsafe.Pointer(ptr))} -} - -// DisableSensor calls the underlying NDK function. -func (h *EventQueue) DisableSensor(sensor *Sensor) error { - return result(capi.ASensorEventQueue_disableSensor(h.ptr, sensor.cptr())) -} - -// EnableSensor calls the underlying NDK function. -func (h *EventQueue) EnableSensor(sensor *Sensor) error { - return result(capi.ASensorEventQueue_enableSensor(h.ptr, sensor.cptr())) -} - -// GetEvents returns the value directly. -func (h *EventQueue) GetEvents(events *SensorEvent, count uint64) int64 { - return (int64)(capi.ASensorEventQueue_getEvents(h.ptr, events.cptr(), count)) -} - -// HasEvents returns the value directly. -func (h *EventQueue) HasEvents() int32 { - return (int32)(capi.ASensorEventQueue_hasEvents(h.ptr)) -} - -// RegisterSensor calls the underlying NDK function. -func (h *EventQueue) RegisterSensor(sensor *Sensor, samplingPeriodUs int32, maxBatchReportLatencyUs int64) error { - return result(capi.ASensorEventQueue_registerSensor(h.ptr, sensor.cptr(), samplingPeriodUs, maxBatchReportLatencyUs)) -} - -// RequestAdditionalInfoEvents calls the underlying NDK function. -func (h *EventQueue) RequestAdditionalInfoEvents(enable bool) error { - return result(capi.ASensorEventQueue_requestAdditionalInfoEvents(h.ptr, enable)) -} - -// SetEventRate calls the underlying NDK function. -func (h *EventQueue) SetEventRate(sensor *Sensor, usec int32) error { - return result(capi.ASensorEventQueue_setEventRate(h.ptr, sensor.cptr(), usec)) -} diff --git a/sensor/functions.go b/sensor/functions.go deleted file mode 100644 index 2e13be0..0000000 --- a/sensor/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor diff --git a/sensor/hardware_buffer.go b/sensor/hardware_buffer.go deleted file mode 100644 index 238c271..0000000 --- a/sensor/hardware_buffer.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// HardwareBuffer wraps the NDK AHardwareBuffer handle. -type HardwareBuffer struct { - ptr *capi.AHardwareBuffer -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *HardwareBuffer) cptr() *capi.AHardwareBuffer { - if h == nil { - return nil - } - return h.ptr -} - -// NewHardwareBufferFromPointer wraps a raw AHardwareBuffer pointer. -func NewHardwareBufferFromPointer(ptr unsafe.Pointer) *HardwareBuffer { - return &HardwareBuffer{ptr: (*capi.AHardwareBuffer)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *HardwareBuffer) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *HardwareBuffer) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewHardwareBufferFromUintPtr wraps a uintptr as a HardwareBuffer. -// The caller must ensure ptr points to a valid AHardwareBuffer. -func NewHardwareBufferFromUintPtr(ptr uintptr) *HardwareBuffer { - return &HardwareBuffer{ptr: (*capi.AHardwareBuffer)(unsafe.Pointer(ptr))} -} diff --git a/sensor/head_tracker_event.go b/sensor/head_tracker_event.go deleted file mode 100644 index b7c3eb7..0000000 --- a/sensor/head_tracker_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// HeadTrackerEvent wraps the NDK AHeadTrackerEvent handle. -type HeadTrackerEvent struct { - ptr *capi.AHeadTrackerEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *HeadTrackerEvent) cptr() *capi.AHeadTrackerEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewHeadTrackerEventFromPointer wraps a raw AHeadTrackerEvent pointer. -func NewHeadTrackerEventFromPointer(ptr unsafe.Pointer) *HeadTrackerEvent { - return &HeadTrackerEvent{ptr: (*capi.AHeadTrackerEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *HeadTrackerEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *HeadTrackerEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewHeadTrackerEventFromUintPtr wraps a uintptr as a HeadTrackerEvent. -// The caller must ensure ptr points to a valid AHeadTrackerEvent. -func NewHeadTrackerEventFromUintPtr(ptr uintptr) *HeadTrackerEvent { - return &HeadTrackerEvent{ptr: (*capi.AHeadTrackerEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/heading_event.go b/sensor/heading_event.go deleted file mode 100644 index 7803e0b..0000000 --- a/sensor/heading_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// HeadingEvent wraps the NDK AHeadingEvent handle. -type HeadingEvent struct { - ptr *capi.AHeadingEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *HeadingEvent) cptr() *capi.AHeadingEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewHeadingEventFromPointer wraps a raw AHeadingEvent pointer. -func NewHeadingEventFromPointer(ptr unsafe.Pointer) *HeadingEvent { - return &HeadingEvent{ptr: (*capi.AHeadingEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *HeadingEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *HeadingEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewHeadingEventFromUintPtr wraps a uintptr as a HeadingEvent. -// The caller must ensure ptr points to a valid AHeadingEvent. -func NewHeadingEventFromUintPtr(ptr uintptr) *HeadingEvent { - return &HeadingEvent{ptr: (*capi.AHeadingEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/heart_rate_event.go b/sensor/heart_rate_event.go deleted file mode 100644 index c112aed..0000000 --- a/sensor/heart_rate_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// HeartRateEvent wraps the NDK AHeartRateEvent handle. -type HeartRateEvent struct { - ptr *capi.AHeartRateEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *HeartRateEvent) cptr() *capi.AHeartRateEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewHeartRateEventFromPointer wraps a raw AHeartRateEvent pointer. -func NewHeartRateEventFromPointer(ptr unsafe.Pointer) *HeartRateEvent { - return &HeartRateEvent{ptr: (*capi.AHeartRateEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *HeartRateEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *HeartRateEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewHeartRateEventFromUintPtr wraps a uintptr as a HeartRateEvent. -// The caller must ensure ptr points to a valid AHeartRateEvent. -func NewHeartRateEventFromUintPtr(ptr uintptr) *HeartRateEvent { - return &HeartRateEvent{ptr: (*capi.AHeartRateEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/limited_axes_imu_event.go b/sensor/limited_axes_imu_event.go deleted file mode 100644 index 03cbe61..0000000 --- a/sensor/limited_axes_imu_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// LimitedAxesImuEvent wraps the NDK ALimitedAxesImuEvent handle. -type LimitedAxesImuEvent struct { - ptr *capi.ALimitedAxesImuEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *LimitedAxesImuEvent) cptr() *capi.ALimitedAxesImuEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewLimitedAxesImuEventFromPointer wraps a raw ALimitedAxesImuEvent pointer. -func NewLimitedAxesImuEventFromPointer(ptr unsafe.Pointer) *LimitedAxesImuEvent { - return &LimitedAxesImuEvent{ptr: (*capi.ALimitedAxesImuEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *LimitedAxesImuEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *LimitedAxesImuEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewLimitedAxesImuEventFromUintPtr wraps a uintptr as a LimitedAxesImuEvent. -// The caller must ensure ptr points to a valid ALimitedAxesImuEvent. -func NewLimitedAxesImuEventFromUintPtr(ptr uintptr) *LimitedAxesImuEvent { - return &LimitedAxesImuEvent{ptr: (*capi.ALimitedAxesImuEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/limited_axes_imu_uncalibrated_event.go b/sensor/limited_axes_imu_uncalibrated_event.go deleted file mode 100644 index bbf3275..0000000 --- a/sensor/limited_axes_imu_uncalibrated_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// LimitedAxesImuUncalibratedEvent wraps the NDK ALimitedAxesImuUncalibratedEvent handle. -type LimitedAxesImuUncalibratedEvent struct { - ptr *capi.ALimitedAxesImuUncalibratedEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *LimitedAxesImuUncalibratedEvent) cptr() *capi.ALimitedAxesImuUncalibratedEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewLimitedAxesImuUncalibratedEventFromPointer wraps a raw ALimitedAxesImuUncalibratedEvent pointer. -func NewLimitedAxesImuUncalibratedEventFromPointer(ptr unsafe.Pointer) *LimitedAxesImuUncalibratedEvent { - return &LimitedAxesImuUncalibratedEvent{ptr: (*capi.ALimitedAxesImuUncalibratedEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *LimitedAxesImuUncalibratedEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *LimitedAxesImuUncalibratedEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewLimitedAxesImuUncalibratedEventFromUintPtr wraps a uintptr as a LimitedAxesImuUncalibratedEvent. -// The caller must ensure ptr points to a valid ALimitedAxesImuUncalibratedEvent. -func NewLimitedAxesImuUncalibratedEventFromUintPtr(ptr uintptr) *LimitedAxesImuUncalibratedEvent { - return &LimitedAxesImuUncalibratedEvent{ptr: (*capi.ALimitedAxesImuUncalibratedEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/manager.go b/sensor/manager.go deleted file mode 100644 index 37e5e95..0000000 --- a/sensor/manager.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// Manager wraps the NDK ASensorManager handle. -type Manager struct { - ptr *capi.ASensorManager -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Manager) cptr() *capi.ASensorManager { - if h == nil { - return nil - } - return h.ptr -} - -// NewManagerFromPointer wraps a raw ASensorManager pointer. -func NewManagerFromPointer(ptr unsafe.Pointer) *Manager { - return &Manager{ptr: (*capi.ASensorManager)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Manager) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Manager) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewManagerFromUintPtr wraps a uintptr as a Manager. -// The caller must ensure ptr points to a valid ASensorManager. -func NewManagerFromUintPtr(ptr uintptr) *Manager { - return &Manager{ptr: (*capi.ASensorManager)(unsafe.Pointer(ptr))} -} - -// ConfigureDirectReport calls the underlying NDK function. -func (h *Manager) ConfigureDirectReport(sensor *Sensor, channelID int32, rate int32) error { - return result(capi.ASensorManager_configureDirectReport(h.ptr, sensor.cptr(), channelID, rate)) -} - -// CreateEventQueue creates a new EventQueue from this Manager. -func (h *Manager) CreateEventQueue(looper *ALooper, ident int32, callback ALooper_callbackFunc, data unsafe.Pointer) *EventQueue { - return &EventQueue{ptr: capi.ASensorManager_createEventQueue(h.ptr, (*capi.ALooper)(looper), ident, capi.ALooper_callbackFunc(callback), data)} -} - -// CreateHardwareBufferDirectChannel calls the underlying NDK function. -func (h *Manager) CreateHardwareBufferDirectChannel(buffer *HardwareBuffer, size uint64) error { - return result(capi.ASensorManager_createHardwareBufferDirectChannel(h.ptr, buffer.cptr(), size)) -} - -// CreateSharedMemoryDirectChannel calls the underlying NDK function. -func (h *Manager) CreateSharedMemoryDirectChannel(fd int32, size uint64) error { - return result(capi.ASensorManager_createSharedMemoryDirectChannel(h.ptr, fd, size)) -} - -// DestroyDirectChannel calls the underlying NDK function. -func (h *Manager) DestroyDirectChannel(channelID int32) { - capi.ASensorManager_destroyDirectChannel(h.ptr, channelID) -} - -// DestroyEventQueue calls the underlying NDK function. -func (h *Manager) DestroyEventQueue(queue *EventQueue) error { - return result(capi.ASensorManager_destroyEventQueue(h.ptr, queue.cptr())) -} - -// DefaultSensor creates a new Sensor from this Manager. -func (h *Manager) DefaultSensor(_type Type) *Sensor { - return &Sensor{ptr: capi.ASensorManager_getDefaultSensor(h.ptr, int32(_type))} -} - -// GetDefaultSensorEx creates a new Sensor from this Manager. -func (h *Manager) GetDefaultSensorEx(_type Type, wakeUp bool) *Sensor { - return &Sensor{ptr: capi.ASensorManager_getDefaultSensorEx(h.ptr, int32(_type), wakeUp)} -} - -// GetDynamicSensorList returns the value directly. -func (h *Manager) GetDynamicSensorList(list *ASensorList) int64 { - return (int64)(capi.ASensorManager_getDynamicSensorList(h.ptr, (*capi.ASensorList)(list))) -} - -// GetInstance calls the underlying C function. -func GetInstance() *Manager { - return &Manager{ptr: capi.ASensorManager_getInstance()} -} - -// ASensorManager_getInstanceForPackage calls the underlying C function. -func ASensorManager_getInstanceForPackage(packageName string) *Manager { - return &Manager{ptr: capi.ASensorManager_getInstanceForPackage(packageName)} -} diff --git a/sensor/meta_data_event.go b/sensor/meta_data_event.go deleted file mode 100644 index d0467cc..0000000 --- a/sensor/meta_data_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// MetaDataEvent wraps the NDK AMetaDataEvent handle. -type MetaDataEvent struct { - ptr *capi.AMetaDataEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *MetaDataEvent) cptr() *capi.AMetaDataEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewMetaDataEventFromPointer wraps a raw AMetaDataEvent pointer. -func NewMetaDataEventFromPointer(ptr unsafe.Pointer) *MetaDataEvent { - return &MetaDataEvent{ptr: (*capi.AMetaDataEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *MetaDataEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *MetaDataEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewMetaDataEventFromUintPtr wraps a uintptr as a MetaDataEvent. -// The caller must ensure ptr points to a valid AMetaDataEvent. -func NewMetaDataEventFromUintPtr(ptr uintptr) *MetaDataEvent { - return &MetaDataEvent{ptr: (*capi.AMetaDataEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/package.go b/sensor/package.go deleted file mode 100644 index 0d96758..0000000 --- a/sensor/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package sensor provides Go bindings for Android Sensor NDK. -package sensor diff --git a/sensor/reporting_mode.go b/sensor/reporting_mode.go deleted file mode 100644 index 8e125a6..0000000 --- a/sensor/reporting_mode.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -type REPORTING_MODE int32 - -const ( - AREPORTING_MODE_INVALID REPORTING_MODE = -1 - AREPORTING_MODE_CONTINUOUS REPORTING_MODE = 0 - AREPORTING_MODE_ON_CHANGE REPORTING_MODE = 1 - AREPORTING_MODE_ONE_SHOT REPORTING_MODE = 2 - AREPORTING_MODE_SPECIAL_TRIGGER REPORTING_MODE = 3 -) diff --git a/sensor/sensor.go b/sensor/sensor.go index 02506d2..7c7ce36 100644 --- a/sensor/sensor.go +++ b/sensor/sensor.go @@ -1,111 +1,160 @@ -// Code generated by idiomgen. DO NOT EDIT. +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. package sensor import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" + "github.com/xaionaro-go/ndk/ndk" ) -// Sensor wraps the NDK ASensor handle. -type Sensor struct { - ptr *capi.ASensor -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Sensor) cptr() *capi.ASensor { - if h == nil { - return nil - } - return h.ptr -} - -// NewSensorFromPointer wraps a raw ASensor pointer. -func NewSensorFromPointer(ptr unsafe.Pointer) *Sensor { - return &Sensor{ptr: (*capi.ASensor)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Sensor) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Sensor) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSensorFromUintPtr wraps a uintptr as a Sensor. -// The caller must ensure ptr points to a valid ASensor. -func NewSensorFromUintPtr(ptr uintptr) *Sensor { - return &Sensor{ptr: (*capi.ASensor)(unsafe.Pointer(ptr))} -} - -// GetFifoMaxEventCount calls the underlying NDK function. -func (h *Sensor) GetFifoMaxEventCount() error { - return result(capi.ASensor_getFifoMaxEventCount(h.ptr)) -} - -// GetFifoReservedEventCount calls the underlying NDK function. -func (h *Sensor) GetFifoReservedEventCount() error { - return result(capi.ASensor_getFifoReservedEventCount(h.ptr)) -} - -// GetHandle calls the underlying NDK function. -func (h *Sensor) GetHandle() error { - return result(capi.ASensor_getHandle(h.ptr)) -} - -// GetHighestDirectReportRateLevel calls the underlying NDK function. -func (h *Sensor) GetHighestDirectReportRateLevel() error { - return result(capi.ASensor_getHighestDirectReportRateLevel(h.ptr)) -} - -// MinDelay returns the value directly. -func (h *Sensor) MinDelay() int32 { - return (int32)(capi.ASensor_getMinDelay(h.ptr)) -} - -// Name returns the value directly. -func (h *Sensor) Name() string { - return (string)(capi.ASensor_getName(h.ptr)) -} - -// GetReportingMode calls the underlying NDK function. -func (h *Sensor) GetReportingMode() error { - return result(capi.ASensor_getReportingMode(h.ptr)) -} - -// Resolution returns the value directly. -func (h *Sensor) Resolution() float32 { - return (float32)(capi.ASensor_getResolution(h.ptr)) -} - -// GetStringType returns the value directly. -func (h *Sensor) GetStringType() string { - return (string)(capi.ASensor_getStringType(h.ptr)) -} - -// Type returns the value directly. -func (h *Sensor) Type() int32 { - return (int32)(capi.ASensor_getType(h.ptr)) -} - -// Vendor returns the value directly. -func (h *Sensor) Vendor() string { - return (string)(capi.ASensor_getVendor(h.ptr)) -} - -// IsDirectChannelTypeSupported returns the value directly. -func (h *Sensor) IsDirectChannelTypeSupported(channelType int32) bool { - return (bool)(capi.ASensor_isDirectChannelTypeSupported(h.ptr, channelType)) -} +type TYPE = ndk.SENSOR_TYPE + +type AdditionalInfoEvent = ndk.AdditionalInfoEvent +type DynamicSensorEvent = ndk.DynamicSensorEvent +type HeartRateEvent = ndk.HeartRateEvent +type MetaDataEvent = ndk.MetaDataEvent +type UncalibratedEvent = ndk.UncalibratedEvent +type Vector = ndk.SensorVector +type MagneticVector = ndk.MagneticVector + +type Sensor = ndk.Sensor +type Event = ndk.SensorEvent +type Manager = ndk.SensorManager + +const ( + FIFO_COUNT_INVALID = ndk.SENSOR_FIFO_COUNT_INVALID + DELAY_INVALID = ndk.SENSOR_DELAY_INVALID + + /** + * Invalid sensor type. Returned by {@link ASensor_getType} as error value. + */ + TYPE_INVALID = ndk.SENSOR_TYPE_INVALID + /** + * {@link ASENSOR_TYPE_ACCELEROMETER} + * reporting-mode: continuous + * + * All values are in SI units (m/s^2) and measure the acceleration of the + * device minus the force of gravity. + */ + TYPE_ACCELEROMETER = ndk.SENSOR_TYPE_ACCELEROMETER + /** + * {@link ASENSOR_TYPE_MAGNETIC_FIELD} + * reporting-mode: continuous + * + * All values are in micro-Tesla (uT) and measure the geomagnetic + * field in the X, Y and Z axis. + */ + TYPE_MAGNETIC_FIELD = ndk.SENSOR_TYPE_MAGNETIC_FIELD + /** + * {@link ASENSOR_TYPE_GYROSCOPE} + * reporting-mode: continuous + * + * All values are in radians/second and measure the rate of rotation + * around the X, Y and Z axis. + */ + TYPE_GYROSCOPE = ndk.SENSOR_TYPE_GYROSCOPE + /** + * {@link ASENSOR_TYPE_LIGHT} + * reporting-mode: on-change + * + * The light sensor value is returned in SI lux units. + */ + TYPE_LIGHT = ndk.SENSOR_TYPE_LIGHT + /** + * {@link ASENSOR_TYPE_PROXIMITY} + * reporting-mode: on-change + * + * The proximity sensor which turns the screen off and back on during calls is the + * wake-up proximity sensor. Implement wake-up proximity sensor before implementing + * a non wake-up proximity sensor. For the wake-up proximity sensor set the flag + * SENSOR_FLAG_WAKE_UP. + * The value corresponds to the distance to the nearest object in centimeters. + */ + TYPE_PROXIMITY = ndk.SENSOR_TYPE_PROXIMITY + /** + * {@link ASENSOR_TYPE_LINEAR_ACCELERATION} + * reporting-mode: continuous + * + * All values are in SI units (m/s^2) and measure the acceleration of the + * device not including the force of gravity. + */ + TYPE_LINEAR_ACCELERATION = ndk.SENSOR_TYPE_LINEAR_ACCELERATION + + // java + TYPE_ORIENTATION = ndk.SENSOR_TYPE_ORIENTATION + TYPE_PRESSURE = ndk.SENSOR_TYPE_PRESSURE + TYPE_TEMPERATURE = ndk.SENSOR_TYPE_TEMPERATURE + TYPE_GRAVITY = ndk.SENSOR_TYPE_GRAVITY + TYPE_ROTATION_VECTOR = ndk.SENSOR_TYPE_ROTATION_VECTOR + TYPE_RELATIVE_HUMIDITY = ndk.SENSOR_TYPE_RELATIVE_HUMIDITY + TYPE_AMBIENT_TEMPERATURE = ndk.SENSOR_TYPE_AMBIENT_TEMPERATURE + TYPE_MAGNETIC_FIELD_UNCALIBRATED = ndk.SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED + TYPE_GAME_ROTATION_VECTOR = ndk.SENSOR_TYPE_GAME_ROTATION_VECTOR + TYPE_GYROSCOPE_UNCALIBRATED = ndk.SENSOR_TYPE_GYROSCOPE_UNCALIBRATED + TYPE_SIGNIFICANT_MOTION = ndk.SENSOR_TYPE_SIGNIFICANT_MOTION + TYPE_STEP_DETECTOR = ndk.SENSOR_TYPE_STEP_DETECTOR + TYPE_STEP_COUNTER = ndk.SENSOR_TYPE_STEP_COUNTER + TYPE_GEOMAGNETIC_ROTATION_VECTOR = ndk.SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR + TYPE_HEART_RATE = ndk.SENSOR_TYPE_HEART_RATE + TYPE_TILT_DETECTOR = ndk.SENSOR_TYPE_TILT_DETECTOR + TYPE_WAKE_GESTURE = ndk.SENSOR_TYPE_WAKE_GESTURE + TYPE_GLANCE_GESTURE = ndk.SENSOR_TYPE_GLANCE_GESTURE + TYPE_PICK_UP_GESTURE = ndk.SENSOR_TYPE_PICK_UP_GESTURE + TYPE_WRIST_TILT_GESTURE = ndk.SENSOR_TYPE_WRIST_TILT_GESTURE + TYPE_DEVICE_ORIENTATION = ndk.SENSOR_TYPE_DEVICE_ORIENTATION + TYPE_POSE_6DOF = ndk.SENSOR_TYPE_POSE_6DOF + TYPE_STATIONARY_DETECT = ndk.SENSOR_TYPE_STATIONARY_DETECT + TYPE_MOTION_DETECT = ndk.SENSOR_TYPE_MOTION_DETECT + TYPE_HEART_BEAT = ndk.SENSOR_TYPE_HEART_BEAT + TYPE_DYNAMIC_SENSOR_META = ndk.SENSOR_TYPE_DYNAMIC_SENSOR_META + TYPE_LOW_LATENCY_OFFBODY_DETECT = ndk.SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT + TYPE_ACCELEROMETER_UNCALIBRATED = ndk.SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED + + /** no contact */ + STATUS_NO_CONTACT = ndk.SENSOR_STATUS_NO_CONTACT + /** unreliable */ + STATUS_UNRELIABLE = ndk.SENSOR_STATUS_UNRELIABLE + /** low accuracy */ + STATUS_ACCURACY_LOW = ndk.SENSOR_STATUS_ACCURACY_LOW + /** medium accuracy */ + STATUS_ACCURACY_MEDIUM = ndk.SENSOR_STATUS_ACCURACY_MEDIUM + /** high accuracy */ + STATUS_ACCURACY_HIGH = ndk.SENSOR_STATUS_ACCURACY_HIGH + + /** invalid reporting mode */ + REPORTING_MODE_INVALID = ndk.REPORTING_MODE_INVALID + /** continuous reporting */ + REPORTING_MODE_CONTINUOUS = ndk.REPORTING_MODE_CONTINUOUS + /** reporting on change */ + REPORTING_MODE_ON_CHANGE = ndk.REPORTING_MODE_ON_CHANGE + /** on shot reporting */ + REPORTING_MODE_ONE_SHOT = ndk.REPORTING_MODE_ONE_SHOT + /** special trigger reporting */ + REPORTING_MODE_SPECIAL_TRIGGER = ndk.REPORTING_MODE_SPECIAL_TRIGGER + + /** stopped */ + DIRECT_RATE_STOP = ndk.SENSOR_DIRECT_RATE_STOP + /** nominal 50Hz */ + DIRECT_RATE_NORMAL = ndk.SENSOR_DIRECT_RATE_NORMAL + /** nominal 200Hz */ + DIRECT_RATE_FAST = ndk.SENSOR_DIRECT_RATE_FAST + /** nominal 800Hz */ + DIRECT_RATE_VERY_FAST = ndk.SENSOR_DIRECT_RATE_VERY_FAST + + /** shared memory created by ASharedMemory_create */ + DIRECT_CHANNEL_TYPE_SHARED_MEMORY = ndk.SENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY + /** AHardwareBuffer */ + DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER = ndk.SENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER + + /** Earth's gravity in m/s^2 */ + STANDARD_GRAVITY = ndk.SENSOR_STANDARD_GRAVITY + /** Maximum magnetic field on Earth's surface in uT */ + MAGNETIC_FIELD_EARTH_MAX = ndk.SENSOR_MAGNETIC_FIELD_EARTH_MAX + /** Minimum magnetic field on Earth's surface in uT*/ + MAGNETIC_FIELD_EARTH_MIN = ndk.SENSOR_MAGNETIC_FIELD_EARTH_MIN +) -// IsWakeUpSensor returns the value directly. -func (h *Sensor) IsWakeUpSensor() bool { - return (bool)(capi.ASensor_isWakeUpSensor(h.ptr)) +func ManagerInstance() *Manager { + return ndk.SensorManagerInstance() } diff --git a/sensor/sensor_additional_info.go b/sensor/sensor_additional_info.go deleted file mode 100644 index 11a0a16..0000000 --- a/sensor/sensor_additional_info.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -type SENSOR_ADDITIONAL_INFO int32 - -const ( - ASENSOR_ADDITIONAL_INFO_BEGIN SENSOR_ADDITIONAL_INFO = 0 - ASENSOR_ADDITIONAL_INFO_END SENSOR_ADDITIONAL_INFO = 1 - ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY SENSOR_ADDITIONAL_INFO = 65536 - ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE SENSOR_ADDITIONAL_INFO = 65537 - ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION SENSOR_ADDITIONAL_INFO = 65538 - ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT SENSOR_ADDITIONAL_INFO = 65539 - ASENSOR_ADDITIONAL_INFO_SAMPLING SENSOR_ADDITIONAL_INFO = 65540 -) diff --git a/sensor/sensor_direct_channel_type.go b/sensor/sensor_direct_channel_type.go deleted file mode 100644 index 5c80a20..0000000 --- a/sensor/sensor_direct_channel_type.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -type SENSOR_DIRECT_CHANNEL_TYPE int32 - -const ( - ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY SENSOR_DIRECT_CHANNEL_TYPE = 1 - ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER SENSOR_DIRECT_CHANNEL_TYPE = 2 -) diff --git a/sensor/sensor_direct_rate.go b/sensor/sensor_direct_rate.go deleted file mode 100644 index 5bf3b66..0000000 --- a/sensor/sensor_direct_rate.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -type SENSOR_DIRECT_RATE int32 - -const ( - ASENSOR_DIRECT_RATE_STOP SENSOR_DIRECT_RATE = 0 - ASENSOR_DIRECT_RATE_NORMAL SENSOR_DIRECT_RATE = 1 - ASENSOR_DIRECT_RATE_FAST SENSOR_DIRECT_RATE = 2 - ASENSOR_DIRECT_RATE_VERY_FAST SENSOR_DIRECT_RATE = 3 -) diff --git a/sensor/sensor_event.go b/sensor/sensor_event.go deleted file mode 100644 index b9cbeb7..0000000 --- a/sensor/sensor_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// SensorEvent wraps the NDK ASensorEvent handle. -type SensorEvent struct { - ptr *capi.ASensorEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *SensorEvent) cptr() *capi.ASensorEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewSensorEventFromPointer wraps a raw ASensorEvent pointer. -func NewSensorEventFromPointer(ptr unsafe.Pointer) *SensorEvent { - return &SensorEvent{ptr: (*capi.ASensorEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *SensorEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *SensorEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSensorEventFromUintPtr wraps a uintptr as a SensorEvent. -// The caller must ensure ptr points to a valid ASensorEvent. -func NewSensorEventFromUintPtr(ptr uintptr) *SensorEvent { - return &SensorEvent{ptr: (*capi.ASensorEvent)(unsafe.Pointer(ptr))} -} diff --git a/sensor/sensor_vector.go b/sensor/sensor_vector.go deleted file mode 100644 index 86b992c..0000000 --- a/sensor/sensor_vector.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// SensorVector wraps the NDK ASensorVector handle. -type SensorVector struct { - ptr *capi.ASensorVector -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *SensorVector) cptr() *capi.ASensorVector { - if h == nil { - return nil - } - return h.ptr -} - -// NewSensorVectorFromPointer wraps a raw ASensorVector pointer. -func NewSensorVectorFromPointer(ptr unsafe.Pointer) *SensorVector { - return &SensorVector{ptr: (*capi.ASensorVector)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *SensorVector) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *SensorVector) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSensorVectorFromUintPtr wraps a uintptr as a SensorVector. -// The caller must ensure ptr points to a valid ASensorVector. -func NewSensorVectorFromUintPtr(ptr uintptr) *SensorVector { - return &SensorVector{ptr: (*capi.ASensorVector)(unsafe.Pointer(ptr))} -} diff --git a/sensor/status.go b/sensor/status.go deleted file mode 100644 index 9cf893c..0000000 --- a/sensor/status.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import "fmt" - -type Status int32 - -const ( - NoContact Status = -1 - Unreliable Status = 0 - AccuracyLow Status = 1 - AccuracyMedium Status = 2 - AccuracyHigh Status = 3 -) - -func (v Status) String() string { - switch v { - case NoContact: - return "NoContact" - case Unreliable: - return "Unreliable" - case AccuracyLow: - return "AccuracyLow" - case AccuracyMedium: - return "AccuracyMedium" - case AccuracyHigh: - return "AccuracyHigh" - default: - return fmt.Sprintf("Status(%d)", int(v)) - } -} diff --git a/sensor/type.go b/sensor/type.go deleted file mode 100644 index e00db60..0000000 --- a/sensor/type.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import "fmt" - -type Type int32 - -const ( - Invalid Type = -1 - Accelerometer Type = 1 - MagneticField Type = 2 - Gyroscope Type = 4 - Light Type = 5 - Pressure Type = 6 - Proximity Type = 8 - Gravity Type = 9 - LinearAcceleration Type = 10 - RotationVector Type = 11 - RelativeHumidity Type = 12 - AmbientTemperature Type = 13 - MagneticFieldUncalibrated Type = 14 - GameRotationVector Type = 15 - GyroscopeUncalibrated Type = 16 - SignificantMotion Type = 17 - StepDetector Type = 18 - StepCounter Type = 19 - GeomagneticRotationVector Type = 20 - HeartRate Type = 21 - Pose6dof Type = 28 - StationaryDetect Type = 29 - MotionDetect Type = 30 - HeartBeat Type = 31 - DynamicSensorMeta Type = 32 - AdditionalInfo Type = 33 - LowLatencyOffbodyDetect Type = 34 - AccelerometerUncalibrated Type = 35 - HingeAngle Type = 36 - HeadTracker Type = 37 - AccelerometerLimitedAxes Type = 38 - GyroscopeLimitedAxes Type = 39 - AccelerometerLimitedAxesUncalibrated Type = 40 - GyroscopeLimitedAxesUncalibrated Type = 41 - Heading Type = 42 -) - -func (v Type) String() string { - switch v { - case Invalid: - return "Invalid" - case Accelerometer: - return "Accelerometer" - case MagneticField: - return "MagneticField" - case Gyroscope: - return "Gyroscope" - case Light: - return "Light" - case Pressure: - return "Pressure" - case Proximity: - return "Proximity" - case Gravity: - return "Gravity" - case LinearAcceleration: - return "LinearAcceleration" - case RotationVector: - return "RotationVector" - case RelativeHumidity: - return "RelativeHumidity" - case AmbientTemperature: - return "AmbientTemperature" - case MagneticFieldUncalibrated: - return "MagneticFieldUncalibrated" - case GameRotationVector: - return "GameRotationVector" - case GyroscopeUncalibrated: - return "GyroscopeUncalibrated" - case SignificantMotion: - return "SignificantMotion" - case StepDetector: - return "StepDetector" - case StepCounter: - return "StepCounter" - case GeomagneticRotationVector: - return "GeomagneticRotationVector" - case HeartRate: - return "HeartRate" - case Pose6dof: - return "Pose6dof" - case StationaryDetect: - return "StationaryDetect" - case MotionDetect: - return "MotionDetect" - case HeartBeat: - return "HeartBeat" - case DynamicSensorMeta: - return "DynamicSensorMeta" - case AdditionalInfo: - return "AdditionalInfo" - case LowLatencyOffbodyDetect: - return "LowLatencyOffbodyDetect" - case AccelerometerUncalibrated: - return "AccelerometerUncalibrated" - case HingeAngle: - return "HingeAngle" - case HeadTracker: - return "HeadTracker" - case AccelerometerLimitedAxes: - return "AccelerometerLimitedAxes" - case GyroscopeLimitedAxes: - return "GyroscopeLimitedAxes" - case AccelerometerLimitedAxesUncalibrated: - return "AccelerometerLimitedAxesUncalibrated" - case GyroscopeLimitedAxesUncalibrated: - return "GyroscopeLimitedAxesUncalibrated" - case Heading: - return "Heading" - default: - return fmt.Sprintf("Type(%d)", int(v)) - } -} diff --git a/sensor/uncalibrated_event.go b/sensor/uncalibrated_event.go deleted file mode 100644 index 5078ed5..0000000 --- a/sensor/uncalibrated_event.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sensor - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/sensor" -) - -// UncalibratedEvent wraps the NDK AUncalibratedEvent handle. -type UncalibratedEvent struct { - ptr *capi.AUncalibratedEvent -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *UncalibratedEvent) cptr() *capi.AUncalibratedEvent { - if h == nil { - return nil - } - return h.ptr -} - -// NewUncalibratedEventFromPointer wraps a raw AUncalibratedEvent pointer. -func NewUncalibratedEventFromPointer(ptr unsafe.Pointer) *UncalibratedEvent { - return &UncalibratedEvent{ptr: (*capi.AUncalibratedEvent)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *UncalibratedEvent) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *UncalibratedEvent) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewUncalibratedEventFromUintPtr wraps a uintptr as a UncalibratedEvent. -// The caller must ensure ptr points to a valid AUncalibratedEvent. -func NewUncalibratedEventFromUintPtr(ptr uintptr) *UncalibratedEvent { - return &UncalibratedEvent{ptr: (*capi.AUncalibratedEvent)(unsafe.Pointer(ptr))} -} diff --git a/sharedmem/errors.go b/sharedmem/errors.go deleted file mode 100644 index 85d0c58..0000000 --- a/sharedmem/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sharedmem diff --git a/sharedmem/functions.go b/sharedmem/functions.go deleted file mode 100644 index ea84760..0000000 --- a/sharedmem/functions.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sharedmem - -import ( - capi "github.com/AndroidGoLab/ndk/capi/sharedmem" -) - -// ASharedMemory_create calls the underlying C function. -func ASharedMemory_create(name string, size uint64) int32 { - return (int32)(capi.ASharedMemory_create(name, size)) -} - -// ASharedMemory_getSize calls the underlying C function. -func ASharedMemory_getSize(fd int32) uint64 { - return (uint64)(capi.ASharedMemory_getSize(fd)) -} - -// ASharedMemory_setProt calls the underlying C function. -func ASharedMemory_setProt(fd int32, prot int32) int32 { - return (int32)(capi.ASharedMemory_setProt(fd, prot)) -} diff --git a/sharedmem/package.go b/sharedmem/package.go deleted file mode 100644 index 1583d1c..0000000 --- a/sharedmem/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package sharedmem provides Go bindings for Android shared memory. -package sharedmem diff --git a/spec/generated/aaudio.yaml b/spec/generated/aaudio.yaml deleted file mode 100644 index ff365a5..0000000 --- a/spec/generated/aaudio.yaml +++ /dev/null @@ -1,831 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: aaudio -source_package: github.com/AndroidGoLab/ndk/capi/aaudio -types: - AAudioStream: - kind: opaque_ptr - c_type: AAudioStream - go_type: '*C.AAudioStream' - AAudioStreamBuilder: - kind: opaque_ptr - c_type: AAudioStreamBuilder - go_type: '*C.AAudioStreamBuilder' - aaudio_allowed_capture_policy_t: - kind: typedef_int32 - c_type: aaudio_allowed_capture_policy_t - go_type: int32 - aaudio_channel_mask_t: - kind: typedef_uint32 - c_type: aaudio_channel_mask_t - go_type: uint32 - aaudio_content_type_t: - kind: typedef_int32 - c_type: aaudio_content_type_t - go_type: int32 - aaudio_data_callback_result_t: - kind: typedef_int32 - c_type: aaudio_data_callback_result_t - go_type: int32 - aaudio_direction_t: - kind: typedef_int32 - c_type: aaudio_direction_t - go_type: int32 - aaudio_format_t: - kind: typedef_int32 - c_type: aaudio_format_t - go_type: int32 - aaudio_input_preset_t: - kind: typedef_int32 - c_type: aaudio_input_preset_t - go_type: int32 - aaudio_performance_mode_t: - kind: typedef_int32 - c_type: aaudio_performance_mode_t - go_type: int32 - aaudio_result_t: - kind: typedef_int32 - c_type: aaudio_result_t - go_type: int32 - aaudio_session_id_t: - kind: typedef_int32 - c_type: aaudio_session_id_t - go_type: int32 - aaudio_sharing_mode_t: - kind: typedef_int32 - c_type: aaudio_sharing_mode_t - go_type: int32 - aaudio_spatialization_behavior_t: - kind: typedef_int32 - c_type: aaudio_spatialization_behavior_t - go_type: int32 - aaudio_stream_state_t: - kind: typedef_int32 - c_type: aaudio_stream_state_t - go_type: int32 - aaudio_usage_t: - kind: typedef_int32 - c_type: aaudio_usage_t - go_type: int32 -enums: - AAUDIO: - - name: AAUDIO_USAGE_MEDIA - value: 1 - - name: AAUDIO_USAGE_VOICE_COMMUNICATION - value: 2 - - name: AAUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING - value: 3 - - name: AAUDIO_USAGE_ALARM - value: 4 - - name: AAUDIO_USAGE_NOTIFICATION - value: 5 - - name: AAUDIO_USAGE_NOTIFICATION_RINGTONE - value: 6 - - name: AAUDIO_USAGE_NOTIFICATION_EVENT - value: 10 - - name: AAUDIO_USAGE_ASSISTANCE_ACCESSIBILITY - value: 11 - - name: AAUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE - value: 12 - - name: AAUDIO_USAGE_ASSISTANCE_SONIFICATION - value: 13 - - name: AAUDIO_USAGE_GAME - value: 14 - - name: AAUDIO_USAGE_ASSISTANT - value: 16 - - name: AAUDIO_SYSTEM_USAGE_EMERGENCY - value: 1000 - - name: AAUDIO_SYSTEM_USAGE_SAFETY - value: 1001 - - name: AAUDIO_SYSTEM_USAGE_VEHICLE_STATUS - value: 1002 - - name: AAUDIO_SYSTEM_USAGE_ANNOUNCEMENT - value: 1003 - AAUDIO_ALLOW_CAPTURE_BY: - - name: AAUDIO_ALLOW_CAPTURE_BY_ALL - value: 1 - - name: AAUDIO_ALLOW_CAPTURE_BY_SYSTEM - value: 2 - - name: AAUDIO_ALLOW_CAPTURE_BY_NONE - value: 3 - AAUDIO_CALLBACK_RESULT: - - name: AAUDIO_CALLBACK_RESULT_CONTINUE - value: 0 - - name: AAUDIO_CALLBACK_RESULT_STOP - value: 1 - AAUDIO_CHANNEL: - - name: AAUDIO_CHANNEL_INVALID - value: -1 - - name: AAUDIO_CHANNEL_FRONT_LEFT - value: 1 - - name: AAUDIO_CHANNEL_FRONT_RIGHT - value: 2 - - name: AAUDIO_CHANNEL_FRONT_CENTER - value: 4 - - name: AAUDIO_CHANNEL_LOW_FREQUENCY - value: 8 - - name: AAUDIO_CHANNEL_BACK_LEFT - value: 16 - - name: AAUDIO_CHANNEL_BACK_RIGHT - value: 32 - - name: AAUDIO_CHANNEL_FRONT_LEFT_OF_CENTER - value: 64 - - name: AAUDIO_CHANNEL_FRONT_RIGHT_OF_CENTER - value: 128 - - name: AAUDIO_CHANNEL_BACK_CENTER - value: 256 - - name: AAUDIO_CHANNEL_SIDE_LEFT - value: 512 - - name: AAUDIO_CHANNEL_SIDE_RIGHT - value: 1024 - - name: AAUDIO_CHANNEL_TOP_CENTER - value: 2048 - - name: AAUDIO_CHANNEL_TOP_FRONT_LEFT - value: 4096 - - name: AAUDIO_CHANNEL_TOP_FRONT_CENTER - value: 8192 - - name: AAUDIO_CHANNEL_TOP_FRONT_RIGHT - value: 16384 - - name: AAUDIO_CHANNEL_TOP_BACK_LEFT - value: 32768 - - name: AAUDIO_CHANNEL_TOP_BACK_CENTER - value: 65536 - - name: AAUDIO_CHANNEL_TOP_BACK_RIGHT - value: 131072 - - name: AAUDIO_CHANNEL_TOP_SIDE_LEFT - value: 262144 - - name: AAUDIO_CHANNEL_TOP_SIDE_RIGHT - value: 524288 - - name: AAUDIO_CHANNEL_BOTTOM_FRONT_LEFT - value: 1048576 - - name: AAUDIO_CHANNEL_BOTTOM_FRONT_CENTER - value: 2097152 - - name: AAUDIO_CHANNEL_BOTTOM_FRONT_RIGHT - value: 4194304 - - name: AAUDIO_CHANNEL_LOW_FREQUENCY_2 - value: 8388608 - - name: AAUDIO_CHANNEL_FRONT_WIDE_LEFT - value: 16777216 - - name: AAUDIO_CHANNEL_FRONT_WIDE_RIGHT - value: 33554432 - - name: AAUDIO_CHANNEL_MONO - value: 1 - - name: AAUDIO_CHANNEL_STEREO - value: 3 - - name: AAUDIO_CHANNEL_2POINT1 - value: 11 - - name: AAUDIO_CHANNEL_TRI - value: 7 - - name: AAUDIO_CHANNEL_TRI_BACK - value: 259 - - name: AAUDIO_CHANNEL_3POINT1 - value: 15 - - name: AAUDIO_CHANNEL_2POINT0POINT2 - value: 786435 - - name: AAUDIO_CHANNEL_2POINT1POINT2 - value: 786443 - - name: AAUDIO_CHANNEL_3POINT0POINT2 - value: 786439 - - name: AAUDIO_CHANNEL_3POINT1POINT2 - value: 786447 - - name: AAUDIO_CHANNEL_QUAD - value: 51 - - name: AAUDIO_CHANNEL_QUAD_SIDE - value: 1539 - - name: AAUDIO_CHANNEL_SURROUND - value: 263 - - name: AAUDIO_CHANNEL_PENTA - value: 55 - - name: AAUDIO_CHANNEL_5POINT1 - value: 63 - - name: AAUDIO_CHANNEL_5POINT1_SIDE - value: 1551 - - name: AAUDIO_CHANNEL_6POINT1 - value: 319 - - name: AAUDIO_CHANNEL_7POINT1 - value: 1599 - - name: AAUDIO_CHANNEL_5POINT1POINT2 - value: 786495 - - name: AAUDIO_CHANNEL_5POINT1POINT4 - value: 184383 - - name: AAUDIO_CHANNEL_7POINT1POINT2 - value: 788031 - - name: AAUDIO_CHANNEL_7POINT1POINT4 - value: 185919 - - name: AAUDIO_CHANNEL_9POINT1POINT4 - value: 50517567 - - name: AAUDIO_CHANNEL_9POINT1POINT6 - value: 51303999 - - name: AAUDIO_CHANNEL_FRONT_BACK - value: 260 - AAUDIO_CONTENT_TYPE: - - name: AAUDIO_CONTENT_TYPE_SPEECH - value: 1 - - name: AAUDIO_CONTENT_TYPE_MUSIC - value: 2 - - name: AAUDIO_CONTENT_TYPE_MOVIE - value: 3 - - name: AAUDIO_CONTENT_TYPE_SONIFICATION - value: 4 - AAUDIO_DIRECTION: - - name: AAUDIO_DIRECTION_OUTPUT - value: 0 - - name: AAUDIO_DIRECTION_INPUT - value: 1 - AAUDIO_FORMAT: - - name: AAUDIO_FORMAT_INVALID - value: -1 - - name: AAUDIO_FORMAT_UNSPECIFIED - value: 0 - - name: AAUDIO_FORMAT_PCM_I16 - value: 1 - - name: AAUDIO_FORMAT_PCM_FLOAT - value: 2 - - name: AAUDIO_FORMAT_PCM_I24_PACKED - value: 3 - - name: AAUDIO_FORMAT_PCM_I32 - value: 4 - - name: AAUDIO_FORMAT_IEC61937 - value: 5 - AAUDIO_INPUT_PRESET: - - name: AAUDIO_INPUT_PRESET_GENERIC - value: 1 - - name: AAUDIO_INPUT_PRESET_CAMCORDER - value: 5 - - name: AAUDIO_INPUT_PRESET_VOICE_RECOGNITION - value: 6 - - name: AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION - value: 7 - - name: AAUDIO_INPUT_PRESET_UNPROCESSED - value: 9 - - name: AAUDIO_INPUT_PRESET_VOICE_PERFORMANCE - value: 10 - - name: AAUDIO_INPUT_PRESET_SYSTEM_ECHO_REFERENCE - value: 1997 - - name: AAUDIO_INPUT_PRESET_SYSTEM_HOTWORD - value: 1999 - AAUDIO_PERFORMANCE_MODE: - - name: AAUDIO_PERFORMANCE_MODE_NONE - value: 10 - - name: AAUDIO_PERFORMANCE_MODE_POWER_SAVING - value: 11 - - name: AAUDIO_PERFORMANCE_MODE_LOW_LATENCY - value: 12 - AAUDIO_SESSION_ID: - - name: AAUDIO_SESSION_ID_NONE - value: -1 - - name: AAUDIO_SESSION_ID_ALLOCATE - value: 0 - AAUDIO_SHARING_MODE: - - name: AAUDIO_SHARING_MODE_EXCLUSIVE - value: 0 - - name: AAUDIO_SHARING_MODE_SHARED - value: 1 - AAUDIO_SPATIALIZATION_BEHAVIOR: - - name: AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO - value: 1 - - name: AAUDIO_SPATIALIZATION_BEHAVIOR_NEVER - value: 2 - AAUDIO_STREAM_STATE: - - name: AAUDIO_STREAM_STATE_UNINITIALIZED - value: 0 - - name: AAUDIO_STREAM_STATE_UNKNOWN - value: 1 - - name: AAUDIO_STREAM_STATE_OPEN - value: 2 - - name: AAUDIO_STREAM_STATE_STARTING - value: 3 - - name: AAUDIO_STREAM_STATE_STARTED - value: 4 - - name: AAUDIO_STREAM_STATE_PAUSING - value: 5 - - name: AAUDIO_STREAM_STATE_PAUSED - value: 6 - - name: AAUDIO_STREAM_STATE_FLUSHING - value: 7 - - name: AAUDIO_STREAM_STATE_FLUSHED - value: 8 - - name: AAUDIO_STREAM_STATE_STOPPING - value: 9 - - name: AAUDIO_STREAM_STATE_STOPPED - value: 10 - - name: AAUDIO_STREAM_STATE_CLOSING - value: 11 - - name: AAUDIO_STREAM_STATE_CLOSED - value: 12 - - name: AAUDIO_STREAM_STATE_DISCONNECTED - value: 13 -functions: - AAudio_convertResultToText: - c_name: AAudio_convertResultToText - params: - - name: returnCode - type: aaudio_result_t - returns: string - AAudio_convertStreamStateToText: - c_name: AAudio_convertStreamStateToText - params: - - name: state - type: aaudio_stream_state_t - returns: string - AAudio_createStreamBuilder: - c_name: AAudio_createStreamBuilder - params: - - name: builder - type: '**AAudioStreamBuilder' - direction: out - returns: aaudio_result_t - AAudioStream_close: - c_name: AAudioStream_close - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_result_t - AAudioStream_getAllowedCapturePolicy: - c_name: AAudioStream_getAllowedCapturePolicy - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_allowed_capture_policy_t - AAudioStream_getBufferCapacityInFrames: - c_name: AAudioStream_getBufferCapacityInFrames - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getBufferSizeInFrames: - c_name: AAudioStream_getBufferSizeInFrames - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getChannelCount: - c_name: AAudioStream_getChannelCount - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getChannelMask: - c_name: AAudioStream_getChannelMask - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_channel_mask_t - AAudioStream_getContentType: - c_name: AAudioStream_getContentType - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_content_type_t - AAudioStream_getDeviceId: - c_name: AAudioStream_getDeviceId - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getDirection: - c_name: AAudioStream_getDirection - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_direction_t - AAudioStream_getFormat: - c_name: AAudioStream_getFormat - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_format_t - AAudioStream_getFramesPerBurst: - c_name: AAudioStream_getFramesPerBurst - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getFramesPerDataCallback: - c_name: AAudioStream_getFramesPerDataCallback - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getFramesRead: - c_name: AAudioStream_getFramesRead - params: - - name: stream - type: '*AAudioStream' - returns: int64 - AAudioStream_getFramesWritten: - c_name: AAudioStream_getFramesWritten - params: - - name: stream - type: '*AAudioStream' - returns: int64 - AAudioStream_getHardwareChannelCount: - c_name: AAudioStream_getHardwareChannelCount - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getHardwareFormat: - c_name: AAudioStream_getHardwareFormat - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_format_t - AAudioStream_getHardwareSampleRate: - c_name: AAudioStream_getHardwareSampleRate - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getInputPreset: - c_name: AAudioStream_getInputPreset - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_input_preset_t - AAudioStream_getPerformanceMode: - c_name: AAudioStream_getPerformanceMode - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_performance_mode_t - AAudioStream_getSampleRate: - c_name: AAudioStream_getSampleRate - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getSamplesPerFrame: - c_name: AAudioStream_getSamplesPerFrame - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_getSessionId: - c_name: AAudioStream_getSessionId - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_session_id_t - AAudioStream_getSharingMode: - c_name: AAudioStream_getSharingMode - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_sharing_mode_t - AAudioStream_getSpatializationBehavior: - c_name: AAudioStream_getSpatializationBehavior - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_spatialization_behavior_t - AAudioStream_getState: - c_name: AAudioStream_getState - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_stream_state_t - AAudioStream_getTimestamp: - c_name: AAudioStream_getTimestamp - params: - - name: stream - type: '*AAudioStream' - - name: clockid - type: clockid_t - - name: framePosition - type: '*int64' - - name: timeNanoseconds - type: '*int64' - returns: aaudio_result_t - AAudioStream_getUsage: - c_name: AAudioStream_getUsage - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_usage_t - AAudioStream_getXRunCount: - c_name: AAudioStream_getXRunCount - params: - - name: stream - type: '*AAudioStream' - returns: int32 - AAudioStream_isContentSpatialized: - c_name: AAudioStream_isContentSpatialized - params: - - name: stream - type: '*AAudioStream' - returns: bool - AAudioStream_isPrivacySensitive: - c_name: AAudioStream_isPrivacySensitive - params: - - name: stream - type: '*AAudioStream' - returns: bool - AAudioStream_read: - c_name: AAudioStream_read - params: - - name: stream - type: '*AAudioStream' - - name: buffer - type: unsafe.Pointer - - name: numFrames - type: int32 - - name: timeoutNanoseconds - type: int64 - returns: aaudio_result_t - AAudioStream_release: - c_name: AAudioStream_release - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_result_t - AAudioStream_requestFlush: - c_name: AAudioStream_requestFlush - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_result_t - AAudioStream_requestPause: - c_name: AAudioStream_requestPause - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_result_t - AAudioStream_requestStart: - c_name: AAudioStream_requestStart - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_result_t - AAudioStream_requestStop: - c_name: AAudioStream_requestStop - params: - - name: stream - type: '*AAudioStream' - returns: aaudio_result_t - AAudioStream_setBufferSizeInFrames: - c_name: AAudioStream_setBufferSizeInFrames - params: - - name: stream - type: '*AAudioStream' - - name: numFrames - type: int32 - returns: aaudio_result_t - AAudioStream_waitForStateChange: - c_name: AAudioStream_waitForStateChange - params: - - name: stream - type: '*AAudioStream' - - name: inputState - type: aaudio_stream_state_t - - name: nextState - type: '*aaudio_stream_state_t' - - name: timeoutNanoseconds - type: int64 - returns: aaudio_result_t - AAudioStream_write: - c_name: AAudioStream_write - params: - - name: stream - type: '*AAudioStream' - - name: buffer - type: unsafe.Pointer - - name: numFrames - type: int32 - - name: timeoutNanoseconds - type: int64 - returns: aaudio_result_t - AAudioStreamBuilder_delete: - c_name: AAudioStreamBuilder_delete - params: - - name: builder - type: '*AAudioStreamBuilder' - returns: aaudio_result_t - AAudioStreamBuilder_openStream: - c_name: AAudioStreamBuilder_openStream - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: stream - type: '**AAudioStream' - direction: out - returns: aaudio_result_t - AAudioStreamBuilder_setAllowedCapturePolicy: - c_name: AAudioStreamBuilder_setAllowedCapturePolicy - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: capturePolicy - type: aaudio_allowed_capture_policy_t - returns: "" - AAudioStreamBuilder_setAttributionTag: - c_name: AAudioStreamBuilder_setAttributionTag - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: attributionTag - type: string - returns: "" - AAudioStreamBuilder_setBufferCapacityInFrames: - c_name: AAudioStreamBuilder_setBufferCapacityInFrames - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: numFrames - type: int32 - returns: "" - AAudioStreamBuilder_setChannelCount: - c_name: AAudioStreamBuilder_setChannelCount - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: channelCount - type: int32 - returns: "" - AAudioStreamBuilder_setChannelMask: - c_name: AAudioStreamBuilder_setChannelMask - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: channelMask - type: aaudio_channel_mask_t - returns: "" - AAudioStreamBuilder_setContentType: - c_name: AAudioStreamBuilder_setContentType - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: contentType - type: aaudio_content_type_t - returns: "" - AAudioStreamBuilder_setDataCallback: - c_name: AAudioStreamBuilder_setDataCallback - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: callback - type: AAudioStream_dataCallback - - name: userData - type: unsafe.Pointer - returns: "" - AAudioStreamBuilder_setDeviceId: - c_name: AAudioStreamBuilder_setDeviceId - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: deviceId - type: int32 - returns: "" - AAudioStreamBuilder_setDirection: - c_name: AAudioStreamBuilder_setDirection - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: direction - type: aaudio_direction_t - returns: "" - AAudioStreamBuilder_setErrorCallback: - c_name: AAudioStreamBuilder_setErrorCallback - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: callback - type: AAudioStream_errorCallback - - name: userData - type: unsafe.Pointer - returns: "" - AAudioStreamBuilder_setFormat: - c_name: AAudioStreamBuilder_setFormat - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: format - type: aaudio_format_t - returns: "" - AAudioStreamBuilder_setFramesPerDataCallback: - c_name: AAudioStreamBuilder_setFramesPerDataCallback - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: numFrames - type: int32 - returns: "" - AAudioStreamBuilder_setInputPreset: - c_name: AAudioStreamBuilder_setInputPreset - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: inputPreset - type: aaudio_input_preset_t - returns: "" - AAudioStreamBuilder_setIsContentSpatialized: - c_name: AAudioStreamBuilder_setIsContentSpatialized - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: isSpatialized - type: bool - returns: "" - AAudioStreamBuilder_setPackageName: - c_name: AAudioStreamBuilder_setPackageName - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: packageName - type: string - returns: "" - AAudioStreamBuilder_setPerformanceMode: - c_name: AAudioStreamBuilder_setPerformanceMode - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: mode - type: aaudio_performance_mode_t - returns: "" - AAudioStreamBuilder_setPrivacySensitive: - c_name: AAudioStreamBuilder_setPrivacySensitive - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: privacySensitive - type: bool - returns: "" - AAudioStreamBuilder_setSampleRate: - c_name: AAudioStreamBuilder_setSampleRate - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: sampleRate - type: int32 - returns: "" - AAudioStreamBuilder_setSamplesPerFrame: - c_name: AAudioStreamBuilder_setSamplesPerFrame - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: samplesPerFrame - type: int32 - returns: "" - AAudioStreamBuilder_setSessionId: - c_name: AAudioStreamBuilder_setSessionId - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: sessionId - type: aaudio_session_id_t - returns: "" - AAudioStreamBuilder_setSharingMode: - c_name: AAudioStreamBuilder_setSharingMode - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: sharingMode - type: aaudio_sharing_mode_t - returns: "" - AAudioStreamBuilder_setSpatializationBehavior: - c_name: AAudioStreamBuilder_setSpatializationBehavior - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: spatializationBehavior - type: aaudio_spatialization_behavior_t - returns: "" - AAudioStreamBuilder_setUsage: - c_name: AAudioStreamBuilder_setUsage - params: - - name: builder - type: '*AAudioStreamBuilder' - - name: usage - type: aaudio_usage_t - returns: "" -callbacks: - AAudioStream_dataCallback: - params: - - name: stream - type: '*AAudioStream' - c_type: AAudioStream* - - name: userData - type: unsafe.Pointer - c_type: void* - - name: audioData - type: unsafe.Pointer - c_type: void* - - name: numFrames - type: int32 - c_type: int32_t - returns: aaudio_data_callback_result_t - AAudioStream_errorCallback: - params: - - name: stream - type: '*AAudioStream' - c_type: AAudioStream* - - name: userData - type: unsafe.Pointer - c_type: void* - - name: _error - type: aaudio_result_t - c_type: aaudio_result_t - returns: "" -macros: - AAUDIO_SYSTEM_USAGE_OFFSET: 1000 - AAUDIO_UNSPECIFIED: 0 diff --git a/spec/generated/asset.yaml b/spec/generated/asset.yaml deleted file mode 100644 index c74f65d..0000000 --- a/spec/generated/asset.yaml +++ /dev/null @@ -1,156 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: asset -source_package: github.com/AndroidGoLab/ndk/capi/asset -types: - AAsset: - kind: opaque_ptr - c_type: AAsset - go_type: '*C.AAsset' - AAssetDir: - kind: opaque_ptr - c_type: AAssetDir - go_type: '*C.AAssetDir' - AAssetManager: - kind: opaque_ptr - c_type: AAssetManager - go_type: '*C.AAssetManager' -enums: - AASSET_MODE: - - name: AASSET_MODE_UNKNOWN - value: 0 - - name: AASSET_MODE_RANDOM - value: 1 - - name: AASSET_MODE_STREAMING - value: 2 - - name: AASSET_MODE_BUFFER - value: 3 -functions: - AAsset_close: - c_name: AAsset_close - params: - - name: asset - type: '*AAsset' - returns: "" - AAsset_getBuffer: - c_name: AAsset_getBuffer - params: - - name: asset - type: '*AAsset' - returns: unsafe.Pointer - AAsset_getLength: - c_name: AAsset_getLength - params: - - name: asset - type: '*AAsset' - returns: off_t - AAsset_getLength64: - c_name: AAsset_getLength64 - params: - - name: asset - type: '*AAsset' - returns: off64_t - AAsset_getRemainingLength: - c_name: AAsset_getRemainingLength - params: - - name: asset - type: '*AAsset' - returns: off_t - AAsset_getRemainingLength64: - c_name: AAsset_getRemainingLength64 - params: - - name: asset - type: '*AAsset' - returns: off64_t - AAsset_isAllocated: - c_name: AAsset_isAllocated - params: - - name: asset - type: '*AAsset' - returns: int32 - AAsset_openFileDescriptor: - c_name: AAsset_openFileDescriptor - params: - - name: asset - type: '*AAsset' - - name: outStart - type: '*off_t' - - name: outLength - type: '*off_t' - returns: int32 - AAsset_openFileDescriptor64: - c_name: AAsset_openFileDescriptor64 - params: - - name: asset - type: '*AAsset' - - name: outStart - type: '*off64_t' - - name: outLength - type: '*off64_t' - returns: int32 - AAsset_read: - c_name: AAsset_read - params: - - name: asset - type: '*AAsset' - - name: buf - type: unsafe.Pointer - - name: count - type: uint64 - returns: int32 - AAsset_seek: - c_name: AAsset_seek - params: - - name: asset - type: '*AAsset' - - name: offset - type: off_t - - name: whence - type: int32 - returns: off_t - AAsset_seek64: - c_name: AAsset_seek64 - params: - - name: asset - type: '*AAsset' - - name: offset - type: off64_t - - name: whence - type: int32 - returns: off64_t - AAssetDir_close: - c_name: AAssetDir_close - params: - - name: assetDir - type: '*AAssetDir' - returns: "" - AAssetDir_getNextFileName: - c_name: AAssetDir_getNextFileName - params: - - name: assetDir - type: '*AAssetDir' - returns: string - AAssetDir_rewind: - c_name: AAssetDir_rewind - params: - - name: assetDir - type: '*AAssetDir' - returns: "" - AAssetManager_open: - c_name: AAssetManager_open - params: - - name: mgr - type: '*AAssetManager' - - name: filename - type: string - - name: mode - type: int32 - returns: '*AAsset' - AAssetManager_openDir: - c_name: AAssetManager_openDir - params: - - name: mgr - type: '*AAssetManager' - - name: dirName - type: string - returns: '*AAssetDir' diff --git a/spec/generated/binder.yaml b/spec/generated/binder.yaml deleted file mode 100644 index dbecb35..0000000 --- a/spec/generated/binder.yaml +++ /dev/null @@ -1,1214 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: binder -source_package: github.com/AndroidGoLab/ndk/capi/binder -types: - AIBinder: - kind: opaque_ptr - c_type: AIBinder - go_type: '*C.AIBinder' - AIBinder_Class: - kind: opaque_ptr - c_type: AIBinder_Class - go_type: '*C.AIBinder_Class' - AIBinder_DeathRecipient: - kind: opaque_ptr - c_type: AIBinder_DeathRecipient - go_type: '*C.AIBinder_DeathRecipient' - AIBinder_Weak: - kind: opaque_ptr - c_type: AIBinder_Weak - go_type: '*C.AIBinder_Weak' - AParcel: - kind: opaque_ptr - c_type: AParcel - go_type: '*C.AParcel' - AStatus: - kind: opaque_ptr - c_type: AStatus - go_type: '*C.AStatus' - binder_exception_t: - kind: typedef_int32 - c_type: binder_exception_t - go_type: int32 - binder_flags_t: - kind: typedef_uint32 - c_type: binder_flags_t - go_type: uint32 - binder_status_t: - kind: typedef_int32 - c_type: binder_status_t - go_type: int32 - transaction_code_t: - kind: typedef_uint32 - c_type: transaction_code_t - go_type: uint32 -enums: - EX: - - name: EX_NONE - value: 0 - - name: EX_SECURITY - value: -1 - - name: EX_BAD_PARCELABLE - value: -2 - - name: EX_ILLEGAL_ARGUMENT - value: -3 - - name: EX_NULL_POINTER - value: -4 - - name: EX_ILLEGAL_STATE - value: -5 - - name: EX_NETWORK_MAIN_THREAD - value: -6 - - name: EX_UNSUPPORTED_OPERATION - value: -7 - - name: EX_SERVICE_SPECIFIC - value: -8 - - name: EX_PARCELABLE - value: -9 - - name: EX_TRANSACTION_FAILED - value: -129 - FLAG: - - name: FLAG_ONEWAY - value: 1 - STATUS: - - name: STATUS_OK - value: 0 - - name: STATUS_UNKNOWN_ERROR - value: -2147483648 - - name: STATUS_NO_MEMORY - value: -12 - - name: STATUS_INVALID_OPERATION - value: -38 - - name: STATUS_BAD_VALUE - value: -22 - - name: STATUS_BAD_TYPE - value: -2147483647 - - name: STATUS_NAME_NOT_FOUND - value: -2 - - name: STATUS_PERMISSION_DENIED - value: -1 - - name: STATUS_NO_INIT - value: -19 - - name: STATUS_ALREADY_EXISTS - value: -17 - - name: STATUS_DEAD_OBJECT - value: -32 - - name: STATUS_FAILED_TRANSACTION - value: -2147483646 - - name: STATUS_BAD_INDEX - value: -75 - - name: STATUS_NOT_ENOUGH_DATA - value: -61 - - name: STATUS_WOULD_BLOCK - value: -11 - - name: STATUS_TIMED_OUT - value: -110 - - name: STATUS_UNKNOWN_TRANSACTION - value: -74 - - name: STATUS_FDS_NOT_ALLOWED - value: -2147483641 - - name: STATUS_UNEXPECTED_NULL - value: -2147483640 -functions: - AIBinder_Class_define: - c_name: AIBinder_Class_define - params: - - name: interfaceDescriptor - type: string - - name: onCreate - type: AIBinder_Class_onCreate - - name: onDestroy - type: AIBinder_Class_onDestroy - - name: onTransact - type: AIBinder_Class_onTransact - returns: '*AIBinder_Class' - AIBinder_Class_disableInterfaceTokenHeader: - c_name: AIBinder_Class_disableInterfaceTokenHeader - params: - - name: clazz - type: '*AIBinder_Class' - returns: "" - AIBinder_Class_getDescriptor: - c_name: AIBinder_Class_getDescriptor - params: - - name: clazz - type: '*AIBinder_Class' - returns: string - AIBinder_Class_setOnDump: - c_name: AIBinder_Class_setOnDump - params: - - name: clazz - type: '*AIBinder_Class' - - name: onDump - type: AIBinder_onDump - returns: "" - AIBinder_DeathRecipient_delete: - c_name: AIBinder_DeathRecipient_delete - params: - - name: recipient - type: '*AIBinder_DeathRecipient' - returns: "" - AIBinder_DeathRecipient_new: - c_name: AIBinder_DeathRecipient_new - params: - - name: onBinderDied - type: AIBinder_DeathRecipient_onBinderDied - returns: '*AIBinder_DeathRecipient' - AIBinder_DeathRecipient_setOnUnlinked: - c_name: AIBinder_DeathRecipient_setOnUnlinked - params: - - name: recipient - type: '*AIBinder_DeathRecipient' - - name: onUnlinked - type: AIBinder_DeathRecipient_onBinderUnlinked - returns: "" - AIBinder_Weak_clone: - c_name: AIBinder_Weak_clone - params: - - name: weak - type: '*AIBinder_Weak' - returns: '*AIBinder_Weak' - AIBinder_Weak_delete: - c_name: AIBinder_Weak_delete - params: - - name: weakBinder - type: '*AIBinder_Weak' - returns: "" - AIBinder_Weak_lt: - c_name: AIBinder_Weak_lt - params: - - name: lhs - type: '*AIBinder_Weak' - - name: rhs - type: '*AIBinder_Weak' - returns: bool - AIBinder_Weak_new: - c_name: AIBinder_Weak_new - params: - - name: binder - type: '*AIBinder' - returns: '*AIBinder_Weak' - AIBinder_Weak_promote: - c_name: AIBinder_Weak_promote - params: - - name: weakBinder - type: '*AIBinder_Weak' - returns: '*AIBinder' - AIBinder_associateClass: - c_name: AIBinder_associateClass - params: - - name: binder - type: '*AIBinder' - - name: clazz - type: '*AIBinder_Class' - returns: bool - AIBinder_debugGetRefCount: - c_name: AIBinder_debugGetRefCount - params: - - name: binder - type: '*AIBinder' - returns: int32 - AIBinder_decStrong: - c_name: AIBinder_decStrong - params: - - name: binder - type: '*AIBinder' - returns: "" - AIBinder_dump: - c_name: AIBinder_dump - params: - - name: binder - type: '*AIBinder' - - name: fd - type: int32 - - name: args - type: '**int8' - c_type: const char** - const: true - - name: numArgs - type: uint32 - returns: binder_status_t - AIBinder_getCallingPid: - c_name: AIBinder_getCallingPid - returns: pid_t - AIBinder_getCallingUid: - c_name: AIBinder_getCallingUid - returns: uid_t - AIBinder_getClass: - c_name: AIBinder_getClass - params: - - name: binder - type: '*AIBinder' - returns: '*AIBinder_Class' - AIBinder_getExtension: - c_name: AIBinder_getExtension - params: - - name: binder - type: '*AIBinder' - - name: outExt - type: '**AIBinder' - direction: out - returns: binder_status_t - AIBinder_getUserData: - c_name: AIBinder_getUserData - params: - - name: binder - type: '*AIBinder' - returns: unsafe.Pointer - AIBinder_incStrong: - c_name: AIBinder_incStrong - params: - - name: binder - type: '*AIBinder' - returns: "" - AIBinder_isAlive: - c_name: AIBinder_isAlive - params: - - name: binder - type: '*AIBinder' - returns: bool - AIBinder_isHandlingTransaction: - c_name: AIBinder_isHandlingTransaction - returns: bool - AIBinder_isRemote: - c_name: AIBinder_isRemote - params: - - name: binder - type: '*AIBinder' - returns: bool - AIBinder_linkToDeath: - c_name: AIBinder_linkToDeath - params: - - name: binder - type: '*AIBinder' - - name: recipient - type: '*AIBinder_DeathRecipient' - - name: cookie - type: unsafe.Pointer - returns: binder_status_t - AIBinder_lt: - c_name: AIBinder_lt - params: - - name: lhs - type: '*AIBinder' - - name: rhs - type: '*AIBinder' - returns: bool - AIBinder_new: - c_name: AIBinder_new - params: - - name: clazz - type: '*AIBinder_Class' - - name: args - type: unsafe.Pointer - returns: '*AIBinder' - AIBinder_ping: - c_name: AIBinder_ping - params: - - name: binder - type: '*AIBinder' - returns: binder_status_t - AIBinder_prepareTransaction: - c_name: AIBinder_prepareTransaction - params: - - name: binder - type: '*AIBinder' - - name: in - type: '**AParcel' - direction: out - returns: binder_status_t - AIBinder_setExtension: - c_name: AIBinder_setExtension - params: - - name: binder - type: '*AIBinder' - - name: ext - type: '*AIBinder' - returns: binder_status_t - AIBinder_transact: - c_name: AIBinder_transact - params: - - name: binder - type: '*AIBinder' - - name: code - type: transaction_code_t - - name: in - type: '**AParcel' - direction: out - - name: out - type: '**AParcel' - direction: out - - name: flags - type: binder_flags_t - returns: binder_status_t - AIBinder_unlinkToDeath: - c_name: AIBinder_unlinkToDeath - params: - - name: binder - type: '*AIBinder' - - name: recipient - type: '*AIBinder_DeathRecipient' - - name: cookie - type: unsafe.Pointer - returns: binder_status_t - AParcel_appendFrom: - c_name: AParcel_appendFrom - params: - - name: from - type: '*AParcel' - - name: to - type: '*AParcel' - - name: start - type: int32 - - name: size - type: int32 - returns: binder_status_t - AParcel_create: - c_name: AParcel_create - returns: '*AParcel' - AParcel_delete: - c_name: AParcel_delete - params: - - name: parcel - type: '*AParcel' - returns: "" - AParcel_getDataPosition: - c_name: AParcel_getDataPosition - params: - - name: parcel - type: '*AParcel' - returns: int32 - AParcel_getDataSize: - c_name: AParcel_getDataSize - params: - - name: parcel - type: '*AParcel' - returns: int32 - AParcel_marshal: - c_name: AParcel_marshal - params: - - name: parcel - type: '*AParcel' - - name: buffer - type: '*uint8' - - name: start - type: uint64 - - name: len - type: uint64 - returns: binder_status_t - AParcel_readBool: - c_name: AParcel_readBool - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*bool' - returns: binder_status_t - AParcel_readBoolArray: - c_name: AParcel_readBoolArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_boolArrayAllocator - - name: setter - type: AParcel_boolArraySetter - returns: binder_status_t - AParcel_readByte: - c_name: AParcel_readByte - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*int8' - returns: binder_status_t - AParcel_readByteArray: - c_name: AParcel_readByteArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_byteArrayAllocator - returns: binder_status_t - AParcel_readChar: - c_name: AParcel_readChar - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*char16_t' - returns: binder_status_t - AParcel_readCharArray: - c_name: AParcel_readCharArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_charArrayAllocator - returns: binder_status_t - AParcel_readDouble: - c_name: AParcel_readDouble - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*float64' - returns: binder_status_t - AParcel_readDoubleArray: - c_name: AParcel_readDoubleArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_doubleArrayAllocator - returns: binder_status_t - AParcel_readFloat: - c_name: AParcel_readFloat - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*float32' - returns: binder_status_t - AParcel_readFloatArray: - c_name: AParcel_readFloatArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_floatArrayAllocator - returns: binder_status_t - AParcel_readInt32: - c_name: AParcel_readInt32 - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*int32' - returns: binder_status_t - AParcel_readInt32Array: - c_name: AParcel_readInt32Array - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_int32ArrayAllocator - returns: binder_status_t - AParcel_readInt64: - c_name: AParcel_readInt64 - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*int64' - returns: binder_status_t - AParcel_readInt64Array: - c_name: AParcel_readInt64Array - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_int64ArrayAllocator - returns: binder_status_t - AParcel_readParcelFileDescriptor: - c_name: AParcel_readParcelFileDescriptor - params: - - name: parcel - type: '*AParcel' - - name: fd - type: '*int32' - returns: binder_status_t - AParcel_readParcelableArray: - c_name: AParcel_readParcelableArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_parcelableArrayAllocator - - name: elementReader - type: AParcel_readParcelableElement - returns: binder_status_t - AParcel_readStatusHeader: - c_name: AParcel_readStatusHeader - params: - - name: parcel - type: '*AParcel' - - name: status - type: '**AStatus' - direction: out - returns: binder_status_t - AParcel_readString: - c_name: AParcel_readString - params: - - name: parcel - type: '*AParcel' - - name: stringData - type: unsafe.Pointer - - name: allocator - type: AParcel_stringAllocator - returns: binder_status_t - AParcel_readStringArray: - c_name: AParcel_readStringArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_stringArrayAllocator - - name: elementAllocator - type: AParcel_stringArrayElementAllocator - returns: binder_status_t - AParcel_readStrongBinder: - c_name: AParcel_readStrongBinder - params: - - name: parcel - type: '*AParcel' - - name: binder - type: '**AIBinder' - direction: out - returns: binder_status_t - AParcel_readUint32: - c_name: AParcel_readUint32 - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*uint32' - returns: binder_status_t - AParcel_readUint32Array: - c_name: AParcel_readUint32Array - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_uint32ArrayAllocator - returns: binder_status_t - AParcel_readUint64: - c_name: AParcel_readUint64 - params: - - name: parcel - type: '*AParcel' - - name: value - type: '*uint64' - returns: binder_status_t - AParcel_readUint64Array: - c_name: AParcel_readUint64Array - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: allocator - type: AParcel_uint64ArrayAllocator - returns: binder_status_t - AParcel_reset: - c_name: AParcel_reset - params: - - name: parcel - type: '*AParcel' - returns: binder_status_t - AParcel_setDataPosition: - c_name: AParcel_setDataPosition - params: - - name: parcel - type: '*AParcel' - - name: position - type: int32 - returns: binder_status_t - AParcel_unmarshal: - c_name: AParcel_unmarshal - params: - - name: parcel - type: '*AParcel' - - name: buffer - type: '*uint8' - - name: len - type: uint64 - returns: binder_status_t - AParcel_writeBool: - c_name: AParcel_writeBool - params: - - name: parcel - type: '*AParcel' - - name: value - type: bool - returns: binder_status_t - AParcel_writeBoolArray: - c_name: AParcel_writeBoolArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: length - type: int32 - - name: getter - type: AParcel_boolArrayGetter - returns: binder_status_t - AParcel_writeByte: - c_name: AParcel_writeByte - params: - - name: parcel - type: '*AParcel' - - name: value - type: int8 - returns: binder_status_t - AParcel_writeByteArray: - c_name: AParcel_writeByteArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: '*int8' - - name: length - type: int32 - returns: binder_status_t - AParcel_writeChar: - c_name: AParcel_writeChar - params: - - name: parcel - type: '*AParcel' - - name: value - type: char16_t - returns: binder_status_t - AParcel_writeCharArray: - c_name: AParcel_writeCharArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: '*char16_t' - - name: length - type: int32 - returns: binder_status_t - AParcel_writeDouble: - c_name: AParcel_writeDouble - params: - - name: parcel - type: '*AParcel' - - name: value - type: float64 - returns: binder_status_t - AParcel_writeDoubleArray: - c_name: AParcel_writeDoubleArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: '*float64' - - name: length - type: int32 - returns: binder_status_t - AParcel_writeFloat: - c_name: AParcel_writeFloat - params: - - name: parcel - type: '*AParcel' - - name: value - type: float32 - returns: binder_status_t - AParcel_writeFloatArray: - c_name: AParcel_writeFloatArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: '*float32' - - name: length - type: int32 - returns: binder_status_t - AParcel_writeInt32: - c_name: AParcel_writeInt32 - params: - - name: parcel - type: '*AParcel' - - name: value - type: int32 - returns: binder_status_t - AParcel_writeInt32Array: - c_name: AParcel_writeInt32Array - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: '*int32' - - name: length - type: int32 - returns: binder_status_t - AParcel_writeInt64: - c_name: AParcel_writeInt64 - params: - - name: parcel - type: '*AParcel' - - name: value - type: int64 - returns: binder_status_t - AParcel_writeInt64Array: - c_name: AParcel_writeInt64Array - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: '*int64' - - name: length - type: int32 - returns: binder_status_t - AParcel_writeParcelFileDescriptor: - c_name: AParcel_writeParcelFileDescriptor - params: - - name: parcel - type: '*AParcel' - - name: fd - type: int32 - returns: binder_status_t - AParcel_writeParcelableArray: - c_name: AParcel_writeParcelableArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: length - type: int32 - - name: elementWriter - type: AParcel_writeParcelableElement - returns: binder_status_t - AParcel_writeStatusHeader: - c_name: AParcel_writeStatusHeader - params: - - name: parcel - type: '*AParcel' - - name: status - type: '*AStatus' - returns: binder_status_t - AParcel_writeString: - c_name: AParcel_writeString - params: - - name: parcel - type: '*AParcel' - - name: string - type: string - - name: length - type: int32 - returns: binder_status_t - AParcel_writeStringArray: - c_name: AParcel_writeStringArray - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: unsafe.Pointer - - name: length - type: int32 - - name: getter - type: AParcel_stringArrayElementGetter - returns: binder_status_t - AParcel_writeStrongBinder: - c_name: AParcel_writeStrongBinder - params: - - name: parcel - type: '*AParcel' - - name: binder - type: '*AIBinder' - returns: binder_status_t - AParcel_writeUint32: - c_name: AParcel_writeUint32 - params: - - name: parcel - type: '*AParcel' - - name: value - type: uint32 - returns: binder_status_t - AParcel_writeUint32Array: - c_name: AParcel_writeUint32Array - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: '*uint32' - - name: length - type: int32 - returns: binder_status_t - AParcel_writeUint64: - c_name: AParcel_writeUint64 - params: - - name: parcel - type: '*AParcel' - - name: value - type: uint64 - returns: binder_status_t - AParcel_writeUint64Array: - c_name: AParcel_writeUint64Array - params: - - name: parcel - type: '*AParcel' - - name: arrayData - type: '*uint64' - - name: length - type: int32 - returns: binder_status_t - AStatus_delete: - c_name: AStatus_delete - params: - - name: status - type: '*AStatus' - returns: "" - AStatus_deleteDescription: - c_name: AStatus_deleteDescription - params: - - name: description - type: string - returns: "" - AStatus_fromExceptionCode: - c_name: AStatus_fromExceptionCode - params: - - name: exception - type: binder_exception_t - returns: '*AStatus' - AStatus_fromExceptionCodeWithMessage: - c_name: AStatus_fromExceptionCodeWithMessage - params: - - name: exception - type: binder_exception_t - - name: message - type: string - returns: '*AStatus' - AStatus_fromServiceSpecificError: - c_name: AStatus_fromServiceSpecificError - params: - - name: serviceSpecific - type: int32 - returns: '*AStatus' - AStatus_fromServiceSpecificErrorWithMessage: - c_name: AStatus_fromServiceSpecificErrorWithMessage - params: - - name: serviceSpecific - type: int32 - - name: message - type: string - returns: '*AStatus' - AStatus_fromStatus: - c_name: AStatus_fromStatus - params: - - name: status - type: binder_status_t - returns: '*AStatus' - AStatus_getDescription: - c_name: AStatus_getDescription - params: - - name: status - type: '*AStatus' - returns: string - AStatus_getExceptionCode: - c_name: AStatus_getExceptionCode - params: - - name: status - type: '*AStatus' - returns: binder_exception_t - AStatus_getMessage: - c_name: AStatus_getMessage - params: - - name: status - type: '*AStatus' - returns: string - AStatus_getServiceSpecificError: - c_name: AStatus_getServiceSpecificError - params: - - name: status - type: '*AStatus' - returns: int32 - AStatus_getStatus: - c_name: AStatus_getStatus - params: - - name: status - type: '*AStatus' - returns: binder_status_t - AStatus_isOk: - c_name: AStatus_isOk - params: - - name: status - type: '*AStatus' - returns: bool - AStatus_newOk: - c_name: AStatus_newOk - returns: '*AStatus' -callbacks: - AIBinder_Class_onCreate: - params: - - name: args - type: unsafe.Pointer - c_type: void* - returns: unsafe.Pointer - AIBinder_Class_onDestroy: - params: - - name: userData - type: unsafe.Pointer - c_type: void* - returns: "" - AIBinder_Class_onTransact: - params: - - name: binder - type: '*AIBinder' - c_type: AIBinder* - - name: code - type: transaction_code_t - c_type: transaction_code_t - - name: in - type: '*AParcel' - c_type: const AParcel* - const: true - - name: out - type: '*AParcel' - c_type: AParcel* - returns: binder_status_t - AIBinder_DeathRecipient_onBinderDied: - returns: "" - AIBinder_DeathRecipient_onBinderUnlinked: - returns: "" - AIBinder_onDump: - params: - - name: binder - type: '*AIBinder' - c_type: AIBinder* - - name: fd - type: int32 - c_type: int - - name: args - type: '**int8' - c_type: const char** - const: true - - name: numArgs - type: uint32 - c_type: uint32_t - returns: binder_status_t - AParcel_boolArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - returns: bool - AParcel_boolArrayGetter: - params: - - name: arrayData - type: unsafe.Pointer - c_type: const void* - const: true - - name: index - type: uint64 - c_type: size_t - returns: bool - AParcel_boolArraySetter: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: index - type: uint64 - c_type: size_t - - name: value - type: bool - c_type: bool - returns: "" - AParcel_byteArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: outBuffer - type: '**int8' - c_type: int8_t** - returns: bool - AParcel_charArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: outBuffer - type: '**char16_t' - c_type: char16_t** - returns: bool - AParcel_doubleArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: outBuffer - type: '**float64' - c_type: double** - returns: bool - AParcel_floatArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: outBuffer - type: '**float32' - c_type: float** - returns: bool - AParcel_int32ArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: outBuffer - type: '**int32' - c_type: int32_t** - returns: bool - AParcel_int64ArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: outBuffer - type: '**int64' - c_type: int64_t** - returns: bool - AParcel_parcelableArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - returns: bool - AParcel_readParcelableElement: - params: - - name: parcel - type: '*AParcel' - c_type: const AParcel* - const: true - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: index - type: uint64 - c_type: size_t - returns: binder_status_t - AParcel_stringAllocator: - params: - - name: stringData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: buffer - type: '**int8' - c_type: char** - returns: bool - AParcel_stringArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - returns: bool - AParcel_stringArrayElementAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: index - type: uint64 - c_type: size_t - - name: length - type: int32 - c_type: int32_t - - name: buffer - type: '**int8' - c_type: char** - returns: bool - AParcel_stringArrayElementGetter: - params: - - name: arrayData - type: unsafe.Pointer - c_type: const void* - const: true - - name: index - type: uint64 - c_type: size_t - - name: outLength - type: '*int32' - c_type: int32_t* - returns: '*int8' - returns_c_type: const char* - AParcel_uint32ArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: outBuffer - type: '**uint32' - c_type: uint32_t** - returns: bool - AParcel_uint64ArrayAllocator: - params: - - name: arrayData - type: unsafe.Pointer - c_type: void* - - name: length - type: int32 - c_type: int32_t - - name: outBuffer - type: '**uint64' - c_type: uint64_t** - returns: bool - AParcel_writeParcelableElement: - params: - - name: parcel - type: '*AParcel' - c_type: AParcel* - - name: arrayData - type: unsafe.Pointer - c_type: const void* - const: true - - name: index - type: uint64 - c_type: size_t - returns: binder_status_t diff --git a/spec/generated/bitmap.yaml b/spec/generated/bitmap.yaml deleted file mode 100644 index 851ae51..0000000 --- a/spec/generated/bitmap.yaml +++ /dev/null @@ -1,131 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: bitmap -source_package: github.com/AndroidGoLab/ndk/capi/bitmap -types: - AHardwareBuffer: - kind: opaque_ptr - c_type: AHardwareBuffer - go_type: '*C.AHardwareBuffer' - AndroidBitmapInfo: - kind: opaque_ptr - c_type: AndroidBitmapInfo - go_type: '*C.AndroidBitmapInfo' -enums: - ANDROID_BITMAP_FLAGS: - - name: ANDROID_BITMAP_FLAGS_IS_HARDWARE - value: -2147483648 - ANDROID_BITMAP_FLAGS_ALPHA: - - name: ANDROID_BITMAP_FLAGS_ALPHA_PREMUL - value: 0 - - name: ANDROID_BITMAP_FLAGS_ALPHA_OPAQUE - value: 1 - - name: ANDROID_BITMAP_FLAGS_ALPHA_UNPREMUL - value: 2 - - name: ANDROID_BITMAP_FLAGS_ALPHA_MASK - value: 3 - - name: ANDROID_BITMAP_FLAGS_ALPHA_SHIFT - value: 0 - ANDROID_BITMAP_RESULT: - - name: ANDROID_BITMAP_RESULT_SUCCESS - value: 0 - - name: ANDROID_BITMAP_RESULT_BAD_PARAMETER - value: -1 - - name: ANDROID_BITMAP_RESULT_JNI_EXCEPTION - value: -2 - - name: ANDROID_BITMAP_RESULT_ALLOCATION_FAILED - value: -3 - AndroidBitmapCompressFormat: - - name: ANDROID_BITMAP_COMPRESS_FORMAT_JPEG - value: 0 - - name: ANDROID_BITMAP_COMPRESS_FORMAT_PNG - value: 1 - - name: ANDROID_BITMAP_COMPRESS_FORMAT_WEBP_LOSSY - value: 3 - - name: ANDROID_BITMAP_COMPRESS_FORMAT_WEBP_LOSSLESS - value: 4 - AndroidBitmapFormat: - - name: ANDROID_BITMAP_FORMAT_NONE - value: 0 - - name: ANDROID_BITMAP_FORMAT_RGBA_8888 - value: 1 - - name: ANDROID_BITMAP_FORMAT_RGB_565 - value: 4 - - name: ANDROID_BITMAP_FORMAT_RGBA_4444 - value: 7 - - name: ANDROID_BITMAP_FORMAT_A_8 - value: 8 - - name: ANDROID_BITMAP_FORMAT_RGBA_F16 - value: 9 - - name: ANDROID_BITMAP_FORMAT_RGBA_1010102 - value: 10 -functions: - AndroidBitmap_compress: - c_name: AndroidBitmap_compress - params: - - name: info - type: '*AndroidBitmapInfo' - - name: dataspace - type: int32 - - name: pixels - type: unsafe.Pointer - - name: format - type: int32 - - name: quality - type: int32 - - name: userContext - type: unsafe.Pointer - - name: fn - type: AndroidBitmap_CompressWriteFunc - returns: int32 - AndroidBitmap_getDataSpace: - c_name: AndroidBitmap_getDataSpace - params: - - name: env - type: '*JNIEnv' - - name: jbitmap - type: jobject - returns: int32 - AndroidBitmap_getHardwareBuffer: - c_name: AndroidBitmap_getHardwareBuffer - params: - - name: env - type: '*JNIEnv' - - name: bitmap - type: jobject - - name: outBuffer - type: '**AHardwareBuffer' - direction: out - returns: int32 - AndroidBitmap_getInfo: - c_name: AndroidBitmap_getInfo - params: - - name: env - type: '*JNIEnv' - - name: jbitmap - type: jobject - - name: info - type: '*AndroidBitmapInfo' - returns: int32 - AndroidBitmap_lockPixels: - c_name: AndroidBitmap_lockPixels - params: - - name: env - type: '*JNIEnv' - - name: jbitmap - type: jobject - - name: addrPtr - type: '*unsafe.Pointer' - direction: out - returns: int32 - AndroidBitmap_unlockPixels: - c_name: AndroidBitmap_unlockPixels - params: - - name: env - type: '*JNIEnv' - - name: jbitmap - type: jobject - returns: int32 -callbacks: - AndroidBitmap_CompressWriteFunc: - returns: "" diff --git a/spec/generated/camera.yaml b/spec/generated/camera.yaml deleted file mode 100644 index 0aa0f3d..0000000 --- a/spec/generated/camera.yaml +++ /dev/null @@ -1,3440 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: camera -source_package: github.com/AndroidGoLab/ndk/capi/camera -types: - ACameraCaptureFailure: - kind: opaque_ptr - c_type: ACameraCaptureFailure - go_type: '*C.ACameraCaptureFailure' - ACameraCaptureSession: - kind: opaque_ptr - c_type: ACameraCaptureSession - go_type: '*C.ACameraCaptureSession' - ACameraCaptureSession_captureCallbacks: - kind: opaque_ptr - c_type: ACameraCaptureSession_captureCallbacks - go_type: '*C.ACameraCaptureSession_captureCallbacks' - ACameraCaptureSession_captureCallbacksV2: - kind: opaque_ptr - c_type: ACameraCaptureSession_captureCallbacksV2 - go_type: '*C.ACameraCaptureSession_captureCallbacksV2' - ACameraCaptureSession_logicalCamera_captureCallbacks: - kind: opaque_ptr - c_type: ACameraCaptureSession_logicalCamera_captureCallbacks - go_type: '*C.ACameraCaptureSession_logicalCamera_captureCallbacks' - ACameraCaptureSession_logicalCamera_captureCallbacksV2: - kind: opaque_ptr - c_type: ACameraCaptureSession_logicalCamera_captureCallbacksV2 - go_type: '*C.ACameraCaptureSession_logicalCamera_captureCallbacksV2' - ACameraCaptureSession_stateCallbacks: - kind: opaque_ptr - c_type: ACameraCaptureSession_stateCallbacks - go_type: '*C.ACameraCaptureSession_stateCallbacks' - ACameraDevice: - kind: opaque_ptr - c_type: ACameraDevice - go_type: '*C.ACameraDevice' - ACameraDevice_StateCallbacks: - kind: opaque_ptr - c_type: ACameraDevice_StateCallbacks - go_type: '*C.ACameraDevice_StateCallbacks' - ACameraDevice_request_template: - kind: typedef_int32 - c_type: ACameraDevice_request_template - go_type: int32 - ACameraDevice_stateCallbacks: - kind: typedef_ACameraDevice_StateCallbacks - c_type: ACameraDevice_stateCallbacks - go_type: ACameraDevice_StateCallbacks - ACameraIdList: - kind: opaque_ptr - c_type: ACameraIdList - go_type: '*C.ACameraIdList' - ACameraManager: - kind: opaque_ptr - c_type: ACameraManager - go_type: '*C.ACameraManager' - ACameraManager_AvailabilityCallbacks: - kind: opaque_ptr - c_type: ACameraManager_AvailabilityCallbacks - go_type: '*C.ACameraManager_AvailabilityCallbacks' - ACameraManager_ExtendedAvailabilityCallbacks: - kind: opaque_ptr - c_type: ACameraManager_ExtendedAvailabilityCallbacks - go_type: '*C.ACameraManager_ExtendedAvailabilityCallbacks' - ACameraMetadata: - kind: opaque_ptr - c_type: ACameraMetadata - go_type: '*C.ACameraMetadata' - ACameraMetadata_const_entry: - kind: opaque_ptr - c_type: ACameraMetadata_const_entry - go_type: '*C.ACameraMetadata_const_entry' - ACameraMetadata_entry: - kind: opaque_ptr - c_type: ACameraMetadata_entry - go_type: '*C.ACameraMetadata_entry' - ACameraMetadata_rational: - kind: opaque_ptr - c_type: ACameraMetadata_rational - go_type: '*C.ACameraMetadata_rational' - ACameraOutputTarget: - kind: opaque_ptr - c_type: ACameraOutputTarget - go_type: '*C.ACameraOutputTarget' - ACameraOutputTargets: - kind: opaque_ptr - c_type: ACameraOutputTargets - go_type: '*C.ACameraOutputTargets' - ACaptureRequest: - kind: opaque_ptr - c_type: ACaptureRequest - go_type: '*C.ACaptureRequest' - ACaptureSessionOutput: - kind: opaque_ptr - c_type: ACaptureSessionOutput - go_type: '*C.ACaptureSessionOutput' - ACaptureSessionOutputContainer: - kind: opaque_ptr - c_type: ACaptureSessionOutputContainer - go_type: '*C.ACaptureSessionOutputContainer' - ALogicalCameraCaptureFailure: - kind: opaque_ptr - c_type: ALogicalCameraCaptureFailure - go_type: '*C.ALogicalCameraCaptureFailure' - acamera_metadata_enum_android_automotive_lens_facing_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_automotive_lens_facing_t - go_type: int32 - acamera_metadata_enum_android_automotive_location_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_automotive_location_t - go_type: int32 - acamera_metadata_enum_android_black_level_lock_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_black_level_lock_t - go_type: int32 - acamera_metadata_enum_android_color_correction_aberration_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_color_correction_aberration_mode_t - go_type: int32 - acamera_metadata_enum_android_color_correction_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_color_correction_mode_t - go_type: int32 - acamera_metadata_enum_android_control_ae_antibanding_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_ae_antibanding_mode_t - go_type: int32 - acamera_metadata_enum_android_control_ae_lock_available_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_ae_lock_available_t - go_type: int32 - acamera_metadata_enum_android_control_ae_lock_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_ae_lock_t - go_type: int32 - acamera_metadata_enum_android_control_ae_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_ae_mode_t - go_type: int32 - acamera_metadata_enum_android_control_ae_precapture_trigger_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_ae_precapture_trigger_t - go_type: int32 - acamera_metadata_enum_android_control_ae_state_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_ae_state_t - go_type: int32 - acamera_metadata_enum_android_control_af_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_af_mode_t - go_type: int32 - acamera_metadata_enum_android_control_af_scene_change_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_af_scene_change_t - go_type: int32 - acamera_metadata_enum_android_control_af_state_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_af_state_t - go_type: int32 - acamera_metadata_enum_android_control_af_trigger_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_af_trigger_t - go_type: int32 - acamera_metadata_enum_android_control_autoframing_available_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_autoframing_available_t - go_type: int32 - acamera_metadata_enum_android_control_autoframing_state_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_autoframing_state_t - go_type: int32 - acamera_metadata_enum_android_control_autoframing_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_autoframing_t - go_type: int32 - acamera_metadata_enum_android_control_awb_lock_available_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_awb_lock_available_t - go_type: int32 - acamera_metadata_enum_android_control_awb_lock_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_awb_lock_t - go_type: int32 - acamera_metadata_enum_android_control_awb_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_awb_mode_t - go_type: int32 - acamera_metadata_enum_android_control_awb_state_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_awb_state_t - go_type: int32 - acamera_metadata_enum_android_control_capture_intent_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_capture_intent_t - go_type: int32 - acamera_metadata_enum_android_control_effect_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_effect_mode_t - go_type: int32 - acamera_metadata_enum_android_control_enable_zsl_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_enable_zsl_t - go_type: int32 - acamera_metadata_enum_android_control_extended_scene_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_extended_scene_mode_t - go_type: int32 - acamera_metadata_enum_android_control_low_light_boost_state_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_low_light_boost_state_t - go_type: int32 - acamera_metadata_enum_android_control_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_mode_t - go_type: int32 - acamera_metadata_enum_android_control_scene_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_scene_mode_t - go_type: int32 - acamera_metadata_enum_android_control_settings_override_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_settings_override_t - go_type: int32 - acamera_metadata_enum_android_control_video_stabilization_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_control_video_stabilization_mode_t - go_type: int32 - acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t - go_type: int32 - acamera_metadata_enum_android_depth_available_depth_stream_configurations_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_depth_available_depth_stream_configurations_t - go_type: int32 - acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t - go_type: int32 - acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t - go_type: int32 - acamera_metadata_enum_android_depth_depth_is_exclusive_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_depth_depth_is_exclusive_t - go_type: int32 - acamera_metadata_enum_android_distortion_correction_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_distortion_correction_mode_t - go_type: int32 - acamera_metadata_enum_android_edge_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_edge_mode_t - go_type: int32 - acamera_metadata_enum_android_flash_info_available_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_flash_info_available_t - go_type: int32 - acamera_metadata_enum_android_flash_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_flash_mode_t - go_type: int32 - acamera_metadata_enum_android_flash_state_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_flash_state_t - go_type: int32 - acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t - go_type: int32 - acamera_metadata_enum_android_heic_available_heic_stream_configurations_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_heic_available_heic_stream_configurations_t - go_type: int32 - acamera_metadata_enum_android_hot_pixel_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_hot_pixel_mode_t - go_type: int32 - acamera_metadata_enum_android_info_supported_hardware_level_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_info_supported_hardware_level_t - go_type: int32 - acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t - go_type: int32 - acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t - go_type: int32 - acamera_metadata_enum_android_lens_facing_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_lens_facing_t - go_type: int32 - acamera_metadata_enum_android_lens_info_focus_distance_calibration_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_lens_info_focus_distance_calibration_t - go_type: int32 - acamera_metadata_enum_android_lens_optical_stabilization_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_lens_optical_stabilization_mode_t - go_type: int32 - acamera_metadata_enum_android_lens_pose_reference_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_lens_pose_reference_t - go_type: int32 - acamera_metadata_enum_android_lens_state_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_lens_state_t - go_type: int32 - acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t - go_type: int32 - acamera_metadata_enum_android_noise_reduction_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_noise_reduction_mode_t - go_type: int32 - acamera_metadata_enum_android_request_available_capabilities_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_request_available_capabilities_t - go_type: int32 - acamera_metadata_enum_android_request_available_color_space_profiles_map_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_request_available_color_space_profiles_map_t - go_type: int32 - acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t - go_type: int32 - acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t - go_type: int32 - acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t - go_type: int32 - acamera_metadata_enum_android_scaler_available_stream_configurations_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_scaler_available_stream_configurations_t - go_type: int32 - acamera_metadata_enum_android_scaler_available_stream_use_cases_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_scaler_available_stream_use_cases_t - go_type: int32 - acamera_metadata_enum_android_scaler_cropping_type_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_scaler_cropping_type_t - go_type: int32 - acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t - go_type: int32 - acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t - go_type: int32 - acamera_metadata_enum_android_scaler_rotate_and_crop_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_scaler_rotate_and_crop_t - go_type: int32 - acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t - go_type: int32 - acamera_metadata_enum_android_sensor_info_lens_shading_applied_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sensor_info_lens_shading_applied_t - go_type: int32 - acamera_metadata_enum_android_sensor_info_timestamp_source_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sensor_info_timestamp_source_t - go_type: int32 - acamera_metadata_enum_android_sensor_pixel_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sensor_pixel_mode_t - go_type: int32 - acamera_metadata_enum_android_sensor_raw_binning_factor_used_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sensor_raw_binning_factor_used_t - go_type: int32 - acamera_metadata_enum_android_sensor_reference_illuminant1_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sensor_reference_illuminant1_t - go_type: int32 - acamera_metadata_enum_android_sensor_test_pattern_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sensor_test_pattern_mode_t - go_type: int32 - acamera_metadata_enum_android_shading_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_shading_mode_t - go_type: int32 - acamera_metadata_enum_android_statistics_face_detect_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_statistics_face_detect_mode_t - go_type: int32 - acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t - go_type: int32 - acamera_metadata_enum_android_statistics_lens_shading_map_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_statistics_lens_shading_map_mode_t - go_type: int32 - acamera_metadata_enum_android_statistics_ois_data_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_statistics_ois_data_mode_t - go_type: int32 - acamera_metadata_enum_android_statistics_scene_flicker_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_statistics_scene_flicker_t - go_type: int32 - acamera_metadata_enum_android_sync_frame_number_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sync_frame_number_t - go_type: int32 - acamera_metadata_enum_android_sync_max_latency_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_sync_max_latency_t - go_type: int32 - acamera_metadata_enum_android_tonemap_mode_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_tonemap_mode_t - go_type: int32 - acamera_metadata_enum_android_tonemap_preset_curve_t: - kind: typedef_int32 - c_type: acamera_metadata_enum_android_tonemap_preset_curve_t - go_type: int32 - acamera_metadata_section_start_t: - kind: typedef_int32 - c_type: acamera_metadata_section_start_t - go_type: int32 - acamera_metadata_section_t: - kind: typedef_int32 - c_type: acamera_metadata_section_t - go_type: int32 - acamera_metadata_tag_t: - kind: typedef_int32 - c_type: acamera_metadata_tag_t - go_type: int32 -enums: - ACAMERA: - - name: ACAMERA_TYPE_BYTE - value: 0 - - name: ACAMERA_TYPE_INT32 - value: 1 - - name: ACAMERA_TYPE_FLOAT - value: 2 - - name: ACAMERA_TYPE_INT64 - value: 3 - - name: ACAMERA_TYPE_DOUBLE - value: 4 - - name: ACAMERA_TYPE_RATIONAL - value: 5 - - name: ACAMERA_NUM_TYPES - value: 6 - ACameraDevice_request_template: - - name: TEMPLATE_PREVIEW - value: 1 - - name: TEMPLATE_STILL_CAPTURE - value: 2 - - name: TEMPLATE_RECORD - value: 3 - - name: TEMPLATE_VIDEO_SNAPSHOT - value: 4 - - name: TEMPLATE_ZERO_SHUTTER_LAG - value: 5 - - name: TEMPLATE_MANUAL - value: 6 - CAPTURE_FAILURE_REASON: - - name: CAPTURE_FAILURE_REASON_FLUSHED - value: 0 - - name: CAPTURE_FAILURE_REASON_ERROR - value: 1 - CAPTURE_SEQUENCE: - - name: CAPTURE_SEQUENCE_ID_NONE - value: -1 - ERROR: - - name: ERROR_CAMERA_IN_USE - value: 1 - - name: ERROR_MAX_CAMERAS_IN_USE - value: 2 - - name: ERROR_CAMERA_DISABLED - value: 3 - - name: ERROR_CAMERA_DEVICE - value: 4 - - name: ERROR_CAMERA_SERVICE - value: 5 - acamera_metadata_enum_android_automotive_lens_facing_t: - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER - value: 0 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT - value: 1 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR - value: 2 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT - value: 3 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT - value: 4 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER - value: 5 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT - value: 6 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER - value: 7 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT - value: 8 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT - value: 9 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER - value: 10 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT - value: 11 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT - value: 12 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER - value: 13 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT - value: 14 - acamera_metadata_enum_android_automotive_location_t: - - name: ACAMERA_AUTOMOTIVE_LOCATION_INTERIOR - value: 0 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER - value: 1 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT - value: 2 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_REAR - value: 3 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT - value: 4 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT - value: 5 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_OTHER - value: 6 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_FRONT - value: 7 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_REAR - value: 8 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_LEFT - value: 9 - - name: ACAMERA_AUTOMOTIVE_LOCATION_EXTRA_RIGHT - value: 10 - acamera_metadata_enum_android_black_level_lock_t: - - name: ACAMERA_BLACK_LEVEL_LOCK_OFF - value: 0 - - name: ACAMERA_BLACK_LEVEL_LOCK_ON - value: 1 - acamera_metadata_enum_android_color_correction_aberration_mode_t: - - name: ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_OFF - value: 0 - - name: ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_FAST - value: 1 - - name: ACAMERA_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY - value: 2 - acamera_metadata_enum_android_color_correction_mode_t: - - name: ACAMERA_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX - value: 0 - - name: ACAMERA_COLOR_CORRECTION_MODE_FAST - value: 1 - - name: ACAMERA_COLOR_CORRECTION_MODE_HIGH_QUALITY - value: 2 - acamera_metadata_enum_android_control_ae_antibanding_mode_t: - - name: ACAMERA_CONTROL_AE_ANTIBANDING_MODE_OFF - value: 0 - - name: ACAMERA_CONTROL_AE_ANTIBANDING_MODE_50HZ - value: 1 - - name: ACAMERA_CONTROL_AE_ANTIBANDING_MODE_60HZ - value: 2 - - name: ACAMERA_CONTROL_AE_ANTIBANDING_MODE_AUTO - value: 3 - acamera_metadata_enum_android_control_ae_lock_available_t: - - name: ACAMERA_CONTROL_AE_LOCK_AVAILABLE_FALSE - value: 0 - - name: ACAMERA_CONTROL_AE_LOCK_AVAILABLE_TRUE - value: 1 - acamera_metadata_enum_android_control_ae_lock_t: - - name: ACAMERA_CONTROL_AE_LOCK_OFF - value: 0 - - name: ACAMERA_CONTROL_AE_LOCK_ON - value: 1 - acamera_metadata_enum_android_control_ae_mode_t: - - name: ACAMERA_CONTROL_AE_MODE_OFF - value: 0 - - name: ACAMERA_CONTROL_AE_MODE_ON - value: 1 - - name: ACAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH - value: 2 - - name: ACAMERA_CONTROL_AE_MODE_ON_ALWAYS_FLASH - value: 3 - - name: ACAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE - value: 4 - - name: ACAMERA_CONTROL_AE_MODE_ON_EXTERNAL_FLASH - value: 5 - - name: ACAMERA_CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY - value: 6 - acamera_metadata_enum_android_control_ae_precapture_trigger_t: - - name: ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE - value: 0 - - name: ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_START - value: 1 - - name: ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL - value: 2 - acamera_metadata_enum_android_control_ae_state_t: - - name: ACAMERA_CONTROL_AE_STATE_INACTIVE - value: 0 - - name: ACAMERA_CONTROL_AE_STATE_SEARCHING - value: 1 - - name: ACAMERA_CONTROL_AE_STATE_CONVERGED - value: 2 - - name: ACAMERA_CONTROL_AE_STATE_LOCKED - value: 3 - - name: ACAMERA_CONTROL_AE_STATE_FLASH_REQUIRED - value: 4 - - name: ACAMERA_CONTROL_AE_STATE_PRECAPTURE - value: 5 - acamera_metadata_enum_android_control_af_mode_t: - - name: ACAMERA_CONTROL_AF_MODE_OFF - value: 0 - - name: ACAMERA_CONTROL_AF_MODE_AUTO - value: 1 - - name: ACAMERA_CONTROL_AF_MODE_MACRO - value: 2 - - name: ACAMERA_CONTROL_AF_MODE_CONTINUOUS_VIDEO - value: 3 - - name: ACAMERA_CONTROL_AF_MODE_CONTINUOUS_PICTURE - value: 4 - - name: ACAMERA_CONTROL_AF_MODE_EDOF - value: 5 - acamera_metadata_enum_android_control_af_scene_change_t: - - name: ACAMERA_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED - value: 0 - - name: ACAMERA_CONTROL_AF_SCENE_CHANGE_DETECTED - value: 1 - acamera_metadata_enum_android_control_af_state_t: - - name: ACAMERA_CONTROL_AF_STATE_INACTIVE - value: 0 - - name: ACAMERA_CONTROL_AF_STATE_PASSIVE_SCAN - value: 1 - - name: ACAMERA_CONTROL_AF_STATE_PASSIVE_FOCUSED - value: 2 - - name: ACAMERA_CONTROL_AF_STATE_ACTIVE_SCAN - value: 3 - - name: ACAMERA_CONTROL_AF_STATE_FOCUSED_LOCKED - value: 4 - - name: ACAMERA_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED - value: 5 - - name: ACAMERA_CONTROL_AF_STATE_PASSIVE_UNFOCUSED - value: 6 - acamera_metadata_enum_android_control_af_trigger_t: - - name: ACAMERA_CONTROL_AF_TRIGGER_IDLE - value: 0 - - name: ACAMERA_CONTROL_AF_TRIGGER_START - value: 1 - - name: ACAMERA_CONTROL_AF_TRIGGER_CANCEL - value: 2 - acamera_metadata_enum_android_control_autoframing_available_t: - - name: ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE_FALSE - value: 0 - - name: ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE_TRUE - value: 1 - acamera_metadata_enum_android_control_autoframing_state_t: - - name: ACAMERA_CONTROL_AUTOFRAMING_STATE_INACTIVE - value: 0 - - name: ACAMERA_CONTROL_AUTOFRAMING_STATE_FRAMING - value: 1 - - name: ACAMERA_CONTROL_AUTOFRAMING_STATE_CONVERGED - value: 2 - acamera_metadata_enum_android_control_autoframing_t: - - name: ACAMERA_CONTROL_AUTOFRAMING_OFF - value: 0 - - name: ACAMERA_CONTROL_AUTOFRAMING_ON - value: 1 - acamera_metadata_enum_android_control_awb_lock_available_t: - - name: ACAMERA_CONTROL_AWB_LOCK_AVAILABLE_FALSE - value: 0 - - name: ACAMERA_CONTROL_AWB_LOCK_AVAILABLE_TRUE - value: 1 - acamera_metadata_enum_android_control_awb_lock_t: - - name: ACAMERA_CONTROL_AWB_LOCK_OFF - value: 0 - - name: ACAMERA_CONTROL_AWB_LOCK_ON - value: 1 - acamera_metadata_enum_android_control_awb_mode_t: - - name: ACAMERA_CONTROL_AWB_MODE_OFF - value: 0 - - name: ACAMERA_CONTROL_AWB_MODE_AUTO - value: 1 - - name: ACAMERA_CONTROL_AWB_MODE_INCANDESCENT - value: 2 - - name: ACAMERA_CONTROL_AWB_MODE_FLUORESCENT - value: 3 - - name: ACAMERA_CONTROL_AWB_MODE_WARM_FLUORESCENT - value: 4 - - name: ACAMERA_CONTROL_AWB_MODE_DAYLIGHT - value: 5 - - name: ACAMERA_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT - value: 6 - - name: ACAMERA_CONTROL_AWB_MODE_TWILIGHT - value: 7 - - name: ACAMERA_CONTROL_AWB_MODE_SHADE - value: 8 - acamera_metadata_enum_android_control_awb_state_t: - - name: ACAMERA_CONTROL_AWB_STATE_INACTIVE - value: 0 - - name: ACAMERA_CONTROL_AWB_STATE_SEARCHING - value: 1 - - name: ACAMERA_CONTROL_AWB_STATE_CONVERGED - value: 2 - - name: ACAMERA_CONTROL_AWB_STATE_LOCKED - value: 3 - acamera_metadata_enum_android_control_capture_intent_t: - - name: ACAMERA_CONTROL_CAPTURE_INTENT_CUSTOM - value: 0 - - name: ACAMERA_CONTROL_CAPTURE_INTENT_PREVIEW - value: 1 - - name: ACAMERA_CONTROL_CAPTURE_INTENT_STILL_CAPTURE - value: 2 - - name: ACAMERA_CONTROL_CAPTURE_INTENT_VIDEO_RECORD - value: 3 - - name: ACAMERA_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT - value: 4 - - name: ACAMERA_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG - value: 5 - - name: ACAMERA_CONTROL_CAPTURE_INTENT_MANUAL - value: 6 - - name: ACAMERA_CONTROL_CAPTURE_INTENT_MOTION_TRACKING - value: 7 - acamera_metadata_enum_android_control_effect_mode_t: - - name: ACAMERA_CONTROL_EFFECT_MODE_OFF - value: 0 - - name: ACAMERA_CONTROL_EFFECT_MODE_MONO - value: 1 - - name: ACAMERA_CONTROL_EFFECT_MODE_NEGATIVE - value: 2 - - name: ACAMERA_CONTROL_EFFECT_MODE_SOLARIZE - value: 3 - - name: ACAMERA_CONTROL_EFFECT_MODE_SEPIA - value: 4 - - name: ACAMERA_CONTROL_EFFECT_MODE_POSTERIZE - value: 5 - - name: ACAMERA_CONTROL_EFFECT_MODE_WHITEBOARD - value: 6 - - name: ACAMERA_CONTROL_EFFECT_MODE_BLACKBOARD - value: 7 - - name: ACAMERA_CONTROL_EFFECT_MODE_AQUA - value: 8 - acamera_metadata_enum_android_control_enable_zsl_t: - - name: ACAMERA_CONTROL_ENABLE_ZSL_FALSE - value: 0 - - name: ACAMERA_CONTROL_ENABLE_ZSL_TRUE - value: 1 - acamera_metadata_enum_android_control_extended_scene_mode_t: - - name: ACAMERA_CONTROL_EXTENDED_SCENE_MODE_DISABLED - value: 0 - - name: ACAMERA_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE - value: 1 - - name: ACAMERA_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS - value: 2 - acamera_metadata_enum_android_control_low_light_boost_state_t: - - name: ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE_INACTIVE - value: 0 - - name: ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE - value: 1 - acamera_metadata_enum_android_control_mode_t: - - name: ACAMERA_CONTROL_MODE_OFF - value: 0 - - name: ACAMERA_CONTROL_MODE_AUTO - value: 1 - - name: ACAMERA_CONTROL_MODE_USE_SCENE_MODE - value: 2 - - name: ACAMERA_CONTROL_MODE_OFF_KEEP_STATE - value: 3 - - name: ACAMERA_CONTROL_MODE_USE_EXTENDED_SCENE_MODE - value: 4 - acamera_metadata_enum_android_control_scene_mode_t: - - name: ACAMERA_CONTROL_SCENE_MODE_DISABLED - value: 0 - - name: ACAMERA_CONTROL_SCENE_MODE_FACE_PRIORITY - value: 1 - - name: ACAMERA_CONTROL_SCENE_MODE_ACTION - value: 2 - - name: ACAMERA_CONTROL_SCENE_MODE_PORTRAIT - value: 3 - - name: ACAMERA_CONTROL_SCENE_MODE_LANDSCAPE - value: 4 - - name: ACAMERA_CONTROL_SCENE_MODE_NIGHT - value: 5 - - name: ACAMERA_CONTROL_SCENE_MODE_NIGHT_PORTRAIT - value: 6 - - name: ACAMERA_CONTROL_SCENE_MODE_THEATRE - value: 7 - - name: ACAMERA_CONTROL_SCENE_MODE_BEACH - value: 8 - - name: ACAMERA_CONTROL_SCENE_MODE_SNOW - value: 9 - - name: ACAMERA_CONTROL_SCENE_MODE_SUNSET - value: 10 - - name: ACAMERA_CONTROL_SCENE_MODE_STEADYPHOTO - value: 11 - - name: ACAMERA_CONTROL_SCENE_MODE_FIREWORKS - value: 12 - - name: ACAMERA_CONTROL_SCENE_MODE_SPORTS - value: 13 - - name: ACAMERA_CONTROL_SCENE_MODE_PARTY - value: 14 - - name: ACAMERA_CONTROL_SCENE_MODE_CANDLELIGHT - value: 15 - - name: ACAMERA_CONTROL_SCENE_MODE_BARCODE - value: 16 - - name: ACAMERA_CONTROL_SCENE_MODE_HDR - value: 18 - acamera_metadata_enum_android_control_settings_override_t: - - name: ACAMERA_CONTROL_SETTINGS_OVERRIDE_OFF - value: 0 - - name: ACAMERA_CONTROL_SETTINGS_OVERRIDE_ZOOM - value: 1 - acamera_metadata_enum_android_control_video_stabilization_mode_t: - - name: ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_OFF - value: 0 - - name: ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_ON - value: 1 - - name: ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION - value: 2 - acamera_metadata_enum_android_depth_available_depth_stream_configurations_maximum_resolution_t: - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT - value: 0 - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT - value: 1 - acamera_metadata_enum_android_depth_available_depth_stream_configurations_t: - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT - value: 0 - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT - value: 1 - acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_maximum_resolution_t: - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT - value: 0 - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT - value: 1 - acamera_metadata_enum_android_depth_available_dynamic_depth_stream_configurations_t: - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT - value: 0 - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT - value: 1 - acamera_metadata_enum_android_depth_depth_is_exclusive_t: - - name: ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE - value: 0 - - name: ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE - value: 1 - acamera_metadata_enum_android_distortion_correction_mode_t: - - name: ACAMERA_DISTORTION_CORRECTION_MODE_OFF - value: 0 - - name: ACAMERA_DISTORTION_CORRECTION_MODE_FAST - value: 1 - - name: ACAMERA_DISTORTION_CORRECTION_MODE_HIGH_QUALITY - value: 2 - acamera_metadata_enum_android_edge_mode_t: - - name: ACAMERA_EDGE_MODE_OFF - value: 0 - - name: ACAMERA_EDGE_MODE_FAST - value: 1 - - name: ACAMERA_EDGE_MODE_HIGH_QUALITY - value: 2 - - name: ACAMERA_EDGE_MODE_ZERO_SHUTTER_LAG - value: 3 - acamera_metadata_enum_android_flash_info_available_t: - - name: ACAMERA_FLASH_INFO_AVAILABLE_FALSE - value: 0 - - name: ACAMERA_FLASH_INFO_AVAILABLE_TRUE - value: 1 - acamera_metadata_enum_android_flash_mode_t: - - name: ACAMERA_FLASH_MODE_OFF - value: 0 - - name: ACAMERA_FLASH_MODE_SINGLE - value: 1 - - name: ACAMERA_FLASH_MODE_TORCH - value: 2 - acamera_metadata_enum_android_flash_state_t: - - name: ACAMERA_FLASH_STATE_UNAVAILABLE - value: 0 - - name: ACAMERA_FLASH_STATE_CHARGING - value: 1 - - name: ACAMERA_FLASH_STATE_READY - value: 2 - - name: ACAMERA_FLASH_STATE_FIRED - value: 3 - - name: ACAMERA_FLASH_STATE_PARTIAL - value: 4 - acamera_metadata_enum_android_heic_available_heic_stream_configurations_maximum_resolution_t: - - name: ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT - value: 0 - - name: ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT - value: 1 - acamera_metadata_enum_android_heic_available_heic_stream_configurations_t: - - name: ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT - value: 0 - - name: ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT - value: 1 - acamera_metadata_enum_android_hot_pixel_mode_t: - - name: ACAMERA_HOT_PIXEL_MODE_OFF - value: 0 - - name: ACAMERA_HOT_PIXEL_MODE_FAST - value: 1 - - name: ACAMERA_HOT_PIXEL_MODE_HIGH_QUALITY - value: 2 - acamera_metadata_enum_android_info_supported_hardware_level_t: - - name: ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED - value: 0 - - name: ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL - value: 1 - - name: ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY - value: 2 - - name: ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_3 - value: 3 - - name: ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL - value: 4 - acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t: - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT - value: 0 - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT - value: 1 - acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t: - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT - value: 0 - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT - value: 1 - acamera_metadata_enum_android_lens_facing_t: - - name: ACAMERA_LENS_FACING_FRONT - value: 0 - - name: ACAMERA_LENS_FACING_BACK - value: 1 - - name: ACAMERA_LENS_FACING_EXTERNAL - value: 2 - acamera_metadata_enum_android_lens_info_focus_distance_calibration_t: - - name: ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED - value: 0 - - name: ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE - value: 1 - - name: ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED - value: 2 - acamera_metadata_enum_android_lens_optical_stabilization_mode_t: - - name: ACAMERA_LENS_OPTICAL_STABILIZATION_MODE_OFF - value: 0 - - name: ACAMERA_LENS_OPTICAL_STABILIZATION_MODE_ON - value: 1 - acamera_metadata_enum_android_lens_pose_reference_t: - - name: ACAMERA_LENS_POSE_REFERENCE_PRIMARY_CAMERA - value: 0 - - name: ACAMERA_LENS_POSE_REFERENCE_GYROSCOPE - value: 1 - - name: ACAMERA_LENS_POSE_REFERENCE_UNDEFINED - value: 2 - - name: ACAMERA_LENS_POSE_REFERENCE_AUTOMOTIVE - value: 3 - acamera_metadata_enum_android_lens_state_t: - - name: ACAMERA_LENS_STATE_STATIONARY - value: 0 - - name: ACAMERA_LENS_STATE_MOVING - value: 1 - acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t: - - name: ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE - value: 0 - - name: ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED - value: 1 - acamera_metadata_enum_android_noise_reduction_mode_t: - - name: ACAMERA_NOISE_REDUCTION_MODE_OFF - value: 0 - - name: ACAMERA_NOISE_REDUCTION_MODE_FAST - value: 1 - - name: ACAMERA_NOISE_REDUCTION_MODE_HIGH_QUALITY - value: 2 - - name: ACAMERA_NOISE_REDUCTION_MODE_MINIMAL - value: 3 - - name: ACAMERA_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG - value: 4 - acamera_metadata_enum_android_request_available_capabilities_t: - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE - value: 0 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR - value: 1 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING - value: 2 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW - value: 3 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS - value: 5 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE - value: 6 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT - value: 8 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING - value: 10 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA - value: 11 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME - value: 12 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA - value: 13 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA - value: 14 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR - value: 16 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE - value: 19 - acamera_metadata_enum_android_request_available_color_space_profiles_map_t: - - name: ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED - value: -1 - - name: ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB - value: 0 - - name: ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 - value: 7 - - name: ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020_HLG - value: 16 - acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t: - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD - value: 1 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 - value: 2 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 - value: 4 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS - value: 8 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF - value: 16 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO - value: 32 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM - value: 64 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO - value: 128 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF - value: 256 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO - value: 512 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM - value: 1024 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO - value: 2048 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX - value: 4096 - acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t: - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW - value: 0 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD - value: 1 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT - value: 2 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT - value: 3 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL - value: 4 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW - value: 5 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT - value: 6 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END - value: 7 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT - value: 8 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END_3_8 - value: 9 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START - value: 24 - acamera_metadata_enum_android_scaler_available_stream_configurations_maximum_resolution_t: - - name: ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT - value: 0 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT - value: 1 - acamera_metadata_enum_android_scaler_available_stream_configurations_t: - - name: ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT - value: 0 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT - value: 1 - acamera_metadata_enum_android_scaler_available_stream_use_cases_t: - - name: ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT - value: 0 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW - value: 1 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE - value: 2 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD - value: 3 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL - value: 4 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL - value: 5 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW - value: 6 - acamera_metadata_enum_android_scaler_cropping_type_t: - - name: ACAMERA_SCALER_CROPPING_TYPE_CENTER_ONLY - value: 0 - - name: ACAMERA_SCALER_CROPPING_TYPE_FREEFORM - value: 1 - acamera_metadata_enum_android_scaler_multi_resolution_stream_supported_t: - - name: ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE - value: 0 - - name: ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE - value: 1 - acamera_metadata_enum_android_scaler_physical_camera_multi_resolution_stream_configurations_t: - - name: ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT - value: 0 - - name: ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT - value: 1 - acamera_metadata_enum_android_scaler_rotate_and_crop_t: - - name: ACAMERA_SCALER_ROTATE_AND_CROP_NONE - value: 0 - - name: ACAMERA_SCALER_ROTATE_AND_CROP_90 - value: 1 - - name: ACAMERA_SCALER_ROTATE_AND_CROP_180 - value: 2 - - name: ACAMERA_SCALER_ROTATE_AND_CROP_270 - value: 3 - - name: ACAMERA_SCALER_ROTATE_AND_CROP_AUTO - value: 4 - acamera_metadata_enum_android_sensor_info_color_filter_arrangement_t: - - name: ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB - value: 0 - - name: ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG - value: 1 - - name: ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG - value: 2 - - name: ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR - value: 3 - - name: ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB - value: 4 - - name: ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO - value: 5 - - name: ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR - value: 6 - acamera_metadata_enum_android_sensor_info_lens_shading_applied_t: - - name: ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE - value: 0 - - name: ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE - value: 1 - acamera_metadata_enum_android_sensor_info_timestamp_source_t: - - name: ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN - value: 0 - - name: ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME - value: 1 - acamera_metadata_enum_android_sensor_pixel_mode_t: - - name: ACAMERA_SENSOR_PIXEL_MODE_DEFAULT - value: 0 - - name: ACAMERA_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION - value: 1 - acamera_metadata_enum_android_sensor_raw_binning_factor_used_t: - - name: ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED_TRUE - value: 0 - - name: ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED_FALSE - value: 1 - acamera_metadata_enum_android_sensor_reference_illuminant1_t: - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT - value: 1 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT - value: 2 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN - value: 3 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FLASH - value: 4 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER - value: 9 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER - value: 10 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_SHADE - value: 11 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT - value: 12 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT - value: 13 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT - value: 14 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT - value: 15 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A - value: 17 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B - value: 18 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C - value: 19 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D55 - value: 20 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D65 - value: 21 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D75 - value: 22 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_D50 - value: 23 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN - value: 24 - acamera_metadata_enum_android_sensor_test_pattern_mode_t: - - name: ACAMERA_SENSOR_TEST_PATTERN_MODE_OFF - value: 0 - - name: ACAMERA_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR - value: 1 - - name: ACAMERA_SENSOR_TEST_PATTERN_MODE_COLOR_BARS - value: 2 - - name: ACAMERA_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY - value: 3 - - name: ACAMERA_SENSOR_TEST_PATTERN_MODE_PN9 - value: 4 - - name: ACAMERA_SENSOR_TEST_PATTERN_MODE_CUSTOM1 - value: 256 - acamera_metadata_enum_android_shading_mode_t: - - name: ACAMERA_SHADING_MODE_OFF - value: 0 - - name: ACAMERA_SHADING_MODE_FAST - value: 1 - - name: ACAMERA_SHADING_MODE_HIGH_QUALITY - value: 2 - acamera_metadata_enum_android_statistics_face_detect_mode_t: - - name: ACAMERA_STATISTICS_FACE_DETECT_MODE_OFF - value: 0 - - name: ACAMERA_STATISTICS_FACE_DETECT_MODE_SIMPLE - value: 1 - - name: ACAMERA_STATISTICS_FACE_DETECT_MODE_FULL - value: 2 - acamera_metadata_enum_android_statistics_hot_pixel_map_mode_t: - - name: ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE_OFF - value: 0 - - name: ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE_ON - value: 1 - acamera_metadata_enum_android_statistics_lens_shading_map_mode_t: - - name: ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE_OFF - value: 0 - - name: ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE_ON - value: 1 - acamera_metadata_enum_android_statistics_ois_data_mode_t: - - name: ACAMERA_STATISTICS_OIS_DATA_MODE_OFF - value: 0 - - name: ACAMERA_STATISTICS_OIS_DATA_MODE_ON - value: 1 - acamera_metadata_enum_android_statistics_scene_flicker_t: - - name: ACAMERA_STATISTICS_SCENE_FLICKER_NONE - value: 0 - - name: ACAMERA_STATISTICS_SCENE_FLICKER_50HZ - value: 1 - - name: ACAMERA_STATISTICS_SCENE_FLICKER_60HZ - value: 2 - acamera_metadata_enum_android_sync_frame_number_t: - - name: ACAMERA_SYNC_FRAME_NUMBER_CONVERGING - value: -1 - - name: ACAMERA_SYNC_FRAME_NUMBER_UNKNOWN - value: -2 - acamera_metadata_enum_android_sync_max_latency_t: - - name: ACAMERA_SYNC_MAX_LATENCY_PER_FRAME_CONTROL - value: 0 - - name: ACAMERA_SYNC_MAX_LATENCY_UNKNOWN - value: -1 - acamera_metadata_enum_android_tonemap_mode_t: - - name: ACAMERA_TONEMAP_MODE_CONTRAST_CURVE - value: 0 - - name: ACAMERA_TONEMAP_MODE_FAST - value: 1 - - name: ACAMERA_TONEMAP_MODE_HIGH_QUALITY - value: 2 - - name: ACAMERA_TONEMAP_MODE_GAMMA_VALUE - value: 3 - - name: ACAMERA_TONEMAP_MODE_PRESET_CURVE - value: 4 - acamera_metadata_enum_android_tonemap_preset_curve_t: - - name: ACAMERA_TONEMAP_PRESET_CURVE_SRGB - value: 0 - - name: ACAMERA_TONEMAP_PRESET_CURVE_REC709 - value: 1 - acamera_metadata_section_start_t: - - name: ACAMERA_COLOR_CORRECTION_START - value: 0 - - name: ACAMERA_CONTROL_START - value: 65536 - - name: ACAMERA_DEMOSAIC_START - value: 131072 - - name: ACAMERA_EDGE_START - value: 196608 - - name: ACAMERA_FLASH_START - value: 262144 - - name: ACAMERA_FLASH_INFO_START - value: 327680 - - name: ACAMERA_HOT_PIXEL_START - value: 393216 - - name: ACAMERA_JPEG_START - value: 458752 - - name: ACAMERA_LENS_START - value: 524288 - - name: ACAMERA_LENS_INFO_START - value: 589824 - - name: ACAMERA_NOISE_REDUCTION_START - value: 655360 - - name: ACAMERA_QUIRKS_START - value: 720896 - - name: ACAMERA_REQUEST_START - value: 786432 - - name: ACAMERA_SCALER_START - value: 851968 - - name: ACAMERA_SENSOR_START - value: 917504 - - name: ACAMERA_SENSOR_INFO_START - value: 983040 - - name: ACAMERA_SHADING_START - value: 1048576 - - name: ACAMERA_STATISTICS_START - value: 1114112 - - name: ACAMERA_STATISTICS_INFO_START - value: 1179648 - - name: ACAMERA_TONEMAP_START - value: 1245184 - - name: ACAMERA_LED_START - value: 1310720 - - name: ACAMERA_INFO_START - value: 1376256 - - name: ACAMERA_BLACK_LEVEL_START - value: 1441792 - - name: ACAMERA_SYNC_START - value: 1507328 - - name: ACAMERA_REPROCESS_START - value: 1572864 - - name: ACAMERA_DEPTH_START - value: 1638400 - - name: ACAMERA_LOGICAL_MULTI_CAMERA_START - value: 1703936 - - name: ACAMERA_DISTORTION_CORRECTION_START - value: 1769472 - - name: ACAMERA_HEIC_START - value: 1835008 - - name: ACAMERA_HEIC_INFO_START - value: 1900544 - - name: ACAMERA_AUTOMOTIVE_START - value: 1966080 - - name: ACAMERA_AUTOMOTIVE_LENS_START - value: 2031616 - - name: ACAMERA_EXTENSION_START - value: 2097152 - - name: ACAMERA_JPEGR_START - value: 2162688 - - name: ACAMERA_VENDOR_START - value: -2147483648 - acamera_metadata_section_t: - - name: ACAMERA_COLOR_CORRECTION - value: 0 - - name: ACAMERA_CONTROL - value: 1 - - name: ACAMERA_DEMOSAIC - value: 2 - - name: ACAMERA_EDGE - value: 3 - - name: ACAMERA_FLASH - value: 4 - - name: ACAMERA_FLASH_INFO - value: 5 - - name: ACAMERA_HOT_PIXEL - value: 6 - - name: ACAMERA_JPEG - value: 7 - - name: ACAMERA_LENS - value: 8 - - name: ACAMERA_LENS_INFO - value: 9 - - name: ACAMERA_NOISE_REDUCTION - value: 10 - - name: ACAMERA_QUIRKS - value: 11 - - name: ACAMERA_REQUEST - value: 12 - - name: ACAMERA_SCALER - value: 13 - - name: ACAMERA_SENSOR - value: 14 - - name: ACAMERA_SENSOR_INFO - value: 15 - - name: ACAMERA_SHADING - value: 16 - - name: ACAMERA_STATISTICS - value: 17 - - name: ACAMERA_STATISTICS_INFO - value: 18 - - name: ACAMERA_TONEMAP - value: 19 - - name: ACAMERA_LED - value: 20 - - name: ACAMERA_INFO - value: 21 - - name: ACAMERA_BLACK_LEVEL - value: 22 - - name: ACAMERA_SYNC - value: 23 - - name: ACAMERA_REPROCESS - value: 24 - - name: ACAMERA_DEPTH - value: 25 - - name: ACAMERA_LOGICAL_MULTI_CAMERA - value: 26 - - name: ACAMERA_DISTORTION_CORRECTION - value: 27 - - name: ACAMERA_HEIC - value: 28 - - name: ACAMERA_HEIC_INFO - value: 29 - - name: ACAMERA_AUTOMOTIVE - value: 30 - - name: ACAMERA_AUTOMOTIVE_LENS - value: 31 - - name: ACAMERA_EXTENSION - value: 32 - - name: ACAMERA_JPEGR - value: 33 - - name: ACAMERA_SECTION_COUNT - value: 34 - - name: ACAMERA_VENDOR - value: 32768 - acamera_metadata_tag_t: - - name: ACAMERA_COLOR_CORRECTION_MODE - value: 0 - - name: ACAMERA_COLOR_CORRECTION_TRANSFORM - value: 1 - - name: ACAMERA_COLOR_CORRECTION_GAINS - value: 2 - - name: ACAMERA_COLOR_CORRECTION_ABERRATION_MODE - value: 3 - - name: ACAMERA_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES - value: 4 - - name: ACAMERA_COLOR_CORRECTION_END - value: 5 - - name: ACAMERA_CONTROL_AE_ANTIBANDING_MODE - value: 65536 - - name: ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION - value: 65537 - - name: ACAMERA_CONTROL_AE_LOCK - value: 65538 - - name: ACAMERA_CONTROL_AE_MODE - value: 65539 - - name: ACAMERA_CONTROL_AE_REGIONS - value: 65540 - - name: ACAMERA_CONTROL_AE_TARGET_FPS_RANGE - value: 65541 - - name: ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER - value: 65542 - - name: ACAMERA_CONTROL_AF_MODE - value: 65543 - - name: ACAMERA_CONTROL_AF_REGIONS - value: 65544 - - name: ACAMERA_CONTROL_AF_TRIGGER - value: 65545 - - name: ACAMERA_CONTROL_AWB_LOCK - value: 65546 - - name: ACAMERA_CONTROL_AWB_MODE - value: 65547 - - name: ACAMERA_CONTROL_AWB_REGIONS - value: 65548 - - name: ACAMERA_CONTROL_CAPTURE_INTENT - value: 65549 - - name: ACAMERA_CONTROL_EFFECT_MODE - value: 65550 - - name: ACAMERA_CONTROL_MODE - value: 65551 - - name: ACAMERA_CONTROL_SCENE_MODE - value: 65552 - - name: ACAMERA_CONTROL_VIDEO_STABILIZATION_MODE - value: 65553 - - name: ACAMERA_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES - value: 65554 - - name: ACAMERA_CONTROL_AE_AVAILABLE_MODES - value: 65555 - - name: ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES - value: 65556 - - name: ACAMERA_CONTROL_AE_COMPENSATION_RANGE - value: 65557 - - name: ACAMERA_CONTROL_AE_COMPENSATION_STEP - value: 65558 - - name: ACAMERA_CONTROL_AF_AVAILABLE_MODES - value: 65559 - - name: ACAMERA_CONTROL_AVAILABLE_EFFECTS - value: 65560 - - name: ACAMERA_CONTROL_AVAILABLE_SCENE_MODES - value: 65561 - - name: ACAMERA_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES - value: 65562 - - name: ACAMERA_CONTROL_AWB_AVAILABLE_MODES - value: 65563 - - name: ACAMERA_CONTROL_MAX_REGIONS - value: 65564 - - name: ACAMERA_CONTROL_AE_STATE - value: 65567 - - name: ACAMERA_CONTROL_AF_STATE - value: 65568 - - name: ACAMERA_CONTROL_AWB_STATE - value: 65570 - - name: ACAMERA_CONTROL_AE_LOCK_AVAILABLE - value: 65572 - - name: ACAMERA_CONTROL_AWB_LOCK_AVAILABLE - value: 65573 - - name: ACAMERA_CONTROL_AVAILABLE_MODES - value: 65574 - - name: ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE - value: 65575 - - name: ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST - value: 65576 - - name: ACAMERA_CONTROL_ENABLE_ZSL - value: 65577 - - name: ACAMERA_CONTROL_AF_SCENE_CHANGE - value: 65578 - - name: ACAMERA_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES - value: 65579 - - name: ACAMERA_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES - value: 65580 - - name: ACAMERA_CONTROL_EXTENDED_SCENE_MODE - value: 65581 - - name: ACAMERA_CONTROL_ZOOM_RATIO_RANGE - value: 65582 - - name: ACAMERA_CONTROL_ZOOM_RATIO - value: 65583 - - name: ACAMERA_CONTROL_SETTINGS_OVERRIDE - value: 65588 - - name: ACAMERA_CONTROL_AVAILABLE_SETTINGS_OVERRIDES - value: 65589 - - name: ACAMERA_CONTROL_AUTOFRAMING - value: 65591 - - name: ACAMERA_CONTROL_AUTOFRAMING_AVAILABLE - value: 65592 - - name: ACAMERA_CONTROL_AUTOFRAMING_STATE - value: 65593 - - name: ACAMERA_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE - value: 65594 - - name: ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE - value: 65595 - - name: ACAMERA_CONTROL_END - value: 65596 - - name: ACAMERA_EDGE_MODE - value: 196608 - - name: ACAMERA_EDGE_AVAILABLE_EDGE_MODES - value: 196610 - - name: ACAMERA_EDGE_END - value: 196611 - - name: ACAMERA_FLASH_MODE - value: 262146 - - name: ACAMERA_FLASH_STATE - value: 262149 - - name: ACAMERA_FLASH_STRENGTH_LEVEL - value: 262150 - - name: ACAMERA_FLASH_SINGLE_STRENGTH_MAX_LEVEL - value: 262151 - - name: ACAMERA_FLASH_SINGLE_STRENGTH_DEFAULT_LEVEL - value: 262152 - - name: ACAMERA_FLASH_TORCH_STRENGTH_MAX_LEVEL - value: 262153 - - name: ACAMERA_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL - value: 262154 - - name: ACAMERA_FLASH_END - value: 262155 - - name: ACAMERA_FLASH_INFO_AVAILABLE - value: 327680 - - name: ACAMERA_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL - value: 327682 - - name: ACAMERA_FLASH_INFO_STRENGTH_DEFAULT_LEVEL - value: 327683 - - name: ACAMERA_FLASH_INFO_END - value: 327684 - - name: ACAMERA_HOT_PIXEL_MODE - value: 393216 - - name: ACAMERA_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES - value: 393217 - - name: ACAMERA_HOT_PIXEL_END - value: 393218 - - name: ACAMERA_JPEG_GPS_COORDINATES - value: 458752 - - name: ACAMERA_JPEG_GPS_PROCESSING_METHOD - value: 458753 - - name: ACAMERA_JPEG_GPS_TIMESTAMP - value: 458754 - - name: ACAMERA_JPEG_ORIENTATION - value: 458755 - - name: ACAMERA_JPEG_QUALITY - value: 458756 - - name: ACAMERA_JPEG_THUMBNAIL_QUALITY - value: 458757 - - name: ACAMERA_JPEG_THUMBNAIL_SIZE - value: 458758 - - name: ACAMERA_JPEG_AVAILABLE_THUMBNAIL_SIZES - value: 458759 - - name: ACAMERA_JPEG_END - value: 458760 - - name: ACAMERA_LENS_APERTURE - value: 524288 - - name: ACAMERA_LENS_FILTER_DENSITY - value: 524289 - - name: ACAMERA_LENS_FOCAL_LENGTH - value: 524290 - - name: ACAMERA_LENS_FOCUS_DISTANCE - value: 524291 - - name: ACAMERA_LENS_OPTICAL_STABILIZATION_MODE - value: 524292 - - name: ACAMERA_LENS_FACING - value: 524293 - - name: ACAMERA_LENS_POSE_ROTATION - value: 524294 - - name: ACAMERA_LENS_POSE_TRANSLATION - value: 524295 - - name: ACAMERA_LENS_FOCUS_RANGE - value: 524296 - - name: ACAMERA_LENS_STATE - value: 524297 - - name: ACAMERA_LENS_INTRINSIC_CALIBRATION - value: 524298 - - name: ACAMERA_LENS_RADIAL_DISTORTION - value: 524299 - - name: ACAMERA_LENS_POSE_REFERENCE - value: 524300 - - name: ACAMERA_LENS_DISTORTION - value: 524301 - - name: ACAMERA_LENS_DISTORTION_MAXIMUM_RESOLUTION - value: 524302 - - name: ACAMERA_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION - value: 524303 - - name: ACAMERA_LENS_END - value: 524304 - - name: ACAMERA_LENS_INFO_AVAILABLE_APERTURES - value: 589824 - - name: ACAMERA_LENS_INFO_AVAILABLE_FILTER_DENSITIES - value: 589825 - - name: ACAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS - value: 589826 - - name: ACAMERA_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION - value: 589827 - - name: ACAMERA_LENS_INFO_HYPERFOCAL_DISTANCE - value: 589828 - - name: ACAMERA_LENS_INFO_MINIMUM_FOCUS_DISTANCE - value: 589829 - - name: ACAMERA_LENS_INFO_SHADING_MAP_SIZE - value: 589830 - - name: ACAMERA_LENS_INFO_FOCUS_DISTANCE_CALIBRATION - value: 589831 - - name: ACAMERA_LENS_INFO_END - value: 589832 - - name: ACAMERA_NOISE_REDUCTION_MODE - value: 655360 - - name: ACAMERA_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES - value: 655362 - - name: ACAMERA_NOISE_REDUCTION_END - value: 655363 - - name: ACAMERA_REQUEST_MAX_NUM_OUTPUT_STREAMS - value: 786438 - - name: ACAMERA_REQUEST_PIPELINE_DEPTH - value: 786441 - - name: ACAMERA_REQUEST_PIPELINE_MAX_DEPTH - value: 786442 - - name: ACAMERA_REQUEST_PARTIAL_RESULT_COUNT - value: 786443 - - name: ACAMERA_REQUEST_AVAILABLE_CAPABILITIES - value: 786444 - - name: ACAMERA_REQUEST_AVAILABLE_REQUEST_KEYS - value: 786445 - - name: ACAMERA_REQUEST_AVAILABLE_RESULT_KEYS - value: 786446 - - name: ACAMERA_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS - value: 786447 - - name: ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS - value: 786448 - - name: ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS - value: 786449 - - name: ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP - value: 786451 - - name: ACAMERA_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP - value: 786453 - - name: ACAMERA_REQUEST_END - value: 786454 - - name: ACAMERA_SCALER_CROP_REGION - value: 851968 - - name: ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM - value: 851972 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS - value: 851978 - - name: ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS - value: 851979 - - name: ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS - value: 851980 - - name: ACAMERA_SCALER_CROPPING_TYPE - value: 851981 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS - value: 851982 - - name: ACAMERA_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP - value: 851983 - - name: ACAMERA_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES - value: 851984 - - name: ACAMERA_SCALER_ROTATE_AND_CROP - value: 851985 - - name: ACAMERA_SCALER_DEFAULT_SECURE_IMAGE_SIZE - value: 851986 - - name: ACAMERA_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS - value: 851987 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION - value: 851988 - - name: ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION - value: 851989 - - name: ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION - value: 851990 - - name: ACAMERA_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED - value: 851992 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_USE_CASES - value: 851994 - - name: ACAMERA_SCALER_RAW_CROP_REGION - value: 851995 - - name: ACAMERA_SCALER_END - value: 851996 - - name: ACAMERA_SENSOR_EXPOSURE_TIME - value: 917504 - - name: ACAMERA_SENSOR_FRAME_DURATION - value: 917505 - - name: ACAMERA_SENSOR_SENSITIVITY - value: 917506 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT1 - value: 917507 - - name: ACAMERA_SENSOR_REFERENCE_ILLUMINANT2 - value: 917508 - - name: ACAMERA_SENSOR_CALIBRATION_TRANSFORM1 - value: 917509 - - name: ACAMERA_SENSOR_CALIBRATION_TRANSFORM2 - value: 917510 - - name: ACAMERA_SENSOR_COLOR_TRANSFORM1 - value: 917511 - - name: ACAMERA_SENSOR_COLOR_TRANSFORM2 - value: 917512 - - name: ACAMERA_SENSOR_FORWARD_MATRIX1 - value: 917513 - - name: ACAMERA_SENSOR_FORWARD_MATRIX2 - value: 917514 - - name: ACAMERA_SENSOR_BLACK_LEVEL_PATTERN - value: 917516 - - name: ACAMERA_SENSOR_MAX_ANALOG_SENSITIVITY - value: 917517 - - name: ACAMERA_SENSOR_ORIENTATION - value: 917518 - - name: ACAMERA_SENSOR_TIMESTAMP - value: 917520 - - name: ACAMERA_SENSOR_NEUTRAL_COLOR_POINT - value: 917522 - - name: ACAMERA_SENSOR_NOISE_PROFILE - value: 917523 - - name: ACAMERA_SENSOR_GREEN_SPLIT - value: 917526 - - name: ACAMERA_SENSOR_TEST_PATTERN_DATA - value: 917527 - - name: ACAMERA_SENSOR_TEST_PATTERN_MODE - value: 917528 - - name: ACAMERA_SENSOR_AVAILABLE_TEST_PATTERN_MODES - value: 917529 - - name: ACAMERA_SENSOR_ROLLING_SHUTTER_SKEW - value: 917530 - - name: ACAMERA_SENSOR_OPTICAL_BLACK_REGIONS - value: 917531 - - name: ACAMERA_SENSOR_DYNAMIC_BLACK_LEVEL - value: 917532 - - name: ACAMERA_SENSOR_DYNAMIC_WHITE_LEVEL - value: 917533 - - name: ACAMERA_SENSOR_PIXEL_MODE - value: 917536 - - name: ACAMERA_SENSOR_RAW_BINNING_FACTOR_USED - value: 917537 - - name: ACAMERA_SENSOR_END - value: 917538 - - name: ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE - value: 983040 - - name: ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE - value: 983041 - - name: ACAMERA_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT - value: 983042 - - name: ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE - value: 983043 - - name: ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION - value: 983044 - - name: ACAMERA_SENSOR_INFO_PHYSICAL_SIZE - value: 983045 - - name: ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE - value: 983046 - - name: ACAMERA_SENSOR_INFO_WHITE_LEVEL - value: 983047 - - name: ACAMERA_SENSOR_INFO_TIMESTAMP_SOURCE - value: 983048 - - name: ACAMERA_SENSOR_INFO_LENS_SHADING_APPLIED - value: 983049 - - name: ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE - value: 983050 - - name: ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION - value: 983051 - - name: ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION - value: 983052 - - name: ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION - value: 983053 - - name: ACAMERA_SENSOR_INFO_BINNING_FACTOR - value: 983054 - - name: ACAMERA_SENSOR_INFO_END - value: 983055 - - name: ACAMERA_SHADING_MODE - value: 1048576 - - name: ACAMERA_SHADING_AVAILABLE_MODES - value: 1048578 - - name: ACAMERA_SHADING_END - value: 1048579 - - name: ACAMERA_STATISTICS_FACE_DETECT_MODE - value: 1114112 - - name: ACAMERA_STATISTICS_HOT_PIXEL_MAP_MODE - value: 1114115 - - name: ACAMERA_STATISTICS_FACE_IDS - value: 1114116 - - name: ACAMERA_STATISTICS_FACE_LANDMARKS - value: 1114117 - - name: ACAMERA_STATISTICS_FACE_RECTANGLES - value: 1114118 - - name: ACAMERA_STATISTICS_FACE_SCORES - value: 1114119 - - name: ACAMERA_STATISTICS_LENS_SHADING_MAP - value: 1114123 - - name: ACAMERA_STATISTICS_SCENE_FLICKER - value: 1114126 - - name: ACAMERA_STATISTICS_HOT_PIXEL_MAP - value: 1114127 - - name: ACAMERA_STATISTICS_LENS_SHADING_MAP_MODE - value: 1114128 - - name: ACAMERA_STATISTICS_OIS_DATA_MODE - value: 1114129 - - name: ACAMERA_STATISTICS_OIS_TIMESTAMPS - value: 1114130 - - name: ACAMERA_STATISTICS_OIS_X_SHIFTS - value: 1114131 - - name: ACAMERA_STATISTICS_OIS_Y_SHIFTS - value: 1114132 - - name: ACAMERA_STATISTICS_LENS_INTRINSIC_TIMESTAMPS - value: 1114133 - - name: ACAMERA_STATISTICS_LENS_INTRINSIC_SAMPLES - value: 1114134 - - name: ACAMERA_STATISTICS_END - value: 1114135 - - name: ACAMERA_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES - value: 1179648 - - name: ACAMERA_STATISTICS_INFO_MAX_FACE_COUNT - value: 1179650 - - name: ACAMERA_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES - value: 1179654 - - name: ACAMERA_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES - value: 1179655 - - name: ACAMERA_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES - value: 1179656 - - name: ACAMERA_STATISTICS_INFO_END - value: 1179657 - - name: ACAMERA_TONEMAP_CURVE_BLUE - value: 1245184 - - name: ACAMERA_TONEMAP_CURVE_GREEN - value: 1245185 - - name: ACAMERA_TONEMAP_CURVE_RED - value: 1245186 - - name: ACAMERA_TONEMAP_MODE - value: 1245187 - - name: ACAMERA_TONEMAP_MAX_CURVE_POINTS - value: 1245188 - - name: ACAMERA_TONEMAP_AVAILABLE_TONE_MAP_MODES - value: 1245189 - - name: ACAMERA_TONEMAP_GAMMA - value: 1245190 - - name: ACAMERA_TONEMAP_PRESET_CURVE - value: 1245191 - - name: ACAMERA_TONEMAP_END - value: 1245192 - - name: ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL - value: 1376256 - - name: ACAMERA_INFO_VERSION - value: 1376257 - - name: ACAMERA_INFO_DEVICE_STATE_ORIENTATIONS - value: 1376259 - - name: ACAMERA_INFO_END - value: 1376260 - - name: ACAMERA_BLACK_LEVEL_LOCK - value: 1441792 - - name: ACAMERA_BLACK_LEVEL_END - value: 1441793 - - name: ACAMERA_SYNC_FRAME_NUMBER - value: 1507328 - - name: ACAMERA_SYNC_MAX_LATENCY - value: 1507329 - - name: ACAMERA_SYNC_END - value: 1507330 - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS - value: 1638401 - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS - value: 1638402 - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS - value: 1638403 - - name: ACAMERA_DEPTH_DEPTH_IS_EXCLUSIVE - value: 1638404 - - name: ACAMERA_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS - value: 1638405 - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS - value: 1638406 - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS - value: 1638407 - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS - value: 1638408 - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION - value: 1638409 - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION - value: 1638410 - - name: ACAMERA_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION - value: 1638411 - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION - value: 1638412 - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION - value: 1638413 - - name: ACAMERA_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION - value: 1638414 - - name: ACAMERA_DEPTH_END - value: 1638415 - - name: ACAMERA_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS - value: 1703936 - - name: ACAMERA_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE - value: 1703937 - - name: ACAMERA_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID - value: 1703938 - - name: ACAMERA_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_SENSOR_CROP_REGION - value: 1703939 - - name: ACAMERA_LOGICAL_MULTI_CAMERA_END - value: 1703940 - - name: ACAMERA_DISTORTION_CORRECTION_MODE - value: 1769472 - - name: ACAMERA_DISTORTION_CORRECTION_AVAILABLE_MODES - value: 1769473 - - name: ACAMERA_DISTORTION_CORRECTION_END - value: 1769474 - - name: ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS - value: 1835008 - - name: ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS - value: 1835009 - - name: ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS - value: 1835010 - - name: ACAMERA_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION - value: 1835011 - - name: ACAMERA_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION - value: 1835012 - - name: ACAMERA_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION - value: 1835013 - - name: ACAMERA_HEIC_END - value: 1835014 - - name: ACAMERA_AUTOMOTIVE_LOCATION - value: 1966080 - - name: ACAMERA_AUTOMOTIVE_END - value: 1966081 - - name: ACAMERA_AUTOMOTIVE_LENS_FACING - value: 2031616 - - name: ACAMERA_AUTOMOTIVE_LENS_END - value: 2031617 - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS - value: 2162688 - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS - value: 2162689 - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS - value: 2162690 - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION - value: 2162691 - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION - value: 2162692 - - name: ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION - value: 2162693 - - name: ACAMERA_JPEGR_END - value: 2162694 -functions: - ACameraCaptureSession_abortCaptures: - c_name: ACameraCaptureSession_abortCaptures - params: - - name: session - type: '*ACameraCaptureSession' - returns: camera_status_t - ACameraCaptureSession_capture: - c_name: ACameraCaptureSession_capture - params: - - name: session - type: '*ACameraCaptureSession' - - name: callbacks - type: '*ACameraCaptureSession_captureCallbacks' - - name: numRequests - type: int32 - - name: requests - type: '**ACaptureRequest' - direction: out - - name: captureSequenceId - type: '*int32' - returns: camera_status_t - ACameraCaptureSession_captureV2: - c_name: ACameraCaptureSession_captureV2 - params: - - name: session - type: '*ACameraCaptureSession' - - name: callbacks - type: '*ACameraCaptureSession_captureCallbacksV2' - - name: numRequests - type: int32 - - name: requests - type: '**ACaptureRequest' - direction: out - - name: captureSequenceId - type: '*int32' - returns: camera_status_t - ACameraCaptureSession_close: - c_name: ACameraCaptureSession_close - params: - - name: session - type: '*ACameraCaptureSession' - returns: "" - ACameraCaptureSession_getDevice: - c_name: ACameraCaptureSession_getDevice - params: - - name: session - type: '*ACameraCaptureSession' - - name: device - type: '**ACameraDevice' - direction: out - returns: camera_status_t - ACameraCaptureSession_logicalCamera_capture: - c_name: ACameraCaptureSession_logicalCamera_capture - params: - - name: session - type: '*ACameraCaptureSession' - - name: callbacks - type: '*ACameraCaptureSession_logicalCamera_captureCallbacks' - - name: numRequests - type: int32 - - name: requests - type: '**ACaptureRequest' - direction: out - - name: captureSequenceId - type: '*int32' - returns: camera_status_t - ACameraCaptureSession_logicalCamera_captureV2: - c_name: ACameraCaptureSession_logicalCamera_captureV2 - params: - - name: session - type: '*ACameraCaptureSession' - - name: callbacks - type: '*ACameraCaptureSession_logicalCamera_captureCallbacksV2' - - name: numRequests - type: int32 - - name: requests - type: '**ACaptureRequest' - direction: out - - name: captureSequenceId - type: '*int32' - returns: camera_status_t - ACameraCaptureSession_logicalCamera_setRepeatingRequest: - c_name: ACameraCaptureSession_logicalCamera_setRepeatingRequest - params: - - name: session - type: '*ACameraCaptureSession' - - name: callbacks - type: '*ACameraCaptureSession_logicalCamera_captureCallbacks' - - name: numRequests - type: int32 - - name: requests - type: '**ACaptureRequest' - direction: out - - name: captureSequenceId - type: '*int32' - returns: camera_status_t - ACameraCaptureSession_logicalCamera_setRepeatingRequestV2: - c_name: ACameraCaptureSession_logicalCamera_setRepeatingRequestV2 - params: - - name: session - type: '*ACameraCaptureSession' - - name: callbacks - type: '*ACameraCaptureSession_logicalCamera_captureCallbacksV2' - - name: numRequests - type: int32 - - name: requests - type: '**ACaptureRequest' - direction: out - - name: captureSequenceId - type: '*int32' - returns: camera_status_t - ACameraCaptureSession_prepareWindow: - c_name: ACameraCaptureSession_prepareWindow - params: - - name: session - type: '*ACameraCaptureSession' - - name: window - type: '*ANativeWindow' - returns: camera_status_t - ACameraCaptureSession_setRepeatingRequest: - c_name: ACameraCaptureSession_setRepeatingRequest - params: - - name: session - type: '*ACameraCaptureSession' - - name: callbacks - type: '*ACameraCaptureSession_captureCallbacks' - - name: numRequests - type: int32 - - name: requests - type: '**ACaptureRequest' - direction: out - - name: captureSequenceId - type: '*int32' - returns: camera_status_t - ACameraCaptureSession_setRepeatingRequestV2: - c_name: ACameraCaptureSession_setRepeatingRequestV2 - params: - - name: session - type: '*ACameraCaptureSession' - - name: callbacks - type: '*ACameraCaptureSession_captureCallbacksV2' - - name: numRequests - type: int32 - - name: requests - type: '**ACaptureRequest' - direction: out - - name: captureSequenceId - type: '*int32' - returns: camera_status_t - ACameraCaptureSession_setWindowPreparedCallback: - c_name: ACameraCaptureSession_setWindowPreparedCallback - params: - - name: session - type: '*ACameraCaptureSession' - - name: context - type: unsafe.Pointer - - name: callback - type: ACameraCaptureSession_prepareCallback - returns: camera_status_t - ACameraCaptureSession_stopRepeating: - c_name: ACameraCaptureSession_stopRepeating - params: - - name: session - type: '*ACameraCaptureSession' - returns: camera_status_t - ACameraCaptureSession_updateSharedOutput: - c_name: ACameraCaptureSession_updateSharedOutput - params: - - name: session - type: '*ACameraCaptureSession' - - name: output - type: '*ACaptureSessionOutput' - returns: camera_status_t - ACameraDevice_close: - c_name: ACameraDevice_close - params: - - name: device - type: '*ACameraDevice' - returns: camera_status_t - ACameraDevice_createCaptureRequest: - c_name: ACameraDevice_createCaptureRequest - params: - - name: device - type: '*ACameraDevice' - - name: templateId - type: ACameraDevice_request_template - - name: request - type: '**ACaptureRequest' - direction: out - returns: camera_status_t - ACameraDevice_createCaptureRequest_withPhysicalIds: - c_name: ACameraDevice_createCaptureRequest_withPhysicalIds - params: - - name: device - type: '*ACameraDevice' - - name: templateId - type: ACameraDevice_request_template - - name: physicalIdList - type: '*ACameraIdList' - - name: request - type: '**ACaptureRequest' - direction: out - returns: camera_status_t - ACameraDevice_createCaptureSession: - c_name: ACameraDevice_createCaptureSession - params: - - name: device - type: '*ACameraDevice' - - name: outputs - type: '*ACaptureSessionOutputContainer' - - name: callbacks - type: '*ACameraCaptureSession_stateCallbacks' - - name: session - type: '**ACameraCaptureSession' - direction: out - returns: camera_status_t - ACameraDevice_createCaptureSessionWithSessionParameters: - c_name: ACameraDevice_createCaptureSessionWithSessionParameters - params: - - name: device - type: '*ACameraDevice' - - name: outputs - type: '*ACaptureSessionOutputContainer' - - name: sessionParameters - type: '*ACaptureRequest' - - name: callbacks - type: '*ACameraCaptureSession_stateCallbacks' - - name: session - type: '**ACameraCaptureSession' - direction: out - returns: camera_status_t - ACameraDevice_getId: - c_name: ACameraDevice_getId - params: - - name: device - type: '*ACameraDevice' - returns: string - ACameraDevice_isSessionConfigurationSupported: - c_name: ACameraDevice_isSessionConfigurationSupported - params: - - name: device - type: '*ACameraDevice' - - name: sessionOutputContainer - type: '*ACaptureSessionOutputContainer' - returns: camera_status_t - ACameraManager_create: - c_name: ACameraManager_create - returns: '*ACameraManager' - ACameraManager_delete: - c_name: ACameraManager_delete - params: - - name: manager - type: '*ACameraManager' - returns: "" - ACameraManager_deleteCameraIdList: - c_name: ACameraManager_deleteCameraIdList - params: - - name: cameraIdList - type: '*ACameraIdList' - returns: "" - ACameraManager_getCameraCharacteristics: - c_name: ACameraManager_getCameraCharacteristics - params: - - name: manager - type: '*ACameraManager' - - name: cameraId - type: string - - name: characteristics - type: '**ACameraMetadata' - direction: out - returns: camera_status_t - ACameraManager_getCameraIdList: - c_name: ACameraManager_getCameraIdList - params: - - name: manager - type: '*ACameraManager' - - name: cameraIdList - type: '**ACameraIdList' - direction: out - returns: camera_status_t - ACameraManager_openCamera: - c_name: ACameraManager_openCamera - params: - - name: manager - type: '*ACameraManager' - - name: cameraId - type: string - - name: callback - type: '*ACameraDevice_StateCallbacks' - - name: device - type: '**ACameraDevice' - direction: out - returns: camera_status_t - ACameraManager_registerAvailabilityCallback: - c_name: ACameraManager_registerAvailabilityCallback - params: - - name: manager - type: '*ACameraManager' - - name: callback - type: '*ACameraManager_AvailabilityCallbacks' - returns: camera_status_t - ACameraManager_registerExtendedAvailabilityCallback: - c_name: ACameraManager_registerExtendedAvailabilityCallback - params: - - name: manager - type: '*ACameraManager' - - name: callback - type: '*ACameraManager_ExtendedAvailabilityCallbacks' - returns: camera_status_t - ACameraManager_unregisterAvailabilityCallback: - c_name: ACameraManager_unregisterAvailabilityCallback - params: - - name: manager - type: '*ACameraManager' - - name: callback - type: '*ACameraManager_AvailabilityCallbacks' - returns: camera_status_t - ACameraManager_unregisterExtendedAvailabilityCallback: - c_name: ACameraManager_unregisterExtendedAvailabilityCallback - params: - - name: manager - type: '*ACameraManager' - - name: callback - type: '*ACameraManager_ExtendedAvailabilityCallbacks' - returns: camera_status_t - ACameraMetadata_copy: - c_name: ACameraMetadata_copy - params: - - name: src - type: '*ACameraMetadata' - returns: '*ACameraMetadata' - ACameraMetadata_free: - c_name: ACameraMetadata_free - params: - - name: metadata - type: '*ACameraMetadata' - returns: "" - ACameraMetadata_fromCameraMetadata: - c_name: ACameraMetadata_fromCameraMetadata - params: - - name: env - type: '*JNIEnv' - - name: cameraMetadata - type: jobject - returns: '*ACameraMetadata' - ACameraMetadata_getAllTags: - c_name: ACameraMetadata_getAllTags - params: - - name: metadata - type: '*ACameraMetadata' - - name: numEntries - type: '*int32' - direction: out - - name: tags - type: '**uint32' - direction: out - returns: camera_status_t - ACameraMetadata_getConstEntry: - c_name: ACameraMetadata_getConstEntry - params: - - name: metadata - type: '*ACameraMetadata' - - name: tag - type: uint32 - - name: entry - type: '*ACameraMetadata_const_entry' - direction: out - returns: camera_status_t - ACameraMetadata_getTagFromName: - c_name: ACameraMetadata_getTagFromName - params: - - name: metadata - type: '*ACameraMetadata' - - name: name - type: string - - name: tag - type: '*uint32' - returns: camera_status_t - ACameraMetadata_isLogicalMultiCamera: - c_name: ACameraMetadata_isLogicalMultiCamera - params: - - name: staticMetadata - type: '*ACameraMetadata' - - name: numPhysicalCameras - type: '*uint64' - - name: physicalCameraIds - type: '***int8' - c_type: const char*const** - direction: out - const: true - returns: bool - ACameraOutputTarget_create: - c_name: ACameraOutputTarget_create - params: - - name: window - type: '*ANativeWindow' - - name: output - type: '**ACameraOutputTarget' - direction: out - returns: camera_status_t - ACameraOutputTarget_free: - c_name: ACameraOutputTarget_free - params: - - name: output - type: '*ACameraOutputTarget' - returns: "" - ACaptureRequest_addTarget: - c_name: ACaptureRequest_addTarget - params: - - name: request - type: '*ACaptureRequest' - - name: output - type: '*ACameraOutputTarget' - returns: camera_status_t - ACaptureRequest_copy: - c_name: ACaptureRequest_copy - params: - - name: src - type: '*ACaptureRequest' - returns: '*ACaptureRequest' - ACaptureRequest_free: - c_name: ACaptureRequest_free - params: - - name: request - type: '*ACaptureRequest' - returns: "" - ACaptureRequest_getAllTags: - c_name: ACaptureRequest_getAllTags - params: - - name: request - type: '*ACaptureRequest' - - name: numTags - type: '*int32' - direction: out - - name: tags - type: '**uint32' - direction: out - returns: camera_status_t - ACaptureRequest_getConstEntry: - c_name: ACaptureRequest_getConstEntry - params: - - name: request - type: '*ACaptureRequest' - - name: tag - type: uint32 - - name: entry - type: '*ACameraMetadata_const_entry' - returns: camera_status_t - ACaptureRequest_getConstEntry_physicalCamera: - c_name: ACaptureRequest_getConstEntry_physicalCamera - params: - - name: request - type: '*ACaptureRequest' - - name: physicalId - type: string - - name: tag - type: uint32 - - name: entry - type: '*ACameraMetadata_const_entry' - returns: camera_status_t - ACaptureRequest_getUserContext: - c_name: ACaptureRequest_getUserContext - params: - - name: request - type: '*ACaptureRequest' - - name: context - type: '*unsafe.Pointer' - direction: out - returns: camera_status_t - ACaptureRequest_removeTarget: - c_name: ACaptureRequest_removeTarget - params: - - name: request - type: '*ACaptureRequest' - - name: output - type: '*ACameraOutputTarget' - returns: camera_status_t - ACaptureRequest_setEntry_double: - c_name: ACaptureRequest_setEntry_double - params: - - name: request - type: '*ACaptureRequest' - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*float64' - returns: camera_status_t - ACaptureRequest_setEntry_float: - c_name: ACaptureRequest_setEntry_float - params: - - name: request - type: '*ACaptureRequest' - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*float32' - returns: camera_status_t - ACaptureRequest_setEntry_i32: - c_name: ACaptureRequest_setEntry_i32 - params: - - name: request - type: '*ACaptureRequest' - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*int32' - returns: camera_status_t - ACaptureRequest_setEntry_i64: - c_name: ACaptureRequest_setEntry_i64 - params: - - name: request - type: '*ACaptureRequest' - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*int64' - returns: camera_status_t - ACaptureRequest_setEntry_physicalCamera_double: - c_name: ACaptureRequest_setEntry_physicalCamera_double - params: - - name: request - type: '*ACaptureRequest' - - name: physicalId - type: string - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*float64' - returns: camera_status_t - ACaptureRequest_setEntry_physicalCamera_float: - c_name: ACaptureRequest_setEntry_physicalCamera_float - params: - - name: request - type: '*ACaptureRequest' - - name: physicalId - type: string - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*float32' - returns: camera_status_t - ACaptureRequest_setEntry_physicalCamera_i32: - c_name: ACaptureRequest_setEntry_physicalCamera_i32 - params: - - name: request - type: '*ACaptureRequest' - - name: physicalId - type: string - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*int32' - returns: camera_status_t - ACaptureRequest_setEntry_physicalCamera_i64: - c_name: ACaptureRequest_setEntry_physicalCamera_i64 - params: - - name: request - type: '*ACaptureRequest' - - name: physicalId - type: string - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*int64' - returns: camera_status_t - ACaptureRequest_setEntry_physicalCamera_rational: - c_name: ACaptureRequest_setEntry_physicalCamera_rational - params: - - name: request - type: '*ACaptureRequest' - - name: physicalId - type: string - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*ACameraMetadata_rational' - returns: camera_status_t - ACaptureRequest_setEntry_physicalCamera_u8: - c_name: ACaptureRequest_setEntry_physicalCamera_u8 - params: - - name: request - type: '*ACaptureRequest' - - name: physicalId - type: string - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*uint8' - returns: camera_status_t - ACaptureRequest_setEntry_rational: - c_name: ACaptureRequest_setEntry_rational - params: - - name: request - type: '*ACaptureRequest' - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*ACameraMetadata_rational' - returns: camera_status_t - ACaptureRequest_setEntry_u8: - c_name: ACaptureRequest_setEntry_u8 - params: - - name: request - type: '*ACaptureRequest' - - name: tag - type: uint32 - - name: count - type: uint32 - - name: data - type: '*uint8' - returns: camera_status_t - ACaptureRequest_setUserContext: - c_name: ACaptureRequest_setUserContext - params: - - name: request - type: '*ACaptureRequest' - - name: context - type: unsafe.Pointer - returns: camera_status_t - ACaptureSessionOutput_create: - c_name: ACaptureSessionOutput_create - params: - - name: anw - type: '*ANativeWindow' - - name: output - type: '**ACaptureSessionOutput' - direction: out - returns: camera_status_t - ACaptureSessionOutput_free: - c_name: ACaptureSessionOutput_free - params: - - name: output - type: '*ACaptureSessionOutput' - returns: "" - ACaptureSessionOutputContainer_add: - c_name: ACaptureSessionOutputContainer_add - params: - - name: container - type: '*ACaptureSessionOutputContainer' - - name: output - type: '*ACaptureSessionOutput' - returns: camera_status_t - ACaptureSessionOutputContainer_create: - c_name: ACaptureSessionOutputContainer_create - params: - - name: container - type: '**ACaptureSessionOutputContainer' - direction: out - returns: camera_status_t - ACaptureSessionOutputContainer_free: - c_name: ACaptureSessionOutputContainer_free - params: - - name: container - type: '*ACaptureSessionOutputContainer' - returns: "" - ACaptureSessionOutputContainer_remove: - c_name: ACaptureSessionOutputContainer_remove - params: - - name: container - type: '*ACaptureSessionOutputContainer' - - name: output - type: '*ACaptureSessionOutput' - returns: camera_status_t - ACaptureSessionPhysicalOutput_create: - c_name: ACaptureSessionPhysicalOutput_create - params: - - name: anw - type: '*ANativeWindow' - - name: physicalId - type: string - - name: output - type: '**ACaptureSessionOutput' - direction: out - returns: camera_status_t - ACaptureSessionSharedOutput_add: - c_name: ACaptureSessionSharedOutput_add - params: - - name: output - type: '*ACaptureSessionOutput' - - name: anw - type: '*ANativeWindow' - returns: camera_status_t - ACaptureSessionSharedOutput_create: - c_name: ACaptureSessionSharedOutput_create - params: - - name: anw - type: '*ANativeWindow' - - name: output - type: '**ACaptureSessionOutput' - direction: out - returns: camera_status_t - ACaptureSessionSharedOutput_remove: - c_name: ACaptureSessionSharedOutput_remove - params: - - name: output - type: '*ACaptureSessionOutput' - - name: anw - type: '*ANativeWindow' - returns: camera_status_t -callbacks: - ACameraCaptureSession_captureCallback_bufferLost: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: request - type: '*ACaptureRequest' - c_type: ACaptureRequest* - - name: window - type: '*ANativeWindow' - c_type: ANativeWindow* - - name: frameNumber - type: int64 - c_type: int64_t - returns: "" - ACameraCaptureSession_captureCallback_failed: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: request - type: '*ACaptureRequest' - c_type: ACaptureRequest* - - name: failure - type: '*ACameraCaptureFailure' - c_type: ACameraCaptureFailure* - returns: "" - ACameraCaptureSession_captureCallback_result: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: request - type: '*ACaptureRequest' - c_type: ACaptureRequest* - - name: result - type: '*ACameraMetadata' - c_type: const ACameraMetadata* - const: true - returns: "" - ACameraCaptureSession_captureCallback_sequenceAbort: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: sequenceId - type: int32 - c_type: int - returns: "" - ACameraCaptureSession_captureCallback_sequenceEnd: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: sequenceId - type: int32 - c_type: int - - name: frameNumber - type: int64 - c_type: int64_t - returns: "" - ACameraCaptureSession_captureCallback_start: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: request - type: '*ACaptureRequest' - c_type: const ACaptureRequest* - const: true - - name: timestamp - type: int64 - c_type: int64_t - returns: "" - ACameraCaptureSession_captureCallback_startV2: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: request - type: '*ACaptureRequest' - c_type: const ACaptureRequest* - const: true - - name: timestamp - type: int64 - c_type: int64_t - - name: frameNumber - type: int64 - c_type: int64_t - returns: "" - ACameraCaptureSession_logicalCamera_captureCallback_failed: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: request - type: '*ACaptureRequest' - c_type: ACaptureRequest* - - name: failure - type: '*ALogicalCameraCaptureFailure' - c_type: ALogicalCameraCaptureFailure* - returns: "" - ACameraCaptureSession_logicalCamera_captureCallback_result: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - - name: request - type: '*ACaptureRequest' - c_type: ACaptureRequest* - - name: result - type: '*ACameraMetadata' - c_type: const ACameraMetadata* - const: true - - name: physicalResultCount - type: uint64 - c_type: size_t - - name: physicalCameraIds - type: '**int8' - c_type: const char** - const: true - - name: physicalResults - type: '**ACameraMetadata' - c_type: const ACameraMetadata** - const: true - returns: "" - ACameraCaptureSession_prepareCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: window - type: '*ANativeWindow' - c_type: ANativeWindow* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - returns: "" - ACameraCaptureSession_stateCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: session - type: '*ACameraCaptureSession' - c_type: ACameraCaptureSession* - returns: "" - ACameraDevice_ErrorStateCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: device - type: '*ACameraDevice' - c_type: ACameraDevice* - - name: _error - type: int32 - c_type: int - returns: "" - ACameraDevice_StateCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: device - type: '*ACameraDevice' - c_type: ACameraDevice* - returns: "" - ACameraManager_AccessPrioritiesChangedCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - returns: "" - ACameraManager_AvailabilityCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: cameraId - type: string - c_type: const char* - const: true - returns: "" - ACameraManager_PhysicalCameraAvailabilityCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: cameraId - type: string - c_type: const char* - const: true - - name: physicalCameraId - type: string - c_type: const char* - const: true - returns: "" -structs: - ACameraCaptureFailure: - fields: - - name: frameNumber - type: int64 - - name: reason - type: int32 - - name: sequenceId - type: int32 - - name: wasImageCaptured - type: bool - ACameraCaptureSession_captureCallbacks: - fields: - - name: context - type: unsafe.Pointer - - name: onCaptureStarted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - const: true - - name: timestamp - type: int64 - - name: onCaptureProgressed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: result - type: '*ACameraMetadata' - const: true - - name: onCaptureCompleted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: result - type: '*ACameraMetadata' - const: true - - name: onCaptureFailed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: failure - type: '*ACameraCaptureFailure' - - name: onCaptureSequenceCompleted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: sequenceId - type: int32 - - name: frameNumber - type: int64 - - name: onCaptureSequenceAborted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: sequenceId - type: int32 - - name: onCaptureBufferLost - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: window - type: '*ANativeWindow' - - name: frameNumber - type: int64 - ACameraCaptureSession_captureCallbacksV2: - fields: - - name: context - type: unsafe.Pointer - - name: onCaptureStarted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - const: true - - name: timestamp - type: int64 - - name: frameNumber - type: int64 - - name: onCaptureProgressed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: result - type: '*ACameraMetadata' - const: true - - name: onCaptureCompleted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: result - type: '*ACameraMetadata' - const: true - - name: onCaptureFailed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: failure - type: '*ACameraCaptureFailure' - - name: onCaptureSequenceCompleted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: sequenceId - type: int32 - - name: frameNumber - type: int64 - - name: onCaptureSequenceAborted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: sequenceId - type: int32 - - name: onCaptureBufferLost - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: window - type: '*ANativeWindow' - - name: frameNumber - type: int64 - ACameraCaptureSession_logicalCamera_captureCallbacks: - fields: - - name: context - type: unsafe.Pointer - - name: onCaptureStarted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - const: true - - name: timestamp - type: int64 - - name: onCaptureProgressed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: result - type: '*ACameraMetadata' - const: true - - name: onLogicalCameraCaptureCompleted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: result - type: '*ACameraMetadata' - const: true - - name: physicalResultCount - type: uint64 - - name: physicalCameraIds - type: '**int8' - const: true - - name: physicalResults - type: '**ACameraMetadata' - const: true - - name: onLogicalCameraCaptureFailed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: failure - type: '*ALogicalCameraCaptureFailure' - - name: onCaptureSequenceCompleted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: sequenceId - type: int32 - - name: frameNumber - type: int64 - - name: onCaptureSequenceAborted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: sequenceId - type: int32 - - name: onCaptureBufferLost - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: window - type: '*ANativeWindow' - - name: frameNumber - type: int64 - ACameraCaptureSession_logicalCamera_captureCallbacksV2: - fields: - - name: context - type: unsafe.Pointer - - name: onCaptureStarted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - const: true - - name: timestamp - type: int64 - - name: frameNumber - type: int64 - - name: onCaptureProgressed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: result - type: '*ACameraMetadata' - const: true - - name: onLogicalCameraCaptureCompleted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: result - type: '*ACameraMetadata' - const: true - - name: physicalResultCount - type: uint64 - - name: physicalCameraIds - type: '**int8' - const: true - - name: physicalResults - type: '**ACameraMetadata' - const: true - - name: onLogicalCameraCaptureFailed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: failure - type: '*ALogicalCameraCaptureFailure' - - name: onCaptureSequenceCompleted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: sequenceId - type: int32 - - name: frameNumber - type: int64 - - name: onCaptureSequenceAborted - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: sequenceId - type: int32 - - name: onCaptureBufferLost - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: request - type: '*ACaptureRequest' - - name: window - type: '*ANativeWindow' - - name: frameNumber - type: int64 - ACameraCaptureSession_stateCallbacks: - fields: - - name: context - type: unsafe.Pointer - - name: onClosed - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: onReady - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - - name: onActive - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: session - type: '*ACameraCaptureSession' - ACameraDevice_StateCallbacks: - fields: - - name: context - type: unsafe.Pointer - - name: onDisconnected - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: device - type: '*ACameraDevice' - - name: onError - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: device - type: '*ACameraDevice' - - name: _error - type: int32 - ACameraIdList: - fields: - - name: numCameras - type: int32 - - name: cameraIds - type: '**int8' - c_type: const char** - ACameraManager_AvailabilityListener: - fields: - - name: context - type: unsafe.Pointer - - name: onCameraAvailable - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: cameraId - type: string - const: true - - name: onCameraUnavailable - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: cameraId - type: string - const: true - ACameraManager_ExtendedAvailabilityListener: - fields: - - name: availabilityCallbacks - type: ACameraManager_AvailabilityCallbacks - - name: onCameraAccessPrioritiesChanged - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: onPhysicalCameraAvailable - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: cameraId - type: string - const: true - - name: physicalCameraId - type: string - const: true - - name: onPhysicalCameraUnavailable - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: cameraId - type: string - const: true - - name: physicalCameraId - type: string - const: true - - name: reserved - type: '[4]unsafe.Pointer' - ACameraMetadata_const_entry: - fields: - - name: tag - type: uint32 - - name: type - type: uint8 - - name: count - type: uint32 - - name: data - type: union - fields: - - name: u8 - type: '*uint8' - - name: i32 - type: '*int32' - - name: f - type: '*float32' - - name: i64 - type: '*int64' - - name: d - type: '*float64' - - name: r - type: '*ACameraMetadata_rational' - ACameraMetadata_entry: - fields: - - name: tag - type: uint32 - - name: type - type: uint8 - - name: count - type: uint32 - - name: data - type: union - fields: - - name: u8 - type: '*uint8' - - name: i32 - type: '*int32' - - name: f - type: '*float32' - - name: i64 - type: '*int64' - - name: d - type: '*float64' - - name: r - type: '*ACameraMetadata_rational' - ACameraMetadata_rational: - fields: - - name: numerator - type: int32 - - name: denominator - type: int32 - ALogicalCameraCaptureFailure: - fields: - - name: captureFailure - type: ACameraCaptureFailure - - name: physicalCameraId - type: string diff --git a/spec/generated/choreographer.yaml b/spec/generated/choreographer.yaml deleted file mode 100644 index 58527dd..0000000 --- a/spec/generated/choreographer.yaml +++ /dev/null @@ -1,175 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: choreographer -source_package: github.com/AndroidGoLab/ndk/capi/choreographer -types: - AChoreographer: - kind: opaque_ptr - c_type: AChoreographer - go_type: '*C.AChoreographer' - AChoreographerFrameCallbackData: - kind: opaque_ptr - c_type: AChoreographerFrameCallbackData - go_type: '*C.AChoreographerFrameCallbackData' - AVsyncId: - kind: typedef_int64 - c_type: AVsyncId - go_type: int64 -functions: - AChoreographer_getInstance: - c_name: AChoreographer_getInstance - returns: '*AChoreographer' - AChoreographer_postFrameCallback: - c_name: AChoreographer_postFrameCallback - params: - - name: choreographer - type: '*AChoreographer' - - name: callback - type: AChoreographer_frameCallback - - name: data - type: unsafe.Pointer - returns: "" - AChoreographer_postFrameCallback64: - c_name: AChoreographer_postFrameCallback64 - params: - - name: choreographer - type: '*AChoreographer' - - name: callback - type: AChoreographer_frameCallback64 - - name: data - type: unsafe.Pointer - returns: "" - AChoreographer_postFrameCallbackDelayed: - c_name: AChoreographer_postFrameCallbackDelayed - params: - - name: choreographer - type: '*AChoreographer' - - name: callback - type: AChoreographer_frameCallback - - name: data - type: unsafe.Pointer - - name: delayMillis - type: int64 - returns: "" - AChoreographer_postFrameCallbackDelayed64: - c_name: AChoreographer_postFrameCallbackDelayed64 - params: - - name: choreographer - type: '*AChoreographer' - - name: callback - type: AChoreographer_frameCallback64 - - name: data - type: unsafe.Pointer - - name: delayMillis - type: uint32 - returns: "" - AChoreographer_postVsyncCallback: - c_name: AChoreographer_postVsyncCallback - params: - - name: choreographer - type: '*AChoreographer' - - name: callback - type: AChoreographer_vsyncCallback - - name: data - type: unsafe.Pointer - returns: "" - AChoreographer_registerRefreshRateCallback: - c_name: AChoreographer_registerRefreshRateCallback - params: - - name: choreographer - type: '*AChoreographer' - - name: "" - type: AChoreographer_refreshRateCallback - - name: data - type: unsafe.Pointer - returns: "" - AChoreographer_unregisterRefreshRateCallback: - c_name: AChoreographer_unregisterRefreshRateCallback - params: - - name: choreographer - type: '*AChoreographer' - - name: "" - type: AChoreographer_refreshRateCallback - - name: data - type: unsafe.Pointer - returns: "" - AChoreographerFrameCallbackData_getFrameTimeNanos: - c_name: AChoreographerFrameCallbackData_getFrameTimeNanos - params: - - name: data - type: '*AChoreographerFrameCallbackData' - returns: int64 - AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos: - c_name: AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos - params: - - name: data - type: '*AChoreographerFrameCallbackData' - - name: index - type: uint64 - returns: int64 - AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos: - c_name: AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos - params: - - name: data - type: '*AChoreographerFrameCallbackData' - - name: index - type: uint64 - returns: int64 - AChoreographerFrameCallbackData_getFrameTimelineVsyncId: - c_name: AChoreographerFrameCallbackData_getFrameTimelineVsyncId - params: - - name: data - type: '*AChoreographerFrameCallbackData' - - name: index - type: uint64 - returns: AVsyncId - AChoreographerFrameCallbackData_getFrameTimelinesLength: - c_name: AChoreographerFrameCallbackData_getFrameTimelinesLength - params: - - name: data - type: '*AChoreographerFrameCallbackData' - returns: uint64 - AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex: - c_name: AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex - params: - - name: data - type: '*AChoreographerFrameCallbackData' - returns: uint64 -callbacks: - AChoreographer_frameCallback: - params: - - name: frameTimeNanos - type: int64 - c_type: long - - name: data - type: unsafe.Pointer - c_type: void* - returns: "" - AChoreographer_frameCallback64: - params: - - name: frameTimeNanos - type: int64 - c_type: int64_t - - name: data - type: unsafe.Pointer - c_type: void* - returns: "" - AChoreographer_refreshRateCallback: - params: - - name: vsyncPeriodNanos - type: int64 - c_type: int64_t - - name: data - type: unsafe.Pointer - c_type: void* - returns: "" - AChoreographer_vsyncCallback: - params: - - name: callbackData - type: '*AChoreographerFrameCallbackData' - c_type: const AChoreographerFrameCallbackData* - const: true - - name: data - type: unsafe.Pointer - c_type: void* - returns: "" diff --git a/spec/generated/configuration.yaml b/spec/generated/configuration.yaml deleted file mode 100644 index 193caba..0000000 --- a/spec/generated/configuration.yaml +++ /dev/null @@ -1,557 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: configuration -source_package: github.com/AndroidGoLab/ndk/capi/configuration -types: - AConfiguration: - kind: opaque_ptr - c_type: AConfiguration - go_type: '*C.AConfiguration' -enums: - ACONFIGURATION: - - name: ACONFIGURATION_ORIENTATION_ANY - value: 0 - - name: ACONFIGURATION_ORIENTATION_PORT - value: 1 - - name: ACONFIGURATION_ORIENTATION_LAND - value: 2 - - name: ACONFIGURATION_ORIENTATION_SQUARE - value: 3 - - name: ACONFIGURATION_TOUCHSCREEN_ANY - value: 0 - - name: ACONFIGURATION_TOUCHSCREEN_NOTOUCH - value: 1 - - name: ACONFIGURATION_TOUCHSCREEN_STYLUS - value: 2 - - name: ACONFIGURATION_TOUCHSCREEN_FINGER - value: 3 - - name: ACONFIGURATION_DENSITY_DEFAULT - value: 0 - - name: ACONFIGURATION_DENSITY_LOW - value: 120 - - name: ACONFIGURATION_DENSITY_MEDIUM - value: 160 - - name: ACONFIGURATION_DENSITY_TV - value: 213 - - name: ACONFIGURATION_DENSITY_HIGH - value: 240 - - name: ACONFIGURATION_DENSITY_XHIGH - value: 320 - - name: ACONFIGURATION_DENSITY_XXHIGH - value: 480 - - name: ACONFIGURATION_DENSITY_XXXHIGH - value: 640 - - name: ACONFIGURATION_DENSITY_ANY - value: 65534 - - name: ACONFIGURATION_DENSITY_NONE - value: 65535 - - name: ACONFIGURATION_KEYBOARD_ANY - value: 0 - - name: ACONFIGURATION_KEYBOARD_NOKEYS - value: 1 - - name: ACONFIGURATION_KEYBOARD_QWERTY - value: 2 - - name: ACONFIGURATION_KEYBOARD_12KEY - value: 3 - - name: ACONFIGURATION_NAVIGATION_ANY - value: 0 - - name: ACONFIGURATION_NAVIGATION_NONAV - value: 1 - - name: ACONFIGURATION_NAVIGATION_DPAD - value: 2 - - name: ACONFIGURATION_NAVIGATION_TRACKBALL - value: 3 - - name: ACONFIGURATION_NAVIGATION_WHEEL - value: 4 - - name: ACONFIGURATION_KEYSHIDDEN_ANY - value: 0 - - name: ACONFIGURATION_KEYSHIDDEN_NO - value: 1 - - name: ACONFIGURATION_KEYSHIDDEN_YES - value: 2 - - name: ACONFIGURATION_KEYSHIDDEN_SOFT - value: 3 - - name: ACONFIGURATION_NAVHIDDEN_ANY - value: 0 - - name: ACONFIGURATION_NAVHIDDEN_NO - value: 1 - - name: ACONFIGURATION_NAVHIDDEN_YES - value: 2 - - name: ACONFIGURATION_SCREENSIZE_ANY - value: 0 - - name: ACONFIGURATION_SCREENSIZE_SMALL - value: 1 - - name: ACONFIGURATION_SCREENSIZE_NORMAL - value: 2 - - name: ACONFIGURATION_SCREENSIZE_LARGE - value: 3 - - name: ACONFIGURATION_SCREENSIZE_XLARGE - value: 4 - - name: ACONFIGURATION_SCREENLONG_ANY - value: 0 - - name: ACONFIGURATION_SCREENLONG_NO - value: 1 - - name: ACONFIGURATION_SCREENLONG_YES - value: 2 - - name: ACONFIGURATION_SCREENROUND_ANY - value: 0 - - name: ACONFIGURATION_SCREENROUND_NO - value: 1 - - name: ACONFIGURATION_SCREENROUND_YES - value: 2 - - name: ACONFIGURATION_WIDE_COLOR_GAMUT_ANY - value: 0 - - name: ACONFIGURATION_WIDE_COLOR_GAMUT_NO - value: 1 - - name: ACONFIGURATION_WIDE_COLOR_GAMUT_YES - value: 2 - - name: ACONFIGURATION_HDR_ANY - value: 0 - - name: ACONFIGURATION_HDR_NO - value: 1 - - name: ACONFIGURATION_HDR_YES - value: 2 - - name: ACONFIGURATION_UI_MODE_TYPE_ANY - value: 0 - - name: ACONFIGURATION_UI_MODE_TYPE_NORMAL - value: 1 - - name: ACONFIGURATION_UI_MODE_TYPE_DESK - value: 2 - - name: ACONFIGURATION_UI_MODE_TYPE_CAR - value: 3 - - name: ACONFIGURATION_UI_MODE_TYPE_TELEVISION - value: 4 - - name: ACONFIGURATION_UI_MODE_TYPE_APPLIANCE - value: 5 - - name: ACONFIGURATION_UI_MODE_TYPE_WATCH - value: 6 - - name: ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET - value: 7 - - name: ACONFIGURATION_UI_MODE_NIGHT_ANY - value: 0 - - name: ACONFIGURATION_UI_MODE_NIGHT_NO - value: 1 - - name: ACONFIGURATION_UI_MODE_NIGHT_YES - value: 2 - - name: ACONFIGURATION_SCREEN_WIDTH_DP_ANY - value: 0 - - name: ACONFIGURATION_SCREEN_HEIGHT_DP_ANY - value: 0 - - name: ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY - value: 0 - - name: ACONFIGURATION_LAYOUTDIR_ANY - value: 0 - - name: ACONFIGURATION_LAYOUTDIR_LTR - value: 1 - - name: ACONFIGURATION_LAYOUTDIR_RTL - value: 2 - - name: ACONFIGURATION_MCC - value: 1 - - name: ACONFIGURATION_MNC - value: 2 - - name: ACONFIGURATION_LOCALE - value: 4 - - name: ACONFIGURATION_TOUCHSCREEN - value: 8 - - name: ACONFIGURATION_KEYBOARD - value: 16 - - name: ACONFIGURATION_KEYBOARD_HIDDEN - value: 32 - - name: ACONFIGURATION_NAVIGATION - value: 64 - - name: ACONFIGURATION_ORIENTATION - value: 128 - - name: ACONFIGURATION_DENSITY - value: 256 - - name: ACONFIGURATION_SCREEN_SIZE - value: 512 - - name: ACONFIGURATION_VERSION - value: 1024 - - name: ACONFIGURATION_SCREEN_LAYOUT - value: 2048 - - name: ACONFIGURATION_UI_MODE - value: 4096 - - name: ACONFIGURATION_SMALLEST_SCREEN_SIZE - value: 8192 - - name: ACONFIGURATION_LAYOUTDIR - value: 16384 - - name: ACONFIGURATION_SCREEN_ROUND - value: 32768 - - name: ACONFIGURATION_COLOR_MODE - value: 65536 - - name: ACONFIGURATION_GRAMMATICAL_GENDER - value: 131072 - - name: ACONFIGURATION_MNC_ZERO - value: 65535 - - name: ACONFIGURATION_GRAMMATICAL_GENDER_ANY - value: 0 - - name: ACONFIGURATION_GRAMMATICAL_GENDER_NEUTER - value: 1 - - name: ACONFIGURATION_GRAMMATICAL_GENDER_FEMININE - value: 2 - - name: ACONFIGURATION_GRAMMATICAL_GENDER_MASCULINE - value: 3 -functions: - AConfiguration_copy: - c_name: AConfiguration_copy - params: - - name: dest - type: '*AConfiguration' - - name: src - type: '*AConfiguration' - returns: "" - AConfiguration_delete: - c_name: AConfiguration_delete - params: - - name: config - type: '*AConfiguration' - returns: "" - AConfiguration_diff: - c_name: AConfiguration_diff - params: - - name: config1 - type: '*AConfiguration' - - name: config2 - type: '*AConfiguration' - returns: int32 - AConfiguration_fromAssetManager: - c_name: AConfiguration_fromAssetManager - params: - - name: out - type: '*AConfiguration' - - name: am - type: '*AAssetManager' - returns: "" - AConfiguration_getCountry: - c_name: AConfiguration_getCountry - params: - - name: config - type: '*AConfiguration' - - name: outCountry - type: string - returns: "" - AConfiguration_getDensity: - c_name: AConfiguration_getDensity - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getGrammaticalGender: - c_name: AConfiguration_getGrammaticalGender - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getKeyboard: - c_name: AConfiguration_getKeyboard - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getKeysHidden: - c_name: AConfiguration_getKeysHidden - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getLanguage: - c_name: AConfiguration_getLanguage - params: - - name: config - type: '*AConfiguration' - - name: outLanguage - type: string - returns: "" - AConfiguration_getLayoutDirection: - c_name: AConfiguration_getLayoutDirection - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getMcc: - c_name: AConfiguration_getMcc - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getMnc: - c_name: AConfiguration_getMnc - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getNavHidden: - c_name: AConfiguration_getNavHidden - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getNavigation: - c_name: AConfiguration_getNavigation - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getOrientation: - c_name: AConfiguration_getOrientation - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getScreenHeightDp: - c_name: AConfiguration_getScreenHeightDp - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getScreenLong: - c_name: AConfiguration_getScreenLong - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getScreenRound: - c_name: AConfiguration_getScreenRound - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getScreenSize: - c_name: AConfiguration_getScreenSize - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getScreenWidthDp: - c_name: AConfiguration_getScreenWidthDp - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getSdkVersion: - c_name: AConfiguration_getSdkVersion - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getSmallestScreenWidthDp: - c_name: AConfiguration_getSmallestScreenWidthDp - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getTouchscreen: - c_name: AConfiguration_getTouchscreen - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getUiModeNight: - c_name: AConfiguration_getUiModeNight - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_getUiModeType: - c_name: AConfiguration_getUiModeType - params: - - name: config - type: '*AConfiguration' - returns: int32 - AConfiguration_isBetterThan: - c_name: AConfiguration_isBetterThan - params: - - name: base - type: '*AConfiguration' - - name: test - type: '*AConfiguration' - - name: requested - type: '*AConfiguration' - returns: int32 - AConfiguration_match: - c_name: AConfiguration_match - params: - - name: base - type: '*AConfiguration' - - name: requested - type: '*AConfiguration' - returns: int32 - AConfiguration_new: - c_name: AConfiguration_new - returns: '*AConfiguration' - AConfiguration_setCountry: - c_name: AConfiguration_setCountry - params: - - name: config - type: '*AConfiguration' - - name: country - type: string - returns: "" - AConfiguration_setDensity: - c_name: AConfiguration_setDensity - params: - - name: config - type: '*AConfiguration' - - name: density - type: int32 - returns: "" - AConfiguration_setGrammaticalGender: - c_name: AConfiguration_setGrammaticalGender - params: - - name: config - type: '*AConfiguration' - - name: value - type: int32 - returns: "" - AConfiguration_setKeyboard: - c_name: AConfiguration_setKeyboard - params: - - name: config - type: '*AConfiguration' - - name: keyboard - type: int32 - returns: "" - AConfiguration_setKeysHidden: - c_name: AConfiguration_setKeysHidden - params: - - name: config - type: '*AConfiguration' - - name: keysHidden - type: int32 - returns: "" - AConfiguration_setLanguage: - c_name: AConfiguration_setLanguage - params: - - name: config - type: '*AConfiguration' - - name: language - type: string - returns: "" - AConfiguration_setLayoutDirection: - c_name: AConfiguration_setLayoutDirection - params: - - name: config - type: '*AConfiguration' - - name: value - type: int32 - returns: "" - AConfiguration_setMcc: - c_name: AConfiguration_setMcc - params: - - name: config - type: '*AConfiguration' - - name: mcc - type: int32 - returns: "" - AConfiguration_setMnc: - c_name: AConfiguration_setMnc - params: - - name: config - type: '*AConfiguration' - - name: mnc - type: int32 - returns: "" - AConfiguration_setNavHidden: - c_name: AConfiguration_setNavHidden - params: - - name: config - type: '*AConfiguration' - - name: navHidden - type: int32 - returns: "" - AConfiguration_setNavigation: - c_name: AConfiguration_setNavigation - params: - - name: config - type: '*AConfiguration' - - name: navigation - type: int32 - returns: "" - AConfiguration_setOrientation: - c_name: AConfiguration_setOrientation - params: - - name: config - type: '*AConfiguration' - - name: orientation - type: int32 - returns: "" - AConfiguration_setScreenHeightDp: - c_name: AConfiguration_setScreenHeightDp - params: - - name: config - type: '*AConfiguration' - - name: value - type: int32 - returns: "" - AConfiguration_setScreenLong: - c_name: AConfiguration_setScreenLong - params: - - name: config - type: '*AConfiguration' - - name: screenLong - type: int32 - returns: "" - AConfiguration_setScreenRound: - c_name: AConfiguration_setScreenRound - params: - - name: config - type: '*AConfiguration' - - name: screenRound - type: int32 - returns: "" - AConfiguration_setScreenSize: - c_name: AConfiguration_setScreenSize - params: - - name: config - type: '*AConfiguration' - - name: screenSize - type: int32 - returns: "" - AConfiguration_setScreenWidthDp: - c_name: AConfiguration_setScreenWidthDp - params: - - name: config - type: '*AConfiguration' - - name: value - type: int32 - returns: "" - AConfiguration_setSdkVersion: - c_name: AConfiguration_setSdkVersion - params: - - name: config - type: '*AConfiguration' - - name: sdkVersion - type: int32 - returns: "" - AConfiguration_setSmallestScreenWidthDp: - c_name: AConfiguration_setSmallestScreenWidthDp - params: - - name: config - type: '*AConfiguration' - - name: value - type: int32 - returns: "" - AConfiguration_setTouchscreen: - c_name: AConfiguration_setTouchscreen - params: - - name: config - type: '*AConfiguration' - - name: touchscreen - type: int32 - returns: "" - AConfiguration_setUiModeNight: - c_name: AConfiguration_setUiModeNight - params: - - name: config - type: '*AConfiguration' - - name: uiModeNight - type: int32 - returns: "" - AConfiguration_setUiModeType: - c_name: AConfiguration_setUiModeType - params: - - name: config - type: '*AConfiguration' - - name: uiModeType - type: int32 - returns: "" diff --git a/spec/generated/egl.yaml b/spec/generated/egl.yaml deleted file mode 100644 index ad5b3b6..0000000 --- a/spec/generated/egl.yaml +++ /dev/null @@ -1,862 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: egl -source_package: github.com/AndroidGoLab/ndk/capi/egl -types: - ANativeWindow: - kind: opaque_ptr - c_type: ANativeWindow - go_type: '*C.ANativeWindow' - ANativeWindow_Buffer: - kind: opaque_ptr - c_type: ANativeWindow_Buffer - go_type: '*C.ANativeWindow_Buffer' - EGLAttrib: - kind: typedef_int64 - c_type: EGLAttrib - go_type: int64 - EGLBoolean: - kind: typedef_uint32 - c_type: EGLBoolean - go_type: uint32 - EGLClientBuffer: - kind: pointer_handle - c_type: EGLClientBuffer - go_type: unsafe.Pointer - EGLConfig: - kind: pointer_handle - c_type: EGLConfig - go_type: unsafe.Pointer - EGLContext: - kind: pointer_handle - c_type: EGLContext - go_type: unsafe.Pointer - EGLDisplay: - kind: pointer_handle - c_type: EGLDisplay - go_type: unsafe.Pointer - EGLImage: - kind: pointer_handle - c_type: EGLImage - go_type: unsafe.Pointer - EGLSurface: - kind: pointer_handle - c_type: EGLSurface - go_type: unsafe.Pointer - EGLSync: - kind: pointer_handle - c_type: EGLSync - go_type: unsafe.Pointer - EGLTime: - kind: typedef_khronos_utime_nanoseconds_t - c_type: EGLTime - go_type: khronos_utime_nanoseconds_t - EGLenum: - kind: typedef_uint32 - c_type: EGLenum - go_type: uint32 -enums: - ANativeWindow_ChangeFrameRateStrategy: - - name: ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS - value: 0 - - name: ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS - value: 1 - ANativeWindow_FrameRateCompatibility: - - name: ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT - value: 0 - - name: ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE - value: 1 - ANativeWindow_LegacyFormat: - - name: WINDOW_FORMAT_RGBA_8888 - value: 1 - - name: WINDOW_FORMAT_RGBX_8888 - value: 2 - - name: WINDOW_FORMAT_RGB_565 - value: 4 - ANativeWindowTransform: - - name: ANATIVEWINDOW_TRANSFORM_IDENTITY - value: 0 - - name: ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL - value: 1 - - name: ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL - value: 2 - - name: ANATIVEWINDOW_TRANSFORM_ROTATE_90 - value: 4 - - name: ANATIVEWINDOW_TRANSFORM_ROTATE_180 - value: 3 - - name: ANATIVEWINDOW_TRANSFORM_ROTATE_270 - value: 7 -functions: - ANativeWindow_acquire: - c_name: ANativeWindow_acquire - params: - - name: window - type: '*ANativeWindow' - returns: "" - ANativeWindow_clearFrameRate: - c_name: ANativeWindow_clearFrameRate - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getBuffersDataSpace: - c_name: ANativeWindow_getBuffersDataSpace - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getBuffersDefaultDataSpace: - c_name: ANativeWindow_getBuffersDefaultDataSpace - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getFormat: - c_name: ANativeWindow_getFormat - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getHeight: - c_name: ANativeWindow_getHeight - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getWidth: - c_name: ANativeWindow_getWidth - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_lock: - c_name: ANativeWindow_lock - params: - - name: window - type: '*ANativeWindow' - - name: outBuffer - type: '*ANativeWindow_Buffer' - - name: inOutDirtyBounds - type: '*ARect' - returns: int32 - ANativeWindow_release: - c_name: ANativeWindow_release - params: - - name: window - type: '*ANativeWindow' - returns: "" - ANativeWindow_setBuffersDataSpace: - c_name: ANativeWindow_setBuffersDataSpace - params: - - name: window - type: '*ANativeWindow' - - name: dataSpace - type: int32 - returns: int32 - ANativeWindow_setBuffersGeometry: - c_name: ANativeWindow_setBuffersGeometry - params: - - name: window - type: '*ANativeWindow' - - name: width - type: int32 - - name: height - type: int32 - - name: format - type: int32 - returns: int32 - ANativeWindow_setBuffersTransform: - c_name: ANativeWindow_setBuffersTransform - params: - - name: window - type: '*ANativeWindow' - - name: transform - type: int32 - returns: int32 - ANativeWindow_setFrameRate: - c_name: ANativeWindow_setFrameRate - params: - - name: window - type: '*ANativeWindow' - - name: frameRate - type: float32 - - name: compatibility - type: int8 - returns: int32 - ANativeWindow_setFrameRateWithChangeStrategy: - c_name: ANativeWindow_setFrameRateWithChangeStrategy - params: - - name: window - type: '*ANativeWindow' - - name: frameRate - type: float32 - - name: compatibility - type: int8 - - name: changeFrameRateStrategy - type: int8 - returns: int32 - ANativeWindow_tryAllocateBuffers: - c_name: ANativeWindow_tryAllocateBuffers - params: - - name: window - type: '*ANativeWindow' - returns: "" - ANativeWindow_unlockAndPost: - c_name: ANativeWindow_unlockAndPost - params: - - name: window - type: '*ANativeWindow' - returns: int32 - eglBindAPI: - c_name: eglBindAPI - params: - - name: api - type: EGLenum - returns: EGLBoolean - eglBindTexImage: - c_name: eglBindTexImage - params: - - name: dpy - type: EGLDisplay - - name: surface - type: EGLSurface - - name: buffer - type: EGLint - returns: EGLBoolean - eglChooseConfig: - c_name: eglChooseConfig - params: - - name: dpy - type: EGLDisplay - - name: attrib_list - type: '*EGLint' - - name: configs - type: '*EGLConfig' - - name: config_size - type: EGLint - - name: num_config - type: '*EGLint' - returns: EGLBoolean - eglClientWaitSync: - c_name: eglClientWaitSync - params: - - name: dpy - type: EGLDisplay - - name: sync - type: EGLSync - - name: flags - type: EGLint - - name: timeout - type: EGLTime - returns: EGLint - eglCopyBuffers: - c_name: eglCopyBuffers - params: - - name: dpy - type: EGLDisplay - - name: surface - type: EGLSurface - - name: target - type: EGLNativePixmapType - returns: EGLBoolean - eglCreateContext: - c_name: eglCreateContext - params: - - name: dpy - type: EGLDisplay - - name: config - type: EGLConfig - - name: share_context - type: EGLContext - - name: attrib_list - type: '*EGLint' - returns: EGLContext - eglCreateImage: - c_name: eglCreateImage - params: - - name: dpy - type: EGLDisplay - - name: ctx - type: EGLContext - - name: target - type: EGLenum - - name: buffer - type: EGLClientBuffer - - name: attrib_list - type: '*EGLAttrib' - returns: EGLImage - eglCreatePbufferFromClientBuffer: - c_name: eglCreatePbufferFromClientBuffer - params: - - name: dpy - type: EGLDisplay - - name: buftype - type: EGLenum - - name: buffer - type: EGLClientBuffer - - name: config - type: EGLConfig - - name: attrib_list - type: '*EGLint' - returns: EGLSurface - eglCreatePbufferSurface: - c_name: eglCreatePbufferSurface - params: - - name: dpy - type: EGLDisplay - - name: config - type: EGLConfig - - name: attrib_list - type: '*EGLint' - returns: EGLSurface - eglCreatePixmapSurface: - c_name: eglCreatePixmapSurface - params: - - name: dpy - type: EGLDisplay - - name: config - type: EGLConfig - - name: pixmap - type: EGLNativePixmapType - - name: attrib_list - type: '*EGLint' - returns: EGLSurface - eglCreatePlatformPixmapSurface: - c_name: eglCreatePlatformPixmapSurface - params: - - name: dpy - type: EGLDisplay - - name: config - type: EGLConfig - - name: native_pixmap - type: unsafe.Pointer - - name: attrib_list - type: '*EGLAttrib' - returns: EGLSurface - eglCreatePlatformWindowSurface: - c_name: eglCreatePlatformWindowSurface - params: - - name: dpy - type: EGLDisplay - - name: config - type: EGLConfig - - name: native_window - type: unsafe.Pointer - - name: attrib_list - type: '*EGLAttrib' - returns: EGLSurface - eglCreateSync: - c_name: eglCreateSync - params: - - name: dpy - type: EGLDisplay - - name: type - type: EGLenum - - name: attrib_list - type: '*EGLAttrib' - returns: EGLSync - eglCreateWindowSurface: - c_name: eglCreateWindowSurface - params: - - name: dpy - type: EGLDisplay - - name: config - type: EGLConfig - - name: win - type: EGLNativeWindowType - - name: attrib_list - type: '*EGLint' - returns: EGLSurface - eglDestroyContext: - c_name: eglDestroyContext - params: - - name: dpy - type: EGLDisplay - - name: ctx - type: EGLContext - returns: EGLBoolean - eglDestroyImage: - c_name: eglDestroyImage - params: - - name: dpy - type: EGLDisplay - - name: image - type: EGLImage - returns: EGLBoolean - eglDestroySurface: - c_name: eglDestroySurface - params: - - name: dpy - type: EGLDisplay - - name: surface - type: EGLSurface - returns: EGLBoolean - eglDestroySync: - c_name: eglDestroySync - params: - - name: dpy - type: EGLDisplay - - name: sync - type: EGLSync - returns: EGLBoolean - eglGetConfigAttrib: - c_name: eglGetConfigAttrib - params: - - name: dpy - type: EGLDisplay - - name: config - type: EGLConfig - - name: attribute - type: EGLint - - name: value - type: '*EGLint' - returns: EGLBoolean - eglGetConfigs: - c_name: eglGetConfigs - params: - - name: dpy - type: EGLDisplay - - name: configs - type: '*EGLConfig' - - name: config_size - type: EGLint - - name: num_config - type: '*EGLint' - returns: EGLBoolean - eglGetCurrentContext: - c_name: eglGetCurrentContext - returns: EGLContext - eglGetCurrentDisplay: - c_name: eglGetCurrentDisplay - returns: EGLDisplay - eglGetCurrentSurface: - c_name: eglGetCurrentSurface - params: - - name: readdraw - type: EGLint - returns: EGLSurface - eglGetDisplay: - c_name: eglGetDisplay - params: - - name: display_id - type: EGLNativeDisplayType - returns: EGLDisplay - eglGetError: - c_name: eglGetError - returns: EGLint - eglGetPlatformDisplay: - c_name: eglGetPlatformDisplay - params: - - name: platform - type: EGLenum - - name: native_display - type: unsafe.Pointer - - name: attrib_list - type: '*EGLAttrib' - returns: EGLDisplay - eglGetProcAddress: - c_name: eglGetProcAddress - params: - - name: procname - type: string - returns: __eglMustCastToProperFunctionPointerType - eglGetSyncAttrib: - c_name: eglGetSyncAttrib - params: - - name: dpy - type: EGLDisplay - - name: sync - type: EGLSync - - name: attribute - type: EGLint - - name: value - type: '*EGLAttrib' - returns: EGLBoolean - eglInitialize: - c_name: eglInitialize - params: - - name: dpy - type: EGLDisplay - - name: major - type: '*EGLint' - - name: minor - type: '*EGLint' - returns: EGLBoolean - eglMakeCurrent: - c_name: eglMakeCurrent - params: - - name: dpy - type: EGLDisplay - - name: draw - type: EGLSurface - - name: read - type: EGLSurface - - name: ctx - type: EGLContext - returns: EGLBoolean - eglQueryAPI: - c_name: eglQueryAPI - returns: EGLenum - eglQueryContext: - c_name: eglQueryContext - params: - - name: dpy - type: EGLDisplay - - name: ctx - type: EGLContext - - name: attribute - type: EGLint - - name: value - type: '*EGLint' - returns: EGLBoolean - eglQueryString: - c_name: eglQueryString - params: - - name: dpy - type: EGLDisplay - - name: name - type: EGLint - returns: string - eglQuerySurface: - c_name: eglQuerySurface - params: - - name: dpy - type: EGLDisplay - - name: surface - type: EGLSurface - - name: attribute - type: EGLint - - name: value - type: '*EGLint' - returns: EGLBoolean - eglReleaseTexImage: - c_name: eglReleaseTexImage - params: - - name: dpy - type: EGLDisplay - - name: surface - type: EGLSurface - - name: buffer - type: EGLint - returns: EGLBoolean - eglReleaseThread: - c_name: eglReleaseThread - returns: EGLBoolean - eglSurfaceAttrib: - c_name: eglSurfaceAttrib - params: - - name: dpy - type: EGLDisplay - - name: surface - type: EGLSurface - - name: attribute - type: EGLint - - name: value - type: EGLint - returns: EGLBoolean - eglSwapBuffers: - c_name: eglSwapBuffers - params: - - name: dpy - type: EGLDisplay - - name: surface - type: EGLSurface - returns: EGLBoolean - eglSwapInterval: - c_name: eglSwapInterval - params: - - name: dpy - type: EGLDisplay - - name: interval - type: EGLint - returns: EGLBoolean - eglTerminate: - c_name: eglTerminate - params: - - name: dpy - type: EGLDisplay - returns: EGLBoolean - eglWaitClient: - c_name: eglWaitClient - returns: EGLBoolean - eglWaitGL: - c_name: eglWaitGL - returns: EGLBoolean - eglWaitNative: - c_name: eglWaitNative - params: - - name: engine - type: EGLint - returns: EGLBoolean - eglWaitSync: - c_name: eglWaitSync - params: - - name: dpy - type: EGLDisplay - - name: sync - type: EGLSync - - name: flags - type: EGLint - returns: EGLBoolean -callbacks: - __eglMustCastToProperFunctionPointerType: - returns: "" - PFNEGLBINDAPIPROC: - returns: "" - PFNEGLBINDTEXIMAGEPROC: - returns: "" - PFNEGLCHOOSECONFIGPROC: - returns: "" - PFNEGLCLIENTWAITSYNCPROC: - returns: "" - PFNEGLCOPYBUFFERSPROC: - returns: "" - PFNEGLCREATECONTEXTPROC: - returns: "" - PFNEGLCREATEIMAGEPROC: - returns: "" - PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC: - returns: "" - PFNEGLCREATEPBUFFERSURFACEPROC: - returns: "" - PFNEGLCREATEPIXMAPSURFACEPROC: - returns: "" - PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC: - returns: "" - PFNEGLCREATEPLATFORMWINDOWSURFACEPROC: - returns: "" - PFNEGLCREATESYNCPROC: - returns: "" - PFNEGLCREATEWINDOWSURFACEPROC: - returns: "" - PFNEGLDESTROYCONTEXTPROC: - returns: "" - PFNEGLDESTROYIMAGEPROC: - returns: "" - PFNEGLDESTROYSURFACEPROC: - returns: "" - PFNEGLDESTROYSYNCPROC: - returns: "" - PFNEGLGETCONFIGATTRIBPROC: - returns: "" - PFNEGLGETCONFIGSPROC: - returns: "" - PFNEGLGETCURRENTCONTEXTPROC: - returns: "" - PFNEGLGETCURRENTDISPLAYPROC: - returns: "" - PFNEGLGETCURRENTSURFACEPROC: - returns: "" - PFNEGLGETDISPLAYPROC: - returns: "" - PFNEGLGETERRORPROC: - returns: "" - PFNEGLGETPLATFORMDISPLAYPROC: - returns: "" - PFNEGLGETPROCADDRESSPROC: - returns: "" - PFNEGLGETSYNCATTRIBPROC: - returns: "" - PFNEGLINITIALIZEPROC: - returns: "" - PFNEGLMAKECURRENTPROC: - returns: "" - PFNEGLQUERYAPIPROC: - returns: "" - PFNEGLQUERYCONTEXTPROC: - returns: "" - PFNEGLQUERYSTRINGPROC: - returns: "" - PFNEGLQUERYSURFACEPROC: - returns: "" - PFNEGLRELEASETEXIMAGEPROC: - returns: "" - PFNEGLRELEASETHREADPROC: - returns: "" - PFNEGLSURFACEATTRIBPROC: - returns: "" - PFNEGLSWAPBUFFERSPROC: - returns: "" - PFNEGLSWAPINTERVALPROC: - returns: "" - PFNEGLTERMINATEPROC: - returns: "" - PFNEGLWAITCLIENTPROC: - returns: "" - PFNEGLWAITGLPROC: - returns: "" - PFNEGLWAITNATIVEPROC: - returns: "" - PFNEGLWAITSYNCPROC: - returns: "" -structs: - ANativeWindow_Buffer: - fields: - - name: width - type: int32 - - name: height - type: int32 - - name: stride - type: int32 - - name: format - type: int32 - - name: bits - type: unsafe.Pointer - - name: reserved - type: '[6]uint32' -macros: - EGL_ALPHA_FORMAT: 12424 - EGL_ALPHA_FORMAT_NONPRE: 12427 - EGL_ALPHA_FORMAT_PRE: 12428 - EGL_ALPHA_MASK_SIZE: 12350 - EGL_ALPHA_SIZE: 12321 - EGL_BACK_BUFFER: 12420 - EGL_BAD_ACCESS: 12290 - EGL_BAD_ALLOC: 12291 - EGL_BAD_ATTRIBUTE: 12292 - EGL_BAD_CONFIG: 12293 - EGL_BAD_CONTEXT: 12294 - EGL_BAD_CURRENT_SURFACE: 12295 - EGL_BAD_DISPLAY: 12296 - EGL_BAD_MATCH: 12297 - EGL_BAD_NATIVE_PIXMAP: 12298 - EGL_BAD_NATIVE_WINDOW: 12299 - EGL_BAD_PARAMETER: 12300 - EGL_BAD_SURFACE: 12301 - EGL_BIND_TO_TEXTURE_RGB: 12345 - EGL_BIND_TO_TEXTURE_RGBA: 12346 - EGL_BLUE_SIZE: 12322 - EGL_BUFFER_DESTROYED: 12437 - EGL_BUFFER_PRESERVED: 12436 - EGL_BUFFER_SIZE: 12320 - EGL_CL_EVENT_HANDLE: 12444 - EGL_CLIENT_APIS: 12429 - EGL_COLOR_BUFFER_TYPE: 12351 - EGL_COLORSPACE: 12423 - EGL_COLORSPACE_LINEAR: 12426 - EGL_CONDITION_SATISFIED: 12534 - EGL_CONFIG_CAVEAT: 12327 - EGL_CONFIG_ID: 12328 - EGL_CONFORMANT: 12354 - EGL_CONTEXT_CLIENT_TYPE: 12439 - EGL_CONTEXT_CLIENT_VERSION: 12440 - EGL_CONTEXT_LOST: 12302 - EGL_CONTEXT_MAJOR_VERSION: 12440 - EGL_CONTEXT_MINOR_VERSION: 12539 - EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT: 2 - EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT: 1 - EGL_CONTEXT_OPENGL_DEBUG: 12720 - EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE: 12721 - EGL_CONTEXT_OPENGL_PROFILE_MASK: 12541 - EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY: 12733 - EGL_CONTEXT_OPENGL_ROBUST_ACCESS: 12722 - EGL_CORE_NATIVE_ENGINE: 12379 - EGL_DEPTH_SIZE: 12325 - EGL_DISPLAY_SCALING: 10000 - EGL_DRAW: 12377 - EGL_EXTENSIONS: 12373 - EGL_FALSE: 0 - EGL_FOREVER: -1 - EGL_GL_COLORSPACE: 12445 - EGL_GL_COLORSPACE_LINEAR: 12426 - EGL_GL_COLORSPACE_SRGB: 12425 - EGL_GL_RENDERBUFFER: 12473 - EGL_GL_TEXTURE_2D: 12465 - EGL_GL_TEXTURE_3D: 12466 - EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 12468 - EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 12470 - EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 12472 - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X: 12467 - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 12469 - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 12471 - EGL_GL_TEXTURE_LEVEL: 12476 - EGL_GL_TEXTURE_ZOFFSET: 12477 - EGL_GREEN_SIZE: 12323 - EGL_HEIGHT: 12374 - EGL_HORIZONTAL_RESOLUTION: 12432 - EGL_IMAGE_PRESERVED: 12498 - EGL_LARGEST_PBUFFER: 12376 - EGL_LEVEL: 12329 - EGL_LOSE_CONTEXT_ON_RESET: 12735 - EGL_LUMINANCE_BUFFER: 12431 - EGL_LUMINANCE_SIZE: 12349 - EGL_MATCH_NATIVE_PIXMAP: 12353 - EGL_MAX_PBUFFER_HEIGHT: 12330 - EGL_MAX_PBUFFER_PIXELS: 12331 - EGL_MAX_PBUFFER_WIDTH: 12332 - EGL_MAX_SWAP_INTERVAL: 12348 - EGL_MIN_SWAP_INTERVAL: 12347 - EGL_MIPMAP_LEVEL: 12419 - EGL_MIPMAP_TEXTURE: 12418 - EGL_MULTISAMPLE_RESOLVE: 12441 - EGL_MULTISAMPLE_RESOLVE_BOX: 12443 - EGL_MULTISAMPLE_RESOLVE_BOX_BIT: 512 - EGL_MULTISAMPLE_RESOLVE_DEFAULT: 12442 - EGL_NATIVE_RENDERABLE: 12333 - EGL_NATIVE_VISUAL_ID: 12334 - EGL_NATIVE_VISUAL_TYPE: 12335 - EGL_NO_RESET_NOTIFICATION: 12734 - EGL_NO_TEXTURE: 12380 - EGL_NON_CONFORMANT_CONFIG: 12369 - EGL_NONE: 12344 - EGL_NOT_INITIALIZED: 12289 - EGL_OPENGL_API: 12450 - EGL_OPENGL_BIT: 8 - EGL_OPENGL_ES_API: 12448 - EGL_OPENGL_ES_BIT: 1 - EGL_OPENGL_ES2_BIT: 4 - EGL_OPENGL_ES3_BIT: 64 - EGL_OPENVG_API: 12449 - EGL_OPENVG_BIT: 2 - EGL_OPENVG_IMAGE: 12438 - EGL_PBUFFER_BIT: 1 - EGL_PIXEL_ASPECT_RATIO: 12434 - EGL_PIXMAP_BIT: 2 - EGL_READ: 12378 - EGL_RED_SIZE: 12324 - EGL_RENDER_BUFFER: 12422 - EGL_RENDERABLE_TYPE: 12352 - EGL_RGB_BUFFER: 12430 - EGL_SAMPLE_BUFFERS: 12338 - EGL_SAMPLES: 12337 - EGL_SIGNALED: 12530 - EGL_SINGLE_BUFFER: 12421 - EGL_SLOW_CONFIG: 12368 - EGL_STENCIL_SIZE: 12326 - EGL_SUCCESS: 12288 - EGL_SURFACE_TYPE: 12339 - EGL_SWAP_BEHAVIOR: 12435 - EGL_SWAP_BEHAVIOR_PRESERVED_BIT: 1024 - EGL_SYNC_CL_EVENT: 12542 - EGL_SYNC_CL_EVENT_COMPLETE: 12543 - EGL_SYNC_CONDITION: 12536 - EGL_SYNC_FENCE: 12537 - EGL_SYNC_FLUSH_COMMANDS_BIT: 1 - EGL_SYNC_PRIOR_COMMANDS_COMPLETE: 12528 - EGL_SYNC_STATUS: 12529 - EGL_SYNC_TYPE: 12535 - EGL_TEXTURE_2D: 12383 - EGL_TEXTURE_FORMAT: 12416 - EGL_TEXTURE_RGB: 12381 - EGL_TEXTURE_RGBA: 12382 - EGL_TEXTURE_TARGET: 12417 - EGL_TIMEOUT_EXPIRED: 12533 - EGL_TRANSPARENT_BLUE_VALUE: 12341 - EGL_TRANSPARENT_GREEN_VALUE: 12342 - EGL_TRANSPARENT_RED_VALUE: 12343 - EGL_TRANSPARENT_RGB: 12370 - EGL_TRANSPARENT_TYPE: 12340 - EGL_TRUE: 1 - EGL_UNSIGNALED: 12531 - EGL_VENDOR: 12371 - EGL_VERSION: 12372 - EGL_VERTICAL_RESOLUTION: 12433 - EGL_VG_ALPHA_FORMAT: 12424 - EGL_VG_ALPHA_FORMAT_NONPRE: 12427 - EGL_VG_ALPHA_FORMAT_PRE: 12428 - EGL_VG_ALPHA_FORMAT_PRE_BIT: 64 - EGL_VG_COLORSPACE: 12423 - EGL_VG_COLORSPACE_LINEAR: 12426 - EGL_VG_COLORSPACE_LINEAR_BIT: 32 - EGL_WIDTH: 12375 - EGL_WINDOW_BIT: 4 diff --git a/spec/generated/font.yaml b/spec/generated/font.yaml deleted file mode 100644 index c5dbaec..0000000 --- a/spec/generated/font.yaml +++ /dev/null @@ -1,171 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: font -source_package: github.com/AndroidGoLab/ndk/capi/font -types: - AFont: - kind: opaque_ptr - c_type: AFont - go_type: '*C.AFont' - AFontMatcher: - kind: opaque_ptr - c_type: AFontMatcher - go_type: '*C.AFontMatcher' - ASystemFontIterator: - kind: opaque_ptr - c_type: ASystemFontIterator - go_type: '*C.ASystemFontIterator' -enums: - AFAMILY_VARIANT: - - name: AFAMILY_VARIANT_DEFAULT - value: 0 - - name: AFAMILY_VARIANT_COMPACT - value: 1 - - name: AFAMILY_VARIANT_ELEGANT - value: 2 - AFONT_WEIGHT: - - name: AFONT_WEIGHT_MIN - value: 0 - - name: AFONT_WEIGHT_THIN - value: 100 - - name: AFONT_WEIGHT_EXTRA_LIGHT - value: 200 - - name: AFONT_WEIGHT_LIGHT - value: 300 - - name: AFONT_WEIGHT_NORMAL - value: 400 - - name: AFONT_WEIGHT_MEDIUM - value: 500 - - name: AFONT_WEIGHT_SEMI_BOLD - value: 600 - - name: AFONT_WEIGHT_BOLD - value: 700 - - name: AFONT_WEIGHT_EXTRA_BOLD - value: 800 - - name: AFONT_WEIGHT_BLACK - value: 900 - - name: AFONT_WEIGHT_MAX - value: 1000 -functions: - AFont_close: - c_name: AFont_close - params: - - name: font - type: '*AFont' - returns: "" - AFont_getAxisCount: - c_name: AFont_getAxisCount - params: - - name: font - type: '*AFont' - returns: uint64 - AFont_getAxisTag: - c_name: AFont_getAxisTag - params: - - name: font - type: '*AFont' - - name: axisIndex - type: uint32 - returns: uint32 - AFont_getAxisValue: - c_name: AFont_getAxisValue - params: - - name: font - type: '*AFont' - - name: axisIndex - type: uint32 - returns: float32 - AFont_getCollectionIndex: - c_name: AFont_getCollectionIndex - params: - - name: font - type: '*AFont' - returns: uint64 - AFont_getFontFilePath: - c_name: AFont_getFontFilePath - params: - - name: font - type: '*AFont' - returns: string - AFont_getLocale: - c_name: AFont_getLocale - params: - - name: font - type: '*AFont' - returns: string - AFont_getWeight: - c_name: AFont_getWeight - params: - - name: font - type: '*AFont' - returns: uint16 - AFont_isItalic: - c_name: AFont_isItalic - params: - - name: font - type: '*AFont' - returns: bool - AFontMatcher_create: - c_name: AFontMatcher_create - returns: '*AFontMatcher' - AFontMatcher_destroy: - c_name: AFontMatcher_destroy - params: - - name: matcher - type: '*AFontMatcher' - returns: "" - AFontMatcher_match: - c_name: AFontMatcher_match - params: - - name: matcher - type: '*AFontMatcher' - - name: familyName - type: string - - name: text - type: '*uint16' - - name: textLength - type: uint32 - - name: runLengthOut - type: '*uint32' - returns: '*AFont' - AFontMatcher_setFamilyVariant: - c_name: AFontMatcher_setFamilyVariant - params: - - name: matcher - type: '*AFontMatcher' - - name: familyVariant - type: uint32 - returns: "" - AFontMatcher_setLocales: - c_name: AFontMatcher_setLocales - params: - - name: matcher - type: '*AFontMatcher' - - name: languageTags - type: string - returns: "" - AFontMatcher_setStyle: - c_name: AFontMatcher_setStyle - params: - - name: matcher - type: '*AFontMatcher' - - name: weight - type: uint16 - - name: italic - type: bool - returns: "" - ASystemFontIterator_close: - c_name: ASystemFontIterator_close - params: - - name: iterator - type: '*ASystemFontIterator' - returns: "" - ASystemFontIterator_next: - c_name: ASystemFontIterator_next - params: - - name: iterator - type: '*ASystemFontIterator' - returns: '*AFont' - ASystemFontIterator_open: - c_name: ASystemFontIterator_open - returns: '*ASystemFontIterator' diff --git a/spec/generated/gles2.yaml b/spec/generated/gles2.yaml deleted file mode 100644 index e08a47d..0000000 --- a/spec/generated/gles2.yaml +++ /dev/null @@ -1,3231 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: gles2 -source_package: github.com/AndroidGoLab/ndk/capi/gles2 -types: - GL_APIENTRY: - kind: typedef_:function - c_type: GL_APIENTRY - go_type: :function - GLbitfield: - kind: typedef_uint32 - c_type: GLbitfield - go_type: uint32 - GLboolean: - kind: typedef_uint8 - c_type: GLboolean - go_type: uint8 - GLbyte: - kind: typedef_khronos_int8_t - c_type: GLbyte - go_type: khronos_int8_t - GLchar: - kind: typedef_int8 - c_type: GLchar - go_type: int8 - GLclampf: - kind: typedef_khronos_float_t - c_type: GLclampf - go_type: khronos_float_t - GLdouble: - kind: typedef_float64 - c_type: GLdouble - go_type: float64 - GLeglClientBufferEXT: - kind: pointer_handle - c_type: GLeglClientBufferEXT - go_type: unsafe.Pointer - GLeglImageOES: - kind: pointer_handle - c_type: GLeglImageOES - go_type: unsafe.Pointer - GLenum: - kind: typedef_uint32 - c_type: GLenum - go_type: uint32 - GLfixed: - kind: typedef_khronos_int32_t - c_type: GLfixed - go_type: khronos_int32_t - GLfloat: - kind: typedef_khronos_float_t - c_type: GLfloat - go_type: khronos_float_t - GLint: - kind: typedef_int32 - c_type: GLint - go_type: int32 - GLint64: - kind: typedef_khronos_int64_t - c_type: GLint64 - go_type: khronos_int64_t - GLintptr: - kind: typedef_khronos_intptr_t - c_type: GLintptr - go_type: khronos_intptr_t - GLshort: - kind: typedef_int16 - c_type: GLshort - go_type: int16 - GLsizei: - kind: typedef_int32 - c_type: GLsizei - go_type: int32 - GLsizeiptr: - kind: typedef_khronos_ssize_t - c_type: GLsizeiptr - go_type: khronos_ssize_t - GLsync: - kind: typedef_*__GLsync - c_type: GLsync - go_type: '*__GLsync' - GLubyte: - kind: typedef_khronos_uint8_t - c_type: GLubyte - go_type: khronos_uint8_t - GLuint: - kind: typedef_uint32 - c_type: GLuint - go_type: uint32 - GLuint64: - kind: typedef_khronos_uint64_t - c_type: GLuint64 - go_type: khronos_uint64_t - GLushort: - kind: typedef_uint16 - c_type: GLushort - go_type: uint16 -functions: - glActiveTexture: - c_name: glActiveTexture - params: - - name: texture - type: GLenum - returns: "" - glAttachShader: - c_name: glAttachShader - params: - - name: program - type: GLuint - - name: shader - type: GLuint - returns: "" - glBindAttribLocation: - c_name: glBindAttribLocation - params: - - name: program - type: GLuint - - name: index - type: GLuint - - name: name - type: '*GLchar' - returns: "" - glBindBuffer: - c_name: glBindBuffer - params: - - name: target - type: GLenum - - name: buffer - type: GLuint - returns: "" - glBindFramebuffer: - c_name: glBindFramebuffer - params: - - name: target - type: GLenum - - name: framebuffer - type: GLuint - returns: "" - glBindRenderbuffer: - c_name: glBindRenderbuffer - params: - - name: target - type: GLenum - - name: renderbuffer - type: GLuint - returns: "" - glBindTexture: - c_name: glBindTexture - params: - - name: target - type: GLenum - - name: texture - type: GLuint - returns: "" - glBlendColor: - c_name: glBlendColor - params: - - name: red - type: GLfloat - - name: green - type: GLfloat - - name: blue - type: GLfloat - - name: alpha - type: GLfloat - returns: "" - glBlendEquation: - c_name: glBlendEquation - params: - - name: mode - type: GLenum - returns: "" - glBlendEquationSeparate: - c_name: glBlendEquationSeparate - params: - - name: modeRGB - type: GLenum - - name: modeAlpha - type: GLenum - returns: "" - glBlendFunc: - c_name: glBlendFunc - params: - - name: sfactor - type: GLenum - - name: dfactor - type: GLenum - returns: "" - glBlendFuncSeparate: - c_name: glBlendFuncSeparate - params: - - name: sfactorRGB - type: GLenum - - name: dfactorRGB - type: GLenum - - name: sfactorAlpha - type: GLenum - - name: dfactorAlpha - type: GLenum - returns: "" - glBufferData: - c_name: glBufferData - params: - - name: target - type: GLenum - - name: size - type: GLsizeiptr - - name: data - type: unsafe.Pointer - - name: usage - type: GLenum - returns: "" - glBufferSubData: - c_name: glBufferSubData - params: - - name: target - type: GLenum - - name: offset - type: GLintptr - - name: size - type: GLsizeiptr - - name: data - type: unsafe.Pointer - returns: "" - glCheckFramebufferStatus: - c_name: glCheckFramebufferStatus - params: - - name: target - type: GLenum - returns: GLenum - glClear: - c_name: glClear - params: - - name: mask - type: GLbitfield - returns: "" - glClearColor: - c_name: glClearColor - params: - - name: red - type: GLfloat - - name: green - type: GLfloat - - name: blue - type: GLfloat - - name: alpha - type: GLfloat - returns: "" - glClearDepthf: - c_name: glClearDepthf - params: - - name: d - type: GLfloat - returns: "" - glClearStencil: - c_name: glClearStencil - params: - - name: s - type: GLint - returns: "" - glColorMask: - c_name: glColorMask - params: - - name: red - type: GLboolean - - name: green - type: GLboolean - - name: blue - type: GLboolean - - name: alpha - type: GLboolean - returns: "" - glCompileShader: - c_name: glCompileShader - params: - - name: shader - type: GLuint - returns: "" - glCompressedTexImage2D: - c_name: glCompressedTexImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: internalformat - type: GLenum - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: border - type: GLint - - name: imageSize - type: GLsizei - - name: data - type: unsafe.Pointer - returns: "" - glCompressedTexSubImage2D: - c_name: glCompressedTexSubImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: format - type: GLenum - - name: imageSize - type: GLsizei - - name: data - type: unsafe.Pointer - returns: "" - glCopyTexImage2D: - c_name: glCopyTexImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: internalformat - type: GLenum - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: border - type: GLint - returns: "" - glCopyTexSubImage2D: - c_name: glCopyTexSubImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glCreateProgram: - c_name: glCreateProgram - returns: GLuint - glCreateShader: - c_name: glCreateShader - params: - - name: type - type: GLenum - returns: GLuint - glCullFace: - c_name: glCullFace - params: - - name: mode - type: GLenum - returns: "" - glDeleteBuffers: - c_name: glDeleteBuffers - params: - - name: "n" - type: GLsizei - - name: buffers - type: '*GLuint' - returns: "" - glDeleteFramebuffers: - c_name: glDeleteFramebuffers - params: - - name: "n" - type: GLsizei - - name: framebuffers - type: '*GLuint' - returns: "" - glDeleteProgram: - c_name: glDeleteProgram - params: - - name: program - type: GLuint - returns: "" - glDeleteRenderbuffers: - c_name: glDeleteRenderbuffers - params: - - name: "n" - type: GLsizei - - name: renderbuffers - type: '*GLuint' - returns: "" - glDeleteShader: - c_name: glDeleteShader - params: - - name: shader - type: GLuint - returns: "" - glDeleteTextures: - c_name: glDeleteTextures - params: - - name: "n" - type: GLsizei - - name: textures - type: '*GLuint' - returns: "" - glDepthFunc: - c_name: glDepthFunc - params: - - name: func - type: GLenum - returns: "" - glDepthMask: - c_name: glDepthMask - params: - - name: flag - type: GLboolean - returns: "" - glDepthRangef: - c_name: glDepthRangef - params: - - name: "n" - type: GLfloat - - name: f - type: GLfloat - returns: "" - glDetachShader: - c_name: glDetachShader - params: - - name: program - type: GLuint - - name: shader - type: GLuint - returns: "" - glDisable: - c_name: glDisable - params: - - name: cap - type: GLenum - returns: "" - glDisableVertexAttribArray: - c_name: glDisableVertexAttribArray - params: - - name: index - type: GLuint - returns: "" - glDrawArrays: - c_name: glDrawArrays - params: - - name: mode - type: GLenum - - name: first - type: GLint - - name: count - type: GLsizei - returns: "" - glDrawElements: - c_name: glDrawElements - params: - - name: mode - type: GLenum - - name: count - type: GLsizei - - name: type - type: GLenum - - name: indices - type: unsafe.Pointer - returns: "" - glEnable: - c_name: glEnable - params: - - name: cap - type: GLenum - returns: "" - glEnableVertexAttribArray: - c_name: glEnableVertexAttribArray - params: - - name: index - type: GLuint - returns: "" - glFinish: - c_name: glFinish - returns: "" - glFlush: - c_name: glFlush - returns: "" - glFramebufferRenderbuffer: - c_name: glFramebufferRenderbuffer - params: - - name: target - type: GLenum - - name: attachment - type: GLenum - - name: renderbuffertarget - type: GLenum - - name: renderbuffer - type: GLuint - returns: "" - glFramebufferTexture2D: - c_name: glFramebufferTexture2D - params: - - name: target - type: GLenum - - name: attachment - type: GLenum - - name: textarget - type: GLenum - - name: texture - type: GLuint - - name: level - type: GLint - returns: "" - glFrontFace: - c_name: glFrontFace - params: - - name: mode - type: GLenum - returns: "" - glGenBuffers: - c_name: glGenBuffers - params: - - name: "n" - type: GLsizei - - name: buffers - type: '*GLuint' - returns: "" - glGenFramebuffers: - c_name: glGenFramebuffers - params: - - name: "n" - type: GLsizei - - name: framebuffers - type: '*GLuint' - returns: "" - glGenRenderbuffers: - c_name: glGenRenderbuffers - params: - - name: "n" - type: GLsizei - - name: renderbuffers - type: '*GLuint' - returns: "" - glGenTextures: - c_name: glGenTextures - params: - - name: "n" - type: GLsizei - - name: textures - type: '*GLuint' - returns: "" - glGenerateMipmap: - c_name: glGenerateMipmap - params: - - name: target - type: GLenum - returns: "" - glGetActiveAttrib: - c_name: glGetActiveAttrib - params: - - name: program - type: GLuint - - name: index - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: size - type: '*GLint' - - name: type - type: '*GLenum' - - name: name - type: '*GLchar' - returns: "" - glGetActiveUniform: - c_name: glGetActiveUniform - params: - - name: program - type: GLuint - - name: index - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: size - type: '*GLint' - - name: type - type: '*GLenum' - - name: name - type: '*GLchar' - returns: "" - glGetAttachedShaders: - c_name: glGetAttachedShaders - params: - - name: program - type: GLuint - - name: maxCount - type: GLsizei - - name: count - type: '*GLsizei' - - name: shaders - type: '*GLuint' - returns: "" - glGetAttribLocation: - c_name: glGetAttribLocation - params: - - name: program - type: GLuint - - name: name - type: '*GLchar' - returns: GLint - glGetBooleanv: - c_name: glGetBooleanv - params: - - name: pname - type: GLenum - - name: data - type: '*GLboolean' - returns: "" - glGetBufferParameteriv: - c_name: glGetBufferParameteriv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetError: - c_name: glGetError - returns: GLenum - glGetFloatv: - c_name: glGetFloatv - params: - - name: pname - type: GLenum - - name: data - type: '*GLfloat' - returns: "" - glGetFramebufferAttachmentParameteriv: - c_name: glGetFramebufferAttachmentParameteriv - params: - - name: target - type: GLenum - - name: attachment - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetIntegerv: - c_name: glGetIntegerv - params: - - name: pname - type: GLenum - - name: data - type: '*GLint' - returns: "" - glGetProgramInfoLog: - c_name: glGetProgramInfoLog - params: - - name: program - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: infoLog - type: '*GLchar' - returns: "" - glGetProgramiv: - c_name: glGetProgramiv - params: - - name: program - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetRenderbufferParameteriv: - c_name: glGetRenderbufferParameteriv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetShaderInfoLog: - c_name: glGetShaderInfoLog - params: - - name: shader - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: infoLog - type: '*GLchar' - returns: "" - glGetShaderPrecisionFormat: - c_name: glGetShaderPrecisionFormat - params: - - name: shadertype - type: GLenum - - name: precisiontype - type: GLenum - - name: range - type: '*GLint' - - name: precision - type: '*GLint' - returns: "" - glGetShaderSource: - c_name: glGetShaderSource - params: - - name: shader - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: source - type: '*GLchar' - returns: "" - glGetShaderiv: - c_name: glGetShaderiv - params: - - name: shader - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetString: - c_name: glGetString - params: - - name: name - type: GLenum - returns: '*GLubyte' - glGetTexParameterfv: - c_name: glGetTexParameterfv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLfloat' - returns: "" - glGetTexParameteriv: - c_name: glGetTexParameteriv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetUniformLocation: - c_name: glGetUniformLocation - params: - - name: program - type: GLuint - - name: name - type: '*GLchar' - returns: GLint - glGetUniformfv: - c_name: glGetUniformfv - params: - - name: program - type: GLuint - - name: location - type: GLint - - name: params - type: '*GLfloat' - returns: "" - glGetUniformiv: - c_name: glGetUniformiv - params: - - name: program - type: GLuint - - name: location - type: GLint - - name: params - type: '*GLint' - returns: "" - glGetVertexAttribPointerv: - c_name: glGetVertexAttribPointerv - params: - - name: index - type: GLuint - - name: pname - type: GLenum - - name: pointer - type: '*unsafe.Pointer' - direction: out - returns: "" - glGetVertexAttribfv: - c_name: glGetVertexAttribfv - params: - - name: index - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLfloat' - returns: "" - glGetVertexAttribiv: - c_name: glGetVertexAttribiv - params: - - name: index - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glHint: - c_name: glHint - params: - - name: target - type: GLenum - - name: mode - type: GLenum - returns: "" - glIsBuffer: - c_name: glIsBuffer - params: - - name: buffer - type: GLuint - returns: GLboolean - glIsEnabled: - c_name: glIsEnabled - params: - - name: cap - type: GLenum - returns: GLboolean - glIsFramebuffer: - c_name: glIsFramebuffer - params: - - name: framebuffer - type: GLuint - returns: GLboolean - glIsProgram: - c_name: glIsProgram - params: - - name: program - type: GLuint - returns: GLboolean - glIsRenderbuffer: - c_name: glIsRenderbuffer - params: - - name: renderbuffer - type: GLuint - returns: GLboolean - glIsShader: - c_name: glIsShader - params: - - name: shader - type: GLuint - returns: GLboolean - glIsTexture: - c_name: glIsTexture - params: - - name: texture - type: GLuint - returns: GLboolean - glLineWidth: - c_name: glLineWidth - params: - - name: width - type: GLfloat - returns: "" - glLinkProgram: - c_name: glLinkProgram - params: - - name: program - type: GLuint - returns: "" - glPixelStorei: - c_name: glPixelStorei - params: - - name: pname - type: GLenum - - name: param - type: GLint - returns: "" - glPolygonOffset: - c_name: glPolygonOffset - params: - - name: factor - type: GLfloat - - name: units - type: GLfloat - returns: "" - glReadPixels: - c_name: glReadPixels - params: - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: format - type: GLenum - - name: type - type: GLenum - - name: pixels - type: unsafe.Pointer - returns: "" - glReleaseShaderCompiler: - c_name: glReleaseShaderCompiler - returns: "" - glRenderbufferStorage: - c_name: glRenderbufferStorage - params: - - name: target - type: GLenum - - name: internalformat - type: GLenum - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glSampleCoverage: - c_name: glSampleCoverage - params: - - name: value - type: GLfloat - - name: invert - type: GLboolean - returns: "" - glScissor: - c_name: glScissor - params: - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glShaderBinary: - c_name: glShaderBinary - params: - - name: count - type: GLsizei - - name: shaders - type: '*GLuint' - - name: binaryformat - type: GLenum - - name: binary - type: unsafe.Pointer - - name: length - type: GLsizei - returns: "" - glShaderSource: - c_name: glShaderSource - params: - - name: shader - type: GLuint - - name: count - type: GLsizei - - name: string - type: '**GLchar' - direction: out - - name: length - type: '*GLint' - returns: "" - glStencilFunc: - c_name: glStencilFunc - params: - - name: func - type: GLenum - - name: ref - type: GLint - - name: mask - type: GLuint - returns: "" - glStencilFuncSeparate: - c_name: glStencilFuncSeparate - params: - - name: face - type: GLenum - - name: func - type: GLenum - - name: ref - type: GLint - - name: mask - type: GLuint - returns: "" - glStencilMask: - c_name: glStencilMask - params: - - name: mask - type: GLuint - returns: "" - glStencilMaskSeparate: - c_name: glStencilMaskSeparate - params: - - name: face - type: GLenum - - name: mask - type: GLuint - returns: "" - glStencilOp: - c_name: glStencilOp - params: - - name: fail - type: GLenum - - name: zfail - type: GLenum - - name: zpass - type: GLenum - returns: "" - glStencilOpSeparate: - c_name: glStencilOpSeparate - params: - - name: face - type: GLenum - - name: sfail - type: GLenum - - name: dpfail - type: GLenum - - name: dppass - type: GLenum - returns: "" - glTexImage2D: - c_name: glTexImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: internalformat - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: border - type: GLint - - name: format - type: GLenum - - name: type - type: GLenum - - name: pixels - type: unsafe.Pointer - returns: "" - glTexParameterf: - c_name: glTexParameterf - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: param - type: GLfloat - returns: "" - glTexParameterfv: - c_name: glTexParameterfv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLfloat' - returns: "" - glTexParameteri: - c_name: glTexParameteri - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: param - type: GLint - returns: "" - glTexParameteriv: - c_name: glTexParameteriv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glTexSubImage2D: - c_name: glTexSubImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: format - type: GLenum - - name: type - type: GLenum - - name: pixels - type: unsafe.Pointer - returns: "" - glUniform1f: - c_name: glUniform1f - params: - - name: location - type: GLint - - name: v0 - type: GLfloat - returns: "" - glUniform1fv: - c_name: glUniform1fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLfloat' - returns: "" - glUniform1i: - c_name: glUniform1i - params: - - name: location - type: GLint - - name: v0 - type: GLint - returns: "" - glUniform1iv: - c_name: glUniform1iv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLint' - returns: "" - glUniform2f: - c_name: glUniform2f - params: - - name: location - type: GLint - - name: v0 - type: GLfloat - - name: v1 - type: GLfloat - returns: "" - glUniform2fv: - c_name: glUniform2fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLfloat' - returns: "" - glUniform2i: - c_name: glUniform2i - params: - - name: location - type: GLint - - name: v0 - type: GLint - - name: v1 - type: GLint - returns: "" - glUniform2iv: - c_name: glUniform2iv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLint' - returns: "" - glUniform3f: - c_name: glUniform3f - params: - - name: location - type: GLint - - name: v0 - type: GLfloat - - name: v1 - type: GLfloat - - name: v2 - type: GLfloat - returns: "" - glUniform3fv: - c_name: glUniform3fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLfloat' - returns: "" - glUniform3i: - c_name: glUniform3i - params: - - name: location - type: GLint - - name: v0 - type: GLint - - name: v1 - type: GLint - - name: v2 - type: GLint - returns: "" - glUniform3iv: - c_name: glUniform3iv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLint' - returns: "" - glUniform4f: - c_name: glUniform4f - params: - - name: location - type: GLint - - name: v0 - type: GLfloat - - name: v1 - type: GLfloat - - name: v2 - type: GLfloat - - name: v3 - type: GLfloat - returns: "" - glUniform4fv: - c_name: glUniform4fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLfloat' - returns: "" - glUniform4i: - c_name: glUniform4i - params: - - name: location - type: GLint - - name: v0 - type: GLint - - name: v1 - type: GLint - - name: v2 - type: GLint - - name: v3 - type: GLint - returns: "" - glUniform4iv: - c_name: glUniform4iv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLint' - returns: "" - glUniformMatrix2fv: - c_name: glUniformMatrix2fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix3fv: - c_name: glUniformMatrix3fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix4fv: - c_name: glUniformMatrix4fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUseProgram: - c_name: glUseProgram - params: - - name: program - type: GLuint - returns: "" - glValidateProgram: - c_name: glValidateProgram - params: - - name: program - type: GLuint - returns: "" - glVertexAttrib1f: - c_name: glVertexAttrib1f - params: - - name: index - type: GLuint - - name: x - type: GLfloat - returns: "" - glVertexAttrib1fv: - c_name: glVertexAttrib1fv - params: - - name: index - type: GLuint - - name: v - type: '*GLfloat' - returns: "" - glVertexAttrib2f: - c_name: glVertexAttrib2f - params: - - name: index - type: GLuint - - name: x - type: GLfloat - - name: "y" - type: GLfloat - returns: "" - glVertexAttrib2fv: - c_name: glVertexAttrib2fv - params: - - name: index - type: GLuint - - name: v - type: '*GLfloat' - returns: "" - glVertexAttrib3f: - c_name: glVertexAttrib3f - params: - - name: index - type: GLuint - - name: x - type: GLfloat - - name: "y" - type: GLfloat - - name: z - type: GLfloat - returns: "" - glVertexAttrib3fv: - c_name: glVertexAttrib3fv - params: - - name: index - type: GLuint - - name: v - type: '*GLfloat' - returns: "" - glVertexAttrib4f: - c_name: glVertexAttrib4f - params: - - name: index - type: GLuint - - name: x - type: GLfloat - - name: "y" - type: GLfloat - - name: z - type: GLfloat - - name: w - type: GLfloat - returns: "" - glVertexAttrib4fv: - c_name: glVertexAttrib4fv - params: - - name: index - type: GLuint - - name: v - type: '*GLfloat' - returns: "" - glVertexAttribPointer: - c_name: glVertexAttribPointer - params: - - name: index - type: GLuint - - name: size - type: GLint - - name: type - type: GLenum - - name: normalized - type: GLboolean - - name: stride - type: GLsizei - - name: pointer - type: unsafe.Pointer - returns: "" - glViewport: - c_name: glViewport - params: - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" -callbacks: - PFNGLACTIVETEXTUREPROC: - returns: "" - PFNGLATTACHSHADERPROC: - returns: "" - PFNGLBINDATTRIBLOCATIONPROC: - returns: "" - PFNGLBINDBUFFERPROC: - returns: "" - PFNGLBINDFRAMEBUFFERPROC: - returns: "" - PFNGLBINDRENDERBUFFERPROC: - returns: "" - PFNGLBINDTEXTUREPROC: - returns: "" - PFNGLBLENDCOLORPROC: - returns: "" - PFNGLBLENDEQUATIONPROC: - returns: "" - PFNGLBLENDEQUATIONSEPARATEPROC: - returns: "" - PFNGLBLENDFUNCPROC: - returns: "" - PFNGLBLENDFUNCSEPARATEPROC: - returns: "" - PFNGLBUFFERDATAPROC: - returns: "" - PFNGLBUFFERSUBDATAPROC: - returns: "" - PFNGLCHECKFRAMEBUFFERSTATUSPROC: - returns: "" - PFNGLCLEARCOLORPROC: - returns: "" - PFNGLCLEARDEPTHFPROC: - returns: "" - PFNGLCLEARPROC: - returns: "" - PFNGLCLEARSTENCILPROC: - returns: "" - PFNGLCOLORMASKPROC: - returns: "" - PFNGLCOMPILESHADERPROC: - returns: "" - PFNGLCOMPRESSEDTEXIMAGE2DPROC: - returns: "" - PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC: - returns: "" - PFNGLCOPYTEXIMAGE2DPROC: - returns: "" - PFNGLCOPYTEXSUBIMAGE2DPROC: - returns: "" - PFNGLCREATEPROGRAMPROC: - returns: "" - PFNGLCREATESHADERPROC: - returns: "" - PFNGLCULLFACEPROC: - returns: "" - PFNGLDELETEBUFFERSPROC: - returns: "" - PFNGLDELETEFRAMEBUFFERSPROC: - returns: "" - PFNGLDELETEPROGRAMPROC: - returns: "" - PFNGLDELETERENDERBUFFERSPROC: - returns: "" - PFNGLDELETESHADERPROC: - returns: "" - PFNGLDELETETEXTURESPROC: - returns: "" - PFNGLDEPTHFUNCPROC: - returns: "" - PFNGLDEPTHMASKPROC: - returns: "" - PFNGLDEPTHRANGEFPROC: - returns: "" - PFNGLDETACHSHADERPROC: - returns: "" - PFNGLDISABLEPROC: - returns: "" - PFNGLDISABLEVERTEXATTRIBARRAYPROC: - returns: "" - PFNGLDRAWARRAYSPROC: - returns: "" - PFNGLDRAWELEMENTSPROC: - returns: "" - PFNGLENABLEPROC: - returns: "" - PFNGLENABLEVERTEXATTRIBARRAYPROC: - returns: "" - PFNGLFINISHPROC: - returns: "" - PFNGLFLUSHPROC: - returns: "" - PFNGLFRAMEBUFFERRENDERBUFFERPROC: - returns: "" - PFNGLFRAMEBUFFERTEXTURE2DPROC: - returns: "" - PFNGLFRONTFACEPROC: - returns: "" - PFNGLGENBUFFERSPROC: - returns: "" - PFNGLGENERATEMIPMAPPROC: - returns: "" - PFNGLGENFRAMEBUFFERSPROC: - returns: "" - PFNGLGENRENDERBUFFERSPROC: - returns: "" - PFNGLGENTEXTURESPROC: - returns: "" - PFNGLGETACTIVEATTRIBPROC: - returns: "" - PFNGLGETACTIVEUNIFORMPROC: - returns: "" - PFNGLGETATTACHEDSHADERSPROC: - returns: "" - PFNGLGETATTRIBLOCATIONPROC: - returns: "" - PFNGLGETBOOLEANVPROC: - returns: "" - PFNGLGETBUFFERPARAMETERIVPROC: - returns: "" - PFNGLGETERRORPROC: - returns: "" - PFNGLGETFLOATVPROC: - returns: "" - PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC: - returns: "" - PFNGLGETINTEGERVPROC: - returns: "" - PFNGLGETPROGRAMINFOLOGPROC: - returns: "" - PFNGLGETPROGRAMIVPROC: - returns: "" - PFNGLGETRENDERBUFFERPARAMETERIVPROC: - returns: "" - PFNGLGETSHADERINFOLOGPROC: - returns: "" - PFNGLGETSHADERIVPROC: - returns: "" - PFNGLGETSHADERPRECISIONFORMATPROC: - returns: "" - PFNGLGETSHADERSOURCEPROC: - returns: "" - PFNGLGETSTRINGPROC: - returns: "" - PFNGLGETTEXPARAMETERFVPROC: - returns: "" - PFNGLGETTEXPARAMETERIVPROC: - returns: "" - PFNGLGETUNIFORMFVPROC: - returns: "" - PFNGLGETUNIFORMIVPROC: - returns: "" - PFNGLGETUNIFORMLOCATIONPROC: - returns: "" - PFNGLGETVERTEXATTRIBFVPROC: - returns: "" - PFNGLGETVERTEXATTRIBIVPROC: - returns: "" - PFNGLGETVERTEXATTRIBPOINTERVPROC: - returns: "" - PFNGLHINTPROC: - returns: "" - PFNGLISBUFFERPROC: - returns: "" - PFNGLISENABLEDPROC: - returns: "" - PFNGLISFRAMEBUFFERPROC: - returns: "" - PFNGLISPROGRAMPROC: - returns: "" - PFNGLISRENDERBUFFERPROC: - returns: "" - PFNGLISSHADERPROC: - returns: "" - PFNGLISTEXTUREPROC: - returns: "" - PFNGLLINEWIDTHPROC: - returns: "" - PFNGLLINKPROGRAMPROC: - returns: "" - PFNGLPIXELSTOREIPROC: - returns: "" - PFNGLPOLYGONOFFSETPROC: - returns: "" - PFNGLREADPIXELSPROC: - returns: "" - PFNGLRELEASESHADERCOMPILERPROC: - returns: "" - PFNGLRENDERBUFFERSTORAGEPROC: - returns: "" - PFNGLSAMPLECOVERAGEPROC: - returns: "" - PFNGLSCISSORPROC: - returns: "" - PFNGLSHADERBINARYPROC: - returns: "" - PFNGLSHADERSOURCEPROC: - returns: "" - PFNGLSTENCILFUNCPROC: - returns: "" - PFNGLSTENCILFUNCSEPARATEPROC: - returns: "" - PFNGLSTENCILMASKPROC: - returns: "" - PFNGLSTENCILMASKSEPARATEPROC: - returns: "" - PFNGLSTENCILOPPROC: - returns: "" - PFNGLSTENCILOPSEPARATEPROC: - returns: "" - PFNGLTEXIMAGE2DPROC: - returns: "" - PFNGLTEXPARAMETERFPROC: - returns: "" - PFNGLTEXPARAMETERFVPROC: - returns: "" - PFNGLTEXPARAMETERIPROC: - returns: "" - PFNGLTEXPARAMETERIVPROC: - returns: "" - PFNGLTEXSUBIMAGE2DPROC: - returns: "" - PFNGLUNIFORM1FPROC: - returns: "" - PFNGLUNIFORM1FVPROC: - returns: "" - PFNGLUNIFORM1IPROC: - returns: "" - PFNGLUNIFORM1IVPROC: - returns: "" - PFNGLUNIFORM2FPROC: - returns: "" - PFNGLUNIFORM2FVPROC: - returns: "" - PFNGLUNIFORM2IPROC: - returns: "" - PFNGLUNIFORM2IVPROC: - returns: "" - PFNGLUNIFORM3FPROC: - returns: "" - PFNGLUNIFORM3FVPROC: - returns: "" - PFNGLUNIFORM3IPROC: - returns: "" - PFNGLUNIFORM3IVPROC: - returns: "" - PFNGLUNIFORM4FPROC: - returns: "" - PFNGLUNIFORM4FVPROC: - returns: "" - PFNGLUNIFORM4IPROC: - returns: "" - PFNGLUNIFORM4IVPROC: - returns: "" - PFNGLUNIFORMMATRIX2FVPROC: - returns: "" - PFNGLUNIFORMMATRIX3FVPROC: - returns: "" - PFNGLUNIFORMMATRIX4FVPROC: - returns: "" - PFNGLUSEPROGRAMPROC: - returns: "" - PFNGLVALIDATEPROGRAMPROC: - returns: "" - PFNGLVERTEXATTRIB1FPROC: - returns: "" - PFNGLVERTEXATTRIB1FVPROC: - returns: "" - PFNGLVERTEXATTRIB2FPROC: - returns: "" - PFNGLVERTEXATTRIB2FVPROC: - returns: "" - PFNGLVERTEXATTRIB3FPROC: - returns: "" - PFNGLVERTEXATTRIB3FVPROC: - returns: "" - PFNGLVERTEXATTRIB4FPROC: - returns: "" - PFNGLVERTEXATTRIB4FVPROC: - returns: "" - PFNGLVERTEXATTRIBPOINTERPROC: - returns: "" - PFNGLVIEWPORTPROC: - returns: "" -macros: - GL_3DC_X_AMD: 34809 - GL_3DC_XY_AMD: 34810 - GL_ACCUM_ADJACENT_PAIRS_NV: 37037 - GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: 35722 - GL_ACTIVE_ATTRIBUTES: 35721 - GL_ACTIVE_PROGRAM_EXT: 33369 - GL_ACTIVE_TEXTURE: 34016 - GL_ACTIVE_UNIFORM_MAX_LENGTH: 35719 - GL_ACTIVE_UNIFORMS: 35718 - GL_ADJACENT_PAIRS_NV: 37038 - GL_AFFINE_2D_NV: 37010 - GL_AFFINE_3D_NV: 37012 - GL_ALIASED_LINE_WIDTH_RANGE: 33902 - GL_ALIASED_POINT_SIZE_RANGE: 33901 - GL_ALL_COMPLETED_NV: 34034 - GL_ALL_SHADER_BITS_EXT: 4294967295 - GL_ALPHA: 6406 - GL_ALPHA_BITS: 3413 - GL_ALPHA_TEST_FUNC_QCOM: 3009 - GL_ALPHA_TEST_QCOM: 3008 - GL_ALPHA_TEST_REF_QCOM: 3010 - GL_ALPHA8_EXT: 32828 - GL_ALPHA8_OES: 32828 - GL_ALPHA16F_EXT: 34844 - GL_ALPHA32F_EXT: 34838 - GL_ALREADY_SIGNALED_APPLE: 37146 - GL_ALWAYS: 519 - GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: 36202 - GL_ANY_SAMPLES_PASSED_EXT: 35887 - GL_ARC_TO_NV: 254 - GL_ARRAY_BUFFER: 34962 - GL_ARRAY_BUFFER_BINDING: 34964 - GL_ATC_RGB_AMD: 35986 - GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: 35987 - GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: 34798 - GL_ATTACHED_SHADERS: 35717 - GL_BACK: 1029 - GL_BEVEL_NV: 37030 - GL_BGRA_EXT: 32993 - GL_BGRA_IMG: 32993 - GL_BGRA8_EXT: 37793 - GL_BINNING_CONTROL_HINT_QCOM: 36784 - GL_BLACKHOLE_RENDER_INTEL: 33788 - GL_BLEND: 3042 - GL_BLEND_ADVANCED_COHERENT_KHR: 37509 - GL_BLEND_ADVANCED_COHERENT_NV: 37509 - GL_BLEND_COLOR: 32773 - GL_BLEND_DST_ALPHA: 32970 - GL_BLEND_DST_RGB: 32968 - GL_BLEND_EQUATION: 32777 - GL_BLEND_EQUATION_ALPHA: 34877 - GL_BLEND_EQUATION_RGB: 32777 - GL_BLEND_OVERLAP_NV: 37505 - GL_BLEND_PREMULTIPLIED_SRC_NV: 37504 - GL_BLEND_SRC_ALPHA: 32971 - GL_BLEND_SRC_RGB: 32969 - GL_BLUE_BITS: 3412 - GL_BLUE_NV: 6405 - GL_BOLD_BIT_NV: 1 - GL_BOOL: 35670 - GL_BOOL_VEC2: 35671 - GL_BOOL_VEC3: 35672 - GL_BOOL_VEC4: 35673 - GL_BOUNDING_BOX_NV: 37005 - GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV: 37020 - GL_BUFFER_ACCESS_OES: 35003 - GL_BUFFER_IMMUTABLE_STORAGE_EXT: 33311 - GL_BUFFER_KHR: 33504 - GL_BUFFER_MAP_POINTER_OES: 35005 - GL_BUFFER_MAPPED_OES: 35004 - GL_BUFFER_OBJECT_EXT: 37201 - GL_BUFFER_SIZE: 34660 - GL_BUFFER_STORAGE_FLAGS_EXT: 33312 - GL_BUFFER_USAGE: 34661 - GL_BYTE: 5120 - GL_CCW: 2305 - GL_CIRCULAR_CCW_ARC_TO_NV: 248 - GL_CIRCULAR_CW_ARC_TO_NV: 250 - GL_CIRCULAR_TANGENT_ARC_TO_NV: 252 - GL_CLAMP_TO_BORDER_EXT: 33069 - GL_CLAMP_TO_BORDER_NV: 33069 - GL_CLAMP_TO_BORDER_OES: 33069 - GL_CLAMP_TO_EDGE: 33071 - GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT: 16384 - GL_CLIENT_STORAGE_BIT_EXT: 512 - GL_CLIP_DEPTH_MODE_EXT: 37725 - GL_CLIP_DISTANCE0_APPLE: 12288 - GL_CLIP_DISTANCE0_EXT: 12288 - GL_CLIP_DISTANCE1_APPLE: 12289 - GL_CLIP_DISTANCE1_EXT: 12289 - GL_CLIP_DISTANCE2_APPLE: 12290 - GL_CLIP_DISTANCE2_EXT: 12290 - GL_CLIP_DISTANCE3_APPLE: 12291 - GL_CLIP_DISTANCE3_EXT: 12291 - GL_CLIP_DISTANCE4_APPLE: 12292 - GL_CLIP_DISTANCE4_EXT: 12292 - GL_CLIP_DISTANCE5_APPLE: 12293 - GL_CLIP_DISTANCE5_EXT: 12293 - GL_CLIP_DISTANCE6_APPLE: 12294 - GL_CLIP_DISTANCE6_EXT: 12294 - GL_CLIP_DISTANCE7_APPLE: 12295 - GL_CLIP_DISTANCE7_EXT: 12295 - GL_CLIP_ORIGIN_EXT: 37724 - GL_CLOSE_PATH_NV: 0 - GL_COLOR_ATTACHMENT_EXT: 37104 - GL_COLOR_ATTACHMENT0: 36064 - GL_COLOR_ATTACHMENT0_EXT: 36064 - GL_COLOR_ATTACHMENT0_NV: 36064 - GL_COLOR_ATTACHMENT1_EXT: 36065 - GL_COLOR_ATTACHMENT1_NV: 36065 - GL_COLOR_ATTACHMENT2_EXT: 36066 - GL_COLOR_ATTACHMENT2_NV: 36066 - GL_COLOR_ATTACHMENT3_EXT: 36067 - GL_COLOR_ATTACHMENT3_NV: 36067 - GL_COLOR_ATTACHMENT4_EXT: 36068 - GL_COLOR_ATTACHMENT4_NV: 36068 - GL_COLOR_ATTACHMENT5_EXT: 36069 - GL_COLOR_ATTACHMENT5_NV: 36069 - GL_COLOR_ATTACHMENT6_EXT: 36070 - GL_COLOR_ATTACHMENT6_NV: 36070 - GL_COLOR_ATTACHMENT7_EXT: 36071 - GL_COLOR_ATTACHMENT7_NV: 36071 - GL_COLOR_ATTACHMENT8_EXT: 36072 - GL_COLOR_ATTACHMENT8_NV: 36072 - GL_COLOR_ATTACHMENT9_EXT: 36073 - GL_COLOR_ATTACHMENT9_NV: 36073 - GL_COLOR_ATTACHMENT10_EXT: 36074 - GL_COLOR_ATTACHMENT10_NV: 36074 - GL_COLOR_ATTACHMENT11_EXT: 36075 - GL_COLOR_ATTACHMENT11_NV: 36075 - GL_COLOR_ATTACHMENT12_EXT: 36076 - GL_COLOR_ATTACHMENT12_NV: 36076 - GL_COLOR_ATTACHMENT13_EXT: 36077 - GL_COLOR_ATTACHMENT13_NV: 36077 - GL_COLOR_ATTACHMENT14_EXT: 36078 - GL_COLOR_ATTACHMENT14_NV: 36078 - GL_COLOR_ATTACHMENT15_EXT: 36079 - GL_COLOR_ATTACHMENT15_NV: 36079 - GL_COLOR_BUFFER_BIT: 16384 - GL_COLOR_BUFFER_BIT0_QCOM: 1 - GL_COLOR_BUFFER_BIT1_QCOM: 2 - GL_COLOR_BUFFER_BIT2_QCOM: 4 - GL_COLOR_BUFFER_BIT3_QCOM: 8 - GL_COLOR_BUFFER_BIT4_QCOM: 16 - GL_COLOR_BUFFER_BIT5_QCOM: 32 - GL_COLOR_BUFFER_BIT6_QCOM: 64 - GL_COLOR_BUFFER_BIT7_QCOM: 128 - GL_COLOR_CLEAR_VALUE: 3106 - GL_COLOR_EXT: 6144 - GL_COLOR_SAMPLES_NV: 36384 - GL_COLOR_WRITEMASK: 3107 - GL_COLORBURN_KHR: 37530 - GL_COLORBURN_NV: 37530 - GL_COLORDODGE_KHR: 37529 - GL_COLORDODGE_NV: 37529 - GL_COMPARE_REF_TO_TEXTURE_EXT: 34894 - GL_COMPILE_STATUS: 35713 - GL_COMPLETION_STATUS_KHR: 37297 - GL_COMPRESSED_RED_GREEN_RGTC2_EXT: 36285 - GL_COMPRESSED_RED_RGTC1_EXT: 36283 - GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: 36494 - GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: 36495 - GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841 - GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840 - GL_COMPRESSED_RGB_S3TC_DXT1_EXT: 33776 - GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: 36492 - GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843 - GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG: 37175 - GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842 - GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG: 37176 - GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777 - GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: 33778 - GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778 - GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: 33779 - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779 - GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286 - GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284 - GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: 36493 - GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT: 35414 - GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG: 37872 - GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT: 35415 - GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG: 37873 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV: 35917 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV: 35918 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919 - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV: 35919 - GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT: 35412 - GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT: 35413 - GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916 - GL_COMPRESSED_SRGB_S3TC_DXT1_NV: 35916 - GL_COMPRESSED_TEXTURE_FORMATS: 34467 - GL_CONDITION_SATISFIED_APPLE: 37148 - GL_CONFORMANT_NV: 37748 - GL_CONIC_CURVE_TO_NV: 26 - GL_CONJOINT_NV: 37508 - GL_CONSERVATIVE_RASTER_MODE_NV: 38221 - GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV: 38222 - GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV: 38224 - GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV: 38223 - GL_CONSERVATIVE_RASTERIZATION_INTEL: 33790 - GL_CONSERVATIVE_RASTERIZATION_NV: 37702 - GL_CONSTANT_ALPHA: 32771 - GL_CONSTANT_COLOR: 32769 - GL_CONTEXT_FLAG_DEBUG_BIT_KHR: 2 - GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR: 8 - GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT: 16 - GL_CONTEXT_LOST_KHR: 1287 - GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR: 33532 - GL_CONTEXT_RELEASE_BEHAVIOR_KHR: 33531 - GL_CONTEXT_ROBUST_ACCESS_EXT: 37107 - GL_CONTEXT_ROBUST_ACCESS_KHR: 37107 - GL_CONTRAST_NV: 37537 - GL_CONVEX_HULL_NV: 37003 - GL_COPY_READ_BUFFER_NV: 36662 - GL_COPY_WRITE_BUFFER_NV: 36663 - GL_COUNT_DOWN_NV: 37001 - GL_COUNT_UP_NV: 37000 - GL_COUNTER_RANGE_AMD: 35777 - GL_COUNTER_TYPE_AMD: 35776 - GL_COVERAGE_ALL_FRAGMENTS_NV: 36565 - GL_COVERAGE_ATTACHMENT_NV: 36562 - GL_COVERAGE_AUTOMATIC_NV: 36567 - GL_COVERAGE_BUFFER_BIT_NV: 32768 - GL_COVERAGE_BUFFERS_NV: 36563 - GL_COVERAGE_COMPONENT_NV: 36560 - GL_COVERAGE_COMPONENT4_NV: 36561 - GL_COVERAGE_EDGE_FRAGMENTS_NV: 36566 - GL_COVERAGE_MODULATION_NV: 37682 - GL_COVERAGE_MODULATION_TABLE_NV: 37681 - GL_COVERAGE_MODULATION_TABLE_SIZE_NV: 37683 - GL_COVERAGE_SAMPLES_NV: 36564 - GL_CPU_OPTIMIZED_QCOM: 36785 - GL_CUBIC_CURVE_TO_NV: 12 - GL_CUBIC_IMG: 37177 - GL_CUBIC_MIPMAP_LINEAR_IMG: 37179 - GL_CUBIC_MIPMAP_NEAREST_IMG: 37178 - GL_CULL_FACE: 2884 - GL_CULL_FACE_MODE: 2885 - GL_CURRENT_PROGRAM: 35725 - GL_CURRENT_QUERY_EXT: 34917 - GL_CURRENT_VERTEX_ATTRIB: 34342 - GL_CW: 2304 - GL_D3D12_FENCE_VALUE_EXT: 38293 - GL_DARKEN_KHR: 37527 - GL_DARKEN_NV: 37527 - GL_DEBUG_CALLBACK_FUNCTION_KHR: 33348 - GL_DEBUG_CALLBACK_USER_PARAM_KHR: 33349 - GL_DEBUG_GROUP_STACK_DEPTH_KHR: 33389 - GL_DEBUG_LOGGED_MESSAGES_KHR: 37189 - GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR: 33347 - GL_DEBUG_OUTPUT_KHR: 37600 - GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR: 33346 - GL_DEBUG_SEVERITY_HIGH_KHR: 37190 - GL_DEBUG_SEVERITY_LOW_KHR: 37192 - GL_DEBUG_SEVERITY_MEDIUM_KHR: 37191 - GL_DEBUG_SEVERITY_NOTIFICATION_KHR: 33387 - GL_DEBUG_SOURCE_API_KHR: 33350 - GL_DEBUG_SOURCE_APPLICATION_KHR: 33354 - GL_DEBUG_SOURCE_OTHER_KHR: 33355 - GL_DEBUG_SOURCE_SHADER_COMPILER_KHR: 33352 - GL_DEBUG_SOURCE_THIRD_PARTY_KHR: 33353 - GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR: 33351 - GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR: 33357 - GL_DEBUG_TYPE_ERROR_KHR: 33356 - GL_DEBUG_TYPE_MARKER_KHR: 33384 - GL_DEBUG_TYPE_OTHER_KHR: 33361 - GL_DEBUG_TYPE_PERFORMANCE_KHR: 33360 - GL_DEBUG_TYPE_POP_GROUP_KHR: 33386 - GL_DEBUG_TYPE_PORTABILITY_KHR: 33359 - GL_DEBUG_TYPE_PUSH_GROUP_KHR: 33385 - GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR: 33358 - GL_DECODE_EXT: 35401 - GL_DECR: 7683 - GL_DECR_WRAP: 34056 - GL_DEDICATED_MEMORY_OBJECT_EXT: 38273 - GL_DELETE_STATUS: 35712 - GL_DEPTH_ATTACHMENT: 36096 - GL_DEPTH_BITS: 3414 - GL_DEPTH_BUFFER_BIT: 256 - GL_DEPTH_BUFFER_BIT0_QCOM: 256 - GL_DEPTH_BUFFER_BIT1_QCOM: 512 - GL_DEPTH_BUFFER_BIT2_QCOM: 1024 - GL_DEPTH_BUFFER_BIT3_QCOM: 2048 - GL_DEPTH_BUFFER_BIT4_QCOM: 4096 - GL_DEPTH_BUFFER_BIT5_QCOM: 8192 - GL_DEPTH_BUFFER_BIT6_QCOM: 16384 - GL_DEPTH_BUFFER_BIT7_QCOM: 32768 - GL_DEPTH_CLEAR_VALUE: 2931 - GL_DEPTH_COMPONENT: 6402 - GL_DEPTH_COMPONENT16: 33189 - GL_DEPTH_COMPONENT16_NONLINEAR_NV: 36396 - GL_DEPTH_COMPONENT16_OES: 33189 - GL_DEPTH_COMPONENT24_OES: 33190 - GL_DEPTH_COMPONENT32_OES: 33191 - GL_DEPTH_EXT: 6145 - GL_DEPTH_FUNC: 2932 - GL_DEPTH_RANGE: 2928 - GL_DEPTH_SAMPLES_NV: 37677 - GL_DEPTH_STENCIL_OES: 34041 - GL_DEPTH_TEST: 2929 - GL_DEPTH_WRITEMASK: 2930 - GL_DEPTH24_STENCIL8_OES: 35056 - GL_DEVICE_LUID_EXT: 38297 - GL_DEVICE_NODE_MASK_EXT: 38298 - GL_DEVICE_UUID_EXT: 38295 - GL_DIFFERENCE_KHR: 37534 - GL_DIFFERENCE_NV: 37534 - GL_DISJOINT_NV: 37507 - GL_DITHER: 3024 - GL_DMP_PROGRAM_BINARY_DMP: 37459 - GL_DONT_CARE: 4352 - GL_DOWNSAMPLE_SCALES_IMG: 37182 - GL_DRAW_BUFFER_EXT: 3073 - GL_DRAW_BUFFER0_EXT: 34853 - GL_DRAW_BUFFER0_NV: 34853 - GL_DRAW_BUFFER1_EXT: 34854 - GL_DRAW_BUFFER1_NV: 34854 - GL_DRAW_BUFFER2_EXT: 34855 - GL_DRAW_BUFFER2_NV: 34855 - GL_DRAW_BUFFER3_EXT: 34856 - GL_DRAW_BUFFER3_NV: 34856 - GL_DRAW_BUFFER4_EXT: 34857 - GL_DRAW_BUFFER4_NV: 34857 - GL_DRAW_BUFFER5_EXT: 34858 - GL_DRAW_BUFFER5_NV: 34858 - GL_DRAW_BUFFER6_EXT: 34859 - GL_DRAW_BUFFER6_NV: 34859 - GL_DRAW_BUFFER7_EXT: 34860 - GL_DRAW_BUFFER7_NV: 34860 - GL_DRAW_BUFFER8_EXT: 34861 - GL_DRAW_BUFFER8_NV: 34861 - GL_DRAW_BUFFER9_EXT: 34862 - GL_DRAW_BUFFER9_NV: 34862 - GL_DRAW_BUFFER10_EXT: 34863 - GL_DRAW_BUFFER10_NV: 34863 - GL_DRAW_BUFFER11_EXT: 34864 - GL_DRAW_BUFFER11_NV: 34864 - GL_DRAW_BUFFER12_EXT: 34865 - GL_DRAW_BUFFER12_NV: 34865 - GL_DRAW_BUFFER13_EXT: 34866 - GL_DRAW_BUFFER13_NV: 34866 - GL_DRAW_BUFFER14_EXT: 34867 - GL_DRAW_BUFFER14_NV: 34867 - GL_DRAW_BUFFER15_EXT: 34868 - GL_DRAW_BUFFER15_NV: 34868 - GL_DRAW_FRAMEBUFFER_ANGLE: 36009 - GL_DRAW_FRAMEBUFFER_APPLE: 36009 - GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: 36006 - GL_DRAW_FRAMEBUFFER_BINDING_APPLE: 36006 - GL_DRAW_FRAMEBUFFER_BINDING_NV: 36006 - GL_DRAW_FRAMEBUFFER_NV: 36009 - GL_DRIVER_UUID_EXT: 38296 - GL_DST_ALPHA: 772 - GL_DST_ATOP_NV: 37519 - GL_DST_COLOR: 774 - GL_DST_IN_NV: 37515 - GL_DST_NV: 37511 - GL_DST_OUT_NV: 37517 - GL_DST_OVER_NV: 37513 - GL_DUP_FIRST_CUBIC_CURVE_TO_NV: 242 - GL_DUP_LAST_CUBIC_CURVE_TO_NV: 244 - GL_DYNAMIC_DRAW: 35048 - GL_DYNAMIC_STORAGE_BIT_EXT: 256 - GL_EFFECTIVE_RASTER_SAMPLES_EXT: 37676 - GL_ELEMENT_ARRAY_BUFFER: 34963 - GL_ELEMENT_ARRAY_BUFFER_BINDING: 34965 - GL_EQUAL: 514 - GL_ETC1_RGB8_OES: 36196 - GL_ETC1_SRGB8_NV: 35054 - GL_EXCLUSION_KHR: 37536 - GL_EXCLUSION_NV: 37536 - GL_EXCLUSIVE_EXT: 36625 - GL_EXTENSIONS: 7939 - GL_FACTOR_MAX_AMD: 36893 - GL_FACTOR_MIN_AMD: 36892 - GL_FALSE: 0 - GL_FASTEST: 4353 - GL_FENCE_CONDITION_NV: 34036 - GL_FENCE_STATUS_NV: 34035 - GL_FETCH_PER_SAMPLE_ARM: 36709 - GL_FILE_NAME_NV: 36980 - GL_FILL_NV: 6914 - GL_FILL_RECTANGLE_NV: 37692 - GL_FIRST_TO_REST_NV: 37039 - GL_FIRST_VERTEX_CONVENTION_EXT: 36429 - GL_FIRST_VERTEX_CONVENTION_OES: 36429 - GL_FIXED: 5132 - GL_FLOAT: 5126 - GL_FLOAT_MAT2: 35674 - GL_FLOAT_MAT3: 35675 - GL_FLOAT_MAT4: 35676 - GL_FLOAT_VEC2: 35664 - GL_FLOAT_VEC3: 35665 - GL_FLOAT_VEC4: 35666 - GL_FLOAT16_NV: 36856 - GL_FLOAT16_VEC2_NV: 36857 - GL_FLOAT16_VEC3_NV: 36858 - GL_FLOAT16_VEC4_NV: 36859 - GL_FONT_ASCENDER_BIT_NV: 2097152 - GL_FONT_DESCENDER_BIT_NV: 4194304 - GL_FONT_GLYPHS_AVAILABLE_NV: 37736 - GL_FONT_HAS_KERNING_BIT_NV: 268435456 - GL_FONT_HEIGHT_BIT_NV: 8388608 - GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV: 33554432 - GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV: 16777216 - GL_FONT_NUM_GLYPH_INDICES_BIT_NV: 536870912 - GL_FONT_TARGET_UNAVAILABLE_NV: 37737 - GL_FONT_UNAVAILABLE_NV: 37738 - GL_FONT_UNDERLINE_POSITION_BIT_NV: 67108864 - GL_FONT_UNDERLINE_THICKNESS_BIT_NV: 134217728 - GL_FONT_UNINTELLIGIBLE_NV: 37739 - GL_FONT_UNITS_PER_EM_BIT_NV: 1048576 - GL_FONT_X_MAX_BOUNDS_BIT_NV: 262144 - GL_FONT_X_MIN_BOUNDS_BIT_NV: 65536 - GL_FONT_Y_MAX_BOUNDS_BIT_NV: 524288 - GL_FONT_Y_MIN_BOUNDS_BIT_NV: 131072 - GL_FOVEATION_ENABLE_BIT_QCOM: 1 - GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM: 2 - GL_FRACTIONAL_EVEN_EXT: 36476 - GL_FRACTIONAL_EVEN_OES: 36476 - GL_FRACTIONAL_ODD_EXT: 36475 - GL_FRACTIONAL_ODD_OES: 36475 - GL_FRAGMENT_COVERAGE_COLOR_NV: 37598 - GL_FRAGMENT_COVERAGE_TO_COLOR_NV: 37597 - GL_FRAGMENT_INPUT_NV: 37741 - GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES: 36445 - GL_FRAGMENT_SHADER: 35632 - GL_FRAGMENT_SHADER_BIT_EXT: 2 - GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: 35723 - GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT: 35410 - GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM: 36710 - GL_FRAMEBUFFER: 36160 - GL_FRAMEBUFFER_ATTACHMENT_ANGLE: 37795 - GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 33296 - GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 33297 - GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT: 36263 - GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES: 36263 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 36049 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 36048 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES: 36052 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR: 38450 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 36051 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 36050 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR: 38448 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT: 36204 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG: 37183 - GL_FRAMEBUFFER_BINDING: 36006 - GL_FRAMEBUFFER_COMPLETE: 36053 - GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT: 37650 - GL_FRAMEBUFFER_DEFAULT_LAYERS_OES: 37650 - GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM: 38562 - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 36054 - GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 36057 - GL_FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM: 35839 - GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT: 38482 - GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT: 36264 - GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES: 36264 - GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 36055 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG: 37180 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE: 36182 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE: 36182 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT: 36182 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG: 37172 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV: 36182 - GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR: 38451 - GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV: 37698 - GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV: 37699 - GL_FRAMEBUFFER_SRGB_EXT: 36281 - GL_FRAMEBUFFER_UNDEFINED_OES: 33305 - GL_FRAMEBUFFER_UNSUPPORTED: 36061 - GL_FRONT: 1028 - GL_FRONT_AND_BACK: 1032 - GL_FRONT_FACE: 2886 - GL_FUNC_ADD: 32774 - GL_FUNC_REVERSE_SUBTRACT: 32779 - GL_FUNC_SUBTRACT: 32778 - GL_GCCSO_SHADER_BINARY_FJ: 37472 - GL_GENERATE_MIPMAP_HINT: 33170 - GL_GEOMETRY_LINKED_INPUT_TYPE_EXT: 35095 - GL_GEOMETRY_LINKED_INPUT_TYPE_OES: 35095 - GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT: 35096 - GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES: 35096 - GL_GEOMETRY_LINKED_VERTICES_OUT_EXT: 35094 - GL_GEOMETRY_LINKED_VERTICES_OUT_OES: 35094 - GL_GEOMETRY_SHADER_BIT_EXT: 4 - GL_GEOMETRY_SHADER_BIT_OES: 4 - GL_GEOMETRY_SHADER_EXT: 36313 - GL_GEOMETRY_SHADER_INVOCATIONS_EXT: 34943 - GL_GEOMETRY_SHADER_INVOCATIONS_OES: 34943 - GL_GEOMETRY_SHADER_OES: 36313 - GL_GEQUAL: 518 - GL_GLYPH_HAS_KERNING_BIT_NV: 256 - GL_GLYPH_HEIGHT_BIT_NV: 2 - GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV: 16 - GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV: 4 - GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV: 8 - GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV: 128 - GL_GLYPH_VERTICAL_BEARING_X_BIT_NV: 32 - GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV: 64 - GL_GLYPH_WIDTH_BIT_NV: 1 - GL_GPU_DISJOINT_EXT: 36795 - GL_GPU_OPTIMIZED_QCOM: 36786 - GL_GREATER: 516 - GL_GREEN_BITS: 3411 - GL_GREEN_NV: 6404 - GL_GUILTY_CONTEXT_RESET_EXT: 33363 - GL_GUILTY_CONTEXT_RESET_KHR: 33363 - GL_HALF_FLOAT_OES: 36193 - GL_HANDLE_TYPE_D3D11_IMAGE_EXT: 38283 - GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT: 38284 - GL_HANDLE_TYPE_D3D12_FENCE_EXT: 38292 - GL_HANDLE_TYPE_D3D12_RESOURCE_EXT: 38282 - GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT: 38281 - GL_HANDLE_TYPE_OPAQUE_FD_EXT: 38278 - GL_HANDLE_TYPE_OPAQUE_WIN32_EXT: 38279 - GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT: 38280 - GL_HARDLIGHT_KHR: 37531 - GL_HARDLIGHT_NV: 37531 - GL_HARDMIX_NV: 37545 - GL_HIGH_FLOAT: 36338 - GL_HIGH_INT: 36341 - GL_HORIZONTAL_LINE_TO_NV: 6 - GL_HSL_COLOR_KHR: 37551 - GL_HSL_COLOR_NV: 37551 - GL_HSL_HUE_KHR: 37549 - GL_HSL_HUE_NV: 37549 - GL_HSL_LUMINOSITY_KHR: 37552 - GL_HSL_LUMINOSITY_NV: 37552 - GL_HSL_SATURATION_KHR: 37550 - GL_HSL_SATURATION_NV: 37550 - GL_IMAGE_BUFFER_EXT: 36945 - GL_IMAGE_BUFFER_OES: 36945 - GL_IMAGE_CUBE_MAP_ARRAY_EXT: 36948 - GL_IMAGE_CUBE_MAP_ARRAY_OES: 36948 - GL_IMPLEMENTATION_COLOR_READ_FORMAT: 35739 - GL_IMPLEMENTATION_COLOR_READ_TYPE: 35738 - GL_INCLUSIVE_EXT: 36624 - GL_INCR: 7682 - GL_INCR_WRAP: 34055 - GL_INFO_LOG_LENGTH: 35716 - GL_INNOCENT_CONTEXT_RESET_EXT: 33364 - GL_INNOCENT_CONTEXT_RESET_KHR: 33364 - GL_INT: 5124 - GL_INT_10_10_10_2_OES: 36343 - GL_INT_IMAGE_BUFFER_EXT: 36956 - GL_INT_IMAGE_BUFFER_OES: 36956 - GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT: 36959 - GL_INT_IMAGE_CUBE_MAP_ARRAY_OES: 36959 - GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES: 37132 - GL_INT_SAMPLER_BUFFER_EXT: 36304 - GL_INT_SAMPLER_BUFFER_OES: 36304 - GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT: 36878 - GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES: 36878 - GL_INT_VEC2: 35667 - GL_INT_VEC3: 35668 - GL_INT_VEC4: 35669 - GL_INT8_NV: 36832 - GL_INT8_VEC2_NV: 36833 - GL_INT8_VEC3_NV: 36834 - GL_INT8_VEC4_NV: 36835 - GL_INT16_NV: 36836 - GL_INT16_VEC2_NV: 36837 - GL_INT16_VEC3_NV: 36838 - GL_INT16_VEC4_NV: 36839 - GL_INT64_NV: 5134 - GL_INT64_VEC2_NV: 36841 - GL_INT64_VEC3_NV: 36842 - GL_INT64_VEC4_NV: 36843 - GL_INVALID_ENUM: 1280 - GL_INVALID_FRAMEBUFFER_OPERATION: 1286 - GL_INVALID_OPERATION: 1282 - GL_INVALID_VALUE: 1281 - GL_INVERT: 5386 - GL_INVERT_OVG_NV: 37556 - GL_INVERT_RGB_NV: 37539 - GL_IS_PER_PATCH_EXT: 37607 - GL_IS_PER_PATCH_OES: 37607 - GL_ISOLINES_EXT: 36474 - GL_ISOLINES_OES: 36474 - GL_ITALIC_BIT_NV: 2 - GL_KEEP: 7680 - GL_LARGE_CCW_ARC_TO_NV: 22 - GL_LARGE_CW_ARC_TO_NV: 24 - GL_LAST_VERTEX_CONVENTION_EXT: 36430 - GL_LAST_VERTEX_CONVENTION_OES: 36430 - GL_LAYER_PROVOKING_VERTEX_EXT: 33374 - GL_LAYER_PROVOKING_VERTEX_OES: 33374 - GL_LAYOUT_COLOR_ATTACHMENT_EXT: 38286 - GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT: 38193 - GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT: 38192 - GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT: 38287 - GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT: 38288 - GL_LAYOUT_GENERAL_EXT: 38285 - GL_LAYOUT_SHADER_READ_ONLY_EXT: 38289 - GL_LAYOUT_TRANSFER_DST_EXT: 38291 - GL_LAYOUT_TRANSFER_SRC_EXT: 38290 - GL_LEQUAL: 515 - GL_LESS: 513 - GL_LIGHTEN_KHR: 37528 - GL_LIGHTEN_NV: 37528 - GL_LINE_LOOP: 2 - GL_LINE_NV: 6913 - GL_LINE_STRIP: 3 - GL_LINE_STRIP_ADJACENCY_EXT: 11 - GL_LINE_STRIP_ADJACENCY_OES: 11 - GL_LINE_TO_NV: 4 - GL_LINE_WIDTH: 2849 - GL_LINEAR: 9729 - GL_LINEAR_MIPMAP_LINEAR: 9987 - GL_LINEAR_MIPMAP_NEAREST: 9985 - GL_LINEAR_TILING_EXT: 38277 - GL_LINEARBURN_NV: 37541 - GL_LINEARDODGE_NV: 37540 - GL_LINEARLIGHT_NV: 37543 - GL_LINES: 1 - GL_LINES_ADJACENCY_EXT: 10 - GL_LINES_ADJACENCY_OES: 10 - GL_LINK_STATUS: 35714 - GL_LOCATION_INDEX_EXT: 37647 - GL_LOSE_CONTEXT_ON_RESET_EXT: 33362 - GL_LOSE_CONTEXT_ON_RESET_KHR: 33362 - GL_LOW_FLOAT: 36336 - GL_LOW_INT: 36339 - GL_LOWER_LEFT_EXT: 36001 - GL_LUID_SIZE_EXT: 8 - GL_LUMINANCE: 6409 - GL_LUMINANCE_ALPHA: 6410 - GL_LUMINANCE_ALPHA16F_EXT: 34847 - GL_LUMINANCE_ALPHA32F_EXT: 34841 - GL_LUMINANCE4_ALPHA4_OES: 32835 - GL_LUMINANCE8_ALPHA8_EXT: 32837 - GL_LUMINANCE8_ALPHA8_OES: 32837 - GL_LUMINANCE8_EXT: 32832 - GL_LUMINANCE8_OES: 32832 - GL_LUMINANCE16F_EXT: 34846 - GL_LUMINANCE32F_EXT: 34840 - GL_MALI_PROGRAM_BINARY_ARM: 36705 - GL_MALI_SHADER_BINARY_ARM: 36704 - GL_MAP_COHERENT_BIT_EXT: 128 - GL_MAP_FLUSH_EXPLICIT_BIT_EXT: 16 - GL_MAP_INVALIDATE_BUFFER_BIT_EXT: 8 - GL_MAP_INVALIDATE_RANGE_BIT_EXT: 4 - GL_MAP_PERSISTENT_BIT_EXT: 64 - GL_MAP_READ_BIT: 1 - GL_MAP_READ_BIT_EXT: 1 - GL_MAP_UNSYNCHRONIZED_BIT_EXT: 32 - GL_MAP_WRITE_BIT: 2 - GL_MAP_WRITE_BIT_EXT: 2 - GL_MAX: 32776 - GL_MAX_3D_TEXTURE_SIZE_OES: 32883 - GL_MAX_CLIP_DISTANCES_APPLE: 3378 - GL_MAX_CLIP_DISTANCES_EXT: 3378 - GL_MAX_COLOR_ATTACHMENTS_EXT: 36063 - GL_MAX_COLOR_ATTACHMENTS_NV: 36063 - GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT: 33530 - GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT: 35378 - GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES: 35378 - GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT: 36382 - GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES: 36382 - GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT: 36383 - GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES: 36383 - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: 35661 - GL_MAX_CUBE_MAP_TEXTURE_SIZE: 34076 - GL_MAX_CULL_DISTANCES_EXT: 33529 - GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR: 33388 - GL_MAX_DEBUG_LOGGED_MESSAGES_KHR: 37188 - GL_MAX_DEBUG_MESSAGE_LENGTH_KHR: 37187 - GL_MAX_DRAW_BUFFERS_EXT: 34852 - GL_MAX_DRAW_BUFFERS_NV: 34852 - GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT: 35068 - GL_MAX_EXT: 32776 - GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES: 36444 - GL_MAX_FRAGMENT_UNIFORM_VECTORS: 36349 - GL_MAX_FRAMEBUFFER_LAYERS_EXT: 37655 - GL_MAX_FRAMEBUFFER_LAYERS_OES: 37655 - GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT: 37583 - GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES: 37583 - GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT: 37589 - GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES: 37589 - GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT: 37069 - GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES: 37069 - GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT: 37155 - GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES: 37155 - GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT: 37156 - GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES: 37156 - GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT: 36320 - GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES: 36320 - GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT: 36442 - GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES: 36442 - GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT: 37079 - GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES: 37079 - GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT: 35881 - GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES: 35881 - GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT: 36321 - GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES: 36321 - GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT: 35372 - GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES: 35372 - GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT: 36319 - GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES: 36319 - GL_MAX_LABEL_LENGTH_KHR: 33512 - GL_MAX_MULTIVIEW_BUFFERS_EXT: 37106 - GL_MAX_PATCH_VERTICES_EXT: 36477 - GL_MAX_PATCH_VERTICES_OES: 36477 - GL_MAX_RASTER_SAMPLES_EXT: 37673 - GL_MAX_RENDERBUFFER_SIZE: 34024 - GL_MAX_SAMPLES_ANGLE: 36183 - GL_MAX_SAMPLES_APPLE: 36183 - GL_MAX_SAMPLES_EXT: 36183 - GL_MAX_SAMPLES_IMG: 37173 - GL_MAX_SAMPLES_NV: 36183 - GL_MAX_SERVER_WAIT_TIMEOUT_APPLE: 37137 - GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT: 38480 - GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT: 38481 - GL_MAX_SHADER_COMPILER_THREADS_KHR: 37296 - GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT: 36707 - GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT: 36711 - GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT: 37273 - GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT: 37274 - GL_MAX_SPARSE_TEXTURE_SIZE_EXT: 37272 - GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV: 37705 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT: 37581 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES: 37581 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT: 37587 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES: 37587 - GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT: 37067 - GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES: 37067 - GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT: 34924 - GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES: 34924 - GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT: 36483 - GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES: 36483 - GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT: 37080 - GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES: 37080 - GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT: 36481 - GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES: 36481 - GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT: 36485 - GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES: 36485 - GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT: 36489 - GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES: 36489 - GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT: 36479 - GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES: 36479 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT: 37582 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES: 37582 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT: 37588 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES: 37588 - GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT: 37068 - GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES: 37068 - GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT: 34925 - GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES: 34925 - GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT: 36486 - GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES: 36486 - GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT: 37081 - GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES: 37081 - GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT: 36482 - GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES: 36482 - GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT: 36490 - GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES: 36490 - GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT: 36480 - GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES: 36480 - GL_MAX_TESS_GEN_LEVEL_EXT: 36478 - GL_MAX_TESS_GEN_LEVEL_OES: 36478 - GL_MAX_TESS_PATCH_COMPONENTS_EXT: 36484 - GL_MAX_TESS_PATCH_COMPONENTS_OES: 36484 - GL_MAX_TEXTURE_BUFFER_SIZE_EXT: 35883 - GL_MAX_TEXTURE_BUFFER_SIZE_OES: 35883 - GL_MAX_TEXTURE_IMAGE_UNITS: 34930 - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: 34047 - GL_MAX_TEXTURE_SIZE: 3379 - GL_MAX_VARYING_VECTORS: 36348 - GL_MAX_VERTEX_ATTRIBS: 34921 - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: 35660 - GL_MAX_VERTEX_UNIFORM_VECTORS: 36347 - GL_MAX_VIEWPORT_DIMS: 3386 - GL_MAX_VIEWPORTS_NV: 33371 - GL_MAX_VIEWPORTS_OES: 33371 - GL_MAX_VIEWS_OVR: 38449 - GL_MAX_WINDOW_RECTANGLES_EXT: 36628 - GL_MEDIUM_FLOAT: 36337 - GL_MEDIUM_INT: 36340 - GL_MIN: 32775 - GL_MIN_EXT: 32775 - GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES: 36443 - GL_MIN_SAMPLE_SHADING_VALUE_OES: 35895 - GL_MINUS_CLAMPED_NV: 37555 - GL_MINUS_NV: 37535 - GL_MIRROR_CLAMP_TO_EDGE_EXT: 34627 - GL_MIRRORED_REPEAT: 33648 - GL_MITER_REVERT_NV: 37031 - GL_MITER_TRUNCATE_NV: 37032 - GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV: 37679 - GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV: 37680 - GL_MOVE_TO_CONTINUES_NV: 37046 - GL_MOVE_TO_NV: 2 - GL_MOVE_TO_RESETS_NV: 37045 - GL_MULTIPLY_KHR: 37524 - GL_MULTIPLY_NV: 37524 - GL_MULTISAMPLE_BUFFER_BIT0_QCOM: 16777216 - GL_MULTISAMPLE_BUFFER_BIT1_QCOM: 33554432 - GL_MULTISAMPLE_BUFFER_BIT2_QCOM: 67108864 - GL_MULTISAMPLE_BUFFER_BIT3_QCOM: 134217728 - GL_MULTISAMPLE_BUFFER_BIT4_QCOM: 268435456 - GL_MULTISAMPLE_BUFFER_BIT5_QCOM: 536870912 - GL_MULTISAMPLE_BUFFER_BIT6_QCOM: 1073741824 - GL_MULTISAMPLE_BUFFER_BIT7_QCOM: 2147483648 - GL_MULTISAMPLE_EXT: 32925 - GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT: 37675 - GL_MULTISAMPLES_NV: 37745 - GL_MULTIVIEW_EXT: 37105 - GL_NEAREST: 9728 - GL_NEAREST_MIPMAP_LINEAR: 9986 - GL_NEAREST_MIPMAP_NEAREST: 9984 - GL_NEGATIVE_ONE_TO_ONE_EXT: 37726 - GL_NEVER: 512 - GL_NICEST: 4354 - GL_NO_ERROR: 0 - GL_NO_RESET_NOTIFICATION_EXT: 33377 - GL_NO_RESET_NOTIFICATION_KHR: 33377 - GL_NONE: 0 - GL_NOTEQUAL: 517 - GL_NUM_COMPRESSED_TEXTURE_FORMATS: 34466 - GL_NUM_DEVICE_UUIDS_EXT: 38294 - GL_NUM_DOWNSAMPLE_SCALES_IMG: 37181 - GL_NUM_PROGRAM_BINARY_FORMATS_OES: 34814 - GL_NUM_SHADER_BINARY_FORMATS: 36345 - GL_NUM_SPARSE_LEVELS_EXT: 37290 - GL_NUM_TILING_TYPES_EXT: 38274 - GL_NUM_VIRTUAL_PAGE_SIZES_EXT: 37288 - GL_NUM_WINDOW_RECTANGLES_EXT: 36629 - GL_OBJECT_TYPE_APPLE: 37138 - GL_ONE: 1 - GL_ONE_MINUS_CONSTANT_ALPHA: 32772 - GL_ONE_MINUS_CONSTANT_COLOR: 32770 - GL_ONE_MINUS_DST_ALPHA: 773 - GL_ONE_MINUS_DST_COLOR: 775 - GL_ONE_MINUS_SRC_ALPHA: 771 - GL_ONE_MINUS_SRC_COLOR: 769 - GL_ONE_MINUS_SRC1_ALPHA_EXT: 35067 - GL_ONE_MINUS_SRC1_COLOR_EXT: 35066 - GL_OPTIMAL_TILING_EXT: 38276 - GL_OUT_OF_MEMORY: 1285 - GL_OVERLAY_KHR: 37526 - GL_OVERLAY_NV: 37526 - GL_PACK_ALIGNMENT: 3333 - GL_PACK_REVERSE_ROW_ORDER_ANGLE: 37796 - GL_PALETTE4_R5_G6_B5_OES: 35730 - GL_PALETTE4_RGB5_A1_OES: 35732 - GL_PALETTE4_RGB8_OES: 35728 - GL_PALETTE4_RGBA4_OES: 35731 - GL_PALETTE4_RGBA8_OES: 35729 - GL_PALETTE8_R5_G6_B5_OES: 35735 - GL_PALETTE8_RGB5_A1_OES: 35737 - GL_PALETTE8_RGB8_OES: 35733 - GL_PALETTE8_RGBA4_OES: 35736 - GL_PALETTE8_RGBA8_OES: 35734 - GL_PATCH_VERTICES_EXT: 36466 - GL_PATCH_VERTICES_OES: 36466 - GL_PATCHES: 14 - GL_PATCHES_EXT: 14 - GL_PATCHES_OES: 14 - GL_PATH_CLIENT_LENGTH_NV: 36991 - GL_PATH_COMMAND_COUNT_NV: 37021 - GL_PATH_COMPUTED_LENGTH_NV: 37024 - GL_PATH_COORD_COUNT_NV: 37022 - GL_PATH_COVER_DEPTH_FUNC_NV: 37055 - GL_PATH_DASH_ARRAY_COUNT_NV: 37023 - GL_PATH_DASH_CAPS_NV: 36987 - GL_PATH_DASH_OFFSET_NV: 36990 - GL_PATH_DASH_OFFSET_RESET_NV: 37044 - GL_PATH_END_CAPS_NV: 36982 - GL_PATH_ERROR_POSITION_NV: 37035 - GL_PATH_FILL_BOUNDING_BOX_NV: 37025 - GL_PATH_FILL_COVER_MODE_NV: 36994 - GL_PATH_FILL_MASK_NV: 36993 - GL_PATH_FILL_MODE_NV: 36992 - GL_PATH_FORMAT_PS_NV: 36977 - GL_PATH_FORMAT_SVG_NV: 36976 - GL_PATH_GEN_COEFF_NV: 37041 - GL_PATH_GEN_COMPONENTS_NV: 37043 - GL_PATH_GEN_MODE_NV: 37040 - GL_PATH_INITIAL_DASH_CAP_NV: 36988 - GL_PATH_INITIAL_END_CAP_NV: 36983 - GL_PATH_JOIN_STYLE_NV: 36985 - GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV: 3382 - GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV: 3384 - GL_PATH_MITER_LIMIT_NV: 36986 - GL_PATH_MODELVIEW_MATRIX_NV: 2982 - GL_PATH_MODELVIEW_NV: 5888 - GL_PATH_MODELVIEW_STACK_DEPTH_NV: 2979 - GL_PATH_OBJECT_BOUNDING_BOX_NV: 37002 - GL_PATH_PROJECTION_MATRIX_NV: 2983 - GL_PATH_PROJECTION_NV: 5889 - GL_PATH_PROJECTION_STACK_DEPTH_NV: 2980 - GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV: 37053 - GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV: 37054 - GL_PATH_STENCIL_FUNC_NV: 37047 - GL_PATH_STENCIL_REF_NV: 37048 - GL_PATH_STENCIL_VALUE_MASK_NV: 37049 - GL_PATH_STROKE_BOUNDING_BOX_NV: 37026 - GL_PATH_STROKE_COVER_MODE_NV: 36995 - GL_PATH_STROKE_MASK_NV: 36996 - GL_PATH_STROKE_WIDTH_NV: 36981 - GL_PATH_TERMINAL_DASH_CAP_NV: 36989 - GL_PATH_TERMINAL_END_CAP_NV: 36984 - GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV: 34019 - GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV: 34020 - GL_PERCENTAGE_AMD: 35779 - GL_PERFMON_GLOBAL_MODE_QCOM: 36768 - GL_PERFMON_RESULT_AMD: 35782 - GL_PERFMON_RESULT_AVAILABLE_AMD: 35780 - GL_PERFMON_RESULT_SIZE_AMD: 35781 - GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL: 38140 - GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL: 38139 - GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL: 38138 - GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL: 38136 - GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL: 38137 - GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL: 38143 - GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL: 38129 - GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL: 38130 - GL_PERFQUERY_COUNTER_EVENT_INTEL: 38128 - GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL: 38142 - GL_PERFQUERY_COUNTER_RAW_INTEL: 38132 - GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL: 38131 - GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL: 38133 - GL_PERFQUERY_DONOT_FLUSH_INTEL: 33785 - GL_PERFQUERY_FLUSH_INTEL: 33786 - GL_PERFQUERY_GLOBAL_CONTEXT_INTEL: 1 - GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL: 38144 - GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL: 38141 - GL_PERFQUERY_SINGLE_CONTEXT_INTEL: 0 - GL_PERFQUERY_WAIT_INTEL: 33787 - GL_PINLIGHT_NV: 37544 - GL_PIXEL_PACK_BUFFER_BINDING_NV: 35053 - GL_PIXEL_PACK_BUFFER_NV: 35051 - GL_PIXEL_UNPACK_BUFFER_BINDING_NV: 35055 - GL_PIXEL_UNPACK_BUFFER_NV: 35052 - GL_PLUS_CLAMPED_ALPHA_NV: 37554 - GL_PLUS_CLAMPED_NV: 37553 - GL_PLUS_DARKER_NV: 37522 - GL_PLUS_NV: 37521 - GL_POINT_NV: 6912 - GL_POINTS: 0 - GL_POLYGON_MODE_NV: 2880 - GL_POLYGON_OFFSET_CLAMP_EXT: 36379 - GL_POLYGON_OFFSET_FACTOR: 32824 - GL_POLYGON_OFFSET_FILL: 32823 - GL_POLYGON_OFFSET_LINE_NV: 10754 - GL_POLYGON_OFFSET_POINT_NV: 10753 - GL_POLYGON_OFFSET_UNITS: 10752 - GL_PRIMITIVE_BOUNDING_BOX_EXT: 37566 - GL_PRIMITIVE_BOUNDING_BOX_OES: 37566 - GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED: 33313 - GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES: 33313 - GL_PRIMITIVES_GENERATED_EXT: 35975 - GL_PRIMITIVES_GENERATED_OES: 35975 - GL_PROGRAM_BINARY_ANGLE: 37798 - GL_PROGRAM_BINARY_FORMAT_MESA: 34655 - GL_PROGRAM_BINARY_FORMATS_OES: 34815 - GL_PROGRAM_BINARY_LENGTH_OES: 34625 - GL_PROGRAM_KHR: 33506 - GL_PROGRAM_OBJECT_EXT: 35648 - GL_PROGRAM_PIPELINE_BINDING_EXT: 33370 - GL_PROGRAM_PIPELINE_KHR: 33508 - GL_PROGRAM_PIPELINE_OBJECT_EXT: 35407 - GL_PROGRAM_SEPARABLE_EXT: 33368 - GL_PROGRAMMABLE_SAMPLE_LOCATION_NV: 37697 - GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV: 37696 - GL_PROTECTED_MEMORY_OBJECT_EXT: 38299 - GL_QUADRATIC_CURVE_TO_NV: 10 - GL_QUADS_EXT: 7 - GL_QUADS_OES: 7 - GL_QUERY_BY_REGION_NO_WAIT_NV: 36374 - GL_QUERY_BY_REGION_WAIT_NV: 36373 - GL_QUERY_COUNTER_BITS_EXT: 34916 - GL_QUERY_KHR: 33507 - GL_QUERY_NO_WAIT_NV: 36372 - GL_QUERY_OBJECT_EXT: 37203 - GL_QUERY_RESULT_AVAILABLE_EXT: 34919 - GL_QUERY_RESULT_EXT: 34918 - GL_QUERY_WAIT_NV: 36371 - GL_R8_EXT: 33321 - GL_R8_SNORM: 36756 - GL_R11F_G11F_B10F_APPLE: 35898 - GL_R16F_EXT: 33325 - GL_R16_EXT: 33322 - GL_R16_SNORM_EXT: 36760 - GL_R32F_EXT: 33326 - GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT: 37674 - GL_RASTER_MULTISAMPLE_EXT: 37671 - GL_RASTER_SAMPLES_EXT: 37672 - GL_READ_BUFFER_EXT: 3074 - GL_READ_BUFFER_NV: 3074 - GL_READ_FRAMEBUFFER_ANGLE: 36008 - GL_READ_FRAMEBUFFER_APPLE: 36008 - GL_READ_FRAMEBUFFER_BINDING_ANGLE: 36010 - GL_READ_FRAMEBUFFER_BINDING_APPLE: 36010 - GL_READ_FRAMEBUFFER_BINDING_NV: 36010 - GL_READ_FRAMEBUFFER_NV: 36008 - GL_RECT_NV: 246 - GL_RED_BITS: 3410 - GL_RED_EXT: 6403 - GL_RED_NV: 6403 - GL_REFERENCED_BY_GEOMETRY_SHADER_EXT: 37641 - GL_REFERENCED_BY_GEOMETRY_SHADER_OES: 37641 - GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT: 37639 - GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES: 37639 - GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT: 37640 - GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES: 37640 - GL_RELATIVE_ARC_TO_NV: 255 - GL_RELATIVE_CONIC_CURVE_TO_NV: 27 - GL_RELATIVE_CUBIC_CURVE_TO_NV: 13 - GL_RELATIVE_HORIZONTAL_LINE_TO_NV: 7 - GL_RELATIVE_LARGE_CCW_ARC_TO_NV: 23 - GL_RELATIVE_LARGE_CW_ARC_TO_NV: 25 - GL_RELATIVE_LINE_TO_NV: 5 - GL_RELATIVE_MOVE_TO_NV: 3 - GL_RELATIVE_QUADRATIC_CURVE_TO_NV: 11 - GL_RELATIVE_RECT_NV: 247 - GL_RELATIVE_ROUNDED_RECT_NV: 233 - GL_RELATIVE_ROUNDED_RECT2_NV: 235 - GL_RELATIVE_ROUNDED_RECT4_NV: 237 - GL_RELATIVE_ROUNDED_RECT8_NV: 239 - GL_RELATIVE_SMALL_CCW_ARC_TO_NV: 19 - GL_RELATIVE_SMALL_CW_ARC_TO_NV: 21 - GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV: 17 - GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV: 15 - GL_RELATIVE_VERTICAL_LINE_TO_NV: 9 - GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM: 36787 - GL_RENDERBUFFER: 36161 - GL_RENDERBUFFER_ALPHA_SIZE: 36179 - GL_RENDERBUFFER_BINDING: 36007 - GL_RENDERBUFFER_BLUE_SIZE: 36178 - GL_RENDERBUFFER_DEPTH_SIZE: 36180 - GL_RENDERBUFFER_GREEN_SIZE: 36177 - GL_RENDERBUFFER_HEIGHT: 36163 - GL_RENDERBUFFER_INTERNAL_FORMAT: 36164 - GL_RENDERBUFFER_RED_SIZE: 36176 - GL_RENDERBUFFER_SAMPLES_ANGLE: 36011 - GL_RENDERBUFFER_SAMPLES_APPLE: 36011 - GL_RENDERBUFFER_SAMPLES_EXT: 36011 - GL_RENDERBUFFER_SAMPLES_IMG: 37171 - GL_RENDERBUFFER_SAMPLES_NV: 36011 - GL_RENDERBUFFER_STENCIL_SIZE: 36181 - GL_RENDERBUFFER_WIDTH: 36162 - GL_RENDERER: 7937 - GL_REPEAT: 10497 - GL_REPLACE: 7681 - GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES: 36200 - GL_RESET_NOTIFICATION_STRATEGY_EXT: 33366 - GL_RESET_NOTIFICATION_STRATEGY_KHR: 33366 - GL_RESTART_PATH_NV: 240 - GL_RG_EXT: 33319 - GL_RG8_EXT: 33323 - GL_RG8_SNORM: 36757 - GL_RG16F_EXT: 33327 - GL_RG16_EXT: 33324 - GL_RG16_SNORM_EXT: 36761 - GL_RG32F_EXT: 33328 - GL_RGB: 6407 - GL_RGB_422_APPLE: 35359 - GL_RGB_RAW_422_APPLE: 35409 - GL_RGB5_A1: 32855 - GL_RGB5_A1_OES: 32855 - GL_RGB8_OES: 32849 - GL_RGB9_E5_APPLE: 35901 - GL_RGB10_A2_EXT: 32857 - GL_RGB10_EXT: 32850 - GL_RGB16F_EXT: 34843 - GL_RGB16_EXT: 32852 - GL_RGB16_SNORM_EXT: 36762 - GL_RGB32F_EXT: 34837 - GL_RGB565: 36194 - GL_RGB565_OES: 36194 - GL_RGBA: 6408 - GL_RGBA4: 32854 - GL_RGBA4_OES: 32854 - GL_RGBA8_OES: 32856 - GL_RGBA8_SNORM: 36759 - GL_RGBA16F_EXT: 34842 - GL_RGBA16_EXT: 32859 - GL_RGBA16_SNORM_EXT: 36763 - GL_RGBA32F_EXT: 34836 - GL_ROUND_NV: 37028 - GL_ROUNDED_RECT_NV: 232 - GL_ROUNDED_RECT2_NV: 234 - GL_ROUNDED_RECT4_NV: 236 - GL_ROUNDED_RECT8_NV: 238 - GL_SAMPLE_ALPHA_TO_COVERAGE: 32926 - GL_SAMPLE_ALPHA_TO_ONE_EXT: 32927 - GL_SAMPLE_BUFFERS: 32936 - GL_SAMPLE_COVERAGE: 32928 - GL_SAMPLE_COVERAGE_INVERT: 32939 - GL_SAMPLE_COVERAGE_VALUE: 32938 - GL_SAMPLE_LOCATION_NV: 36432 - GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV: 37695 - GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV: 37694 - GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV: 37693 - GL_SAMPLE_SHADING_OES: 35894 - GL_SAMPLER: 33510 - GL_SAMPLER_2D: 35678 - GL_SAMPLER_2D_ARRAY_SHADOW_NV: 36292 - GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES: 37131 - GL_SAMPLER_2D_SHADOW_EXT: 35682 - GL_SAMPLER_3D_OES: 35679 - GL_SAMPLER_BUFFER_EXT: 36290 - GL_SAMPLER_BUFFER_OES: 36290 - GL_SAMPLER_CUBE: 35680 - GL_SAMPLER_CUBE_MAP_ARRAY_EXT: 36876 - GL_SAMPLER_CUBE_MAP_ARRAY_OES: 36876 - GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT: 36877 - GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES: 36877 - GL_SAMPLER_CUBE_SHADOW_NV: 36293 - GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT: 35815 - GL_SAMPLER_EXTERNAL_OES: 36198 - GL_SAMPLER_KHR: 33510 - GL_SAMPLES: 32937 - GL_SCISSOR_BOX: 3088 - GL_SCISSOR_TEST: 3089 - GL_SCREEN_KHR: 37525 - GL_SCREEN_NV: 37525 - GL_SGX_BINARY_IMG: 35850 - GL_SGX_PROGRAM_BINARY_IMG: 37168 - GL_SHADER_BINARY_DMP: 37456 - GL_SHADER_BINARY_FORMATS: 36344 - GL_SHADER_BINARY_VIV: 36804 - GL_SHADER_COMPILER: 36346 - GL_SHADER_KHR: 33505 - GL_SHADER_OBJECT_EXT: 35656 - GL_SHADER_PIXEL_LOCAL_STORAGE_EXT: 36708 - GL_SHADER_SOURCE_LENGTH: 35720 - GL_SHADER_TYPE: 35663 - GL_SHADING_LANGUAGE_VERSION: 35724 - GL_SHARED_EDGE_NV: 192 - GL_SHORT: 5122 - GL_SIGNALED_APPLE: 37145 - GL_SKIP_DECODE_EXT: 35402 - GL_SKIP_MISSING_GLYPH_NV: 37033 - GL_SLUMINANCE_ALPHA_NV: 35908 - GL_SLUMINANCE_NV: 35910 - GL_SLUMINANCE8_ALPHA8_NV: 35909 - GL_SLUMINANCE8_NV: 35911 - GL_SMALL_CCW_ARC_TO_NV: 18 - GL_SMALL_CW_ARC_TO_NV: 20 - GL_SMAPHS_PROGRAM_BINARY_DMP: 37458 - GL_SMAPHS30_PROGRAM_BINARY_DMP: 37457 - GL_SMOOTH_CUBIC_CURVE_TO_NV: 16 - GL_SMOOTH_QUADRATIC_CURVE_TO_NV: 14 - GL_SOFTLIGHT_KHR: 37532 - GL_SOFTLIGHT_NV: 37532 - GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT: 37289 - GL_SQUARE_NV: 37027 - GL_SR8_EXT: 36797 - GL_SRC_ALPHA: 770 - GL_SRC_ALPHA_SATURATE: 776 - GL_SRC_ALPHA_SATURATE_EXT: 776 - GL_SRC_ATOP_NV: 37518 - GL_SRC_COLOR: 768 - GL_SRC_IN_NV: 37514 - GL_SRC_NV: 37510 - GL_SRC_OUT_NV: 37516 - GL_SRC_OVER_NV: 37512 - GL_SRC1_ALPHA_EXT: 34185 - GL_SRC1_COLOR_EXT: 35065 - GL_SRG8_EXT: 36798 - GL_SRGB_ALPHA_EXT: 35906 - GL_SRGB_EXT: 35904 - GL_SRGB8_ALPHA8_EXT: 35907 - GL_SRGB8_NV: 35905 - GL_STACK_OVERFLOW_KHR: 1283 - GL_STACK_UNDERFLOW_KHR: 1284 - GL_STANDARD_FONT_FORMAT_NV: 37740 - GL_STANDARD_FONT_NAME_NV: 36978 - GL_STATE_RESTORE: 35804 - GL_STATIC_DRAW: 35044 - GL_STENCIL_ATTACHMENT: 36128 - GL_STENCIL_BACK_FAIL: 34817 - GL_STENCIL_BACK_FUNC: 34816 - GL_STENCIL_BACK_PASS_DEPTH_FAIL: 34818 - GL_STENCIL_BACK_PASS_DEPTH_PASS: 34819 - GL_STENCIL_BACK_REF: 36003 - GL_STENCIL_BACK_VALUE_MASK: 36004 - GL_STENCIL_BACK_WRITEMASK: 36005 - GL_STENCIL_BITS: 3415 - GL_STENCIL_BUFFER_BIT: 1024 - GL_STENCIL_BUFFER_BIT0_QCOM: 65536 - GL_STENCIL_BUFFER_BIT1_QCOM: 131072 - GL_STENCIL_BUFFER_BIT2_QCOM: 262144 - GL_STENCIL_BUFFER_BIT3_QCOM: 524288 - GL_STENCIL_BUFFER_BIT4_QCOM: 1048576 - GL_STENCIL_BUFFER_BIT5_QCOM: 2097152 - GL_STENCIL_BUFFER_BIT6_QCOM: 4194304 - GL_STENCIL_BUFFER_BIT7_QCOM: 8388608 - GL_STENCIL_CLEAR_VALUE: 2961 - GL_STENCIL_EXT: 6146 - GL_STENCIL_FAIL: 2964 - GL_STENCIL_FUNC: 2962 - GL_STENCIL_INDEX_OES: 6401 - GL_STENCIL_INDEX1_OES: 36166 - GL_STENCIL_INDEX4_OES: 36167 - GL_STENCIL_INDEX8: 36168 - GL_STENCIL_INDEX8_OES: 36168 - GL_STENCIL_PASS_DEPTH_FAIL: 2965 - GL_STENCIL_PASS_DEPTH_PASS: 2966 - GL_STENCIL_REF: 2967 - GL_STENCIL_SAMPLES_NV: 37678 - GL_STENCIL_TEST: 2960 - GL_STENCIL_VALUE_MASK: 2963 - GL_STENCIL_WRITEMASK: 2968 - GL_STREAM_DRAW: 35040 - GL_SUBPIXEL_BITS: 3408 - GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV: 37703 - GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV: 37704 - GL_SUPERSAMPLE_SCALE_X_NV: 37746 - GL_SUPERSAMPLE_SCALE_Y_NV: 37747 - GL_SYNC_CONDITION_APPLE: 37139 - GL_SYNC_FENCE_APPLE: 37142 - GL_SYNC_FLAGS_APPLE: 37141 - GL_SYNC_FLUSH_COMMANDS_BIT_APPLE: 1 - GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE: 37143 - GL_SYNC_OBJECT_APPLE: 35411 - GL_SYNC_STATUS_APPLE: 37140 - GL_SYSTEM_FONT_NAME_NV: 36979 - GL_TESS_CONTROL_OUTPUT_VERTICES_EXT: 36469 - GL_TESS_CONTROL_OUTPUT_VERTICES_OES: 36469 - GL_TESS_CONTROL_SHADER_BIT_EXT: 8 - GL_TESS_CONTROL_SHADER_BIT_OES: 8 - GL_TESS_CONTROL_SHADER_EXT: 36488 - GL_TESS_CONTROL_SHADER_OES: 36488 - GL_TESS_EVALUATION_SHADER_BIT_EXT: 16 - GL_TESS_EVALUATION_SHADER_BIT_OES: 16 - GL_TESS_EVALUATION_SHADER_EXT: 36487 - GL_TESS_EVALUATION_SHADER_OES: 36487 - GL_TESS_GEN_MODE_EXT: 36470 - GL_TESS_GEN_MODE_OES: 36470 - GL_TESS_GEN_POINT_MODE_EXT: 36473 - GL_TESS_GEN_POINT_MODE_OES: 36473 - GL_TESS_GEN_SPACING_EXT: 36471 - GL_TESS_GEN_SPACING_OES: 36471 - GL_TESS_GEN_VERTEX_ORDER_EXT: 36472 - GL_TESS_GEN_VERTEX_ORDER_OES: 36472 - GL_TEXTURE: 5890 - GL_TEXTURE_2D: 3553 - GL_TEXTURE_2D_ARRAY: 35866 - GL_TEXTURE_2D_MULTISAMPLE: 37120 - GL_TEXTURE_2D_MULTISAMPLE_ARRAY: 37122 - GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES: 37122 - GL_TEXTURE_3D: 32879 - GL_TEXTURE_3D_OES: 32879 - GL_TEXTURE_ASTC_DECODE_PRECISION_EXT: 36713 - GL_TEXTURE_BINDING_2D: 32873 - GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES: 37125 - GL_TEXTURE_BINDING_3D_OES: 32874 - GL_TEXTURE_BINDING_BUFFER_EXT: 35884 - GL_TEXTURE_BINDING_BUFFER_OES: 35884 - GL_TEXTURE_BINDING_CUBE_MAP: 34068 - GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT: 36874 - GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES: 36874 - GL_TEXTURE_BINDING_EXTERNAL_OES: 36199 - GL_TEXTURE_BORDER_COLOR_EXT: 4100 - GL_TEXTURE_BORDER_COLOR_NV: 4100 - GL_TEXTURE_BORDER_COLOR_OES: 4100 - GL_TEXTURE_BUFFER_BINDING_EXT: 35882 - GL_TEXTURE_BUFFER_BINDING_OES: 35882 - GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT: 35885 - GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES: 35885 - GL_TEXTURE_BUFFER_EXT: 35882 - GL_TEXTURE_BUFFER_OES: 35882 - GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT: 37279 - GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES: 37279 - GL_TEXTURE_BUFFER_OFFSET_EXT: 37277 - GL_TEXTURE_BUFFER_OFFSET_OES: 37277 - GL_TEXTURE_BUFFER_SIZE_EXT: 37278 - GL_TEXTURE_BUFFER_SIZE_OES: 37278 - GL_TEXTURE_COMPARE_FUNC_EXT: 34893 - GL_TEXTURE_COMPARE_MODE_EXT: 34892 - GL_TEXTURE_CUBE_MAP: 34067 - GL_TEXTURE_CUBE_MAP_ARRAY_EXT: 36873 - GL_TEXTURE_CUBE_MAP_ARRAY_OES: 36873 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 34070 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 34072 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 34074 - GL_TEXTURE_CUBE_MAP_POSITIVE_X: 34069 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 34071 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 34073 - GL_TEXTURE_DEPTH_QCOM: 35796 - GL_TEXTURE_EXTERNAL_OES: 36197 - GL_TEXTURE_FORMAT_QCOM: 35798 - GL_TEXTURE_FORMAT_SRGB_OVERRIDE_EXT: 36799 - GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM: 35835 - GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM: 35837 - GL_TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM: 35836 - GL_TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM: 35838 - GL_TEXTURE_HEIGHT_QCOM: 35795 - GL_TEXTURE_IMAGE_VALID_QCOM: 35800 - GL_TEXTURE_IMMUTABLE_FORMAT_EXT: 37167 - GL_TEXTURE_IMMUTABLE_LEVELS: 33503 - GL_TEXTURE_INTERNAL_FORMAT_QCOM: 35797 - GL_TEXTURE_MAG_FILTER: 10240 - GL_TEXTURE_MAX_ANISOTROPY_EXT: 34046 - GL_TEXTURE_MAX_LEVEL_APPLE: 33085 - GL_TEXTURE_MIN_FILTER: 10241 - GL_TEXTURE_NUM_LEVELS_QCOM: 35801 - GL_TEXTURE_OBJECT_VALID_QCOM: 35803 - GL_TEXTURE_PROTECTED_EXT: 35834 - GL_TEXTURE_REDUCTION_MODE_EXT: 37734 - GL_TEXTURE_SAMPLES_IMG: 37174 - GL_TEXTURE_SPARSE_EXT: 37286 - GL_TEXTURE_SRGB_DECODE_EXT: 35400 - GL_TEXTURE_TARGET_QCOM: 35802 - GL_TEXTURE_TILING_EXT: 38272 - GL_TEXTURE_TYPE_QCOM: 35799 - GL_TEXTURE_USAGE_ANGLE: 37794 - GL_TEXTURE_VIEW_MIN_LAYER_EXT: 33501 - GL_TEXTURE_VIEW_MIN_LAYER_OES: 33501 - GL_TEXTURE_VIEW_MIN_LEVEL_EXT: 33499 - GL_TEXTURE_VIEW_MIN_LEVEL_OES: 33499 - GL_TEXTURE_VIEW_NUM_LAYERS_EXT: 33502 - GL_TEXTURE_VIEW_NUM_LAYERS_OES: 33502 - GL_TEXTURE_VIEW_NUM_LEVELS_EXT: 33500 - GL_TEXTURE_VIEW_NUM_LEVELS_OES: 33500 - GL_TEXTURE_WIDTH_QCOM: 35794 - GL_TEXTURE_WRAP_R_OES: 32882 - GL_TEXTURE_WRAP_S: 10242 - GL_TEXTURE_WRAP_T: 10243 - GL_TEXTURE0: 33984 - GL_TEXTURE1: 33985 - GL_TEXTURE2: 33986 - GL_TEXTURE3: 33987 - GL_TEXTURE4: 33988 - GL_TEXTURE5: 33989 - GL_TEXTURE6: 33990 - GL_TEXTURE7: 33991 - GL_TEXTURE8: 33992 - GL_TEXTURE9: 33993 - GL_TEXTURE10: 33994 - GL_TEXTURE11: 33995 - GL_TEXTURE12: 33996 - GL_TEXTURE13: 33997 - GL_TEXTURE14: 33998 - GL_TEXTURE15: 33999 - GL_TEXTURE16: 34000 - GL_TEXTURE17: 34001 - GL_TEXTURE18: 34002 - GL_TEXTURE19: 34003 - GL_TEXTURE20: 34004 - GL_TEXTURE21: 34005 - GL_TEXTURE22: 34006 - GL_TEXTURE23: 34007 - GL_TEXTURE24: 34008 - GL_TEXTURE25: 34009 - GL_TEXTURE26: 34010 - GL_TEXTURE27: 34011 - GL_TEXTURE28: 34012 - GL_TEXTURE29: 34013 - GL_TEXTURE30: 34014 - GL_TEXTURE31: 34015 - GL_TILING_TYPES_EXT: 38275 - GL_TIME_ELAPSED_EXT: 35007 - GL_TIMEOUT_EXPIRED_APPLE: 37147 - GL_TIMEOUT_IGNORED_APPLE: -1 - GL_TIMESTAMP_EXT: 36392 - GL_TRANSFORM_FEEDBACK: 36386 - GL_TRANSLATE_2D_NV: 37008 - GL_TRANSLATE_3D_NV: 37009 - GL_TRANSLATE_X_NV: 37006 - GL_TRANSLATE_Y_NV: 37007 - GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: 37792 - GL_TRANSPOSE_AFFINE_2D_NV: 37014 - GL_TRANSPOSE_AFFINE_3D_NV: 37016 - GL_TRIANGLE_FAN: 6 - GL_TRIANGLE_STRIP: 5 - GL_TRIANGLE_STRIP_ADJACENCY_EXT: 13 - GL_TRIANGLE_STRIP_ADJACENCY_OES: 13 - GL_TRIANGLES: 4 - GL_TRIANGLES_ADJACENCY_EXT: 12 - GL_TRIANGLES_ADJACENCY_OES: 12 - GL_TRIANGULAR_NV: 37029 - GL_TRUE: 1 - GL_UNCORRELATED_NV: 37506 - GL_UNDEFINED_VERTEX_EXT: 33376 - GL_UNDEFINED_VERTEX_OES: 33376 - GL_UNKNOWN_CONTEXT_RESET_EXT: 33365 - GL_UNKNOWN_CONTEXT_RESET_KHR: 33365 - GL_UNPACK_ALIGNMENT: 3317 - GL_UNPACK_ROW_LENGTH_EXT: 3314 - GL_UNPACK_SKIP_PIXELS_EXT: 3316 - GL_UNPACK_SKIP_ROWS_EXT: 3315 - GL_UNSIGNALED_APPLE: 37144 - GL_UNSIGNED_BYTE: 5121 - GL_UNSIGNED_INT: 5125 - GL_UNSIGNED_INT_2_10_10_10_REV_EXT: 33640 - GL_UNSIGNED_INT_5_9_9_9_REV_APPLE: 35902 - GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE: 35899 - GL_UNSIGNED_INT_10_10_10_2_OES: 36342 - GL_UNSIGNED_INT_24_8_OES: 34042 - GL_UNSIGNED_INT_IMAGE_BUFFER_EXT: 36967 - GL_UNSIGNED_INT_IMAGE_BUFFER_OES: 36967 - GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT: 36970 - GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES: 36970 - GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES: 37133 - GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT: 36312 - GL_UNSIGNED_INT_SAMPLER_BUFFER_OES: 36312 - GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT: 36879 - GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES: 36879 - GL_UNSIGNED_INT8_NV: 36844 - GL_UNSIGNED_INT8_VEC2_NV: 36845 - GL_UNSIGNED_INT8_VEC3_NV: 36846 - GL_UNSIGNED_INT8_VEC4_NV: 36847 - GL_UNSIGNED_INT16_NV: 36848 - GL_UNSIGNED_INT16_VEC2_NV: 36849 - GL_UNSIGNED_INT16_VEC3_NV: 36850 - GL_UNSIGNED_INT16_VEC4_NV: 36851 - GL_UNSIGNED_INT64_AMD: 35778 - GL_UNSIGNED_INT64_NV: 5135 - GL_UNSIGNED_INT64_VEC2_NV: 36853 - GL_UNSIGNED_INT64_VEC3_NV: 36854 - GL_UNSIGNED_INT64_VEC4_NV: 36855 - GL_UNSIGNED_NORMALIZED_EXT: 35863 - GL_UNSIGNED_SHORT: 5123 - GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: 33638 - GL_UNSIGNED_SHORT_4_4_4_4: 32819 - GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: 33637 - GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG: 33637 - GL_UNSIGNED_SHORT_5_5_5_1: 32820 - GL_UNSIGNED_SHORT_5_6_5: 33635 - GL_UNSIGNED_SHORT_8_8_APPLE: 34234 - GL_UNSIGNED_SHORT_8_8_REV_APPLE: 34235 - GL_UPPER_LEFT_EXT: 36002 - GL_USE_MISSING_GLYPH_NV: 37034 - GL_UTF8_NV: 37018 - GL_UTF16_NV: 37019 - GL_UUID_SIZE_EXT: 16 - GL_VALIDATE_STATUS: 35715 - GL_VENDOR: 7936 - GL_VERSION: 7938 - GL_VERTEX_ARRAY_BINDING_OES: 34229 - GL_VERTEX_ARRAY_KHR: 32884 - GL_VERTEX_ARRAY_OBJECT_EXT: 37204 - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 34975 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 35070 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT: 35070 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV: 35070 - GL_VERTEX_ATTRIB_ARRAY_ENABLED: 34338 - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: 34922 - GL_VERTEX_ATTRIB_ARRAY_POINTER: 34373 - GL_VERTEX_ATTRIB_ARRAY_SIZE: 34339 - GL_VERTEX_ATTRIB_ARRAY_STRIDE: 34340 - GL_VERTEX_ATTRIB_ARRAY_TYPE: 34341 - GL_VERTEX_SHADER: 35633 - GL_VERTEX_SHADER_BIT_EXT: 1 - GL_VERTICAL_LINE_TO_NV: 8 - GL_VIEWPORT: 2978 - GL_VIEWPORT_BOUNDS_RANGE_NV: 33373 - GL_VIEWPORT_BOUNDS_RANGE_OES: 33373 - GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV: 33375 - GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES: 33375 - GL_VIEWPORT_POSITION_W_SCALE_NV: 37756 - GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV: 37757 - GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV: 37758 - GL_VIEWPORT_SUBPIXEL_BITS_NV: 33372 - GL_VIEWPORT_SUBPIXEL_BITS_OES: 33372 - GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV: 37719 - GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV: 37713 - GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV: 37715 - GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV: 37717 - GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV: 37718 - GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV: 37712 - GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV: 37714 - GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV: 37716 - GL_VIEWPORT_SWIZZLE_W_NV: 37723 - GL_VIEWPORT_SWIZZLE_X_NV: 37720 - GL_VIEWPORT_SWIZZLE_Y_NV: 37721 - GL_VIEWPORT_SWIZZLE_Z_NV: 37722 - GL_VIRTUAL_PAGE_SIZE_INDEX_EXT: 37287 - GL_VIRTUAL_PAGE_SIZE_X_EXT: 37269 - GL_VIRTUAL_PAGE_SIZE_Y_EXT: 37270 - GL_VIRTUAL_PAGE_SIZE_Z_EXT: 37271 - GL_VIVIDLIGHT_NV: 37542 - GL_WAIT_FAILED_APPLE: 37149 - GL_WEIGHTED_AVERAGE_EXT: 37735 - GL_WINDOW_RECTANGLE_EXT: 36626 - GL_WINDOW_RECTANGLE_MODE_EXT: 36627 - GL_WRITE_ONLY_OES: 35001 - GL_WRITEONLY_RENDERING_QCOM: 34851 - GL_XOR_NV: 5382 - GL_Z400_BINARY_AMD: 34624 - GL_ZERO: 0 - GL_ZERO_TO_ONE_EXT: 37727 diff --git a/spec/generated/gles3.yaml b/spec/generated/gles3.yaml deleted file mode 100644 index cc873b8..0000000 --- a/spec/generated/gles3.yaml +++ /dev/null @@ -1,3691 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: gles3 -source_package: github.com/AndroidGoLab/ndk/capi/gles3 -types: - GLbitfield: - kind: typedef_uint32 - c_type: GLbitfield - go_type: uint32 - GLboolean: - kind: typedef_uint8 - c_type: GLboolean - go_type: uint8 - GLbyte: - kind: typedef_khronos_int8_t - c_type: GLbyte - go_type: khronos_int8_t - GLchar: - kind: typedef_int8 - c_type: GLchar - go_type: int8 - GLclampf: - kind: typedef_khronos_float_t - c_type: GLclampf - go_type: khronos_float_t - GLenum: - kind: typedef_uint32 - c_type: GLenum - go_type: uint32 - GLfixed: - kind: typedef_khronos_int32_t - c_type: GLfixed - go_type: khronos_int32_t - GLfloat: - kind: typedef_khronos_float_t - c_type: GLfloat - go_type: khronos_float_t - GLhalf: - kind: typedef_uint16 - c_type: GLhalf - go_type: uint16 - GLint: - kind: typedef_int32 - c_type: GLint - go_type: int32 - GLint64: - kind: typedef_khronos_int64_t - c_type: GLint64 - go_type: khronos_int64_t - GLintptr: - kind: typedef_khronos_intptr_t - c_type: GLintptr - go_type: khronos_intptr_t - GLshort: - kind: typedef_int16 - c_type: GLshort - go_type: int16 - GLsizei: - kind: typedef_int32 - c_type: GLsizei - go_type: int32 - GLsizeiptr: - kind: typedef_khronos_ssize_t - c_type: GLsizeiptr - go_type: khronos_ssize_t - GLsync: - kind: typedef_*__GLsync - c_type: GLsync - go_type: '*__GLsync' - GLubyte: - kind: typedef_khronos_uint8_t - c_type: GLubyte - go_type: khronos_uint8_t - GLuint: - kind: typedef_uint32 - c_type: GLuint - go_type: uint32 - GLuint64: - kind: typedef_khronos_uint64_t - c_type: GLuint64 - go_type: khronos_uint64_t - GLushort: - kind: typedef_uint16 - c_type: GLushort - go_type: uint16 -functions: - glActiveTexture: - c_name: glActiveTexture - params: - - name: texture - type: GLenum - returns: "" - glAttachShader: - c_name: glAttachShader - params: - - name: program - type: GLuint - - name: shader - type: GLuint - returns: "" - glBeginQuery: - c_name: glBeginQuery - params: - - name: target - type: GLenum - - name: id - type: GLuint - returns: "" - glBeginTransformFeedback: - c_name: glBeginTransformFeedback - params: - - name: primitiveMode - type: GLenum - returns: "" - glBindAttribLocation: - c_name: glBindAttribLocation - params: - - name: program - type: GLuint - - name: index - type: GLuint - - name: name - type: '*GLchar' - returns: "" - glBindBuffer: - c_name: glBindBuffer - params: - - name: target - type: GLenum - - name: buffer - type: GLuint - returns: "" - glBindBufferBase: - c_name: glBindBufferBase - params: - - name: target - type: GLenum - - name: index - type: GLuint - - name: buffer - type: GLuint - returns: "" - glBindBufferRange: - c_name: glBindBufferRange - params: - - name: target - type: GLenum - - name: index - type: GLuint - - name: buffer - type: GLuint - - name: offset - type: GLintptr - - name: size - type: GLsizeiptr - returns: "" - glBindFramebuffer: - c_name: glBindFramebuffer - params: - - name: target - type: GLenum - - name: framebuffer - type: GLuint - returns: "" - glBindRenderbuffer: - c_name: glBindRenderbuffer - params: - - name: target - type: GLenum - - name: renderbuffer - type: GLuint - returns: "" - glBindSampler: - c_name: glBindSampler - params: - - name: unit - type: GLuint - - name: sampler - type: GLuint - returns: "" - glBindTexture: - c_name: glBindTexture - params: - - name: target - type: GLenum - - name: texture - type: GLuint - returns: "" - glBindTransformFeedback: - c_name: glBindTransformFeedback - params: - - name: target - type: GLenum - - name: id - type: GLuint - returns: "" - glBindVertexArray: - c_name: glBindVertexArray - params: - - name: array - type: GLuint - returns: "" - glBlendColor: - c_name: glBlendColor - params: - - name: red - type: GLfloat - - name: green - type: GLfloat - - name: blue - type: GLfloat - - name: alpha - type: GLfloat - returns: "" - glBlendEquation: - c_name: glBlendEquation - params: - - name: mode - type: GLenum - returns: "" - glBlendEquationSeparate: - c_name: glBlendEquationSeparate - params: - - name: modeRGB - type: GLenum - - name: modeAlpha - type: GLenum - returns: "" - glBlendFunc: - c_name: glBlendFunc - params: - - name: sfactor - type: GLenum - - name: dfactor - type: GLenum - returns: "" - glBlendFuncSeparate: - c_name: glBlendFuncSeparate - params: - - name: sfactorRGB - type: GLenum - - name: dfactorRGB - type: GLenum - - name: sfactorAlpha - type: GLenum - - name: dfactorAlpha - type: GLenum - returns: "" - glBlitFramebuffer: - c_name: glBlitFramebuffer - params: - - name: srcX0 - type: GLint - - name: srcY0 - type: GLint - - name: srcX1 - type: GLint - - name: srcY1 - type: GLint - - name: dstX0 - type: GLint - - name: dstY0 - type: GLint - - name: dstX1 - type: GLint - - name: dstY1 - type: GLint - - name: mask - type: GLbitfield - - name: filter - type: GLenum - returns: "" - glBufferData: - c_name: glBufferData - params: - - name: target - type: GLenum - - name: size - type: GLsizeiptr - - name: data - type: unsafe.Pointer - - name: usage - type: GLenum - returns: "" - glBufferSubData: - c_name: glBufferSubData - params: - - name: target - type: GLenum - - name: offset - type: GLintptr - - name: size - type: GLsizeiptr - - name: data - type: unsafe.Pointer - returns: "" - glCheckFramebufferStatus: - c_name: glCheckFramebufferStatus - params: - - name: target - type: GLenum - returns: GLenum - glClear: - c_name: glClear - params: - - name: mask - type: GLbitfield - returns: "" - glClearBufferfi: - c_name: glClearBufferfi - params: - - name: buffer - type: GLenum - - name: drawbuffer - type: GLint - - name: depth - type: GLfloat - - name: stencil - type: GLint - returns: "" - glClearBufferfv: - c_name: glClearBufferfv - params: - - name: buffer - type: GLenum - - name: drawbuffer - type: GLint - - name: value - type: '*GLfloat' - returns: "" - glClearBufferiv: - c_name: glClearBufferiv - params: - - name: buffer - type: GLenum - - name: drawbuffer - type: GLint - - name: value - type: '*GLint' - returns: "" - glClearBufferuiv: - c_name: glClearBufferuiv - params: - - name: buffer - type: GLenum - - name: drawbuffer - type: GLint - - name: value - type: '*GLuint' - returns: "" - glClearColor: - c_name: glClearColor - params: - - name: red - type: GLfloat - - name: green - type: GLfloat - - name: blue - type: GLfloat - - name: alpha - type: GLfloat - returns: "" - glClearDepthf: - c_name: glClearDepthf - params: - - name: d - type: GLfloat - returns: "" - glClearStencil: - c_name: glClearStencil - params: - - name: s - type: GLint - returns: "" - glClientWaitSync: - c_name: glClientWaitSync - params: - - name: sync - type: GLsync - - name: flags - type: GLbitfield - - name: timeout - type: GLuint64 - returns: GLenum - glColorMask: - c_name: glColorMask - params: - - name: red - type: GLboolean - - name: green - type: GLboolean - - name: blue - type: GLboolean - - name: alpha - type: GLboolean - returns: "" - glCompileShader: - c_name: glCompileShader - params: - - name: shader - type: GLuint - returns: "" - glCompressedTexImage2D: - c_name: glCompressedTexImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: internalformat - type: GLenum - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: border - type: GLint - - name: imageSize - type: GLsizei - - name: data - type: unsafe.Pointer - returns: "" - glCompressedTexImage3D: - c_name: glCompressedTexImage3D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: internalformat - type: GLenum - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: depth - type: GLsizei - - name: border - type: GLint - - name: imageSize - type: GLsizei - - name: data - type: unsafe.Pointer - returns: "" - glCompressedTexSubImage2D: - c_name: glCompressedTexSubImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: format - type: GLenum - - name: imageSize - type: GLsizei - - name: data - type: unsafe.Pointer - returns: "" - glCompressedTexSubImage3D: - c_name: glCompressedTexSubImage3D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: zoffset - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: depth - type: GLsizei - - name: format - type: GLenum - - name: imageSize - type: GLsizei - - name: data - type: unsafe.Pointer - returns: "" - glCopyBufferSubData: - c_name: glCopyBufferSubData - params: - - name: readTarget - type: GLenum - - name: writeTarget - type: GLenum - - name: readOffset - type: GLintptr - - name: writeOffset - type: GLintptr - - name: size - type: GLsizeiptr - returns: "" - glCopyTexImage2D: - c_name: glCopyTexImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: internalformat - type: GLenum - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: border - type: GLint - returns: "" - glCopyTexSubImage2D: - c_name: glCopyTexSubImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glCopyTexSubImage3D: - c_name: glCopyTexSubImage3D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: zoffset - type: GLint - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glCreateProgram: - c_name: glCreateProgram - returns: GLuint - glCreateShader: - c_name: glCreateShader - params: - - name: type - type: GLenum - returns: GLuint - glCullFace: - c_name: glCullFace - params: - - name: mode - type: GLenum - returns: "" - glDeleteBuffers: - c_name: glDeleteBuffers - params: - - name: "n" - type: GLsizei - - name: buffers - type: '*GLuint' - returns: "" - glDeleteFramebuffers: - c_name: glDeleteFramebuffers - params: - - name: "n" - type: GLsizei - - name: framebuffers - type: '*GLuint' - returns: "" - glDeleteProgram: - c_name: glDeleteProgram - params: - - name: program - type: GLuint - returns: "" - glDeleteQueries: - c_name: glDeleteQueries - params: - - name: "n" - type: GLsizei - - name: ids - type: '*GLuint' - returns: "" - glDeleteRenderbuffers: - c_name: glDeleteRenderbuffers - params: - - name: "n" - type: GLsizei - - name: renderbuffers - type: '*GLuint' - returns: "" - glDeleteSamplers: - c_name: glDeleteSamplers - params: - - name: count - type: GLsizei - - name: samplers - type: '*GLuint' - returns: "" - glDeleteShader: - c_name: glDeleteShader - params: - - name: shader - type: GLuint - returns: "" - glDeleteSync: - c_name: glDeleteSync - params: - - name: sync - type: GLsync - returns: "" - glDeleteTextures: - c_name: glDeleteTextures - params: - - name: "n" - type: GLsizei - - name: textures - type: '*GLuint' - returns: "" - glDeleteTransformFeedbacks: - c_name: glDeleteTransformFeedbacks - params: - - name: "n" - type: GLsizei - - name: ids - type: '*GLuint' - returns: "" - glDeleteVertexArrays: - c_name: glDeleteVertexArrays - params: - - name: "n" - type: GLsizei - - name: arrays - type: '*GLuint' - returns: "" - glDepthFunc: - c_name: glDepthFunc - params: - - name: func - type: GLenum - returns: "" - glDepthMask: - c_name: glDepthMask - params: - - name: flag - type: GLboolean - returns: "" - glDepthRangef: - c_name: glDepthRangef - params: - - name: "n" - type: GLfloat - - name: f - type: GLfloat - returns: "" - glDetachShader: - c_name: glDetachShader - params: - - name: program - type: GLuint - - name: shader - type: GLuint - returns: "" - glDisable: - c_name: glDisable - params: - - name: cap - type: GLenum - returns: "" - glDisableVertexAttribArray: - c_name: glDisableVertexAttribArray - params: - - name: index - type: GLuint - returns: "" - glDrawArrays: - c_name: glDrawArrays - params: - - name: mode - type: GLenum - - name: first - type: GLint - - name: count - type: GLsizei - returns: "" - glDrawArraysInstanced: - c_name: glDrawArraysInstanced - params: - - name: mode - type: GLenum - - name: first - type: GLint - - name: count - type: GLsizei - - name: instancecount - type: GLsizei - returns: "" - glDrawBuffers: - c_name: glDrawBuffers - params: - - name: "n" - type: GLsizei - - name: bufs - type: '*GLenum' - returns: "" - glDrawElements: - c_name: glDrawElements - params: - - name: mode - type: GLenum - - name: count - type: GLsizei - - name: type - type: GLenum - - name: indices - type: unsafe.Pointer - returns: "" - glDrawElementsInstanced: - c_name: glDrawElementsInstanced - params: - - name: mode - type: GLenum - - name: count - type: GLsizei - - name: type - type: GLenum - - name: indices - type: unsafe.Pointer - - name: instancecount - type: GLsizei - returns: "" - glDrawRangeElements: - c_name: glDrawRangeElements - params: - - name: mode - type: GLenum - - name: start - type: GLuint - - name: end - type: GLuint - - name: count - type: GLsizei - - name: type - type: GLenum - - name: indices - type: unsafe.Pointer - returns: "" - glEnable: - c_name: glEnable - params: - - name: cap - type: GLenum - returns: "" - glEnableVertexAttribArray: - c_name: glEnableVertexAttribArray - params: - - name: index - type: GLuint - returns: "" - glEndQuery: - c_name: glEndQuery - params: - - name: target - type: GLenum - returns: "" - glEndTransformFeedback: - c_name: glEndTransformFeedback - returns: "" - glFenceSync: - c_name: glFenceSync - params: - - name: condition - type: GLenum - - name: flags - type: GLbitfield - returns: GLsync - glFinish: - c_name: glFinish - returns: "" - glFlush: - c_name: glFlush - returns: "" - glFlushMappedBufferRange: - c_name: glFlushMappedBufferRange - params: - - name: target - type: GLenum - - name: offset - type: GLintptr - - name: length - type: GLsizeiptr - returns: "" - glFramebufferRenderbuffer: - c_name: glFramebufferRenderbuffer - params: - - name: target - type: GLenum - - name: attachment - type: GLenum - - name: renderbuffertarget - type: GLenum - - name: renderbuffer - type: GLuint - returns: "" - glFramebufferTexture2D: - c_name: glFramebufferTexture2D - params: - - name: target - type: GLenum - - name: attachment - type: GLenum - - name: textarget - type: GLenum - - name: texture - type: GLuint - - name: level - type: GLint - returns: "" - glFramebufferTextureLayer: - c_name: glFramebufferTextureLayer - params: - - name: target - type: GLenum - - name: attachment - type: GLenum - - name: texture - type: GLuint - - name: level - type: GLint - - name: layer - type: GLint - returns: "" - glFrontFace: - c_name: glFrontFace - params: - - name: mode - type: GLenum - returns: "" - glGenBuffers: - c_name: glGenBuffers - params: - - name: "n" - type: GLsizei - - name: buffers - type: '*GLuint' - returns: "" - glGenFramebuffers: - c_name: glGenFramebuffers - params: - - name: "n" - type: GLsizei - - name: framebuffers - type: '*GLuint' - returns: "" - glGenQueries: - c_name: glGenQueries - params: - - name: "n" - type: GLsizei - - name: ids - type: '*GLuint' - returns: "" - glGenRenderbuffers: - c_name: glGenRenderbuffers - params: - - name: "n" - type: GLsizei - - name: renderbuffers - type: '*GLuint' - returns: "" - glGenSamplers: - c_name: glGenSamplers - params: - - name: count - type: GLsizei - - name: samplers - type: '*GLuint' - returns: "" - glGenTextures: - c_name: glGenTextures - params: - - name: "n" - type: GLsizei - - name: textures - type: '*GLuint' - returns: "" - glGenTransformFeedbacks: - c_name: glGenTransformFeedbacks - params: - - name: "n" - type: GLsizei - - name: ids - type: '*GLuint' - returns: "" - glGenVertexArrays: - c_name: glGenVertexArrays - params: - - name: "n" - type: GLsizei - - name: arrays - type: '*GLuint' - returns: "" - glGenerateMipmap: - c_name: glGenerateMipmap - params: - - name: target - type: GLenum - returns: "" - glGetActiveAttrib: - c_name: glGetActiveAttrib - params: - - name: program - type: GLuint - - name: index - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: size - type: '*GLint' - - name: type - type: '*GLenum' - - name: name - type: '*GLchar' - returns: "" - glGetActiveUniform: - c_name: glGetActiveUniform - params: - - name: program - type: GLuint - - name: index - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: size - type: '*GLint' - - name: type - type: '*GLenum' - - name: name - type: '*GLchar' - returns: "" - glGetActiveUniformBlockName: - c_name: glGetActiveUniformBlockName - params: - - name: program - type: GLuint - - name: uniformBlockIndex - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: uniformBlockName - type: '*GLchar' - returns: "" - glGetActiveUniformBlockiv: - c_name: glGetActiveUniformBlockiv - params: - - name: program - type: GLuint - - name: uniformBlockIndex - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetActiveUniformsiv: - c_name: glGetActiveUniformsiv - params: - - name: program - type: GLuint - - name: uniformCount - type: GLsizei - - name: uniformIndices - type: '*GLuint' - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetAttachedShaders: - c_name: glGetAttachedShaders - params: - - name: program - type: GLuint - - name: maxCount - type: GLsizei - - name: count - type: '*GLsizei' - - name: shaders - type: '*GLuint' - returns: "" - glGetAttribLocation: - c_name: glGetAttribLocation - params: - - name: program - type: GLuint - - name: name - type: '*GLchar' - returns: GLint - glGetBooleanv: - c_name: glGetBooleanv - params: - - name: pname - type: GLenum - - name: data - type: '*GLboolean' - returns: "" - glGetBufferParameteri64v: - c_name: glGetBufferParameteri64v - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint64' - returns: "" - glGetBufferParameteriv: - c_name: glGetBufferParameteriv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetBufferPointerv: - c_name: glGetBufferPointerv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*unsafe.Pointer' - direction: out - returns: "" - glGetError: - c_name: glGetError - returns: GLenum - glGetFloatv: - c_name: glGetFloatv - params: - - name: pname - type: GLenum - - name: data - type: '*GLfloat' - returns: "" - glGetFragDataLocation: - c_name: glGetFragDataLocation - params: - - name: program - type: GLuint - - name: name - type: '*GLchar' - returns: GLint - glGetFramebufferAttachmentParameteriv: - c_name: glGetFramebufferAttachmentParameteriv - params: - - name: target - type: GLenum - - name: attachment - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetInteger64i_v: - c_name: glGetInteger64i_v - params: - - name: target - type: GLenum - - name: index - type: GLuint - - name: data - type: '*GLint64' - returns: "" - glGetInteger64v: - c_name: glGetInteger64v - params: - - name: pname - type: GLenum - - name: data - type: '*GLint64' - returns: "" - glGetIntegeri_v: - c_name: glGetIntegeri_v - params: - - name: target - type: GLenum - - name: index - type: GLuint - - name: data - type: '*GLint' - returns: "" - glGetIntegerv: - c_name: glGetIntegerv - params: - - name: pname - type: GLenum - - name: data - type: '*GLint' - returns: "" - glGetInternalformativ: - c_name: glGetInternalformativ - params: - - name: target - type: GLenum - - name: internalformat - type: GLenum - - name: pname - type: GLenum - - name: bufSize - type: GLsizei - - name: params - type: '*GLint' - returns: "" - glGetProgramBinary: - c_name: glGetProgramBinary - params: - - name: program - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: binaryFormat - type: '*GLenum' - - name: binary - type: unsafe.Pointer - returns: "" - glGetProgramInfoLog: - c_name: glGetProgramInfoLog - params: - - name: program - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: infoLog - type: '*GLchar' - returns: "" - glGetProgramiv: - c_name: glGetProgramiv - params: - - name: program - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetQueryObjectuiv: - c_name: glGetQueryObjectuiv - params: - - name: id - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLuint' - returns: "" - glGetQueryiv: - c_name: glGetQueryiv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetRenderbufferParameteriv: - c_name: glGetRenderbufferParameteriv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetSamplerParameterfv: - c_name: glGetSamplerParameterfv - params: - - name: sampler - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLfloat' - returns: "" - glGetSamplerParameteriv: - c_name: glGetSamplerParameteriv - params: - - name: sampler - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetShaderInfoLog: - c_name: glGetShaderInfoLog - params: - - name: shader - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: infoLog - type: '*GLchar' - returns: "" - glGetShaderPrecisionFormat: - c_name: glGetShaderPrecisionFormat - params: - - name: shadertype - type: GLenum - - name: precisiontype - type: GLenum - - name: range - type: '*GLint' - - name: precision - type: '*GLint' - returns: "" - glGetShaderSource: - c_name: glGetShaderSource - params: - - name: shader - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: source - type: '*GLchar' - returns: "" - glGetShaderiv: - c_name: glGetShaderiv - params: - - name: shader - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetString: - c_name: glGetString - params: - - name: name - type: GLenum - returns: '*GLubyte' - glGetStringi: - c_name: glGetStringi - params: - - name: name - type: GLenum - - name: index - type: GLuint - returns: '*GLubyte' - glGetSynciv: - c_name: glGetSynciv - params: - - name: sync - type: GLsync - - name: pname - type: GLenum - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: values - type: '*GLint' - returns: "" - glGetTexParameterfv: - c_name: glGetTexParameterfv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLfloat' - returns: "" - glGetTexParameteriv: - c_name: glGetTexParameteriv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetTransformFeedbackVarying: - c_name: glGetTransformFeedbackVarying - params: - - name: program - type: GLuint - - name: index - type: GLuint - - name: bufSize - type: GLsizei - - name: length - type: '*GLsizei' - - name: size - type: '*GLsizei' - - name: type - type: '*GLenum' - - name: name - type: '*GLchar' - returns: "" - glGetUniformBlockIndex: - c_name: glGetUniformBlockIndex - params: - - name: program - type: GLuint - - name: uniformBlockName - type: '*GLchar' - returns: GLuint - glGetUniformIndices: - c_name: glGetUniformIndices - params: - - name: program - type: GLuint - - name: uniformCount - type: GLsizei - - name: uniformNames - type: '**GLchar' - direction: out - - name: uniformIndices - type: '*GLuint' - returns: "" - glGetUniformLocation: - c_name: glGetUniformLocation - params: - - name: program - type: GLuint - - name: name - type: '*GLchar' - returns: GLint - glGetUniformfv: - c_name: glGetUniformfv - params: - - name: program - type: GLuint - - name: location - type: GLint - - name: params - type: '*GLfloat' - returns: "" - glGetUniformiv: - c_name: glGetUniformiv - params: - - name: program - type: GLuint - - name: location - type: GLint - - name: params - type: '*GLint' - returns: "" - glGetUniformuiv: - c_name: glGetUniformuiv - params: - - name: program - type: GLuint - - name: location - type: GLint - - name: params - type: '*GLuint' - returns: "" - glGetVertexAttribIiv: - c_name: glGetVertexAttribIiv - params: - - name: index - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glGetVertexAttribIuiv: - c_name: glGetVertexAttribIuiv - params: - - name: index - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLuint' - returns: "" - glGetVertexAttribPointerv: - c_name: glGetVertexAttribPointerv - params: - - name: index - type: GLuint - - name: pname - type: GLenum - - name: pointer - type: '*unsafe.Pointer' - direction: out - returns: "" - glGetVertexAttribfv: - c_name: glGetVertexAttribfv - params: - - name: index - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLfloat' - returns: "" - glGetVertexAttribiv: - c_name: glGetVertexAttribiv - params: - - name: index - type: GLuint - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glHint: - c_name: glHint - params: - - name: target - type: GLenum - - name: mode - type: GLenum - returns: "" - glInvalidateFramebuffer: - c_name: glInvalidateFramebuffer - params: - - name: target - type: GLenum - - name: numAttachments - type: GLsizei - - name: attachments - type: '*GLenum' - returns: "" - glInvalidateSubFramebuffer: - c_name: glInvalidateSubFramebuffer - params: - - name: target - type: GLenum - - name: numAttachments - type: GLsizei - - name: attachments - type: '*GLenum' - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glIsBuffer: - c_name: glIsBuffer - params: - - name: buffer - type: GLuint - returns: GLboolean - glIsEnabled: - c_name: glIsEnabled - params: - - name: cap - type: GLenum - returns: GLboolean - glIsFramebuffer: - c_name: glIsFramebuffer - params: - - name: framebuffer - type: GLuint - returns: GLboolean - glIsProgram: - c_name: glIsProgram - params: - - name: program - type: GLuint - returns: GLboolean - glIsQuery: - c_name: glIsQuery - params: - - name: id - type: GLuint - returns: GLboolean - glIsRenderbuffer: - c_name: glIsRenderbuffer - params: - - name: renderbuffer - type: GLuint - returns: GLboolean - glIsSampler: - c_name: glIsSampler - params: - - name: sampler - type: GLuint - returns: GLboolean - glIsShader: - c_name: glIsShader - params: - - name: shader - type: GLuint - returns: GLboolean - glIsSync: - c_name: glIsSync - params: - - name: sync - type: GLsync - returns: GLboolean - glIsTexture: - c_name: glIsTexture - params: - - name: texture - type: GLuint - returns: GLboolean - glIsTransformFeedback: - c_name: glIsTransformFeedback - params: - - name: id - type: GLuint - returns: GLboolean - glIsVertexArray: - c_name: glIsVertexArray - params: - - name: array - type: GLuint - returns: GLboolean - glLineWidth: - c_name: glLineWidth - params: - - name: width - type: GLfloat - returns: "" - glLinkProgram: - c_name: glLinkProgram - params: - - name: program - type: GLuint - returns: "" - glMapBufferRange: - c_name: glMapBufferRange - params: - - name: target - type: GLenum - - name: offset - type: GLintptr - - name: length - type: GLsizeiptr - - name: access - type: GLbitfield - returns: unsafe.Pointer - glPauseTransformFeedback: - c_name: glPauseTransformFeedback - returns: "" - glPixelStorei: - c_name: glPixelStorei - params: - - name: pname - type: GLenum - - name: param - type: GLint - returns: "" - glPolygonOffset: - c_name: glPolygonOffset - params: - - name: factor - type: GLfloat - - name: units - type: GLfloat - returns: "" - glProgramBinary: - c_name: glProgramBinary - params: - - name: program - type: GLuint - - name: binaryFormat - type: GLenum - - name: binary - type: unsafe.Pointer - - name: length - type: GLsizei - returns: "" - glProgramParameteri: - c_name: glProgramParameteri - params: - - name: program - type: GLuint - - name: pname - type: GLenum - - name: value - type: GLint - returns: "" - glReadBuffer: - c_name: glReadBuffer - params: - - name: src - type: GLenum - returns: "" - glReadPixels: - c_name: glReadPixels - params: - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: format - type: GLenum - - name: type - type: GLenum - - name: pixels - type: unsafe.Pointer - returns: "" - glReleaseShaderCompiler: - c_name: glReleaseShaderCompiler - returns: "" - glRenderbufferStorage: - c_name: glRenderbufferStorage - params: - - name: target - type: GLenum - - name: internalformat - type: GLenum - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glRenderbufferStorageMultisample: - c_name: glRenderbufferStorageMultisample - params: - - name: target - type: GLenum - - name: samples - type: GLsizei - - name: internalformat - type: GLenum - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glResumeTransformFeedback: - c_name: glResumeTransformFeedback - returns: "" - glSampleCoverage: - c_name: glSampleCoverage - params: - - name: value - type: GLfloat - - name: invert - type: GLboolean - returns: "" - glSamplerParameterf: - c_name: glSamplerParameterf - params: - - name: sampler - type: GLuint - - name: pname - type: GLenum - - name: param - type: GLfloat - returns: "" - glSamplerParameterfv: - c_name: glSamplerParameterfv - params: - - name: sampler - type: GLuint - - name: pname - type: GLenum - - name: param - type: '*GLfloat' - returns: "" - glSamplerParameteri: - c_name: glSamplerParameteri - params: - - name: sampler - type: GLuint - - name: pname - type: GLenum - - name: param - type: GLint - returns: "" - glSamplerParameteriv: - c_name: glSamplerParameteriv - params: - - name: sampler - type: GLuint - - name: pname - type: GLenum - - name: param - type: '*GLint' - returns: "" - glScissor: - c_name: glScissor - params: - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glShaderBinary: - c_name: glShaderBinary - params: - - name: count - type: GLsizei - - name: shaders - type: '*GLuint' - - name: binaryformat - type: GLenum - - name: binary - type: unsafe.Pointer - - name: length - type: GLsizei - returns: "" - glShaderSource: - c_name: glShaderSource - params: - - name: shader - type: GLuint - - name: count - type: GLsizei - - name: string - type: '**GLchar' - direction: out - - name: length - type: '*GLint' - returns: "" - glStencilFunc: - c_name: glStencilFunc - params: - - name: func - type: GLenum - - name: ref - type: GLint - - name: mask - type: GLuint - returns: "" - glStencilFuncSeparate: - c_name: glStencilFuncSeparate - params: - - name: face - type: GLenum - - name: func - type: GLenum - - name: ref - type: GLint - - name: mask - type: GLuint - returns: "" - glStencilMask: - c_name: glStencilMask - params: - - name: mask - type: GLuint - returns: "" - glStencilMaskSeparate: - c_name: glStencilMaskSeparate - params: - - name: face - type: GLenum - - name: mask - type: GLuint - returns: "" - glStencilOp: - c_name: glStencilOp - params: - - name: fail - type: GLenum - - name: zfail - type: GLenum - - name: zpass - type: GLenum - returns: "" - glStencilOpSeparate: - c_name: glStencilOpSeparate - params: - - name: face - type: GLenum - - name: sfail - type: GLenum - - name: dpfail - type: GLenum - - name: dppass - type: GLenum - returns: "" - glTexImage2D: - c_name: glTexImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: internalformat - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: border - type: GLint - - name: format - type: GLenum - - name: type - type: GLenum - - name: pixels - type: unsafe.Pointer - returns: "" - glTexImage3D: - c_name: glTexImage3D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: internalformat - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: depth - type: GLsizei - - name: border - type: GLint - - name: format - type: GLenum - - name: type - type: GLenum - - name: pixels - type: unsafe.Pointer - returns: "" - glTexParameterf: - c_name: glTexParameterf - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: param - type: GLfloat - returns: "" - glTexParameterfv: - c_name: glTexParameterfv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLfloat' - returns: "" - glTexParameteri: - c_name: glTexParameteri - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: param - type: GLint - returns: "" - glTexParameteriv: - c_name: glTexParameteriv - params: - - name: target - type: GLenum - - name: pname - type: GLenum - - name: params - type: '*GLint' - returns: "" - glTexStorage2D: - c_name: glTexStorage2D - params: - - name: target - type: GLenum - - name: levels - type: GLsizei - - name: internalformat - type: GLenum - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glTexStorage3D: - c_name: glTexStorage3D - params: - - name: target - type: GLenum - - name: levels - type: GLsizei - - name: internalformat - type: GLenum - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: depth - type: GLsizei - returns: "" - glTexSubImage2D: - c_name: glTexSubImage2D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: format - type: GLenum - - name: type - type: GLenum - - name: pixels - type: unsafe.Pointer - returns: "" - glTexSubImage3D: - c_name: glTexSubImage3D - params: - - name: target - type: GLenum - - name: level - type: GLint - - name: xoffset - type: GLint - - name: yoffset - type: GLint - - name: zoffset - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - - name: depth - type: GLsizei - - name: format - type: GLenum - - name: type - type: GLenum - - name: pixels - type: unsafe.Pointer - returns: "" - glTransformFeedbackVaryings: - c_name: glTransformFeedbackVaryings - params: - - name: program - type: GLuint - - name: count - type: GLsizei - - name: varyings - type: '**GLchar' - direction: out - - name: bufferMode - type: GLenum - returns: "" - glUniform1f: - c_name: glUniform1f - params: - - name: location - type: GLint - - name: v0 - type: GLfloat - returns: "" - glUniform1fv: - c_name: glUniform1fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLfloat' - returns: "" - glUniform1i: - c_name: glUniform1i - params: - - name: location - type: GLint - - name: v0 - type: GLint - returns: "" - glUniform1iv: - c_name: glUniform1iv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLint' - returns: "" - glUniform1ui: - c_name: glUniform1ui - params: - - name: location - type: GLint - - name: v0 - type: GLuint - returns: "" - glUniform1uiv: - c_name: glUniform1uiv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLuint' - returns: "" - glUniform2f: - c_name: glUniform2f - params: - - name: location - type: GLint - - name: v0 - type: GLfloat - - name: v1 - type: GLfloat - returns: "" - glUniform2fv: - c_name: glUniform2fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLfloat' - returns: "" - glUniform2i: - c_name: glUniform2i - params: - - name: location - type: GLint - - name: v0 - type: GLint - - name: v1 - type: GLint - returns: "" - glUniform2iv: - c_name: glUniform2iv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLint' - returns: "" - glUniform2ui: - c_name: glUniform2ui - params: - - name: location - type: GLint - - name: v0 - type: GLuint - - name: v1 - type: GLuint - returns: "" - glUniform2uiv: - c_name: glUniform2uiv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLuint' - returns: "" - glUniform3f: - c_name: glUniform3f - params: - - name: location - type: GLint - - name: v0 - type: GLfloat - - name: v1 - type: GLfloat - - name: v2 - type: GLfloat - returns: "" - glUniform3fv: - c_name: glUniform3fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLfloat' - returns: "" - glUniform3i: - c_name: glUniform3i - params: - - name: location - type: GLint - - name: v0 - type: GLint - - name: v1 - type: GLint - - name: v2 - type: GLint - returns: "" - glUniform3iv: - c_name: glUniform3iv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLint' - returns: "" - glUniform3ui: - c_name: glUniform3ui - params: - - name: location - type: GLint - - name: v0 - type: GLuint - - name: v1 - type: GLuint - - name: v2 - type: GLuint - returns: "" - glUniform3uiv: - c_name: glUniform3uiv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLuint' - returns: "" - glUniform4f: - c_name: glUniform4f - params: - - name: location - type: GLint - - name: v0 - type: GLfloat - - name: v1 - type: GLfloat - - name: v2 - type: GLfloat - - name: v3 - type: GLfloat - returns: "" - glUniform4fv: - c_name: glUniform4fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLfloat' - returns: "" - glUniform4i: - c_name: glUniform4i - params: - - name: location - type: GLint - - name: v0 - type: GLint - - name: v1 - type: GLint - - name: v2 - type: GLint - - name: v3 - type: GLint - returns: "" - glUniform4iv: - c_name: glUniform4iv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLint' - returns: "" - glUniform4ui: - c_name: glUniform4ui - params: - - name: location - type: GLint - - name: v0 - type: GLuint - - name: v1 - type: GLuint - - name: v2 - type: GLuint - - name: v3 - type: GLuint - returns: "" - glUniform4uiv: - c_name: glUniform4uiv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: value - type: '*GLuint' - returns: "" - glUniformBlockBinding: - c_name: glUniformBlockBinding - params: - - name: program - type: GLuint - - name: uniformBlockIndex - type: GLuint - - name: uniformBlockBinding - type: GLuint - returns: "" - glUniformMatrix2fv: - c_name: glUniformMatrix2fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix2x3fv: - c_name: glUniformMatrix2x3fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix2x4fv: - c_name: glUniformMatrix2x4fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix3fv: - c_name: glUniformMatrix3fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix3x2fv: - c_name: glUniformMatrix3x2fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix3x4fv: - c_name: glUniformMatrix3x4fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix4fv: - c_name: glUniformMatrix4fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix4x2fv: - c_name: glUniformMatrix4x2fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUniformMatrix4x3fv: - c_name: glUniformMatrix4x3fv - params: - - name: location - type: GLint - - name: count - type: GLsizei - - name: transpose - type: GLboolean - - name: value - type: '*GLfloat' - returns: "" - glUnmapBuffer: - c_name: glUnmapBuffer - params: - - name: target - type: GLenum - returns: GLboolean - glUseProgram: - c_name: glUseProgram - params: - - name: program - type: GLuint - returns: "" - glValidateProgram: - c_name: glValidateProgram - params: - - name: program - type: GLuint - returns: "" - glVertexAttrib1f: - c_name: glVertexAttrib1f - params: - - name: index - type: GLuint - - name: x - type: GLfloat - returns: "" - glVertexAttrib1fv: - c_name: glVertexAttrib1fv - params: - - name: index - type: GLuint - - name: v - type: '*GLfloat' - returns: "" - glVertexAttrib2f: - c_name: glVertexAttrib2f - params: - - name: index - type: GLuint - - name: x - type: GLfloat - - name: "y" - type: GLfloat - returns: "" - glVertexAttrib2fv: - c_name: glVertexAttrib2fv - params: - - name: index - type: GLuint - - name: v - type: '*GLfloat' - returns: "" - glVertexAttrib3f: - c_name: glVertexAttrib3f - params: - - name: index - type: GLuint - - name: x - type: GLfloat - - name: "y" - type: GLfloat - - name: z - type: GLfloat - returns: "" - glVertexAttrib3fv: - c_name: glVertexAttrib3fv - params: - - name: index - type: GLuint - - name: v - type: '*GLfloat' - returns: "" - glVertexAttrib4f: - c_name: glVertexAttrib4f - params: - - name: index - type: GLuint - - name: x - type: GLfloat - - name: "y" - type: GLfloat - - name: z - type: GLfloat - - name: w - type: GLfloat - returns: "" - glVertexAttrib4fv: - c_name: glVertexAttrib4fv - params: - - name: index - type: GLuint - - name: v - type: '*GLfloat' - returns: "" - glVertexAttribDivisor: - c_name: glVertexAttribDivisor - params: - - name: index - type: GLuint - - name: divisor - type: GLuint - returns: "" - glVertexAttribI4i: - c_name: glVertexAttribI4i - params: - - name: index - type: GLuint - - name: x - type: GLint - - name: "y" - type: GLint - - name: z - type: GLint - - name: w - type: GLint - returns: "" - glVertexAttribI4iv: - c_name: glVertexAttribI4iv - params: - - name: index - type: GLuint - - name: v - type: '*GLint' - returns: "" - glVertexAttribI4ui: - c_name: glVertexAttribI4ui - params: - - name: index - type: GLuint - - name: x - type: GLuint - - name: "y" - type: GLuint - - name: z - type: GLuint - - name: w - type: GLuint - returns: "" - glVertexAttribI4uiv: - c_name: glVertexAttribI4uiv - params: - - name: index - type: GLuint - - name: v - type: '*GLuint' - returns: "" - glVertexAttribIPointer: - c_name: glVertexAttribIPointer - params: - - name: index - type: GLuint - - name: size - type: GLint - - name: type - type: GLenum - - name: stride - type: GLsizei - - name: pointer - type: unsafe.Pointer - returns: "" - glVertexAttribPointer: - c_name: glVertexAttribPointer - params: - - name: index - type: GLuint - - name: size - type: GLint - - name: type - type: GLenum - - name: normalized - type: GLboolean - - name: stride - type: GLsizei - - name: pointer - type: unsafe.Pointer - returns: "" - glViewport: - c_name: glViewport - params: - - name: x - type: GLint - - name: "y" - type: GLint - - name: width - type: GLsizei - - name: height - type: GLsizei - returns: "" - glWaitSync: - c_name: glWaitSync - params: - - name: sync - type: GLsync - - name: flags - type: GLbitfield - - name: timeout - type: GLuint64 - returns: "" -callbacks: - PFNGLACTIVETEXTUREPROC: - returns: "" - PFNGLATTACHSHADERPROC: - returns: "" - PFNGLBEGINQUERYPROC: - returns: "" - PFNGLBEGINTRANSFORMFEEDBACKPROC: - returns: "" - PFNGLBINDATTRIBLOCATIONPROC: - returns: "" - PFNGLBINDBUFFERBASEPROC: - returns: "" - PFNGLBINDBUFFERPROC: - returns: "" - PFNGLBINDBUFFERRANGEPROC: - returns: "" - PFNGLBINDFRAMEBUFFERPROC: - returns: "" - PFNGLBINDRENDERBUFFERPROC: - returns: "" - PFNGLBINDSAMPLERPROC: - returns: "" - PFNGLBINDTEXTUREPROC: - returns: "" - PFNGLBINDTRANSFORMFEEDBACKPROC: - returns: "" - PFNGLBINDVERTEXARRAYPROC: - returns: "" - PFNGLBLENDCOLORPROC: - returns: "" - PFNGLBLENDEQUATIONPROC: - returns: "" - PFNGLBLENDEQUATIONSEPARATEPROC: - returns: "" - PFNGLBLENDFUNCPROC: - returns: "" - PFNGLBLENDFUNCSEPARATEPROC: - returns: "" - PFNGLBLITFRAMEBUFFERPROC: - returns: "" - PFNGLBUFFERDATAPROC: - returns: "" - PFNGLBUFFERSUBDATAPROC: - returns: "" - PFNGLCHECKFRAMEBUFFERSTATUSPROC: - returns: "" - PFNGLCLEARBUFFERFIPROC: - returns: "" - PFNGLCLEARBUFFERFVPROC: - returns: "" - PFNGLCLEARBUFFERIVPROC: - returns: "" - PFNGLCLEARBUFFERUIVPROC: - returns: "" - PFNGLCLEARCOLORPROC: - returns: "" - PFNGLCLEARDEPTHFPROC: - returns: "" - PFNGLCLEARPROC: - returns: "" - PFNGLCLEARSTENCILPROC: - returns: "" - PFNGLCLIENTWAITSYNCPROC: - returns: "" - PFNGLCOLORMASKPROC: - returns: "" - PFNGLCOMPILESHADERPROC: - returns: "" - PFNGLCOMPRESSEDTEXIMAGE2DPROC: - returns: "" - PFNGLCOMPRESSEDTEXIMAGE3DPROC: - returns: "" - PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC: - returns: "" - PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC: - returns: "" - PFNGLCOPYBUFFERSUBDATAPROC: - returns: "" - PFNGLCOPYTEXIMAGE2DPROC: - returns: "" - PFNGLCOPYTEXSUBIMAGE2DPROC: - returns: "" - PFNGLCOPYTEXSUBIMAGE3DPROC: - returns: "" - PFNGLCREATEPROGRAMPROC: - returns: "" - PFNGLCREATESHADERPROC: - returns: "" - PFNGLCULLFACEPROC: - returns: "" - PFNGLDELETEBUFFERSPROC: - returns: "" - PFNGLDELETEFRAMEBUFFERSPROC: - returns: "" - PFNGLDELETEPROGRAMPROC: - returns: "" - PFNGLDELETEQUERIESPROC: - returns: "" - PFNGLDELETERENDERBUFFERSPROC: - returns: "" - PFNGLDELETESAMPLERSPROC: - returns: "" - PFNGLDELETESHADERPROC: - returns: "" - PFNGLDELETESYNCPROC: - returns: "" - PFNGLDELETETEXTURESPROC: - returns: "" - PFNGLDELETETRANSFORMFEEDBACKSPROC: - returns: "" - PFNGLDELETEVERTEXARRAYSPROC: - returns: "" - PFNGLDEPTHFUNCPROC: - returns: "" - PFNGLDEPTHMASKPROC: - returns: "" - PFNGLDEPTHRANGEFPROC: - returns: "" - PFNGLDETACHSHADERPROC: - returns: "" - PFNGLDISABLEPROC: - returns: "" - PFNGLDISABLEVERTEXATTRIBARRAYPROC: - returns: "" - PFNGLDRAWARRAYSINSTANCEDPROC: - returns: "" - PFNGLDRAWARRAYSPROC: - returns: "" - PFNGLDRAWBUFFERSPROC: - returns: "" - PFNGLDRAWELEMENTSINSTANCEDPROC: - returns: "" - PFNGLDRAWELEMENTSPROC: - returns: "" - PFNGLDRAWRANGEELEMENTSPROC: - returns: "" - PFNGLENABLEPROC: - returns: "" - PFNGLENABLEVERTEXATTRIBARRAYPROC: - returns: "" - PFNGLENDQUERYPROC: - returns: "" - PFNGLENDTRANSFORMFEEDBACKPROC: - returns: "" - PFNGLFENCESYNCPROC: - returns: "" - PFNGLFINISHPROC: - returns: "" - PFNGLFLUSHMAPPEDBUFFERRANGEPROC: - returns: "" - PFNGLFLUSHPROC: - returns: "" - PFNGLFRAMEBUFFERRENDERBUFFERPROC: - returns: "" - PFNGLFRAMEBUFFERTEXTURE2DPROC: - returns: "" - PFNGLFRAMEBUFFERTEXTURELAYERPROC: - returns: "" - PFNGLFRONTFACEPROC: - returns: "" - PFNGLGENBUFFERSPROC: - returns: "" - PFNGLGENERATEMIPMAPPROC: - returns: "" - PFNGLGENFRAMEBUFFERSPROC: - returns: "" - PFNGLGENQUERIESPROC: - returns: "" - PFNGLGENRENDERBUFFERSPROC: - returns: "" - PFNGLGENSAMPLERSPROC: - returns: "" - PFNGLGENTEXTURESPROC: - returns: "" - PFNGLGENTRANSFORMFEEDBACKSPROC: - returns: "" - PFNGLGENVERTEXARRAYSPROC: - returns: "" - PFNGLGETACTIVEATTRIBPROC: - returns: "" - PFNGLGETACTIVEUNIFORMBLOCKIVPROC: - returns: "" - PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC: - returns: "" - PFNGLGETACTIVEUNIFORMPROC: - returns: "" - PFNGLGETACTIVEUNIFORMSIVPROC: - returns: "" - PFNGLGETATTACHEDSHADERSPROC: - returns: "" - PFNGLGETATTRIBLOCATIONPROC: - returns: "" - PFNGLGETBOOLEANVPROC: - returns: "" - PFNGLGETBUFFERPARAMETERI64VPROC: - returns: "" - PFNGLGETBUFFERPARAMETERIVPROC: - returns: "" - PFNGLGETBUFFERPOINTERVPROC: - returns: "" - PFNGLGETERRORPROC: - returns: "" - PFNGLGETFLOATVPROC: - returns: "" - PFNGLGETFRAGDATALOCATIONPROC: - returns: "" - PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC: - returns: "" - PFNGLGETINTEGER64I_VPROC: - returns: "" - PFNGLGETINTEGER64VPROC: - returns: "" - PFNGLGETINTEGERI_VPROC: - returns: "" - PFNGLGETINTEGERVPROC: - returns: "" - PFNGLGETINTERNALFORMATIVPROC: - returns: "" - PFNGLGETPROGRAMBINARYPROC: - returns: "" - PFNGLGETPROGRAMINFOLOGPROC: - returns: "" - PFNGLGETPROGRAMIVPROC: - returns: "" - PFNGLGETQUERYIVPROC: - returns: "" - PFNGLGETQUERYOBJECTUIVPROC: - returns: "" - PFNGLGETRENDERBUFFERPARAMETERIVPROC: - returns: "" - PFNGLGETSAMPLERPARAMETERFVPROC: - returns: "" - PFNGLGETSAMPLERPARAMETERIVPROC: - returns: "" - PFNGLGETSHADERINFOLOGPROC: - returns: "" - PFNGLGETSHADERIVPROC: - returns: "" - PFNGLGETSHADERPRECISIONFORMATPROC: - returns: "" - PFNGLGETSHADERSOURCEPROC: - returns: "" - PFNGLGETSTRINGIPROC: - returns: "" - PFNGLGETSTRINGPROC: - returns: "" - PFNGLGETSYNCIVPROC: - returns: "" - PFNGLGETTEXPARAMETERFVPROC: - returns: "" - PFNGLGETTEXPARAMETERIVPROC: - returns: "" - PFNGLGETTRANSFORMFEEDBACKVARYINGPROC: - returns: "" - PFNGLGETUNIFORMBLOCKINDEXPROC: - returns: "" - PFNGLGETUNIFORMFVPROC: - returns: "" - PFNGLGETUNIFORMINDICESPROC: - returns: "" - PFNGLGETUNIFORMIVPROC: - returns: "" - PFNGLGETUNIFORMLOCATIONPROC: - returns: "" - PFNGLGETUNIFORMUIVPROC: - returns: "" - PFNGLGETVERTEXATTRIBFVPROC: - returns: "" - PFNGLGETVERTEXATTRIBIIVPROC: - returns: "" - PFNGLGETVERTEXATTRIBIUIVPROC: - returns: "" - PFNGLGETVERTEXATTRIBIVPROC: - returns: "" - PFNGLGETVERTEXATTRIBPOINTERVPROC: - returns: "" - PFNGLHINTPROC: - returns: "" - PFNGLINVALIDATEFRAMEBUFFERPROC: - returns: "" - PFNGLINVALIDATESUBFRAMEBUFFERPROC: - returns: "" - PFNGLISBUFFERPROC: - returns: "" - PFNGLISENABLEDPROC: - returns: "" - PFNGLISFRAMEBUFFERPROC: - returns: "" - PFNGLISPROGRAMPROC: - returns: "" - PFNGLISQUERYPROC: - returns: "" - PFNGLISRENDERBUFFERPROC: - returns: "" - PFNGLISSAMPLERPROC: - returns: "" - PFNGLISSHADERPROC: - returns: "" - PFNGLISSYNCPROC: - returns: "" - PFNGLISTEXTUREPROC: - returns: "" - PFNGLISTRANSFORMFEEDBACKPROC: - returns: "" - PFNGLISVERTEXARRAYPROC: - returns: "" - PFNGLLINEWIDTHPROC: - returns: "" - PFNGLLINKPROGRAMPROC: - returns: "" - PFNGLMAPBUFFERRANGEPROC: - returns: "" - PFNGLPAUSETRANSFORMFEEDBACKPROC: - returns: "" - PFNGLPIXELSTOREIPROC: - returns: "" - PFNGLPOLYGONOFFSETPROC: - returns: "" - PFNGLPROGRAMBINARYPROC: - returns: "" - PFNGLPROGRAMPARAMETERIPROC: - returns: "" - PFNGLREADBUFFERPROC: - returns: "" - PFNGLREADPIXELSPROC: - returns: "" - PFNGLRELEASESHADERCOMPILERPROC: - returns: "" - PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC: - returns: "" - PFNGLRENDERBUFFERSTORAGEPROC: - returns: "" - PFNGLRESUMETRANSFORMFEEDBACKPROC: - returns: "" - PFNGLSAMPLECOVERAGEPROC: - returns: "" - PFNGLSAMPLERPARAMETERFPROC: - returns: "" - PFNGLSAMPLERPARAMETERFVPROC: - returns: "" - PFNGLSAMPLERPARAMETERIPROC: - returns: "" - PFNGLSAMPLERPARAMETERIVPROC: - returns: "" - PFNGLSCISSORPROC: - returns: "" - PFNGLSHADERBINARYPROC: - returns: "" - PFNGLSHADERSOURCEPROC: - returns: "" - PFNGLSTENCILFUNCPROC: - returns: "" - PFNGLSTENCILFUNCSEPARATEPROC: - returns: "" - PFNGLSTENCILMASKPROC: - returns: "" - PFNGLSTENCILMASKSEPARATEPROC: - returns: "" - PFNGLSTENCILOPPROC: - returns: "" - PFNGLSTENCILOPSEPARATEPROC: - returns: "" - PFNGLTEXIMAGE2DPROC: - returns: "" - PFNGLTEXIMAGE3DPROC: - returns: "" - PFNGLTEXPARAMETERFPROC: - returns: "" - PFNGLTEXPARAMETERFVPROC: - returns: "" - PFNGLTEXPARAMETERIPROC: - returns: "" - PFNGLTEXPARAMETERIVPROC: - returns: "" - PFNGLTEXSTORAGE2DPROC: - returns: "" - PFNGLTEXSTORAGE3DPROC: - returns: "" - PFNGLTEXSUBIMAGE2DPROC: - returns: "" - PFNGLTEXSUBIMAGE3DPROC: - returns: "" - PFNGLTRANSFORMFEEDBACKVARYINGSPROC: - returns: "" - PFNGLUNIFORM1FPROC: - returns: "" - PFNGLUNIFORM1FVPROC: - returns: "" - PFNGLUNIFORM1IPROC: - returns: "" - PFNGLUNIFORM1IVPROC: - returns: "" - PFNGLUNIFORM1UIPROC: - returns: "" - PFNGLUNIFORM1UIVPROC: - returns: "" - PFNGLUNIFORM2FPROC: - returns: "" - PFNGLUNIFORM2FVPROC: - returns: "" - PFNGLUNIFORM2IPROC: - returns: "" - PFNGLUNIFORM2IVPROC: - returns: "" - PFNGLUNIFORM2UIPROC: - returns: "" - PFNGLUNIFORM2UIVPROC: - returns: "" - PFNGLUNIFORM3FPROC: - returns: "" - PFNGLUNIFORM3FVPROC: - returns: "" - PFNGLUNIFORM3IPROC: - returns: "" - PFNGLUNIFORM3IVPROC: - returns: "" - PFNGLUNIFORM3UIPROC: - returns: "" - PFNGLUNIFORM3UIVPROC: - returns: "" - PFNGLUNIFORM4FPROC: - returns: "" - PFNGLUNIFORM4FVPROC: - returns: "" - PFNGLUNIFORM4IPROC: - returns: "" - PFNGLUNIFORM4IVPROC: - returns: "" - PFNGLUNIFORM4UIPROC: - returns: "" - PFNGLUNIFORM4UIVPROC: - returns: "" - PFNGLUNIFORMBLOCKBINDINGPROC: - returns: "" - PFNGLUNIFORMMATRIX2FVPROC: - returns: "" - PFNGLUNIFORMMATRIX2X3FVPROC: - returns: "" - PFNGLUNIFORMMATRIX2X4FVPROC: - returns: "" - PFNGLUNIFORMMATRIX3FVPROC: - returns: "" - PFNGLUNIFORMMATRIX3X2FVPROC: - returns: "" - PFNGLUNIFORMMATRIX3X4FVPROC: - returns: "" - PFNGLUNIFORMMATRIX4FVPROC: - returns: "" - PFNGLUNIFORMMATRIX4X2FVPROC: - returns: "" - PFNGLUNIFORMMATRIX4X3FVPROC: - returns: "" - PFNGLUNMAPBUFFERPROC: - returns: "" - PFNGLUSEPROGRAMPROC: - returns: "" - PFNGLVALIDATEPROGRAMPROC: - returns: "" - PFNGLVERTEXATTRIB1FPROC: - returns: "" - PFNGLVERTEXATTRIB1FVPROC: - returns: "" - PFNGLVERTEXATTRIB2FPROC: - returns: "" - PFNGLVERTEXATTRIB2FVPROC: - returns: "" - PFNGLVERTEXATTRIB3FPROC: - returns: "" - PFNGLVERTEXATTRIB3FVPROC: - returns: "" - PFNGLVERTEXATTRIB4FPROC: - returns: "" - PFNGLVERTEXATTRIB4FVPROC: - returns: "" - PFNGLVERTEXATTRIBDIVISORPROC: - returns: "" - PFNGLVERTEXATTRIBI4IPROC: - returns: "" - PFNGLVERTEXATTRIBI4IVPROC: - returns: "" - PFNGLVERTEXATTRIBI4UIPROC: - returns: "" - PFNGLVERTEXATTRIBI4UIVPROC: - returns: "" - PFNGLVERTEXATTRIBIPOINTERPROC: - returns: "" - PFNGLVERTEXATTRIBPOINTERPROC: - returns: "" - PFNGLVIEWPORTPROC: - returns: "" - PFNGLWAITSYNCPROC: - returns: "" -macros: - GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: 35722 - GL_ACTIVE_ATTRIBUTES: 35721 - GL_ACTIVE_TEXTURE: 34016 - GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: 35381 - GL_ACTIVE_UNIFORM_BLOCKS: 35382 - GL_ACTIVE_UNIFORM_MAX_LENGTH: 35719 - GL_ACTIVE_UNIFORMS: 35718 - GL_ALIASED_LINE_WIDTH_RANGE: 33902 - GL_ALIASED_POINT_SIZE_RANGE: 33901 - GL_ALPHA: 6406 - GL_ALPHA_BITS: 3413 - GL_ALREADY_SIGNALED: 37146 - GL_ALWAYS: 519 - GL_ANY_SAMPLES_PASSED: 35887 - GL_ANY_SAMPLES_PASSED_CONSERVATIVE: 36202 - GL_ARRAY_BUFFER: 34962 - GL_ARRAY_BUFFER_BINDING: 34964 - GL_ATTACHED_SHADERS: 35717 - GL_BACK: 1029 - GL_BLEND: 3042 - GL_BLEND_COLOR: 32773 - GL_BLEND_DST_ALPHA: 32970 - GL_BLEND_DST_RGB: 32968 - GL_BLEND_EQUATION: 32777 - GL_BLEND_EQUATION_ALPHA: 34877 - GL_BLEND_EQUATION_RGB: 32777 - GL_BLEND_SRC_ALPHA: 32971 - GL_BLEND_SRC_RGB: 32969 - GL_BLUE: 6405 - GL_BLUE_BITS: 3412 - GL_BOOL: 35670 - GL_BOOL_VEC2: 35671 - GL_BOOL_VEC3: 35672 - GL_BOOL_VEC4: 35673 - GL_BUFFER_ACCESS_FLAGS: 37151 - GL_BUFFER_MAP_LENGTH: 37152 - GL_BUFFER_MAP_OFFSET: 37153 - GL_BUFFER_MAP_POINTER: 35005 - GL_BUFFER_MAPPED: 35004 - GL_BUFFER_SIZE: 34660 - GL_BUFFER_USAGE: 34661 - GL_BYTE: 5120 - GL_CCW: 2305 - GL_CLAMP_TO_EDGE: 33071 - GL_COLOR: 6144 - GL_COLOR_ATTACHMENT0: 36064 - GL_COLOR_ATTACHMENT1: 36065 - GL_COLOR_ATTACHMENT2: 36066 - GL_COLOR_ATTACHMENT3: 36067 - GL_COLOR_ATTACHMENT4: 36068 - GL_COLOR_ATTACHMENT5: 36069 - GL_COLOR_ATTACHMENT6: 36070 - GL_COLOR_ATTACHMENT7: 36071 - GL_COLOR_ATTACHMENT8: 36072 - GL_COLOR_ATTACHMENT9: 36073 - GL_COLOR_ATTACHMENT10: 36074 - GL_COLOR_ATTACHMENT11: 36075 - GL_COLOR_ATTACHMENT12: 36076 - GL_COLOR_ATTACHMENT13: 36077 - GL_COLOR_ATTACHMENT14: 36078 - GL_COLOR_ATTACHMENT15: 36079 - GL_COLOR_ATTACHMENT16: 36080 - GL_COLOR_ATTACHMENT17: 36081 - GL_COLOR_ATTACHMENT18: 36082 - GL_COLOR_ATTACHMENT19: 36083 - GL_COLOR_ATTACHMENT20: 36084 - GL_COLOR_ATTACHMENT21: 36085 - GL_COLOR_ATTACHMENT22: 36086 - GL_COLOR_ATTACHMENT23: 36087 - GL_COLOR_ATTACHMENT24: 36088 - GL_COLOR_ATTACHMENT25: 36089 - GL_COLOR_ATTACHMENT26: 36090 - GL_COLOR_ATTACHMENT27: 36091 - GL_COLOR_ATTACHMENT28: 36092 - GL_COLOR_ATTACHMENT29: 36093 - GL_COLOR_ATTACHMENT30: 36094 - GL_COLOR_ATTACHMENT31: 36095 - GL_COLOR_BUFFER_BIT: 16384 - GL_COLOR_CLEAR_VALUE: 3106 - GL_COLOR_WRITEMASK: 3107 - GL_COMPARE_REF_TO_TEXTURE: 34894 - GL_COMPILE_STATUS: 35713 - GL_COMPRESSED_R11_EAC: 37488 - GL_COMPRESSED_RG11_EAC: 37490 - GL_COMPRESSED_RGB8_ETC2: 37492 - GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37494 - GL_COMPRESSED_RGBA8_ETC2_EAC: 37496 - GL_COMPRESSED_SIGNED_R11_EAC: 37489 - GL_COMPRESSED_SIGNED_RG11_EAC: 37491 - GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37497 - GL_COMPRESSED_SRGB8_ETC2: 37493 - GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37495 - GL_COMPRESSED_TEXTURE_FORMATS: 34467 - GL_CONDITION_SATISFIED: 37148 - GL_CONSTANT_ALPHA: 32771 - GL_CONSTANT_COLOR: 32769 - GL_COPY_READ_BUFFER: 36662 - GL_COPY_READ_BUFFER_BINDING: 36662 - GL_COPY_WRITE_BUFFER: 36663 - GL_COPY_WRITE_BUFFER_BINDING: 36663 - GL_CULL_FACE: 2884 - GL_CULL_FACE_MODE: 2885 - GL_CURRENT_PROGRAM: 35725 - GL_CURRENT_QUERY: 34917 - GL_CURRENT_VERTEX_ATTRIB: 34342 - GL_CW: 2304 - GL_DECR: 7683 - GL_DECR_WRAP: 34056 - GL_DELETE_STATUS: 35712 - GL_DEPTH: 6145 - GL_DEPTH_ATTACHMENT: 36096 - GL_DEPTH_BITS: 3414 - GL_DEPTH_BUFFER_BIT: 256 - GL_DEPTH_CLEAR_VALUE: 2931 - GL_DEPTH_COMPONENT: 6402 - GL_DEPTH_COMPONENT16: 33189 - GL_DEPTH_COMPONENT24: 33190 - GL_DEPTH_COMPONENT32F: 36012 - GL_DEPTH_FUNC: 2932 - GL_DEPTH_RANGE: 2928 - GL_DEPTH_STENCIL: 34041 - GL_DEPTH_STENCIL_ATTACHMENT: 33306 - GL_DEPTH_TEST: 2929 - GL_DEPTH_WRITEMASK: 2930 - GL_DEPTH24_STENCIL8: 35056 - GL_DEPTH32F_STENCIL8: 36013 - GL_DITHER: 3024 - GL_DONT_CARE: 4352 - GL_DRAW_BUFFER0: 34853 - GL_DRAW_BUFFER1: 34854 - GL_DRAW_BUFFER2: 34855 - GL_DRAW_BUFFER3: 34856 - GL_DRAW_BUFFER4: 34857 - GL_DRAW_BUFFER5: 34858 - GL_DRAW_BUFFER6: 34859 - GL_DRAW_BUFFER7: 34860 - GL_DRAW_BUFFER8: 34861 - GL_DRAW_BUFFER9: 34862 - GL_DRAW_BUFFER10: 34863 - GL_DRAW_BUFFER11: 34864 - GL_DRAW_BUFFER12: 34865 - GL_DRAW_BUFFER13: 34866 - GL_DRAW_BUFFER14: 34867 - GL_DRAW_BUFFER15: 34868 - GL_DRAW_FRAMEBUFFER: 36009 - GL_DRAW_FRAMEBUFFER_BINDING: 36006 - GL_DST_ALPHA: 772 - GL_DST_COLOR: 774 - GL_DYNAMIC_COPY: 35050 - GL_DYNAMIC_DRAW: 35048 - GL_DYNAMIC_READ: 35049 - GL_ELEMENT_ARRAY_BUFFER: 34963 - GL_ELEMENT_ARRAY_BUFFER_BINDING: 34965 - GL_EQUAL: 514 - GL_EXTENSIONS: 7939 - GL_FALSE: 0 - GL_FASTEST: 4353 - GL_FIXED: 5132 - GL_FLOAT: 5126 - GL_FLOAT_32_UNSIGNED_INT_24_8_REV: 36269 - GL_FLOAT_MAT2: 35674 - GL_FLOAT_MAT3: 35675 - GL_FLOAT_MAT4: 35676 - GL_FLOAT_VEC2: 35664 - GL_FLOAT_VEC3: 35665 - GL_FLOAT_VEC4: 35666 - GL_FRAGMENT_SHADER: 35632 - GL_FRAGMENT_SHADER_DERIVATIVE_HINT: 35723 - GL_FRAMEBUFFER: 36160 - GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 33301 - GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 33300 - GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 33296 - GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 33297 - GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 33302 - GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 33299 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 36049 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 36048 - GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: 33298 - GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 33303 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 36051 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 36052 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 36050 - GL_FRAMEBUFFER_BINDING: 36006 - GL_FRAMEBUFFER_COMPLETE: 36053 - GL_FRAMEBUFFER_DEFAULT: 33304 - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 36054 - GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 36057 - GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 36055 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 36182 - GL_FRAMEBUFFER_UNDEFINED: 33305 - GL_FRAMEBUFFER_UNSUPPORTED: 36061 - GL_FRONT: 1028 - GL_FRONT_AND_BACK: 1032 - GL_FRONT_FACE: 2886 - GL_FUNC_ADD: 32774 - GL_FUNC_REVERSE_SUBTRACT: 32779 - GL_FUNC_SUBTRACT: 32778 - GL_GENERATE_MIPMAP_HINT: 33170 - GL_GEQUAL: 518 - GL_GREATER: 516 - GL_GREEN: 6404 - GL_GREEN_BITS: 3411 - GL_HALF_FLOAT: 5131 - GL_HIGH_FLOAT: 36338 - GL_HIGH_INT: 36341 - GL_IMPLEMENTATION_COLOR_READ_FORMAT: 35739 - GL_IMPLEMENTATION_COLOR_READ_TYPE: 35738 - GL_INCR: 7682 - GL_INCR_WRAP: 34055 - GL_INFO_LOG_LENGTH: 35716 - GL_INT: 5124 - GL_INT_2_10_10_10_REV: 36255 - GL_INT_SAMPLER_2D: 36298 - GL_INT_SAMPLER_2D_ARRAY: 36303 - GL_INT_SAMPLER_3D: 36299 - GL_INT_SAMPLER_CUBE: 36300 - GL_INT_VEC2: 35667 - GL_INT_VEC3: 35668 - GL_INT_VEC4: 35669 - GL_INTERLEAVED_ATTRIBS: 35980 - GL_INVALID_ENUM: 1280 - GL_INVALID_FRAMEBUFFER_OPERATION: 1286 - GL_INVALID_INDEX: 4294967295 - GL_INVALID_OPERATION: 1282 - GL_INVALID_VALUE: 1281 - GL_INVERT: 5386 - GL_KEEP: 7680 - GL_LEQUAL: 515 - GL_LESS: 513 - GL_LINE_LOOP: 2 - GL_LINE_STRIP: 3 - GL_LINE_WIDTH: 2849 - GL_LINEAR: 9729 - GL_LINEAR_MIPMAP_LINEAR: 9987 - GL_LINEAR_MIPMAP_NEAREST: 9985 - GL_LINES: 1 - GL_LINK_STATUS: 35714 - GL_LOW_FLOAT: 36336 - GL_LOW_INT: 36339 - GL_LUMINANCE: 6409 - GL_LUMINANCE_ALPHA: 6410 - GL_MAJOR_VERSION: 33307 - GL_MAP_FLUSH_EXPLICIT_BIT: 16 - GL_MAP_INVALIDATE_BUFFER_BIT: 8 - GL_MAP_INVALIDATE_RANGE_BIT: 4 - GL_MAP_READ_BIT: 1 - GL_MAP_UNSYNCHRONIZED_BIT: 32 - GL_MAP_WRITE_BIT: 2 - GL_MAX: 32776 - GL_MAX_3D_TEXTURE_SIZE: 32883 - GL_MAX_ARRAY_TEXTURE_LAYERS: 35071 - GL_MAX_COLOR_ATTACHMENTS: 36063 - GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 35379 - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: 35661 - GL_MAX_COMBINED_UNIFORM_BLOCKS: 35374 - GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 35377 - GL_MAX_CUBE_MAP_TEXTURE_SIZE: 34076 - GL_MAX_DRAW_BUFFERS: 34852 - GL_MAX_ELEMENT_INDEX: 36203 - GL_MAX_ELEMENTS_INDICES: 33001 - GL_MAX_ELEMENTS_VERTICES: 33000 - GL_MAX_FRAGMENT_INPUT_COMPONENTS: 37157 - GL_MAX_FRAGMENT_UNIFORM_BLOCKS: 35373 - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: 35657 - GL_MAX_FRAGMENT_UNIFORM_VECTORS: 36349 - GL_MAX_PROGRAM_TEXEL_OFFSET: 35077 - GL_MAX_RENDERBUFFER_SIZE: 34024 - GL_MAX_SAMPLES: 36183 - GL_MAX_SERVER_WAIT_TIMEOUT: 37137 - GL_MAX_TEXTURE_IMAGE_UNITS: 34930 - GL_MAX_TEXTURE_LOD_BIAS: 34045 - GL_MAX_TEXTURE_SIZE: 3379 - GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 35978 - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 35979 - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 35968 - GL_MAX_UNIFORM_BLOCK_SIZE: 35376 - GL_MAX_UNIFORM_BUFFER_BINDINGS: 35375 - GL_MAX_VARYING_COMPONENTS: 35659 - GL_MAX_VARYING_VECTORS: 36348 - GL_MAX_VERTEX_ATTRIBS: 34921 - GL_MAX_VERTEX_OUTPUT_COMPONENTS: 37154 - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: 35660 - GL_MAX_VERTEX_UNIFORM_BLOCKS: 35371 - GL_MAX_VERTEX_UNIFORM_COMPONENTS: 35658 - GL_MAX_VERTEX_UNIFORM_VECTORS: 36347 - GL_MAX_VIEWPORT_DIMS: 3386 - GL_MEDIUM_FLOAT: 36337 - GL_MEDIUM_INT: 36340 - GL_MIN: 32775 - GL_MIN_PROGRAM_TEXEL_OFFSET: 35076 - GL_MINOR_VERSION: 33308 - GL_MIRRORED_REPEAT: 33648 - GL_NEAREST: 9728 - GL_NEAREST_MIPMAP_LINEAR: 9986 - GL_NEAREST_MIPMAP_NEAREST: 9984 - GL_NEVER: 512 - GL_NICEST: 4354 - GL_NO_ERROR: 0 - GL_NONE: 0 - GL_NOTEQUAL: 517 - GL_NUM_COMPRESSED_TEXTURE_FORMATS: 34466 - GL_NUM_EXTENSIONS: 33309 - GL_NUM_PROGRAM_BINARY_FORMATS: 34814 - GL_NUM_SAMPLE_COUNTS: 37760 - GL_NUM_SHADER_BINARY_FORMATS: 36345 - GL_OBJECT_TYPE: 37138 - GL_ONE: 1 - GL_ONE_MINUS_CONSTANT_ALPHA: 32772 - GL_ONE_MINUS_CONSTANT_COLOR: 32770 - GL_ONE_MINUS_DST_ALPHA: 773 - GL_ONE_MINUS_DST_COLOR: 775 - GL_ONE_MINUS_SRC_ALPHA: 771 - GL_ONE_MINUS_SRC_COLOR: 769 - GL_OUT_OF_MEMORY: 1285 - GL_PACK_ALIGNMENT: 3333 - GL_PACK_ROW_LENGTH: 3330 - GL_PACK_SKIP_PIXELS: 3332 - GL_PACK_SKIP_ROWS: 3331 - GL_PIXEL_PACK_BUFFER: 35051 - GL_PIXEL_PACK_BUFFER_BINDING: 35053 - GL_PIXEL_UNPACK_BUFFER: 35052 - GL_PIXEL_UNPACK_BUFFER_BINDING: 35055 - GL_POINTS: 0 - GL_POLYGON_OFFSET_FACTOR: 32824 - GL_POLYGON_OFFSET_FILL: 32823 - GL_POLYGON_OFFSET_UNITS: 10752 - GL_PRIMITIVE_RESTART_FIXED_INDEX: 36201 - GL_PROGRAM_BINARY_FORMATS: 34815 - GL_PROGRAM_BINARY_LENGTH: 34625 - GL_PROGRAM_BINARY_RETRIEVABLE_HINT: 33367 - GL_QUERY_RESULT: 34918 - GL_QUERY_RESULT_AVAILABLE: 34919 - GL_R8: 33321 - GL_R8I: 33329 - GL_R8UI: 33330 - GL_R8_SNORM: 36756 - GL_R11F_G11F_B10F: 35898 - GL_R16F: 33325 - GL_R16I: 33331 - GL_R16UI: 33332 - GL_R32F: 33326 - GL_R32I: 33333 - GL_R32UI: 33334 - GL_RASTERIZER_DISCARD: 35977 - GL_READ_BUFFER: 3074 - GL_READ_FRAMEBUFFER: 36008 - GL_READ_FRAMEBUFFER_BINDING: 36010 - GL_RED: 6403 - GL_RED_BITS: 3410 - GL_RED_INTEGER: 36244 - GL_RENDERBUFFER: 36161 - GL_RENDERBUFFER_ALPHA_SIZE: 36179 - GL_RENDERBUFFER_BINDING: 36007 - GL_RENDERBUFFER_BLUE_SIZE: 36178 - GL_RENDERBUFFER_DEPTH_SIZE: 36180 - GL_RENDERBUFFER_GREEN_SIZE: 36177 - GL_RENDERBUFFER_HEIGHT: 36163 - GL_RENDERBUFFER_INTERNAL_FORMAT: 36164 - GL_RENDERBUFFER_RED_SIZE: 36176 - GL_RENDERBUFFER_SAMPLES: 36011 - GL_RENDERBUFFER_STENCIL_SIZE: 36181 - GL_RENDERBUFFER_WIDTH: 36162 - GL_RENDERER: 7937 - GL_REPEAT: 10497 - GL_REPLACE: 7681 - GL_RG: 33319 - GL_RG_INTEGER: 33320 - GL_RG8: 33323 - GL_RG8I: 33335 - GL_RG8UI: 33336 - GL_RG8_SNORM: 36757 - GL_RG16F: 33327 - GL_RG16I: 33337 - GL_RG16UI: 33338 - GL_RG32F: 33328 - GL_RG32I: 33339 - GL_RG32UI: 33340 - GL_RGB: 6407 - GL_RGB_INTEGER: 36248 - GL_RGB5_A1: 32855 - GL_RGB8: 32849 - GL_RGB8I: 36239 - GL_RGB8UI: 36221 - GL_RGB8_SNORM: 36758 - GL_RGB9_E5: 35901 - GL_RGB10_A2: 32857 - GL_RGB10_A2UI: 36975 - GL_RGB16F: 34843 - GL_RGB16I: 36233 - GL_RGB16UI: 36215 - GL_RGB32F: 34837 - GL_RGB32I: 36227 - GL_RGB32UI: 36209 - GL_RGB565: 36194 - GL_RGBA: 6408 - GL_RGBA_INTEGER: 36249 - GL_RGBA4: 32854 - GL_RGBA8: 32856 - GL_RGBA8I: 36238 - GL_RGBA8UI: 36220 - GL_RGBA8_SNORM: 36759 - GL_RGBA16F: 34842 - GL_RGBA16I: 36232 - GL_RGBA16UI: 36214 - GL_RGBA32F: 34836 - GL_RGBA32I: 36226 - GL_RGBA32UI: 36208 - GL_SAMPLE_ALPHA_TO_COVERAGE: 32926 - GL_SAMPLE_BUFFERS: 32936 - GL_SAMPLE_COVERAGE: 32928 - GL_SAMPLE_COVERAGE_INVERT: 32939 - GL_SAMPLE_COVERAGE_VALUE: 32938 - GL_SAMPLER_2D: 35678 - GL_SAMPLER_2D_ARRAY: 36289 - GL_SAMPLER_2D_ARRAY_SHADOW: 36292 - GL_SAMPLER_2D_SHADOW: 35682 - GL_SAMPLER_3D: 35679 - GL_SAMPLER_BINDING: 35097 - GL_SAMPLER_CUBE: 35680 - GL_SAMPLER_CUBE_SHADOW: 36293 - GL_SAMPLES: 32937 - GL_SCISSOR_BOX: 3088 - GL_SCISSOR_TEST: 3089 - GL_SEPARATE_ATTRIBS: 35981 - GL_SHADER_BINARY_FORMATS: 36344 - GL_SHADER_COMPILER: 36346 - GL_SHADER_SOURCE_LENGTH: 35720 - GL_SHADER_TYPE: 35663 - GL_SHADING_LANGUAGE_VERSION: 35724 - GL_SHORT: 5122 - GL_SIGNALED: 37145 - GL_SIGNED_NORMALIZED: 36764 - GL_SRC_ALPHA: 770 - GL_SRC_ALPHA_SATURATE: 776 - GL_SRC_COLOR: 768 - GL_SRGB: 35904 - GL_SRGB8: 35905 - GL_SRGB8_ALPHA8: 35907 - GL_STATIC_COPY: 35046 - GL_STATIC_DRAW: 35044 - GL_STATIC_READ: 35045 - GL_STENCIL: 6146 - GL_STENCIL_ATTACHMENT: 36128 - GL_STENCIL_BACK_FAIL: 34817 - GL_STENCIL_BACK_FUNC: 34816 - GL_STENCIL_BACK_PASS_DEPTH_FAIL: 34818 - GL_STENCIL_BACK_PASS_DEPTH_PASS: 34819 - GL_STENCIL_BACK_REF: 36003 - GL_STENCIL_BACK_VALUE_MASK: 36004 - GL_STENCIL_BACK_WRITEMASK: 36005 - GL_STENCIL_BITS: 3415 - GL_STENCIL_BUFFER_BIT: 1024 - GL_STENCIL_CLEAR_VALUE: 2961 - GL_STENCIL_FAIL: 2964 - GL_STENCIL_FUNC: 2962 - GL_STENCIL_INDEX8: 36168 - GL_STENCIL_PASS_DEPTH_FAIL: 2965 - GL_STENCIL_PASS_DEPTH_PASS: 2966 - GL_STENCIL_REF: 2967 - GL_STENCIL_TEST: 2960 - GL_STENCIL_VALUE_MASK: 2963 - GL_STENCIL_WRITEMASK: 2968 - GL_STREAM_COPY: 35042 - GL_STREAM_DRAW: 35040 - GL_STREAM_READ: 35041 - GL_SUBPIXEL_BITS: 3408 - GL_SYNC_CONDITION: 37139 - GL_SYNC_FENCE: 37142 - GL_SYNC_FLAGS: 37141 - GL_SYNC_FLUSH_COMMANDS_BIT: 1 - GL_SYNC_GPU_COMMANDS_COMPLETE: 37143 - GL_SYNC_STATUS: 37140 - GL_TEXTURE: 5890 - GL_TEXTURE_2D: 3553 - GL_TEXTURE_2D_ARRAY: 35866 - GL_TEXTURE_3D: 32879 - GL_TEXTURE_BASE_LEVEL: 33084 - GL_TEXTURE_BINDING_2D: 32873 - GL_TEXTURE_BINDING_2D_ARRAY: 35869 - GL_TEXTURE_BINDING_3D: 32874 - GL_TEXTURE_BINDING_CUBE_MAP: 34068 - GL_TEXTURE_COMPARE_FUNC: 34893 - GL_TEXTURE_COMPARE_MODE: 34892 - GL_TEXTURE_CUBE_MAP: 34067 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 34070 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 34072 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 34074 - GL_TEXTURE_CUBE_MAP_POSITIVE_X: 34069 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 34071 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 34073 - GL_TEXTURE_IMMUTABLE_FORMAT: 37167 - GL_TEXTURE_IMMUTABLE_LEVELS: 33503 - GL_TEXTURE_MAG_FILTER: 10240 - GL_TEXTURE_MAX_LEVEL: 33085 - GL_TEXTURE_MAX_LOD: 33083 - GL_TEXTURE_MIN_FILTER: 10241 - GL_TEXTURE_MIN_LOD: 33082 - GL_TEXTURE_SWIZZLE_A: 36421 - GL_TEXTURE_SWIZZLE_B: 36420 - GL_TEXTURE_SWIZZLE_G: 36419 - GL_TEXTURE_SWIZZLE_R: 36418 - GL_TEXTURE_WRAP_R: 32882 - GL_TEXTURE_WRAP_S: 10242 - GL_TEXTURE_WRAP_T: 10243 - GL_TEXTURE0: 33984 - GL_TEXTURE1: 33985 - GL_TEXTURE2: 33986 - GL_TEXTURE3: 33987 - GL_TEXTURE4: 33988 - GL_TEXTURE5: 33989 - GL_TEXTURE6: 33990 - GL_TEXTURE7: 33991 - GL_TEXTURE8: 33992 - GL_TEXTURE9: 33993 - GL_TEXTURE10: 33994 - GL_TEXTURE11: 33995 - GL_TEXTURE12: 33996 - GL_TEXTURE13: 33997 - GL_TEXTURE14: 33998 - GL_TEXTURE15: 33999 - GL_TEXTURE16: 34000 - GL_TEXTURE17: 34001 - GL_TEXTURE18: 34002 - GL_TEXTURE19: 34003 - GL_TEXTURE20: 34004 - GL_TEXTURE21: 34005 - GL_TEXTURE22: 34006 - GL_TEXTURE23: 34007 - GL_TEXTURE24: 34008 - GL_TEXTURE25: 34009 - GL_TEXTURE26: 34010 - GL_TEXTURE27: 34011 - GL_TEXTURE28: 34012 - GL_TEXTURE29: 34013 - GL_TEXTURE30: 34014 - GL_TEXTURE31: 34015 - GL_TIMEOUT_EXPIRED: 37147 - GL_TIMEOUT_IGNORED: -1 - GL_TRANSFORM_FEEDBACK: 36386 - GL_TRANSFORM_FEEDBACK_ACTIVE: 36388 - GL_TRANSFORM_FEEDBACK_BINDING: 36389 - GL_TRANSFORM_FEEDBACK_BUFFER: 35982 - GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: 35983 - GL_TRANSFORM_FEEDBACK_BUFFER_MODE: 35967 - GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: 35973 - GL_TRANSFORM_FEEDBACK_BUFFER_START: 35972 - GL_TRANSFORM_FEEDBACK_PAUSED: 36387 - GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 35976 - GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: 35958 - GL_TRANSFORM_FEEDBACK_VARYINGS: 35971 - GL_TRIANGLE_FAN: 6 - GL_TRIANGLE_STRIP: 5 - GL_TRIANGLES: 4 - GL_TRUE: 1 - GL_UNIFORM_ARRAY_STRIDE: 35388 - GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 35395 - GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: 35394 - GL_UNIFORM_BLOCK_BINDING: 35391 - GL_UNIFORM_BLOCK_DATA_SIZE: 35392 - GL_UNIFORM_BLOCK_INDEX: 35386 - GL_UNIFORM_BLOCK_NAME_LENGTH: 35393 - GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 35398 - GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 35396 - GL_UNIFORM_BUFFER: 35345 - GL_UNIFORM_BUFFER_BINDING: 35368 - GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: 35380 - GL_UNIFORM_BUFFER_SIZE: 35370 - GL_UNIFORM_BUFFER_START: 35369 - GL_UNIFORM_IS_ROW_MAJOR: 35390 - GL_UNIFORM_MATRIX_STRIDE: 35389 - GL_UNIFORM_NAME_LENGTH: 35385 - GL_UNIFORM_OFFSET: 35387 - GL_UNIFORM_SIZE: 35384 - GL_UNIFORM_TYPE: 35383 - GL_UNPACK_ALIGNMENT: 3317 - GL_UNPACK_IMAGE_HEIGHT: 32878 - GL_UNPACK_ROW_LENGTH: 3314 - GL_UNPACK_SKIP_IMAGES: 32877 - GL_UNPACK_SKIP_PIXELS: 3316 - GL_UNPACK_SKIP_ROWS: 3315 - GL_UNSIGNALED: 37144 - GL_UNSIGNED_BYTE: 5121 - GL_UNSIGNED_INT: 5125 - GL_UNSIGNED_INT_2_10_10_10_REV: 33640 - GL_UNSIGNED_INT_5_9_9_9_REV: 35902 - GL_UNSIGNED_INT_10F_11F_11F_REV: 35899 - GL_UNSIGNED_INT_24_8: 34042 - GL_UNSIGNED_INT_SAMPLER_2D: 36306 - GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: 36311 - GL_UNSIGNED_INT_SAMPLER_3D: 36307 - GL_UNSIGNED_INT_SAMPLER_CUBE: 36308 - GL_UNSIGNED_INT_VEC2: 36294 - GL_UNSIGNED_INT_VEC3: 36295 - GL_UNSIGNED_INT_VEC4: 36296 - GL_UNSIGNED_NORMALIZED: 35863 - GL_UNSIGNED_SHORT: 5123 - GL_UNSIGNED_SHORT_4_4_4_4: 32819 - GL_UNSIGNED_SHORT_5_5_5_1: 32820 - GL_UNSIGNED_SHORT_5_6_5: 33635 - GL_VALIDATE_STATUS: 35715 - GL_VENDOR: 7936 - GL_VERSION: 7938 - GL_VERTEX_ARRAY_BINDING: 34229 - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 34975 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR: 35070 - GL_VERTEX_ATTRIB_ARRAY_ENABLED: 34338 - GL_VERTEX_ATTRIB_ARRAY_INTEGER: 35069 - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: 34922 - GL_VERTEX_ATTRIB_ARRAY_POINTER: 34373 - GL_VERTEX_ATTRIB_ARRAY_SIZE: 34339 - GL_VERTEX_ATTRIB_ARRAY_STRIDE: 34340 - GL_VERTEX_ATTRIB_ARRAY_TYPE: 34341 - GL_VERTEX_SHADER: 35633 - GL_VIEWPORT: 2978 - GL_WAIT_FAILED: 37149 - GL_ZERO: 0 diff --git a/spec/generated/hardwarebuffer.yaml b/spec/generated/hardwarebuffer.yaml deleted file mode 100644 index a1481d3..0000000 --- a/spec/generated/hardwarebuffer.yaml +++ /dev/null @@ -1,292 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: hardwarebuffer -source_package: github.com/AndroidGoLab/ndk/capi/hardwarebuffer -types: - AHardwareBuffer: - kind: opaque_ptr - c_type: AHardwareBuffer - go_type: '*C.AHardwareBuffer' - AHardwareBuffer_Desc: - kind: opaque_ptr - c_type: AHardwareBuffer_Desc - go_type: '*C.AHardwareBuffer_Desc' - AHardwareBuffer_Plane: - kind: opaque_ptr - c_type: AHardwareBuffer_Plane - go_type: '*C.AHardwareBuffer_Plane' - AHardwareBuffer_Planes: - kind: opaque_ptr - c_type: AHardwareBuffer_Planes - go_type: '*C.AHardwareBuffer_Planes' -enums: - AHardwareBuffer_Format: - - name: AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM - value: 1 - - name: AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM - value: 2 - - name: AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM - value: 3 - - name: AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM - value: 4 - - name: AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT - value: 22 - - name: AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM - value: 43 - - name: AHARDWAREBUFFER_FORMAT_BLOB - value: 33 - - name: AHARDWAREBUFFER_FORMAT_D16_UNORM - value: 48 - - name: AHARDWAREBUFFER_FORMAT_D24_UNORM - value: 49 - - name: AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT - value: 50 - - name: AHARDWAREBUFFER_FORMAT_D32_FLOAT - value: 51 - - name: AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT - value: 52 - - name: AHARDWAREBUFFER_FORMAT_S8_UINT - value: 53 - - name: AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 - value: 35 - - name: AHARDWAREBUFFER_FORMAT_YCbCr_P010 - value: 54 - - name: AHARDWAREBUFFER_FORMAT_YCbCr_P210 - value: 60 - - name: AHARDWAREBUFFER_FORMAT_R8_UNORM - value: 56 - - name: AHARDWAREBUFFER_FORMAT_R16_UINT - value: 57 - - name: AHARDWAREBUFFER_FORMAT_R16G16_UINT - value: 58 - - name: AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM - value: 59 - AHardwareBuffer_UsageFlags: - - name: AHARDWAREBUFFER_USAGE_CPU_READ_NEVER - value: 0 - - name: AHARDWAREBUFFER_USAGE_CPU_READ_RARELY - value: 2 - - name: AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN - value: 3 - - name: AHARDWAREBUFFER_USAGE_CPU_READ_MASK - value: 15 - - name: AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER - value: 0 - - name: AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY - value: 32 - - name: AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN - value: 48 - - name: AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK - value: 240 - - name: AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE - value: 256 - - name: AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER - value: 512 - - name: AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT - value: 512 - - name: AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY - value: 2048 - - name: AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT - value: 16384 - - name: AHARDWAREBUFFER_USAGE_VIDEO_ENCODE - value: 65536 - - name: AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA - value: 8388608 - - name: AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER - value: 16777216 - - name: AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP - value: 33554432 - - name: AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE - value: 67108864 - - name: AHARDWAREBUFFER_USAGE_FRONT_BUFFER - value: 4294967296 - - name: AHARDWAREBUFFER_USAGE_VENDOR_0 - value: 268435456 - - name: AHARDWAREBUFFER_USAGE_VENDOR_1 - value: 536870912 - - name: AHARDWAREBUFFER_USAGE_VENDOR_2 - value: 1073741824 - - name: AHARDWAREBUFFER_USAGE_VENDOR_3 - value: -2147483648 - - name: AHARDWAREBUFFER_USAGE_VENDOR_4 - value: 281474976710656 - - name: AHARDWAREBUFFER_USAGE_VENDOR_5 - value: 562949953421312 - - name: AHARDWAREBUFFER_USAGE_VENDOR_6 - value: 1125899906842624 - - name: AHARDWAREBUFFER_USAGE_VENDOR_7 - value: 2251799813685248 - - name: AHARDWAREBUFFER_USAGE_VENDOR_8 - value: 4503599627370496 - - name: AHARDWAREBUFFER_USAGE_VENDOR_9 - value: 9007199254740992 - - name: AHARDWAREBUFFER_USAGE_VENDOR_10 - value: 18014398509481984 - - name: AHARDWAREBUFFER_USAGE_VENDOR_11 - value: 36028797018963968 - - name: AHARDWAREBUFFER_USAGE_VENDOR_12 - value: 72057594037927936 - - name: AHARDWAREBUFFER_USAGE_VENDOR_13 - value: 144115188075855872 - - name: AHARDWAREBUFFER_USAGE_VENDOR_14 - value: 288230376151711744 - - name: AHARDWAREBUFFER_USAGE_VENDOR_15 - value: 576460752303423488 - - name: AHARDWAREBUFFER_USAGE_VENDOR_16 - value: 1152921504606846976 - - name: AHARDWAREBUFFER_USAGE_VENDOR_17 - value: 2305843009213693952 - - name: AHARDWAREBUFFER_USAGE_VENDOR_18 - value: 4611686018427387904 - - name: AHARDWAREBUFFER_USAGE_VENDOR_19 - value: -9223372036854775808 -functions: - AHardwareBuffer_acquire: - c_name: AHardwareBuffer_acquire - params: - - name: buffer - type: '*AHardwareBuffer' - returns: "" - AHardwareBuffer_allocate: - c_name: AHardwareBuffer_allocate - params: - - name: desc - type: '*AHardwareBuffer_Desc' - - name: outBuffer - type: '**AHardwareBuffer' - direction: out - returns: int32 - AHardwareBuffer_describe: - c_name: AHardwareBuffer_describe - params: - - name: buffer - type: '*AHardwareBuffer' - - name: outDesc - type: '*AHardwareBuffer_Desc' - returns: "" - AHardwareBuffer_getId: - c_name: AHardwareBuffer_getId - params: - - name: buffer - type: '*AHardwareBuffer' - - name: outId - type: '*uint64' - returns: int32 - AHardwareBuffer_isSupported: - c_name: AHardwareBuffer_isSupported - params: - - name: desc - type: '*AHardwareBuffer_Desc' - returns: int32 - AHardwareBuffer_lock: - c_name: AHardwareBuffer_lock - params: - - name: buffer - type: '*AHardwareBuffer' - - name: usage - type: uint64 - - name: fence - type: int32 - - name: rect - type: '*ARect' - - name: outVirtualAddress - type: '*unsafe.Pointer' - direction: out - returns: int32 - AHardwareBuffer_lockAndGetInfo: - c_name: AHardwareBuffer_lockAndGetInfo - params: - - name: buffer - type: '*AHardwareBuffer' - - name: usage - type: uint64 - - name: fence - type: int32 - - name: rect - type: '*ARect' - - name: outVirtualAddress - type: '*unsafe.Pointer' - direction: out - - name: outBytesPerPixel - type: '*int32' - - name: outBytesPerStride - type: '*int32' - returns: int32 - AHardwareBuffer_lockPlanes: - c_name: AHardwareBuffer_lockPlanes - params: - - name: buffer - type: '*AHardwareBuffer' - - name: usage - type: uint64 - - name: fence - type: int32 - - name: rect - type: '*ARect' - - name: outPlanes - type: '*AHardwareBuffer_Planes' - returns: int32 - AHardwareBuffer_recvHandleFromUnixSocket: - c_name: AHardwareBuffer_recvHandleFromUnixSocket - params: - - name: socketFd - type: int32 - - name: outBuffer - type: '**AHardwareBuffer' - direction: out - returns: int32 - AHardwareBuffer_release: - c_name: AHardwareBuffer_release - params: - - name: buffer - type: '*AHardwareBuffer' - returns: "" - AHardwareBuffer_sendHandleToUnixSocket: - c_name: AHardwareBuffer_sendHandleToUnixSocket - params: - - name: buffer - type: '*AHardwareBuffer' - - name: socketFd - type: int32 - returns: int32 - AHardwareBuffer_unlock: - c_name: AHardwareBuffer_unlock - params: - - name: buffer - type: '*AHardwareBuffer' - - name: fence - type: '*int32' - returns: int32 -structs: - AHardwareBuffer_Desc: - fields: - - name: width - type: uint32 - - name: height - type: uint32 - - name: layers - type: uint32 - - name: format - type: uint32 - - name: usage - type: uint64 - - name: stride - type: uint32 - - name: rfu0 - type: uint32 - - name: rfu1 - type: uint64 - AHardwareBuffer_Plane: - fields: - - name: data - type: unsafe.Pointer - - name: pixelStride - type: uint32 - - name: rowStride - type: uint32 - AHardwareBuffer_Planes: - fields: - - name: planeCount - type: uint32 - - name: planes - type: '[4]AHardwareBuffer_Plane' diff --git a/spec/generated/imagedecoder.yaml b/spec/generated/imagedecoder.yaml deleted file mode 100644 index 1a3b814..0000000 --- a/spec/generated/imagedecoder.yaml +++ /dev/null @@ -1,442 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: imagedecoder -source_package: github.com/AndroidGoLab/ndk/capi/imagedecoder -types: - AAsset: - kind: opaque_ptr - c_type: AAsset - go_type: '*C.AAsset' - AAssetDir: - kind: opaque_ptr - c_type: AAssetDir - go_type: '*C.AAssetDir' - AAssetManager: - kind: opaque_ptr - c_type: AAssetManager - go_type: '*C.AAssetManager' - AImageDecoder: - kind: opaque_ptr - c_type: AImageDecoder - go_type: '*C.AImageDecoder' - AImageDecoderFrameInfo: - kind: opaque_ptr - c_type: AImageDecoderFrameInfo - go_type: '*C.AImageDecoderFrameInfo' - AImageDecoderHeaderInfo: - kind: opaque_ptr - c_type: AImageDecoderHeaderInfo - go_type: '*C.AImageDecoderHeaderInfo' -enums: - AASSET_MODE: - - name: AASSET_MODE_UNKNOWN - value: 0 - - name: AASSET_MODE_RANDOM - value: 1 - - name: AASSET_MODE_STREAMING - value: 2 - - name: AASSET_MODE_BUFFER - value: 3 - ANDROID_IMAGE: - - name: ANDROID_IMAGE_DECODER_INFINITE - value: 2147483647 - ANDROID_IMAGE_DECODER: - - name: ANDROID_IMAGE_DECODER_SUCCESS - value: 0 - - name: ANDROID_IMAGE_DECODER_INCOMPLETE - value: -1 - - name: ANDROID_IMAGE_DECODER_ERROR - value: -2 - - name: ANDROID_IMAGE_DECODER_INVALID_CONVERSION - value: -3 - - name: ANDROID_IMAGE_DECODER_INVALID_SCALE - value: -4 - - name: ANDROID_IMAGE_DECODER_BAD_PARAMETER - value: -5 - - name: ANDROID_IMAGE_DECODER_INVALID_INPUT - value: -6 - - name: ANDROID_IMAGE_DECODER_SEEK_ERROR - value: -7 - - name: ANDROID_IMAGE_DECODER_INTERNAL_ERROR - value: -8 - - name: ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT - value: -9 - - name: ANDROID_IMAGE_DECODER_FINISHED - value: -10 - - name: ANDROID_IMAGE_DECODER_INVALID_STATE - value: -11 - ANDROID_IMAGE_DECODER_BLEND_OP_SRC: - - name: ANDROID_IMAGE_DECODER_BLEND_OP_SRC - value: 1 - - name: ANDROID_IMAGE_DECODER_BLEND_OP_SRC_OVER - value: 2 - ANDROID_IMAGE_DECODER_DISPOSE_OP: - - name: ANDROID_IMAGE_DECODER_DISPOSE_OP_NONE - value: 1 - - name: ANDROID_IMAGE_DECODER_DISPOSE_OP_BACKGROUND - value: 2 - - name: ANDROID_IMAGE_DECODER_DISPOSE_OP_PREVIOUS - value: 3 -functions: - AAsset_close: - c_name: AAsset_close - params: - - name: asset - type: '*AAsset' - returns: "" - AAsset_getBuffer: - c_name: AAsset_getBuffer - params: - - name: asset - type: '*AAsset' - returns: unsafe.Pointer - AAsset_getLength: - c_name: AAsset_getLength - params: - - name: asset - type: '*AAsset' - returns: off_t - AAsset_getLength64: - c_name: AAsset_getLength64 - params: - - name: asset - type: '*AAsset' - returns: off64_t - AAsset_getRemainingLength: - c_name: AAsset_getRemainingLength - params: - - name: asset - type: '*AAsset' - returns: off_t - AAsset_getRemainingLength64: - c_name: AAsset_getRemainingLength64 - params: - - name: asset - type: '*AAsset' - returns: off64_t - AAsset_isAllocated: - c_name: AAsset_isAllocated - params: - - name: asset - type: '*AAsset' - returns: int32 - AAsset_openFileDescriptor: - c_name: AAsset_openFileDescriptor - params: - - name: asset - type: '*AAsset' - - name: outStart - type: '*off_t' - - name: outLength - type: '*off_t' - returns: int32 - AAsset_openFileDescriptor64: - c_name: AAsset_openFileDescriptor64 - params: - - name: asset - type: '*AAsset' - - name: outStart - type: '*off64_t' - - name: outLength - type: '*off64_t' - returns: int32 - AAsset_read: - c_name: AAsset_read - params: - - name: asset - type: '*AAsset' - - name: buf - type: unsafe.Pointer - - name: count - type: uint64 - returns: int32 - AAsset_seek: - c_name: AAsset_seek - params: - - name: asset - type: '*AAsset' - - name: offset - type: off_t - - name: whence - type: int32 - returns: off_t - AAsset_seek64: - c_name: AAsset_seek64 - params: - - name: asset - type: '*AAsset' - - name: offset - type: off64_t - - name: whence - type: int32 - returns: off64_t - AAssetDir_close: - c_name: AAssetDir_close - params: - - name: assetDir - type: '*AAssetDir' - returns: "" - AAssetDir_getNextFileName: - c_name: AAssetDir_getNextFileName - params: - - name: assetDir - type: '*AAssetDir' - returns: string - AAssetDir_rewind: - c_name: AAssetDir_rewind - params: - - name: assetDir - type: '*AAssetDir' - returns: "" - AAssetManager_open: - c_name: AAssetManager_open - params: - - name: mgr - type: '*AAssetManager' - - name: filename - type: string - - name: mode - type: int32 - returns: '*AAsset' - AAssetManager_openDir: - c_name: AAssetManager_openDir - params: - - name: mgr - type: '*AAssetManager' - - name: dirName - type: string - returns: '*AAssetDir' - AImageDecoder_advanceFrame: - c_name: AImageDecoder_advanceFrame - params: - - name: decoder - type: '*AImageDecoder' - returns: int32 - AImageDecoder_computeSampledSize: - c_name: AImageDecoder_computeSampledSize - params: - - name: decoder - type: '*AImageDecoder' - - name: sampleSize - type: int32 - - name: width - type: '*int32' - - name: height - type: '*int32' - returns: int32 - AImageDecoder_createFromAAsset: - c_name: AImageDecoder_createFromAAsset - params: - - name: asset - type: '*AAsset' - - name: outDecoder - type: '**AImageDecoder' - direction: out - returns: int32 - AImageDecoder_createFromBuffer: - c_name: AImageDecoder_createFromBuffer - params: - - name: buffer - type: unsafe.Pointer - - name: length - type: uint64 - - name: outDecoder - type: '**AImageDecoder' - direction: out - returns: int32 - AImageDecoder_createFromFd: - c_name: AImageDecoder_createFromFd - params: - - name: fd - type: int32 - - name: outDecoder - type: '**AImageDecoder' - direction: out - returns: int32 - AImageDecoder_decodeImage: - c_name: AImageDecoder_decodeImage - params: - - name: decoder - type: '*AImageDecoder' - - name: pixels - type: unsafe.Pointer - - name: stride - type: uint64 - - name: size - type: uint64 - returns: int32 - AImageDecoder_delete: - c_name: AImageDecoder_delete - params: - - name: decoder - type: '*AImageDecoder' - returns: "" - AImageDecoder_getFrameInfo: - c_name: AImageDecoder_getFrameInfo - params: - - name: decoder - type: '*AImageDecoder' - - name: info - type: '*AImageDecoderFrameInfo' - returns: int32 - AImageDecoder_getHeaderInfo: - c_name: AImageDecoder_getHeaderInfo - params: - - name: decoder - type: '*AImageDecoder' - returns: '*AImageDecoderHeaderInfo' - AImageDecoder_getMinimumStride: - c_name: AImageDecoder_getMinimumStride - params: - - name: decoder - type: '*AImageDecoder' - returns: uint64 - AImageDecoder_getRepeatCount: - c_name: AImageDecoder_getRepeatCount - params: - - name: decoder - type: '*AImageDecoder' - returns: int32 - AImageDecoder_isAnimated: - c_name: AImageDecoder_isAnimated - params: - - name: decoder - type: '*AImageDecoder' - returns: bool - AImageDecoder_resultToString: - c_name: AImageDecoder_resultToString - params: - - name: "" - type: int32 - returns: string - AImageDecoder_rewind: - c_name: AImageDecoder_rewind - params: - - name: decoder - type: '*AImageDecoder' - returns: int32 - AImageDecoder_setAndroidBitmapFormat: - c_name: AImageDecoder_setAndroidBitmapFormat - params: - - name: decoder - type: '*AImageDecoder' - - name: format - type: int32 - returns: int32 - AImageDecoder_setCrop: - c_name: AImageDecoder_setCrop - params: - - name: decoder - type: '*AImageDecoder' - - name: crop - type: ARect - returns: int32 - AImageDecoder_setDataSpace: - c_name: AImageDecoder_setDataSpace - params: - - name: decoder - type: '*AImageDecoder' - - name: dataspace - type: int32 - returns: int32 - AImageDecoder_setInternallyHandleDisposePrevious: - c_name: AImageDecoder_setInternallyHandleDisposePrevious - params: - - name: decoder - type: '*AImageDecoder' - - name: handleInternally - type: bool - returns: "" - AImageDecoder_setTargetSize: - c_name: AImageDecoder_setTargetSize - params: - - name: decoder - type: '*AImageDecoder' - - name: width - type: int32 - - name: height - type: int32 - returns: int32 - AImageDecoder_setUnpremultipliedRequired: - c_name: AImageDecoder_setUnpremultipliedRequired - params: - - name: decoder - type: '*AImageDecoder' - - name: unpremultipliedRequired - type: bool - returns: int32 - AImageDecoderFrameInfo_create: - c_name: AImageDecoderFrameInfo_create - returns: '*AImageDecoderFrameInfo' - AImageDecoderFrameInfo_delete: - c_name: AImageDecoderFrameInfo_delete - params: - - name: info - type: '*AImageDecoderFrameInfo' - returns: "" - AImageDecoderFrameInfo_getBlendOp: - c_name: AImageDecoderFrameInfo_getBlendOp - params: - - name: info - type: '*AImageDecoderFrameInfo' - returns: int32 - AImageDecoderFrameInfo_getDisposeOp: - c_name: AImageDecoderFrameInfo_getDisposeOp - params: - - name: info - type: '*AImageDecoderFrameInfo' - returns: int32 - AImageDecoderFrameInfo_getDuration: - c_name: AImageDecoderFrameInfo_getDuration - params: - - name: info - type: '*AImageDecoderFrameInfo' - returns: int64 - AImageDecoderFrameInfo_getFrameRect: - c_name: AImageDecoderFrameInfo_getFrameRect - params: - - name: info - type: '*AImageDecoderFrameInfo' - returns: ARect - AImageDecoderFrameInfo_hasAlphaWithinBounds: - c_name: AImageDecoderFrameInfo_hasAlphaWithinBounds - params: - - name: info - type: '*AImageDecoderFrameInfo' - returns: bool - AImageDecoderHeaderInfo_getAlphaFlags: - c_name: AImageDecoderHeaderInfo_getAlphaFlags - params: - - name: "" - type: '*AImageDecoderHeaderInfo' - returns: int32 - AImageDecoderHeaderInfo_getAndroidBitmapFormat: - c_name: AImageDecoderHeaderInfo_getAndroidBitmapFormat - params: - - name: "" - type: '*AImageDecoderHeaderInfo' - returns: int32 - AImageDecoderHeaderInfo_getDataSpace: - c_name: AImageDecoderHeaderInfo_getDataSpace - params: - - name: "" - type: '*AImageDecoderHeaderInfo' - returns: int32 - AImageDecoderHeaderInfo_getHeight: - c_name: AImageDecoderHeaderInfo_getHeight - params: - - name: "" - type: '*AImageDecoderHeaderInfo' - returns: int32 - AImageDecoderHeaderInfo_getMimeType: - c_name: AImageDecoderHeaderInfo_getMimeType - params: - - name: "" - type: '*AImageDecoderHeaderInfo' - returns: string - AImageDecoderHeaderInfo_getWidth: - c_name: AImageDecoderHeaderInfo_getWidth - params: - - name: "" - type: '*AImageDecoderHeaderInfo' - returns: int32 diff --git a/spec/generated/input.yaml b/spec/generated/input.yaml deleted file mode 100644 index f52656d..0000000 --- a/spec/generated/input.yaml +++ /dev/null @@ -1,864 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: input -source_package: github.com/AndroidGoLab/ndk/capi/input -types: - AInputEvent: - kind: opaque_ptr - c_type: AInputEvent - go_type: '*C.AInputEvent' - AInputQueue: - kind: opaque_ptr - c_type: AInputQueue - go_type: '*C.AInputQueue' -enums: - AINPUT_EVENT_TYPE: - - name: AINPUT_EVENT_TYPE_KEY - value: 1 - - name: AINPUT_EVENT_TYPE_MOTION - value: 2 - - name: AINPUT_EVENT_TYPE_FOCUS - value: 3 - - name: AINPUT_EVENT_TYPE_CAPTURE - value: 4 - - name: AINPUT_EVENT_TYPE_DRAG - value: 5 - - name: AINPUT_EVENT_TYPE_TOUCH_MODE - value: 6 - AINPUT_KEYBOARD_TYPE: - - name: AINPUT_KEYBOARD_TYPE_NONE - value: 0 - - name: AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC - value: 1 - - name: AINPUT_KEYBOARD_TYPE_ALPHABETIC - value: 2 - AINPUT_MOTION_RANGE: - - name: AINPUT_MOTION_RANGE_X - value: 0 - - name: AINPUT_MOTION_RANGE_Y - value: 1 - - name: AINPUT_MOTION_RANGE_PRESSURE - value: 2 - - name: AINPUT_MOTION_RANGE_SIZE - value: 3 - - name: AINPUT_MOTION_RANGE_TOUCH_MAJOR - value: 4 - - name: AINPUT_MOTION_RANGE_TOUCH_MINOR - value: 5 - - name: AINPUT_MOTION_RANGE_TOOL_MAJOR - value: 6 - - name: AINPUT_MOTION_RANGE_TOOL_MINOR - value: 7 - - name: AINPUT_MOTION_RANGE_ORIENTATION - value: 8 - AINPUT_SOURCE: - - name: AINPUT_SOURCE_UNKNOWN - value: 0 - - name: AINPUT_SOURCE_KEYBOARD - value: 257 - - name: AINPUT_SOURCE_DPAD - value: 513 - - name: AINPUT_SOURCE_GAMEPAD - value: 1025 - - name: AINPUT_SOURCE_TOUCHSCREEN - value: 4098 - - name: AINPUT_SOURCE_MOUSE - value: 8194 - - name: AINPUT_SOURCE_STYLUS - value: 16386 - - name: AINPUT_SOURCE_BLUETOOTH_STYLUS - value: 49154 - - name: AINPUT_SOURCE_TRACKBALL - value: 65540 - - name: AINPUT_SOURCE_MOUSE_RELATIVE - value: 131076 - - name: AINPUT_SOURCE_TOUCHPAD - value: 1048584 - - name: AINPUT_SOURCE_TOUCH_NAVIGATION - value: 2097152 - - name: AINPUT_SOURCE_JOYSTICK - value: 16777232 - - name: AINPUT_SOURCE_HDMI - value: 33554433 - - name: AINPUT_SOURCE_SENSOR - value: 67108864 - - name: AINPUT_SOURCE_ROTARY_ENCODER - value: 4194304 - - name: AINPUT_SOURCE_ANY - value: -256 - AINPUT_SOURCE_CLASS: - - name: AINPUT_SOURCE_CLASS_MASK - value: 255 - - name: AINPUT_SOURCE_CLASS_NONE - value: 0 - - name: AINPUT_SOURCE_CLASS_BUTTON - value: 1 - - name: AINPUT_SOURCE_CLASS_POINTER - value: 2 - - name: AINPUT_SOURCE_CLASS_NAVIGATION - value: 4 - - name: AINPUT_SOURCE_CLASS_POSITION - value: 8 - - name: AINPUT_SOURCE_CLASS_JOYSTICK - value: 16 - AKEY_EVENT_ACTION: - - name: AKEY_EVENT_ACTION_DOWN - value: 0 - - name: AKEY_EVENT_ACTION_UP - value: 1 - - name: AKEY_EVENT_ACTION_MULTIPLE - value: 2 - AKEY_EVENT_FLAG: - - name: AKEY_EVENT_FLAG_WOKE_HERE - value: 1 - - name: AKEY_EVENT_FLAG_SOFT_KEYBOARD - value: 2 - - name: AKEY_EVENT_FLAG_KEEP_TOUCH_MODE - value: 4 - - name: AKEY_EVENT_FLAG_FROM_SYSTEM - value: 8 - - name: AKEY_EVENT_FLAG_EDITOR_ACTION - value: 16 - - name: AKEY_EVENT_FLAG_CANCELED - value: 32 - - name: AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY - value: 64 - - name: AKEY_EVENT_FLAG_LONG_PRESS - value: 128 - - name: AKEY_EVENT_FLAG_CANCELED_LONG_PRESS - value: 256 - - name: AKEY_EVENT_FLAG_TRACKING - value: 512 - - name: AKEY_EVENT_FLAG_FALLBACK - value: 1024 - AKEY_STATE: - - name: AKEY_STATE_UNKNOWN - value: -1 - - name: AKEY_STATE_UP - value: 0 - - name: AKEY_STATE_DOWN - value: 1 - - name: AKEY_STATE_VIRTUAL - value: 2 - AMETA: - - name: AMETA_NONE - value: 0 - - name: AMETA_ALT_ON - value: 2 - - name: AMETA_ALT_LEFT_ON - value: 16 - - name: AMETA_ALT_RIGHT_ON - value: 32 - - name: AMETA_SHIFT_ON - value: 1 - - name: AMETA_SHIFT_LEFT_ON - value: 64 - - name: AMETA_SHIFT_RIGHT_ON - value: 128 - - name: AMETA_SYM_ON - value: 4 - - name: AMETA_FUNCTION_ON - value: 8 - - name: AMETA_CTRL_ON - value: 4096 - - name: AMETA_CTRL_LEFT_ON - value: 8192 - - name: AMETA_CTRL_RIGHT_ON - value: 16384 - - name: AMETA_META_ON - value: 65536 - - name: AMETA_META_LEFT_ON - value: 131072 - - name: AMETA_META_RIGHT_ON - value: 262144 - - name: AMETA_CAPS_LOCK_ON - value: 1048576 - - name: AMETA_NUM_LOCK_ON - value: 2097152 - - name: AMETA_SCROLL_LOCK_ON - value: 4194304 - AMOTION_EVENT: - - name: AMOTION_EVENT_AXIS_X - value: 0 - - name: AMOTION_EVENT_AXIS_Y - value: 1 - - name: AMOTION_EVENT_AXIS_PRESSURE - value: 2 - - name: AMOTION_EVENT_AXIS_SIZE - value: 3 - - name: AMOTION_EVENT_AXIS_TOUCH_MAJOR - value: 4 - - name: AMOTION_EVENT_AXIS_TOUCH_MINOR - value: 5 - - name: AMOTION_EVENT_AXIS_TOOL_MAJOR - value: 6 - - name: AMOTION_EVENT_AXIS_TOOL_MINOR - value: 7 - - name: AMOTION_EVENT_AXIS_ORIENTATION - value: 8 - - name: AMOTION_EVENT_AXIS_VSCROLL - value: 9 - - name: AMOTION_EVENT_AXIS_HSCROLL - value: 10 - - name: AMOTION_EVENT_AXIS_Z - value: 11 - - name: AMOTION_EVENT_AXIS_RX - value: 12 - - name: AMOTION_EVENT_AXIS_RY - value: 13 - - name: AMOTION_EVENT_AXIS_RZ - value: 14 - - name: AMOTION_EVENT_AXIS_HAT_X - value: 15 - - name: AMOTION_EVENT_AXIS_HAT_Y - value: 16 - - name: AMOTION_EVENT_AXIS_LTRIGGER - value: 17 - - name: AMOTION_EVENT_AXIS_RTRIGGER - value: 18 - - name: AMOTION_EVENT_AXIS_THROTTLE - value: 19 - - name: AMOTION_EVENT_AXIS_RUDDER - value: 20 - - name: AMOTION_EVENT_AXIS_WHEEL - value: 21 - - name: AMOTION_EVENT_AXIS_GAS - value: 22 - - name: AMOTION_EVENT_AXIS_BRAKE - value: 23 - - name: AMOTION_EVENT_AXIS_DISTANCE - value: 24 - - name: AMOTION_EVENT_AXIS_TILT - value: 25 - - name: AMOTION_EVENT_AXIS_SCROLL - value: 26 - - name: AMOTION_EVENT_AXIS_RELATIVE_X - value: 27 - - name: AMOTION_EVENT_AXIS_RELATIVE_Y - value: 28 - - name: AMOTION_EVENT_AXIS_GENERIC_1 - value: 32 - - name: AMOTION_EVENT_AXIS_GENERIC_2 - value: 33 - - name: AMOTION_EVENT_AXIS_GENERIC_3 - value: 34 - - name: AMOTION_EVENT_AXIS_GENERIC_4 - value: 35 - - name: AMOTION_EVENT_AXIS_GENERIC_5 - value: 36 - - name: AMOTION_EVENT_AXIS_GENERIC_6 - value: 37 - - name: AMOTION_EVENT_AXIS_GENERIC_7 - value: 38 - - name: AMOTION_EVENT_AXIS_GENERIC_8 - value: 39 - - name: AMOTION_EVENT_AXIS_GENERIC_9 - value: 40 - - name: AMOTION_EVENT_AXIS_GENERIC_10 - value: 41 - - name: AMOTION_EVENT_AXIS_GENERIC_11 - value: 42 - - name: AMOTION_EVENT_AXIS_GENERIC_12 - value: 43 - - name: AMOTION_EVENT_AXIS_GENERIC_13 - value: 44 - - name: AMOTION_EVENT_AXIS_GENERIC_14 - value: 45 - - name: AMOTION_EVENT_AXIS_GENERIC_15 - value: 46 - - name: AMOTION_EVENT_AXIS_GENERIC_16 - value: 47 - - name: AMOTION_EVENT_AXIS_GESTURE_X_OFFSET - value: 48 - - name: AMOTION_EVENT_AXIS_GESTURE_Y_OFFSET - value: 49 - - name: AMOTION_EVENT_AXIS_GESTURE_SCROLL_X_DISTANCE - value: 50 - - name: AMOTION_EVENT_AXIS_GESTURE_SCROLL_Y_DISTANCE - value: 51 - - name: AMOTION_EVENT_AXIS_GESTURE_PINCH_SCALE_FACTOR - value: 52 - - name: AMOTION_EVENT_AXIS_GESTURE_SWIPE_FINGER_COUNT - value: 53 - - name: AMOTION_EVENT_MAXIMUM_VALID_AXIS_VALUE - value: 53 - AMOTION_EVENT_ACTION: - - name: AMOTION_EVENT_ACTION_MASK - value: 255 - - name: AMOTION_EVENT_ACTION_POINTER_INDEX_MASK - value: 65280 - - name: AMOTION_EVENT_ACTION_DOWN - value: 0 - - name: AMOTION_EVENT_ACTION_UP - value: 1 - - name: AMOTION_EVENT_ACTION_MOVE - value: 2 - - name: AMOTION_EVENT_ACTION_CANCEL - value: 3 - - name: AMOTION_EVENT_ACTION_OUTSIDE - value: 4 - - name: AMOTION_EVENT_ACTION_POINTER_DOWN - value: 5 - - name: AMOTION_EVENT_ACTION_POINTER_UP - value: 6 - - name: AMOTION_EVENT_ACTION_HOVER_MOVE - value: 7 - - name: AMOTION_EVENT_ACTION_SCROLL - value: 8 - - name: AMOTION_EVENT_ACTION_HOVER_ENTER - value: 9 - - name: AMOTION_EVENT_ACTION_HOVER_EXIT - value: 10 - - name: AMOTION_EVENT_ACTION_BUTTON_PRESS - value: 11 - - name: AMOTION_EVENT_ACTION_BUTTON_RELEASE - value: 12 - AMOTION_EVENT_BUTTON: - - name: AMOTION_EVENT_BUTTON_PRIMARY - value: 1 - - name: AMOTION_EVENT_BUTTON_SECONDARY - value: 2 - - name: AMOTION_EVENT_BUTTON_TERTIARY - value: 4 - - name: AMOTION_EVENT_BUTTON_BACK - value: 8 - - name: AMOTION_EVENT_BUTTON_FORWARD - value: 16 - - name: AMOTION_EVENT_BUTTON_STYLUS_PRIMARY - value: 32 - - name: AMOTION_EVENT_BUTTON_STYLUS_SECONDARY - value: 64 - AMOTION_EVENT_EDGE_FLAG: - - name: AMOTION_EVENT_EDGE_FLAG_NONE - value: 0 - - name: AMOTION_EVENT_EDGE_FLAG_TOP - value: 1 - - name: AMOTION_EVENT_EDGE_FLAG_BOTTOM - value: 2 - - name: AMOTION_EVENT_EDGE_FLAG_LEFT - value: 4 - - name: AMOTION_EVENT_EDGE_FLAG_RIGHT - value: 8 - AMOTION_EVENT_FLAG_WINDOW: - - name: AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED - value: 1 - AMOTION_EVENT_TOOL_TYPE: - - name: AMOTION_EVENT_TOOL_TYPE_UNKNOWN - value: 0 - - name: AMOTION_EVENT_TOOL_TYPE_FINGER - value: 1 - - name: AMOTION_EVENT_TOOL_TYPE_STYLUS - value: 2 - - name: AMOTION_EVENT_TOOL_TYPE_MOUSE - value: 3 - - name: AMOTION_EVENT_TOOL_TYPE_ERASER - value: 4 - - name: AMOTION_EVENT_TOOL_TYPE_PALM - value: 5 - AMotionClassification: - - name: AMOTION_EVENT_CLASSIFICATION_NONE - value: 0 - - name: AMOTION_EVENT_CLASSIFICATION_AMBIGUOUS_GESTURE - value: 1 - - name: AMOTION_EVENT_CLASSIFICATION_DEEP_PRESS - value: 2 - - name: AMOTION_EVENT_CLASSIFICATION_TWO_FINGER_SWIPE - value: 3 - - name: AMOTION_EVENT_CLASSIFICATION_MULTI_FINGER_SWIPE - value: 4 - - name: AMOTION_EVENT_CLASSIFICATION_PINCH - value: 5 -functions: - AInputEvent_getDeviceId: - c_name: AInputEvent_getDeviceId - params: - - name: event - type: '*AInputEvent' - returns: int32 - AInputEvent_getSource: - c_name: AInputEvent_getSource - params: - - name: event - type: '*AInputEvent' - returns: int32 - AInputEvent_getType: - c_name: AInputEvent_getType - params: - - name: event - type: '*AInputEvent' - returns: int32 - AInputEvent_release: - c_name: AInputEvent_release - params: - - name: event - type: '*AInputEvent' - returns: "" - AInputEvent_toJava: - c_name: AInputEvent_toJava - params: - - name: env - type: '*JNIEnv' - - name: aInputEvent - type: '*AInputEvent' - returns: jobject - AInputQueue_attachLooper: - c_name: AInputQueue_attachLooper - params: - - name: queue - type: '*AInputQueue' - - name: looper - type: '*ALooper' - - name: ident - type: int32 - - name: callback - type: ALooper_callbackFunc - - name: data - type: unsafe.Pointer - returns: "" - AInputQueue_detachLooper: - c_name: AInputQueue_detachLooper - params: - - name: queue - type: '*AInputQueue' - returns: "" - AInputQueue_finishEvent: - c_name: AInputQueue_finishEvent - params: - - name: queue - type: '*AInputQueue' - - name: event - type: '*AInputEvent' - - name: handled - type: int32 - returns: "" - AInputQueue_fromJava: - c_name: AInputQueue_fromJava - params: - - name: env - type: '*JNIEnv' - - name: inputQueue - type: jobject - returns: '*AInputQueue' - AInputQueue_getEvent: - c_name: AInputQueue_getEvent - params: - - name: queue - type: '*AInputQueue' - - name: outEvent - type: '**AInputEvent' - direction: out - returns: int32 - AInputQueue_hasEvents: - c_name: AInputQueue_hasEvents - params: - - name: queue - type: '*AInputQueue' - returns: int32 - AInputQueue_preDispatchEvent: - c_name: AInputQueue_preDispatchEvent - params: - - name: queue - type: '*AInputQueue' - - name: event - type: '*AInputEvent' - returns: int32 - AKeyEvent_fromJava: - c_name: AKeyEvent_fromJava - params: - - name: env - type: '*JNIEnv' - - name: keyEvent - type: jobject - returns: '*AInputEvent' - AKeyEvent_getAction: - c_name: AKeyEvent_getAction - params: - - name: key_event - type: '*AInputEvent' - returns: int32 - AKeyEvent_getDownTime: - c_name: AKeyEvent_getDownTime - params: - - name: key_event - type: '*AInputEvent' - returns: int64 - AKeyEvent_getEventTime: - c_name: AKeyEvent_getEventTime - params: - - name: key_event - type: '*AInputEvent' - returns: int64 - AKeyEvent_getFlags: - c_name: AKeyEvent_getFlags - params: - - name: key_event - type: '*AInputEvent' - returns: int32 - AKeyEvent_getKeyCode: - c_name: AKeyEvent_getKeyCode - params: - - name: key_event - type: '*AInputEvent' - returns: int32 - AKeyEvent_getMetaState: - c_name: AKeyEvent_getMetaState - params: - - name: key_event - type: '*AInputEvent' - returns: int32 - AKeyEvent_getRepeatCount: - c_name: AKeyEvent_getRepeatCount - params: - - name: key_event - type: '*AInputEvent' - returns: int32 - AKeyEvent_getScanCode: - c_name: AKeyEvent_getScanCode - params: - - name: key_event - type: '*AInputEvent' - returns: int32 - AMotionEvent_fromJava: - c_name: AMotionEvent_fromJava - params: - - name: env - type: '*JNIEnv' - - name: motionEvent - type: jobject - returns: '*AInputEvent' - AMotionEvent_getAction: - c_name: AMotionEvent_getAction - params: - - name: motion_event - type: '*AInputEvent' - returns: int32 - AMotionEvent_getActionButton: - c_name: AMotionEvent_getActionButton - params: - - name: motion_event - type: '*AInputEvent' - returns: int32 - AMotionEvent_getAxisValue: - c_name: AMotionEvent_getAxisValue - params: - - name: motion_event - type: '*AInputEvent' - - name: axis - type: int32 - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getButtonState: - c_name: AMotionEvent_getButtonState - params: - - name: motion_event - type: '*AInputEvent' - returns: int32 - AMotionEvent_getClassification: - c_name: AMotionEvent_getClassification - params: - - name: motion_event - type: '*AInputEvent' - returns: int32 - AMotionEvent_getDownTime: - c_name: AMotionEvent_getDownTime - params: - - name: motion_event - type: '*AInputEvent' - returns: int64 - AMotionEvent_getEdgeFlags: - c_name: AMotionEvent_getEdgeFlags - params: - - name: motion_event - type: '*AInputEvent' - returns: int32 - AMotionEvent_getEventTime: - c_name: AMotionEvent_getEventTime - params: - - name: motion_event - type: '*AInputEvent' - returns: int64 - AMotionEvent_getFlags: - c_name: AMotionEvent_getFlags - params: - - name: motion_event - type: '*AInputEvent' - returns: int32 - AMotionEvent_getHistoricalAxisValue: - c_name: AMotionEvent_getHistoricalAxisValue - params: - - name: motion_event - type: '*AInputEvent' - - name: axis - type: int32 - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalEventTime: - c_name: AMotionEvent_getHistoricalEventTime - params: - - name: motion_event - type: '*AInputEvent' - - name: history_index - type: uint64 - returns: int64 - AMotionEvent_getHistoricalOrientation: - c_name: AMotionEvent_getHistoricalOrientation - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalPressure: - c_name: AMotionEvent_getHistoricalPressure - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalRawX: - c_name: AMotionEvent_getHistoricalRawX - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalRawY: - c_name: AMotionEvent_getHistoricalRawY - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalSize: - c_name: AMotionEvent_getHistoricalSize - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalToolMajor: - c_name: AMotionEvent_getHistoricalToolMajor - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalToolMinor: - c_name: AMotionEvent_getHistoricalToolMinor - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalTouchMajor: - c_name: AMotionEvent_getHistoricalTouchMajor - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalTouchMinor: - c_name: AMotionEvent_getHistoricalTouchMinor - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalX: - c_name: AMotionEvent_getHistoricalX - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistoricalY: - c_name: AMotionEvent_getHistoricalY - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - - name: history_index - type: uint64 - returns: float32 - AMotionEvent_getHistorySize: - c_name: AMotionEvent_getHistorySize - params: - - name: motion_event - type: '*AInputEvent' - returns: uint64 - AMotionEvent_getMetaState: - c_name: AMotionEvent_getMetaState - params: - - name: motion_event - type: '*AInputEvent' - returns: int32 - AMotionEvent_getOrientation: - c_name: AMotionEvent_getOrientation - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getPointerCount: - c_name: AMotionEvent_getPointerCount - params: - - name: motion_event - type: '*AInputEvent' - returns: uint64 - AMotionEvent_getPointerId: - c_name: AMotionEvent_getPointerId - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: int32 - AMotionEvent_getPressure: - c_name: AMotionEvent_getPressure - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getRawX: - c_name: AMotionEvent_getRawX - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getRawY: - c_name: AMotionEvent_getRawY - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getSize: - c_name: AMotionEvent_getSize - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getToolMajor: - c_name: AMotionEvent_getToolMajor - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getToolMinor: - c_name: AMotionEvent_getToolMinor - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getToolType: - c_name: AMotionEvent_getToolType - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: int32 - AMotionEvent_getTouchMajor: - c_name: AMotionEvent_getTouchMajor - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getTouchMinor: - c_name: AMotionEvent_getTouchMinor - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getX: - c_name: AMotionEvent_getX - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getXOffset: - c_name: AMotionEvent_getXOffset - params: - - name: motion_event - type: '*AInputEvent' - returns: float32 - AMotionEvent_getXPrecision: - c_name: AMotionEvent_getXPrecision - params: - - name: motion_event - type: '*AInputEvent' - returns: float32 - AMotionEvent_getY: - c_name: AMotionEvent_getY - params: - - name: motion_event - type: '*AInputEvent' - - name: pointer_index - type: uint64 - returns: float32 - AMotionEvent_getYOffset: - c_name: AMotionEvent_getYOffset - params: - - name: motion_event - type: '*AInputEvent' - returns: float32 - AMotionEvent_getYPrecision: - c_name: AMotionEvent_getYPrecision - params: - - name: motion_event - type: '*AInputEvent' - returns: float32 -macros: - AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: 8 diff --git a/spec/generated/logging.yaml b/spec/generated/logging.yaml deleted file mode 100644 index 3e0deff..0000000 --- a/spec/generated/logging.yaml +++ /dev/null @@ -1,196 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: logging -source_package: github.com/AndroidGoLab/ndk/capi/logging -types: - android_LogPriority: - kind: typedef_int32 - c_type: android_LogPriority - go_type: int32 - log_id_t: - kind: typedef_int32 - c_type: log_id_t - go_type: int32 -enums: - android_LogPriority: - - name: ANDROID_LOG_UNKNOWN - value: 0 - - name: ANDROID_LOG_DEFAULT - value: 1 - - name: ANDROID_LOG_VERBOSE - value: 2 - - name: ANDROID_LOG_DEBUG - value: 3 - - name: ANDROID_LOG_INFO - value: 4 - - name: ANDROID_LOG_WARN - value: 5 - - name: ANDROID_LOG_ERROR - value: 6 - - name: ANDROID_LOG_FATAL - value: 7 - - name: ANDROID_LOG_SILENT - value: 8 - log_id_t: - - name: LOG_ID_MIN - value: 0 - - name: LOG_ID_MAIN - value: 0 - - name: LOG_ID_RADIO - value: 1 - - name: LOG_ID_EVENTS - value: 2 - - name: LOG_ID_SYSTEM - value: 3 - - name: LOG_ID_CRASH - value: 4 - - name: LOG_ID_STATS - value: 5 - - name: LOG_ID_SECURITY - value: 6 - - name: LOG_ID_KERNEL - value: 7 - - name: LOG_ID_MAX - value: 8 - - name: LOG_ID_DEFAULT - value: 2147483647 -functions: - __android_log_buf_write: - c_name: __android_log_buf_write - params: - - name: bufID - type: int32 - - name: prio - type: int32 - - name: tag - type: string - - name: text - type: string - returns: int32 - __android_log_call_aborter: - c_name: __android_log_call_aborter - params: - - name: abort_message - type: string - returns: "" - __android_log_default_aborter: - c_name: __android_log_default_aborter - params: - - name: abort_message - type: string - returns: "" - __android_log_get_minimum_priority: - c_name: __android_log_get_minimum_priority - returns: int32 - __android_log_id_is_valid: - c_name: __android_log_id_is_valid - params: - - name: id - type: log_id_t - returns: bool - __android_log_is_loggable: - c_name: __android_log_is_loggable - params: - - name: prio - type: int32 - - name: tag - type: string - - name: default_prio - type: int32 - returns: int32 - __android_log_is_loggable_len: - c_name: __android_log_is_loggable_len - params: - - name: prio - type: int32 - - name: tag - type: string - - name: len - type: uint64 - - name: default_prio - type: int32 - returns: int32 - __android_log_logd_logger: - c_name: __android_log_logd_logger - params: - - name: log_message - type: '*__android_log_message' - returns: "" - __android_log_set_aborter: - c_name: __android_log_set_aborter - params: - - name: aborter - type: __android_aborter_function - returns: "" - __android_log_set_default_tag: - c_name: __android_log_set_default_tag - params: - - name: tag - type: string - returns: "" - __android_log_set_logger: - c_name: __android_log_set_logger - params: - - name: logger - type: __android_logger_function - returns: "" - __android_log_set_minimum_priority: - c_name: __android_log_set_minimum_priority - params: - - name: priority - type: int32 - returns: int32 - __android_log_stderr_logger: - c_name: __android_log_stderr_logger - params: - - name: log_message - type: '*__android_log_message' - returns: "" - __android_log_write: - c_name: __android_log_write - params: - - name: prio - type: int32 - - name: tag - type: string - - name: text - type: string - returns: int32 - __android_log_write_log_message: - c_name: __android_log_write_log_message - params: - - name: log_message - type: '*__android_log_message' - returns: "" -callbacks: - __android_aborter_function: - params: - - name: abort_message - type: string - c_type: const char* - const: true - returns: "" - __android_logger_function: - params: - - name: log_message - type: '*__android_log_message' - c_type: const struct __android_log_message* - const: true - returns: "" -structs: - __android_log_message: - fields: - - name: struct_size - type: uint64 - - name: buffer_id - type: int32 - - name: priority - type: int32 - - name: tag - type: string - - name: file - type: string - - name: line - type: uint32 - - name: message - type: string diff --git a/spec/generated/looper.yaml b/spec/generated/looper.yaml deleted file mode 100644 index 3e1922e..0000000 --- a/spec/generated/looper.yaml +++ /dev/null @@ -1,111 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: looper -source_package: github.com/AndroidGoLab/ndk/capi/looper -types: - ALooper: - kind: opaque_ptr - c_type: ALooper - go_type: '*C.ALooper' -enums: - ALOOPER_EVENT: - - name: ALOOPER_EVENT_INPUT - value: 1 - - name: ALOOPER_EVENT_OUTPUT - value: 2 - - name: ALOOPER_EVENT_ERROR - value: 4 - - name: ALOOPER_EVENT_HANGUP - value: 8 - - name: ALOOPER_EVENT_INVALID - value: 16 - ALOOPER_POLL: - - name: ALOOPER_POLL_WAKE - value: -1 - - name: ALOOPER_POLL_CALLBACK - value: -2 - - name: ALOOPER_POLL_TIMEOUT - value: -3 - - name: ALOOPER_POLL_ERROR - value: -4 - ALOOPER_PREPARE_ALLOW: - - name: ALOOPER_PREPARE_ALLOW_NON_CALLBACKS - value: 1 -functions: - ALooper_acquire: - c_name: ALooper_acquire - params: - - name: looper - type: '*ALooper' - returns: "" - ALooper_addFd: - c_name: ALooper_addFd - params: - - name: looper - type: '*ALooper' - - name: fd - type: int32 - - name: ident - type: int32 - - name: events - type: int32 - - name: callback - type: ALooper_callbackFunc - - name: data - type: unsafe.Pointer - returns: int32 - ALooper_forThread: - c_name: ALooper_forThread - returns: '*ALooper' - ALooper_pollOnce: - c_name: ALooper_pollOnce - params: - - name: timeoutMillis - type: int32 - - name: outFd - type: '*int32' - - name: outEvents - type: '*int32' - - name: outData - type: '*unsafe.Pointer' - direction: out - returns: int32 - ALooper_prepare: - c_name: ALooper_prepare - params: - - name: opts - type: int32 - returns: '*ALooper' - ALooper_release: - c_name: ALooper_release - params: - - name: looper - type: '*ALooper' - returns: "" - ALooper_removeFd: - c_name: ALooper_removeFd - params: - - name: looper - type: '*ALooper' - - name: fd - type: int32 - returns: int32 - ALooper_wake: - c_name: ALooper_wake - params: - - name: looper - type: '*ALooper' - returns: "" -callbacks: - ALooper_callbackFunc: - params: - - name: fd - type: int32 - c_type: int - - name: events - type: int32 - c_type: int - - name: data - type: unsafe.Pointer - c_type: void* - returns: int32 diff --git a/spec/generated/media.yaml b/spec/generated/media.yaml deleted file mode 100644 index 9d5759f..0000000 --- a/spec/generated/media.yaml +++ /dev/null @@ -1,2473 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: media -source_package: github.com/AndroidGoLab/ndk/capi/media -types: - ABitrateMode: - kind: typedef_int32 - c_type: ABitrateMode - go_type: int32 - ACodecAudioCapabilities: - kind: opaque_ptr - c_type: ACodecAudioCapabilities - go_type: '*C.ACodecAudioCapabilities' - ACodecEncoderCapabilities: - kind: opaque_ptr - c_type: ACodecEncoderCapabilities - go_type: '*C.ACodecEncoderCapabilities' - ACodecPerformancePoint: - kind: opaque_ptr - c_type: ACodecPerformancePoint - go_type: '*C.ACodecPerformancePoint' - ACodecVideoCapabilities: - kind: opaque_ptr - c_type: ACodecVideoCapabilities - go_type: '*C.ACodecVideoCapabilities' - ADoubleRange: - kind: opaque_ptr - c_type: ADoubleRange - go_type: '*C.ADoubleRange' - AImage: - kind: opaque_ptr - c_type: AImage - go_type: '*C.AImage' - AImageCropRect: - kind: opaque_ptr - c_type: AImageCropRect - go_type: '*C.AImageCropRect' - AImageReader: - kind: opaque_ptr - c_type: AImageReader - go_type: '*C.AImageReader' - AImageReader_BufferRemovedListener: - kind: opaque_ptr - c_type: AImageReader_BufferRemovedListener - go_type: '*C.AImageReader_BufferRemovedListener' - AImageReader_ImageListener: - kind: opaque_ptr - c_type: AImageReader_ImageListener - go_type: '*C.AImageReader_ImageListener' - AIntRange: - kind: opaque_ptr - c_type: AIntRange - go_type: '*C.AIntRange' - AMediaCodec: - kind: opaque_ptr - c_type: AMediaCodec - go_type: '*C.AMediaCodec' - AMediaCodecBufferInfo: - kind: opaque_ptr - c_type: AMediaCodecBufferInfo - go_type: '*C.AMediaCodecBufferInfo' - AMediaCodecCryptoInfo: - kind: opaque_ptr - c_type: AMediaCodecCryptoInfo - go_type: '*C.AMediaCodecCryptoInfo' - AMediaCodecInfo: - kind: opaque_ptr - c_type: AMediaCodecInfo - go_type: '*C.AMediaCodecInfo' - AMediaCodecKind: - kind: typedef_int32 - c_type: AMediaCodecKind - go_type: int32 - AMediaCodecOnAsyncNotifyCallback: - kind: opaque_ptr - c_type: AMediaCodecOnAsyncNotifyCallback - go_type: '*C.AMediaCodecOnAsyncNotifyCallback' - AMediaCodecType: - kind: typedef_int32 - c_type: AMediaCodecType - go_type: int32 - AMediaCrypto: - kind: opaque_ptr - c_type: AMediaCrypto - go_type: '*C.AMediaCrypto' - AMediaDataSource: - kind: opaque_ptr - c_type: AMediaDataSource - go_type: '*C.AMediaDataSource' - AMediaDrm: - kind: opaque_ptr - c_type: AMediaDrm - go_type: '*C.AMediaDrm' - AMediaDrmByteArray: - kind: opaque_ptr - c_type: AMediaDrmByteArray - go_type: '*C.AMediaDrmByteArray' - AMediaDrmEventType: - kind: typedef_int32 - c_type: AMediaDrmEventType - go_type: int32 - AMediaDrmKeyId: - kind: typedef_AMediaDrmByteArray - c_type: AMediaDrmKeyId - go_type: AMediaDrmByteArray - AMediaDrmKeyRequestType: - kind: typedef_int32 - c_type: AMediaDrmKeyRequestType - go_type: int32 - AMediaDrmKeySetId: - kind: typedef_AMediaDrmByteArray - c_type: AMediaDrmKeySetId - go_type: AMediaDrmByteArray - AMediaDrmKeyStatus: - kind: opaque_ptr - c_type: AMediaDrmKeyStatus - go_type: '*C.AMediaDrmKeyStatus' - AMediaDrmKeyStatusType: - kind: typedef_int32 - c_type: AMediaDrmKeyStatusType - go_type: int32 - AMediaDrmKeyType: - kind: typedef_int32 - c_type: AMediaDrmKeyType - go_type: int32 - AMediaDrmKeyValue: - kind: opaque_ptr - c_type: AMediaDrmKeyValue - go_type: '*C.AMediaDrmKeyValue' - AMediaDrmScope: - kind: typedef_AMediaDrmByteArray - c_type: AMediaDrmScope - go_type: AMediaDrmByteArray - AMediaDrmSecureStop: - kind: typedef_AMediaDrmByteArray - c_type: AMediaDrmSecureStop - go_type: AMediaDrmByteArray - AMediaDrmSessionId: - kind: typedef_AMediaDrmByteArray - c_type: AMediaDrmSessionId - go_type: AMediaDrmByteArray - AMediaExtractor: - kind: opaque_ptr - c_type: AMediaExtractor - go_type: '*C.AMediaExtractor' - AMediaFormat: - kind: opaque_ptr - c_type: AMediaFormat - go_type: '*C.AMediaFormat' - AMediaMuxer: - kind: opaque_ptr - c_type: AMediaMuxer - go_type: '*C.AMediaMuxer' - AMediaUUID: - kind: typedef_[16]uint8 - c_type: AMediaUUID - go_type: '[16]uint8' - ANativeWindow: - kind: opaque_ptr - c_type: ANativeWindow - go_type: '*C.ANativeWindow' - AppendMode: - kind: typedef_int32 - c_type: AppendMode - go_type: int32 - OutputFormat: - kind: typedef_int32 - c_type: OutputFormat - go_type: int32 - PsshEntry: - kind: opaque_ptr - c_type: PsshEntry - go_type: '*C.PsshEntry' - PsshInfo: - kind: opaque_ptr - c_type: PsshInfo - go_type: '*C.PsshInfo' - SeekMode: - kind: typedef_int32 - c_type: SeekMode - go_type: int32 - cryptoinfo_mode_t: - kind: typedef_int32 - c_type: cryptoinfo_mode_t - go_type: int32 - cryptoinfo_pattern_t: - kind: opaque_ptr - c_type: cryptoinfo_pattern_t - go_type: '*C.cryptoinfo_pattern_t' -enums: - ABitrateMode: - - name: ABITRATE_MODE_CQ - value: 0 - - name: ABITRATE_MODE_VBR - value: 1 - - name: ABITRATE_MODE_CBR - value: 2 - - name: ABITRATE_MODE_CBR_FD - value: 3 - AIMAGE_FORMATS: - - name: AIMAGE_FORMAT_RGBA_8888 - value: 1 - - name: AIMAGE_FORMAT_RGBX_8888 - value: 2 - - name: AIMAGE_FORMAT_RGB_888 - value: 3 - - name: AIMAGE_FORMAT_RGB_565 - value: 4 - - name: AIMAGE_FORMAT_RGBA_FP16 - value: 22 - - name: AIMAGE_FORMAT_YUV_420_888 - value: 35 - - name: AIMAGE_FORMAT_JPEG - value: 256 - - name: AIMAGE_FORMAT_RAW16 - value: 32 - - name: AIMAGE_FORMAT_RAW_PRIVATE - value: 36 - - name: AIMAGE_FORMAT_RAW10 - value: 37 - - name: AIMAGE_FORMAT_RAW12 - value: 38 - - name: AIMAGE_FORMAT_DEPTH16 - value: 1144402265 - - name: AIMAGE_FORMAT_DEPTH_POINT_CLOUD - value: 257 - - name: AIMAGE_FORMAT_PRIVATE - value: 34 - - name: AIMAGE_FORMAT_Y8 - value: 538982489 - - name: AIMAGE_FORMAT_HEIC - value: 1212500294 - - name: AIMAGE_FORMAT_DEPTH_JPEG - value: 1768253795 - AMEDIACODEC: - - name: AMEDIACODEC_CONFIGURE_FLAG_ENCODE - value: 1 - - name: AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED - value: -3 - - name: AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED - value: -2 - - name: AMEDIACODEC_INFO_TRY_AGAIN_LATER - value: -1 - AMEDIACODEC_BUFFER_FLAG: - - name: AMEDIACODEC_BUFFER_FLAG_KEY_FRAME - value: 1 - - name: AMEDIACODEC_BUFFER_FLAG_CODEC_CONFIG - value: 2 - - name: AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM - value: 4 - - name: AMEDIACODEC_BUFFER_FLAG_PARTIAL_FRAME - value: 8 - - name: AMEDIACODEC_BUFFER_FLAG_MUXER_DATA - value: 16 - - name: AMEDIACODEC_BUFFER_FLAG_DECODE_ONLY - value: 32 - AMEDIAEXTRACTOR_SAMPLE_FLAG: - - name: AMEDIAEXTRACTOR_SAMPLE_FLAG_SYNC - value: 1 - - name: AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED - value: 2 - AMediaCodecKind: - - name: AMediaCodecKind_INVALID - value: 0 - - name: AMediaCodecKind_DECODER - value: 1 - - name: AMediaCodecKind_ENCODER - value: 2 - AMediaCodecType: - - name: AMediaCodecType_INVALID_CODEC_INFO - value: 0 - - name: AMediaCodecType_SOFTWARE_ONLY - value: 1 - - name: AMediaCodecType_HARDWARE_ACCELERATED - value: 2 - - name: AMediaCodecType_SOFTWARE_WITH_DEVICE_ACCESS - value: 3 - AMediaDrmEventType: - - name: EVENT_PROVISION_REQUIRED - value: 1 - - name: EVENT_KEY_REQUIRED - value: 2 - - name: EVENT_KEY_EXPIRED - value: 3 - - name: EVENT_VENDOR_DEFINED - value: 4 - - name: EVENT_SESSION_RECLAIMED - value: 5 - AMediaDrmKeyRequestType: - - name: KEY_REQUEST_TYPE_INITIAL - value: 0 - - name: KEY_REQUEST_TYPE_RENEWAL - value: 1 - - name: KEY_REQUEST_TYPE_RELEASE - value: 2 - - name: KEY_REQUEST_TYPE_NONE - value: 3 - - name: KEY_REQUEST_TYPE_UPDATE - value: 4 - AMediaDrmKeyStatusType: - - name: KEY_STATUS_TYPE_USABLE - value: 0 - - name: KEY_STATUS_TYPE_EXPIRED - value: 1 - - name: KEY_STATUS_TYPE_OUTPUTNOTALLOWED - value: 2 - - name: KEY_STATUS_TYPE_STATUSPENDING - value: 3 - - name: KEY_STATUS_TYPE_INTERNALERROR - value: 4 - AMediaDrmKeyType: - - name: KEY_TYPE_STREAMING - value: 1 - - name: KEY_TYPE_OFFLINE - value: 2 - - name: KEY_TYPE_RELEASE - value: 3 - AppendMode: - - name: AMEDIAMUXER_APPEND_IGNORE_LAST_VIDEO_GOP - value: 0 - - name: AMEDIAMUXER_APPEND_TO_EXISTING_DATA - value: 1 - OutputFormat: - - name: AMEDIAMUXER_OUTPUT_FORMAT_MPEG_4 - value: 0 - - name: AMEDIAMUXER_OUTPUT_FORMAT_WEBM - value: 1 - - name: AMEDIAMUXER_OUTPUT_FORMAT_THREE_GPP - value: 2 - - name: AMEDIAMUXER_OUTPUT_FORMAT_HEIF - value: 3 - - name: AMEDIAMUXER_OUTPUT_FORMAT_OGG - value: 4 - SeekMode: - - name: AMEDIAEXTRACTOR_SEEK_PREVIOUS_SYNC - value: 0 - - name: AMEDIAEXTRACTOR_SEEK_NEXT_SYNC - value: 1 - - name: AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC - value: 2 - cryptoinfo_mode_t: - - name: AMEDIACODECRYPTOINFO_MODE_CLEAR - value: 0 - - name: AMEDIACODECRYPTOINFO_MODE_AES_CTR - value: 1 - - name: AMEDIACODECRYPTOINFO_MODE_AES_WV - value: 2 - - name: AMEDIACODECRYPTOINFO_MODE_AES_CBC - value: 3 -functions: - ACodecAudioCapabilities_getBitrateRange: - c_name: ACodecAudioCapabilities_getBitrateRange - params: - - name: audioCaps - type: '*ACodecAudioCapabilities' - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecAudioCapabilities_getInputChannelCountRanges: - c_name: ACodecAudioCapabilities_getInputChannelCountRanges - params: - - name: audioCaps - type: '*ACodecAudioCapabilities' - - name: outArrayPtr - type: '**AIntRange' - direction: out - - name: outCount - type: '*uint64' - returns: media_status_t - ACodecAudioCapabilities_getMaxInputChannelCount: - c_name: ACodecAudioCapabilities_getMaxInputChannelCount - params: - - name: audioCaps - type: '*ACodecAudioCapabilities' - returns: int32 - ACodecAudioCapabilities_getMinInputChannelCount: - c_name: ACodecAudioCapabilities_getMinInputChannelCount - params: - - name: audioCaps - type: '*ACodecAudioCapabilities' - returns: int32 - ACodecAudioCapabilities_getSupportedSampleRateRanges: - c_name: ACodecAudioCapabilities_getSupportedSampleRateRanges - params: - - name: audioCaps - type: '*ACodecAudioCapabilities' - - name: outArrayPtr - type: '**AIntRange' - direction: out - - name: outCount - type: '*uint64' - returns: media_status_t - ACodecAudioCapabilities_getSupportedSampleRates: - c_name: ACodecAudioCapabilities_getSupportedSampleRates - params: - - name: audioCaps - type: '*ACodecAudioCapabilities' - - name: outArrayPtr - type: '**int32' - direction: out - - name: outCount - type: '*uint64' - returns: media_status_t - ACodecAudioCapabilities_isSampleRateSupported: - c_name: ACodecAudioCapabilities_isSampleRateSupported - params: - - name: audioCaps - type: '*ACodecAudioCapabilities' - - name: sampleRate - type: int32 - returns: int32 - ACodecEncoderCapabilities_getComplexityRange: - c_name: ACodecEncoderCapabilities_getComplexityRange - params: - - name: encoderCaps - type: '*ACodecEncoderCapabilities' - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecEncoderCapabilities_getQualityRange: - c_name: ACodecEncoderCapabilities_getQualityRange - params: - - name: encoderCaps - type: '*ACodecEncoderCapabilities' - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecEncoderCapabilities_isBitrateModeSupported: - c_name: ACodecEncoderCapabilities_isBitrateModeSupported - params: - - name: encoderCaps - type: '*ACodecEncoderCapabilities' - - name: mode - type: ABitrateMode - returns: int32 - ACodecPerformancePoint_covers: - c_name: ACodecPerformancePoint_covers - params: - - name: one - type: '*ACodecPerformancePoint' - - name: another - type: '*ACodecPerformancePoint' - returns: int32 - ACodecPerformancePoint_coversFormat: - c_name: ACodecPerformancePoint_coversFormat - params: - - name: performancePoint - type: '*ACodecPerformancePoint' - - name: format - type: '*AMediaFormat' - returns: int32 - ACodecPerformancePoint_create: - c_name: ACodecPerformancePoint_create - params: - - name: width - type: int32 - - name: height - type: int32 - - name: frameRate - type: int32 - returns: '*ACodecPerformancePoint' - ACodecPerformancePoint_destroy: - c_name: ACodecPerformancePoint_destroy - params: - - name: performancePoint - type: '*ACodecPerformancePoint' - returns: "" - ACodecPerformancePoint_equals: - c_name: ACodecPerformancePoint_equals - params: - - name: one - type: '*ACodecPerformancePoint' - - name: another - type: '*ACodecPerformancePoint' - returns: int32 - ACodecVideoCapabilities_areSizeAndRateSupported: - c_name: ACodecVideoCapabilities_areSizeAndRateSupported - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: width - type: int32 - - name: height - type: int32 - - name: frameRate - type: float64 - returns: int32 - ACodecVideoCapabilities_getAchievableFrameRatesFor: - c_name: ACodecVideoCapabilities_getAchievableFrameRatesFor - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: width - type: int32 - - name: height - type: int32 - - name: outRange - type: '*ADoubleRange' - returns: media_status_t - ACodecVideoCapabilities_getBitrateRange: - c_name: ACodecVideoCapabilities_getBitrateRange - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecVideoCapabilities_getHeightAlignment: - c_name: ACodecVideoCapabilities_getHeightAlignment - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - returns: int32 - ACodecVideoCapabilities_getNextSupportedPerformancePoint: - c_name: ACodecVideoCapabilities_getNextSupportedPerformancePoint - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: outPerformancePoint - type: '**ACodecPerformancePoint' - direction: out - returns: media_status_t - ACodecVideoCapabilities_getSupportedFrameRates: - c_name: ACodecVideoCapabilities_getSupportedFrameRates - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecVideoCapabilities_getSupportedFrameRatesFor: - c_name: ACodecVideoCapabilities_getSupportedFrameRatesFor - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: width - type: int32 - - name: height - type: int32 - - name: outRange - type: '*ADoubleRange' - returns: media_status_t - ACodecVideoCapabilities_getSupportedHeights: - c_name: ACodecVideoCapabilities_getSupportedHeights - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecVideoCapabilities_getSupportedHeightsFor: - c_name: ACodecVideoCapabilities_getSupportedHeightsFor - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: width - type: int32 - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecVideoCapabilities_getSupportedWidths: - c_name: ACodecVideoCapabilities_getSupportedWidths - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecVideoCapabilities_getSupportedWidthsFor: - c_name: ACodecVideoCapabilities_getSupportedWidthsFor - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: height - type: int32 - - name: outRange - type: '*AIntRange' - returns: media_status_t - ACodecVideoCapabilities_getWidthAlignment: - c_name: ACodecVideoCapabilities_getWidthAlignment - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - returns: int32 - ACodecVideoCapabilities_isSizeSupported: - c_name: ACodecVideoCapabilities_isSizeSupported - params: - - name: videoCaps - type: '*ACodecVideoCapabilities' - - name: width - type: int32 - - name: height - type: int32 - returns: int32 - AImage_delete: - c_name: AImage_delete - params: - - name: image - type: '*AImage' - returns: "" - AImage_deleteAsync: - c_name: AImage_deleteAsync - params: - - name: image - type: '*AImage' - - name: releaseFenceFd - type: int32 - returns: "" - AImage_getCropRect: - c_name: AImage_getCropRect - params: - - name: image - type: '*AImage' - - name: rect - type: '*AImageCropRect' - returns: media_status_t - AImage_getDataSpace: - c_name: AImage_getDataSpace - params: - - name: image - type: '*AImage' - - name: dataSpace - type: '*int32' - returns: media_status_t - AImage_getFormat: - c_name: AImage_getFormat - params: - - name: image - type: '*AImage' - - name: format - type: '*int32' - returns: media_status_t - AImage_getHardwareBuffer: - c_name: AImage_getHardwareBuffer - params: - - name: image - type: '*AImage' - - name: buffer - type: '**AHardwareBuffer' - direction: out - returns: media_status_t - AImage_getHeight: - c_name: AImage_getHeight - params: - - name: image - type: '*AImage' - - name: height - type: '*int32' - returns: media_status_t - AImage_getNumberOfPlanes: - c_name: AImage_getNumberOfPlanes - params: - - name: image - type: '*AImage' - - name: numPlanes - type: '*int32' - returns: media_status_t - AImage_getPlaneData: - c_name: AImage_getPlaneData - params: - - name: image - type: '*AImage' - - name: planeIdx - type: int32 - - name: data - type: '**uint8' - direction: out - - name: dataLength - type: '*int32' - returns: media_status_t - AImage_getPlanePixelStride: - c_name: AImage_getPlanePixelStride - params: - - name: image - type: '*AImage' - - name: planeIdx - type: int32 - - name: pixelStride - type: '*int32' - returns: media_status_t - AImage_getPlaneRowStride: - c_name: AImage_getPlaneRowStride - params: - - name: image - type: '*AImage' - - name: planeIdx - type: int32 - - name: rowStride - type: '*int32' - returns: media_status_t - AImage_getTimestamp: - c_name: AImage_getTimestamp - params: - - name: image - type: '*AImage' - - name: timestampNs - type: '*int64' - returns: media_status_t - AImage_getWidth: - c_name: AImage_getWidth - params: - - name: image - type: '*AImage' - - name: width - type: '*int32' - returns: media_status_t - AImageReader_acquireLatestImage: - c_name: AImageReader_acquireLatestImage - params: - - name: reader - type: '*AImageReader' - - name: image - type: '**AImage' - direction: out - returns: media_status_t - AImageReader_acquireLatestImageAsync: - c_name: AImageReader_acquireLatestImageAsync - params: - - name: reader - type: '*AImageReader' - - name: image - type: '**AImage' - direction: out - - name: acquireFenceFd - type: '*int32' - returns: media_status_t - AImageReader_acquireNextImage: - c_name: AImageReader_acquireNextImage - params: - - name: reader - type: '*AImageReader' - - name: image - type: '**AImage' - direction: out - returns: media_status_t - AImageReader_acquireNextImageAsync: - c_name: AImageReader_acquireNextImageAsync - params: - - name: reader - type: '*AImageReader' - - name: image - type: '**AImage' - direction: out - - name: acquireFenceFd - type: '*int32' - returns: media_status_t - AImageReader_delete: - c_name: AImageReader_delete - params: - - name: reader - type: '*AImageReader' - returns: "" - AImageReader_getFormat: - c_name: AImageReader_getFormat - params: - - name: reader - type: '*AImageReader' - - name: format - type: '*int32' - returns: media_status_t - AImageReader_getHeight: - c_name: AImageReader_getHeight - params: - - name: reader - type: '*AImageReader' - - name: height - type: '*int32' - returns: media_status_t - AImageReader_getMaxImages: - c_name: AImageReader_getMaxImages - params: - - name: reader - type: '*AImageReader' - - name: maxImages - type: '*int32' - returns: media_status_t - AImageReader_getWidth: - c_name: AImageReader_getWidth - params: - - name: reader - type: '*AImageReader' - - name: width - type: '*int32' - returns: media_status_t - AImageReader_getWindow: - c_name: AImageReader_getWindow - params: - - name: reader - type: '*AImageReader' - - name: window - type: '**ANativeWindow' - direction: out - returns: media_status_t - AImageReader_new: - c_name: AImageReader_new - params: - - name: width - type: int32 - - name: height - type: int32 - - name: format - type: int32 - - name: maxImages - type: int32 - - name: reader - type: '**AImageReader' - direction: out - returns: media_status_t - AImageReader_newWithDataSpace: - c_name: AImageReader_newWithDataSpace - params: - - name: width - type: int32 - - name: height - type: int32 - - name: usage - type: uint64 - - name: maxImages - type: int32 - - name: hardwareBufferFormat - type: uint32 - - name: dataSpace - type: int32 - - name: reader - type: '**AImageReader' - direction: out - returns: media_status_t - AImageReader_newWithUsage: - c_name: AImageReader_newWithUsage - params: - - name: width - type: int32 - - name: height - type: int32 - - name: format - type: int32 - - name: usage - type: uint64 - - name: maxImages - type: int32 - - name: reader - type: '**AImageReader' - direction: out - returns: media_status_t - AImageReader_setBufferRemovedListener: - c_name: AImageReader_setBufferRemovedListener - params: - - name: reader - type: '*AImageReader' - - name: listener - type: '*AImageReader_BufferRemovedListener' - returns: media_status_t - AImageReader_setImageListener: - c_name: AImageReader_setImageListener - params: - - name: reader - type: '*AImageReader' - - name: listener - type: '*AImageReader_ImageListener' - returns: media_status_t - AMediaCodec_configure: - c_name: AMediaCodec_configure - params: - - name: "" - type: '*AMediaCodec' - - name: format - type: '*AMediaFormat' - - name: surface - type: '*ANativeWindow' - - name: crypto - type: '*AMediaCrypto' - - name: flags - type: uint32 - returns: media_status_t - AMediaCodec_createCodecByName: - c_name: AMediaCodec_createCodecByName - params: - - name: name - type: string - returns: '*AMediaCodec' - AMediaCodec_createDecoderByType: - c_name: AMediaCodec_createDecoderByType - params: - - name: mime_type - type: string - returns: '*AMediaCodec' - AMediaCodec_createEncoderByType: - c_name: AMediaCodec_createEncoderByType - params: - - name: mime_type - type: string - returns: '*AMediaCodec' - AMediaCodec_createInputSurface: - c_name: AMediaCodec_createInputSurface - params: - - name: mData - type: '*AMediaCodec' - - name: surface - type: '**ANativeWindow' - direction: out - returns: media_status_t - AMediaCodec_createPersistentInputSurface: - c_name: AMediaCodec_createPersistentInputSurface - params: - - name: surface - type: '**ANativeWindow' - direction: out - returns: media_status_t - AMediaCodec_delete: - c_name: AMediaCodec_delete - params: - - name: "" - type: '*AMediaCodec' - returns: media_status_t - AMediaCodec_dequeueInputBuffer: - c_name: AMediaCodec_dequeueInputBuffer - params: - - name: "" - type: '*AMediaCodec' - - name: timeoutUs - type: int64 - returns: int64 - AMediaCodec_dequeueOutputBuffer: - c_name: AMediaCodec_dequeueOutputBuffer - params: - - name: "" - type: '*AMediaCodec' - - name: info - type: '*AMediaCodecBufferInfo' - - name: timeoutUs - type: int64 - returns: int64 - AMediaCodec_flush: - c_name: AMediaCodec_flush - params: - - name: "" - type: '*AMediaCodec' - returns: media_status_t - AMediaCodec_getBufferFormat: - c_name: AMediaCodec_getBufferFormat - params: - - name: "" - type: '*AMediaCodec' - - name: index - type: uint64 - returns: '*AMediaFormat' - AMediaCodec_getInputBuffer: - c_name: AMediaCodec_getInputBuffer - params: - - name: "" - type: '*AMediaCodec' - - name: idx - type: uint64 - - name: out_size - type: '*uint64' - returns: '*uint8' - AMediaCodec_getInputFormat: - c_name: AMediaCodec_getInputFormat - params: - - name: "" - type: '*AMediaCodec' - returns: '*AMediaFormat' - AMediaCodec_getName: - c_name: AMediaCodec_getName - params: - - name: "" - type: '*AMediaCodec' - - name: out_name - type: '**int8' - c_type: char** - direction: out - returns: media_status_t - AMediaCodec_getOutputBuffer: - c_name: AMediaCodec_getOutputBuffer - params: - - name: "" - type: '*AMediaCodec' - - name: idx - type: uint64 - - name: out_size - type: '*uint64' - returns: '*uint8' - AMediaCodec_getOutputFormat: - c_name: AMediaCodec_getOutputFormat - params: - - name: "" - type: '*AMediaCodec' - returns: '*AMediaFormat' - AMediaCodec_queueInputBuffer: - c_name: AMediaCodec_queueInputBuffer - params: - - name: "" - type: '*AMediaCodec' - - name: idx - type: uint64 - - name: offset - type: off_t - - name: size - type: uint64 - - name: time - type: uint64 - - name: flags - type: uint32 - returns: media_status_t - AMediaCodec_queueSecureInputBuffer: - c_name: AMediaCodec_queueSecureInputBuffer - params: - - name: "" - type: '*AMediaCodec' - - name: idx - type: uint64 - - name: offset - type: off_t - - name: "" - type: '*AMediaCodecCryptoInfo' - - name: time - type: uint64 - - name: flags - type: uint32 - returns: media_status_t - AMediaCodec_releaseCrypto: - c_name: AMediaCodec_releaseCrypto - params: - - name: "" - type: '*AMediaCodec' - returns: media_status_t - AMediaCodec_releaseName: - c_name: AMediaCodec_releaseName - params: - - name: "" - type: '*AMediaCodec' - - name: name - type: string - returns: "" - AMediaCodec_releaseOutputBuffer: - c_name: AMediaCodec_releaseOutputBuffer - params: - - name: "" - type: '*AMediaCodec' - - name: idx - type: uint64 - - name: render - type: bool - returns: media_status_t - AMediaCodec_releaseOutputBufferAtTime: - c_name: AMediaCodec_releaseOutputBufferAtTime - params: - - name: mData - type: '*AMediaCodec' - - name: idx - type: uint64 - - name: timestampNs - type: int64 - returns: media_status_t - AMediaCodec_setAsyncNotifyCallback: - c_name: AMediaCodec_setAsyncNotifyCallback - params: - - name: "" - type: '*AMediaCodec' - - name: callback - type: AMediaCodecOnAsyncNotifyCallback - - name: userdata - type: unsafe.Pointer - returns: media_status_t - AMediaCodec_setInputSurface: - c_name: AMediaCodec_setInputSurface - params: - - name: mData - type: '*AMediaCodec' - - name: surface - type: '*ANativeWindow' - returns: media_status_t - AMediaCodec_setOnFrameRenderedCallback: - c_name: AMediaCodec_setOnFrameRenderedCallback - params: - - name: "" - type: '*AMediaCodec' - - name: callback - type: AMediaCodecOnFrameRendered - - name: userdata - type: unsafe.Pointer - returns: media_status_t - AMediaCodec_setOutputSurface: - c_name: AMediaCodec_setOutputSurface - params: - - name: "" - type: '*AMediaCodec' - - name: surface - type: '*ANativeWindow' - returns: media_status_t - AMediaCodec_setParameters: - c_name: AMediaCodec_setParameters - params: - - name: mData - type: '*AMediaCodec' - - name: params - type: '*AMediaFormat' - returns: media_status_t - AMediaCodec_signalEndOfInputStream: - c_name: AMediaCodec_signalEndOfInputStream - params: - - name: mData - type: '*AMediaCodec' - returns: media_status_t - AMediaCodec_start: - c_name: AMediaCodec_start - params: - - name: "" - type: '*AMediaCodec' - returns: media_status_t - AMediaCodec_stop: - c_name: AMediaCodec_stop - params: - - name: "" - type: '*AMediaCodec' - returns: media_status_t - AMediaCodecActionCode_isRecoverable: - c_name: AMediaCodecActionCode_isRecoverable - params: - - name: actionCode - type: int32 - returns: bool - AMediaCodecActionCode_isTransient: - c_name: AMediaCodecActionCode_isTransient - params: - - name: actionCode - type: int32 - returns: bool - AMediaCodecCryptoInfo_delete: - c_name: AMediaCodecCryptoInfo_delete - params: - - name: "" - type: '*AMediaCodecCryptoInfo' - returns: media_status_t - AMediaCodecCryptoInfo_getClearBytes: - c_name: AMediaCodecCryptoInfo_getClearBytes - params: - - name: "" - type: '*AMediaCodecCryptoInfo' - - name: dst - type: '*uint64' - returns: media_status_t - AMediaCodecCryptoInfo_getEncryptedBytes: - c_name: AMediaCodecCryptoInfo_getEncryptedBytes - params: - - name: "" - type: '*AMediaCodecCryptoInfo' - - name: dst - type: '*uint64' - returns: media_status_t - AMediaCodecCryptoInfo_getIV: - c_name: AMediaCodecCryptoInfo_getIV - params: - - name: "" - type: '*AMediaCodecCryptoInfo' - - name: dst - type: '*uint8' - returns: media_status_t - AMediaCodecCryptoInfo_getKey: - c_name: AMediaCodecCryptoInfo_getKey - params: - - name: "" - type: '*AMediaCodecCryptoInfo' - - name: dst - type: '*uint8' - returns: media_status_t - AMediaCodecCryptoInfo_getMode: - c_name: AMediaCodecCryptoInfo_getMode - params: - - name: "" - type: '*AMediaCodecCryptoInfo' - returns: cryptoinfo_mode_t - AMediaCodecCryptoInfo_getNumSubSamples: - c_name: AMediaCodecCryptoInfo_getNumSubSamples - params: - - name: "" - type: '*AMediaCodecCryptoInfo' - returns: uint64 - AMediaCodecCryptoInfo_new: - c_name: AMediaCodecCryptoInfo_new - params: - - name: numsubsamples - type: int32 - - name: key - type: '[16]uint8' - - name: iv - type: '[16]uint8' - - name: mode - type: cryptoinfo_mode_t - - name: clearbytes - type: '*uint64' - - name: encryptedbytes - type: '*uint64' - returns: '*AMediaCodecCryptoInfo' - AMediaCodecCryptoInfo_setPattern: - c_name: AMediaCodecCryptoInfo_setPattern - params: - - name: info - type: '*AMediaCodecCryptoInfo' - - name: pattern - type: '*cryptoinfo_pattern_t' - returns: "" - AMediaCodecInfo_getAudioCapabilities: - c_name: AMediaCodecInfo_getAudioCapabilities - params: - - name: info - type: '*AMediaCodecInfo' - - name: outAudioCaps - type: '**ACodecAudioCapabilities' - direction: out - returns: media_status_t - AMediaCodecInfo_getCanonicalName: - c_name: AMediaCodecInfo_getCanonicalName - params: - - name: info - type: '*AMediaCodecInfo' - returns: string - AMediaCodecInfo_getEncoderCapabilities: - c_name: AMediaCodecInfo_getEncoderCapabilities - params: - - name: info - type: '*AMediaCodecInfo' - - name: outEncoderCaps - type: '**ACodecEncoderCapabilities' - direction: out - returns: media_status_t - AMediaCodecInfo_getKind: - c_name: AMediaCodecInfo_getKind - params: - - name: info - type: '*AMediaCodecInfo' - returns: AMediaCodecKind - AMediaCodecInfo_getMaxSupportedInstances: - c_name: AMediaCodecInfo_getMaxSupportedInstances - params: - - name: info - type: '*AMediaCodecInfo' - returns: int32 - AMediaCodecInfo_getMediaCodecInfoType: - c_name: AMediaCodecInfo_getMediaCodecInfoType - params: - - name: info - type: '*AMediaCodecInfo' - returns: AMediaCodecType - AMediaCodecInfo_getMediaType: - c_name: AMediaCodecInfo_getMediaType - params: - - name: info - type: '*AMediaCodecInfo' - returns: string - AMediaCodecInfo_getVideoCapabilities: - c_name: AMediaCodecInfo_getVideoCapabilities - params: - - name: info - type: '*AMediaCodecInfo' - - name: outVideoCaps - type: '**ACodecVideoCapabilities' - direction: out - returns: media_status_t - AMediaCodecInfo_isFeatureRequired: - c_name: AMediaCodecInfo_isFeatureRequired - params: - - name: info - type: '*AMediaCodecInfo' - - name: featureName - type: string - returns: int32 - AMediaCodecInfo_isFeatureSupported: - c_name: AMediaCodecInfo_isFeatureSupported - params: - - name: info - type: '*AMediaCodecInfo' - - name: featureName - type: string - returns: int32 - AMediaCodecInfo_isFormatSupported: - c_name: AMediaCodecInfo_isFormatSupported - params: - - name: info - type: '*AMediaCodecInfo' - - name: format - type: '*AMediaFormat' - returns: int32 - AMediaCodecInfo_isVendor: - c_name: AMediaCodecInfo_isVendor - params: - - name: info - type: '*AMediaCodecInfo' - returns: int32 - AMediaCrypto_delete: - c_name: AMediaCrypto_delete - params: - - name: crypto - type: '*AMediaCrypto' - returns: "" - AMediaCrypto_isCryptoSchemeSupported: - c_name: AMediaCrypto_isCryptoSchemeSupported - params: - - name: uuid - type: AMediaUUID - returns: bool - AMediaCrypto_new: - c_name: AMediaCrypto_new - params: - - name: uuid - type: AMediaUUID - - name: initData - type: unsafe.Pointer - - name: initDataSize - type: uint64 - returns: '*AMediaCrypto' - AMediaCrypto_requiresSecureDecoderComponent: - c_name: AMediaCrypto_requiresSecureDecoderComponent - params: - - name: mime - type: string - returns: bool - AMediaDataSource_close: - c_name: AMediaDataSource_close - params: - - name: "" - type: '*AMediaDataSource' - returns: "" - AMediaDataSource_delete: - c_name: AMediaDataSource_delete - params: - - name: "" - type: '*AMediaDataSource' - returns: "" - AMediaDataSource_new: - c_name: AMediaDataSource_new - returns: '*AMediaDataSource' - AMediaDataSource_newUri: - c_name: AMediaDataSource_newUri - params: - - name: uri - type: string - - name: numheaders - type: int32 - - name: key_values - type: '**int8' - c_type: const char*const* - const: true - returns: '*AMediaDataSource' - AMediaDataSource_setClose: - c_name: AMediaDataSource_setClose - params: - - name: "" - type: '*AMediaDataSource' - - name: "" - type: AMediaDataSourceClose - returns: "" - AMediaDataSource_setGetAvailableSize: - c_name: AMediaDataSource_setGetAvailableSize - params: - - name: "" - type: '*AMediaDataSource' - - name: "" - type: AMediaDataSourceGetAvailableSize - returns: "" - AMediaDataSource_setGetSize: - c_name: AMediaDataSource_setGetSize - params: - - name: "" - type: '*AMediaDataSource' - - name: "" - type: AMediaDataSourceGetSize - returns: "" - AMediaDataSource_setReadAt: - c_name: AMediaDataSource_setReadAt - params: - - name: "" - type: '*AMediaDataSource' - - name: "" - type: AMediaDataSourceReadAt - returns: "" - AMediaDataSource_setUserdata: - c_name: AMediaDataSource_setUserdata - params: - - name: "" - type: '*AMediaDataSource' - - name: userdata - type: unsafe.Pointer - returns: "" - AMediaDrm_closeSession: - c_name: AMediaDrm_closeSession - params: - - name: "" - type: '*AMediaDrm' - - name: sessionId - type: '*AMediaDrmSessionId' - returns: media_status_t - AMediaDrm_createByUUID: - c_name: AMediaDrm_createByUUID - params: - - name: uuid - type: '*uint8' - returns: '*AMediaDrm' - AMediaDrm_decrypt: - c_name: AMediaDrm_decrypt - params: - - name: "" - type: '*AMediaDrm' - - name: sessionId - type: '*AMediaDrmSessionId' - - name: cipherAlgorithm - type: string - - name: keyId - type: '*uint8' - - name: iv - type: '*uint8' - - name: input - type: '*uint8' - - name: output - type: '*uint8' - - name: dataSize - type: uint64 - returns: media_status_t - AMediaDrm_encrypt: - c_name: AMediaDrm_encrypt - params: - - name: "" - type: '*AMediaDrm' - - name: sessionId - type: '*AMediaDrmSessionId' - - name: cipherAlgorithm - type: string - - name: keyId - type: '*uint8' - - name: iv - type: '*uint8' - - name: input - type: '*uint8' - - name: output - type: '*uint8' - - name: dataSize - type: uint64 - returns: media_status_t - AMediaDrm_getKeyRequest: - c_name: AMediaDrm_getKeyRequest - params: - - name: "" - type: '*AMediaDrm' - - name: scope - type: '*AMediaDrmScope' - - name: init - type: '*uint8' - - name: initSize - type: uint64 - - name: mimeType - type: string - - name: keyType - type: AMediaDrmKeyType - - name: optionalParameters - type: '*AMediaDrmKeyValue' - - name: numOptionalParameters - type: uint64 - - name: keyRequest - type: '**uint8' - direction: out - - name: keyRequestSize - type: '*uint64' - returns: media_status_t - AMediaDrm_getKeyRequestWithDefaultUrlAndType: - c_name: AMediaDrm_getKeyRequestWithDefaultUrlAndType - params: - - name: "" - type: '*AMediaDrm' - - name: scope - type: '*AMediaDrmScope' - - name: init - type: '*uint8' - - name: initSize - type: uint64 - - name: mimeType - type: string - - name: keyType - type: AMediaDrmKeyType - - name: optionalParameters - type: '*AMediaDrmKeyValue' - - name: numOptionalParameters - type: uint64 - - name: keyRequest - type: '**uint8' - direction: out - - name: keyRequestSize - type: '*uint64' - - name: defaultUrl - type: '**int8' - c_type: const char** - direction: out - const: true - - name: keyRequestType - type: '*AMediaDrmKeyRequestType' - returns: media_status_t - AMediaDrm_getPropertyByteArray: - c_name: AMediaDrm_getPropertyByteArray - params: - - name: "" - type: '*AMediaDrm' - - name: propertyName - type: string - - name: propertyValue - type: '*AMediaDrmByteArray' - returns: media_status_t - AMediaDrm_getPropertyString: - c_name: AMediaDrm_getPropertyString - params: - - name: "" - type: '*AMediaDrm' - - name: propertyName - type: string - - name: propertyValue - type: '**int8' - c_type: const char** - direction: out - const: true - returns: media_status_t - AMediaDrm_getProvisionRequest: - c_name: AMediaDrm_getProvisionRequest - params: - - name: "" - type: '*AMediaDrm' - - name: provisionRequest - type: '**uint8' - direction: out - - name: provisionRequestSize - type: '*uint64' - - name: serverUrl - type: '**int8' - c_type: const char** - direction: out - const: true - returns: media_status_t - AMediaDrm_getSecureStops: - c_name: AMediaDrm_getSecureStops - params: - - name: "" - type: '*AMediaDrm' - - name: secureStops - type: '*AMediaDrmSecureStop' - - name: numSecureStops - type: '*uint64' - returns: media_status_t - AMediaDrm_isCryptoSchemeSupported: - c_name: AMediaDrm_isCryptoSchemeSupported - params: - - name: uuid - type: '*uint8' - - name: mimeType - type: string - returns: bool - AMediaDrm_openSession: - c_name: AMediaDrm_openSession - params: - - name: "" - type: '*AMediaDrm' - - name: sessionId - type: '*AMediaDrmSessionId' - returns: media_status_t - AMediaDrm_provideKeyResponse: - c_name: AMediaDrm_provideKeyResponse - params: - - name: "" - type: '*AMediaDrm' - - name: scope - type: '*AMediaDrmScope' - - name: response - type: '*uint8' - - name: responseSize - type: uint64 - - name: keySetId - type: '*AMediaDrmKeySetId' - returns: media_status_t - AMediaDrm_provideProvisionResponse: - c_name: AMediaDrm_provideProvisionResponse - params: - - name: "" - type: '*AMediaDrm' - - name: response - type: '*uint8' - - name: responseSize - type: uint64 - returns: media_status_t - AMediaDrm_queryKeyStatus: - c_name: AMediaDrm_queryKeyStatus - params: - - name: "" - type: '*AMediaDrm' - - name: sessionId - type: '*AMediaDrmSessionId' - - name: keyValuePairs - type: '*AMediaDrmKeyValue' - - name: numPairs - type: '*uint64' - returns: media_status_t - AMediaDrm_release: - c_name: AMediaDrm_release - params: - - name: "" - type: '*AMediaDrm' - returns: "" - AMediaDrm_releaseSecureStops: - c_name: AMediaDrm_releaseSecureStops - params: - - name: "" - type: '*AMediaDrm' - - name: ssRelease - type: '*AMediaDrmSecureStop' - returns: media_status_t - AMediaDrm_removeKeys: - c_name: AMediaDrm_removeKeys - params: - - name: "" - type: '*AMediaDrm' - - name: keySetId - type: '*AMediaDrmSessionId' - returns: media_status_t - AMediaDrm_restoreKeys: - c_name: AMediaDrm_restoreKeys - params: - - name: "" - type: '*AMediaDrm' - - name: sessionId - type: '*AMediaDrmSessionId' - - name: keySetId - type: '*AMediaDrmKeySetId' - returns: media_status_t - AMediaDrm_setOnEventListener: - c_name: AMediaDrm_setOnEventListener - params: - - name: "" - type: '*AMediaDrm' - - name: listener - type: AMediaDrmEventListener - returns: media_status_t - AMediaDrm_setOnExpirationUpdateListener: - c_name: AMediaDrm_setOnExpirationUpdateListener - params: - - name: "" - type: '*AMediaDrm' - - name: listener - type: AMediaDrmExpirationUpdateListener - returns: media_status_t - AMediaDrm_setOnKeysChangeListener: - c_name: AMediaDrm_setOnKeysChangeListener - params: - - name: "" - type: '*AMediaDrm' - - name: listener - type: AMediaDrmKeysChangeListener - returns: media_status_t - AMediaDrm_setPropertyByteArray: - c_name: AMediaDrm_setPropertyByteArray - params: - - name: "" - type: '*AMediaDrm' - - name: propertyName - type: string - - name: value - type: '*uint8' - - name: valueSize - type: uint64 - returns: media_status_t - AMediaDrm_setPropertyString: - c_name: AMediaDrm_setPropertyString - params: - - name: "" - type: '*AMediaDrm' - - name: propertyName - type: string - - name: value - type: string - returns: media_status_t - AMediaDrm_sign: - c_name: AMediaDrm_sign - params: - - name: "" - type: '*AMediaDrm' - - name: sessionId - type: '*AMediaDrmSessionId' - - name: macAlgorithm - type: string - - name: keyId - type: '*uint8' - - name: message - type: '*uint8' - - name: messageSize - type: uint64 - - name: signature - type: '*uint8' - - name: signatureSize - type: '*uint64' - returns: media_status_t - AMediaDrm_verify: - c_name: AMediaDrm_verify - params: - - name: "" - type: '*AMediaDrm' - - name: sessionId - type: '*AMediaDrmSessionId' - - name: macAlgorithm - type: string - - name: keyId - type: '*uint8' - - name: message - type: '*uint8' - - name: messageSize - type: uint64 - - name: signature - type: '*uint8' - - name: signatureSize - type: uint64 - returns: media_status_t - AMediaExtractor_advance: - c_name: AMediaExtractor_advance - params: - - name: "" - type: '*AMediaExtractor' - returns: bool - AMediaExtractor_delete: - c_name: AMediaExtractor_delete - params: - - name: "" - type: '*AMediaExtractor' - returns: media_status_t - AMediaExtractor_getCachedDuration: - c_name: AMediaExtractor_getCachedDuration - params: - - name: "" - type: '*AMediaExtractor' - returns: int64 - AMediaExtractor_getFileFormat: - c_name: AMediaExtractor_getFileFormat - params: - - name: "" - type: '*AMediaExtractor' - returns: '*AMediaFormat' - AMediaExtractor_getPsshInfo: - c_name: AMediaExtractor_getPsshInfo - params: - - name: "" - type: '*AMediaExtractor' - returns: '*PsshInfo' - AMediaExtractor_getSampleCryptoInfo: - c_name: AMediaExtractor_getSampleCryptoInfo - params: - - name: "" - type: '*AMediaExtractor' - returns: '*AMediaCodecCryptoInfo' - AMediaExtractor_getSampleFlags: - c_name: AMediaExtractor_getSampleFlags - params: - - name: "" - type: '*AMediaExtractor' - returns: uint32 - AMediaExtractor_getSampleFormat: - c_name: AMediaExtractor_getSampleFormat - params: - - name: ex - type: '*AMediaExtractor' - - name: fmt - type: '*AMediaFormat' - returns: media_status_t - AMediaExtractor_getSampleSize: - c_name: AMediaExtractor_getSampleSize - params: - - name: "" - type: '*AMediaExtractor' - returns: int64 - AMediaExtractor_getSampleTime: - c_name: AMediaExtractor_getSampleTime - params: - - name: "" - type: '*AMediaExtractor' - returns: int64 - AMediaExtractor_getSampleTrackIndex: - c_name: AMediaExtractor_getSampleTrackIndex - params: - - name: "" - type: '*AMediaExtractor' - returns: int32 - AMediaExtractor_getTrackCount: - c_name: AMediaExtractor_getTrackCount - params: - - name: "" - type: '*AMediaExtractor' - returns: uint64 - AMediaExtractor_getTrackFormat: - c_name: AMediaExtractor_getTrackFormat - params: - - name: "" - type: '*AMediaExtractor' - - name: idx - type: uint64 - returns: '*AMediaFormat' - AMediaExtractor_new: - c_name: AMediaExtractor_new - returns: '*AMediaExtractor' - AMediaExtractor_readSampleData: - c_name: AMediaExtractor_readSampleData - params: - - name: "" - type: '*AMediaExtractor' - - name: buffer - type: '*uint8' - - name: capacity - type: uint64 - returns: int64 - AMediaExtractor_seekTo: - c_name: AMediaExtractor_seekTo - params: - - name: "" - type: '*AMediaExtractor' - - name: seekPosUs - type: int64 - - name: mode - type: SeekMode - returns: media_status_t - AMediaExtractor_selectTrack: - c_name: AMediaExtractor_selectTrack - params: - - name: "" - type: '*AMediaExtractor' - - name: idx - type: uint64 - returns: media_status_t - AMediaExtractor_setDataSource: - c_name: AMediaExtractor_setDataSource - params: - - name: "" - type: '*AMediaExtractor' - - name: location - type: string - returns: media_status_t - AMediaExtractor_setDataSourceCustom: - c_name: AMediaExtractor_setDataSourceCustom - params: - - name: "" - type: '*AMediaExtractor' - - name: src - type: '*AMediaDataSource' - returns: media_status_t - AMediaExtractor_setDataSourceFd: - c_name: AMediaExtractor_setDataSourceFd - params: - - name: "" - type: '*AMediaExtractor' - - name: fd - type: int32 - - name: offset - type: off64_t - - name: length - type: off64_t - returns: media_status_t - AMediaExtractor_unselectTrack: - c_name: AMediaExtractor_unselectTrack - params: - - name: "" - type: '*AMediaExtractor' - - name: idx - type: uint64 - returns: media_status_t - AMediaFormat_clear: - c_name: AMediaFormat_clear - params: - - name: "" - type: '*AMediaFormat' - returns: "" - AMediaFormat_copy: - c_name: AMediaFormat_copy - params: - - name: to - type: '*AMediaFormat' - - name: from - type: '*AMediaFormat' - returns: media_status_t - AMediaFormat_delete: - c_name: AMediaFormat_delete - params: - - name: "" - type: '*AMediaFormat' - returns: media_status_t - AMediaFormat_getBuffer: - c_name: AMediaFormat_getBuffer - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: data - type: '*unsafe.Pointer' - direction: out - - name: size - type: '*uint64' - returns: bool - AMediaFormat_getDouble: - c_name: AMediaFormat_getDouble - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: out - type: '*float64' - returns: bool - AMediaFormat_getFloat: - c_name: AMediaFormat_getFloat - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: out - type: '*float32' - returns: bool - AMediaFormat_getInt32: - c_name: AMediaFormat_getInt32 - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: out - type: '*int32' - returns: bool - AMediaFormat_getInt64: - c_name: AMediaFormat_getInt64 - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: out - type: '*int64' - returns: bool - AMediaFormat_getRect: - c_name: AMediaFormat_getRect - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: left - type: '*int32' - - name: top - type: '*int32' - - name: right - type: '*int32' - - name: bottom - type: '*int32' - returns: bool - AMediaFormat_getSize: - c_name: AMediaFormat_getSize - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: out - type: '*uint64' - returns: bool - AMediaFormat_getString: - c_name: AMediaFormat_getString - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: out - type: '**int8' - c_type: const char** - direction: out - const: true - returns: bool - AMediaFormat_new: - c_name: AMediaFormat_new - returns: '*AMediaFormat' - AMediaFormat_setBuffer: - c_name: AMediaFormat_setBuffer - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: data - type: unsafe.Pointer - - name: size - type: uint64 - returns: "" - AMediaFormat_setDouble: - c_name: AMediaFormat_setDouble - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: value - type: float64 - returns: "" - AMediaFormat_setFloat: - c_name: AMediaFormat_setFloat - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: value - type: float32 - returns: "" - AMediaFormat_setInt32: - c_name: AMediaFormat_setInt32 - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: value - type: int32 - returns: "" - AMediaFormat_setInt64: - c_name: AMediaFormat_setInt64 - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: value - type: int64 - returns: "" - AMediaFormat_setRect: - c_name: AMediaFormat_setRect - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: left - type: int32 - - name: top - type: int32 - - name: right - type: int32 - - name: bottom - type: int32 - returns: "" - AMediaFormat_setSize: - c_name: AMediaFormat_setSize - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: value - type: uint64 - returns: "" - AMediaFormat_setString: - c_name: AMediaFormat_setString - params: - - name: "" - type: '*AMediaFormat' - - name: name - type: string - - name: value - type: string - returns: "" - AMediaFormat_toString: - c_name: AMediaFormat_toString - params: - - name: "" - type: '*AMediaFormat' - returns: string - AMediaMuxer_addTrack: - c_name: AMediaMuxer_addTrack - params: - - name: "" - type: '*AMediaMuxer' - - name: format - type: '*AMediaFormat' - returns: int64 - AMediaMuxer_append: - c_name: AMediaMuxer_append - params: - - name: fd - type: int32 - - name: mode - type: AppendMode - returns: '*AMediaMuxer' - AMediaMuxer_delete: - c_name: AMediaMuxer_delete - params: - - name: "" - type: '*AMediaMuxer' - returns: media_status_t - AMediaMuxer_getTrackCount: - c_name: AMediaMuxer_getTrackCount - params: - - name: "" - type: '*AMediaMuxer' - returns: int64 - AMediaMuxer_getTrackFormat: - c_name: AMediaMuxer_getTrackFormat - params: - - name: muxer - type: '*AMediaMuxer' - - name: idx - type: uint64 - returns: '*AMediaFormat' - AMediaMuxer_new: - c_name: AMediaMuxer_new - params: - - name: fd - type: int32 - - name: format - type: OutputFormat - returns: '*AMediaMuxer' - AMediaMuxer_setLocation: - c_name: AMediaMuxer_setLocation - params: - - name: "" - type: '*AMediaMuxer' - - name: latitude - type: float32 - - name: longitude - type: float32 - returns: media_status_t - AMediaMuxer_setOrientationHint: - c_name: AMediaMuxer_setOrientationHint - params: - - name: "" - type: '*AMediaMuxer' - - name: degrees - type: int32 - returns: media_status_t - AMediaMuxer_start: - c_name: AMediaMuxer_start - params: - - name: "" - type: '*AMediaMuxer' - returns: media_status_t - AMediaMuxer_stop: - c_name: AMediaMuxer_stop - params: - - name: "" - type: '*AMediaMuxer' - returns: media_status_t - AMediaMuxer_writeSampleData: - c_name: AMediaMuxer_writeSampleData - params: - - name: muxer - type: '*AMediaMuxer' - - name: trackIdx - type: uint64 - - name: data - type: '*uint8' - - name: info - type: '*AMediaCodecBufferInfo' - returns: media_status_t -callbacks: - AImageReader_BufferRemovedCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: reader - type: '*AImageReader' - c_type: AImageReader* - - name: buffer - type: '*AHardwareBuffer' - c_type: AHardwareBuffer* - returns: "" - AImageReader_ImageCallback: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: reader - type: '*AImageReader' - c_type: AImageReader* - returns: "" - AMediaCodecOnAsyncError: - params: - - name: codec - type: '*AMediaCodec' - c_type: AMediaCodec* - - name: userdata - type: unsafe.Pointer - c_type: void* - - name: _error - type: media_status_t - c_type: media_status_t - - name: actionCode - type: int32 - c_type: int32_t - - name: detail - type: string - c_type: const char* - const: true - returns: "" - AMediaCodecOnAsyncFormatChanged: - params: - - name: codec - type: '*AMediaCodec' - c_type: AMediaCodec* - - name: userdata - type: unsafe.Pointer - c_type: void* - - name: format - type: '*AMediaFormat' - c_type: AMediaFormat* - returns: "" - AMediaCodecOnAsyncInputAvailable: - params: - - name: codec - type: '*AMediaCodec' - c_type: AMediaCodec* - - name: userdata - type: unsafe.Pointer - c_type: void* - - name: index - type: int32 - c_type: int32_t - returns: "" - AMediaCodecOnAsyncOutputAvailable: - params: - - name: codec - type: '*AMediaCodec' - c_type: AMediaCodec* - - name: userdata - type: unsafe.Pointer - c_type: void* - - name: index - type: int32 - c_type: int32_t - - name: bufferInfo - type: '*AMediaCodecBufferInfo' - c_type: AMediaCodecBufferInfo* - returns: "" - AMediaCodecOnFrameRendered: - params: - - name: codec - type: '*AMediaCodec' - c_type: AMediaCodec* - - name: userdata - type: unsafe.Pointer - c_type: void* - - name: mediaTimeUs - type: int64 - c_type: int64_t - - name: systemNano - type: int64 - c_type: int64_t - returns: "" - AMediaDataSourceClose: - params: - - name: userdata - type: unsafe.Pointer - c_type: void* - returns: "" - AMediaDataSourceGetAvailableSize: - params: - - name: userdata - type: unsafe.Pointer - c_type: void* - - name: offset - type: off64_t - c_type: off64_t - returns: int64 - AMediaDataSourceGetSize: - params: - - name: userdata - type: unsafe.Pointer - c_type: void* - returns: int64 - AMediaDataSourceReadAt: - params: - - name: userdata - type: unsafe.Pointer - c_type: void* - - name: offset - type: off64_t - c_type: off64_t - - name: buffer - type: unsafe.Pointer - c_type: void* - - name: size - type: uint64 - c_type: size_t - returns: int64 - AMediaDrmEventListener: - params: - - name: p0 - type: '*AMediaDrm' - c_type: AMediaDrm* - - name: sessionId - type: '*AMediaDrmSessionId' - c_type: const AMediaDrmSessionId* - const: true - - name: eventType - type: AMediaDrmEventType - c_type: AMediaDrmEventType - - name: extra - type: int32 - c_type: int - - name: data - type: '*uint8' - c_type: const uint8_t* - const: true - - name: dataSize - type: uint64 - c_type: size_t - returns: "" - AMediaDrmExpirationUpdateListener: - params: - - name: p0 - type: '*AMediaDrm' - c_type: AMediaDrm* - - name: sessionId - type: '*AMediaDrmSessionId' - c_type: const AMediaDrmSessionId* - const: true - - name: expiryTimeInMS - type: int64 - c_type: int64_t - returns: "" - AMediaDrmKeysChangeListener: - params: - - name: p0 - type: '*AMediaDrm' - c_type: AMediaDrm* - - name: sessionId - type: '*AMediaDrmSessionId' - c_type: const AMediaDrmSessionId* - const: true - - name: keyStatus - type: '*AMediaDrmKeyStatus' - c_type: const AMediaDrmKeyStatus* - const: true - - name: numKeys - type: uint64 - c_type: size_t - - name: hasNewUsableKey - type: bool - c_type: bool - returns: "" -structs: - ADoubleRange: - fields: - - name: mLower - type: float64 - - name: mUpper - type: float64 - AImageCropRect: - fields: - - name: left - type: int32 - - name: top - type: int32 - - name: right - type: int32 - - name: bottom - type: int32 - AImageReader_BufferRemovedListener: - fields: - - name: context - type: unsafe.Pointer - - name: onBufferRemoved - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: reader - type: '*AImageReader' - - name: buffer - type: '*AHardwareBuffer' - AImageReader_ImageListener: - fields: - - name: context - type: unsafe.Pointer - - name: onImageAvailable - type: func_ptr - params: - - name: context - type: unsafe.Pointer - - name: reader - type: '*AImageReader' - AIntRange: - fields: - - name: mLower - type: int32 - - name: mUpper - type: int32 - AMediaCodecBufferInfo: - fields: - - name: offset - type: int32 - - name: size - type: int32 - - name: presentationTimeUs - type: int64 - - name: flags - type: uint32 - AMediaCodecOnAsyncNotifyCallback: - fields: - - name: onAsyncInputAvailable - type: func_ptr - params: - - name: codec - type: '*AMediaCodec' - - name: userdata - type: unsafe.Pointer - - name: index - type: int32 - - name: onAsyncOutputAvailable - type: func_ptr - params: - - name: codec - type: '*AMediaCodec' - - name: userdata - type: unsafe.Pointer - - name: index - type: int32 - - name: bufferInfo - type: '*AMediaCodecBufferInfo' - - name: onAsyncFormatChanged - type: func_ptr - params: - - name: codec - type: '*AMediaCodec' - - name: userdata - type: unsafe.Pointer - - name: format - type: '*AMediaFormat' - - name: onAsyncError - type: func_ptr - params: - - name: codec - type: '*AMediaCodec' - - name: userdata - type: unsafe.Pointer - - name: _error - type: media_status_t - - name: actionCode - type: int32 - - name: detail - type: string - const: true - AMediaDrmKeyStatus: - fields: - - name: keyId - type: AMediaDrmKeyId - - name: keyType - type: AMediaDrmKeyStatusType - AMediaDrmKeyValuePair: - fields: - - name: mKey - type: string - - name: mValue - type: string - PsshEntry: - fields: - - name: uuid - type: AMediaUUID - - name: datalen - type: uint64 - - name: data - type: unsafe.Pointer - PsshInfo: - fields: - - name: numentries - type: uint64 - - name: entries - type: '[]PsshEntry' diff --git a/spec/generated/midi.yaml b/spec/generated/midi.yaml deleted file mode 100644 index 41b6d94..0000000 --- a/spec/generated/midi.yaml +++ /dev/null @@ -1,171 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: midi -source_package: github.com/AndroidGoLab/ndk/capi/midi -types: - AMidiDevice: - kind: opaque_ptr - c_type: AMidiDevice - go_type: '*C.AMidiDevice' - AMidiDevice_Protocol: - kind: typedef_int32 - c_type: AMidiDevice_Protocol - go_type: int32 - AMidiInputPort: - kind: opaque_ptr - c_type: AMidiInputPort - go_type: '*C.AMidiInputPort' - AMidiOutputPort: - kind: opaque_ptr - c_type: AMidiOutputPort - go_type: '*C.AMidiOutputPort' -enums: - AMIDI_DEVICE_TYPE: - - name: AMIDI_DEVICE_TYPE_USB - value: 1 - - name: AMIDI_DEVICE_TYPE_VIRTUAL - value: 2 - - name: AMIDI_DEVICE_TYPE_BLUETOOTH - value: 3 - AMIDI_OPCODE: - - name: AMIDI_OPCODE_DATA - value: 1 - - name: AMIDI_OPCODE_FLUSH - value: 2 - AMidiDevice_Protocol: - - name: AMIDI_DEVICE_PROTOCOL_UMP_USE_MIDI_CI - value: 0 - - name: AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS - value: 1 - - name: AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS - value: 2 - - name: AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS - value: 3 - - name: AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS - value: 4 - - name: AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0 - value: 17 - - name: AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0_AND_JRTS - value: 18 - - name: AMIDI_DEVICE_PROTOCOL_UNKNOWN - value: -1 -functions: - AMidiDevice_fromJava: - c_name: AMidiDevice_fromJava - params: - - name: env - type: '*JNIEnv' - - name: midiDeviceObj - type: jobject - - name: outDevicePtrPtr - type: '**AMidiDevice' - direction: out - returns: media_status_t - AMidiDevice_getDefaultProtocol: - c_name: AMidiDevice_getDefaultProtocol - params: - - name: device - type: '*AMidiDevice' - returns: AMidiDevice_Protocol - AMidiDevice_getNumInputPorts: - c_name: AMidiDevice_getNumInputPorts - params: - - name: device - type: '*AMidiDevice' - returns: int64 - AMidiDevice_getNumOutputPorts: - c_name: AMidiDevice_getNumOutputPorts - params: - - name: device - type: '*AMidiDevice' - returns: int64 - AMidiDevice_getType: - c_name: AMidiDevice_getType - params: - - name: device - type: '*AMidiDevice' - returns: int32 - AMidiDevice_release: - c_name: AMidiDevice_release - params: - - name: midiDevice - type: '*AMidiDevice' - returns: media_status_t - AMidiInputPort_close: - c_name: AMidiInputPort_close - params: - - name: inputPort - type: '*AMidiInputPort' - returns: "" - AMidiInputPort_open: - c_name: AMidiInputPort_open - params: - - name: device - type: '*AMidiDevice' - - name: portNumber - type: int32 - - name: outInputPortPtr - type: '**AMidiInputPort' - direction: out - returns: media_status_t - AMidiInputPort_send: - c_name: AMidiInputPort_send - params: - - name: inputPort - type: '*AMidiInputPort' - - name: buffer - type: '*uint8' - - name: numBytes - type: uint64 - returns: int64 - AMidiInputPort_sendFlush: - c_name: AMidiInputPort_sendFlush - params: - - name: inputPort - type: '*AMidiInputPort' - returns: media_status_t - AMidiInputPort_sendWithTimestamp: - c_name: AMidiInputPort_sendWithTimestamp - params: - - name: inputPort - type: '*AMidiInputPort' - - name: buffer - type: '*uint8' - - name: numBytes - type: uint64 - - name: timestamp - type: int64 - returns: int64 - AMidiOutputPort_close: - c_name: AMidiOutputPort_close - params: - - name: outputPort - type: '*AMidiOutputPort' - returns: "" - AMidiOutputPort_open: - c_name: AMidiOutputPort_open - params: - - name: device - type: '*AMidiDevice' - - name: portNumber - type: int32 - - name: outOutputPortPtr - type: '**AMidiOutputPort' - direction: out - returns: media_status_t - AMidiOutputPort_receive: - c_name: AMidiOutputPort_receive - params: - - name: outputPort - type: '*AMidiOutputPort' - - name: opcodePtr - type: '*int32' - - name: buffer - type: '*uint8' - - name: maxBytes - type: uint64 - - name: numBytesReceivedPtr - type: '*uint64' - - name: outTimestampPtr - type: '*int64' - returns: int64 diff --git a/spec/generated/multinetwork.yaml b/spec/generated/multinetwork.yaml deleted file mode 100644 index 4990fd0..0000000 --- a/spec/generated/multinetwork.yaml +++ /dev/null @@ -1,118 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: multinetwork -source_package: github.com/AndroidGoLab/ndk/capi/multinetwork -types: - net_handle_t: - kind: typedef_uint64 - c_type: net_handle_t - go_type: uint64 -enums: - ResNsendFlags: - - name: ANDROID_RESOLV_NO_RETRY - value: 1 - - name: ANDROID_RESOLV_NO_CACHE_STORE - value: 2 - - name: ANDROID_RESOLV_NO_CACHE_LOOKUP - value: 4 -functions: - android_getprocdns: - c_name: android_getprocdns - params: - - name: network - type: '*net_handle_t' - returns: int32 - android_getprocnetwork: - c_name: android_getprocnetwork - params: - - name: network - type: '*net_handle_t' - returns: int32 - android_res_cancel: - c_name: android_res_cancel - params: - - name: nsend_fd - type: int32 - returns: "" - android_res_nquery: - c_name: android_res_nquery - params: - - name: network - type: net_handle_t - - name: dname - type: string - - name: ns_class - type: int32 - - name: ns_type - type: int32 - - name: flags - type: uint32 - returns: int32 - android_res_nresult: - c_name: android_res_nresult - params: - - name: fd - type: int32 - - name: rcode - type: '*int32' - - name: answer - type: '*uint8' - - name: anslen - type: uint64 - returns: int32 - android_res_nsend: - c_name: android_res_nsend - params: - - name: network - type: net_handle_t - - name: msg - type: '*uint8' - - name: msglen - type: uint64 - - name: flags - type: uint32 - returns: int32 - android_setprocdns: - c_name: android_setprocdns - params: - - name: network - type: net_handle_t - returns: int32 - android_setprocnetwork: - c_name: android_setprocnetwork - params: - - name: network - type: net_handle_t - returns: int32 - android_setsocknetwork: - c_name: android_setsocknetwork - params: - - name: network - type: net_handle_t - - name: fd - type: int32 - returns: int32 - android_tag_socket: - c_name: android_tag_socket - params: - - name: sockfd - type: int32 - - name: tag - type: uint32 - returns: int32 - android_tag_socket_with_uid: - c_name: android_tag_socket_with_uid - params: - - name: sockfd - type: int32 - - name: tag - type: uint32 - - name: uid - type: uid_t - returns: int32 - android_untag_socket: - c_name: android_untag_socket - params: - - name: sockfd - type: int32 - returns: int32 diff --git a/spec/generated/nativeactivity.yaml b/spec/generated/nativeactivity.yaml deleted file mode 100644 index aee6d17..0000000 --- a/spec/generated/nativeactivity.yaml +++ /dev/null @@ -1,219 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: nativeactivity -source_package: github.com/AndroidGoLab/ndk/capi/nativeactivity -types: - ANativeActivity: - kind: opaque_ptr - c_type: ANativeActivity - go_type: '*C.ANativeActivity' - ANativeActivity_createFunc: - kind: typedef_:function - c_type: ANativeActivity_createFunc - go_type: :function - ANativeActivityCallbacks: - kind: opaque_ptr - c_type: ANativeActivityCallbacks - go_type: '*C.ANativeActivityCallbacks' -enums: - ANATIVEACTIVITY_HIDE_SOFT_INPUT: - - name: ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY - value: 1 - - name: ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS - value: 2 - ANATIVEACTIVITY_SHOW_SOFT_INPUT: - - name: ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT - value: 1 - - name: ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED - value: 2 -functions: - ANativeActivity_finish: - c_name: ANativeActivity_finish - params: - - name: activity - type: '*ANativeActivity' - returns: "" - ANativeActivity_hideSoftInput: - c_name: ANativeActivity_hideSoftInput - params: - - name: activity - type: '*ANativeActivity' - - name: flags - type: uint32 - returns: "" - ANativeActivity_setWindowFlags: - c_name: ANativeActivity_setWindowFlags - params: - - name: activity - type: '*ANativeActivity' - - name: addFlags - type: uint32 - - name: removeFlags - type: uint32 - returns: "" - ANativeActivity_setWindowFormat: - c_name: ANativeActivity_setWindowFormat - params: - - name: activity - type: '*ANativeActivity' - - name: format - type: int32 - returns: "" - ANativeActivity_showSoftInput: - c_name: ANativeActivity_showSoftInput - params: - - name: activity - type: '*ANativeActivity' - - name: flags - type: uint32 - returns: "" -structs: - ANativeActivity: - fields: - - name: callbacks - type: '*ANativeActivityCallbacks' - - name: vm - type: '*JavaVM' - - name: env - type: '*JNIEnv' - - name: clazz - type: jobject - - name: internalDataPath - type: string - - name: externalDataPath - type: string - - name: sdkVersion - type: int32 - - name: instance - type: unsafe.Pointer - - name: assetManager - type: '*AAssetManager' - - name: obbPath - type: string - ANativeActivityCallbacks: - fields: - - name: onStart - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: onResume - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: onSaveInstanceState - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: outSize - type: '*uint64' - c_type: size_t* - returns: unsafe.Pointer - - name: onPause - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: onStop - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: onDestroy - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: onWindowFocusChanged - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: hasFocus - type: int32 - c_type: int - - name: onNativeWindowCreated - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: window - type: '*ANativeWindow' - c_type: ANativeWindow* - - name: onNativeWindowResized - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: window - type: '*ANativeWindow' - c_type: ANativeWindow* - - name: onNativeWindowRedrawNeeded - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: window - type: '*ANativeWindow' - c_type: ANativeWindow* - - name: onNativeWindowDestroyed - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: window - type: '*ANativeWindow' - c_type: ANativeWindow* - - name: onInputQueueCreated - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: queue - type: '*AInputQueue' - c_type: AInputQueue* - - name: onInputQueueDestroyed - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: queue - type: '*AInputQueue' - c_type: AInputQueue* - - name: onContentRectChanged - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: rect - type: '*ARect' - c_type: const ARect* - const: true - - name: onConfigurationChanged - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* - - name: onLowMemory - type: func_ptr - params: - - name: activity - type: '*ANativeActivity' - c_type: ANativeActivity* diff --git a/spec/generated/nativewindow.yaml b/spec/generated/nativewindow.yaml deleted file mode 100644 index 4d38f00..0000000 --- a/spec/generated/nativewindow.yaml +++ /dev/null @@ -1,180 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: nativewindow -source_package: github.com/AndroidGoLab/ndk/capi/nativewindow -types: - ANativeWindow: - kind: opaque_ptr - c_type: ANativeWindow - go_type: '*C.ANativeWindow' - ANativeWindow_Buffer: - kind: opaque_ptr - c_type: ANativeWindow_Buffer - go_type: '*C.ANativeWindow_Buffer' -enums: - ANativeWindow_ChangeFrameRateStrategy: - - name: ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS - value: 0 - - name: ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS - value: 1 - ANativeWindow_FrameRateCompatibility: - - name: ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT - value: 0 - - name: ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE - value: 1 - ANativeWindow_LegacyFormat: - - name: WINDOW_FORMAT_RGBA_8888 - value: 1 - - name: WINDOW_FORMAT_RGBX_8888 - value: 2 - - name: WINDOW_FORMAT_RGB_565 - value: 4 - ANativeWindowTransform: - - name: ANATIVEWINDOW_TRANSFORM_IDENTITY - value: 0 - - name: ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL - value: 1 - - name: ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL - value: 2 - - name: ANATIVEWINDOW_TRANSFORM_ROTATE_90 - value: 4 - - name: ANATIVEWINDOW_TRANSFORM_ROTATE_180 - value: 3 - - name: ANATIVEWINDOW_TRANSFORM_ROTATE_270 - value: 7 -functions: - ANativeWindow_acquire: - c_name: ANativeWindow_acquire - params: - - name: window - type: '*ANativeWindow' - returns: "" - ANativeWindow_clearFrameRate: - c_name: ANativeWindow_clearFrameRate - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getBuffersDataSpace: - c_name: ANativeWindow_getBuffersDataSpace - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getBuffersDefaultDataSpace: - c_name: ANativeWindow_getBuffersDefaultDataSpace - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getFormat: - c_name: ANativeWindow_getFormat - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getHeight: - c_name: ANativeWindow_getHeight - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_getWidth: - c_name: ANativeWindow_getWidth - params: - - name: window - type: '*ANativeWindow' - returns: int32 - ANativeWindow_lock: - c_name: ANativeWindow_lock - params: - - name: window - type: '*ANativeWindow' - - name: outBuffer - type: '*ANativeWindow_Buffer' - - name: inOutDirtyBounds - type: '*ARect' - returns: int32 - ANativeWindow_release: - c_name: ANativeWindow_release - params: - - name: window - type: '*ANativeWindow' - returns: "" - ANativeWindow_setBuffersDataSpace: - c_name: ANativeWindow_setBuffersDataSpace - params: - - name: window - type: '*ANativeWindow' - - name: dataSpace - type: int32 - returns: int32 - ANativeWindow_setBuffersGeometry: - c_name: ANativeWindow_setBuffersGeometry - params: - - name: window - type: '*ANativeWindow' - - name: width - type: int32 - - name: height - type: int32 - - name: format - type: int32 - returns: int32 - ANativeWindow_setBuffersTransform: - c_name: ANativeWindow_setBuffersTransform - params: - - name: window - type: '*ANativeWindow' - - name: transform - type: int32 - returns: int32 - ANativeWindow_setFrameRate: - c_name: ANativeWindow_setFrameRate - params: - - name: window - type: '*ANativeWindow' - - name: frameRate - type: float32 - - name: compatibility - type: int8 - returns: int32 - ANativeWindow_setFrameRateWithChangeStrategy: - c_name: ANativeWindow_setFrameRateWithChangeStrategy - params: - - name: window - type: '*ANativeWindow' - - name: frameRate - type: float32 - - name: compatibility - type: int8 - - name: changeFrameRateStrategy - type: int8 - returns: int32 - ANativeWindow_tryAllocateBuffers: - c_name: ANativeWindow_tryAllocateBuffers - params: - - name: window - type: '*ANativeWindow' - returns: "" - ANativeWindow_unlockAndPost: - c_name: ANativeWindow_unlockAndPost - params: - - name: window - type: '*ANativeWindow' - returns: int32 -structs: - ANativeWindow_Buffer: - fields: - - name: width - type: int32 - - name: height - type: int32 - - name: stride - type: int32 - - name: format - type: int32 - - name: bits - type: unsafe.Pointer - - name: reserved - type: '[6]uint32' diff --git a/spec/generated/neuralnetworks.yaml b/spec/generated/neuralnetworks.yaml deleted file mode 100644 index 74cd964..0000000 --- a/spec/generated/neuralnetworks.yaml +++ /dev/null @@ -1,634 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: neuralnetworks -source_package: github.com/AndroidGoLab/ndk/capi/neuralnetworks -functions: - ANeuralNetworks_getDefaultLoopTimeout: - c_name: ANeuralNetworks_getDefaultLoopTimeout - returns: uint64 - ANeuralNetworks_getDevice: - c_name: ANeuralNetworks_getDevice - params: - - name: devIndex - type: uint32 - - name: device - type: '**ANeuralNetworksDevice' - direction: out - returns: int32 - ANeuralNetworks_getDeviceCount: - c_name: ANeuralNetworks_getDeviceCount - params: - - name: numDevices - type: '*uint32' - returns: int32 - ANeuralNetworks_getMaximumLoopTimeout: - c_name: ANeuralNetworks_getMaximumLoopTimeout - returns: uint64 - ANeuralNetworks_getRuntimeFeatureLevel: - c_name: ANeuralNetworks_getRuntimeFeatureLevel - returns: int64 - ANeuralNetworksBurst_create: - c_name: ANeuralNetworksBurst_create - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: burst - type: '**ANeuralNetworksBurst' - direction: out - returns: int32 - ANeuralNetworksBurst_free: - c_name: ANeuralNetworksBurst_free - params: - - name: burst - type: '*ANeuralNetworksBurst' - returns: "" - ANeuralNetworksCompilation_create: - c_name: ANeuralNetworksCompilation_create - params: - - name: model - type: '*ANeuralNetworksModel' - - name: compilation - type: '**ANeuralNetworksCompilation' - direction: out - returns: int32 - ANeuralNetworksCompilation_createForDevices: - c_name: ANeuralNetworksCompilation_createForDevices - params: - - name: model - type: '*ANeuralNetworksModel' - - name: devices - type: '**ANeuralNetworksDevice' - direction: out - - name: numDevices - type: uint32 - - name: compilation - type: '**ANeuralNetworksCompilation' - direction: out - returns: int32 - ANeuralNetworksCompilation_finish: - c_name: ANeuralNetworksCompilation_finish - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - returns: int32 - ANeuralNetworksCompilation_free: - c_name: ANeuralNetworksCompilation_free - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - returns: "" - ANeuralNetworksCompilation_getPreferredMemoryAlignmentForInput: - c_name: ANeuralNetworksCompilation_getPreferredMemoryAlignmentForInput - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: index - type: uint32 - - name: alignment - type: '*uint32' - returns: int32 - ANeuralNetworksCompilation_getPreferredMemoryAlignmentForOutput: - c_name: ANeuralNetworksCompilation_getPreferredMemoryAlignmentForOutput - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: index - type: uint32 - - name: alignment - type: '*uint32' - returns: int32 - ANeuralNetworksCompilation_getPreferredMemoryPaddingForInput: - c_name: ANeuralNetworksCompilation_getPreferredMemoryPaddingForInput - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: index - type: uint32 - - name: padding - type: '*uint32' - returns: int32 - ANeuralNetworksCompilation_getPreferredMemoryPaddingForOutput: - c_name: ANeuralNetworksCompilation_getPreferredMemoryPaddingForOutput - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: index - type: uint32 - - name: padding - type: '*uint32' - returns: int32 - ANeuralNetworksCompilation_setCaching: - c_name: ANeuralNetworksCompilation_setCaching - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: cacheDir - type: string - - name: token - type: '*uint8' - returns: int32 - ANeuralNetworksCompilation_setPreference: - c_name: ANeuralNetworksCompilation_setPreference - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: preference - type: int32 - returns: int32 - ANeuralNetworksCompilation_setPriority: - c_name: ANeuralNetworksCompilation_setPriority - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: priority - type: int32 - returns: int32 - ANeuralNetworksCompilation_setTimeout: - c_name: ANeuralNetworksCompilation_setTimeout - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: duration - type: uint64 - returns: int32 - ANeuralNetworksDevice_getFeatureLevel: - c_name: ANeuralNetworksDevice_getFeatureLevel - params: - - name: device - type: '*ANeuralNetworksDevice' - - name: featureLevel - type: '*int64' - returns: int32 - ANeuralNetworksDevice_getName: - c_name: ANeuralNetworksDevice_getName - params: - - name: device - type: '*ANeuralNetworksDevice' - - name: name - type: '**int8' - c_type: const char** - direction: out - const: true - returns: int32 - ANeuralNetworksDevice_getType: - c_name: ANeuralNetworksDevice_getType - params: - - name: device - type: '*ANeuralNetworksDevice' - - name: type - type: '*int32' - returns: int32 - ANeuralNetworksDevice_getVersion: - c_name: ANeuralNetworksDevice_getVersion - params: - - name: device - type: '*ANeuralNetworksDevice' - - name: version - type: '**int8' - c_type: const char** - direction: out - const: true - returns: int32 - ANeuralNetworksDevice_wait: - c_name: ANeuralNetworksDevice_wait - params: - - name: device - type: '*ANeuralNetworksDevice' - returns: int32 - ANeuralNetworksEvent_createFromSyncFenceFd: - c_name: ANeuralNetworksEvent_createFromSyncFenceFd - params: - - name: sync_fence_fd - type: int32 - - name: event - type: '**ANeuralNetworksEvent' - direction: out - returns: int32 - ANeuralNetworksEvent_free: - c_name: ANeuralNetworksEvent_free - params: - - name: event - type: '*ANeuralNetworksEvent' - returns: "" - ANeuralNetworksEvent_getSyncFenceFd: - c_name: ANeuralNetworksEvent_getSyncFenceFd - params: - - name: event - type: '*ANeuralNetworksEvent' - - name: sync_fence_fd - type: '*int32' - returns: int32 - ANeuralNetworksEvent_wait: - c_name: ANeuralNetworksEvent_wait - params: - - name: event - type: '*ANeuralNetworksEvent' - returns: int32 - ANeuralNetworksExecution_burstCompute: - c_name: ANeuralNetworksExecution_burstCompute - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: burst - type: '*ANeuralNetworksBurst' - returns: int32 - ANeuralNetworksExecution_compute: - c_name: ANeuralNetworksExecution_compute - params: - - name: execution - type: '*ANeuralNetworksExecution' - returns: int32 - ANeuralNetworksExecution_create: - c_name: ANeuralNetworksExecution_create - params: - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: execution - type: '**ANeuralNetworksExecution' - direction: out - returns: int32 - ANeuralNetworksExecution_enableInputAndOutputPadding: - c_name: ANeuralNetworksExecution_enableInputAndOutputPadding - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: enable - type: bool - returns: int32 - ANeuralNetworksExecution_free: - c_name: ANeuralNetworksExecution_free - params: - - name: execution - type: '*ANeuralNetworksExecution' - returns: "" - ANeuralNetworksExecution_getDuration: - c_name: ANeuralNetworksExecution_getDuration - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: durationCode - type: int32 - - name: duration - type: '*uint64' - returns: int32 - ANeuralNetworksExecution_getOutputOperandDimensions: - c_name: ANeuralNetworksExecution_getOutputOperandDimensions - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: index - type: int32 - - name: dimensions - type: '*uint32' - returns: int32 - ANeuralNetworksExecution_getOutputOperandRank: - c_name: ANeuralNetworksExecution_getOutputOperandRank - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: index - type: int32 - - name: rank - type: '*uint32' - returns: int32 - ANeuralNetworksExecution_setInput: - c_name: ANeuralNetworksExecution_setInput - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: index - type: int32 - - name: type - type: '*ANeuralNetworksOperandType' - - name: buffer - type: unsafe.Pointer - - name: length - type: uint64 - returns: int32 - ANeuralNetworksExecution_setInputFromMemory: - c_name: ANeuralNetworksExecution_setInputFromMemory - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: index - type: int32 - - name: type - type: '*ANeuralNetworksOperandType' - - name: memory - type: '*ANeuralNetworksMemory' - - name: offset - type: uint64 - - name: length - type: uint64 - returns: int32 - ANeuralNetworksExecution_setLoopTimeout: - c_name: ANeuralNetworksExecution_setLoopTimeout - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: duration - type: uint64 - returns: int32 - ANeuralNetworksExecution_setMeasureTiming: - c_name: ANeuralNetworksExecution_setMeasureTiming - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: measure - type: bool - returns: int32 - ANeuralNetworksExecution_setOutput: - c_name: ANeuralNetworksExecution_setOutput - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: index - type: int32 - - name: type - type: '*ANeuralNetworksOperandType' - - name: buffer - type: unsafe.Pointer - - name: length - type: uint64 - returns: int32 - ANeuralNetworksExecution_setOutputFromMemory: - c_name: ANeuralNetworksExecution_setOutputFromMemory - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: index - type: int32 - - name: type - type: '*ANeuralNetworksOperandType' - - name: memory - type: '*ANeuralNetworksMemory' - - name: offset - type: uint64 - - name: length - type: uint64 - returns: int32 - ANeuralNetworksExecution_setReusable: - c_name: ANeuralNetworksExecution_setReusable - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: reusable - type: bool - returns: int32 - ANeuralNetworksExecution_setTimeout: - c_name: ANeuralNetworksExecution_setTimeout - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: duration - type: uint64 - returns: int32 - ANeuralNetworksExecution_startCompute: - c_name: ANeuralNetworksExecution_startCompute - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: event - type: '**ANeuralNetworksEvent' - direction: out - returns: int32 - ANeuralNetworksExecution_startComputeWithDependencies: - c_name: ANeuralNetworksExecution_startComputeWithDependencies - params: - - name: execution - type: '*ANeuralNetworksExecution' - - name: dependencies - type: '**ANeuralNetworksEvent' - direction: out - - name: num_dependencies - type: uint32 - - name: duration - type: uint64 - - name: event - type: '**ANeuralNetworksEvent' - direction: out - returns: int32 - ANeuralNetworksMemory_copy: - c_name: ANeuralNetworksMemory_copy - params: - - name: src - type: '*ANeuralNetworksMemory' - - name: dst - type: '*ANeuralNetworksMemory' - returns: int32 - ANeuralNetworksMemory_createFromAHardwareBuffer: - c_name: ANeuralNetworksMemory_createFromAHardwareBuffer - params: - - name: ahwb - type: '*AHardwareBuffer' - - name: memory - type: '**ANeuralNetworksMemory' - direction: out - returns: int32 - ANeuralNetworksMemory_createFromDesc: - c_name: ANeuralNetworksMemory_createFromDesc - params: - - name: desc - type: '*ANeuralNetworksMemoryDesc' - - name: memory - type: '**ANeuralNetworksMemory' - direction: out - returns: int32 - ANeuralNetworksMemory_createFromFd: - c_name: ANeuralNetworksMemory_createFromFd - params: - - name: size - type: uint64 - - name: protect - type: int32 - - name: fd - type: int32 - - name: offset - type: uint64 - - name: memory - type: '**ANeuralNetworksMemory' - direction: out - returns: int32 - ANeuralNetworksMemory_free: - c_name: ANeuralNetworksMemory_free - params: - - name: memory - type: '*ANeuralNetworksMemory' - returns: "" - ANeuralNetworksMemoryDesc_addInputRole: - c_name: ANeuralNetworksMemoryDesc_addInputRole - params: - - name: desc - type: '*ANeuralNetworksMemoryDesc' - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: index - type: uint32 - - name: frequency - type: float32 - returns: int32 - ANeuralNetworksMemoryDesc_addOutputRole: - c_name: ANeuralNetworksMemoryDesc_addOutputRole - params: - - name: desc - type: '*ANeuralNetworksMemoryDesc' - - name: compilation - type: '*ANeuralNetworksCompilation' - - name: index - type: uint32 - - name: frequency - type: float32 - returns: int32 - ANeuralNetworksMemoryDesc_create: - c_name: ANeuralNetworksMemoryDesc_create - params: - - name: desc - type: '**ANeuralNetworksMemoryDesc' - direction: out - returns: int32 - ANeuralNetworksMemoryDesc_finish: - c_name: ANeuralNetworksMemoryDesc_finish - params: - - name: desc - type: '*ANeuralNetworksMemoryDesc' - returns: int32 - ANeuralNetworksMemoryDesc_free: - c_name: ANeuralNetworksMemoryDesc_free - params: - - name: desc - type: '*ANeuralNetworksMemoryDesc' - returns: "" - ANeuralNetworksMemoryDesc_setDimensions: - c_name: ANeuralNetworksMemoryDesc_setDimensions - params: - - name: desc - type: '*ANeuralNetworksMemoryDesc' - - name: rank - type: uint32 - - name: dimensions - type: '*uint32' - returns: int32 - ANeuralNetworksModel_addOperand: - c_name: ANeuralNetworksModel_addOperand - params: - - name: model - type: '*ANeuralNetworksModel' - - name: type - type: '*ANeuralNetworksOperandType' - returns: int32 - ANeuralNetworksModel_addOperation: - c_name: ANeuralNetworksModel_addOperation - params: - - name: model - type: '*ANeuralNetworksModel' - - name: type - type: ANeuralNetworksOperationType - - name: inputCount - type: uint32 - - name: inputs - type: '*uint32' - - name: outputCount - type: uint32 - - name: outputs - type: '*uint32' - returns: int32 - ANeuralNetworksModel_create: - c_name: ANeuralNetworksModel_create - params: - - name: model - type: '**ANeuralNetworksModel' - direction: out - returns: int32 - ANeuralNetworksModel_finish: - c_name: ANeuralNetworksModel_finish - params: - - name: model - type: '*ANeuralNetworksModel' - returns: int32 - ANeuralNetworksModel_free: - c_name: ANeuralNetworksModel_free - params: - - name: model - type: '*ANeuralNetworksModel' - returns: "" - ANeuralNetworksModel_getSupportedOperationsForDevices: - c_name: ANeuralNetworksModel_getSupportedOperationsForDevices - params: - - name: model - type: '*ANeuralNetworksModel' - - name: devices - type: '**ANeuralNetworksDevice' - direction: out - - name: numDevices - type: uint32 - - name: supportedOps - type: '*bool' - returns: int32 - ANeuralNetworksModel_identifyInputsAndOutputs: - c_name: ANeuralNetworksModel_identifyInputsAndOutputs - params: - - name: model - type: '*ANeuralNetworksModel' - - name: inputCount - type: uint32 - - name: inputs - type: '*uint32' - - name: outputCount - type: uint32 - - name: outputs - type: '*uint32' - returns: int32 - ANeuralNetworksModel_relaxComputationFloat32toFloat16: - c_name: ANeuralNetworksModel_relaxComputationFloat32toFloat16 - params: - - name: model - type: '*ANeuralNetworksModel' - - name: allow - type: bool - returns: int32 - ANeuralNetworksModel_setOperandSymmPerChannelQuantParams: - c_name: ANeuralNetworksModel_setOperandSymmPerChannelQuantParams - params: - - name: model - type: '*ANeuralNetworksModel' - - name: index - type: int32 - - name: channelQuant - type: '*ANeuralNetworksSymmPerChannelQuantParams' - returns: int32 - ANeuralNetworksModel_setOperandValue: - c_name: ANeuralNetworksModel_setOperandValue - params: - - name: model - type: '*ANeuralNetworksModel' - - name: index - type: int32 - - name: buffer - type: unsafe.Pointer - - name: length - type: uint64 - returns: int32 - ANeuralNetworksModel_setOperandValueFromMemory: - c_name: ANeuralNetworksModel_setOperandValueFromMemory - params: - - name: model - type: '*ANeuralNetworksModel' - - name: index - type: int32 - - name: memory - type: '*ANeuralNetworksMemory' - - name: offset - type: uint64 - - name: length - type: uint64 - returns: int32 - ANeuralNetworksModel_setOperandValueFromModel: - c_name: ANeuralNetworksModel_setOperandValueFromModel - params: - - name: model - type: '*ANeuralNetworksModel' - - name: index - type: int32 - - name: value - type: '*ANeuralNetworksModel' - returns: int32 diff --git a/spec/generated/performancehint.yaml b/spec/generated/performancehint.yaml deleted file mode 100644 index b31ad06..0000000 --- a/spec/generated/performancehint.yaml +++ /dev/null @@ -1,128 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: performancehint -source_package: github.com/AndroidGoLab/ndk/capi/performancehint -types: - APerformanceHintManager: - kind: opaque_ptr - c_type: APerformanceHintManager - go_type: '*C.APerformanceHintManager' - APerformanceHintSession: - kind: opaque_ptr - c_type: APerformanceHintSession - go_type: '*C.APerformanceHintSession' - AWorkDuration: - kind: opaque_ptr - c_type: AWorkDuration - go_type: '*C.AWorkDuration' -functions: - APerformanceHint_closeSession: - c_name: APerformanceHint_closeSession - params: - - name: session - type: '*APerformanceHintSession' - returns: "" - APerformanceHint_createSession: - c_name: APerformanceHint_createSession - params: - - name: manager - type: '*APerformanceHintManager' - - name: threadIds - type: '*int32' - - name: size - type: uint64 - - name: initialTargetWorkDurationNanos - type: int64 - returns: '*APerformanceHintSession' - APerformanceHint_getManager: - c_name: APerformanceHint_getManager - returns: '*APerformanceHintManager' - APerformanceHint_getPreferredUpdateRateNanos: - c_name: APerformanceHint_getPreferredUpdateRateNanos - params: - - name: manager - type: '*APerformanceHintManager' - returns: int64 - APerformanceHint_reportActualWorkDuration: - c_name: APerformanceHint_reportActualWorkDuration - params: - - name: session - type: '*APerformanceHintSession' - - name: actualDurationNanos - type: int64 - returns: int32 - APerformanceHint_reportActualWorkDuration2: - c_name: APerformanceHint_reportActualWorkDuration2 - params: - - name: session - type: '*APerformanceHintSession' - - name: workDuration - type: '*AWorkDuration' - returns: int32 - APerformanceHint_setPreferPowerEfficiency: - c_name: APerformanceHint_setPreferPowerEfficiency - params: - - name: session - type: '*APerformanceHintSession' - - name: enabled - type: bool - returns: int32 - APerformanceHint_setThreads: - c_name: APerformanceHint_setThreads - params: - - name: session - type: '*APerformanceHintSession' - - name: threadIds - type: '*pid_t' - - name: size - type: uint64 - returns: int32 - APerformanceHint_updateTargetWorkDuration: - c_name: APerformanceHint_updateTargetWorkDuration - params: - - name: session - type: '*APerformanceHintSession' - - name: targetDurationNanos - type: int64 - returns: int32 - AWorkDuration_create: - c_name: AWorkDuration_create - returns: '*AWorkDuration' - AWorkDuration_release: - c_name: AWorkDuration_release - params: - - name: aWorkDuration - type: '*AWorkDuration' - returns: "" - AWorkDuration_setActualCpuDurationNanos: - c_name: AWorkDuration_setActualCpuDurationNanos - params: - - name: aWorkDuration - type: '*AWorkDuration' - - name: actualCpuDurationNanos - type: int64 - returns: "" - AWorkDuration_setActualGpuDurationNanos: - c_name: AWorkDuration_setActualGpuDurationNanos - params: - - name: aWorkDuration - type: '*AWorkDuration' - - name: actualGpuDurationNanos - type: int64 - returns: "" - AWorkDuration_setActualTotalDurationNanos: - c_name: AWorkDuration_setActualTotalDurationNanos - params: - - name: aWorkDuration - type: '*AWorkDuration' - - name: actualTotalDurationNanos - type: int64 - returns: "" - AWorkDuration_setWorkPeriodStartTimestampNanos: - c_name: AWorkDuration_setWorkPeriodStartTimestampNanos - params: - - name: aWorkDuration - type: '*AWorkDuration' - - name: workPeriodStartTimestampNanos - type: int64 - returns: "" diff --git a/spec/generated/permission.yaml b/spec/generated/permission.yaml deleted file mode 100644 index d39802c..0000000 --- a/spec/generated/permission.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: permission -source_package: github.com/AndroidGoLab/ndk/capi/permission -enums: - PERMISSION_MANAGER_PERMISSION: - - name: PERMISSION_MANAGER_PERMISSION_GRANTED - value: 0 - - name: PERMISSION_MANAGER_PERMISSION_DENIED - value: -1 - PERMISSION_MANAGER_STATUS: - - name: PERMISSION_MANAGER_STATUS_OK - value: 0 - - name: PERMISSION_MANAGER_STATUS_ERROR_UNKNOWN - value: -1 - - name: PERMISSION_MANAGER_STATUS_SERVICE_UNAVAILABLE - value: -2 -functions: - APermissionManager_checkPermission: - c_name: APermissionManager_checkPermission - params: - - name: permission - type: string - - name: pid - type: pid_t - - name: uid - type: uid_t - - name: outResult - type: '*int32' - returns: int32 diff --git a/spec/generated/persistablebundle.yaml b/spec/generated/persistablebundle.yaml deleted file mode 100644 index 5abc36b..0000000 --- a/spec/generated/persistablebundle.yaml +++ /dev/null @@ -1,512 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: persistablebundle -source_package: github.com/AndroidGoLab/ndk/capi/persistablebundle -types: - APersistableBundle: - kind: opaque_ptr - c_type: APersistableBundle - go_type: '*C.APersistableBundle' -enums: - APERSISTABLEBUNDLE: - - name: APERSISTABLEBUNDLE_KEY_NOT_FOUND - value: -1 - - name: APERSISTABLEBUNDLE_ALLOCATOR_FAILED - value: -2 -functions: - APersistableBundle_delete: - c_name: APersistableBundle_delete - params: - - name: pBundle - type: '*APersistableBundle' - returns: "" - APersistableBundle_dup: - c_name: APersistableBundle_dup - params: - - name: pBundle - type: '*APersistableBundle' - returns: '*APersistableBundle' - APersistableBundle_erase: - c_name: APersistableBundle_erase - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - returns: int32 - APersistableBundle_getBoolean: - c_name: APersistableBundle_getBoolean - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: '*bool' - returns: bool - APersistableBundle_getBooleanKeys: - c_name: APersistableBundle_getBooleanKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getBooleanVector: - c_name: APersistableBundle_getBooleanVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: buffer - type: '*bool' - - name: bufferSizeBytes - type: int32 - returns: int32 - APersistableBundle_getBooleanVectorKeys: - c_name: APersistableBundle_getBooleanVectorKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getDouble: - c_name: APersistableBundle_getDouble - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: '*float64' - returns: bool - APersistableBundle_getDoubleKeys: - c_name: APersistableBundle_getDoubleKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getDoubleVector: - c_name: APersistableBundle_getDoubleVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: buffer - type: '*float64' - - name: bufferSizeBytes - type: int32 - returns: int32 - APersistableBundle_getDoubleVectorKeys: - c_name: APersistableBundle_getDoubleVectorKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getInt: - c_name: APersistableBundle_getInt - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: '*int32' - returns: bool - APersistableBundle_getIntKeys: - c_name: APersistableBundle_getIntKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getIntVector: - c_name: APersistableBundle_getIntVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: buffer - type: '*int32' - - name: bufferSizeBytes - type: int32 - returns: int32 - APersistableBundle_getIntVectorKeys: - c_name: APersistableBundle_getIntVectorKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getLong: - c_name: APersistableBundle_getLong - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: '*int64' - returns: bool - APersistableBundle_getLongKeys: - c_name: APersistableBundle_getLongKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getLongVector: - c_name: APersistableBundle_getLongVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: buffer - type: '*int64' - - name: bufferSizeBytes - type: int32 - returns: int32 - APersistableBundle_getLongVectorKeys: - c_name: APersistableBundle_getLongVectorKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getPersistableBundle: - c_name: APersistableBundle_getPersistableBundle - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: outBundle - type: '**APersistableBundle' - direction: out - returns: bool - APersistableBundle_getPersistableBundleKeys: - c_name: APersistableBundle_getPersistableBundleKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getString: - c_name: APersistableBundle_getString - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: '**int8' - c_type: char** - direction: out - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getStringKeys: - c_name: APersistableBundle_getStringKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getStringVector: - c_name: APersistableBundle_getStringVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: buffer - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_getStringVectorKeys: - c_name: APersistableBundle_getStringVectorKeys - params: - - name: pBundle - type: '*APersistableBundle' - - name: outKeys - type: '**int8' - c_type: char** - direction: out - - name: bufferSizeBytes - type: int32 - - name: stringAllocator - type: APersistableBundle_stringAllocator - - name: context - type: unsafe.Pointer - returns: int32 - APersistableBundle_isEqual: - c_name: APersistableBundle_isEqual - params: - - name: lhs - type: '*APersistableBundle' - - name: rhs - type: '*APersistableBundle' - returns: bool - APersistableBundle_new: - c_name: APersistableBundle_new - returns: '*APersistableBundle' - APersistableBundle_putBoolean: - c_name: APersistableBundle_putBoolean - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: bool - returns: "" - APersistableBundle_putBooleanVector: - c_name: APersistableBundle_putBooleanVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: vec - type: '*bool' - - name: num - type: int32 - returns: "" - APersistableBundle_putDouble: - c_name: APersistableBundle_putDouble - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: float64 - returns: "" - APersistableBundle_putDoubleVector: - c_name: APersistableBundle_putDoubleVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: vec - type: '*float64' - - name: num - type: int32 - returns: "" - APersistableBundle_putInt: - c_name: APersistableBundle_putInt - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: int32 - returns: "" - APersistableBundle_putIntVector: - c_name: APersistableBundle_putIntVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: vec - type: '*int32' - - name: num - type: int32 - returns: "" - APersistableBundle_putLong: - c_name: APersistableBundle_putLong - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: int64 - returns: "" - APersistableBundle_putLongVector: - c_name: APersistableBundle_putLongVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: vec - type: '*int64' - - name: num - type: int32 - returns: "" - APersistableBundle_putPersistableBundle: - c_name: APersistableBundle_putPersistableBundle - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: '*APersistableBundle' - returns: "" - APersistableBundle_putString: - c_name: APersistableBundle_putString - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: val - type: string - returns: "" - APersistableBundle_putStringVector: - c_name: APersistableBundle_putStringVector - params: - - name: pBundle - type: '*APersistableBundle' - - name: key - type: string - - name: vec - type: '**int8' - c_type: const char*const* - const: true - - name: num - type: int32 - returns: "" - APersistableBundle_readFromParcel: - c_name: APersistableBundle_readFromParcel - params: - - name: parcel - type: '*AParcel' - - name: outPBundle - type: '**APersistableBundle' - direction: out - returns: binder_status_t - APersistableBundle_size: - c_name: APersistableBundle_size - params: - - name: pBundle - type: '*APersistableBundle' - returns: int32 - APersistableBundle_writeToParcel: - c_name: APersistableBundle_writeToParcel - params: - - name: pBundle - type: '*APersistableBundle' - - name: parcel - type: '*AParcel' - returns: binder_status_t -callbacks: - APersistableBundle_stringAllocator: - params: - - name: sizeBytes - type: int32 - c_type: int32_t - - name: context - type: unsafe.Pointer - c_type: void* - returns: '*int8' - returns_c_type: char* diff --git a/spec/generated/sensor.yaml b/spec/generated/sensor.yaml deleted file mode 100644 index 6c530f4..0000000 --- a/spec/generated/sensor.yaml +++ /dev/null @@ -1,539 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: sensor -source_package: github.com/AndroidGoLab/ndk/capi/sensor -types: - AAdditionalInfoEvent: - kind: opaque_ptr - c_type: AAdditionalInfoEvent - go_type: '*C.AAdditionalInfoEvent' - ADynamicSensorEvent: - kind: opaque_ptr - c_type: ADynamicSensorEvent - go_type: '*C.ADynamicSensorEvent' - AHardwareBuffer: - kind: opaque_ptr - c_type: AHardwareBuffer - go_type: '*C.AHardwareBuffer' - AHeadTrackerEvent: - kind: opaque_ptr - c_type: AHeadTrackerEvent - go_type: '*C.AHeadTrackerEvent' - AHeadingEvent: - kind: opaque_ptr - c_type: AHeadingEvent - go_type: '*C.AHeadingEvent' - AHeartRateEvent: - kind: opaque_ptr - c_type: AHeartRateEvent - go_type: '*C.AHeartRateEvent' - ALimitedAxesImuEvent: - kind: opaque_ptr - c_type: ALimitedAxesImuEvent - go_type: '*C.ALimitedAxesImuEvent' - ALimitedAxesImuUncalibratedEvent: - kind: opaque_ptr - c_type: ALimitedAxesImuUncalibratedEvent - go_type: '*C.ALimitedAxesImuUncalibratedEvent' - AMetaDataEvent: - kind: opaque_ptr - c_type: AMetaDataEvent - go_type: '*C.AMetaDataEvent' - ASensor: - kind: opaque_ptr - c_type: ASensor - go_type: '*C.ASensor' - ASensorEvent: - kind: opaque_ptr - c_type: ASensorEvent - go_type: '*C.ASensorEvent' - ASensorEventQueue: - kind: opaque_ptr - c_type: ASensorEventQueue - go_type: '*C.ASensorEventQueue' - ASensorList: - kind: typedef_*ASensorRef - c_type: ASensorList - go_type: '*ASensorRef' - ASensorManager: - kind: opaque_ptr - c_type: ASensorManager - go_type: '*C.ASensorManager' - ASensorRef: - kind: typedef_*ASensor - c_type: ASensorRef - go_type: '*ASensor' - ASensorVector: - kind: opaque_ptr - c_type: ASensorVector - go_type: '*C.ASensorVector' - AUncalibratedEvent: - kind: opaque_ptr - c_type: AUncalibratedEvent - go_type: '*C.AUncalibratedEvent' -enums: - AREPORTING_MODE: - - name: AREPORTING_MODE_INVALID - value: -1 - - name: AREPORTING_MODE_CONTINUOUS - value: 0 - - name: AREPORTING_MODE_ON_CHANGE - value: 1 - - name: AREPORTING_MODE_ONE_SHOT - value: 2 - - name: AREPORTING_MODE_SPECIAL_TRIGGER - value: 3 - ASENSOR_ADDITIONAL_INFO: - - name: ASENSOR_ADDITIONAL_INFO_BEGIN - value: 0 - - name: ASENSOR_ADDITIONAL_INFO_END - value: 1 - - name: ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY - value: 65536 - - name: ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE - value: 65537 - - name: ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION - value: 65538 - - name: ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT - value: 65539 - - name: ASENSOR_ADDITIONAL_INFO_SAMPLING - value: 65540 - ASENSOR_DIRECT_CHANNEL_TYPE: - - name: ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY - value: 1 - - name: ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER - value: 2 - ASENSOR_DIRECT_RATE: - - name: ASENSOR_DIRECT_RATE_STOP - value: 0 - - name: ASENSOR_DIRECT_RATE_NORMAL - value: 1 - - name: ASENSOR_DIRECT_RATE_FAST - value: 2 - - name: ASENSOR_DIRECT_RATE_VERY_FAST - value: 3 - ASENSOR_STATUS: - - name: ASENSOR_STATUS_NO_CONTACT - value: -1 - - name: ASENSOR_STATUS_UNRELIABLE - value: 0 - - name: ASENSOR_STATUS_ACCURACY_LOW - value: 1 - - name: ASENSOR_STATUS_ACCURACY_MEDIUM - value: 2 - - name: ASENSOR_STATUS_ACCURACY_HIGH - value: 3 - ASENSOR_TYPE: - - name: ASENSOR_TYPE_INVALID - value: -1 - - name: ASENSOR_TYPE_ACCELEROMETER - value: 1 - - name: ASENSOR_TYPE_MAGNETIC_FIELD - value: 2 - - name: ASENSOR_TYPE_GYROSCOPE - value: 4 - - name: ASENSOR_TYPE_LIGHT - value: 5 - - name: ASENSOR_TYPE_PRESSURE - value: 6 - - name: ASENSOR_TYPE_PROXIMITY - value: 8 - - name: ASENSOR_TYPE_GRAVITY - value: 9 - - name: ASENSOR_TYPE_LINEAR_ACCELERATION - value: 10 - - name: ASENSOR_TYPE_ROTATION_VECTOR - value: 11 - - name: ASENSOR_TYPE_RELATIVE_HUMIDITY - value: 12 - - name: ASENSOR_TYPE_AMBIENT_TEMPERATURE - value: 13 - - name: ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED - value: 14 - - name: ASENSOR_TYPE_GAME_ROTATION_VECTOR - value: 15 - - name: ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED - value: 16 - - name: ASENSOR_TYPE_SIGNIFICANT_MOTION - value: 17 - - name: ASENSOR_TYPE_STEP_DETECTOR - value: 18 - - name: ASENSOR_TYPE_STEP_COUNTER - value: 19 - - name: ASENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR - value: 20 - - name: ASENSOR_TYPE_HEART_RATE - value: 21 - - name: ASENSOR_TYPE_POSE_6DOF - value: 28 - - name: ASENSOR_TYPE_STATIONARY_DETECT - value: 29 - - name: ASENSOR_TYPE_MOTION_DETECT - value: 30 - - name: ASENSOR_TYPE_HEART_BEAT - value: 31 - - name: ASENSOR_TYPE_DYNAMIC_SENSOR_META - value: 32 - - name: ASENSOR_TYPE_ADDITIONAL_INFO - value: 33 - - name: ASENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT - value: 34 - - name: ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED - value: 35 - - name: ASENSOR_TYPE_HINGE_ANGLE - value: 36 - - name: ASENSOR_TYPE_HEAD_TRACKER - value: 37 - - name: ASENSOR_TYPE_ACCELEROMETER_LIMITED_AXES - value: 38 - - name: ASENSOR_TYPE_GYROSCOPE_LIMITED_AXES - value: 39 - - name: ASENSOR_TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED - value: 40 - - name: ASENSOR_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED - value: 41 - - name: ASENSOR_TYPE_HEADING - value: 42 -functions: - ASensor_getFifoMaxEventCount: - c_name: ASensor_getFifoMaxEventCount - params: - - name: sensor - type: '*ASensor' - returns: int32 - ASensor_getFifoReservedEventCount: - c_name: ASensor_getFifoReservedEventCount - params: - - name: sensor - type: '*ASensor' - returns: int32 - ASensor_getHandle: - c_name: ASensor_getHandle - params: - - name: sensor - type: '*ASensor' - returns: int32 - ASensor_getHighestDirectReportRateLevel: - c_name: ASensor_getHighestDirectReportRateLevel - params: - - name: sensor - type: '*ASensor' - returns: int32 - ASensor_getMinDelay: - c_name: ASensor_getMinDelay - params: - - name: sensor - type: '*ASensor' - returns: int32 - ASensor_getName: - c_name: ASensor_getName - params: - - name: sensor - type: '*ASensor' - returns: string - ASensor_getReportingMode: - c_name: ASensor_getReportingMode - params: - - name: sensor - type: '*ASensor' - returns: int32 - ASensor_getResolution: - c_name: ASensor_getResolution - params: - - name: sensor - type: '*ASensor' - returns: float32 - ASensor_getStringType: - c_name: ASensor_getStringType - params: - - name: sensor - type: '*ASensor' - returns: string - ASensor_getType: - c_name: ASensor_getType - params: - - name: sensor - type: '*ASensor' - returns: int32 - ASensor_getVendor: - c_name: ASensor_getVendor - params: - - name: sensor - type: '*ASensor' - returns: string - ASensor_isDirectChannelTypeSupported: - c_name: ASensor_isDirectChannelTypeSupported - params: - - name: sensor - type: '*ASensor' - - name: channelType - type: int32 - returns: bool - ASensor_isWakeUpSensor: - c_name: ASensor_isWakeUpSensor - params: - - name: sensor - type: '*ASensor' - returns: bool - ASensorEventQueue_disableSensor: - c_name: ASensorEventQueue_disableSensor - params: - - name: queue - type: '*ASensorEventQueue' - - name: sensor - type: '*ASensor' - returns: int32 - ASensorEventQueue_enableSensor: - c_name: ASensorEventQueue_enableSensor - params: - - name: queue - type: '*ASensorEventQueue' - - name: sensor - type: '*ASensor' - returns: int32 - ASensorEventQueue_getEvents: - c_name: ASensorEventQueue_getEvents - params: - - name: queue - type: '*ASensorEventQueue' - - name: events - type: '*ASensorEvent' - - name: count - type: uint64 - returns: int64 - ASensorEventQueue_hasEvents: - c_name: ASensorEventQueue_hasEvents - params: - - name: queue - type: '*ASensorEventQueue' - returns: int32 - ASensorEventQueue_registerSensor: - c_name: ASensorEventQueue_registerSensor - params: - - name: queue - type: '*ASensorEventQueue' - - name: sensor - type: '*ASensor' - - name: samplingPeriodUs - type: int32 - - name: maxBatchReportLatencyUs - type: int64 - returns: int32 - ASensorEventQueue_requestAdditionalInfoEvents: - c_name: ASensorEventQueue_requestAdditionalInfoEvents - params: - - name: queue - type: '*ASensorEventQueue' - - name: enable - type: bool - returns: int32 - ASensorEventQueue_setEventRate: - c_name: ASensorEventQueue_setEventRate - params: - - name: queue - type: '*ASensorEventQueue' - - name: sensor - type: '*ASensor' - - name: usec - type: int32 - returns: int32 - ASensorManager_configureDirectReport: - c_name: ASensorManager_configureDirectReport - params: - - name: manager - type: '*ASensorManager' - - name: sensor - type: '*ASensor' - - name: channelId - type: int32 - - name: rate - type: int32 - returns: int32 - ASensorManager_createEventQueue: - c_name: ASensorManager_createEventQueue - params: - - name: manager - type: '*ASensorManager' - - name: looper - type: '*ALooper' - - name: ident - type: int32 - - name: callback - type: ALooper_callbackFunc - - name: data - type: unsafe.Pointer - returns: '*ASensorEventQueue' - ASensorManager_createHardwareBufferDirectChannel: - c_name: ASensorManager_createHardwareBufferDirectChannel - params: - - name: manager - type: '*ASensorManager' - - name: buffer - type: '*AHardwareBuffer' - - name: size - type: uint64 - returns: int32 - ASensorManager_createSharedMemoryDirectChannel: - c_name: ASensorManager_createSharedMemoryDirectChannel - params: - - name: manager - type: '*ASensorManager' - - name: fd - type: int32 - - name: size - type: uint64 - returns: int32 - ASensorManager_destroyDirectChannel: - c_name: ASensorManager_destroyDirectChannel - params: - - name: manager - type: '*ASensorManager' - - name: channelId - type: int32 - returns: "" - ASensorManager_destroyEventQueue: - c_name: ASensorManager_destroyEventQueue - params: - - name: manager - type: '*ASensorManager' - - name: queue - type: '*ASensorEventQueue' - returns: int32 - ASensorManager_getDefaultSensor: - c_name: ASensorManager_getDefaultSensor - params: - - name: manager - type: '*ASensorManager' - - name: type - type: int32 - returns: '*ASensor' - ASensorManager_getDefaultSensorEx: - c_name: ASensorManager_getDefaultSensorEx - params: - - name: manager - type: '*ASensorManager' - - name: type - type: int32 - - name: wakeUp - type: bool - returns: '*ASensor' - ASensorManager_getDynamicSensorList: - c_name: ASensorManager_getDynamicSensorList - params: - - name: manager - type: '*ASensorManager' - - name: list - type: '*ASensorList' - returns: int64 - ASensorManager_getInstance: - c_name: ASensorManager_getInstance - returns: '*ASensorManager' - ASensorManager_getInstanceForPackage: - c_name: ASensorManager_getInstanceForPackage - params: - - name: packageName - type: string - returns: '*ASensorManager' - ASensorManager_getSensorList: - c_name: ASensorManager_getSensorList - params: - - name: manager - type: '*ASensorManager' - - name: list - type: '*ASensorList' - returns: int32 -structs: - AAdditionalInfoEvent: - fields: - - name: type - type: int32 - - name: serial - type: int32 - - name: "" - type: union - ADynamicSensorEvent: - fields: - - name: connected - type: int32 - - name: handle - type: int32 - AHeadTrackerEvent: - fields: - - name: rx - type: float32 - - name: ry - type: float32 - - name: rz - type: float32 - - name: vx - type: float32 - - name: vy - type: float32 - - name: vz - type: float32 - - name: discontinuity_count - type: int32 - AHeadingEvent: - fields: - - name: heading - type: float32 - - name: accuracy - type: float32 - AHeartRateEvent: - fields: - - name: bpm - type: float32 - - name: status - type: int8 - ALimitedAxesImuEvent: - fields: - - name: "" - type: union - - name: "" - type: union - ALimitedAxesImuUncalibratedEvent: - fields: - - name: "" - type: union - - name: "" - type: union - - name: "" - type: union - AMetaDataEvent: - fields: - - name: what - type: int32 - - name: sensor - type: int32 - ASensorEvent: - fields: - - name: version - type: int32 - - name: sensor - type: int32 - - name: type - type: int32 - - name: reserved0 - type: int32 - - name: timestamp - type: int64 - - name: "" - type: union - - name: flags - type: uint32 - - name: reserved1 - type: '[3]int32' - ASensorVector: - fields: - - name: "" - type: union - - name: status - type: int8 - - name: reserved - type: '[3]uint8' - AUncalibratedEvent: - fields: - - name: "" - type: union - - name: "" - type: union diff --git a/spec/generated/sharedmem.yaml b/spec/generated/sharedmem.yaml deleted file mode 100644 index 04d65b1..0000000 --- a/spec/generated/sharedmem.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: sharedmem -source_package: github.com/AndroidGoLab/ndk/capi/sharedmem -functions: - ASharedMemory_create: - c_name: ASharedMemory_create - params: - - name: name - type: string - - name: size - type: uint64 - returns: int32 - ASharedMemory_getSize: - c_name: ASharedMemory_getSize - params: - - name: fd - type: int32 - returns: uint64 - ASharedMemory_setProt: - c_name: ASharedMemory_setProt - params: - - name: fd - type: int32 - - name: prot - type: int32 - returns: int32 diff --git a/spec/generated/storage.yaml b/spec/generated/storage.yaml deleted file mode 100644 index bed8d2f..0000000 --- a/spec/generated/storage.yaml +++ /dev/null @@ -1,96 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: storage -source_package: github.com/AndroidGoLab/ndk/capi/storage -types: - AStorageManager: - kind: opaque_ptr - c_type: AStorageManager - go_type: '*C.AStorageManager' -enums: - AOBB_STATE: - - name: AOBB_STATE_MOUNTED - value: 1 - - name: AOBB_STATE_UNMOUNTED - value: 2 - - name: AOBB_STATE_ERROR_INTERNAL - value: 20 - - name: AOBB_STATE_ERROR_COULD_NOT_MOUNT - value: 21 - - name: AOBB_STATE_ERROR_COULD_NOT_UNMOUNT - value: 22 - - name: AOBB_STATE_ERROR_NOT_MOUNTED - value: 23 - - name: AOBB_STATE_ERROR_ALREADY_MOUNTED - value: 24 - - name: AOBB_STATE_ERROR_PERMISSION_DENIED - value: 25 -functions: - AStorageManager_delete: - c_name: AStorageManager_delete - params: - - name: mgr - type: '*AStorageManager' - returns: "" - AStorageManager_getMountedObbPath: - c_name: AStorageManager_getMountedObbPath - params: - - name: mgr - type: '*AStorageManager' - - name: filename - type: string - returns: string - AStorageManager_isObbMounted: - c_name: AStorageManager_isObbMounted - params: - - name: mgr - type: '*AStorageManager' - - name: filename - type: string - returns: int32 - AStorageManager_mountObb: - c_name: AStorageManager_mountObb - params: - - name: mgr - type: '*AStorageManager' - - name: filename - type: string - - name: key - type: string - - name: cb - type: AStorageManager_obbCallbackFunc - - name: data - type: unsafe.Pointer - returns: "" - AStorageManager_new: - c_name: AStorageManager_new - returns: '*AStorageManager' - AStorageManager_unmountObb: - c_name: AStorageManager_unmountObb - params: - - name: mgr - type: '*AStorageManager' - - name: filename - type: string - - name: force - type: int32 - - name: cb - type: AStorageManager_obbCallbackFunc - - name: data - type: unsafe.Pointer - returns: "" -callbacks: - AStorageManager_obbCallbackFunc: - params: - - name: filename - type: string - c_type: const char* - const: true - - name: state - type: int32 - c_type: const int32_t - const: true - - name: data - type: unsafe.Pointer - c_type: void* - returns: "" diff --git a/spec/generated/surfacecontrol.yaml b/spec/generated/surfacecontrol.yaml deleted file mode 100644 index 25807b8..0000000 --- a/spec/generated/surfacecontrol.yaml +++ /dev/null @@ -1,378 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: surfacecontrol -source_package: github.com/AndroidGoLab/ndk/capi/surfacecontrol -types: - ASurfaceControl: - kind: opaque_ptr - c_type: ASurfaceControl - go_type: '*C.ASurfaceControl' - ASurfaceTransaction: - kind: opaque_ptr - c_type: ASurfaceTransaction - go_type: '*C.ASurfaceTransaction' - ASurfaceTransactionStats: - kind: opaque_ptr - c_type: ASurfaceTransactionStats - go_type: '*C.ASurfaceTransactionStats' -enums: - AHdrMetadataType: - - name: HDR10_SMPTE2086 - value: 1 - - name: HDR10_CTA861_3 - value: 2 - - name: HDR10PLUS_SEI - value: 3 - ASurfaceTransactionTransparency: - - name: ASURFACE_TRANSACTION_TRANSPARENCY_TRANSPARENT - value: 0 - - name: ASURFACE_TRANSACTION_TRANSPARENCY_TRANSLUCENT - value: 1 - - name: ASURFACE_TRANSACTION_TRANSPARENCY_OPAQUE - value: 2 - ASurfaceTransactionVisibility: - - name: ASURFACE_TRANSACTION_VISIBILITY_HIDE - value: 0 - - name: ASURFACE_TRANSACTION_VISIBILITY_SHOW - value: 1 -functions: - ASurfaceControl_acquire: - c_name: ASurfaceControl_acquire - params: - - name: surface_control - type: '*ASurfaceControl' - returns: "" - ASurfaceControl_create: - c_name: ASurfaceControl_create - params: - - name: parent - type: '*ASurfaceControl' - - name: debug_name - type: string - returns: '*ASurfaceControl' - ASurfaceControl_createFromWindow: - c_name: ASurfaceControl_createFromWindow - params: - - name: parent - type: '*ANativeWindow' - - name: debug_name - type: string - returns: '*ASurfaceControl' - ASurfaceControl_release: - c_name: ASurfaceControl_release - params: - - name: surface_control - type: '*ASurfaceControl' - returns: "" - ASurfaceTransaction_apply: - c_name: ASurfaceTransaction_apply - params: - - name: transaction - type: '*ASurfaceTransaction' - returns: "" - ASurfaceTransaction_clearFrameRate: - c_name: ASurfaceTransaction_clearFrameRate - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - returns: "" - ASurfaceTransaction_create: - c_name: ASurfaceTransaction_create - returns: '*ASurfaceTransaction' - ASurfaceTransaction_delete: - c_name: ASurfaceTransaction_delete - params: - - name: transaction - type: '*ASurfaceTransaction' - returns: "" - ASurfaceTransaction_reparent: - c_name: ASurfaceTransaction_reparent - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: new_parent - type: '*ASurfaceControl' - returns: "" - ASurfaceTransaction_setBuffer: - c_name: ASurfaceTransaction_setBuffer - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: buffer - type: '*AHardwareBuffer' - - name: acquire_fence_fd - type: int32 - returns: "" - ASurfaceTransaction_setBufferAlpha: - c_name: ASurfaceTransaction_setBufferAlpha - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: alpha - type: float32 - returns: "" - ASurfaceTransaction_setBufferTransform: - c_name: ASurfaceTransaction_setBufferTransform - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: transform - type: int32 - returns: "" - ASurfaceTransaction_setCrop: - c_name: ASurfaceTransaction_setCrop - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: crop - type: '*ARect' - returns: "" - ASurfaceTransaction_setDamageRegion: - c_name: ASurfaceTransaction_setDamageRegion - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: rects - type: '*ARect' - - name: count - type: uint32 - returns: "" - ASurfaceTransaction_setDesiredHdrHeadroom: - c_name: ASurfaceTransaction_setDesiredHdrHeadroom - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: desiredHeadroom - type: float32 - returns: "" - ASurfaceTransaction_setDesiredPresentTime: - c_name: ASurfaceTransaction_setDesiredPresentTime - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: desiredPresentTime - type: int64 - returns: "" - ASurfaceTransaction_setEnableBackPressure: - c_name: ASurfaceTransaction_setEnableBackPressure - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: enableBackPressure - type: bool - returns: "" - ASurfaceTransaction_setExtendedRangeBrightness: - c_name: ASurfaceTransaction_setExtendedRangeBrightness - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: currentBufferRatio - type: float32 - - name: desiredRatio - type: float32 - returns: "" - ASurfaceTransaction_setFrameRate: - c_name: ASurfaceTransaction_setFrameRate - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: frameRate - type: float32 - - name: compatibility - type: int8 - returns: "" - ASurfaceTransaction_setFrameRateWithChangeStrategy: - c_name: ASurfaceTransaction_setFrameRateWithChangeStrategy - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: frameRate - type: float32 - - name: compatibility - type: int8 - - name: changeFrameRateStrategy - type: int8 - returns: "" - ASurfaceTransaction_setFrameTimeline: - c_name: ASurfaceTransaction_setFrameTimeline - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: vsyncId - type: AVsyncId - returns: "" - ASurfaceTransaction_setGeometry: - c_name: ASurfaceTransaction_setGeometry - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: source - type: '*ARect' - - name: destination - type: '*ARect' - - name: transform - type: int32 - returns: "" - ASurfaceTransaction_setOnCommit: - c_name: ASurfaceTransaction_setOnCommit - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: context - type: unsafe.Pointer - - name: func - type: ASurfaceTransaction_OnCommit - returns: "" - ASurfaceTransaction_setOnComplete: - c_name: ASurfaceTransaction_setOnComplete - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: context - type: unsafe.Pointer - - name: func - type: ASurfaceTransaction_OnComplete - returns: "" - ASurfaceTransaction_setPosition: - c_name: ASurfaceTransaction_setPosition - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: x - type: int32 - - name: "y" - type: int32 - returns: "" - ASurfaceTransaction_setScale: - c_name: ASurfaceTransaction_setScale - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: xScale - type: float32 - - name: yScale - type: float32 - returns: "" - ASurfaceTransaction_setZOrder: - c_name: ASurfaceTransaction_setZOrder - params: - - name: transaction - type: '*ASurfaceTransaction' - - name: surface_control - type: '*ASurfaceControl' - - name: z_order - type: int32 - returns: "" - ASurfaceTransactionStats_getAcquireTime: - c_name: ASurfaceTransactionStats_getAcquireTime - params: - - name: surface_transaction_stats - type: '*ASurfaceTransactionStats' - - name: surface_control - type: '*ASurfaceControl' - returns: int64 - ASurfaceTransactionStats_getLatchTime: - c_name: ASurfaceTransactionStats_getLatchTime - params: - - name: surface_transaction_stats - type: '*ASurfaceTransactionStats' - returns: int64 - ASurfaceTransactionStats_getPresentFenceFd: - c_name: ASurfaceTransactionStats_getPresentFenceFd - params: - - name: surface_transaction_stats - type: '*ASurfaceTransactionStats' - returns: int32 - ASurfaceTransactionStats_getPreviousReleaseFenceFd: - c_name: ASurfaceTransactionStats_getPreviousReleaseFenceFd - params: - - name: surface_transaction_stats - type: '*ASurfaceTransactionStats' - - name: surface_control - type: '*ASurfaceControl' - returns: int32 -callbacks: - ASurfaceTransaction_OnBufferRelease: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: release_fence_fd - type: int32 - c_type: int - returns: "" - ASurfaceTransaction_OnCommit: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: stats - type: '*ASurfaceTransactionStats' - c_type: ASurfaceTransactionStats* - returns: "" - ASurfaceTransaction_OnComplete: - params: - - name: context - type: unsafe.Pointer - c_type: void* - - name: stats - type: '*ASurfaceTransactionStats' - c_type: ASurfaceTransactionStats* - returns: "" -structs: - AColor_xy: - fields: - - name: x - type: float32 - - name: "y" - type: float32 - AHdrMetadata_cta861_3: - fields: - - name: maxContentLightLevel - type: float32 - - name: maxFrameAverageLightLevel - type: float32 - AHdrMetadata_smpte2086: - fields: - - name: displayPrimaryRed - type: AColor_xy - - name: displayPrimaryGreen - type: AColor_xy - - name: displayPrimaryBlue - type: AColor_xy - - name: whitePoint - type: AColor_xy - - name: maxLuminance - type: float32 - - name: minLuminance - type: float32 diff --git a/spec/generated/surfacetexture.yaml b/spec/generated/surfacetexture.yaml deleted file mode 100644 index 0d36c3e..0000000 --- a/spec/generated/surfacetexture.yaml +++ /dev/null @@ -1,56 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: surfacetexture -source_package: github.com/AndroidGoLab/ndk/capi/surfacetexture -types: - ASurfaceTexture: - kind: opaque_ptr - c_type: ASurfaceTexture - go_type: '*C.ASurfaceTexture' -functions: - ASurfaceTexture_acquireANativeWindow: - c_name: ASurfaceTexture_acquireANativeWindow - params: - - name: st - type: '*ASurfaceTexture' - returns: '*ANativeWindow' - ASurfaceTexture_attachToGLContext: - c_name: ASurfaceTexture_attachToGLContext - params: - - name: st - type: '*ASurfaceTexture' - - name: texName - type: uint32 - returns: int32 - ASurfaceTexture_detachFromGLContext: - c_name: ASurfaceTexture_detachFromGLContext - params: - - name: st - type: '*ASurfaceTexture' - returns: int32 - ASurfaceTexture_getTimestamp: - c_name: ASurfaceTexture_getTimestamp - params: - - name: st - type: '*ASurfaceTexture' - returns: int64 - ASurfaceTexture_getTransformMatrix: - c_name: ASurfaceTexture_getTransformMatrix - params: - - name: st - type: '*ASurfaceTexture' - - name: mtx - type: '[16]float32' - returns: "" - ASurfaceTexture_release: - c_name: ASurfaceTexture_release - params: - - name: st - type: '*ASurfaceTexture' - returns: "" - ASurfaceTexture_updateTexImage: - c_name: ASurfaceTexture_updateTexImage - params: - - name: st - type: '*ASurfaceTexture' - returns: int32 diff --git a/spec/generated/sync.yaml b/spec/generated/sync.yaml deleted file mode 100644 index 4c92eb5..0000000 --- a/spec/generated/sync.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: sync -source_package: github.com/AndroidGoLab/ndk/capi/sync -functions: - sync_file_info: - c_name: sync_file_info - params: - - name: fd - type: int32 - returns: '*sync_file_info' - sync_file_info_free: - c_name: sync_file_info_free - params: - - name: info - type: '*sync_file_info' - returns: "" - sync_merge: - c_name: sync_merge - params: - - name: name - type: string - - name: fd1 - type: int32 - - name: fd2 - type: int32 - returns: int32 diff --git a/spec/generated/thermal.yaml b/spec/generated/thermal.yaml deleted file mode 100644 index 4e9c017..0000000 --- a/spec/generated/thermal.yaml +++ /dev/null @@ -1,107 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: thermal -source_package: github.com/AndroidGoLab/ndk/capi/thermal -types: - AThermalHeadroomThreshold: - kind: opaque_ptr - c_type: AThermalHeadroomThreshold - go_type: '*C.AThermalHeadroomThreshold' - AThermalManager: - kind: opaque_ptr - c_type: AThermalManager - go_type: '*C.AThermalManager' - AThermalStatus: - kind: typedef_int32 - c_type: AThermalStatus - go_type: int32 -enums: - AThermalStatus: - - name: ATHERMAL_STATUS_ERROR - value: -1 - - name: ATHERMAL_STATUS_NONE - value: 0 - - name: ATHERMAL_STATUS_LIGHT - value: 1 - - name: ATHERMAL_STATUS_MODERATE - value: 2 - - name: ATHERMAL_STATUS_SEVERE - value: 3 - - name: ATHERMAL_STATUS_CRITICAL - value: 4 - - name: ATHERMAL_STATUS_EMERGENCY - value: 5 - - name: ATHERMAL_STATUS_SHUTDOWN - value: 6 -functions: - AThermal_acquireManager: - c_name: AThermal_acquireManager - returns: '*AThermalManager' - AThermal_getCurrentThermalStatus: - c_name: AThermal_getCurrentThermalStatus - params: - - name: manager - type: '*AThermalManager' - returns: AThermalStatus - AThermal_getThermalHeadroom: - c_name: AThermal_getThermalHeadroom - params: - - name: manager - type: '*AThermalManager' - - name: forecastSeconds - type: int32 - returns: float32 - AThermal_getThermalHeadroomThresholds: - c_name: AThermal_getThermalHeadroomThresholds - params: - - name: manager - type: '*AThermalManager' - - name: outThresholds - type: '**AThermalHeadroomThreshold' - direction: out - - name: size - type: '*uint64' - returns: int32 - AThermal_registerThermalStatusListener: - c_name: AThermal_registerThermalStatusListener - params: - - name: manager - type: '*AThermalManager' - - name: callback - type: AThermal_StatusCallback - - name: data - type: unsafe.Pointer - returns: int32 - AThermal_releaseManager: - c_name: AThermal_releaseManager - params: - - name: manager - type: '*AThermalManager' - returns: "" - AThermal_unregisterThermalStatusListener: - c_name: AThermal_unregisterThermalStatusListener - params: - - name: manager - type: '*AThermalManager' - - name: callback - type: AThermal_StatusCallback - - name: data - type: unsafe.Pointer - returns: int32 -callbacks: - AThermal_StatusCallback: - params: - - name: data - type: unsafe.Pointer - c_type: void* - - name: status - type: AThermalStatus - c_type: AThermalStatus - returns: "" -structs: - AThermalHeadroomThreshold: - fields: - - name: headroom - type: float32 - - name: thermalStatus - type: AThermalStatus diff --git a/spec/generated/trace.yaml b/spec/generated/trace.yaml deleted file mode 100644 index 024a033..0000000 --- a/spec/generated/trace.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: trace -source_package: github.com/AndroidGoLab/ndk/capi/trace -functions: - ATrace_beginAsyncSection: - c_name: ATrace_beginAsyncSection - params: - - name: sectionName - type: string - - name: cookie - type: int32 - returns: "" - ATrace_beginSection: - c_name: ATrace_beginSection - params: - - name: sectionName - type: string - returns: "" - ATrace_endAsyncSection: - c_name: ATrace_endAsyncSection - params: - - name: sectionName - type: string - - name: cookie - type: int32 - returns: "" - ATrace_endSection: - c_name: ATrace_endSection - returns: "" - ATrace_isEnabled: - c_name: ATrace_isEnabled - returns: bool - ATrace_setCounter: - c_name: ATrace_setCounter - params: - - name: counterName - type: string - - name: counterValue - type: int64 - returns: "" diff --git a/spec/generated/vulkan.yaml b/spec/generated/vulkan.yaml deleted file mode 100644 index 03d66e9..0000000 --- a/spec/generated/vulkan.yaml +++ /dev/null @@ -1,6 +0,0 @@ -# Code generated by specgen. DO NOT EDIT. - -module: vulkan -source_package: github.com/AndroidGoLab/ndk/capi/vulkan -macros: - VULKAN_H_: 1 diff --git a/spec/overlays/.gitkeep b/spec/overlays/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/overlays/aaudio.yaml b/spec/overlays/aaudio.yaml deleted file mode 100644 index fdc504c..0000000 --- a/spec/overlays/aaudio.yaml +++ /dev/null @@ -1,197 +0,0 @@ -module: aaudio - -package: - go_name: audio - go_import: github.com/AndroidGoLab/ndk/audio - doc: "Package audio provides Go bindings for Android AAudio." - -types: - aaudio_result_t: - go_error: true - success_value: AAUDIO_OK - error_prefix: "audio" - strip_prefix: AAUDIO_ERROR_ - - aaudio_data_callback_result_t: - go_name: DataCallbackResult - enum_source: AAUDIO_CALLBACK_RESULT - strip_prefix: AAUDIO_CALLBACK_RESULT_ - - AAudioStreamBuilder: - go_name: StreamBuilder - constructor: AAudio_createStreamBuilder - destructor: AAudioStreamBuilder_delete - pattern: builder - - AAudioStream: - go_name: Stream - destructor: AAudioStream_close - interfaces: - - io.Closer - - aaudio_direction_t: - go_name: Direction - enum_source: AAUDIO_DIRECTION - strip_prefix: AAUDIO_DIRECTION_ - string_method: true - - aaudio_format_t: - go_name: Format - enum_source: AAUDIO_FORMAT - strip_prefix: AAUDIO_FORMAT_ - - aaudio_sharing_mode_t: - go_name: SharingMode - enum_source: AAUDIO_SHARING_MODE - strip_prefix: AAUDIO_SHARING_MODE_ - - aaudio_performance_mode_t: - go_name: PerformanceMode - enum_source: AAUDIO_PERFORMANCE_MODE - strip_prefix: AAUDIO_PERFORMANCE_MODE_ - - aaudio_stream_state_t: - go_name: StreamState - enum_source: AAUDIO_STREAM_STATE - strip_prefix: AAUDIO_STREAM_STATE_ - string_method: true - -functions: - # Builder setters — all get method chaining - AAudioStreamBuilder_setDeviceId: - receiver: StreamBuilder - go_name: SetDeviceID - chain: true - AAudioStreamBuilder_setDirection: - receiver: StreamBuilder - go_name: SetDirection - chain: true - AAudioStreamBuilder_setSharingMode: - receiver: StreamBuilder - chain: true - AAudioStreamBuilder_setPerformanceMode: - receiver: StreamBuilder - chain: true - AAudioStreamBuilder_setSampleRate: - receiver: StreamBuilder - chain: true - AAudioStreamBuilder_setChannelCount: - receiver: StreamBuilder - chain: true - AAudioStreamBuilder_setFormat: - receiver: StreamBuilder - chain: true - AAudioStreamBuilder_setBufferCapacityInFrames: - receiver: StreamBuilder - chain: true - - # Builder open - AAudioStreamBuilder_openStream: - receiver: StreamBuilder - go_name: Open - returns_new: Stream - - # Callback (requires CGo trampoline — skipped for now) - AAudioStreamBuilder_setDataCallback: - skip: true - - # Stream getters - AAudioStream_getState: - receiver: Stream - go_name: State - pure: true - AAudioStream_getFramesPerBurst: - receiver: Stream - go_name: FramesPerBurst - pure: true - AAudioStream_getSampleRate: - receiver: Stream - go_name: SampleRate - pure: true - AAudioStream_getChannelCount: - receiver: Stream - go_name: ChannelCount - pure: true - AAudioStream_getXRunCount: - receiver: Stream - go_name: XRunCount - pure: true - - # Stream control - AAudioStream_requestStart: - receiver: Stream - go_name: Start - AAudioStream_requestPause: - receiver: Stream - go_name: Pause - AAudioStream_requestStop: - receiver: Stream - go_name: Stop - AAudioStream_requestFlush: - receiver: Stream - go_name: Flush - - # Stream I/O - AAudioStream_write: - receiver: Stream - go_name: Write - buf_param: buffer - buf_frames_param: numFrames - timeout_param: timeoutNanoseconds - returns_frames: true - buf_go_type: "[]byte" - AAudioStream_read: - receiver: Stream - go_name: Read - buf_param: buffer - buf_frames_param: numFrames - timeout_param: timeoutNanoseconds - returns_frames: true - buf_go_type: "[]byte" - -extra_enums: - aaudio_result_t: - - name: AAUDIO_OK - value: 0 - - name: AAUDIO_ERROR_BASE - value: -900 - - name: AAUDIO_ERROR_DISCONNECTED - value: -899 - - name: AAUDIO_ERROR_ILLEGAL_ARGUMENT - value: -898 - - name: AAUDIO_ERROR_INTERNAL - value: -896 - - name: AAUDIO_ERROR_INVALID_STATE - value: -895 - - name: AAUDIO_ERROR_INVALID_HANDLE - value: -892 - - name: AAUDIO_ERROR_UNIMPLEMENTED - value: -890 - - name: AAUDIO_ERROR_UNAVAILABLE - value: -889 - - name: AAUDIO_ERROR_NO_FREE_HANDLES - value: -888 - - name: AAUDIO_ERROR_NO_MEMORY - value: -887 - - name: AAUDIO_ERROR_NULL - value: -886 - - name: AAUDIO_ERROR_TIMEOUT - value: -885 - - name: AAUDIO_ERROR_WOULD_BLOCK - value: -884 - - name: AAUDIO_ERROR_INVALID_FORMAT - value: -883 - - name: AAUDIO_ERROR_OUT_OF_RANGE - value: -882 - - name: AAUDIO_ERROR_NO_SERVICE - value: -881 - - name: AAUDIO_ERROR_INVALID_RATE - value: -880 - -api_levels: - AAudioStream_release: 30 - AAudioStream_getChannelMask: 32 - AAudioStream_getSpatializationBehavior: 32 - AAudioStream_getHardwareChannelCount: 34 - AAudioStream_getHardwareSampleRate: 34 - AAudioStream_getHardwareFormat: 34 diff --git a/spec/overlays/asset.yaml b/spec/overlays/asset.yaml deleted file mode 100644 index 15fee18..0000000 --- a/spec/overlays/asset.yaml +++ /dev/null @@ -1,91 +0,0 @@ -module: asset - -package: - go_name: asset - go_import: github.com/AndroidGoLab/ndk/asset - doc: "Package asset provides Go bindings for Android Asset Manager." - -types: - AAssetManager: - go_name: Manager - - AAssetDir: - go_name: Dir - destructor: AAssetDir_close - - AAsset: - go_name: Asset - destructor: AAsset_close - interfaces: - - io.ReadSeeker - - io.Closer - - AASSET_MODE: - go_name: Mode - strip_prefix: AASSET_MODE_ - -functions: - AAssetManager_openDir: - receiver: Manager - go_name: OpenDir - returns_new: Dir - - AAssetManager_open: - receiver: Manager - go_name: Open - returns_new: Asset - - AAssetDir_getNextFileName: - receiver: Dir - go_name: NextFileName - pure: true - - AAssetDir_rewind: - receiver: Dir - go_name: Rewind - - AAssetDir_close: - skip: true - - AAsset_read: - receiver: Asset - go_name: Read - buf_param: buf - - AAsset_seek: - receiver: Asset - go_name: Seek - pure: true - - AAsset_close: - skip: true - - AAsset_getBuffer: - receiver: Asset - go_name: Buffer - pure: true - - AAsset_getLength: - receiver: Asset - go_name: Length - pure: true - - AAsset_getLength64: - receiver: Asset - go_name: Length64 - pure: true - - AAsset_getRemainingLength: - receiver: Asset - go_name: RemainingLength - pure: true - - AAsset_getRemainingLength64: - receiver: Asset - go_name: RemainingLength64 - pure: true - - AAsset_isAllocated: - receiver: Asset - go_name: IsAllocated - pure: true diff --git a/spec/overlays/binder.yaml b/spec/overlays/binder.yaml deleted file mode 100644 index eecbed0..0000000 --- a/spec/overlays/binder.yaml +++ /dev/null @@ -1,40 +0,0 @@ -module: binder - -package: - go_name: binder - go_import: github.com/AndroidGoLab/ndk/binder - doc: "Package binder provides Go bindings for Android Binder IPC." - -types: - binder_status_t: - go_error: true - success_value: STATUS_OK - error_prefix: "binder" - strip_prefix: STATUS_ - enum_source: STATUS - - binder_exception_t: - go_name: ExceptionCode - strip_prefix: EX_ - enum_source: EX - - binder_flags_t: - go_name: Flags - strip_prefix: FLAG_ - enum_source: FLAG - - AIBinder: - go_name: Binder - destructor: AIBinder_decStrong - pattern: ref_counted - - AIBinder_Class: - go_name: Class - - AParcel: - go_name: Parcel - destructor: AParcel_delete - - AStatus: - go_name: Status - destructor: AStatus_delete diff --git a/spec/overlays/bitmap.yaml b/spec/overlays/bitmap.yaml deleted file mode 100644 index ca75289..0000000 --- a/spec/overlays/bitmap.yaml +++ /dev/null @@ -1,27 +0,0 @@ -module: bitmap - -package: - go_name: bitmap - go_import: github.com/AndroidGoLab/ndk/bitmap - doc: "Package bitmap provides Go bindings for Android Bitmap (jnigraphics)." - -types: - ANDROID_BITMAP_RESULT: - go_error: true - success_value: ANDROID_BITMAP_RESULT_SUCCESS - error_prefix: "bitmap" - strip_prefix: ANDROID_BITMAP_RESULT_ - - AndroidBitmapFormat: - go_name: Format - strip_prefix: ANDROID_BITMAP_FORMAT_ - -functions: - AndroidBitmap_getInfo: - go_name: GetInfo - - AndroidBitmap_lockPixels: - go_name: LockPixels - - AndroidBitmap_unlockPixels: - go_name: UnlockPixels diff --git a/spec/overlays/camera.yaml b/spec/overlays/camera.yaml deleted file mode 100644 index a0e912c..0000000 --- a/spec/overlays/camera.yaml +++ /dev/null @@ -1,237 +0,0 @@ -module: camera - -package: - go_name: camera - go_import: github.com/AndroidGoLab/ndk/camera - doc: "Package camera provides Go bindings for Android Camera2 NDK." - -types: - camera_status_t: - go_error: true - success_value: ACAMERA_OK - error_prefix: "camera" - strip_prefix: ACAMERA_ERROR_ - - ACameraManager: - go_name: Manager - constructor: ACameraManager_create - destructor: ACameraManager_delete - - ACameraDevice: - go_name: Device - destructor: ACameraDevice_close - - ACameraCaptureSession: - go_name: CaptureSession - destructor: ACameraCaptureSession_close - - ACaptureRequest: - go_name: CaptureRequest - destructor: ACaptureRequest_free - - ACameraOutputTarget: - go_name: OutputTarget - constructor: ACameraOutputTarget_create - destructor: ACameraOutputTarget_free - - ACaptureSessionOutputContainer: - go_name: SessionOutputContainer - constructor: ACaptureSessionOutputContainer_create - destructor: ACaptureSessionOutputContainer_free - - ACaptureSessionOutput: - go_name: SessionOutput - constructor: ACaptureSessionOutput_create - destructor: ACaptureSessionOutput_free - - ACameraMetadata: - go_name: Metadata - destructor: ACameraMetadata_free - - ACameraDevice_request_template: - go_name: TemplateType - strip_prefix: TEMPLATE_ - - MetadataTag: - go_name: MetadataTag - strip_prefix: ACAMERA_ - -callback_structs: - ACameraDevice_StateCallbacks: - go_name: DeviceStateCallbacks - context_field: context - fields: - onDisconnected: - go_name: OnDisconnected - go_signature: "func()" - callback_type: ACameraDevice_StateCallback - onError: - go_name: OnError - go_signature: "func(int)" - go_param_count: 1 - callback_type: ACameraDevice_ErrorStateCallback - - ACameraCaptureSession_stateCallbacks: - go_name: SessionStateCallbacks - context_field: context - fields: - onClosed: - go_name: OnClosed - go_signature: "func()" - callback_type: ACameraCaptureSession_stateCallback - onReady: - go_name: OnReady - go_signature: "func()" - callback_type: ACameraCaptureSession_stateCallback - onActive: - go_name: OnActive - go_signature: "func()" - callback_type: ACameraCaptureSession_stateCallback - -struct_accessors: - ACameraIdList: - count_field: numCameras - items_field: cameraIds - item_type: string - delete_func: ACameraManager_deleteCameraIdList - -extra_enums: - camera_status_t: - - name: ACAMERA_OK - value: 0 - - name: ACAMERA_ERROR_UNKNOWN - value: -10000 - - name: ACAMERA_ERROR_INVALID_PARAMETER - value: -10001 - - name: ACAMERA_ERROR_CAMERA_DISCONNECTED - value: -10002 - - name: ACAMERA_ERROR_NOT_ENOUGH_MEMORY - value: -10003 - - name: ACAMERA_ERROR_METADATA_NOT_FOUND - value: -10004 - - name: ACAMERA_ERROR_CAMERA_DEVICE - value: -10005 - - name: ACAMERA_ERROR_CAMERA_SERVICE - value: -10006 - - name: ACAMERA_ERROR_SESSION_CLOSED - value: -10007 - - name: ACAMERA_ERROR_INVALID_OPERATION - value: -10008 - - name: ACAMERA_ERROR_STREAM_CONFIGURE_FAIL - value: -10009 - - name: ACAMERA_ERROR_CAMERA_IN_USE - value: -10010 - - name: ACAMERA_ERROR_MAX_CAMERAS_IN_USE - value: -10011 - - name: ACAMERA_ERROR_CAMERA_DISABLED - value: -10012 - - name: ACAMERA_ERROR_PERMISSION_DENIED - value: -10013 - - name: ACAMERA_ERROR_UNSUPPORTED_OPERATION - value: -10014 - MetadataTag: - - name: ACAMERA_SENSOR_ORIENTATION - value: 917518 - - name: ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS - value: 851978 - -functions: - # Manager functions - ACameraManager_getCameraCharacteristics: - receiver: Manager - go_name: GetCameraCharacteristics - returns_new: Metadata - - ACameraManager_getCameraIdList: - receiver: Manager - go_name: CameraIDList - returns_list_struct: ACameraIdList - - ACameraManager_deleteCameraIdList: - skip: true - - ACameraManager_openCamera: - receiver: Manager - go_name: OpenCamera - callback_param: callback - returns_new: Device - - # Device functions - ACameraDevice_createCaptureRequest: - receiver: Device - returns_new: CaptureRequest - - ACameraDevice_createCaptureSession: - receiver: Device - go_name: CreateCaptureSession - callback_param: callbacks - returns_new: CaptureSession - - # CaptureRequest functions - ACaptureRequest_addTarget: - receiver: CaptureRequest - chain: true - - ACaptureRequest_removeTarget: - receiver: CaptureRequest - - # OutputTarget functions - ACameraOutputTarget_create: - skip: true # handled as constructor on OutputTarget type - - ACameraOutputTarget_free: - skip: true - - # SessionOutputContainer functions - ACaptureSessionOutputContainer_create: - skip: true # handled as constructor on SessionOutputContainer type - - ACaptureSessionOutputContainer_free: - skip: true - - ACaptureSessionOutputContainer_add: - receiver: SessionOutputContainer - go_name: Add - - ACaptureSessionOutputContainer_remove: - receiver: SessionOutputContainer - go_name: Remove - - # SessionOutput functions - ACaptureSessionOutput_create: - skip: true # handled as constructor on SessionOutput type - - ACaptureSessionOutput_free: - skip: true - - # CaptureSession functions - ACameraCaptureSession_setRepeatingRequest: - receiver: CaptureSession - go_name: SetRepeatingRequest - custom_call: - params: - - name: req - go_type: "*CaptureRequest" - args: "nil, 1, &req.ptr, nil" - - ACameraCaptureSession_stopRepeating: - receiver: CaptureSession - - ACameraCaptureSession_capture: - skip: true - -api_levels: - ACameraDevice_createCaptureSessionWithSessionParameters: 28 - ACameraDevice_isSessionConfigurationSupported: 29 - ACameraCaptureSession_updateSharedOutput: 28 - ACameraCaptureSession_logicalCamera_capture: 29 - ACameraCaptureSession_logicalCamera_setRepeatingRequest: 29 - ACaptureSessionSharedOutput_create: 28 - ACaptureSessionSharedOutput_add: 28 - ACaptureSessionSharedOutput_remove: 28 - ACaptureSessionPhysicalOutput_create: 29 - ACameraManager_registerExtendedAvailabilityCallback: 29 - ACameraManager_unregisterExtendedAvailabilityCallback: 29 - ACameraMetadata_isLogicalMultiCamera: 29 - ACameraMetadata_getPhysicalCameraIds: 29 - ACameraMetadata_getTagFromName: 35 diff --git a/spec/overlays/choreographer.yaml b/spec/overlays/choreographer.yaml deleted file mode 100644 index eb97a4c..0000000 --- a/spec/overlays/choreographer.yaml +++ /dev/null @@ -1,29 +0,0 @@ -module: choreographer - -package: - go_name: choreographer - go_import: github.com/AndroidGoLab/ndk/choreographer - doc: "Package choreographer provides Go bindings for Android AChoreographer." - -types: - AChoreographer: - go_name: Choreographer - pattern: singleton - -functions: - AChoreographer_getInstance: - go_name: GetInstance - returns_new: Choreographer - - # Callback functions require CGo trampoline — skipped for now - AChoreographer_postFrameCallback: - skip: true - AChoreographer_postFrameCallbackDelayed: - skip: true - AChoreographer_postFrameCallback64: - skip: true - AChoreographer_postFrameCallbackDelayed64: - skip: true - -api_levels: - AChoreographer_getInstance: 24 diff --git a/spec/overlays/configuration.yaml b/spec/overlays/configuration.yaml deleted file mode 100644 index c9d5adf..0000000 --- a/spec/overlays/configuration.yaml +++ /dev/null @@ -1,95 +0,0 @@ -module: configuration - -package: - go_name: config - go_import: github.com/AndroidGoLab/ndk/config - doc: "Package config provides Go bindings for Android AConfiguration." - -types: - AConfiguration: - go_name: Config - constructor: AConfiguration_new - destructor: AConfiguration_delete - - Configuration_orientation: - go_name: Orientation - strip_prefix: ACONFIGURATION_ - - Configuration_screenSize: - go_name: ScreenSize - strip_prefix: ACONFIGURATION_ - -functions: - AConfiguration_new: - skip: true - - AConfiguration_delete: - skip: true - - AConfiguration_fromAssetManager: - skip: true - - AConfiguration_getLanguage: - receiver: Config - go_name: Language - - AConfiguration_getCountry: - receiver: Config - go_name: Country - - AConfiguration_getOrientation: - receiver: Config - go_name: Orientation - pure: true - - AConfiguration_getDensity: - receiver: Config - go_name: Density - pure: true - - AConfiguration_getScreenSize: - receiver: Config - go_name: ScreenSize - pure: true - - AConfiguration_getScreenWidthDp: - receiver: Config - go_name: ScreenWidthDp - pure: true - - AConfiguration_getScreenHeightDp: - receiver: Config - go_name: ScreenHeightDp - pure: true - - AConfiguration_getSdkVersion: - receiver: Config - go_name: SdkVersion - pure: true - - # AConfiguration_setScreenRound is in the spec but not in the capi package - # (missing from the C headers on this NDK version). - AConfiguration_setScreenRound: - skip: true - -extra_enums: - Configuration_orientation: - - name: ACONFIGURATION_ORIENTATION_ANY - value: 0 - - name: ACONFIGURATION_ORIENTATION_PORT - value: 1 - - name: ACONFIGURATION_ORIENTATION_LAND - value: 2 - - name: ACONFIGURATION_ORIENTATION_SQUARE - value: 3 - Configuration_screenSize: - - name: ACONFIGURATION_SCREENSIZE_ANY - value: 0 - - name: ACONFIGURATION_SCREENSIZE_SMALL - value: 1 - - name: ACONFIGURATION_SCREENSIZE_NORMAL - value: 2 - - name: ACONFIGURATION_SCREENSIZE_LARGE - value: 3 - - name: ACONFIGURATION_SCREENSIZE_XLARGE - value: 4 diff --git a/spec/overlays/egl.yaml b/spec/overlays/egl.yaml deleted file mode 100644 index 1d6ad09..0000000 --- a/spec/overlays/egl.yaml +++ /dev/null @@ -1,155 +0,0 @@ -module: egl - -package: - go_name: egl - go_import: github.com/AndroidGoLab/ndk/egl - doc: "Package egl provides Go bindings for EGL." - -types: - EGLint: - go_name: Int - strip_prefix: EGL_ - - EGLBoolean: - go_name: Boolean - strip_prefix: EGL_ - - EGLDisplay: - go_name: EGLDisplay - transparent: true - - EGLConfig: - go_name: EGLConfig - transparent: true - - EGLContext: - go_name: EGLContext - transparent: true - - EGLSurface: - go_name: EGLSurface - transparent: true - - EGLNativeWindowType: - go_name: EGLNativeWindowType - transparent: true - - EGLNativeDisplayType: - go_name: EGLNativeDisplayType - transparent: true - - EGLImage: - go_name: EGLImage - transparent: true - - EGLClientBuffer: - go_name: EGLClientBuffer - transparent: true - - EGLSync: - go_name: EGLSync - transparent: true - - ANativeWindow: - go_name: ANativeWindow - -functions: - ANativeWindow_clearFrameRate: - skip: true - - eglGetDisplay: - go_name: GetDisplay - eglInitialize: - go_name: Initialize - eglTerminate: - go_name: Terminate - eglGetError: - go_name: GetError - eglChooseConfig: - go_name: ChooseConfig - eglGetConfigAttrib: - go_name: GetConfigAttrib - eglCreateWindowSurface: - go_name: CreateWindowSurface - eglCreatePbufferSurface: - go_name: CreatePbufferSurface - eglDestroySurface: - go_name: DestroySurface - eglCreateContext: - go_name: CreateContext - eglDestroyContext: - go_name: DestroyContext - eglMakeCurrent: - go_name: MakeCurrent - eglSwapBuffers: - go_name: SwapBuffers - eglSwapInterval: - go_name: SwapInterval - eglGetCurrentDisplay: - go_name: GetCurrentDisplay - eglGetCurrentSurface: - go_name: GetCurrentSurface - eglGetCurrentContext: - go_name: GetCurrentContext - eglQuerySurface: - go_name: QuerySurface - eglQueryString: - go_name: QueryString - eglReleaseThread: - go_name: ReleaseThread - eglWaitGL: - go_name: WaitGL - eglWaitNative: - go_name: WaitNative - eglBindAPI: - go_name: BindAPI - eglQueryAPI: - go_name: QueryAPI - -extra_enums: - EGLint: - - name: EGL_NONE - value: 12344 - - name: EGL_RENDERABLE_TYPE - value: 12352 - - name: EGL_OPENGL_ES2_BIT - value: 4 - - name: EGL_OPENGL_ES3_BIT - value: 64 - - name: EGL_SURFACE_TYPE - value: 12339 - - name: EGL_WINDOW_BIT - value: 4 - - name: EGL_PBUFFER_BIT - value: 1 - - name: EGL_RED_SIZE - value: 12324 - - name: EGL_GREEN_SIZE - value: 12323 - - name: EGL_BLUE_SIZE - value: 12322 - - name: EGL_ALPHA_SIZE - value: 12321 - - name: EGL_DEPTH_SIZE - value: 12325 - - name: EGL_STENCIL_SIZE - value: 12326 - - name: EGL_CONFIG_ID - value: 12328 - - name: EGL_BUFFER_SIZE - value: 12320 - - name: EGL_WIDTH - value: 12375 - - name: EGL_HEIGHT - value: 12374 - - name: EGL_CONTEXT_CLIENT_VERSION - value: 12440 - - name: EGL_CONTEXT_MAJOR_VERSION - value: 12440 - - name: EGL_OPENGL_ES_API - value: 12448 - EGLBoolean: - - name: EGL_FALSE - value: 0 - - name: EGL_TRUE - value: 1 diff --git a/spec/overlays/font.yaml b/spec/overlays/font.yaml deleted file mode 100644 index 2376378..0000000 --- a/spec/overlays/font.yaml +++ /dev/null @@ -1,63 +0,0 @@ -module: font - -package: - go_name: font - go_import: github.com/AndroidGoLab/ndk/font - doc: "Package font provides Go bindings for Android Font." - -types: - AFONT_WEIGHT: - go_name: Weight - strip_prefix: AFONT_WEIGHT_ - - AFont: - go_name: Font - destructor: AFont_close - - AFontMatcher: - go_name: Matcher - constructor: AFontMatcher_create - destructor: AFontMatcher_destroy - pattern: builder - -functions: - AFont_getFilePath: - receiver: Font - go_name: FilePath - pure: true - - AFont_getWeight: - receiver: Font - go_name: Weight - pure: true - - AFont_isItalic: - receiver: Font - go_name: IsItalic - pure: true - - AFontMatcher_setFamilyName: - receiver: Matcher - go_name: SetFamilyName - chain: true - - AFontMatcher_setStyle: - receiver: Matcher - go_name: SetStyle - chain: true - - AFontMatcher_match: - receiver: Matcher - go_name: Match - returns_new: Font - -api_levels: - AFont_close: 29 - AFont_getFilePath: 29 - AFont_getWeight: 29 - AFont_isItalic: 29 - AFontMatcher_create: 29 - AFontMatcher_destroy: 29 - AFontMatcher_setFamilyName: 29 - AFontMatcher_setStyle: 29 - AFontMatcher_match: 29 diff --git a/spec/overlays/gles2.yaml b/spec/overlays/gles2.yaml deleted file mode 100644 index 7aa48b9..0000000 --- a/spec/overlays/gles2.yaml +++ /dev/null @@ -1,256 +0,0 @@ -module: gles2 - -package: - go_name: gles2 - go_import: github.com/AndroidGoLab/ndk/gles2 - doc: "Package gles2 provides Go bindings for OpenGL ES 2.0." - -types: - GLenum: - go_name: Enum - strip_prefix: GL_ - - GLbitfield: - go_name: Bitfield - strip_prefix: GL_ - - GLboolean: - go_name: Boolean - strip_prefix: GL_ - -# Constants from extension headers and core GL not parsed by specgen. -extra_enums: - GLenum: - - name: GL_FALSE - value: 0 - - name: GL_TRUE - value: 1 - - name: GL_POINTS - value: 0 - - name: GL_TRIANGLES - value: 4 - - name: GL_TRIANGLE_STRIP - value: 5 - - name: GL_TRIANGLE_FAN - value: 6 - - name: GL_NO_ERROR - value: 0 - - name: GL_DEPTH_TEST - value: 2929 - - name: GL_BLEND - value: 3042 - - name: GL_TEXTURE_2D - value: 3553 - - name: GL_UNSIGNED_BYTE - value: 5121 - - name: GL_FLOAT - value: 5126 - - name: GL_RGBA - value: 6408 - - name: GL_NEAREST - value: 9728 - - name: GL_LINEAR - value: 9729 - - name: GL_TEXTURE_MAG_FILTER - value: 10240 - - name: GL_TEXTURE_MIN_FILTER - value: 10241 - - name: GL_TEXTURE_WRAP_S - value: 10242 - - name: GL_TEXTURE_WRAP_T - value: 10243 - - name: GL_COLOR_BUFFER_BIT - value: 16384 - - name: GL_DEPTH_BUFFER_BIT - value: 256 - - name: GL_CLAMP_TO_EDGE - value: 33071 - - name: GL_DEPTH_COMPONENT16 - value: 33189 - - name: GL_TEXTURE0 - value: 33984 - - name: GL_ARRAY_BUFFER - value: 34962 - - name: GL_ELEMENT_ARRAY_BUFFER - value: 34963 - - name: GL_STATIC_DRAW - value: 35044 - - name: GL_DYNAMIC_DRAW - value: 35048 - - name: GL_VERTEX_SHADER - value: 35633 - - name: GL_FRAGMENT_SHADER - value: 35632 - - name: GL_COMPILE_STATUS - value: 35713 - - name: GL_LINK_STATUS - value: 35714 - - name: GL_COLOR_ATTACHMENT0 - value: 36064 - - name: GL_DEPTH_ATTACHMENT - value: 36096 - - name: GL_FRAMEBUFFER_COMPLETE - value: 36053 - - name: GL_FRAMEBUFFER - value: 36160 - - name: GL_RENDERBUFFER - value: 36161 - - name: GL_TEXTURE_EXTERNAL_OES - value: 36197 - - name: GL_SRC_ALPHA - value: 770 - - name: GL_ONE_MINUS_SRC_ALPHA - value: 771 - -functions: - # State functions - glClearColor: - go_name: ClearColor - glClear: - go_name: Clear - glEnable: - go_name: Enable - glDisable: - go_name: Disable - glViewport: - go_name: Viewport - glScissor: - go_name: Scissor - - # Shader functions - glCreateShader: - go_name: CreateShader - glDeleteShader: - go_name: DeleteShader - glShaderSource: - go_name: ShaderSource - glCompileShader: - go_name: CompileShader - glGetShaderiv: - go_name: GetShaderiv - - # Program functions - glCreateProgram: - go_name: CreateProgram - glDeleteProgram: - go_name: DeleteProgram - glAttachShader: - go_name: AttachShader - glLinkProgram: - go_name: LinkProgram - glUseProgram: - go_name: UseProgram - glGetProgramiv: - go_name: GetProgramiv - - # Uniform functions - glGetUniformLocation: - go_name: GetUniformLocation - glUniform1f: - go_name: Uniform1f - glUniform1i: - go_name: Uniform1i - glUniform4fv: - go_name: Uniform4fv - glUniformMatrix4fv: - go_name: UniformMatrix4fv - - # Vertex attribute functions - glGetAttribLocation: - go_name: GetAttribLocation - glEnableVertexAttribArray: - go_name: EnableVertexAttribArray - glDisableVertexAttribArray: - go_name: DisableVertexAttribArray - glVertexAttribPointer: - go_name: VertexAttribPointer - - # Buffer functions - glGenBuffers: - go_name: GenBuffers - glDeleteBuffers: - go_name: DeleteBuffers - glBindBuffer: - go_name: BindBuffer - glBufferData: - go_name: BufferData - glBufferSubData: - go_name: BufferSubData - - # Texture functions - glGenTextures: - go_name: GenTextures - glDeleteTextures: - go_name: DeleteTextures - glBindTexture: - go_name: BindTexture - glTexImage2D: - go_name: TexImage2D - glTexParameteri: - go_name: TexParameteri - glActiveTexture: - go_name: ActiveTexture - - # Draw functions - glDrawArrays: - go_name: DrawArrays - glDrawElements: - go_name: DrawElements - - # Framebuffer functions - glGenFramebuffers: - go_name: GenFramebuffers - glDeleteFramebuffers: - go_name: DeleteFramebuffers - glBindFramebuffer: - go_name: BindFramebuffer - glFramebufferTexture2D: - go_name: FramebufferTexture2D - glCheckFramebufferStatus: - go_name: CheckFramebufferStatus - - # Renderbuffer functions - glGenRenderbuffers: - go_name: GenRenderbuffers - glDeleteRenderbuffers: - go_name: DeleteRenderbuffers - glBindRenderbuffer: - go_name: BindRenderbuffer - glRenderbufferStorage: - go_name: RenderbufferStorage - glFramebufferRenderbuffer: - go_name: FramebufferRenderbuffer - - # Query functions - glGetError: - go_name: GetError - glGetString: - go_name: GetString - glGetIntegerv: - go_name: GetIntegerv - glFlush: - go_name: Flush - glFinish: - go_name: Finish - - # Blending and depth functions - glBlendFunc: - go_name: BlendFunc - glBlendFuncSeparate: - go_name: BlendFuncSeparate - glDepthFunc: - go_name: DepthFunc - glDepthMask: - go_name: DepthMask - glStencilFunc: - go_name: StencilFunc - glStencilOp: - go_name: StencilOp - - # Pixel functions - glPixelStorei: - go_name: PixelStorei - glReadPixels: - go_name: ReadPixels - glLineWidth: - go_name: LineWidth diff --git a/spec/overlays/gles3.yaml b/spec/overlays/gles3.yaml deleted file mode 100644 index 6a800a1..0000000 --- a/spec/overlays/gles3.yaml +++ /dev/null @@ -1,130 +0,0 @@ -module: gles3 - -package: - go_name: gles3 - go_import: github.com/AndroidGoLab/ndk/gles3 - doc: "Package gles3 provides Go bindings for OpenGL ES 3.0." - -types: - GLenum: - go_name: GLenum - strip_prefix: GL_ - GLbitfield: - go_name: GLbitfield - strip_prefix: GL_ - -extra_enums: - GLenum: - - name: GL_SYNC_GPU_COMMANDS_COMPLETE - value: 37143 - - name: GL_ALREADY_SIGNALED - value: 37146 - - name: GL_TIMEOUT_EXPIRED - value: 37147 - - name: GL_CONDITION_SATISFIED - value: 37148 - - name: GL_WAIT_FAILED - value: 37149 - - name: GL_TRANSFORM_FEEDBACK - value: 36386 - - name: GL_TRANSFORM_FEEDBACK_BUFFER - value: 35982 - - name: GL_INTERLEAVED_ATTRIBS - value: 35980 - - name: GL_SEPARATE_ATTRIBS - value: 35981 - GLbitfield: - - name: GL_SYNC_FLUSH_COMMANDS_BIT - value: 1 - -functions: - glGetString: - go_name: GetString - glGenVertexArrays: - go_name: GenVertexArrays - glDeleteVertexArrays: - go_name: DeleteVertexArrays - glBindVertexArray: - go_name: BindVertexArray - glMapBufferRange: - go_name: MapBufferRange - glUnmapBuffer: - go_name: UnmapBuffer - glFlushMappedBufferRange: - go_name: FlushMappedBufferRange - glBlitFramebuffer: - go_name: BlitFramebuffer - glRenderbufferStorageMultisample: - go_name: RenderbufferStorageMultisample - glFramebufferTextureLayer: - go_name: FramebufferTextureLayer - glBindBufferBase: - go_name: BindBufferBase - glBindBufferRange: - go_name: BindBufferRange - glBeginTransformFeedback: - go_name: BeginTransformFeedback - glEndTransformFeedback: - go_name: EndTransformFeedback - glTransformFeedbackVaryings: - go_name: TransformFeedbackVaryings - glGenTransformFeedbacks: - go_name: GenTransformFeedbacks - glDeleteTransformFeedbacks: - go_name: DeleteTransformFeedbacks - glBindTransformFeedback: - go_name: BindTransformFeedback - glFenceSync: - go_name: FenceSync - glDeleteSync: - go_name: DeleteSync - glClientWaitSync: - go_name: ClientWaitSync - glWaitSync: - go_name: WaitSync - glGenSamplers: - go_name: GenSamplers - glDeleteSamplers: - go_name: DeleteSamplers - glBindSampler: - go_name: BindSampler - glSamplerParameteri: - go_name: SamplerParameteri - glBeginQuery: - go_name: BeginQuery - glEndQuery: - go_name: EndQuery - glGenQueries: - go_name: GenQueries - glDeleteQueries: - go_name: DeleteQueries - glGetQueryObjectuiv: - go_name: GetQueryObjectuiv - glTexStorage2D: - go_name: TexStorage2D - glTexStorage3D: - go_name: TexStorage3D - glTexSubImage3D: - go_name: TexSubImage3D - glCopyBufferSubData: - go_name: CopyBufferSubData - glDrawArraysInstanced: - go_name: DrawArraysInstanced - glDrawElementsInstanced: - go_name: DrawElementsInstanced - glClearBufferfv: - go_name: ClearBufferfv - glClearBufferiv: - go_name: ClearBufferiv - glClearBufferfi: - go_name: ClearBufferfi - glDrawRangeElements: - go_name: DrawRangeElements - glReadBuffer: - go_name: ReadBuffer - glDrawBuffers: - go_name: DrawBuffers - glInvalidateFramebuffer: - go_name: InvalidateFramebuffer - glGetStringi: - go_name: GetStringi diff --git a/spec/overlays/hardwarebuffer.yaml b/spec/overlays/hardwarebuffer.yaml deleted file mode 100644 index 44e7e07..0000000 --- a/spec/overlays/hardwarebuffer.yaml +++ /dev/null @@ -1,69 +0,0 @@ -module: hardwarebuffer - -package: - go_name: hwbuf - go_import: github.com/AndroidGoLab/ndk/hwbuf - doc: "Package hwbuf provides Go bindings for Android HardwareBuffer." - -types: - AHardwareBuffer: - go_name: Buffer - destructor: AHardwareBuffer_release - doc: "Buffer represents a hardware-allocated buffer." - - AHardwareBuffer_Desc: - go_name: Desc - value_struct: true - - AHardwareBuffer_Format: - go_name: Format - strip_prefix: AHARDWAREBUFFER_FORMAT_ - string_method: true - - AHardwareBuffer_UsageFlags: - go_name: Usage - strip_prefix: AHARDWAREBUFFER_USAGE_ - -functions: - # Buffer lifecycle - AHardwareBuffer_allocate: - go_name: Allocate - output_params: - outBuffer: "*Buffer" - - AHardwareBuffer_acquire: - receiver: Buffer - go_name: Acquire - - AHardwareBuffer_release: - skip: true - - AHardwareBuffer_describe: - receiver: Buffer - go_name: Describe - output_params: - outDesc: "*Desc" - - # Buffer access - AHardwareBuffer_lock: - receiver: Buffer - go_name: Lock - output_params: - outVirtualAddress: "unsafe.Pointer" - - AHardwareBuffer_unlock: - receiver: Buffer - go_name: Unlock - - # Query - AHardwareBuffer_isSupported: - go_name: IsSupported - pure: true - - AHardwareBuffer_recvHandleFromUnixSocket: - go_name: RecvHandleFromUnixSocket - output_params: - outBuffer: "*Buffer" - -api_levels: - AHardwareBuffer_isSupported: 29 diff --git a/spec/overlays/imagedecoder.yaml b/spec/overlays/imagedecoder.yaml deleted file mode 100644 index 8b5924d..0000000 --- a/spec/overlays/imagedecoder.yaml +++ /dev/null @@ -1,73 +0,0 @@ -module: imagedecoder - -package: - go_name: image - go_import: github.com/AndroidGoLab/ndk/image - doc: "Package image provides Go bindings for Android ImageDecoder." - -types: - ANDROID_IMAGE_DECODER: - go_error: true - success_value: ANDROID_IMAGE_DECODER_SUCCESS - error_prefix: "image" - strip_prefix: ANDROID_IMAGE_DECODER_ - - AImageDecoder: - go_name: Decoder - destructor: AImageDecoder_delete - - AImageDecoderHeaderInfo: - go_name: HeaderInfo - -functions: - AImageDecoder_createFromFd: - go_name: NewDecoderFromFd - returns_new: Decoder - output_params: - outDecoder: "*Decoder" - - AImageDecoder_createFromBuffer: - skip: true # buffer param is unsafe.Pointer, not CLI-friendly - - AImageDecoder_setTargetSize: - receiver: Decoder - go_name: SetTargetSize - - AImageDecoder_getHeaderInfo: - receiver: Decoder - go_name: HeaderInfo - returns_new: HeaderInfo - - AImageDecoder_getMinimumStride: - receiver: Decoder - go_name: MinimumStride - pure: true - - AImageDecoder_decodeImage: - receiver: Decoder - go_name: Decode - - AImageDecoderHeaderInfo_getWidth: - receiver: HeaderInfo - go_name: Width - pure: true - AImageDecoderHeaderInfo_getHeight: - receiver: HeaderInfo - go_name: Height - pure: true - AImageDecoderHeaderInfo_getMimeType: - receiver: HeaderInfo - go_name: MimeType - pure: true - -api_levels: - AImageDecoder_createFromFd: 30 - AImageDecoder_createFromBuffer: 30 - AImageDecoder_delete: 30 - AImageDecoder_setTargetSize: 30 - AImageDecoder_getHeaderInfo: 30 - AImageDecoder_getMinimumStride: 30 - AImageDecoder_decodeImage: 30 - AImageDecoderHeaderInfo_getWidth: 30 - AImageDecoderHeaderInfo_getHeight: 30 - AImageDecoderHeaderInfo_getMimeType: 30 diff --git a/spec/overlays/input.yaml b/spec/overlays/input.yaml deleted file mode 100644 index ef0119c..0000000 --- a/spec/overlays/input.yaml +++ /dev/null @@ -1,97 +0,0 @@ -module: input - -package: - go_name: input - go_import: github.com/AndroidGoLab/ndk/input - doc: "Package input provides Go bindings for Android Input events." - -types: - AInputEvent: - go_name: Event - doc: "Event represents an input event (key or motion)." - - AInputQueue: - go_name: Queue - doc: "Queue represents an input event queue." - - AINPUT_EVENT_TYPE: - go_name: EventType - strip_prefix: AINPUT_EVENT_TYPE_ - string_method: true - - AKEY_EVENT_ACTION: - go_name: KeyAction - strip_prefix: AKEY_EVENT_ACTION_ - string_method: true - - AMOTION_EVENT_ACTION: - go_name: MotionAction - strip_prefix: AMOTION_EVENT_ - string_method: true - - AINPUT_SOURCE: - go_name: Source - strip_prefix: AINPUT_SOURCE_ - string_method: true - -functions: - # Event getters - AInputEvent_getType: - receiver: Event - go_name: Type - pure: true - AInputEvent_getSource: - receiver: Event - go_name: Source - pure: true - - # Key event getters - AKeyEvent_getAction: - receiver: Event - go_name: KeyAction - pure: true - AKeyEvent_getKeyCode: - receiver: Event - go_name: KeyCode - pure: true - AKeyEvent_getRepeatCount: - receiver: Event - go_name: RepeatCount - pure: true - - # Motion event getters - AMotionEvent_getAction: - receiver: Event - go_name: MotionAction - pure: true - AMotionEvent_getPointerCount: - receiver: Event - go_name: PointerCount - pure: true - AMotionEvent_getX: - receiver: Event - go_name: X - pure: true - AMotionEvent_getY: - receiver: Event - go_name: Y - pure: true - AMotionEvent_getPressure: - receiver: Event - go_name: Pressure - pure: true - - # Queue functions - AInputQueue_detachLooper: - receiver: Queue - go_name: DetachLooper - AInputQueue_hasEvents: - receiver: Queue - go_name: HasEvents - AInputQueue_getEvent: - skip: true # hand-written in queue_event.go - AInputQueue_preDispatchEvent: - skip: true # hand-written in queue_event.go - AInputQueue_finishEvent: - receiver: Queue - go_name: FinishEvent diff --git a/spec/overlays/logging.yaml b/spec/overlays/logging.yaml deleted file mode 100644 index 5ff46b6..0000000 --- a/spec/overlays/logging.yaml +++ /dev/null @@ -1,16 +0,0 @@ -module: logging - -package: - go_name: log - go_import: github.com/AndroidGoLab/ndk/log - doc: "Package log provides Go bindings for Android logging." - -types: - android_LogPriority: - go_name: Priority - strip_prefix: ANDROID_LOG_ - string_method: true - -functions: - __android_log_write: - go_name: Write diff --git a/spec/overlays/looper.yaml b/spec/overlays/looper.yaml deleted file mode 100644 index 28924e3..0000000 --- a/spec/overlays/looper.yaml +++ /dev/null @@ -1,47 +0,0 @@ -module: looper - -package: - go_name: looper - go_import: github.com/AndroidGoLab/ndk/looper - doc: "Package looper provides Go bindings for Android ALooper." - -types: - ALooper: - go_name: Looper - destructor: ALooper_release - pattern: ref_counted - - ALOOPER_EVENT: - go_name: Event - strip_prefix: ALOOPER_ - -functions: - ALooper_prepare: - go_name: Prepare - returns_new: Looper - - ALooper_acquire: - receiver: Looper - go_name: Acquire - - ALooper_release: - skip: true - - ALooper_pollOnce: - go_name: PollOnce - timeout_param: timeoutMillis - timeout_unit: ms - - ALooper_pollAll: - go_name: PollAll - - ALooper_wake: - receiver: Looper - go_name: Wake - - ALooper_addFd: - skip: true - - ALooper_removeFd: - receiver: Looper - go_name: RemoveFd diff --git a/spec/overlays/media.yaml b/spec/overlays/media.yaml deleted file mode 100644 index e6fd272..0000000 --- a/spec/overlays/media.yaml +++ /dev/null @@ -1,335 +0,0 @@ -module: media - -package: - go_name: media - go_import: github.com/AndroidGoLab/ndk/media - doc: "Package media provides Go bindings for Android Media NDK." - -types: - media_status_t: - go_error: true - success_value: AMEDIA_OK - error_prefix: "media" - strip_prefix: AMEDIA_ERROR_ - - AMediaCodec: - go_name: Codec - destructor: AMediaCodec_delete - - AMediaFormat: - go_name: Format - constructor: AMediaFormat_new - destructor: AMediaFormat_delete - - AMediaExtractor: - go_name: Extractor - constructor: AMediaExtractor_new - destructor: AMediaExtractor_delete - - AMediaMuxer: - go_name: Muxer - destructor: AMediaMuxer_delete - - AMediaDrm: - go_name: Drm - - AMediaCrypto: - go_name: Crypto - - AImageReader: - go_name: ImageReader - destructor: AImageReader_delete - - AImage: - go_name: Image - destructor: AImage_delete - - ANativeWindow: - go_name: Window - - AMediaCodecBufferInfo: - go_name: BufferInfo - value_struct: true - -functions: - # --- ImageReader lifecycle --- - AImageReader_new: - go_name: NewImageReader - returns_new: ImageReader - output_params: - reader: "*ImageReader" - - AImageReader_newWithUsage: - go_name: NewImageReaderWithUsage - returns_new: ImageReader - output_params: - reader: "*ImageReader" - - # --- ImageReader queries --- - AImageReader_getWindow: - receiver: ImageReader - go_name: Window - output_params: - window: "*Window" - AImageReader_getWidth: - receiver: ImageReader - go_name: Width - AImageReader_getHeight: - receiver: ImageReader - go_name: Height - AImageReader_getFormat: - receiver: ImageReader - go_name: Format - AImageReader_getMaxImages: - receiver: ImageReader - go_name: MaxImages - - # --- ImageReader frame acquisition --- - AImageReader_acquireNextImage: - receiver: ImageReader - go_name: AcquireNextImage - output_params: - image: "*Image" - AImageReader_acquireLatestImage: - receiver: ImageReader - go_name: AcquireLatestImage - output_params: - image: "*Image" - - # --- Image queries --- - AImage_getWidth: - receiver: Image - go_name: Width - AImage_getHeight: - receiver: Image - go_name: Height - AImage_getFormat: - receiver: Image - go_name: Format - AImage_getTimestamp: - receiver: Image - go_name: Timestamp - AImage_getNumberOfPlanes: - receiver: Image - go_name: NumberOfPlanes - AImage_getPlanePixelStride: - receiver: Image - go_name: PlanePixelStride - AImage_getPlaneRowStride: - receiver: Image - go_name: PlaneRowStride - AImage_getPlaneData: - receiver: Image - go_name: PlaneData - output_params: - data: "*uint8" - dataLength: "int32" - # --- Codec lifecycle --- - AMediaCodec_createDecoderByType: - go_name: NewDecoder - returns_new: Codec - AMediaCodec_createEncoderByType: - go_name: NewEncoder - returns_new: Codec - - # --- Codec control --- - AMediaCodec_configure: - receiver: Codec - AMediaCodec_start: - receiver: Codec - AMediaCodec_stop: - receiver: Codec - AMediaCodec_flush: - receiver: Codec - - # --- Codec buffer operations --- - AMediaCodec_dequeueInputBuffer: - receiver: Codec - go_name: DequeueInputBuffer - pure: true - AMediaCodec_dequeueOutputBuffer: - receiver: Codec - go_name: DequeueOutputBuffer - pure: true - AMediaCodec_queueInputBuffer: - receiver: Codec - AMediaCodec_releaseOutputBuffer: - receiver: Codec - - # --- Codec getters --- - AMediaCodec_getOutputFormat: - skip: true # returns *AMediaFormat directly, can't convert capi pointer to idiomatic type - - # --- Format setters --- - AMediaFormat_setString: - receiver: Format - chain: true - AMediaFormat_setInt32: - receiver: Format - chain: true - - # --- Format getters --- - AMediaFormat_getInt32: - receiver: Format - pure: true - AMediaFormat_getString: - skip: true # needs **byte out param - - # --- Extractor operations --- - AMediaExtractor_setDataSourceFd: - receiver: Extractor - AMediaExtractor_getTrackCount: - receiver: Extractor - go_name: TrackCount - pure: true - AMediaExtractor_getTrackFormat: - skip: true # returns *AMediaFormat directly, can't convert capi pointer to idiomatic type - AMediaExtractor_selectTrack: - receiver: Extractor - AMediaExtractor_advance: - skip: true # returns bool, not Media_status_t - AMediaExtractor_readSampleData: - skip: true # returns int32 (byte count), not Media_status_t - AMediaExtractor_getSampleTime: - receiver: Extractor - go_name: SampleTime - pure: true - - # --- Muxer operations --- - AMediaMuxer_new: - skip: true # has OutputFormat param that needs manual casting - AMediaMuxer_addTrack: - skip: true # returns int32 (track index), not Media_status_t - AMediaMuxer_start: - receiver: Muxer - AMediaMuxer_stop: - receiver: Muxer - -extra_enums: - media_status_t: - - name: AMEDIA_OK - value: 0 - - name: AMEDIA_ERROR_UNKNOWN - value: -10000 - - name: AMEDIA_ERROR_MALFORMED - value: -10001 - - name: AMEDIA_ERROR_UNSUPPORTED - value: -10002 - - name: AMEDIA_ERROR_INVALID_OBJECT - value: -10003 - - name: AMEDIA_ERROR_INVALID_PARAMETER - value: -10004 - - name: AMEDIA_ERROR_INVALID_OPERATION - value: -10005 - - name: AMEDIA_ERROR_END_OF_STREAM - value: -10006 - - name: AMEDIA_ERROR_IO - value: -10007 - - name: AMEDIA_ERROR_WOULD_BLOCK - value: -10008 - - name: AMEDIA_DRM_ERROR_BASE - value: -20000 - - name: AMEDIA_DRM_NOT_PROVISIONED - value: -20001 - - name: AMEDIA_DRM_RESOURCE_BUSY - value: -20002 - - name: AMEDIA_DRM_DEVICE_REVOKED - value: -20003 - - name: AMEDIA_DRM_SHORT_BUFFER - value: -20004 - - name: AMEDIA_DRM_SESSION_NOT_OPENED - value: -20005 - - name: AMEDIA_DRM_TAMPER_DETECTED - value: -20006 - - name: AMEDIA_DRM_VERIFY_FAILED - value: -20007 - - name: AMEDIA_DRM_NEED_KEY - value: -20008 - - name: AMEDIA_DRM_LICENSE_EXPIRED - value: -20009 - - name: AMEDIA_IMGREADER_ERROR_BASE - value: -30000 - - name: AMEDIA_IMGREADER_NO_BUFFER_AVAILABLE - value: -30001 - - name: AMEDIA_IMGREADER_MAX_IMAGES_ACQUIRED - value: -30002 - - name: AMEDIA_IMGREADER_CANNOT_LOCK_IMAGE - value: -30003 - - name: AMEDIA_IMGREADER_CANNOT_UNLOCK_IMAGE - value: -30004 - - name: AMEDIA_IMGREADER_IMAGE_NOT_LOCKED - value: -30005 - -api_levels: - AMediaCodec_createDecoderByType: 21 - AMediaCodec_createEncoderByType: 21 - AMediaCodec_delete: 21 - AMediaCodec_configure: 21 - AMediaCodec_start: 21 - AMediaCodec_stop: 21 - AMediaCodec_flush: 21 - AMediaCodec_dequeueInputBuffer: 21 - AMediaCodec_dequeueOutputBuffer: 21 - AMediaCodec_getOutputFormat: 21 - AMediaCodec_queueInputBuffer: 21 - AMediaCodec_releaseOutputBuffer: 21 - AMediaFormat_new: 21 - AMediaFormat_delete: 21 - AMediaFormat_setString: 21 - AMediaFormat_setInt32: 21 - AMediaFormat_getInt32: 21 - AMediaFormat_getString: 21 - AMediaExtractor_new: 21 - AMediaExtractor_delete: 21 - AMediaExtractor_setDataSourceFd: 21 - AMediaExtractor_getTrackCount: 21 - AMediaExtractor_getTrackFormat: 21 - AMediaExtractor_selectTrack: 21 - AMediaExtractor_advance: 21 - AMediaExtractor_readSampleData: 21 - AMediaExtractor_getSampleTime: 21 - AMediaMuxer_new: 21 - AMediaMuxer_delete: 21 - AMediaMuxer_addTrack: 21 - AMediaMuxer_start: 21 - AMediaMuxer_stop: 21 - AMediaCodecInfo_getCanonicalName: 36 - AMediaCodecInfo_getKind: 36 - AMediaCodecInfo_isVendor: 36 - AMediaCodecInfo_getMediaCodecInfoType: 36 - AMediaCodecInfo_getMediaType: 36 - AMediaCodecInfo_getMaxSupportedInstances: 36 - AMediaCodecInfo_isFeatureSupported: 36 - AMediaCodecInfo_isFeatureRequired: 36 - AMediaCodecInfo_isFormatSupported: 36 - AMediaCodecInfo_getAudioCapabilities: 36 - AMediaCodecInfo_getVideoCapabilities: 36 - AMediaCodecInfo_getEncoderCapabilities: 36 - ACodecAudioCapabilities_getBitrateRange: 36 - ACodecAudioCapabilities_getSupportedSampleRates: 36 - ACodecAudioCapabilities_getSupportedSampleRateRanges: 36 - ACodecAudioCapabilities_getMaxInputChannelCount: 36 - ACodecAudioCapabilities_getMinInputChannelCount: 36 - ACodecAudioCapabilities_getInputChannelCountRanges: 36 - ACodecAudioCapabilities_isSampleRateSupported: 36 - ACodecPerformancePoint_create: 36 - ACodecPerformancePoint_destroy: 36 - ACodecPerformancePoint_coversFormat: 36 - ACodecPerformancePoint_covers: 36 - ACodecPerformancePoint_equals: 36 - ACodecVideoCapabilities_getBitrateRange: 36 - ACodecVideoCapabilities_getSupportedWidths: 36 - ACodecVideoCapabilities_getSupportedHeights: 36 - ACodecVideoCapabilities_getWidthAlignment: 36 - ACodecVideoCapabilities_getHeightAlignment: 36 - ACodecVideoCapabilities_getSupportedFrameRates: 36 - ACodecVideoCapabilities_getSupportedWidthsFor: 36 - ACodecVideoCapabilities_getSupportedHeightsFor: 36 - ACodecVideoCapabilities_getSupportedFrameRatesFor: 36 - ACodecVideoCapabilities_getAchievableFrameRatesFor: 36 - ACodecVideoCapabilities_getNextSupportedPerformancePoint: 36 - ACodecVideoCapabilities_areSizeAndRateSupported: 36 - ACodecVideoCapabilities_isSizeSupported: 36 - ACodecEncoderCapabilities_getQualityRange: 36 - ACodecEncoderCapabilities_getComplexityRange: 36 - ACodecEncoderCapabilities_isBitrateModeSupported: 36 diff --git a/spec/overlays/midi.yaml b/spec/overlays/midi.yaml deleted file mode 100644 index e33d129..0000000 --- a/spec/overlays/midi.yaml +++ /dev/null @@ -1,73 +0,0 @@ -module: midi - -package: - go_name: midi - go_import: github.com/AndroidGoLab/ndk/midi - doc: "Package midi provides Go bindings for Android MIDI." - -types: - Midi_result_t: - go_error: true - success_value: AMIDI_OK - error_prefix: "midi" - strip_prefix: AMIDI_ERROR_ - - AMidiDevice: - go_name: Device - destructor: AMidiDevice_release - - AMidiInputPort: - go_name: InputPort - destructor: AMidiInputPort_close - - AMidiOutputPort: - go_name: OutputPort - destructor: AMidiOutputPort_close - -functions: - AMidiDevice_fromJava: - skip: true # Requires JNI; Device is obtained via NewDeviceFromPointer instead. - - AMidiDevice_getNumInputPorts: - receiver: Device - go_name: NumInputPorts - pure: true - - AMidiDevice_getNumOutputPorts: - receiver: Device - go_name: NumOutputPorts - pure: true - - AMidiInputPort_open: - receiver: Device - go_name: OpenInputPort - returns_new: InputPort - - AMidiInputPort_send: - receiver: InputPort - go_name: Send - - AMidiOutputPort_open: - receiver: Device - go_name: OpenOutputPort - returns_new: OutputPort - -extra_enums: - Midi_result_t: - - name: AMIDI_OK - value: 0 - - name: AMIDI_ERROR_UNKNOWN - value: -1 - - name: AMIDI_ERROR_WOULD_BLOCK - value: -2 - -api_levels: - AMidiDevice_fromJava: 29 - AMidiDevice_release: 29 - AMidiDevice_getNumInputPorts: 29 - AMidiDevice_getNumOutputPorts: 29 - AMidiInputPort_open: 29 - AMidiInputPort_close: 29 - AMidiInputPort_send: 29 - AMidiOutputPort_open: 29 - AMidiOutputPort_close: 29 diff --git a/spec/overlays/multinetwork.yaml b/spec/overlays/multinetwork.yaml deleted file mode 100644 index 73ff5ad..0000000 --- a/spec/overlays/multinetwork.yaml +++ /dev/null @@ -1,10 +0,0 @@ -module: multinetwork - -package: - go_name: net - go_import: github.com/AndroidGoLab/ndk/net - doc: "Package net provides Go bindings for Android multinetwork APIs." - -types: - Net_handle_t: - go_name: Network diff --git a/spec/overlays/nativeactivity.yaml b/spec/overlays/nativeactivity.yaml deleted file mode 100644 index b0771fb..0000000 --- a/spec/overlays/nativeactivity.yaml +++ /dev/null @@ -1,46 +0,0 @@ -module: nativeactivity - -package: - go_name: activity - go_import: github.com/AndroidGoLab/ndk/activity - doc: "Package activity provides Go bindings for Android NativeActivity." - -types: - ANativeActivity: - go_name: Activity - - ANATIVEACTIVITY_SHOW_SOFT_INPUT: - go_name: ShowSoftInputFlags - strip_prefix: ANATIVEACTIVITY_SHOW_SOFT_INPUT_ - - ANATIVEACTIVITY_HIDE_SOFT_INPUT: - go_name: HideSoftInputFlags - strip_prefix: ANATIVEACTIVITY_HIDE_SOFT_INPUT_ - -lifecycle: - entry_point: ANativeActivity_onCreate - activity_type: ANativeActivity - callbacks_accessor: "activity->callbacks" - callback_struct: ANativeActivityCallbacks - entry_callback: OnCreate - -functions: - ANativeActivity_finish: - receiver: Activity - go_name: Finish - - ANativeActivity_setWindowFormat: - receiver: Activity - go_name: SetWindowFormat - - ANativeActivity_setWindowFlags: - receiver: Activity - go_name: SetWindowFlags - - ANativeActivity_showSoftInput: - receiver: Activity - go_name: ShowSoftInput - - ANativeActivity_hideSoftInput: - receiver: Activity - go_name: HideSoftInput diff --git a/spec/overlays/nativewindow.yaml b/spec/overlays/nativewindow.yaml deleted file mode 100644 index 903f795..0000000 --- a/spec/overlays/nativewindow.yaml +++ /dev/null @@ -1,54 +0,0 @@ -module: nativewindow - -package: - go_name: window - go_import: github.com/AndroidGoLab/ndk/window - doc: "Package window provides Go bindings for Android NativeWindow." - -types: - ANativeWindow: - go_name: Window - ref_counted: true - acquire: ANativeWindow_acquire - release: ANativeWindow_release - doc: "Window represents a native window surface." - - ANativeWindow_LegacyFormat: - go_name: Format - strip_prefix: WINDOW_FORMAT_ - string_method: true - -functions: - ANativeWindow_clearFrameRate: - skip: true - - # Window lifecycle - ANativeWindow_acquire: - receiver: Window - go_name: Acquire - - # Window getters - ANativeWindow_getWidth: - receiver: Window - go_name: Width - pure: true - ANativeWindow_getHeight: - receiver: Window - go_name: Height - pure: true - ANativeWindow_getFormat: - receiver: Window - go_name: Format - pure: true - - # Window configuration - ANativeWindow_setBuffersGeometry: - receiver: Window - go_name: SetBuffersGeometry - - # Buffer operations - ANativeWindow_lock: - skip: true - ANativeWindow_unlockAndPost: - receiver: Window - go_name: UnlockAndPost diff --git a/spec/overlays/neuralnetworks.yaml b/spec/overlays/neuralnetworks.yaml deleted file mode 100644 index e060898..0000000 --- a/spec/overlays/neuralnetworks.yaml +++ /dev/null @@ -1,296 +0,0 @@ -module: neuralnetworks - -package: - go_name: nnapi - go_import: github.com/AndroidGoLab/ndk/nnapi - doc: "Package nnapi provides Go bindings for Android Neural Networks API (NNAPI)." - -types: - Nnapi_result_t: - go_error: true - success_value: ANEURALNETWORKS_NO_ERROR - error_prefix: "nnapi" - strip_prefix: ANEURALNETWORKS_ - - Nnapi_operand_type_t: - go_name: OperandType - strip_prefix: ANEURALNETWORKS_ - - Nnapi_operation_type_t: - go_name: OperationType - strip_prefix: ANEURALNETWORKS_ - - Nnapi_fuse_code_t: - go_name: FuseCode - strip_prefix: ANEURALNETWORKS_ - - Nnapi_preference_t: - go_name: Preference - strip_prefix: ANEURALNETWORKS_PREFER_ - - Nnapi_device_type_t: - go_name: DeviceType - strip_prefix: ANEURALNETWORKS_DEVICE_ - - Nnapi_priority_t: - go_name: Priority - strip_prefix: ANEURALNETWORKS_PRIORITY_ - - ANeuralNetworksModel: - go_name: Model - constructor: ANeuralNetworksModel_create - destructor: ANeuralNetworksModel_free - - ANeuralNetworksCompilation: - go_name: Compilation - destructor: ANeuralNetworksCompilation_free - - ANeuralNetworksExecution: - go_name: Execution - destructor: ANeuralNetworksExecution_free - - ANeuralNetworksMemory: - go_name: Memory - destructor: ANeuralNetworksMemory_free - - ANeuralNetworksBurst: - go_name: Burst - destructor: ANeuralNetworksBurst_free - - ANeuralNetworksEvent: - go_name: Event - destructor: ANeuralNetworksEvent_free - - ANeuralNetworksDevice: - go_name: Device - -functions: - # Model - ANeuralNetworksModel_create: - skip: true - ANeuralNetworksModel_free: - skip: true - ANeuralNetworksModel_finish: - receiver: Model - go_name: Finish - ANeuralNetworksModel_addOperand: - skip: true # references undefined ANeuralNetworksOperandType - ANeuralNetworksModel_setOperandValue: - receiver: Model - go_name: SetOperandValue - ANeuralNetworksModel_addOperation: - receiver: Model - go_name: AddOperation - ANeuralNetworksModel_identifyInputsAndOutputs: - receiver: Model - go_name: IdentifyInputsAndOutputs - ANeuralNetworksModel_relaxComputationFloat32toFloat16: - receiver: Model - go_name: RelaxFloat32toFloat16 - - # Compilation - ANeuralNetworksCompilation_create: - receiver: Model - go_name: NewCompilation - returns_new: Compilation - ANeuralNetworksCompilation_free: - skip: true - ANeuralNetworksCompilation_setPreference: - receiver: Compilation - go_name: SetPreference - ANeuralNetworksCompilation_finish: - receiver: Compilation - go_name: Finish - ANeuralNetworksCompilation_setPriority: - receiver: Compilation - go_name: SetPriority - ANeuralNetworksCompilation_setTimeout: - receiver: Compilation - go_name: SetTimeout - ANeuralNetworksCompilation_setCaching: - receiver: Compilation - go_name: SetCaching - - # Execution - ANeuralNetworksExecution_create: - receiver: Compilation - go_name: NewExecution - returns_new: Execution - ANeuralNetworksExecution_free: - skip: true - ANeuralNetworksExecution_setInput: - skip: true # references undefined ANeuralNetworksOperandType - ANeuralNetworksExecution_setOutput: - skip: true # references undefined ANeuralNetworksOperandType - ANeuralNetworksExecution_compute: - receiver: Execution - go_name: Compute - ANeuralNetworksExecution_startCompute: - receiver: Execution - go_name: StartCompute - returns_new: Event - ANeuralNetworksExecution_setTimeout: - receiver: Execution - go_name: SetTimeout - ANeuralNetworksExecution_setMeasureTiming: - receiver: Execution - go_name: SetMeasureTiming - ANeuralNetworksExecution_getDuration: - receiver: Execution - go_name: GetDuration - ANeuralNetworksExecution_setInputFromMemory: - skip: true # references undefined ANeuralNetworksOperandType - ANeuralNetworksExecution_setOutputFromMemory: - skip: true # references undefined ANeuralNetworksOperandType - - # Memory - ANeuralNetworksMemory_createFromFd: - skip: true # first param is uint32 (size), not a handle - ANeuralNetworksMemory_free: - skip: true - - # Burst - ANeuralNetworksBurst_create: - receiver: Compilation - go_name: NewBurst - returns_new: Burst - ANeuralNetworksBurst_free: - skip: true - - # Event - ANeuralNetworksEvent_wait: - receiver: Event - go_name: Wait - ANeuralNetworksEvent_free: - skip: true - - # Device enumeration - ANeuralNetworks_getDeviceCount: - skip: true # has *uint32 out-param, not a simple return - ANeuralNetworks_getDevice: - skip: true # free function with returns_new; first param is uint32, not a handle - ANeuralNetworksDevice_getName: - skip: true # has **byte out-param - ANeuralNetworksDevice_getType: - skip: true # has *Nnapi_device_type_t out-param, not a simple return - ANeuralNetworksDevice_getVersion: - skip: true # has **byte out-param - ANeuralNetworksDevice_getFeatureLevel: - skip: true # has *int64 out-param - -extra_enums: - Nnapi_operand_type_t: - - name: ANEURALNETWORKS_FLOAT32 - value: 0 - - name: ANEURALNETWORKS_INT32 - value: 1 - - name: ANEURALNETWORKS_UINT32 - value: 2 - - name: ANEURALNETWORKS_TENSOR_FLOAT32 - value: 3 - - name: ANEURALNETWORKS_TENSOR_INT32 - value: 4 - - name: ANEURALNETWORKS_TENSOR_QUANT8_ASYMM - value: 5 - - name: ANEURALNETWORKS_BOOL - value: 6 - - name: ANEURALNETWORKS_TENSOR_QUANT16_SYMM - value: 7 - - name: ANEURALNETWORKS_TENSOR_FLOAT16 - value: 8 - - name: ANEURALNETWORKS_TENSOR_BOOL8 - value: 9 - - name: ANEURALNETWORKS_FLOAT16 - value: 10 - - name: ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL - value: 11 - - name: ANEURALNETWORKS_TENSOR_QUANT16_ASYMM - value: 12 - - name: ANEURALNETWORKS_TENSOR_QUANT8_SYMM - value: 13 - - name: ANEURALNETWORKS_TENSOR_QUANT8_ASYMM_SIGNED - value: 14 - Nnapi_operation_type_t: - - name: ANEURALNETWORKS_ADD - value: 0 - - name: ANEURALNETWORKS_MUL - value: 18 - - name: ANEURALNETWORKS_RELU - value: 19 - - name: ANEURALNETWORKS_SOFTMAX - value: 25 - - name: ANEURALNETWORKS_FULLY_CONNECTED - value: 9 - - name: ANEURALNETWORKS_CONV_2D - value: 3 - - name: ANEURALNETWORKS_DEPTHWISE_CONV_2D - value: 4 - - name: ANEURALNETWORKS_AVERAGE_POOL_2D - value: 1 - - name: ANEURALNETWORKS_MAX_POOL_2D - value: 17 - - name: ANEURALNETWORKS_RESHAPE - value: 22 - - name: ANEURALNETWORKS_CONCATENATION - value: 2 - Nnapi_fuse_code_t: - - name: ANEURALNETWORKS_FUSED_NONE - value: 0 - - name: ANEURALNETWORKS_FUSED_RELU - value: 1 - - name: ANEURALNETWORKS_FUSED_RELU1 - value: 2 - - name: ANEURALNETWORKS_FUSED_RELU6 - value: 3 - Nnapi_preference_t: - - name: ANEURALNETWORKS_PREFER_LOW_POWER - value: 0 - - name: ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER - value: 1 - - name: ANEURALNETWORKS_PREFER_SUSTAINED_SPEED - value: 2 - Nnapi_result_t: - - name: ANEURALNETWORKS_NO_ERROR - value: 0 - - name: ANEURALNETWORKS_OUT_OF_MEMORY - value: 1 - - name: ANEURALNETWORKS_INCOMPLETE - value: 2 - - name: ANEURALNETWORKS_UNEXPECTED_NULL - value: 3 - - name: ANEURALNETWORKS_BAD_DATA - value: 4 - - name: ANEURALNETWORKS_OP_FAILED - value: 5 - - name: ANEURALNETWORKS_BAD_STATE - value: 6 - - name: ANEURALNETWORKS_UNMAPPABLE - value: 7 - - name: ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE - value: 8 - - name: ANEURALNETWORKS_UNAVAILABLE_DEVICE - value: 9 - - name: ANEURALNETWORKS_MISSED_DEADLINE_TRANSIENT - value: 10 - - name: ANEURALNETWORKS_MISSED_DEADLINE_PERSISTENT - value: 11 - - name: ANEURALNETWORKS_RESOURCE_EXHAUSTED_TRANSIENT - value: 12 - - name: ANEURALNETWORKS_RESOURCE_EXHAUSTED_PERSISTENT - value: 13 - - name: ANEURALNETWORKS_DEAD_OBJECT - value: 14 - -api_levels: - ANeuralNetworksBurst_create: 29 - ANeuralNetworksBurst_free: 29 - ANeuralNetworksCompilation_setPriority: 30 - ANeuralNetworksCompilation_setTimeout: 30 - ANeuralNetworksCompilation_setCaching: 29 - ANeuralNetworksExecution_setTimeout: 30 - ANeuralNetworksExecution_setMeasureTiming: 29 - ANeuralNetworksExecution_getDuration: 29 - ANeuralNetworksDevice_getName: 29 - ANeuralNetworksDevice_getType: 29 - ANeuralNetworksDevice_getVersion: 29 - ANeuralNetworksDevice_getFeatureLevel: 29 diff --git a/spec/overlays/performancehint.yaml b/spec/overlays/performancehint.yaml deleted file mode 100644 index 814cbf0..0000000 --- a/spec/overlays/performancehint.yaml +++ /dev/null @@ -1,41 +0,0 @@ -module: performancehint - -package: - go_name: hint - go_import: github.com/AndroidGoLab/ndk/hint - doc: "Package hint provides Go bindings for Android performance hint management." - -types: - APerformanceHintManager: - go_name: Manager - - APerformanceHintSession: - go_name: Session - destructor: APerformanceHint_closeSession - interfaces: - - io.Closer - -functions: - APerformanceHint_closeSession: - skip: true - - APerformanceHint_createSession: - receiver: Manager - go_name: CreateSession - returns_new: Session - timeout_param: initialTargetWorkDurationNanos - - APerformanceHint_getPreferredUpdateRateNanos: - receiver: Manager - go_name: PreferredUpdateRateNanos - pure: true - - APerformanceHint_updateTargetWorkDuration: - receiver: Session - go_name: UpdateTargetWorkDuration - timeout_param: targetDurationNanos - - APerformanceHint_reportActualWorkDuration: - receiver: Session - go_name: ReportActualWorkDuration - timeout_param: actualDurationNanos diff --git a/spec/overlays/permission.yaml b/spec/overlays/permission.yaml deleted file mode 100644 index d780d96..0000000 --- a/spec/overlays/permission.yaml +++ /dev/null @@ -1,18 +0,0 @@ -module: permission - -package: - go_name: permission - go_import: github.com/AndroidGoLab/ndk/permission - doc: "Package permission provides Go bindings for Android Permission Manager." - -types: - PERMISSION_MANAGER_PERMISSION: - go_name: Result - strip_prefix: PERMISSION_MANAGER_PERMISSION_ - -functions: - APermissionManager_checkPermission: - go_name: CheckPermission - -api_levels: - APermissionManager_checkPermission: 31 diff --git a/spec/overlays/persistablebundle.yaml b/spec/overlays/persistablebundle.yaml deleted file mode 100644 index d5ed2da..0000000 --- a/spec/overlays/persistablebundle.yaml +++ /dev/null @@ -1,89 +0,0 @@ -module: persistablebundle - -package: - go_name: persistablebundle - go_import: github.com/AndroidGoLab/ndk/persistablebundle - doc: "Package persistablebundle provides Go bindings for Android PersistableBundle." - -types: - APersistableBundle: - go_name: PersistableBundle - destructor: APersistableBundle_delete - -functions: - APersistableBundle_writeToParcel: - receiver: PersistableBundle - go_name: WriteToParcel - - APersistableBundle_readFromParcel: - go_name: ReadFromParcel - output_params: - outPBundle: "*PersistableBundle" - - APersistableBundle_size: - receiver: PersistableBundle - go_name: Size - pure: true - - APersistableBundle_erase: - receiver: PersistableBundle - go_name: Erase - pure: true - - APersistableBundle_getPersistableBundle: - receiver: PersistableBundle - go_name: GetPersistableBundle - output_params: - outBundle: "*PersistableBundle" - - # Get*Vector functions return size in bytes (>=0) or APERSISTABLEBUNDLE_KEY_NOT_FOUND (-1). - # Use pure:true so callers get the size back (needed for the two-call pattern: - # first call with nil buffer to get required size, second call to fill buffer). - APersistableBundle_getBooleanVector: - receiver: PersistableBundle - go_name: GetBooleanVector - pure: true - APersistableBundle_getIntVector: - receiver: PersistableBundle - go_name: GetIntVector - pure: true - APersistableBundle_getLongVector: - receiver: PersistableBundle - go_name: GetLongVector - pure: true - APersistableBundle_getDoubleVector: - receiver: PersistableBundle - go_name: GetDoubleVector - pure: true - - # Skip: takes const char* const* which is complex to wrap idiomatically - APersistableBundle_putStringVector: - skip: true - - # Skip: functions that require APersistableBundle_stringAllocator callback - APersistableBundle_getString: - skip: true - APersistableBundle_getStringVector: - skip: true - APersistableBundle_getBooleanKeys: - skip: true - APersistableBundle_getIntKeys: - skip: true - APersistableBundle_getLongKeys: - skip: true - APersistableBundle_getDoubleKeys: - skip: true - APersistableBundle_getStringKeys: - skip: true - APersistableBundle_getBooleanVectorKeys: - skip: true - APersistableBundle_getIntVectorKeys: - skip: true - APersistableBundle_getLongVectorKeys: - skip: true - APersistableBundle_getDoubleVectorKeys: - skip: true - APersistableBundle_getStringVectorKeys: - skip: true - APersistableBundle_getPersistableBundleKeys: - skip: true diff --git a/spec/overlays/sensor.yaml b/spec/overlays/sensor.yaml deleted file mode 100644 index 6aaab63..0000000 --- a/spec/overlays/sensor.yaml +++ /dev/null @@ -1,96 +0,0 @@ -module: sensor - -package: - go_name: sensor - go_import: github.com/AndroidGoLab/ndk/sensor - doc: "Package sensor provides Go bindings for Android Sensor NDK." - -types: - ASENSOR_TYPE: - go_name: Type - strip_prefix: ASENSOR_TYPE_ - string_method: true - - ASENSOR_STATUS: - go_name: Status - strip_prefix: ASENSOR_STATUS_ - string_method: true - - ASensorManager: - go_name: Manager - pattern: singleton - - ASensor: - go_name: Sensor - - ASensorEventQueue: - go_name: EventQueue - -functions: - # Manager — singleton accessor - ASensorManager_getInstance: - go_name: GetInstance - returns_new: Manager - - # Manager — get default sensor by type - ASensorManager_getDefaultSensor: - receiver: Manager - go_name: DefaultSensor - returns_new: Sensor - - # Manager — enumerate sensors - ASensorManager_getSensorList: - skip: true # needs **ASensor out-param - - # Manager — event queue lifecycle - ASensorManager_createEventQueue: - receiver: Manager - go_name: CreateEventQueue - returns_new: EventQueue - - ASensorManager_destroyEventQueue: - receiver: Manager - go_name: DestroyEventQueue - - ASensorEventQueue_enableSensor: - receiver: EventQueue - go_name: EnableSensor - - ASensorEventQueue_disableSensor: - receiver: EventQueue - go_name: DisableSensor - - ASensorEventQueue_setEventRate: - receiver: EventQueue - go_name: SetEventRate - - ASensorEventQueue_hasEvents: - receiver: EventQueue - go_name: HasEvents - pure: true - - # Sensor info getters - ASensor_getName: - receiver: Sensor - go_name: Name - pure: true - - ASensor_getVendor: - receiver: Sensor - go_name: Vendor - pure: true - - ASensor_getType: - receiver: Sensor - go_name: Type - pure: true - - ASensor_getResolution: - receiver: Sensor - go_name: Resolution - pure: true - - ASensor_getMinDelay: - receiver: Sensor - go_name: MinDelay - pure: true diff --git a/spec/overlays/sharedmem.yaml b/spec/overlays/sharedmem.yaml deleted file mode 100644 index 7e43fac..0000000 --- a/spec/overlays/sharedmem.yaml +++ /dev/null @@ -1,6 +0,0 @@ -module: sharedmem - -package: - go_name: sharedmem - go_import: github.com/AndroidGoLab/ndk/sharedmem - doc: "Package sharedmem provides Go bindings for Android shared memory." diff --git a/spec/overlays/storage.yaml b/spec/overlays/storage.yaml deleted file mode 100644 index cf65567..0000000 --- a/spec/overlays/storage.yaml +++ /dev/null @@ -1,39 +0,0 @@ -module: storage - -package: - go_name: storage - go_import: github.com/AndroidGoLab/ndk/storage - doc: "Package storage provides Go bindings for Android Storage Manager." - -types: - AStorageManager: - go_name: Manager - constructor: AStorageManager_new - destructor: AStorageManager_delete - -functions: - AStorageManager_mountObb: - receiver: Manager - go_name: MountObb - - AStorageManager_unmountObb: - receiver: Manager - go_name: UnmountObb - - AStorageManager_isObbMounted: - receiver: Manager - go_name: IsObbMounted - pure: true - - AStorageManager_getMountedObbPath: - receiver: Manager - go_name: MountedObbPath - pure: true - -api_levels: - AStorageManager_new: 24 - AStorageManager_delete: 24 - AStorageManager_mountObb: 24 - AStorageManager_unmountObb: 24 - AStorageManager_isObbMounted: 24 - AStorageManager_getMountedObbPath: 24 diff --git a/spec/overlays/surfacecontrol.yaml b/spec/overlays/surfacecontrol.yaml deleted file mode 100644 index 45eadef..0000000 --- a/spec/overlays/surfacecontrol.yaml +++ /dev/null @@ -1,104 +0,0 @@ -module: surfacecontrol - -package: - go_name: surfacecontrol - go_import: github.com/AndroidGoLab/ndk/surfacecontrol - doc: "Package surfacecontrol provides Go bindings for Android SurfaceControl." - -types: - ASurfaceControl: - go_name: SurfaceControl - destructor: ASurfaceControl_release - - ASurfaceTransaction: - go_name: Transaction - constructor: ASurfaceTransaction_create - destructor: ASurfaceTransaction_delete - - ASurfaceTransactionVisibility: - go_name: Visibility - strip_prefix: ASURFACE_TRANSACTION_VISIBILITY_ - - ASurfaceTransactionTransparency: - go_name: Transparency - strip_prefix: ASURFACE_TRANSACTION_TRANSPARENCY_ - -functions: - # SurfaceControl lifecycle - ASurfaceControl_createFromWindow: - skip: true - - ASurfaceControl_create: - go_name: CreateChild - receiver: SurfaceControl - returns_new: SurfaceControl - - ASurfaceControl_acquire: - receiver: SurfaceControl - go_name: Acquire - - ASurfaceControl_release: - skip: true - - # Transaction lifecycle - ASurfaceTransaction_create: - skip: true - - ASurfaceTransaction_delete: - skip: true - - ASurfaceTransaction_apply: - receiver: Transaction - go_name: Apply - - # Transaction operations - ASurfaceTransaction_setVisibility: - receiver: Transaction - go_name: SetVisibility - chain: true - - ASurfaceTransaction_setZOrder: - receiver: Transaction - go_name: SetZOrder - chain: true - - ASurfaceTransaction_setBuffer: - skip: true - - ASurfaceTransaction_setBufferTransparency: - receiver: Transaction - go_name: SetBufferTransparency - chain: true - - ASurfaceTransaction_setDamageRegion: - receiver: Transaction - go_name: SetDamageRegion - chain: true - - ASurfaceTransaction_setPosition: - receiver: Transaction - go_name: SetPosition - chain: true - - ASurfaceTransaction_setBufferAlpha: - receiver: Transaction - go_name: SetBufferAlpha - chain: true - - ASurfaceTransaction_setCrop: - receiver: Transaction - go_name: SetCrop - chain: true - - ASurfaceTransaction_setScale: - receiver: Transaction - go_name: SetScale - chain: true - - ASurfaceTransaction_setColor: - receiver: Transaction - go_name: SetColor - chain: true - - ASurfaceTransaction_setOnComplete: - skip: true diff --git a/spec/overlays/surfacetexture.yaml b/spec/overlays/surfacetexture.yaml deleted file mode 100644 index cfde454..0000000 --- a/spec/overlays/surfacetexture.yaml +++ /dev/null @@ -1,49 +0,0 @@ -module: surfacetexture - -package: - go_name: surfacetexture - go_import: github.com/AndroidGoLab/ndk/surfacetexture - doc: "Package surfacetexture provides Go bindings for Android SurfaceTexture." - -types: - ASurfaceTexture: - go_name: SurfaceTexture - destructor: ASurfaceTexture_release - ANativeWindow: - go_name: NativeWindow - -functions: - ASurfaceTexture_fromSurfaceTexture: - skip: true - - ASurfaceTexture_release: - skip: true - - ASurfaceTexture_acquireANativeWindow: - receiver: SurfaceTexture - go_name: AcquireWindow - returns_new: NativeWindow - - ASurfaceTexture_attachToGLContext: - receiver: SurfaceTexture - go_name: AttachToGLContext - - ASurfaceTexture_detachFromGLContext: - receiver: SurfaceTexture - go_name: DetachFromGLContext - - ASurfaceTexture_updateTexImage: - receiver: SurfaceTexture - go_name: UpdateTexImage - - ASurfaceTexture_getTransformMatrix: - receiver: SurfaceTexture - go_name: TransformMatrix - - ASurfaceTexture_getTimestamp: - receiver: SurfaceTexture - go_name: Timestamp - pure: true - - ASurfaceTexture_setOnFrameAvailableListener: - skip: true diff --git a/spec/overlays/sync.yaml b/spec/overlays/sync.yaml deleted file mode 100644 index 7b37c0c..0000000 --- a/spec/overlays/sync.yaml +++ /dev/null @@ -1,15 +0,0 @@ -module: sync - -package: - go_name: sync - go_import: github.com/AndroidGoLab/ndk/sync - doc: "Package sync provides Go bindings for Android sync primitives." - -functions: - # sync_file_info function has the same name as the return type in the spec, - # and the capi uses _s suffix for the struct type. The function/type name - # collision produces invalid code; skip for now. - sync_file_info: - skip: true - sync_file_info_free: - skip: true diff --git a/spec/overlays/thermal.yaml b/spec/overlays/thermal.yaml deleted file mode 100644 index 94e0d8d..0000000 --- a/spec/overlays/thermal.yaml +++ /dev/null @@ -1,35 +0,0 @@ -module: thermal - -package: - go_name: thermal - go_import: github.com/AndroidGoLab/ndk/thermal - doc: "Package thermal provides Go bindings for Android thermal management." - -types: - AThermalManager: - go_name: Manager - constructor: AThermal_acquireManager - destructor: AThermal_releaseManager - - AThermalStatus: - go_name: ThermalStatus - strip_prefix: ATHERMAL_ - string_method: true - -functions: - AThermal_acquireManager: - skip: true - - AThermal_releaseManager: - skip: true - - AThermal_getCurrentThermalStatus: - receiver: Manager - go_name: CurrentStatus - pure: true - - AThermal_registerThermalStatusListener: - skip: true - - AThermal_unregisterThermalStatusListener: - skip: true diff --git a/spec/overlays/trace.yaml b/spec/overlays/trace.yaml deleted file mode 100644 index 1f5277d..0000000 --- a/spec/overlays/trace.yaml +++ /dev/null @@ -1,21 +0,0 @@ -module: trace - -package: - go_name: trace - go_import: github.com/AndroidGoLab/ndk/trace - doc: "Package trace provides Go bindings for Android native tracing." - -functions: - ATrace_isEnabled: - go_name: IsEnabled - pure: true - ATrace_beginSection: - go_name: BeginSection - ATrace_endSection: - go_name: EndSection - ATrace_beginAsyncSection: - go_name: BeginAsyncSection - ATrace_endAsyncSection: - go_name: EndAsyncSection - ATrace_setCounter: - go_name: SetCounter diff --git a/spec/overlays/vulkan.yaml b/spec/overlays/vulkan.yaml deleted file mode 100644 index 1591466..0000000 --- a/spec/overlays/vulkan.yaml +++ /dev/null @@ -1,150 +0,0 @@ -module: vulkan - -package: - go_name: vulkan - go_import: github.com/AndroidGoLab/ndk/vulkan - doc: "Package vulkan provides Go bindings for Vulkan on Android." - -types: - VkResult: - go_error: true - success_value: VK_SUCCESS - error_prefix: "vulkan" - strip_prefix: VK_ERROR_ - - VkFormat: - go_name: Format - strip_prefix: VK_FORMAT_ - - VkPresentModeKHR: - go_name: PresentMode - strip_prefix: VK_PRESENT_MODE_ - - VkStructureType: - go_name: StructureType - strip_prefix: VK_STRUCTURE_TYPE_ - -functions: - # Instance lifecycle - vkCreateInstance: - go_name: CreateInstance - returns_new: Instance - vkDestroyInstance: - go_name: DestroyInstance - vkEnumeratePhysicalDevices: - go_name: EnumeratePhysicalDevices - - # Device lifecycle - vkCreateDevice: - go_name: CreateDevice - returns_new: Device - vkDestroyDevice: - go_name: DestroyDevice - vkGetDeviceQueue: - go_name: GetDeviceQueue - vkDeviceWaitIdle: - go_name: DeviceWaitIdle - vkQueueWaitIdle: - go_name: QueueWaitIdle - - # Memory - vkAllocateMemory: - go_name: AllocateMemory - vkFreeMemory: - go_name: FreeMemory - vkMapMemory: - go_name: MapMemory - vkUnmapMemory: - go_name: UnmapMemory - - # Buffer - vkCreateBuffer: - go_name: CreateBuffer - vkDestroyBuffer: - go_name: DestroyBuffer - - # Image - vkCreateImage: - go_name: CreateImage - vkDestroyImage: - go_name: DestroyImage - vkCreateImageView: - go_name: CreateImageView - vkDestroyImageView: - go_name: DestroyImageView - - # Pipeline - vkCreateGraphicsPipelines: - go_name: CreateGraphicsPipelines - vkDestroyPipeline: - go_name: DestroyPipeline - vkCreateShaderModule: - go_name: CreateShaderModule - vkDestroyShaderModule: - go_name: DestroyShaderModule - - # Render pass - vkCreateRenderPass: - go_name: CreateRenderPass - vkDestroyRenderPass: - go_name: DestroyRenderPass - - # Framebuffer - vkCreateFramebuffer: - go_name: CreateFramebuffer - vkDestroyFramebuffer: - go_name: DestroyFramebuffer - - # Command - vkCreateCommandPool: - go_name: CreateCommandPool - vkDestroyCommandPool: - go_name: DestroyCommandPool - vkAllocateCommandBuffers: - go_name: AllocateCommandBuffers - vkBeginCommandBuffer: - go_name: BeginCommandBuffer - vkEndCommandBuffer: - go_name: EndCommandBuffer - vkQueueSubmit: - go_name: QueueSubmit - - # Synchronization - vkCreateSemaphore: - go_name: CreateSemaphore - vkDestroySemaphore: - go_name: DestroySemaphore - vkCreateFence: - go_name: CreateFence - vkDestroyFence: - go_name: DestroyFence - vkWaitForFences: - go_name: WaitForFences - vkResetFences: - go_name: ResetFences - - # Android surface - VkCreateAndroidSurfaceKHR: - go_name: CreateAndroidSurface - vkDestroySurfaceKHR: - go_name: DestroySurface - vkGetPhysicalDeviceSurfaceSupportKHR: - go_name: GetPhysicalDeviceSurfaceSupport - vkGetPhysicalDeviceSurfaceCapabilitiesKHR: - go_name: GetPhysicalDeviceSurfaceCapabilities - vkGetPhysicalDeviceSurfaceFormatsKHR: - go_name: GetPhysicalDeviceSurfaceFormats - vkGetPhysicalDeviceSurfacePresentModesKHR: - go_name: GetPhysicalDeviceSurfacePresentModes - - # Swapchain - vkCreateSwapchainKHR: - go_name: CreateSwapchain - vkDestroySwapchainKHR: - go_name: DestroySwapchain - vkGetSwapchainImagesKHR: - go_name: GetSwapchainImages - vkAcquireNextImageKHR: - go_name: AcquireNextImage - vkQueuePresentKHR: - go_name: QueuePresent diff --git a/storage/astorage_manager_obb_callback_func.go b/storage/astorage_manager_obb_callback_func.go deleted file mode 100644 index 7999cb1..0000000 --- a/storage/astorage_manager_obb_callback_func.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package storage - -import ( - capi "github.com/AndroidGoLab/ndk/capi/storage" -) - -type AStorageManager_obbCallbackFunc = capi.AStorageManager_obbCallbackFunc diff --git a/storage/errors.go b/storage/errors.go deleted file mode 100644 index c606db1..0000000 --- a/storage/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package storage - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/storage/functions.go b/storage/functions.go deleted file mode 100644 index 318cee5..0000000 --- a/storage/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package storage diff --git a/storage/manager.go b/storage/manager.go deleted file mode 100644 index 0e727b4..0000000 --- a/storage/manager.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package storage - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/storage" -) - -// Manager wraps the NDK AStorageManager handle. -type Manager struct { - ptr *capi.AStorageManager -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Manager) cptr() *capi.AStorageManager { - if h == nil { - return nil - } - return h.ptr -} - -// NewManager creates a new Manager. -func NewManager() *Manager { - return &Manager{ptr: capi.AStorageManager_new()} -} - -// Close releases the underlying NDK handle. -func (h *Manager) Close() error { - if h.ptr == nil { - return nil - } - capi.AStorageManager_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewManagerFromPointer wraps a raw AStorageManager pointer. -func NewManagerFromPointer(ptr unsafe.Pointer) *Manager { - return &Manager{ptr: (*capi.AStorageManager)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Manager) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Manager) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewManagerFromUintPtr wraps a uintptr as a Manager. -// The caller must ensure ptr points to a valid AStorageManager. -func NewManagerFromUintPtr(ptr uintptr) *Manager { - return &Manager{ptr: (*capi.AStorageManager)(unsafe.Pointer(ptr))} -} - -// MountedObbPath returns the value directly. -func (h *Manager) MountedObbPath(filename string) string { - return (string)(capi.AStorageManager_getMountedObbPath(h.ptr, filename)) -} - -// IsObbMounted returns the value directly. -func (h *Manager) IsObbMounted(filename string) int32 { - return (int32)(capi.AStorageManager_isObbMounted(h.ptr, filename)) -} - -// MountObb calls the underlying NDK function. -func (h *Manager) MountObb(filename string, key string, cb AStorageManager_obbCallbackFunc, data unsafe.Pointer) { - capi.AStorageManager_mountObb(h.ptr, filename, key, capi.AStorageManager_obbCallbackFunc(cb), data) -} - -// UnmountObb calls the underlying NDK function. -func (h *Manager) UnmountObb(filename string, force int32, cb AStorageManager_obbCallbackFunc, data unsafe.Pointer) { - capi.AStorageManager_unmountObb(h.ptr, filename, force, capi.AStorageManager_obbCallbackFunc(cb), data) -} diff --git a/storage/obb_state.go b/storage/obb_state.go deleted file mode 100644 index cc93abb..0000000 --- a/storage/obb_state.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package storage - -type OBB_STATE int32 - -const ( - AOBB_STATE_MOUNTED OBB_STATE = 1 - AOBB_STATE_UNMOUNTED OBB_STATE = 2 - AOBB_STATE_ERROR_INTERNAL OBB_STATE = 20 - AOBB_STATE_ERROR_COULD_NOT_MOUNT OBB_STATE = 21 - AOBB_STATE_ERROR_COULD_NOT_UNMOUNT OBB_STATE = 22 - AOBB_STATE_ERROR_NOT_MOUNTED OBB_STATE = 23 - AOBB_STATE_ERROR_ALREADY_MOUNTED OBB_STATE = 24 - AOBB_STATE_ERROR_PERMISSION_DENIED OBB_STATE = 25 -) diff --git a/storage/package.go b/storage/package.go deleted file mode 100644 index e65c214..0000000 --- a/storage/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package storage provides Go bindings for Android Storage Manager. -package storage diff --git a/storage/storage.go b/storage/storage.go new file mode 100644 index 0000000..8cbe529 --- /dev/null +++ b/storage/storage.go @@ -0,0 +1,21 @@ +// Copyright 2018-2024 The gooid Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package storage + +import ( + "github.com/xaionaro-go/ndk/ndk" +) + +type AssetManager = ndk.AssetManager +type AssetDir = ndk.AssetDir +type Asset = ndk.Asset + +/* Available modes for opening assets */ +const ( + ASSET_MODE_UNKNOWN = ndk.ASSET_MODE_UNKNOWN + ASSET_MODE_RANDOM = ndk.ASSET_MODE_RANDOM + ASSET_MODE_STREAMING = ndk.ASSET_MODE_STREAMING + ASSET_MODE_BUFFER = ndk.ASSET_MODE_BUFFER +) diff --git a/surfacecontrol/arect.go b/surfacecontrol/arect.go deleted file mode 100644 index 1f2587d..0000000 --- a/surfacecontrol/arect.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -import ( - capi "github.com/AndroidGoLab/ndk/capi/surfacecontrol" -) - -type ARect = capi.ARect diff --git a/surfacecontrol/asurface_transaction_on_commit.go b/surfacecontrol/asurface_transaction_on_commit.go deleted file mode 100644 index 899ae0a..0000000 --- a/surfacecontrol/asurface_transaction_on_commit.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -import ( - capi "github.com/AndroidGoLab/ndk/capi/surfacecontrol" -) - -type ASurfaceTransaction_OnCommit = capi.ASurfaceTransaction_OnCommit diff --git a/surfacecontrol/avsync_id.go b/surfacecontrol/avsync_id.go deleted file mode 100644 index d6772ff..0000000 --- a/surfacecontrol/avsync_id.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -import ( - capi "github.com/AndroidGoLab/ndk/capi/surfacecontrol" -) - -type AVsyncId = capi.AVsyncId diff --git a/surfacecontrol/errors.go b/surfacecontrol/errors.go deleted file mode 100644 index 4069261..0000000 --- a/surfacecontrol/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/surfacecontrol/functions.go b/surfacecontrol/functions.go deleted file mode 100644 index 019b44a..0000000 --- a/surfacecontrol/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol diff --git a/surfacecontrol/hdr_metadata_type.go b/surfacecontrol/hdr_metadata_type.go deleted file mode 100644 index 6448e8b..0000000 --- a/surfacecontrol/hdr_metadata_type.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -type HdrMetadataType int32 - -const ( - HDR10_SMPTE2086 HdrMetadataType = 1 - HDR10_CTA861_3 HdrMetadataType = 2 - HDR10PLUS_SEI HdrMetadataType = 3 -) diff --git a/surfacecontrol/package.go b/surfacecontrol/package.go deleted file mode 100644 index 6490004..0000000 --- a/surfacecontrol/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package surfacecontrol provides Go bindings for Android SurfaceControl. -package surfacecontrol diff --git a/surfacecontrol/surface_control.go b/surfacecontrol/surface_control.go deleted file mode 100644 index b8acb8f..0000000 --- a/surfacecontrol/surface_control.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/surfacecontrol" -) - -// SurfaceControl wraps the NDK ASurfaceControl handle. -type SurfaceControl struct { - ptr *capi.ASurfaceControl -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *SurfaceControl) cptr() *capi.ASurfaceControl { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *SurfaceControl) Close() error { - if h.ptr == nil { - return nil - } - capi.ASurfaceControl_release(h.ptr) - h.ptr = nil - return nil -} - -// NewSurfaceControlFromPointer wraps a raw ASurfaceControl pointer. -func NewSurfaceControlFromPointer(ptr unsafe.Pointer) *SurfaceControl { - return &SurfaceControl{ptr: (*capi.ASurfaceControl)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *SurfaceControl) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *SurfaceControl) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSurfaceControlFromUintPtr wraps a uintptr as a SurfaceControl. -// The caller must ensure ptr points to a valid ASurfaceControl. -func NewSurfaceControlFromUintPtr(ptr uintptr) *SurfaceControl { - return &SurfaceControl{ptr: (*capi.ASurfaceControl)(unsafe.Pointer(ptr))} -} - -// Acquire calls the underlying NDK function. -func (h *SurfaceControl) Acquire() { - capi.ASurfaceControl_acquire(h.ptr) -} - -// CreateChild creates a new SurfaceControl from this SurfaceControl. -func (h *SurfaceControl) CreateChild(debug_name string) *SurfaceControl { - return &SurfaceControl{ptr: capi.ASurfaceControl_create(h.ptr, debug_name)} -} diff --git a/surfacecontrol/surface_transaction_stats.go b/surfacecontrol/surface_transaction_stats.go deleted file mode 100644 index 6df4b37..0000000 --- a/surfacecontrol/surface_transaction_stats.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/surfacecontrol" -) - -// SurfaceTransactionStats wraps the NDK ASurfaceTransactionStats handle. -type SurfaceTransactionStats struct { - ptr *capi.ASurfaceTransactionStats -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *SurfaceTransactionStats) cptr() *capi.ASurfaceTransactionStats { - if h == nil { - return nil - } - return h.ptr -} - -// NewSurfaceTransactionStatsFromPointer wraps a raw ASurfaceTransactionStats pointer. -func NewSurfaceTransactionStatsFromPointer(ptr unsafe.Pointer) *SurfaceTransactionStats { - return &SurfaceTransactionStats{ptr: (*capi.ASurfaceTransactionStats)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *SurfaceTransactionStats) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *SurfaceTransactionStats) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSurfaceTransactionStatsFromUintPtr wraps a uintptr as a SurfaceTransactionStats. -// The caller must ensure ptr points to a valid ASurfaceTransactionStats. -func NewSurfaceTransactionStatsFromUintPtr(ptr uintptr) *SurfaceTransactionStats { - return &SurfaceTransactionStats{ptr: (*capi.ASurfaceTransactionStats)(unsafe.Pointer(ptr))} -} - -// GetAcquireTime returns the value directly. -func (h *SurfaceTransactionStats) GetAcquireTime(surface_control *SurfaceControl) int64 { - return (int64)(capi.ASurfaceTransactionStats_getAcquireTime(h.ptr, surface_control.cptr())) -} - -// GetLatchTime returns the value directly. -func (h *SurfaceTransactionStats) GetLatchTime() int64 { - return (int64)(capi.ASurfaceTransactionStats_getLatchTime(h.ptr)) -} - -// GetPresentFenceFd calls the underlying NDK function. -func (h *SurfaceTransactionStats) GetPresentFenceFd() error { - return result(capi.ASurfaceTransactionStats_getPresentFenceFd(h.ptr)) -} - -// GetPreviousReleaseFenceFd calls the underlying NDK function. -func (h *SurfaceTransactionStats) GetPreviousReleaseFenceFd(surface_control *SurfaceControl) error { - return result(capi.ASurfaceTransactionStats_getPreviousReleaseFenceFd(h.ptr, surface_control.cptr())) -} diff --git a/surfacecontrol/transaction.go b/surfacecontrol/transaction.go deleted file mode 100644 index f5e1efc..0000000 --- a/surfacecontrol/transaction.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/surfacecontrol" -) - -// Transaction wraps the NDK ASurfaceTransaction handle. -type Transaction struct { - ptr *capi.ASurfaceTransaction -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Transaction) cptr() *capi.ASurfaceTransaction { - if h == nil { - return nil - } - return h.ptr -} - -// NewTransaction creates a new Transaction. -func NewTransaction() *Transaction { - return &Transaction{ptr: capi.ASurfaceTransaction_create()} -} - -// Close releases the underlying NDK handle. -func (h *Transaction) Close() error { - if h.ptr == nil { - return nil - } - capi.ASurfaceTransaction_delete(h.ptr) - h.ptr = nil - return nil -} - -// NewTransactionFromPointer wraps a raw ASurfaceTransaction pointer. -func NewTransactionFromPointer(ptr unsafe.Pointer) *Transaction { - return &Transaction{ptr: (*capi.ASurfaceTransaction)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Transaction) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Transaction) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewTransactionFromUintPtr wraps a uintptr as a Transaction. -// The caller must ensure ptr points to a valid ASurfaceTransaction. -func NewTransactionFromUintPtr(ptr uintptr) *Transaction { - return &Transaction{ptr: (*capi.ASurfaceTransaction)(unsafe.Pointer(ptr))} -} - -// Apply calls the underlying NDK function. -func (h *Transaction) Apply() { - capi.ASurfaceTransaction_apply(h.ptr) -} - -// ClearFrameRate calls the underlying NDK function. -func (h *Transaction) ClearFrameRate(surface_control *SurfaceControl) { - capi.ASurfaceTransaction_clearFrameRate(h.ptr, surface_control.cptr()) -} - -// Reparent calls the underlying NDK function. -func (h *Transaction) Reparent(surface_control *SurfaceControl, new_parent *SurfaceControl) { - capi.ASurfaceTransaction_reparent(h.ptr, surface_control.cptr(), new_parent.cptr()) -} - -// SetBufferAlpha sets a property and returns the receiver for chaining. -func (h *Transaction) SetBufferAlpha(surface_control *SurfaceControl, alpha float32) *Transaction { - capi.ASurfaceTransaction_setBufferAlpha(h.ptr, surface_control.cptr(), alpha) - return h -} - -// SetBufferTransform calls the underlying NDK function. -func (h *Transaction) SetBufferTransform(surface_control *SurfaceControl, transform int32) { - capi.ASurfaceTransaction_setBufferTransform(h.ptr, surface_control.cptr(), transform) -} - -// SetCrop sets a property and returns the receiver for chaining. -func (h *Transaction) SetCrop(surface_control *SurfaceControl, crop *ARect) *Transaction { - capi.ASurfaceTransaction_setCrop(h.ptr, surface_control.cptr(), (*capi.ARect)(crop)) - return h -} - -// SetDamageRegion sets a property and returns the receiver for chaining. -func (h *Transaction) SetDamageRegion(surface_control *SurfaceControl, rects *ARect, count uint32) *Transaction { - capi.ASurfaceTransaction_setDamageRegion(h.ptr, surface_control.cptr(), (*capi.ARect)(rects), count) - return h -} - -// SetDesiredHdrHeadroom calls the underlying NDK function. -func (h *Transaction) SetDesiredHdrHeadroom(surface_control *SurfaceControl, desiredHeadroom float32) { - capi.ASurfaceTransaction_setDesiredHdrHeadroom(h.ptr, surface_control.cptr(), desiredHeadroom) -} - -// SetDesiredPresentTime calls the underlying NDK function. -func (h *Transaction) SetDesiredPresentTime(desiredPresentTime int64) { - capi.ASurfaceTransaction_setDesiredPresentTime(h.ptr, desiredPresentTime) -} - -// SetEnableBackPressure calls the underlying NDK function. -func (h *Transaction) SetEnableBackPressure(surface_control *SurfaceControl, enableBackPressure bool) { - capi.ASurfaceTransaction_setEnableBackPressure(h.ptr, surface_control.cptr(), enableBackPressure) -} - -// SetExtendedRangeBrightness calls the underlying NDK function. -func (h *Transaction) SetExtendedRangeBrightness(surface_control *SurfaceControl, currentBufferRatio float32, desiredRatio float32) { - capi.ASurfaceTransaction_setExtendedRangeBrightness(h.ptr, surface_control.cptr(), currentBufferRatio, desiredRatio) -} - -// SetFrameRate calls the underlying NDK function. -func (h *Transaction) SetFrameRate(surface_control *SurfaceControl, frameRate float32, compatibility int8) { - capi.ASurfaceTransaction_setFrameRate(h.ptr, surface_control.cptr(), frameRate, compatibility) -} - -// SetFrameRateWithChangeStrategy calls the underlying NDK function. -func (h *Transaction) SetFrameRateWithChangeStrategy(surface_control *SurfaceControl, frameRate float32, compatibility int8, changeFrameRateStrategy int8) { - capi.ASurfaceTransaction_setFrameRateWithChangeStrategy(h.ptr, surface_control.cptr(), frameRate, compatibility, changeFrameRateStrategy) -} - -// SetGeometry calls the underlying NDK function. -func (h *Transaction) SetGeometry(surface_control *SurfaceControl, source *ARect, destination *ARect, transform int32) { - capi.ASurfaceTransaction_setGeometry(h.ptr, surface_control.cptr(), (*capi.ARect)(source), (*capi.ARect)(destination), transform) -} - -// SetPosition sets a property and returns the receiver for chaining. -func (h *Transaction) SetPosition(surface_control *SurfaceControl, x int32, y int32) *Transaction { - capi.ASurfaceTransaction_setPosition(h.ptr, surface_control.cptr(), x, y) - return h -} - -// SetScale sets a property and returns the receiver for chaining. -func (h *Transaction) SetScale(surface_control *SurfaceControl, xScale float32, yScale float32) *Transaction { - capi.ASurfaceTransaction_setScale(h.ptr, surface_control.cptr(), xScale, yScale) - return h -} - -// SetZOrder sets a property and returns the receiver for chaining. -func (h *Transaction) SetZOrder(surface_control *SurfaceControl, z_order int32) *Transaction { - capi.ASurfaceTransaction_setZOrder(h.ptr, surface_control.cptr(), z_order) - return h -} diff --git a/surfacecontrol/transparency.go b/surfacecontrol/transparency.go deleted file mode 100644 index d2469f2..0000000 --- a/surfacecontrol/transparency.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -type Transparency int32 - -const ( - Transparent Transparency = 0 - Translucent Transparency = 1 - Opaque Transparency = 2 -) diff --git a/surfacecontrol/visibility.go b/surfacecontrol/visibility.go deleted file mode 100644 index 8e2bc4e..0000000 --- a/surfacecontrol/visibility.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacecontrol - -type Visibility int32 - -const ( - Hide Visibility = 0 - Show Visibility = 1 -) diff --git a/surfacetexture/errors.go b/surfacetexture/errors.go deleted file mode 100644 index 7b01868..0000000 --- a/surfacetexture/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacetexture - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/surfacetexture/functions.go b/surfacetexture/functions.go deleted file mode 100644 index 7fd2688..0000000 --- a/surfacetexture/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacetexture diff --git a/surfacetexture/native_window.go b/surfacetexture/native_window.go deleted file mode 100644 index 5b4dcb7..0000000 --- a/surfacetexture/native_window.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacetexture - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/surfacetexture" -) - -// NativeWindow wraps the NDK ANativeWindow handle. -type NativeWindow struct { - ptr *capi.ANativeWindow -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *NativeWindow) cptr() *capi.ANativeWindow { - if h == nil { - return nil - } - return h.ptr -} - -// NewNativeWindowFromPointer wraps a raw ANativeWindow pointer. -func NewNativeWindowFromPointer(ptr unsafe.Pointer) *NativeWindow { - return &NativeWindow{ptr: (*capi.ANativeWindow)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *NativeWindow) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *NativeWindow) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewNativeWindowFromUintPtr wraps a uintptr as a NativeWindow. -// The caller must ensure ptr points to a valid ANativeWindow. -func NewNativeWindowFromUintPtr(ptr uintptr) *NativeWindow { - return &NativeWindow{ptr: (*capi.ANativeWindow)(unsafe.Pointer(ptr))} -} diff --git a/surfacetexture/package.go b/surfacetexture/package.go deleted file mode 100644 index 9235c6b..0000000 --- a/surfacetexture/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package surfacetexture provides Go bindings for Android SurfaceTexture. -package surfacetexture diff --git a/surfacetexture/surface_texture.go b/surfacetexture/surface_texture.go deleted file mode 100644 index 692cceb..0000000 --- a/surfacetexture/surface_texture.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package surfacetexture - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/surfacetexture" -) - -// SurfaceTexture wraps the NDK ASurfaceTexture handle. -type SurfaceTexture struct { - ptr *capi.ASurfaceTexture -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *SurfaceTexture) cptr() *capi.ASurfaceTexture { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *SurfaceTexture) Close() error { - if h.ptr == nil { - return nil - } - capi.ASurfaceTexture_release(h.ptr) - h.ptr = nil - return nil -} - -// NewSurfaceTextureFromPointer wraps a raw ASurfaceTexture pointer. -func NewSurfaceTextureFromPointer(ptr unsafe.Pointer) *SurfaceTexture { - return &SurfaceTexture{ptr: (*capi.ASurfaceTexture)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *SurfaceTexture) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *SurfaceTexture) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewSurfaceTextureFromUintPtr wraps a uintptr as a SurfaceTexture. -// The caller must ensure ptr points to a valid ASurfaceTexture. -func NewSurfaceTextureFromUintPtr(ptr uintptr) *SurfaceTexture { - return &SurfaceTexture{ptr: (*capi.ASurfaceTexture)(unsafe.Pointer(ptr))} -} - -// AcquireWindow creates a new NativeWindow from this SurfaceTexture. -func (h *SurfaceTexture) AcquireWindow() *NativeWindow { - return &NativeWindow{ptr: capi.ASurfaceTexture_acquireANativeWindow(h.ptr)} -} - -// AttachToGLContext calls the underlying NDK function. -func (h *SurfaceTexture) AttachToGLContext(texName uint32) error { - return result(capi.ASurfaceTexture_attachToGLContext(h.ptr, texName)) -} - -// DetachFromGLContext calls the underlying NDK function. -func (h *SurfaceTexture) DetachFromGLContext() error { - return result(capi.ASurfaceTexture_detachFromGLContext(h.ptr)) -} - -// Timestamp returns the value directly. -func (h *SurfaceTexture) Timestamp() int64 { - return (int64)(capi.ASurfaceTexture_getTimestamp(h.ptr)) -} - -// TransformMatrix calls the underlying NDK function. -func (h *SurfaceTexture) TransformMatrix(mtx *[16]float32) { - capi.ASurfaceTexture_getTransformMatrix(h.ptr, mtx) -} - -// UpdateTexImage calls the underlying NDK function. -func (h *SurfaceTexture) UpdateTexImage() error { - return result(capi.ASurfaceTexture_updateTexImage(h.ptr)) -} diff --git a/sync/errors.go b/sync/errors.go deleted file mode 100644 index f1b3397..0000000 --- a/sync/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sync diff --git a/sync/functions.go b/sync/functions.go deleted file mode 100644 index 2910984..0000000 --- a/sync/functions.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package sync - -import ( - capi "github.com/AndroidGoLab/ndk/capi/sync" -) - -// Sync_merge calls the underlying C function. -func Sync_merge(name string, fd1 int32, fd2 int32) int32 { - return (int32)(capi.Sync_merge(name, fd1, fd2)) -} diff --git a/sync/package.go b/sync/package.go deleted file mode 100644 index 4a500ee..0000000 --- a/sync/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package sync provides Go bindings for Android sync primitives. -package sync diff --git a/templates/.gitkeep b/templates/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/templates/bridge_c.go.tmpl b/templates/bridge_c.go.tmpl deleted file mode 100644 index b42ea04..0000000 --- a/templates/bridge_c.go.tmpl +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -/* -{{ range .CIncludes }}{{ . }} -{{ end }} -{{ range $cs := .CallbackStructs }}{{ range $f := $cs.Fields }}extern void goBridge_{{ $cs.GoName }}_{{ $f.GoName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ toCType $p.Type }} {{ $p.Name }}{{ end }}); -{{ end }}{{ end }} -{{ range $cs := .CallbackStructs }} -static void bridge_{{ $cs.SpecName }}_init({{ $cs.SpecName }}* cbs, uintptr_t cbId) { - cbs->{{ $cs.ContextField }} = (void*)cbId; -{{ range $f := $cs.Fields }} cbs->{{ $f.CName }} = goBridge_{{ $cs.GoName }}_{{ $f.GoName }}; -{{ end }}} -{{ end }} -{{ range $sa := .StructAccessors }} -static int bridge_{{ $sa.SpecName }}_count({{ $sa.SpecName }}* list) { - return list->{{ $sa.CountField }}; -} - -{{ if eq $sa.ItemType "string" }}static const char* bridge_{{ $sa.SpecName }}_item({{ $sa.SpecName }}* list, int i) { - return list->{{ $sa.ItemsField }}[i]; -} -{{ else }}static void* bridge_{{ $sa.SpecName }}_item({{ $sa.SpecName }}* list, int i) { - return list->{{ $sa.ItemsField }}[i]; -} -{{ end }}{{ end }} -{{ .ExtraBridgeC }} -*/ -import "C" - -import ( - "unsafe" -) -{{ range $cs := .CallbackStructs }} -// {{ $cs.GoName }} holds Go callbacks for {{ $cs.SpecName }}. -type {{ $cs.GoName }} struct { -{{ range $f := $cs.Fields }} {{ $f.GoName }} {{ $f.GoSignature }} -{{ end }}} -{{ end }} -{{ range $cs := .CallbackStructs }} -// BridgeRegister{{ $cs.GoName }} registers a {{ $cs.GoName }} and returns its callback ID. -func BridgeRegister{{ $cs.GoName }}(cbs {{ $cs.GoName }}) uintptr { - return bridgeRegisterCB(cbs) -} - -// BridgeUnregister{{ $cs.GoName }} unregisters a previously registered {{ $cs.GoName }}. -func BridgeUnregister{{ $cs.GoName }}(id uintptr) { - bridgeUnregisterCB(id) -} - -// BridgeInit{{ $cs.GoName }} initializes a C {{ $cs.SpecName }} with bridge function pointers. -func BridgeInit{{ $cs.GoName }}(cbs *{{ $cs.SpecName }}, cbID uintptr) { - C.bridge_{{ $cs.SpecName }}_init((*C.{{ $cs.SpecName }})(unsafe.Pointer(cbs)), C.uintptr_t(cbID)) -} -{{ end }} -{{ range $sa := .StructAccessors }} -// Bridge{{ $sa.SpecName }}Count returns the count of items in a {{ $sa.SpecName }}. -func Bridge{{ $sa.SpecName }}Count(list *{{ $sa.SpecName }}) int { - return int(C.bridge_{{ $sa.SpecName }}_count((*C.{{ $sa.SpecName }})(unsafe.Pointer(list)))) -} - -{{ if eq $sa.ItemType "string" }}// Bridge{{ $sa.SpecName }}Item returns the item at index i from a {{ $sa.SpecName }}. -func Bridge{{ $sa.SpecName }}Item(list *{{ $sa.SpecName }}, i int) string { - return C.GoString(C.bridge_{{ $sa.SpecName }}_item((*C.{{ $sa.SpecName }})(unsafe.Pointer(list)), C.int(i))) -} -{{ else }}// Bridge{{ $sa.SpecName }}Item returns the item at index i from a {{ $sa.SpecName }}. -func Bridge{{ $sa.SpecName }}Item(list *{{ $sa.SpecName }}, i int) unsafe.Pointer { - return unsafe.Pointer(C.bridge_{{ $sa.SpecName }}_item((*C.{{ $sa.SpecName }})(unsafe.Pointer(list)), C.int(i))) -} -{{ end }}{{ end }} -{{ .ExtraBridgeGo }} diff --git a/templates/bridge_export.go.tmpl b/templates/bridge_export.go.tmpl deleted file mode 100644 index 05dc99c..0000000 --- a/templates/bridge_export.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -/* -{{ range .CIncludes }}{{ . }} -{{ end }} -*/ -import "C" - -import "unsafe" -{{ range $cs := .CallbackStructs }}{{ range $f := $cs.Fields }} -//export goBridge_{{ $cs.GoName }}_{{ $f.GoName }} -func goBridge_{{ $cs.GoName }}_{{ $f.GoName }}(context unsafe.Pointer{{ range skipSpecParams $f.Params 1 }}, {{ .Name }} {{ cTypeToGo .Type }}{{ end }}) { - if cb, ok := bridgeLookupCB(uintptr(context)).({{ $cs.GoName }}); ok && cb.{{ $f.GoName }} != nil { - cb.{{ $f.GoName }}({{ range $i, $p := tailSpecParams (skipSpecParams $f.Params 1) $f.GoParamCount }}{{ if $i }}, {{ end }}{{ goConvertSpecParam $p }}{{ end }}) - } -} -{{ end }}{{ end }} diff --git a/templates/bridge_lifecycle.go.tmpl b/templates/bridge_lifecycle.go.tmpl deleted file mode 100644 index 7468622..0000000 --- a/templates/bridge_lifecycle.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -/* -{{ range .CIncludes }}{{ . }} -{{ end }} -{{ range $f := .Lifecycle.Fields }}extern {{ if $f.Returns }}{{ toCType $f.Returns }}{{ else }}void{{ end }} goBridge_Lifecycle_{{ $f.GoName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ toCParamDecl $p }}{{ end }}); -{{ end }} -void bridgeInstallLifecycleCallbacks({{ .Lifecycle.ActivityType }}* activity) { -{{ range $f := .Lifecycle.Fields }} {{ $.Lifecycle.CallbacksAccessor }}->{{ $f.CName }} = goBridge_Lifecycle_{{ $f.GoName }}; -{{ end }}} -*/ -import "C" - -import ( - "sync" - "unsafe" -) - -// LifecycleCallbacks holds Go callbacks for {{ .Lifecycle.ActivityType }} lifecycle events. -type LifecycleCallbacks struct { -{{ if .Lifecycle.EntryCallback }} {{ .Lifecycle.EntryCallback }} func(unsafe.Pointer) -{{ end }}{{ range $f := .Lifecycle.Fields }} {{ $f.GoName }} func({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ lifecycleGoParamType $p.Type }}{{ end }}) -{{ end }}} - -var ( - bridgeLifecycleMu sync.Mutex - bridgeLifecycleCB LifecycleCallbacks -) - -// BridgeSetLifecycleCallbacks registers callbacks for the lifecycle events. -func BridgeSetLifecycleCallbacks(cb LifecycleCallbacks) { - bridgeLifecycleMu.Lock() - bridgeLifecycleCB = cb - bridgeLifecycleMu.Unlock() -} - -// BridgeInstallLifecycleCallbacks installs the bridge callbacks into a {{ .Lifecycle.ActivityType }}. -func BridgeInstallLifecycleCallbacks(activity *{{ .Lifecycle.ActivityType }}) { - C.bridgeInstallLifecycleCallbacks((*C.{{ .Lifecycle.ActivityType }})(unsafe.Pointer(activity))) -} diff --git a/templates/bridge_lifecycle_export.go.tmpl b/templates/bridge_lifecycle_export.go.tmpl deleted file mode 100644 index 9c93f6d..0000000 --- a/templates/bridge_lifecycle_export.go.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -/* -{{ range .CIncludes }}{{ . }} -{{ end }} -extern void bridgeInstallLifecycleCallbacks({{ .Lifecycle.ActivityType }}* activity); -*/ -import "C" - -import "unsafe" - -//export {{ .Lifecycle.EntryPoint }} -func {{ .Lifecycle.EntryPoint }}( - activity *C.{{ .Lifecycle.ActivityType }}, - savedState unsafe.Pointer, - savedStateSize C.size_t, -) { - C.bridgeInstallLifecycleCallbacks(activity) -{{ if .Lifecycle.EntryCallback }} bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.{{ .Lifecycle.EntryCallback }} - bridgeLifecycleMu.Unlock() - if cb != nil { - cb(unsafe.Pointer(activity)) - } -{{ end }} -} -{{ range $f := .Lifecycle.Fields }} -//export goBridge_Lifecycle_{{ $f.GoName }} -func goBridge_Lifecycle_{{ $f.GoName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ cTypeToGo $p.Type }}{{ end }}){{ if $f.Returns }} {{ cTypeToGo $f.Returns }}{{ end }} { - bridgeLifecycleMu.Lock() - cb := bridgeLifecycleCB.{{ $f.GoName }} - bridgeLifecycleMu.Unlock() - if cb != nil { - cb({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ lifecycleConvertParam $p }}{{ end }}) - } -{{ if $f.Returns }} return nil -{{ end }}} -{{ end }} diff --git a/templates/bridge_registry.go.tmpl b/templates/bridge_registry.go.tmpl deleted file mode 100644 index d3fb08f..0000000 --- a/templates/bridge_registry.go.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -import "sync" - -var ( - bridgeCBMu sync.Mutex - bridgeCBMap = map[uintptr]interface{}{} - bridgeCBNext uintptr -) - -func bridgeRegisterCB(cb interface{}) uintptr { - bridgeCBMu.Lock() - bridgeCBNext++ - id := bridgeCBNext - bridgeCBMap[id] = cb - bridgeCBMu.Unlock() - return id -} - -func bridgeUnregisterCB(id uintptr) { - bridgeCBMu.Lock() - delete(bridgeCBMap, id) - bridgeCBMu.Unlock() -} - -func bridgeLookupCB(id uintptr) interface{} { - bridgeCBMu.Lock() - cb := bridgeCBMap[id] - bridgeCBMu.Unlock() - return cb -} diff --git a/templates/callback_file.go.tmpl b/templates/callback_file.go.tmpl deleted file mode 100644 index bbc6a20..0000000 --- a/templates/callback_file.go.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -// {{ .Callback.GoCallbackType }} is the Go function type for the {{ .Callback.SpecName }} callback. -type {{ .Callback.GoCallbackType }} {{ .Callback.GoCallbackSig }} diff --git a/templates/errors.go.tmpl b/templates/errors.go.tmpl deleted file mode 100644 index ae0a318..0000000 --- a/templates/errors.go.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} -{{ if or .ErrorEnums .Methods }} -import "fmt" -{{ if .ErrorEnums }}{{ $ee := index .ErrorEnums 0 }} -// Error represents an NDK error code. -type Error int32 - -const ( -{{- range $ee.Values }} -{{- if ne .SpecName $ee.SuccessValue }} - {{ .GoName }} Error = {{ .Value }} -{{- end }} -{{- end }} -) - -func (e Error) Error() string { - return fmt.Sprintf("{{ $ee.Prefix }}: error %d", int(e)) -} -{{- else }} -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} -{{- end }} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} -{{- end }} diff --git a/templates/functions.go.tmpl b/templates/functions.go.tmpl deleted file mode 100644 index e334c68..0000000 --- a/templates/functions.go.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} -{{ if .FreeFunctions }} -import ( - {{ if anyDurationFreeFunc .FreeFunctions }}"time" - {{ end }}{{ if anyUnsafeFreeFunc .FreeFunctions }}"unsafe" - {{ end }} - capi "{{ .SourcePackage }}" -) -{{ range $f := .FreeFunctions }} -{{- if $f.OutputParams }} -{{- if $f.ReturnsBool }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, bool) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ok := capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - if !ok { - return {{ range $op := $f.OutputParams }}{{ zeroValue $op }}, {{ end }}false - } - return {{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}true -} -{{- else if eq $f.Returns "" }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - return {{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}{{ end }} -} -{{- else }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, error) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ret := capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - if err := result(int32(ret)); err != nil { - return {{ range $op := $f.OutputParams }}{{ zeroValue $op }}, {{ end }}err - } - return {{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}nil -} -{{- end }} -{{- else }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}){{ if $f.Returns }} {{ $f.Returns }}{{ end }} { -{{ range $p := stringParams $f.Params }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }} {{ if $f.IsHandleReturn -}} - return &{{ trimStar $f.Returns }}{ptr: capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }})} - {{- else if $f.Returns -}} - return ({{ $f.Returns }})(capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }})) - {{- else -}} - capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}) - {{- end }} -} -{{- end }} -{{ end }} -{{- end }} diff --git a/templates/lifecycle.go.tmpl b/templates/lifecycle.go.tmpl deleted file mode 100644 index c3f0a45..0000000 --- a/templates/lifecycle.go.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} -{{ if .Lifecycle }} -import ( - "unsafe" - - capi "{{ .SourcePackage }}" -) - -// LifecycleCallbacks holds Go callbacks for {{ .Lifecycle.ActivityType }} lifecycle events. -type LifecycleCallbacks struct { -{{ if .Lifecycle.EntryCallback }} {{ .Lifecycle.EntryCallback }} func(*{{ .Lifecycle.GoActivityType }}) -{{ end }}{{ range $f := .Lifecycle.Fields }} {{ $f.GoName }} func(*{{ $.Lifecycle.GoActivityType }}{{ range skipSpecParams $f.Params 1 }}, {{ lifecycleGoParamType .Type }}{{ end }}) -{{ end }}} - -// SetLifecycleCallbacks registers callbacks for the lifecycle events. -func SetLifecycleCallbacks(cb LifecycleCallbacks) { - bridgeCB := capi.LifecycleCallbacks{} -{{ if .Lifecycle.EntryCallback }} if cb.{{ .Lifecycle.EntryCallback }} != nil { - fn := cb.{{ .Lifecycle.EntryCallback }} - bridgeCB.{{ .Lifecycle.EntryCallback }} = func(p0 unsafe.Pointer) { fn(New{{ $.Lifecycle.GoActivityType }}FromPointer(p0)) } - } -{{ end }}{{ range $f := .Lifecycle.Fields }} if cb.{{ $f.GoName }} != nil { - fn := cb.{{ $f.GoName }} - bridgeCB.{{ $f.GoName }} = func({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}p{{ $i }} {{ lifecycleGoParamType $p.Type }}{{ end }}) { - fn(New{{ $.Lifecycle.GoActivityType }}FromPointer(p0){{ range $i, $p := skipSpecParams $f.Params 1 }}, p{{ add $i 1 }}{{ end }}) - } - } -{{ end }} capi.BridgeSetLifecycleCallbacks(bridgeCB) -} -{{ end }} diff --git a/templates/package.go.tmpl b/templates/package.go.tmpl deleted file mode 100644 index 5d7a14c..0000000 --- a/templates/package.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// {{ .PackageDoc }} -package {{ .PackageName }} diff --git a/templates/type_alias_file.go.tmpl b/templates/type_alias_file.go.tmpl deleted file mode 100644 index 64917d9..0000000 --- a/templates/type_alias_file.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -import ( - capi "{{ .SourcePackage }}" -) - -type {{ .Alias.GoName }} = capi.{{ .Alias.CapiType }} diff --git a/templates/type_file.go.tmpl b/templates/type_file.go.tmpl deleted file mode 100644 index 834904d..0000000 --- a/templates/type_file.go.tmpl +++ /dev/null @@ -1,275 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -import ( -{{- if anyDurationParam .Methods .FreeFunctions }} - "time" -{{- end }} - "unsafe" - - capi "{{ .SourcePackage }}" -) - -// {{ .Type.GoName }} wraps the NDK {{ .Type.CapiType }} handle. -type {{ .Type.GoName }} struct { - ptr *capi.{{ .Type.CapiType }} -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *{{ .Type.GoName }}) cptr() *capi.{{ .Type.CapiType }} { - if h == nil { - return nil - } - return h.ptr -} -{{ if .Type.Constructor }} -{{ if .Type.ConstructorReturnsPointer }} -// New{{ .Type.GoName }} creates a new {{ .Type.GoName }}. -func New{{ .Type.GoName }}({{ range $i, $p := .Type.ConstructorParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) *{{ .Type.GoName }} { - return &{{ .Type.GoName }}{ptr: capi.{{ .Type.Constructor }}({{ range $i, $p := .Type.ConstructorParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }})} -} -{{ else }} -// New{{ .Type.GoName }} creates a new {{ .Type.GoName }}. -func New{{ .Type.GoName }}({{ range $i, $p := .Type.ConstructorParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) (*{{ .Type.GoName }}, error) { -{{ range $p := stringParams .Type.ConstructorParams }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }} var ptr *capi.{{ .Type.CapiType }} - if err := result(capi.{{ .Type.Constructor }}({{ range $p := .Type.ConstructorParams }}{{ capiArg $p }}, {{ end }}&ptr)); err != nil { - return nil, err - } - return &{{ .Type.GoName }}{ptr: ptr}, nil -} -{{ end }} -{{ end }} -{{ if .Type.Destructor }} -// Close releases the underlying NDK handle. -func (h *{{ .Type.GoName }}) Close() error { - if h.ptr == nil { - return nil - } - {{ if .Type.DestructorReturnsError -}} - err := result(capi.{{ .Type.Destructor }}(h.ptr)) - h.ptr = nil - return err - {{- else -}} - capi.{{ .Type.Destructor }}(h.ptr) - h.ptr = nil - return nil - {{- end }} -} -{{ end }} - -// New{{ .Type.GoName }}FromPointer wraps a raw {{ .Type.CapiType }} pointer. -func New{{ .Type.GoName }}FromPointer(ptr unsafe.Pointer) *{{ .Type.GoName }} { - return &{{ .Type.GoName }}{ptr: (*capi.{{ .Type.CapiType }})(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *{{ .Type.GoName }}) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *{{ .Type.GoName }}) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// New{{ .Type.GoName }}FromUintPtr wraps a uintptr as a {{ .Type.GoName }}. -// The caller must ensure ptr points to a valid {{ .Type.CapiType }}. -func New{{ .Type.GoName }}FromUintPtr(ptr uintptr) *{{ .Type.GoName }} { - return &{{ .Type.GoName }}{ptr: (*capi.{{ .Type.CapiType }})(unsafe.Pointer(ptr))} -} -{{ range $m := .Methods }} -{{- if $m.CustomCall }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := $m.CustomCall.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) error { - return result(capi.{{ $m.CName }}(h.ptr, {{ $m.CustomCall.Args }})) -} -{{- else if $m.OutputParams }} -{{- if $m.ReturnsBool }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterOutputParams (skipAndFilterOut $m.Params) $m.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $m.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, bool) { -{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ok := capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}) - if !ok { - return {{ range $op := $m.OutputParams }}{{ zeroValue $op }}, {{ end }}false - } - return {{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}true -} -{{- else if eq $m.Returns "" }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterOutputParams (skipAndFilterOut $m.Params) $m.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $m.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}) { -{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}) - return {{ range $i, $op := $m.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}{{ end }} -} -{{- else }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterOutputParams (skipAndFilterOut $m.Params) $m.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $m.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, error) { -{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ret := capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}) - if err := result(ret); err != nil { - return {{ range $op := $m.OutputParams }}{{ zeroValue $op }}, {{ end }}err - } - return {{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}nil -} -{{- end }} -{{- else if and $m.CallbackParam $m.ReturnsNew }} -// {{ $m.GoName }} creates a new {{ $m.ReturnsNew }} from this {{ $m.ReceiverType }}. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := callbackVisibleParams $m.Params $m.CallbackParam }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}{{ if callbackVisibleParams $m.Params $m.CallbackParam }}, {{ end }}cbs {{ $m.CallbackGoType }}) (*{{ $m.ReturnsNew }}, error) { -{{ range $p := stringParams (callbackVisibleParams $m.Params $m.CallbackParam) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }} cbID := capi.BridgeRegister{{ $m.CallbackGoType }}(cbs) - var cbsC capi.{{ $m.CallbackStruct }} - capi.BridgeInit{{ $m.CallbackGoType }}(&cbsC, cbID) - var ptr *capi.{{ lookupCapiType $.OpaqueTypes $m.ReturnsNew }} - if err := result(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ callbackCapiArg . $m.CallbackParam }}{{ end }}, &ptr)); err != nil { - capi.BridgeUnregister{{ $m.CallbackGoType }}(cbID) - return nil, err - } - return &{{ $m.ReturnsNew }}{ptr: ptr}, nil -} -{{- else if $m.ReturnsListAccessor }} -// {{ $m.GoName }} returns items from the underlying list. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ([]{{ $m.ReturnsListAccessor.ItemType }}, error) { - var list *capi.{{ $m.ReturnsListAccessor.SpecName }} - if err := result(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}, &list)); err != nil { - return nil, err - } - defer capi.{{ $m.ReturnsListAccessor.DeleteFunc }}(list) - count := capi.Bridge{{ $m.ReturnsListAccessor.SpecName }}Count(list) - items := make([]{{ $m.ReturnsListAccessor.ItemType }}, count) - for i := range items { - items[i] = capi.Bridge{{ $m.ReturnsListAccessor.SpecName }}Item(list, i) - } - return items, nil -} -{{- else if $m.FixedParams }} -{{- if $m.ReturnsNew }} -// {{ $m.GoName }} creates a new {{ $m.ReturnsNew }} from this {{ $m.ReceiverType }}. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterFixedParams (skipAndFilterOut $m.Params) $m.FixedParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) (*{{ $m.ReturnsNew }}, error) { - var ptr *capi.{{ lookupCapiType $.OpaqueTypes $m.ReturnsNew }} - if err := result(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArgOrFixed . $m.FixedParams }}{{ end }}, &ptr)); err != nil { - return nil, err - } - return &{{ $m.ReturnsNew }}{ptr: ptr}, nil -} -{{- else if eq $m.Returns "" }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterFixedParams (skipAndFilterOut $m.Params) $m.FixedParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) { - capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArgOrFixed . $m.FixedParams }}{{ end }}) -} -{{- else }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterFixedParams (skipAndFilterOut $m.Params) $m.FixedParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) error { - return result(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArgOrFixed . $m.FixedParams }}{{ end }})) -} -{{- end }} -{{ else if $m.Chain }} -// {{ $m.GoName }} sets a property and returns the receiver for chaining. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) *{{ $m.ReceiverType }} { - capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}) - return h -} -{{ else if and $m.Pure (ne $m.Returns "") }} -// {{ $m.GoName }} returns the value directly. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) {{ $m.Returns }} { - return ({{ $m.Returns }})(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }})) -} -{{ else if $m.ReturnsNew }} -{{ if $m.ReturnsNewDirect }} -// {{ $m.GoName }} creates a new {{ $m.ReturnsNew }} from this {{ $m.ReceiverType }}. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) *{{ $m.ReturnsNew }} { - return &{{ $m.ReturnsNew }}{ptr: capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }})} -} -{{ else }} -// {{ $m.GoName }} creates a new {{ $m.ReturnsNew }} from this {{ $m.ReceiverType }}. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) (*{{ $m.ReturnsNew }}, error) { -{{ range $p := stringParams (skipAndFilterOut $m.Params) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }} var ptr *capi.{{ lookupCapiType $.OpaqueTypes $m.ReturnsNew }} - if err := result(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}, &ptr)); err != nil { - return nil, err - } - return &{{ $m.ReturnsNew }}{ptr: ptr}, nil -} -{{ end }} -{{ else if $m.ReturnsFrames }} -// {{ $m.GoName }} calls the underlying NDK function and returns the frame count. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) (int32, error) { -{{- if $m.BufGoType }} - r := capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArgBuf . $m.BufGoType }}{{ end }}) -{{- else }} - r := capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}) -{{- end }} - if r < 0 { - return 0, Error(r) - } - return int32(r), nil -} -{{ else if eq $m.Returns "" }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) { - capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}) -} -{{ else }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) error { - return result(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }})) -} -{{ end }} -{{- end }} -{{ range $f := .FreeFunctions }} -{{- if $f.OutputParams }} -{{- if $f.ReturnsBool }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, bool) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ok := capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - if !ok { - return {{ range $op := $f.OutputParams }}{{ zeroValue $op }}, {{ end }}false - } - return {{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}true -} -{{- else if eq $f.Returns "" }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - return {{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}{{ end }} -} -{{- else }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, error) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ret := capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - if err := result(ret); err != nil { - return {{ range $op := $f.OutputParams }}{{ zeroValue $op }}, {{ end }}err - } - return {{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}nil -} -{{- end }} -{{- else }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}){{ if $f.Returns }} {{ $f.Returns }}{{ end }} { -{{ range $p := stringParams $f.Params }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }} {{ if $f.IsHandleReturn -}} - return &{{ trimStar $f.Returns }}{ptr: capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }})} - {{- else if $f.Returns -}} - return ({{ $f.Returns }})(capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }})) - {{- else -}} - capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}) - {{- end }} -} -{{- end }} -{{ end }} diff --git a/templates/value_enum_file.go.tmpl b/templates/value_enum_file.go.tmpl deleted file mode 100644 index 03aefa1..0000000 --- a/templates/value_enum_file.go.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} -{{ if .Enum.StringMethod }} -import "fmt" -{{ end }} -type {{ .Enum.GoName }} {{ .Enum.BaseType }} - -const ( -{{- range .Enum.Values }} - {{ .GoName }} {{ $.Enum.GoName }} = {{ if .ValueStr }}{{ .ValueStr }}{{ else }}{{ .Value }}{{ end }} -{{- end }} -) -{{ if .Enum.StringMethod }} -func (v {{ .Enum.GoName }}) String() string { - switch v { - {{- range .Enum.Values }} - case {{ .GoName }}: - return "{{ .GoName }}" - {{- end }} - default: - return fmt.Sprintf("{{ .Enum.GoName }}(%d)", int(v)) - } -} -{{ end }} diff --git a/templates/value_struct_file.go.tmpl b/templates/value_struct_file.go.tmpl deleted file mode 100644 index b96936a..0000000 --- a/templates/value_struct_file.go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -import ( - "unsafe" - - capi "{{ .SourcePackage }}" -) - -// {{ .Type.GoName }} is a Go value type mirroring the NDK {{ .Type.CapiType }} C struct. -// Fields are layout-compatible with the C struct for zero-copy conversion. -type {{ .Type.GoName }} struct { -{{ range $f := .Type.Fields }} {{ $f.GoName }} {{ $f.GoType }} -{{ end }}} - -// cptr returns a pointer to the capi representation. -// The Go struct is layout-compatible with the C struct. -func (s *{{ .Type.GoName }}) cptr() *capi.{{ .Type.CapiType }} { - return (*capi.{{ .Type.CapiType }})(unsafe.Pointer(s)) -} - -// {{ lowerFirst .Type.GoName }}FromCapi creates a {{ .Type.GoName }} from a capi pointer. -func {{ lowerFirst .Type.GoName }}FromCapi(c *capi.{{ .Type.CapiType }}) *{{ .Type.GoName }} { - return (*{{ .Type.GoName }})(unsafe.Pointer(c)) -} diff --git a/tests/e2e/audio-inject/main.go b/tests/e2e/audio-inject/main.go deleted file mode 100644 index 8c1864d..0000000 --- a/tests/e2e/audio-inject/main.go +++ /dev/null @@ -1,93 +0,0 @@ -// Audio injector: streams a sine wave to the Android emulator's virtual -// microphone via the gRPC injectAudio API. -// -// Usage: audio-inject -port 8554 -freq 440 -duration 3s -package main - -import ( - "context" - "encoding/binary" - "flag" - "fmt" - "io" - "log" - "math" - "time" - - emupb "github.com/AndroidGoLab/ndk/tests/e2e/audio-inject/proto/emupb" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" -) - -func main() { - port := flag.Int("port", 8554, "emulator gRPC port") - freq := flag.Float64("freq", 440, "sine wave frequency in Hz") - dur := flag.Duration("duration", 3*time.Second, "injection duration") - sampleRate := flag.Uint64("rate", 48000, "sample rate in Hz") - flag.Parse() - - addr := fmt.Sprintf("localhost:%d", *port) - log.Printf("connecting to emulator gRPC at %s", addr) - - conn, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - log.Fatalf("grpc dial: %v", err) - } - defer conn.Close() - - client := emupb.NewEmulatorControllerClient(conn) - stream, err := client.InjectAudio(context.Background()) - if err != nil { - log.Fatalf("InjectAudio: %v", err) - } - - // Send audio in 10ms chunks. - samplesPerChunk := int(*sampleRate / 100) - totalSamples := int(float64(*sampleRate) * dur.Seconds()) - sent := 0 - phase := 0.0 - phaseInc := 2.0 * math.Pi * *freq / float64(*sampleRate) - - format := &emupb.AudioFormat{ - SamplingRate: *sampleRate, - Channels: emupb.AudioFormat_Mono, - Format: emupb.AudioFormat_AUD_FMT_S16, - } - - for sent < totalSamples { - n := samplesPerChunk - if sent+n > totalSamples { - n = totalSamples - sent - } - - buf := make([]byte, n*2) // 2 bytes per S16LE sample - for i := 0; i < n; i++ { - sample := int16(math.Sin(phase) * 0.8 * 32767) - binary.LittleEndian.PutUint16(buf[i*2:], uint16(sample)) - phase += phaseInc - } - - pkt := &emupb.AudioPacket{ - Audio: buf, - } - if sent == 0 { - pkt.Format = format - } - - if err := stream.Send(pkt); err != nil { - if err == io.EOF { - break - } - log.Fatalf("send: %v", err) - } - sent += n - - // Pace at roughly real-time to avoid overflowing the 300ms buffer. - time.Sleep(10 * time.Millisecond) - } - - if _, err := stream.CloseAndRecv(); err != nil && err != io.EOF { - log.Printf("close stream: %v", err) - } - log.Printf("injected %d samples (%.2fs) at %d Hz", sent, float64(sent)/float64(*sampleRate), *sampleRate) -} diff --git a/tests/e2e/audio-inject/proto/emulator_controller.proto b/tests/e2e/audio-inject/proto/emulator_controller.proto deleted file mode 100644 index ba237e1..0000000 --- a/tests/e2e/audio-inject/proto/emulator_controller.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; - -package android.emulation.control; - -option go_package = "github.com/xaionaro-go/ndk/tests/e2e/audio-inject/proto/emupb"; - -import "google/protobuf/empty.proto"; - -service EmulatorController { - // Injects audio packets to the android microphone. - rpc injectAudio(stream AudioPacket) returns (google.protobuf.Empty) {} -} - -message AudioFormat { - enum SampleFormat { - AUD_FMT_U8 = 0; - AUD_FMT_S16 = 1; - } - enum Channels { - Mono = 0; - Stereo = 1; - } - uint64 samplingRate = 1; - Channels channels = 2; - SampleFormat format = 3; -} - -message AudioPacket { - AudioFormat format = 1; - uint64 timestamp = 2; - bytes audio = 3; -} diff --git a/tests/e2e/audio-inject/proto/emupb/emulator_controller.pb.go b/tests/e2e/audio-inject/proto/emupb/emulator_controller.pb.go deleted file mode 100644 index 2e80dbb..0000000 --- a/tests/e2e/audio-inject/proto/emupb/emulator_controller.pb.go +++ /dev/null @@ -1,318 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc v3.21.12 -// source: emulator_controller.proto - -package emupb - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type AudioFormat_SampleFormat int32 - -const ( - AudioFormat_AUD_FMT_U8 AudioFormat_SampleFormat = 0 - AudioFormat_AUD_FMT_S16 AudioFormat_SampleFormat = 1 -) - -// Enum value maps for AudioFormat_SampleFormat. -var ( - AudioFormat_SampleFormat_name = map[int32]string{ - 0: "AUD_FMT_U8", - 1: "AUD_FMT_S16", - } - AudioFormat_SampleFormat_value = map[string]int32{ - "AUD_FMT_U8": 0, - "AUD_FMT_S16": 1, - } -) - -func (x AudioFormat_SampleFormat) Enum() *AudioFormat_SampleFormat { - p := new(AudioFormat_SampleFormat) - *p = x - return p -} - -func (x AudioFormat_SampleFormat) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (AudioFormat_SampleFormat) Descriptor() protoreflect.EnumDescriptor { - return file_emulator_controller_proto_enumTypes[0].Descriptor() -} - -func (AudioFormat_SampleFormat) Type() protoreflect.EnumType { - return &file_emulator_controller_proto_enumTypes[0] -} - -func (x AudioFormat_SampleFormat) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use AudioFormat_SampleFormat.Descriptor instead. -func (AudioFormat_SampleFormat) EnumDescriptor() ([]byte, []int) { - return file_emulator_controller_proto_rawDescGZIP(), []int{0, 0} -} - -type AudioFormat_Channels int32 - -const ( - AudioFormat_Mono AudioFormat_Channels = 0 - AudioFormat_Stereo AudioFormat_Channels = 1 -) - -// Enum value maps for AudioFormat_Channels. -var ( - AudioFormat_Channels_name = map[int32]string{ - 0: "Mono", - 1: "Stereo", - } - AudioFormat_Channels_value = map[string]int32{ - "Mono": 0, - "Stereo": 1, - } -) - -func (x AudioFormat_Channels) Enum() *AudioFormat_Channels { - p := new(AudioFormat_Channels) - *p = x - return p -} - -func (x AudioFormat_Channels) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (AudioFormat_Channels) Descriptor() protoreflect.EnumDescriptor { - return file_emulator_controller_proto_enumTypes[1].Descriptor() -} - -func (AudioFormat_Channels) Type() protoreflect.EnumType { - return &file_emulator_controller_proto_enumTypes[1] -} - -func (x AudioFormat_Channels) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use AudioFormat_Channels.Descriptor instead. -func (AudioFormat_Channels) EnumDescriptor() ([]byte, []int) { - return file_emulator_controller_proto_rawDescGZIP(), []int{0, 1} -} - -type AudioFormat struct { - state protoimpl.MessageState `protogen:"open.v1"` - SamplingRate uint64 `protobuf:"varint,1,opt,name=samplingRate,proto3" json:"samplingRate,omitempty"` - Channels AudioFormat_Channels `protobuf:"varint,2,opt,name=channels,proto3,enum=android.emulation.control.AudioFormat_Channels" json:"channels,omitempty"` - Format AudioFormat_SampleFormat `protobuf:"varint,3,opt,name=format,proto3,enum=android.emulation.control.AudioFormat_SampleFormat" json:"format,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AudioFormat) Reset() { - *x = AudioFormat{} - mi := &file_emulator_controller_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AudioFormat) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AudioFormat) ProtoMessage() {} - -func (x *AudioFormat) ProtoReflect() protoreflect.Message { - mi := &file_emulator_controller_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AudioFormat.ProtoReflect.Descriptor instead. -func (*AudioFormat) Descriptor() ([]byte, []int) { - return file_emulator_controller_proto_rawDescGZIP(), []int{0} -} - -func (x *AudioFormat) GetSamplingRate() uint64 { - if x != nil { - return x.SamplingRate - } - return 0 -} - -func (x *AudioFormat) GetChannels() AudioFormat_Channels { - if x != nil { - return x.Channels - } - return AudioFormat_Mono -} - -func (x *AudioFormat) GetFormat() AudioFormat_SampleFormat { - if x != nil { - return x.Format - } - return AudioFormat_AUD_FMT_U8 -} - -type AudioPacket struct { - state protoimpl.MessageState `protogen:"open.v1"` - Format *AudioFormat `protobuf:"bytes,1,opt,name=format,proto3" json:"format,omitempty"` - Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Audio []byte `protobuf:"bytes,3,opt,name=audio,proto3" json:"audio,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AudioPacket) Reset() { - *x = AudioPacket{} - mi := &file_emulator_controller_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AudioPacket) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AudioPacket) ProtoMessage() {} - -func (x *AudioPacket) ProtoReflect() protoreflect.Message { - mi := &file_emulator_controller_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AudioPacket.ProtoReflect.Descriptor instead. -func (*AudioPacket) Descriptor() ([]byte, []int) { - return file_emulator_controller_proto_rawDescGZIP(), []int{1} -} - -func (x *AudioPacket) GetFormat() *AudioFormat { - if x != nil { - return x.Format - } - return nil -} - -func (x *AudioPacket) GetTimestamp() uint64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *AudioPacket) GetAudio() []byte { - if x != nil { - return x.Audio - } - return nil -} - -var File_emulator_controller_proto protoreflect.FileDescriptor - -const file_emulator_controller_proto_rawDesc = "" + - "\n" + - "\x19emulator_controller.proto\x12\x19android.emulation.control\x1a\x1bgoogle/protobuf/empty.proto\"\x9e\x02\n" + - "\vAudioFormat\x12\"\n" + - "\fsamplingRate\x18\x01 \x01(\x04R\fsamplingRate\x12K\n" + - "\bchannels\x18\x02 \x01(\x0e2/.android.emulation.control.AudioFormat.ChannelsR\bchannels\x12K\n" + - "\x06format\x18\x03 \x01(\x0e23.android.emulation.control.AudioFormat.SampleFormatR\x06format\"/\n" + - "\fSampleFormat\x12\x0e\n" + - "\n" + - "AUD_FMT_U8\x10\x00\x12\x0f\n" + - "\vAUD_FMT_S16\x10\x01\" \n" + - "\bChannels\x12\b\n" + - "\x04Mono\x10\x00\x12\n" + - "\n" + - "\x06Stereo\x10\x01\"\x81\x01\n" + - "\vAudioPacket\x12>\n" + - "\x06format\x18\x01 \x01(\v2&.android.emulation.control.AudioFormatR\x06format\x12\x1c\n" + - "\ttimestamp\x18\x02 \x01(\x04R\ttimestamp\x12\x14\n" + - "\x05audio\x18\x03 \x01(\fR\x05audio2g\n" + - "\x12EmulatorController\x12Q\n" + - "\vinjectAudio\x12&.android.emulation.control.AudioPacket\x1a\x16.google.protobuf.Empty\"\x00(\x01B?Z=github.com/AndroidGoLab/ndk/tests/e2e/audio-inject/proto/emupbb\x06proto3" - -var ( - file_emulator_controller_proto_rawDescOnce sync.Once - file_emulator_controller_proto_rawDescData []byte -) - -func file_emulator_controller_proto_rawDescGZIP() []byte { - file_emulator_controller_proto_rawDescOnce.Do(func() { - file_emulator_controller_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_emulator_controller_proto_rawDesc), len(file_emulator_controller_proto_rawDesc))) - }) - return file_emulator_controller_proto_rawDescData -} - -var file_emulator_controller_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_emulator_controller_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_emulator_controller_proto_goTypes = []any{ - (AudioFormat_SampleFormat)(0), // 0: android.emulation.control.AudioFormat.SampleFormat - (AudioFormat_Channels)(0), // 1: android.emulation.control.AudioFormat.Channels - (*AudioFormat)(nil), // 2: android.emulation.control.AudioFormat - (*AudioPacket)(nil), // 3: android.emulation.control.AudioPacket - (*emptypb.Empty)(nil), // 4: google.protobuf.Empty -} -var file_emulator_controller_proto_depIdxs = []int32{ - 1, // 0: android.emulation.control.AudioFormat.channels:type_name -> android.emulation.control.AudioFormat.Channels - 0, // 1: android.emulation.control.AudioFormat.format:type_name -> android.emulation.control.AudioFormat.SampleFormat - 2, // 2: android.emulation.control.AudioPacket.format:type_name -> android.emulation.control.AudioFormat - 3, // 3: android.emulation.control.EmulatorController.injectAudio:input_type -> android.emulation.control.AudioPacket - 4, // 4: android.emulation.control.EmulatorController.injectAudio:output_type -> google.protobuf.Empty - 4, // [4:5] is the sub-list for method output_type - 3, // [3:4] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_emulator_controller_proto_init() } -func file_emulator_controller_proto_init() { - if File_emulator_controller_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_emulator_controller_proto_rawDesc), len(file_emulator_controller_proto_rawDesc)), - NumEnums: 2, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_emulator_controller_proto_goTypes, - DependencyIndexes: file_emulator_controller_proto_depIdxs, - EnumInfos: file_emulator_controller_proto_enumTypes, - MessageInfos: file_emulator_controller_proto_msgTypes, - }.Build() - File_emulator_controller_proto = out.File - file_emulator_controller_proto_goTypes = nil - file_emulator_controller_proto_depIdxs = nil -} diff --git a/tests/e2e/audio-inject/proto/emupb/emulator_controller_grpc.pb.go b/tests/e2e/audio-inject/proto/emupb/emulator_controller_grpc.pb.go deleted file mode 100644 index 4a757a9..0000000 --- a/tests/e2e/audio-inject/proto/emupb/emulator_controller_grpc.pb.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc v3.21.12 -// source: emulator_controller.proto - -package emupb - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - EmulatorController_InjectAudio_FullMethodName = "/android.emulation.control.EmulatorController/injectAudio" -) - -// EmulatorControllerClient is the client API for EmulatorController service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type EmulatorControllerClient interface { - // Injects audio packets to the android microphone. - InjectAudio(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[AudioPacket, emptypb.Empty], error) -} - -type emulatorControllerClient struct { - cc grpc.ClientConnInterface -} - -func NewEmulatorControllerClient(cc grpc.ClientConnInterface) EmulatorControllerClient { - return &emulatorControllerClient{cc} -} - -func (c *emulatorControllerClient) InjectAudio(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[AudioPacket, emptypb.Empty], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &EmulatorController_ServiceDesc.Streams[0], EmulatorController_InjectAudio_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &grpc.GenericClientStream[AudioPacket, emptypb.Empty]{ClientStream: stream} - return x, nil -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type EmulatorController_InjectAudioClient = grpc.ClientStreamingClient[AudioPacket, emptypb.Empty] - -// EmulatorControllerServer is the server API for EmulatorController service. -// All implementations must embed UnimplementedEmulatorControllerServer -// for forward compatibility. -type EmulatorControllerServer interface { - // Injects audio packets to the android microphone. - InjectAudio(grpc.ClientStreamingServer[AudioPacket, emptypb.Empty]) error - mustEmbedUnimplementedEmulatorControllerServer() -} - -// UnimplementedEmulatorControllerServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedEmulatorControllerServer struct{} - -func (UnimplementedEmulatorControllerServer) InjectAudio(grpc.ClientStreamingServer[AudioPacket, emptypb.Empty]) error { - return status.Error(codes.Unimplemented, "method InjectAudio not implemented") -} -func (UnimplementedEmulatorControllerServer) mustEmbedUnimplementedEmulatorControllerServer() {} -func (UnimplementedEmulatorControllerServer) testEmbeddedByValue() {} - -// UnsafeEmulatorControllerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to EmulatorControllerServer will -// result in compilation errors. -type UnsafeEmulatorControllerServer interface { - mustEmbedUnimplementedEmulatorControllerServer() -} - -func RegisterEmulatorControllerServer(s grpc.ServiceRegistrar, srv EmulatorControllerServer) { - // If the following call panics, it indicates UnimplementedEmulatorControllerServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&EmulatorController_ServiceDesc, srv) -} - -func _EmulatorController_InjectAudio_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(EmulatorControllerServer).InjectAudio(&grpc.GenericServerStream[AudioPacket, emptypb.Empty]{ServerStream: stream}) -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type EmulatorController_InjectAudioServer = grpc.ClientStreamingServer[AudioPacket, emptypb.Empty] - -// EmulatorController_ServiceDesc is the grpc.ServiceDesc for EmulatorController service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var EmulatorController_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "android.emulation.control.EmulatorController", - HandlerType: (*EmulatorControllerServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "injectAudio", - Handler: _EmulatorController_InjectAudio_Handler, - ClientStreams: true, - }, - }, - Metadata: "emulator_controller.proto", -} diff --git a/tests/e2e/audio-recording-e2e/main.go b/tests/e2e/audio-recording-e2e/main.go deleted file mode 100644 index 8530748..0000000 --- a/tests/e2e/audio-recording-e2e/main.go +++ /dev/null @@ -1,154 +0,0 @@ -// E2E test: exercises the full AAudio input stream lifecycle at 48 kHz. -// -// The test opens an AAudio capture stream, reads ~1 second of audio, -// and verifies the lifecycle completes without errors. If a 440 Hz -// tone is being injected (via host PulseAudio or emulator gRPC), the -// test also verifies frequency detection via the Goertzel algorithm. -// -// Pass with -detect-tone to require 440 Hz detection (exit 1 on failure). -// Without the flag, the test passes as long as AAudio works correctly. -// -// Exit 0 = PASS, exit 1 = FAIL. -package main - -import ( - "flag" - "fmt" - "math" - "os" - "time" - "unsafe" - - "github.com/AndroidGoLab/ndk/audio" -) - -// goertzelMagnitude computes the magnitude of a specific frequency in -// a buffer of int16 PCM samples using the Goertzel algorithm. -func goertzelMagnitude(samples []int16, targetFreq, sampleRate float64) float64 { - n := len(samples) - k := int(0.5 + float64(n)*targetFreq/sampleRate) - w := 2.0 * math.Pi * float64(k) / float64(n) - coeff := 2.0 * math.Cos(w) - - var s0, s1, s2 float64 - for _, sample := range samples { - s0 = coeff*s1 - s2 + float64(sample) - s2 = s1 - s1 = s0 - } - - return s1*s1 + s2*s2 - coeff*s1*s2 -} - -func main() { - detectTone := flag.Bool("detect-tone", false, "require 440 Hz tone detection (fail if not found)") - flag.Parse() - - builder, err := audio.NewStreamBuilder() - if err != nil { - fmt.Fprintf(os.Stderr, "FAIL: create builder: %v\n", err) - os.Exit(1) - } - defer builder.Close() - - builder. - SetDirection(audio.Input). - SetSampleRate(48000). - SetChannelCount(1). - SetFormat(audio.PcmI16). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - - stream, err := builder.Open() - if err != nil { - fmt.Fprintf(os.Stderr, "FAIL: open stream: %v\n", err) - os.Exit(1) - } - defer stream.Close() - - actualRate := float64(stream.SampleRate()) - fmt.Printf("stream opened: rate=%.0f Hz, channels=%d\n", actualRate, stream.ChannelCount()) - - if err := stream.Start(); err != nil { - fmt.Fprintf(os.Stderr, "FAIL: start stream: %v\n", err) - os.Exit(1) - } - - // Read ~1 second of audio. - totalFrames := int32(actualRate) - buf := make([]int16, 1024) - bufBytes := unsafe.Slice((*byte)(unsafe.Pointer(&buf[0])), len(buf)*int(unsafe.Sizeof(buf[0]))) - var captured []int16 - - for int32(len(captured)) < totalFrames { - framesToRead := int32(len(buf)) - if remaining := totalFrames - int32(len(captured)); remaining < framesToRead { - framesToRead = remaining - } - - n, err := stream.Read(bufBytes, framesToRead, time.Second) - if err != nil { - fmt.Fprintf(os.Stderr, "FAIL: read: %v\n", err) - os.Exit(1) - } - if n == 0 { - fmt.Fprintf(os.Stderr, "FAIL: read returned 0 frames\n") - os.Exit(1) - } - - captured = append(captured, buf[:n]...) - } - - if err := stream.Stop(); err != nil { - fmt.Fprintf(os.Stderr, "WARN: stop: %v\n", err) - } - - fmt.Printf("captured %d frames\n", len(captured)) - - // Compute peak amplitude. - var peak int16 - for _, s := range captured { - v := s - if v < 0 { - v = -v - } - if v > peak { - peak = v - } - } - fmt.Printf("peak amplitude: %d\n", peak) - - // Goertzel: check 440 Hz vs other frequencies. - targetFreq := 440.0 - targetMag := goertzelMagnitude(captured, targetFreq, actualRate) - - otherFreqs := []float64{200, 600, 1000, 2000, 5000} - var maxOtherMag float64 - for _, f := range otherFreqs { - mag := goertzelMagnitude(captured, f, actualRate) - fmt.Printf(" %.0f Hz magnitude: %.2e\n", f, mag) - if mag > maxOtherMag { - maxOtherMag = mag - } - } - fmt.Printf(" 440 Hz magnitude: %.2e\n", targetMag) - fmt.Printf(" max other magnitude: %.2e\n", maxOtherMag) - - toneDetected := targetMag > 1e10 && (maxOtherMag == 0 || targetMag/maxOtherMag >= 10) - - if toneDetected { - fmt.Println("PASS: 440 Hz tone detected") - return - } - - if *detectTone { - if targetMag < 1e10 { - fmt.Fprintf(os.Stderr, "FAIL: 440 Hz energy too low (%.2e < 1e10)\n", targetMag) - } else { - fmt.Fprintf(os.Stderr, "FAIL: 440 Hz not dominant (ratio=%.1f, need >=10)\n", targetMag/maxOtherMag) - } - os.Exit(1) - } - - fmt.Println("PASS: AAudio lifecycle OK (tone detection skipped — no injected signal)") -} diff --git a/tests/e2e/examples_test.go b/tests/e2e/examples_test.go deleted file mode 100644 index 85598fe..0000000 --- a/tests/e2e/examples_test.go +++ /dev/null @@ -1,174 +0,0 @@ -//go:build e2e - -// E2E tests that exercise NDK idiomatic Go bindings on an Android device. -// -// Each test creates and tears down its own resources. Tests tolerate -// emulator limitations (e.g. absent camera, limited sensors) by -// skipping rather than failing. -// -// Build the test binary: -// -// CGO_ENABLED=1 GOOS=android GOARCH=amd64 \ -// CC=$NDK/.../x86_64-linux-android35-clang \ -// go test -c -tags e2e -o tests/e2e/examples.test ./tests/e2e/ -// -// Run on device: -// -// adb push tests/e2e/examples.test /data/local/tmp/ -// adb shell /data/local/tmp/examples.test -test.v -package main - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/AndroidGoLab/ndk/audio" - "github.com/AndroidGoLab/ndk/camera" - "github.com/AndroidGoLab/ndk/config" - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/log" - "github.com/AndroidGoLab/ndk/media" - "github.com/AndroidGoLab/ndk/sensor" - "github.com/AndroidGoLab/ndk/thermal" - "github.com/AndroidGoLab/ndk/trace" -) - -func TestExample_AudioStreamInfo(t *testing.T) { - builder, err := audio.NewStreamBuilder() - require.NoError(t, err, "NewStreamBuilder") - defer builder.Close() - - builder. - SetSampleRate(44100). - SetChannelCount(1). - SetFormat(audio.PcmI16). - SetDirection(audio.Output) - - stream, err := builder.Open() - if err != nil { - t.Skipf("cannot open audio stream on this device: %v", err) - } - defer stream.Close() - - rate := stream.SampleRate() - assert.Greater(t, rate, int32(0), "SampleRate should be positive") - t.Logf("SampleRate: %d Hz", rate) - - chans := stream.ChannelCount() - assert.Greater(t, chans, int32(0), "ChannelCount should be positive") - t.Logf("ChannelCount: %d", chans) - - burst := stream.FramesPerBurst() - assert.Greater(t, burst, int32(0), "FramesPerBurst should be positive") - t.Logf("FramesPerBurst: %d", burst) -} - -func TestExample_CameraList(t *testing.T) { - mgr := camera.NewManager() - require.NotNil(t, mgr, "NewManager returned nil") - defer mgr.Close() - - ids, err := mgr.CameraIDList() - // On emulator without camera the list may be empty but no error. - assert.NoError(t, err, "CameraIDList should not return an error") - t.Logf("camera IDs: %v (count=%d)", ids, len(ids)) -} - -func TestExample_SensorList(t *testing.T) { - mgr := sensor.GetInstance() - require.NotNil(t, mgr, "GetInstance returned nil") - - accel := mgr.DefaultSensor(sensor.Accelerometer) - require.NotNil(t, accel, "DefaultSensor(Accelerometer) returned nil") - - name := accel.Name() - if name == "" { - t.Skip("accelerometer not available on this emulator") - } - - assert.NotEmpty(t, name, "sensor name should be non-empty") - t.Logf("accelerometer: name=%q vendor=%q type=%s resolution=%.6f minDelay=%d", - name, accel.Vendor(), sensor.Type(accel.Type()), accel.Resolution(), accel.MinDelay()) -} - -func TestExample_ThermalStatus(t *testing.T) { - mgr := thermal.NewManager() - require.NotNil(t, mgr, "NewManager returned nil") - defer mgr.Close() - - // CurrentStatus should not panic; on a cool emulator it returns StatusNone. - status := mgr.CurrentStatus() - assert.GreaterOrEqual(t, int32(status), int32(thermal.StatusError), - "status should be a valid ThermalStatus value") - t.Logf("thermal status: %s (%d)", status, status) -} - -func TestExample_EGLInfo(t *testing.T) { - var defaultDisplay egl.EGLNativeDisplayType - dpy := egl.GetDisplay(defaultDisplay) - require.NotNil(t, dpy, "GetDisplay returned EGL_NO_DISPLAY") - - var major, minor egl.Int - ret := egl.Initialize(dpy, &major, &minor) - require.NotEqual(t, egl.Boolean(0), ret, - "Initialize failed, error=0x%X", egl.GetError()) - defer egl.Terminate(dpy) - - t.Logf("EGL %d.%d", major, minor) - - vendor := egl.QueryString(dpy, egl.EGL_VENDOR) - assert.NotEmpty(t, vendor, "EGL vendor string should be non-empty") - t.Logf("EGL vendor: %s", vendor) -} - -func TestExample_MediaCodecs(t *testing.T) { - t.Run("Encoder", func(t *testing.T) { - enc := media.NewEncoder("video/avc") - require.NotNil(t, enc, "NewEncoder returned nil") - assert.NotNil(t, enc.Pointer(), "encoder Pointer should be non-nil") - t.Log("video/avc encoder created") - enc.Close() - }) - - t.Run("Decoder", func(t *testing.T) { - dec := media.NewDecoder("video/avc") - require.NotNil(t, dec, "NewDecoder returned nil") - assert.NotNil(t, dec.Pointer(), "decoder Pointer should be non-nil") - t.Log("video/avc decoder created") - dec.Close() - }) -} - -func TestExample_ConfigShow(t *testing.T) { - cfg := config.NewConfig() - require.NotNil(t, cfg, "NewConfig returned nil") - defer cfg.Close() - - density := cfg.Density() - // An empty config returns 0 for density (no activity context), so - // only verify the call succeeds without panic. - t.Logf("density: %d", density) - - sdk := cfg.SdkVersion() - // Empty config returns 0 for sdk version, but the call must not crash. - t.Logf("SdkVersion: %d", sdk) - - t.Logf("ScreenSize: %d Orientation: %d ScreenDp: %dx%d", - cfg.ScreenSize(), cfg.Orientation(), - cfg.ScreenWidthDp(), cfg.ScreenHeightDp()) -} - -func TestExample_TraceEnabled(t *testing.T) { - // Just verify the call does not panic. - enabled := trace.IsEnabled() - t.Logf("trace.IsEnabled: %v", enabled) -} - -func TestExample_LogWrite(t *testing.T) { - ret := log.Write(int32(log.Info), "ndktest", "E2E test message") - assert.GreaterOrEqual(t, ret, int32(0), - "log.Write should return >= 0 (got %d)", ret) - t.Logf("log.Write returned: %d", ret) -} diff --git a/tests/e2e/main.go b/tests/e2e/main.go deleted file mode 100644 index f260f1f..0000000 --- a/tests/e2e/main.go +++ /dev/null @@ -1,1033 +0,0 @@ -// E2E test for ndk idiomatic Go packages on Android. -// Exercises EVERY NDK package through the generated idiomatic Go bindings. -// -// Build: -// -// CGO_ENABLED=1 GOOS=android GOARCH=amd64 \ -// CC=$NDK/.../x86_64-linux-android35-clang \ -// go build -o e2e/e2e_test ./e2e -// -// Run: -// -// adb push e2e_test /data/local/tmp/ && adb shell /data/local/tmp/e2e_test -package main - -/* -#include -#include - -// Vulkan struct creation helpers. -// Struct layout is a C concern; the actual Vulkan calls go through the -// idiomatic Go vulkan package. - -static void go_vk_create_info(void** out) { - static VkApplicationInfo appInfo = { - .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, - .pApplicationName = "ndk-e2e", - .applicationVersion = 1, - .pEngineName = "ndk", - .engineVersion = 1, - .apiVersion = VK_API_VERSION_1_0, - }; - static VkInstanceCreateInfo ci = { - .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, - .pApplicationInfo = &appInfo, - }; - *out = &ci; -} - -// Get physical device properties (struct layout requires C). -static void go_vk_device_props(void* physDev, char* name, uint32_t* apiVer) { - VkPhysicalDeviceProperties props; - vkGetPhysicalDeviceProperties((VkPhysicalDevice)physDev, &props); - strncpy(name, props.deviceName, 255); - name[255] = 0; - *apiVer = props.apiVersion; -} -*/ -import "C" - -import ( - "fmt" - "os" - "runtime" - "unsafe" - - "github.com/AndroidGoLab/ndk/audio" - "github.com/AndroidGoLab/ndk/bitmap" - "github.com/AndroidGoLab/ndk/camera" - "github.com/AndroidGoLab/ndk/choreographer" - "github.com/AndroidGoLab/ndk/config" - "github.com/AndroidGoLab/ndk/egl" - "github.com/AndroidGoLab/ndk/font" - "github.com/AndroidGoLab/ndk/gles2" - "github.com/AndroidGoLab/ndk/gles3" - "github.com/AndroidGoLab/ndk/hwbuf" - "github.com/AndroidGoLab/ndk/input" - "github.com/AndroidGoLab/ndk/log" - "github.com/AndroidGoLab/ndk/looper" - "github.com/AndroidGoLab/ndk/media" - "github.com/AndroidGoLab/ndk/permission" - "github.com/AndroidGoLab/ndk/sensor" - "github.com/AndroidGoLab/ndk/storage" - "github.com/AndroidGoLab/ndk/surfacecontrol" - "github.com/AndroidGoLab/ndk/thermal" - "github.com/AndroidGoLab/ndk/trace" - "github.com/AndroidGoLab/ndk/window" - - // Import-only packages (verify linking, no testable functions). - _ "github.com/AndroidGoLab/ndk/activity" - _ "github.com/AndroidGoLab/ndk/asset" - _ "github.com/AndroidGoLab/ndk/binder" - _ "github.com/AndroidGoLab/ndk/hint" - _ "github.com/AndroidGoLab/ndk/image" - _ "github.com/AndroidGoLab/ndk/midi" - _ "github.com/AndroidGoLab/ndk/net" - _ "github.com/AndroidGoLab/ndk/nnapi" - _ "github.com/AndroidGoLab/ndk/sharedmem" - _ "github.com/AndroidGoLab/ndk/surfacetexture" - _ "github.com/AndroidGoLab/ndk/sync" - _ "github.com/AndroidGoLab/ndk/vulkan" -) - - -// GL query constants not in generated enums. -const ( - glVendor gles2.Enum = 0x1F00 - glVersion gles2.Enum = 0x1F01 - glRenderer gles2.Enum = 0x1F02 - glExtensions gles2.Enum = 0x1F03 -) - -// GL3 constants not in generated enums. -const ( - glTextureWrapR gles3.GLenum = 0x8072 - glClampToEdge gles3.GLint = 0x812F - glBack gles3.GLenum = 0x0405 -) - -// Looper constants not in generated enums. -const ( - looperPrepareAllowNonCallbacks int32 = 1 - looperPollTimeout int32 = -3 -) - -var ( - passed int - failed int - skipped int -) - -func pass(name string) { - fmt.Printf(" PASS %s\n", name) - passed++ -} - -func passf(name, detail string) { - fmt.Printf(" PASS %s (%s)\n", name, detail) - passed++ -} - -func fail(name, reason string) { - fmt.Printf(" FAIL %s: %s\n", name, reason) - failed++ -} - -func skip(name, reason string) { - fmt.Printf(" SKIP %s: %s\n", name, reason) - skipped++ -} - -// goString converts a null-terminated C string (*byte) to a Go string. -func goString(p *byte) string { - if p == nil { - return "" - } - return C.GoString((*C.char)(unsafe.Pointer(p))) -} - -// ---- Test suites for each NDK module ---- - -func testTrace() { - fmt.Println("\n[trace] ndk/trace") - - enabled := trace.IsEnabled() - passf("trace.IsEnabled", fmt.Sprintf("%v", enabled)) - - trace.BeginSection("ndk_e2e_section") - trace.EndSection() - pass("trace.BeginSection/EndSection") - - trace.BeginAsyncSection("ndk_e2e_async", 42) - trace.EndAsyncSection("ndk_e2e_async", 42) - pass("trace.BeginAsyncSection/EndAsyncSection") - - trace.SetCounter("ndk_e2e_counter", 100) - pass("trace.SetCounter") -} - -func testSensor() { - fmt.Println("\n[sensor] ndk/sensor") - - mgr := sensor.GetInstance() - pass("sensor.GetInstance") - - accel := mgr.DefaultSensor(sensor.Accelerometer) - name := accel.Name() - if name == "" { - skip("sensor.DefaultSensor/Accelerometer", "not available") - } else { - typ := sensor.Type(accel.Type()) - vendor := accel.Vendor() - res := accel.Resolution() - delay := accel.MinDelay() - passf("sensor.DefaultSensor/Accelerometer", - fmt.Sprintf("name=%q type=%s vendor=%q res=%.6f minDelay=%d", - name, typ, vendor, res, delay)) - } - - for _, st := range []sensor.Type{sensor.Gyroscope, sensor.Light, sensor.Proximity} { - s := mgr.DefaultSensor(st) - sname := s.Name() - if sname == "" { - skip(fmt.Sprintf("sensor.DefaultSensor/%s", st), "not available") - } else { - passf(fmt.Sprintf("sensor.DefaultSensor/%s", st), fmt.Sprintf("name=%q", sname)) - } - } -} - -func testLooper() { - fmt.Println("\n[looper] ndk/looper") - - l := looper.Prepare(looperPrepareAllowNonCallbacks) - pass("looper.Prepare") - - l.Wake() - ret := looper.PollOnce(0, nil, nil, nil) - passf("looper.Wake+PollOnce", fmt.Sprintf("returned %d", ret)) - - ret = looper.PollOnce(1, nil, nil, nil) - if ret == looperPollTimeout { - pass("looper.PollOnce/timeout") - } else { - passf("looper.PollOnce/timeout", fmt.Sprintf("returned %d", ret)) - } -} - -func testConfig() { - fmt.Println("\n[config] ndk/config") - - cfg := config.NewConfig() - pass("config.NewConfig") - defer cfg.Close() - - // Language/Country take string (output param written by C). - // The string-based binding loses the output, but exercises the call path. - cfg.Language("\x00\x00\x00\x00\x00\x00\x00\x00") - passf("config.Language", "(called)") - - cfg.Country("\x00\x00\x00\x00\x00\x00\x00\x00") - passf("config.Country", "(called)") - - density := cfg.Density() - passf("config.Density", fmt.Sprintf("%d", density)) - - screenSize := cfg.ScreenSize() - passf("config.ScreenSize", fmt.Sprintf("%d", screenSize)) - - orientation := cfg.Orientation() - passf("config.Orientation", fmt.Sprintf("%d", orientation)) - - sdk := cfg.SdkVersion() - passf("config.SdkVersion", fmt.Sprintf("%d", sdk)) - - screenW := cfg.ScreenWidthDp() - screenH := cfg.ScreenHeightDp() - passf("config.ScreenWidthDp/ScreenHeightDp", fmt.Sprintf("%dx%d", screenW, screenH)) -} - -func testPermission() { - fmt.Println("\n[permission] ndk/permission") - - pid := permission.Pid_t(os.Getpid()) - uid := permission.Uid_t(os.Getuid()) - var result int32 - status := permission.CheckPermission("android.permission.INTERNET", pid, uid, &result) - passf("permission.CheckPermission", - fmt.Sprintf("INTERNET: status=%d result=%d (Granted=%d Denied=%d)", - status, result, permission.Granted, permission.Denied)) -} - -func testChoreographer() { - fmt.Println("\n[choreographer] ndk/choreographer") - - // Requires a looper on the current thread (set up in testLooper). - _ = choreographer.GetInstance() - pass("choreographer.GetInstance") -} - -func testEGL() { - fmt.Println("\n[egl] ndk/egl") - - var defaultDisplay egl.EGLNativeDisplayType - dpy := egl.GetDisplay(defaultDisplay) - if dpy == nil { - fail("egl.GetDisplay", "returned nil (EGL_NO_DISPLAY)") - return - } - pass("egl.GetDisplay") - - var major, minor egl.Int - ret := egl.Initialize(dpy, &major, &minor) - if ret == 0 { - fail("egl.Initialize", fmt.Sprintf("returned false, error=0x%X", egl.GetError())) - return - } - passf("egl.Initialize", fmt.Sprintf("EGL %d.%d", major, minor)) - - vendor := egl.QueryString(dpy, egl.EGL_VENDOR) - passf("egl.QueryString/VENDOR", vendor) - - version := egl.QueryString(dpy, egl.EGL_VERSION) - passf("egl.QueryString/VERSION", version) - - extensions := egl.QueryString(dpy, egl.EGL_EXTENSIONS) - if len(extensions) > 80 { - extensions = extensions[:80] + "..." - } - passf("egl.QueryString/EXTENSIONS", extensions) - - // Choose config supporting GLES3 (superset of GLES2). - attribs := []egl.Int{ - egl.SurfaceType, egl.PbufferBit, - egl.RenderableType, egl.OpenglEs3Bit, - egl.RedSize, 8, - egl.GreenSize, 8, - egl.BlueSize, 8, - egl.None, - } - var cfg egl.EGLConfig - var numConfig egl.Int - ret = egl.ChooseConfig(dpy, &attribs[0], &cfg, 1, &numConfig) - if ret == 0 || numConfig == 0 { - // Fallback to ES2-only config. - attribs[3] = egl.OpenglEs2Bit - ret = egl.ChooseConfig(dpy, &attribs[0], &cfg, 1, &numConfig) - if ret == 0 { - fail("egl.ChooseConfig", fmt.Sprintf("error=0x%X", egl.GetError())) - return - } - } - pass("egl.ChooseConfig") - - // Query config attrib. - var redSize egl.Int - egl.GetConfigAttrib(dpy, cfg, egl.RedSize, &redSize) - passf("egl.GetConfigAttrib/RED_SIZE", fmt.Sprintf("%d", redSize)) - - // ---- GLES2 context ---- - ctxAttribs2 := []egl.Int{egl.ContextClientVersion, 2, egl.None} - ctx2 := egl.CreateContext(dpy, cfg, nil, &ctxAttribs2[0]) - if ctx2 == nil { - fail("egl.CreateContext/ES2", fmt.Sprintf("error=0x%X", egl.GetError())) - egl.Terminate(dpy) - return - } - pass("egl.CreateContext/ES2") - - pbufAttribs := []egl.Int{egl.Width, 16, egl.Height, 16, egl.None} - surface := egl.CreatePbufferSurface(dpy, cfg, &pbufAttribs[0]) - if surface == nil { - fail("egl.CreatePbufferSurface", fmt.Sprintf("error=0x%X", egl.GetError())) - egl.DestroyContext(dpy, ctx2) - egl.Terminate(dpy) - return - } - pass("egl.CreatePbufferSurface") - - // Query surface. - var surfW egl.Int - egl.QuerySurface(dpy, surface, egl.Width, &surfW) - passf("egl.QuerySurface/WIDTH", fmt.Sprintf("%d", surfW)) - - ret = egl.MakeCurrent(dpy, surface, surface, ctx2) - if ret == 0 { - fail("egl.MakeCurrent/ES2", fmt.Sprintf("error=0x%X", egl.GetError())) - } else { - pass("egl.MakeCurrent/ES2") - - // Verify GetCurrentContext/Display/Surface. - curCtx := egl.GetCurrentContext() - if curCtx != nil { - pass("egl.GetCurrentContext") - } else { - fail("egl.GetCurrentContext", "returned nil") - } - curDpy := egl.GetCurrentDisplay() - if curDpy != nil { - pass("egl.GetCurrentDisplay") - } else { - fail("egl.GetCurrentDisplay", "returned nil") - } - - testGLES2() - } - - egl.MakeCurrent(dpy, nil, nil, nil) - egl.DestroyContext(dpy, ctx2) - pass("egl.DestroyContext/ES2") - - // ---- GLES3 context ---- - ctxAttribs3 := []egl.Int{egl.ContextMajorVersion, 3, egl.None} - ctx3 := egl.CreateContext(dpy, cfg, nil, &ctxAttribs3[0]) - if ctx3 == nil { - skip("egl.CreateContext/ES3", "GLES3 not available") - } else { - pass("egl.CreateContext/ES3") - ret = egl.MakeCurrent(dpy, surface, surface, ctx3) - if ret == 0 { - fail("egl.MakeCurrent/ES3", fmt.Sprintf("error=0x%X", egl.GetError())) - } else { - pass("egl.MakeCurrent/ES3") - testGLES3() - } - egl.MakeCurrent(dpy, nil, nil, nil) - egl.DestroyContext(dpy, ctx3) - pass("egl.DestroyContext/ES3") - } - - // Swap interval (valid even without window surface, just tests the call). - egl.SwapInterval(dpy, 1) - pass("egl.SwapInterval") - - // Query API. - api := egl.QueryAPI() - passf("egl.QueryAPI", fmt.Sprintf("0x%X", api)) - - egl.DestroySurface(dpy, surface) - pass("egl.DestroySurface") - egl.ReleaseThread() - pass("egl.ReleaseThread") - egl.Terminate(dpy) - pass("egl.Terminate") -} - -// glContextOK probes the GL context by clearing to blue and reading back a pixel. -// Returns false if the gfxstream GPU pipe is broken (all GL calls silently no-op). -func glContextOK() bool { - gles2.Viewport(0, 0, 16, 16) - gles2.ClearColor(0.0, 0.0, 1.0, 1.0) - gles2.Clear(gles2.Bitfield(gles2.ColorBufferBit)) - var rgba [4]byte - gles2.ReadPixels(0, 0, 1, 1, gles2.Rgba, gles2.UnsignedByte, unsafe.Pointer(&rgba[0])) - return rgba[2] > 200 -} - -func testGLES2() { - fmt.Println("\n[gles2] ndk/gles2 (requires EGL context)") - - renderer := goString((*byte)(unsafe.Pointer(gles2.GetString(glRenderer)))) - passf("gles2.GetString/RENDERER", renderer) - - version := goString((*byte)(unsafe.Pointer(gles2.GetString(glVersion)))) - passf("gles2.GetString/VERSION", version) - - vendor := goString((*byte)(unsafe.Pointer(gles2.GetString(glVendor)))) - passf("gles2.GetString/VENDOR", vendor) - - err := gles2.GetError() - if err == gles2.NoError { - pass("gles2.GetError (no error)") - } else { - fail("gles2.GetError", fmt.Sprintf("0x%X", err)) - } - - // Probe GL context: clear to blue and read back. If the emulator's gfxstream - // GPU pipe is broken (e.g. from rapid process restarts exhausting the pipe pool), - // all GL calls silently no-op and ReadPixels returns zeros. In that case, skip - // all GL tests since the failures are environmental, not binding-related. - if !glContextOK() { - skip("gles2.*", "GL context non-functional (gfxstream pipe broken, re-run test)") - return - } - - pass("gles2.Viewport") - pass("gles2.ClearColor+Clear") - pass("gles2.ReadPixels (blue)") - - // Shader lifecycle - vs := gles2.CreateShader(gles2.VertexShader) - if vs > 0 { - passf("gles2.CreateShader/VERTEX", fmt.Sprintf("id=%d", vs)) - gles2.DeleteShader(vs) - pass("gles2.DeleteShader") - } else { - fail("gles2.CreateShader/VERTEX", fmt.Sprintf("returned %d (glError=0x%X)", vs, gles2.GetError())) - } - - fs := gles2.CreateShader(gles2.FragmentShader) - if fs > 0 { - passf("gles2.CreateShader/FRAGMENT", fmt.Sprintf("id=%d", fs)) - gles2.DeleteShader(fs) - } else { - fail("gles2.CreateShader/FRAGMENT", fmt.Sprintf("returned %d (glError=0x%X)", fs, gles2.GetError())) - } - - prog := gles2.CreateProgram() - if prog > 0 { - passf("gles2.CreateProgram", fmt.Sprintf("id=%d", prog)) - gles2.DeleteProgram(prog) - pass("gles2.DeleteProgram") - } else { - fail("gles2.CreateProgram", fmt.Sprintf("returned %d (glError=0x%X)", prog, gles2.GetError())) - } - - // Texture lifecycle - var tex gles2.GLuint - gles2.GenTextures(1, &tex) - if tex > 0 { - passf("gles2.GenTextures", fmt.Sprintf("id=%d", tex)) - gles2.BindTexture(gles2.Texture2d, tex) - gles2.TexParameteri(gles2.Texture2d, gles2.TextureMinFilter, gles2.GLint(gles2.Nearest)) - pass("gles2.BindTexture+TexParameteri") - gles2.BindTexture(gles2.Texture2d, 0) - gles2.DeleteTextures(1, &tex) - pass("gles2.DeleteTextures") - } - - // Buffer lifecycle - var buf gles2.GLuint - gles2.GenBuffers(1, &buf) - if buf > 0 { - passf("gles2.GenBuffers", fmt.Sprintf("id=%d", buf)) - gles2.BindBuffer(gles2.ArrayBuffer, buf) - pass("gles2.BindBuffer") - gles2.BindBuffer(gles2.ArrayBuffer, 0) - gles2.DeleteBuffers(1, &buf) - pass("gles2.DeleteBuffers") - } - - // Framebuffer + Renderbuffer lifecycle - var fbo, rbo gles2.GLuint - gles2.GenFramebuffers(1, &fbo) - gles2.GenRenderbuffers(1, &rbo) - if fbo > 0 && rbo > 0 { - passf("gles2.GenFramebuffers+GenRenderbuffers", fmt.Sprintf("fbo=%d rbo=%d", fbo, rbo)) - gles2.BindFramebuffer(gles2.Framebuffer, fbo) - gles2.BindRenderbuffer(gles2.Renderbuffer, rbo) - pass("gles2.BindFramebuffer+BindRenderbuffer") - gles2.BindFramebuffer(gles2.Framebuffer, 0) - gles2.BindRenderbuffer(gles2.Renderbuffer, 0) - gles2.DeleteFramebuffers(1, &fbo) - gles2.DeleteRenderbuffers(1, &rbo) - pass("gles2.DeleteFramebuffers+DeleteRenderbuffers") - } - - // State functions - gles2.Enable(gles2.Blend) - gles2.BlendFunc(gles2.SrcAlpha, gles2.OneMinusSrcAlpha) - pass("gles2.Enable(Blend)+BlendFunc") - gles2.Disable(gles2.Blend) - - const glScissorTest gles2.Enum = 0x0C11 - gles2.Enable(glScissorTest) - gles2.Scissor(0, 0, 8, 8) - pass("gles2.Enable(ScissorTest)+Scissor") - gles2.Disable(glScissorTest) - - gles2.Enable(gles2.DepthTest) - gles2.DepthFunc(0x0201) // GL_LESS - gles2.DepthMask(gles2.Boolean(1)) - pass("gles2.DepthFunc+DepthMask") - gles2.Disable(gles2.DepthTest) - - gles2.LineWidth(1.0) - pass("gles2.LineWidth") - - gles2.PixelStorei(0x0D05, 1) // GL_PACK_ALIGNMENT - pass("gles2.PixelStorei") - - var maxTexSize gles2.GLint - gles2.GetIntegerv(0x0D33, &maxTexSize) // GL_MAX_TEXTURE_SIZE - passf("gles2.GetIntegerv/MAX_TEXTURE_SIZE", fmt.Sprintf("%d", maxTexSize)) - - gles2.Flush() - pass("gles2.Flush") - gles2.Finish() - pass("gles2.Finish") -} - -func testGLES3() { - fmt.Println("\n[gles3] ndk/gles3 (requires GLES3 context)") - - if !glContextOK() { - skip("gles3.*", "GL context non-functional (gfxstream pipe broken, re-run test)") - return - } - - // Vertex Array Objects (ES3 feature) - var vao gles3.GLuint - gles3.GenVertexArrays(1, &vao) - if vao > 0 { - passf("gles3.GenVertexArrays", fmt.Sprintf("id=%d", vao)) - gles3.BindVertexArray(vao) - pass("gles3.BindVertexArray") - gles3.BindVertexArray(0) - gles3.DeleteVertexArrays(1, &vao) - pass("gles3.DeleteVertexArrays") - } else { - // GenVertexArrays is the first GLES3 call after context switch. - // If it returns 0, the gfxstream pipe degraded during the ES2→ES3 - // context switch — skip remaining GLES3 tests. - skip("gles3.*", "GenVertexArrays returned 0 (gfxstream pipe degraded during context switch)") - return - } - - // Samplers (ES3 feature) - var sampler gles3.GLuint - gles3.GenSamplers(1, &sampler) - switch { - case sampler > 0: - passf("gles3.GenSamplers", fmt.Sprintf("id=%d", sampler)) - gles3.SamplerParameteri(sampler, glTextureWrapR, glClampToEdge) - pass("gles3.SamplerParameteri") - gles3.BindSampler(0, sampler) - pass("gles3.BindSampler") - gles3.BindSampler(0, 0) - gles3.DeleteSamplers(1, &sampler) - pass("gles3.DeleteSamplers") - case !glContextOK(): - skip("gles3.GenSamplers+", "gfxstream pipe degraded mid-test") - return - default: - fail("gles3.GenSamplers", "returned 0") - } - - // Queries (ES3 feature) - var query gles3.GLuint - gles3.GenQueries(1, &query) - switch { - case query > 0: - passf("gles3.GenQueries", fmt.Sprintf("id=%d", query)) - gles3.DeleteQueries(1, &query) - pass("gles3.DeleteQueries") - case !glContextOK(): - skip("gles3.GenQueries+", "gfxstream pipe degraded mid-test") - return - default: - fail("gles3.GenQueries", "returned 0") - } - - // Fence sync (ES3 feature) - sync := gles3.FenceSync(gles3.SyncGpuCommandsComplete, 0) - switch { - case sync != nil: - pass("gles3.FenceSync") - ret := gles3.ClientWaitSync(sync, gles3.SyncFlushCommandsBit, 1000000000) - passf("gles3.ClientWaitSync", fmt.Sprintf("returned 0x%X", ret)) - gles3.DeleteSync(sync) - pass("gles3.DeleteSync") - case !glContextOK(): - skip("gles3.FenceSync+", "gfxstream pipe degraded mid-test") - return - default: - fail("gles3.FenceSync", "returned nil") - } - - // Transform feedback objects (ES3 feature) - var tf gles3.GLuint - gles3.GenTransformFeedbacks(1, &tf) - switch { - case tf > 0: - passf("gles3.GenTransformFeedbacks", fmt.Sprintf("id=%d", tf)) - gles3.BindTransformFeedback(gles3.TransformFeedback, tf) - pass("gles3.BindTransformFeedback") - gles3.BindTransformFeedback(gles3.TransformFeedback, 0) - gles3.DeleteTransformFeedbacks(1, &tf) - pass("gles3.DeleteTransformFeedbacks") - case !glContextOK(): - skip("gles3.GenTransformFeedbacks+", "gfxstream pipe degraded mid-test") - return - default: - fail("gles3.GenTransformFeedbacks", "returned 0") - } - - // ReadBuffer (ES3 feature) - gles3.ReadBuffer(glBack) - pass("gles3.ReadBuffer") - - // GetStringi (ES3 feature) - ext := gles3.GetStringi(gles3.GLenum(glExtensions), 0) - if ext != nil { - passf("gles3.GetStringi", fmt.Sprintf("ext[0]=%q", goString((*byte)(unsafe.Pointer(ext))))) - } else { - pass("gles3.GetStringi (no extensions)") - } -} - -func testVulkan() { - fmt.Println("\n[vulkan] ndk/vulkan") - - // Vulkan idiomatic bindings are not yet generated (empty package). - // The capi/vulkan package links against -lvulkan, verifying the library is present. - skip("vulkan.*", "idiomatic vulkan bindings not yet generated") -} - -func testNNAPI() { - fmt.Println("\n[nnapi] ndk/nnapi") - - // The idiomatic nnapi package does not yet expose NewModel/Close. - // Verify the package links and enum types are available. - skip("nnapi.NewModel", "constructor not yet in idiomatic bindings") -} - -func testAAudio() { - fmt.Println("\n[audio] ndk/audio") - - builder, err := audio.NewStreamBuilder() - if err != nil { - fail("audio.NewStreamBuilder", err.Error()) - return - } - pass("audio.NewStreamBuilder") - - // Builder methods chain idiomatically. - builder. - SetDirection(audio.Output). - SetFormat(audio.PcmI16). - SetSampleRate(44100). - SetChannelCount(2). - SetPerformanceMode(audio.LowLatency). - SetSharingMode(audio.Shared) - pass("audio.StreamBuilder chaining (6 setters)") - - stream, err := builder.Open() - if err != nil { - skip("audio.StreamBuilder.Open", err.Error()) - builder.Close() - return - } - pass("audio.StreamBuilder.Open") - - rate := stream.SampleRate() - passf("audio.Stream.SampleRate", fmt.Sprintf("%d Hz", rate)) - - chans := stream.ChannelCount() - passf("audio.Stream.ChannelCount", fmt.Sprintf("%d", chans)) - - state := stream.State() - passf("audio.Stream.State", fmt.Sprintf("%s", state)) - - burst := stream.FramesPerBurst() - passf("audio.Stream.FramesPerBurst", fmt.Sprintf("%d", burst)) - - xruns := stream.XRunCount() - passf("audio.Stream.XRunCount", fmt.Sprintf("%d", xruns)) - - err = stream.Start() - if err == nil { - pass("audio.Stream.Start") - stream.Stop() - pass("audio.Stream.Stop") - } else { - skip("audio.Stream.Start", err.Error()) - } - - stream.Close() - pass("audio.Stream.Close") - - builder.Close() - pass("audio.StreamBuilder.Close") -} - -func testThermal() { - fmt.Println("\n[thermal] ndk/thermal") - - mgr := thermal.NewManager() - pass("thermal.NewManager") - - status := mgr.CurrentStatus() - passf("thermal.Manager.CurrentStatus", fmt.Sprintf("status=%d", status)) - - mgr.Close() - pass("thermal.Manager.Close") -} - -func testFont() { - fmt.Println("\n[font] ndk/font") - - matcher := font.NewMatcher() - pass("font.NewMatcher") - - // SetStyle chains idiomatically. - matcher.SetStyle(400, false) - pass("font.Matcher.SetStyle (weight=400, italic=false)") - matcher.SetStyle(700, true) - pass("font.Matcher.SetStyle (weight=700, italic=true)") - - matcher.Close() - pass("font.Matcher.Close") -} - -func testMedia() { - fmt.Println("\n[media] ndk/media") - - // AMediaFormat lifecycle and methods. - fmt_ := media.NewFormat() - pass("media.NewFormat") - - fmt_.SetString("mime", "video/avc") - pass("media.Format.SetString") - - fmt_.SetInt32("width", 1920) - pass("media.Format.SetInt32") - - var width int32 - ok := fmt_.GetInt32("width", &width) - if ok && width == 1920 { - passf("media.Format.GetInt32", fmt.Sprintf("width=%d", width)) - } else { - fail("media.Format.GetInt32", fmt.Sprintf("ok=%v width=%d", ok, width)) - } - - fmt_.Close() - pass("media.Format.Close") - - // AMediaExtractor lifecycle. - ext := media.NewExtractor() - pass("media.NewExtractor") - - trackCount := ext.TrackCount() - passf("media.Extractor.TrackCount", fmt.Sprintf("%d (no source)", trackCount)) - - sampleTime := ext.SampleTime() - passf("media.Extractor.SampleTime", fmt.Sprintf("%d (no source)", sampleTime)) - - ext.Close() - pass("media.Extractor.Close") - - // AMediaCodec (decoder) lifecycle. - dec := media.NewDecoder("video/avc") - pass("media.NewDecoder (video/avc)") - dec.Close() - pass("media.Codec.Close (decoder)") - - // AMediaCodec (encoder) lifecycle. - enc := media.NewEncoder("video/avc") - pass("media.NewEncoder (video/avc)") - enc.Close() - pass("media.Codec.Close (encoder)") -} - -func testCamera() { - fmt.Println("\n[camera] ndk/camera") - - mgr := camera.NewManager() - pass("camera.NewManager") - - mgr.Close() - pass("camera.Manager.Close") -} - -func testStorage() { - fmt.Println("\n[storage] ndk/storage") - - mgr := storage.NewManager() - pass("storage.NewManager") - - // Test IsObbMounted with a non-existent file (should return 0/false). - mounted := mgr.IsObbMounted("/data/local/tmp/nonexistent.obb") - passf("storage.Manager.IsObbMounted", fmt.Sprintf("mounted=%d", mounted)) - - mgr.Close() - pass("storage.Manager.Close") -} - -func testSurfaceControl() { - fmt.Println("\n[surfacecontrol] ndk/surfacecontrol") - - txn := surfacecontrol.NewTransaction() - pass("surfacecontrol.NewTransaction") - - // Apply empty transaction (no-op but exercises the call path). - txn.Apply() - pass("surfacecontrol.Transaction.Apply") - - txn.Close() - pass("surfacecontrol.Transaction.Close") -} - -func testEnumsAndTypes() { - fmt.Println("\n[enums] Enum/type verification for packages with no callable functions") - - // ndk/log — verify Priority enum values and String method. - if log.Info == 4 && log.Debug == 3 && log.Warn == 5 && log.Error == 6 { - passf("log.Priority", fmt.Sprintf("Info=%d Debug=%d Warn=%d Error=%d Silent=%d", - log.Info, log.Debug, log.Warn, log.Error, log.Silent)) - } else { - fail("log.Priority", "unexpected enum values") - } - passf("log.Priority.String", log.Info.String()) - - // ndk/bitmap — verify Format enum values. - if bitmap.Rgba8888 == 1 && bitmap.Rgb565 == 4 && bitmap.None == 0 { - passf("bitmap.Format", fmt.Sprintf("None=%d Rgba8888=%d Rgb565=%d RgbaF16=%d", - bitmap.None, bitmap.Rgba8888, bitmap.Rgb565, bitmap.RgbaF16)) - } else { - fail("bitmap.Format", "unexpected enum values") - } - - // ndk/input — verify event type enums and String methods. - if input.Key == 1 && input.Motion == 2 { - passf("input.EventType", fmt.Sprintf("Key=%d(%s) Motion=%d(%s)", - input.Key, input.Key, input.Motion, input.Motion)) - } else { - fail("input.EventType", "unexpected enum values") - } - if input.Down == 0 && input.Up == 1 { - passf("input.KeyAction", fmt.Sprintf("Down=%d(%s) Up=%d(%s)", - input.Down, input.Down, input.Up, input.Up)) - } else { - fail("input.KeyAction", "unexpected enum values") - } - if input.Keyboard == 257 && input.Touchscreen == 4098 { - passf("input.Source", fmt.Sprintf("Keyboard=%d(%s) Touchscreen=%d(%s)", - input.Keyboard, input.Keyboard, input.Touchscreen, input.Touchscreen)) - } else { - fail("input.Source", "unexpected enum values") - } - if input.ActionDown == 0 && input.ActionUp == 1 && input.ActionMove == 2 { - passf("input.MotionAction", fmt.Sprintf("ActionDown=%d(%s) ActionUp=%d(%s)", - input.ActionDown, input.ActionDown, input.ActionUp, input.ActionUp)) - } else { - fail("input.MotionAction", "unexpected enum values") - } - - // ndk/hwbuf — verify Format and Usage enum values. - if hwbuf.R8g8b8a8Unorm == 1 { - passf("hwbuf.Format", fmt.Sprintf("R8g8b8a8Unorm=%d Blob=%d", - hwbuf.R8g8b8a8Unorm, hwbuf.Blob)) - } else { - fail("hwbuf.Format", "unexpected enum values") - } - - // ndk/window — verify Format enum values. - if window.Rgba8888 == 1 && window.Rgb565 == 4 { - passf("window.Format", fmt.Sprintf("Rgba8888=%d Rgbx8888=%d Rgb565=%d", - window.Rgba8888, window.Rgbx8888, window.Rgb565)) - } else { - fail("window.Format", "unexpected enum values") - } - - // ndk/sensor — verify Type enum String() method. - passf("sensor.Type.String", sensor.Accelerometer.String()) - - // ndk/audio — verify enum String() methods. - passf("audio.Direction.String", audio.Output.String()) - passf("audio.StreamState.String", audio.Open.String()) - - // ndk/vulkan — idiomatic bindings not yet generated; skip enum verification. - skip("vulkan.StructureType", "idiomatic vulkan bindings not yet generated") - - // ndk/camera — verify TemplateType and error enums. - passf("camera.TemplateType", fmt.Sprintf("Preview=%d Record=%d", - camera.Preview, camera.Record)) - - // ndk/surfacecontrol — verify Visibility and Transparency enums. - if surfacecontrol.Hide == 0 && surfacecontrol.Show == 1 { - passf("surfacecontrol.Visibility", fmt.Sprintf("Show=%d Hide=%d", - surfacecontrol.Show, surfacecontrol.Hide)) - } else { - fail("surfacecontrol.Visibility", "unexpected enum values") - } - passf("surfacecontrol.Transparency", fmt.Sprintf("Transparent=%d Opaque=%d", - surfacecontrol.Transparent, surfacecontrol.Opaque)) -} - -func testGoRuntime() { - fmt.Println("\n[go_runtime] goroutines, channels, memory") - - ch := make(chan int, 1) - go func() { ch <- 42 }() - if v := <-ch; v == 42 { - pass("goroutine+channel") - } else { - fail("goroutine+channel", fmt.Sprintf("expected 42, got %d", v)) - } - - const N = 100 - results := make(chan int, N) - for i := 0; i < N; i++ { - go func(v int) { results <- v * v }(i) - } - sum := 0 - for i := 0; i < N; i++ { - sum += <-results - } - if sum > 0 { - passf("100_goroutines", fmt.Sprintf("sum_of_squares=%d", sum)) - } else { - fail("100_goroutines", "unexpected sum") - } - - buf := make([]byte, 1<<20) - buf[0] = 0xAB - buf[len(buf)-1] = 0xCD - if buf[0] == 0xAB && buf[len(buf)-1] == 0xCD { - pass("1MB_alloc") - } else { - fail("1MB_alloc", "memory corruption") - } - - passf("runtime.GOOS", runtime.GOOS) - passf("runtime.GOARCH", runtime.GOARCH) - passf("runtime.NumCPU", fmt.Sprintf("%d", runtime.NumCPU())) -} - -func main() { - fmt.Println("========================================") - fmt.Println(" ndk E2E Test Suite (idiomatic)") - fmt.Println(" All 34 NDK packages verified") - fmt.Println("========================================") - - testTrace() // ndk/trace - testSensor() // ndk/sensor - testLooper() // ndk/looper (must precede choreographer) - testConfig() // ndk/config - testPermission() // ndk/permission - testChoreographer() // ndk/choreographer (needs looper) - testEGL() // ndk/egl + ndk/gles2 + ndk/gles3 - testVulkan() // ndk/vulkan - testNNAPI() // ndk/nnapi - testAAudio() // ndk/audio - testThermal() // ndk/thermal - testFont() // ndk/font - testMedia() // ndk/media - testCamera() // ndk/camera - testStorage() // ndk/storage - testSurfaceControl() // ndk/surfacecontrol - testEnumsAndTypes() // ndk/{log,bitmap,input,hwbuf,window,sensor,audio,vulkan,camera,surfacecontrol} - testGoRuntime() // Go runtime verification - - fmt.Println("\n========================================") - fmt.Printf(" TOTAL: %d passed, %d failed, %d skipped\n", passed, failed, skipped) - fmt.Println("========================================") - - // Report packages tested via blank import (linking verified). - fmt.Println("\n Packages verified via blank import (linking only):") - fmt.Println(" ndk/activity - requires ANativeActivity handle") - fmt.Println(" ndk/asset - requires AAssetManager from Activity") - fmt.Println(" ndk/binder - no constructors (needs Android Binder)") - fmt.Println(" ndk/hint - requires APerformanceHintManager from system") - fmt.Println(" ndk/image - no decoder constructor exposed") - fmt.Println(" ndk/midi - requires AMidiDevice from JNI") - fmt.Println(" ndk/net - type alias only") - fmt.Println(" ndk/sharedmem - no functions exposed") - fmt.Println(" ndk/surfacetexture - requires ASurfaceTexture handle") - fmt.Println(" ndk/sync - no functions exposed") - - if failed > 0 { - os.Exit(1) - } -} diff --git a/tests/e2e/ndkcli_test.go b/tests/e2e/ndkcli_test.go deleted file mode 100644 index 2125646..0000000 --- a/tests/e2e/ndkcli_test.go +++ /dev/null @@ -1,217 +0,0 @@ -//go:build e2e - -// E2E tests for ndkcli commands running on an Android device. -// -// These tests execute ndkcli subcommands as subprocesses and verify -// their output. The ndkcli binary must be pre-built and available -// at the path specified by the NDKCLI_BIN environment variable -// (default: /data/local/tmp/ndkcli). -package main - -import ( - "os" - "os/exec" - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func ndkcliBin() string { - if bin := os.Getenv("NDKCLI_BIN"); bin != "" { - return bin - } - return "/data/local/tmp/ndkcli" -} - -func runNdkcli( - t *testing.T, - args ...string, -) (string, error) { - t.Helper() - cmd := exec.Command(ndkcliBin(), args...) - out, err := cmd.CombinedOutput() - return string(out), err -} - -func requireNdkcli( - t *testing.T, - args ...string, -) string { - t.Helper() - out, err := runNdkcli(t, args...) - require.NoError(t, err, "ndkcli %s failed: %s", strings.Join(args, " "), out) - return out -} - -func TestNdkcli_Help(t *testing.T) { - out := requireNdkcli(t, "--help") - assert.Contains(t, out, "ndkcli") - assert.Contains(t, out, "camera") - assert.Contains(t, out, "audio") - assert.Contains(t, out, "sensor") -} - -func TestNdkcli_CameraManagerCameraIDList(t *testing.T) { - out, err := runNdkcli(t, "camera", "manager", "camera-id-list") - // May fail on emulator without camera permission, but should not crash. - t.Logf("camera manager camera-id-list: err=%v output=%q", err, out) -} - -func TestNdkcli_CameraListDetails(t *testing.T) { - out, err := runNdkcli(t, "camera", "list-details") - t.Logf("camera list-details: err=%v output=%q", err, out) -} - -func TestNdkcli_AudioStreamBuilderNew(t *testing.T) { - out := requireNdkcli(t, "audio", "stream-builder", "new") - assert.Contains(t, out, "created successfully") -} - -func TestNdkcli_AudioRecord(t *testing.T) { - out, err := runNdkcli(t, "audio", "record", - "--output", "/data/local/tmp/ndkcli_test.pcm", - "--duration", "1s", - "--sample-rate", "44100", - "--channels", "1", - ) - t.Logf("audio record: err=%v output=%q", err, out) - // Cleanup. - os.Remove("/data/local/tmp/ndkcli_test.pcm") -} - -func TestNdkcli_SensorRead(t *testing.T) { - out, err := runNdkcli(t, "sensor", "read", "--type", "1", "--duration", "1s") - t.Logf("sensor read: err=%v output=%q", err, out) -} - -func TestNdkcli_SensorManagerDefaultSensor(t *testing.T) { - out, err := runNdkcli(t, "sensor", "manager", "default-sensor", "--value", "1") - t.Logf("sensor manager default-sensor: err=%v output=%q", err, out) -} - -func TestNdkcli_ThermalManagerCurrentStatus(t *testing.T) { - out := requireNdkcli(t, "thermal", "manager", "current-status") - t.Logf("thermal status: %q", out) -} - -func TestNdkcli_ThermalMonitor(t *testing.T) { - out, err := runNdkcli(t, "thermal", "monitor", "--interval", "500ms", "--duration", "1s") - t.Logf("thermal monitor: err=%v output=%q", err, out) -} - -func TestNdkcli_EGLInfo(t *testing.T) { - out := requireNdkcli(t, "egl", "info") - assert.Contains(t, out, "vendor", "EGL info should contain vendor") - t.Logf("egl info:\n%s", out) -} - -func TestNdkcli_EGLConfigs(t *testing.T) { - out, err := runNdkcli(t, "egl", "configs") - t.Logf("egl configs: err=%v output=%q", err, out) -} - -func TestNdkcli_GLES2Info(t *testing.T) { - out := requireNdkcli(t, "gles2", "info") - assert.Contains(t, out, "GL_VERSION", "gles2 info should contain GL_VERSION") - t.Logf("gles2 info:\n%s", out) -} - -func TestNdkcli_GLES3Info(t *testing.T) { - out, err := runNdkcli(t, "gles3", "info") - t.Logf("gles3 info: err=%v output=%q", err, out) -} - -func TestNdkcli_MediaCodecs(t *testing.T) { - out := requireNdkcli(t, "media", "codecs") - assert.Contains(t, out, "video/avc", "should probe H.264") - t.Logf("media codecs:\n%s", out) -} - -func TestNdkcli_MediaNewEncoder(t *testing.T) { - out, err := runNdkcli(t, "media", "new-encoder", "--mime_type", "video/avc") - t.Logf("media new-encoder: err=%v output=%q", err, out) -} - -func TestNdkcli_MediaNewDecoder(t *testing.T) { - out, err := runNdkcli(t, "media", "new-decoder", "--mime_type", "video/avc") - t.Logf("media new-decoder: err=%v output=%q", err, out) -} - -func TestNdkcli_ConfigShow(t *testing.T) { - out := requireNdkcli(t, "config", "show") - assert.Contains(t, out, "density", "config show should contain density") - t.Logf("config show:\n%s", out) -} - -func TestNdkcli_ConfigDensity(t *testing.T) { - out := requireNdkcli(t, "config", "config", "density") - t.Logf("config density: %q", out) -} - -func TestNdkcli_ConfigSdkVersion(t *testing.T) { - out := requireNdkcli(t, "config", "config", "sdk-version") - t.Logf("config sdk-version: %q", out) -} - -func TestNdkcli_FontMatch(t *testing.T) { - out, err := runNdkcli(t, "font", "match", "--family", "sans-serif", "--weight", "400") - t.Logf("font match: err=%v output=%q", err, out) -} - -func TestNdkcli_PermissionCheck(t *testing.T) { - out, err := runNdkcli(t, "permission", "check", - "--name", "android.permission.CAMERA", - "--pid", "1000", "--uid", "1000", - ) - t.Logf("permission check: err=%v output=%q", err, out) -} - -func TestNdkcli_TraceIsEnabled(t *testing.T) { - out := requireNdkcli(t, "trace", "is-enabled") - t.Logf("trace is-enabled: %q", out) -} - -func TestNdkcli_TraceBeginEndSection(t *testing.T) { - out := requireNdkcli(t, "trace", "begin-section", "--section-name", "test_section") - t.Logf("trace begin-section: %q", out) - - out = requireNdkcli(t, "trace", "end-section") - t.Logf("trace end-section: %q", out) -} - -func TestNdkcli_TraceSetCounter(t *testing.T) { - out := requireNdkcli(t, "trace", "set-counter", "--counter-name", "test_counter", "--counter-value", "42") - t.Logf("trace set-counter: %q", out) -} - -func TestNdkcli_LogWrite(t *testing.T) { - out := requireNdkcli(t, "log", "write", "--tag", "ndktest", "--text", "e2e test", "--prio", "4") - t.Logf("log write: %q", out) -} - -func TestNdkcli_NnapiProbe(t *testing.T) { - out, err := runNdkcli(t, "nnapi", "probe") - t.Logf("nnapi probe: err=%v output=%q", err, out) -} - -func TestNdkcli_LooperTest(t *testing.T) { - out, err := runNdkcli(t, "looper", "test") - t.Logf("looper test: err=%v output=%q", err, out) -} - -func TestNdkcli_WindowQuery(t *testing.T) { - out, err := runNdkcli(t, "window", "query") - t.Logf("window query: err=%v output=%q", err, out) -} - -func TestNdkcli_StorageObb(t *testing.T) { - out, err := runNdkcli(t, "storage", "obb", "--file", "/nonexistent.obb") - t.Logf("storage obb: err=%v output=%q", err, out) -} - -func TestNdkcli_BinderprocessStartThreadPool(t *testing.T) { - out, err := runNdkcli(t, "binderprocess", "start-thread-pool") - t.Logf("binderprocess start-thread-pool: err=%v output=%q", err, out) -} diff --git a/tests/e2e/nested_char_pointer_helpers.go b/tests/e2e/nested_char_pointer_helpers.go deleted file mode 100644 index eaec78f..0000000 --- a/tests/e2e/nested_char_pointer_helpers.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build e2e - -package main - -/* -#include -#include - -static char **ndk_e2e_alloc_char_slot(void) { - return (char **)calloc(1, sizeof(char *)); -} - -static void ndk_e2e_free_char_slot(char **slot) { - free(slot); -} - -static char *ndk_e2e_char_slot_value(char **slot) { - return slot == NULL ? NULL : *slot; -} - -static char *ndk_e2e_copy_string(const char *value) { - size_t size = strlen(value) + 1; - char *copy = (char *)malloc(size); - if (copy != NULL) { - memcpy(copy, value, size); - } - return copy; -} - -static char **ndk_e2e_alloc_header_values(void) { - char **values = (char **)calloc(2, sizeof(char *)); - if (values == NULL) { - return NULL; - } - values[0] = ndk_e2e_copy_string("X-NDK-E2E"); - values[1] = ndk_e2e_copy_string("nested-char-pointer"); - if (values[0] == NULL || values[1] == NULL) { - free(values[0]); - free(values[1]); - free(values); - return NULL; - } - return values; -} - -static void ndk_e2e_free_header_values(char **values) { - if (values == NULL) { - return; - } - free(values[0]); - free(values[1]); - free(values); -} - -*/ -import "C" - -import "unsafe" - -func e2eAllocCharSlot() unsafe.Pointer { - return unsafe.Pointer(C.ndk_e2e_alloc_char_slot()) -} - -func e2eFreeCharSlot(slot unsafe.Pointer) { - C.ndk_e2e_free_char_slot((**C.char)(slot)) -} - -func e2eCharSlotValue(slot unsafe.Pointer) (string, bool) { - value := C.ndk_e2e_char_slot_value((**C.char)(slot)) - if value == nil { - return "", false - } - return C.GoString(value), true -} - -func e2eAllocHeaderValues() unsafe.Pointer { - return unsafe.Pointer(C.ndk_e2e_alloc_header_values()) -} - -func e2eFreeHeaderValues(values unsafe.Pointer) { - C.ndk_e2e_free_header_values((**C.char)(values)) -} diff --git a/tests/e2e/nested_char_pointer_test.go b/tests/e2e/nested_char_pointer_test.go deleted file mode 100644 index fe23821..0000000 --- a/tests/e2e/nested_char_pointer_test.go +++ /dev/null @@ -1,48 +0,0 @@ -//go:build e2e - -package main - -import ( - "testing" - "unsafe" - - rawmedia "github.com/AndroidGoLab/ndk/capi/media" - rawpb "github.com/AndroidGoLab/ndk/capi/persistablebundle" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestRawCAPICharPointerOutput(t *testing.T) { - format := rawmedia.AMediaFormat_new() - require.NotNil(t, format, "AMediaFormat_new") - defer rawmedia.AMediaFormat_delete(format) - - rawmedia.AMediaFormat_setString(format, "ndk.e2e.char-pointer", "safe") - slot := e2eAllocCharSlot() - require.NotNil(t, slot, "char** output slot allocation") - defer e2eFreeCharSlot(slot) - - out := (**int8)(unsafe.Pointer(slot)) - require.True(t, rawmedia.AMediaFormat_getString(format, "ndk.e2e.char-pointer", out)) - value, ok := e2eCharSlotValue(slot) - require.True(t, ok, "AMediaFormat_getString output") - assert.Equal(t, "safe", value) -} - -func TestRawCAPICharPointerInputArray(t *testing.T) { - values := e2eAllocHeaderValues() - require.NotNil(t, values, "const char* const* input array allocation") - defer e2eFreeHeaderValues(values) - - bundle := rawpb.APersistableBundle_new() - require.NotNil(t, bundle, "APersistableBundle_new") - defer rawpb.APersistableBundle_delete(bundle) - - rawpb.APersistableBundle_putStringVector( - bundle, - "ndk.e2e.values", - (**int8)(unsafe.Pointer(values)), - 2, - ) - assert.Equal(t, int32(1), rawpb.APersistableBundle_size(bundle)) -} diff --git a/tests/e2e/run-audio-e2e.sh b/tests/e2e/run-audio-e2e.sh deleted file mode 100755 index 40f00b9..0000000 --- a/tests/e2e/run-audio-e2e.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env bash -# E2E test: verify AAudio input stream lifecycle on Android emulator. -# -# Opens an AAudio capture stream at 48 kHz, reads ~1 second of audio, -# and verifies the full lifecycle (open/start/read/stop/close) completes -# without errors. -# -# If PulseAudio is available and the emulator is launched with -# -allow-host-audio, the script also injects a 440 Hz tone via a -# PulseAudio null-sink monitor and verifies frequency detection. -# -# Prerequisites: -# - Android NDK installed (auto-detected or set ANDROID_NDK_HOME) -# - A running Android emulator (preferably with -allow-host-audio) -# -# Usage: ./tests/e2e/run-audio-e2e.sh - -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -PROJECT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)" - -# Detect NDK. -ANDROID_HOME="${ANDROID_HOME:-$HOME/Android/Sdk}" -NDK_PATH="${ANDROID_NDK_HOME:-$(ls -d "$ANDROID_HOME/ndk/"* 2>/dev/null | sort -V | tail -1)}" -if [ -z "$NDK_PATH" ] || [ ! -d "$NDK_PATH" ]; then - echo "ERROR: Android NDK not found; set ANDROID_NDK_HOME or ANDROID_HOME" - exit 1 -fi - -API_LEVEL="${API_LEVEL:-35}" -NDK_SYSROOT="${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/sysroot" -CC="${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android${API_LEVEL}-clang" -if [ ! -x "$CC" ]; then - echo "ERROR: NDK clang not found at $CC" - exit 1 -fi - -ADB="${ADB:-adb}" -# adb starts a separate shell, so the host's GODEBUG does not propagate. -REMOTE_GODEBUG="${GODEBUG:-cgocheck=1}" -export CGO_CFLAGS="${CGO_CFLAGS:+$CGO_CFLAGS }--sysroot=$NDK_SYSROOT" -export CGO_CPPFLAGS="${CGO_CPPFLAGS:+$CGO_CPPFLAGS }--sysroot=$NDK_SYSROOT" -export CGO_LDFLAGS="${CGO_LDFLAGS:+$CGO_LDFLAGS }--sysroot=$NDK_SYSROOT" - -# Verify adb connectivity. -if ! "$ADB" get-state >/dev/null 2>&1; then - echo "ERROR: No adb device found. Start an emulator first." - exit 1 -fi - -cd "$PROJECT_DIR" - -# Cross-compile device binary. -echo "=== Building audio recording E2E (android/amd64) ===" -CGO_ENABLED=1 GOOS=android GOARCH=amd64 CC="$CC" \ - go build -o /tmp/audio-recording-e2e ./tests/e2e/audio-recording-e2e - -# Try to set up PulseAudio tone injection (best-effort). -DETECT_TONE="" -INJECT_CLEANUP="" - -setup_pa_injection() { - if ! command -v pactl >/dev/null 2>&1; then - echo "WARN: pactl not found, skipping audio injection" - return 1 - fi - - # Create a null sink whose monitor becomes the virtual mic. - local sink_idx - sink_idx=$(pactl load-module module-null-sink \ - sink_name=e2e_audio_sink \ - sink_properties=device.description=E2EAudioSink 2>/dev/null) || return 1 - - pactl set-default-source e2e_audio_sink.monitor 2>/dev/null || { - pactl unload-module "$sink_idx" 2>/dev/null - return 1 - } - - # Generate a 440 Hz stereo tone at 44100 Hz (emulator's PA format). - python3 -c " -import struct, math -rate, freq, dur, amp = 44100, 440, 10, 30000 -with open('/tmp/e2e_tone_440hz.raw', 'wb') as f: - for i in range(rate * dur): - s = int(amp * math.sin(2 * math.pi * freq * i / rate)) - f.write(struct.pack('/dev/null || return 1 - - # Play tone into the null sink in background. - paplay --raw --format=s16le --channels=2 --rate=44100 \ - --device=e2e_audio_sink /tmp/e2e_tone_440hz.raw &>/dev/null & - local play_pid=$! - - INJECT_CLEANUP="kill $play_pid 2>/dev/null; pactl unload-module $sink_idx 2>/dev/null; rm -f /tmp/e2e_tone_440hz.raw" - echo "Audio injection active (440 Hz via PulseAudio)" - # NOTE: The Android emulator (v36) does not reliably pass host - # PulseAudio input to the guest microphone. Tone injection is - # set up for diagnostic purposes; pass -detect-tone manually - # if your environment supports it. - return 0 -} - -# Attempt injection; failures are non-fatal. -setup_pa_injection || echo "Continuing without audio injection" - -cleanup() { - "$ADB" shell rm -f /data/local/tmp/audio-recording-e2e 2>/dev/null || true - eval "$INJECT_CLEANUP" 2>/dev/null || true - rm -f /tmp/audio-recording-e2e 2>/dev/null || true -} -trap cleanup EXIT - -# Push and run device binary. -echo "=== Running audio recording E2E on device ===" -"$ADB" push /tmp/audio-recording-e2e /data/local/tmp/audio-recording-e2e >/dev/null 2>&1 -"$ADB" shell chmod 755 /data/local/tmp/audio-recording-e2e - -# shellcheck disable=SC2086 -OUTPUT=$("$ADB" shell "GODEBUG=$REMOTE_GODEBUG timeout 15 /data/local/tmp/audio-recording-e2e $DETECT_TONE 2>&1; echo EXIT=\$?" 2>&1) -echo "$OUTPUT" - -EXIT_CODE=$(echo "$OUTPUT" | grep -oP 'EXIT=\K\d+' | tail -1) - -if [ "${EXIT_CODE:-1}" = "0" ]; then - echo "=== PASS: Audio recording E2E ===" -else - echo "=== FAIL: Audio recording E2E (exit=$EXIT_CODE) ===" -fi - -exit "${EXIT_CODE:-1}" diff --git a/tests/e2e/run-examples-test.sh b/tests/e2e/run-examples-test.sh deleted file mode 100755 index b6b91f9..0000000 --- a/tests/e2e/run-examples-test.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env bash -# E2E: cross-compile the Go test binary with the "e2e" build tag, -# push it to an Android emulator, and run it via adb. -# -# Prerequisites: -# - Android NDK installed (auto-detected or set ANDROID_NDK_HOME) -# - A running Android emulator or device (adb accessible) -# -# Usage: ./tests/e2e/run-examples-test.sh - -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -PROJECT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)" - -# Detect NDK. -ANDROID_HOME="${ANDROID_HOME:-$HOME/Android/Sdk}" -NDK_PATH="${ANDROID_NDK_HOME:-$(ls -d "$ANDROID_HOME/ndk/"* 2>/dev/null | sort -V | tail -1)}" -if [ -z "$NDK_PATH" ] || [ ! -d "$NDK_PATH" ]; then - echo "ERROR: Android NDK not found; set ANDROID_NDK_HOME or ANDROID_HOME" - exit 1 -fi - -API_LEVEL="${API_LEVEL:-35}" -TOOLCHAIN_DIR="${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64" -NDK_SYSROOT="${TOOLCHAIN_DIR}/sysroot" -CC="${TOOLCHAIN_DIR}/bin/x86_64-linux-android${API_LEVEL}-clang" -if [ ! -x "$CC" ]; then - echo "ERROR: NDK clang not found at $CC" - exit 1 -fi - -export CGO_CFLAGS="${CGO_CFLAGS:+$CGO_CFLAGS }--sysroot=$NDK_SYSROOT" -export CGO_CPPFLAGS="${CGO_CPPFLAGS:+$CGO_CPPFLAGS }--sysroot=$NDK_SYSROOT" -export CGO_LDFLAGS="${CGO_LDFLAGS:+$CGO_LDFLAGS }--sysroot=$NDK_SYSROOT" - -ADB="${ADB:-adb}" -TIMEOUT="${TIMEOUT:-60}" -# adb starts a separate shell, so the host's GODEBUG does not propagate. -REMOTE_GODEBUG="${GODEBUG:-cgocheck=1}" - -# Verify adb connectivity. -if ! "$ADB" get-state >/dev/null 2>&1; then - echo "ERROR: No adb device found. Start an emulator first." - exit 1 -fi - -cd "$PROJECT_DIR" - -BIN="/tmp/examples_e2e.test" -NDKCLI_BIN="/tmp/ndkcli" - -echo "=== Cross-compiling examples E2E test binary (android/amd64) ===" -CGO_ENABLED=1 GOOS=android GOARCH=amd64 CC="$CC" \ - go test -c -tags e2e -o "$BIN" ./tests/e2e/ - -echo "=== Cross-compiling ndkcli (android/amd64) ===" -CGO_ENABLED=1 GOOS=android GOARCH=amd64 CC="$CC" \ - go build -o "$NDKCLI_BIN" ./cmd/ndkcli/ - -echo "=== Pushing to device ===" -"$ADB" push "$BIN" /data/local/tmp/examples_e2e.test >/dev/null 2>&1 -"$ADB" push "$NDKCLI_BIN" /data/local/tmp/ndkcli >/dev/null 2>&1 -"$ADB" shell chmod 755 /data/local/tmp/examples_e2e.test -"$ADB" shell chmod 755 /data/local/tmp/ndkcli - -echo "=== Running tests ===" -OUTPUT=$("$ADB" shell "GODEBUG=$REMOTE_GODEBUG timeout $TIMEOUT /data/local/tmp/examples_e2e.test -test.v 2>&1; echo EXIT=\$?" 2>&1) -echo "$OUTPUT" - -EXIT_CODE=$(echo "$OUTPUT" | grep -oP 'EXIT=\K\d+' | tail -1) - -# Cleanup. -"$ADB" shell rm -f /data/local/tmp/examples_e2e.test /data/local/tmp/ndkcli 2>/dev/null || true -rm -f "$BIN" "$NDKCLI_BIN" 2>/dev/null || true - -if [ "${EXIT_CODE:-1}" = "0" ]; then - echo "=== PASS: examples E2E tests ===" -else - echo "=== FAIL: examples E2E tests (exit=$EXIT_CODE) ===" -fi - -exit "${EXIT_CODE:-1}" diff --git a/tests/e2e/run-examples.sh b/tests/e2e/run-examples.sh deleted file mode 100755 index 05ab491..0000000 --- a/tests/e2e/run-examples.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env bash -# E2E test: cross-compile all examples and run each on Android emulator. -# -# Expects a running emulator (adb device available). -# Cross-compiles each example for android/amd64, pushes to /data/local/tmp, -# runs with a timeout, and reports pass/fail. -# -# Prerequisites: -# - Android NDK installed (auto-detected or set ANDROID_NDK_HOME) -# - A running Android emulator or device (adb accessible) -# -# Usage: ./tests/e2e/run-examples.sh - -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -PROJECT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)" - -# Detect NDK. -ANDROID_HOME="${ANDROID_HOME:-$HOME/Android/Sdk}" -NDK_PATH="${ANDROID_NDK_HOME:-$(ls -d "$ANDROID_HOME/ndk/"* 2>/dev/null | sort -V | tail -1)}" -if [ -z "$NDK_PATH" ] || [ ! -d "$NDK_PATH" ]; then - echo "ERROR: Android NDK not found; set ANDROID_NDK_HOME or ANDROID_HOME" - exit 1 -fi - -API_LEVEL="${API_LEVEL:-35}" -TOOLCHAIN_DIR="${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64" -NDK_SYSROOT="${TOOLCHAIN_DIR}/sysroot" -CC="${TOOLCHAIN_DIR}/bin/x86_64-linux-android${API_LEVEL}-clang" -if [ ! -x "$CC" ]; then - echo "ERROR: NDK clang not found at $CC" - exit 1 -fi - -export CGO_CFLAGS="${CGO_CFLAGS:+$CGO_CFLAGS }--sysroot=$NDK_SYSROOT" -export CGO_CPPFLAGS="${CGO_CPPFLAGS:+$CGO_CPPFLAGS }--sysroot=$NDK_SYSROOT" -export CGO_LDFLAGS="${CGO_LDFLAGS:+$CGO_LDFLAGS }--sysroot=$NDK_SYSROOT" - -ADB="${ADB:-adb}" -TIMEOUT="${TIMEOUT:-15}" -# adb starts a separate shell, so the host's GODEBUG does not propagate. -REMOTE_GODEBUG="${GODEBUG:-cgocheck=1}" - -# Verify adb connectivity. -if ! "$ADB" get-state >/dev/null 2>&1; then - echo "ERROR: No adb device found. Start an emulator first." - exit 1 -fi - -cd "$PROJECT_DIR" - -PASS=0 -FAIL=0 -FAILURES=() - -for main_go in $(find examples/ -name main.go -not -path "*/_build/*" | sort); do - pkg=$(dirname "$main_go") - name=$(echo "$pkg" | tr '/' '_') - bin="/tmp/e2e_$name" - - # Build. - if ! CGO_ENABLED=1 GOOS=android GOARCH=amd64 CC="$CC" go build -o "$bin" "./$pkg" 2>/tmp/build_err.txt; then - echo "FAIL (build) $pkg" - FAIL=$((FAIL + 1)) - FAILURES+=("$pkg (build)") - continue - fi - - # Push and run. - "$ADB" push "$bin" "/data/local/tmp/e2e_$name" >/dev/null 2>&1 - "$ADB" shell "chmod 755 /data/local/tmp/e2e_$name" - - output=$("$ADB" shell "GODEBUG=$REMOTE_GODEBUG timeout $TIMEOUT /data/local/tmp/e2e_$name 2>&1; echo EXIT=\$?" 2>&1) - exit_code=$(echo "$output" | grep -oP 'EXIT=\K\d+' | tail -1) - - if [ "$exit_code" = "0" ]; then - echo "PASS $pkg" - PASS=$((PASS + 1)) - else - echo "FAIL (exit=$exit_code) $pkg" - FAIL=$((FAIL + 1)) - FAILURES+=("$pkg (exit=$exit_code)") - fi - - # Cleanup. - "$ADB" shell "rm -f /data/local/tmp/e2e_$name" 2>/dev/null || true - rm -f "$bin" -done - -echo "" -echo "========== RESULTS ==========" -echo "PASS: $PASS" -echo "FAIL: $FAIL" -echo "TOTAL: $((PASS + FAIL))" - -if [ ${#FAILURES[@]} -gt 0 ]; then - echo "" - echo "Failures:" - for f in "${FAILURES[@]}"; do - echo " $f" - done - exit 1 -fi diff --git a/tests/e2e/run.sh b/tests/e2e/run.sh deleted file mode 100755 index a69f451..0000000 --- a/tests/e2e/run.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash -# E2E test: cross-compile Go+CGo+NDK binary and run on Android emulator. -# -# Prerequisites: -# - Android SDK with emulator and system image installed -# - Android NDK r27+ installed -# - KVM available (/dev/kvm) -# - ANDROID_HOME set (e.g., ~/android-sdk) -# -# Usage: ./tests/e2e/run.sh - -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -PROJECT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)" - -: "${ANDROID_HOME:?ANDROID_HOME must be set}" -NDK_VERSION="${NDK_VERSION:-28.0.13004108}" -API_LEVEL="${API_LEVEL:-35}" -AVD_NAME="${AVD_NAME:-ndk_e2e}" -SYSTEM_IMAGE="system-images;android-${API_LEVEL};google_apis;x86_64" - -NDK="${ANDROID_HOME}/ndk/${NDK_VERSION}" -NDK_SYSROOT="${NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot" -CC="${NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android${API_LEVEL}-clang" -ADB="${ANDROID_HOME}/platform-tools/adb" -EMULATOR="${ANDROID_HOME}/emulator/emulator" -AVDMANAGER="${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager" -# adb starts a separate shell, so the host's GODEBUG does not propagate. -REMOTE_GODEBUG="${GODEBUG:-cgocheck=1}" -export CGO_CFLAGS="${CGO_CFLAGS:+$CGO_CFLAGS }--sysroot=$NDK_SYSROOT" -export CGO_CPPFLAGS="${CGO_CPPFLAGS:+$CGO_CPPFLAGS }--sysroot=$NDK_SYSROOT" -export CGO_LDFLAGS="${CGO_LDFLAGS:+$CGO_LDFLAGS }--sysroot=$NDK_SYSROOT" - -# Verify prerequisites -for tool in "$CC" "$ADB" "$EMULATOR"; do - [ -x "$tool" ] || { echo "ERROR: $tool not found"; exit 1; } -done -[ -c /dev/kvm ] || { echo "ERROR: /dev/kvm not available"; exit 1; } - -echo "=== Step 1: Cross-compile ===" -cd "$PROJECT_DIR" -CGO_ENABLED=1 GOOS=android GOARCH=amd64 CC="$CC" \ - go build -o tests/e2e/e2e_test ./tests/e2e -file tests/e2e/e2e_test - -echo "=== Step 2: Create AVD (if needed) ===" -if [ ! -d "$HOME/.android/avd/${AVD_NAME}.avd" ]; then - echo "no" | bash "$AVDMANAGER" create avd \ - -n "$AVD_NAME" -k "$SYSTEM_IMAGE" --force -fi - -echo "=== Step 3: Start emulator ===" -ANDROID_SDK_ROOT="$ANDROID_HOME" "$EMULATOR" \ - -avd "$AVD_NAME" -no-window -no-boot-anim \ - -gpu swiftshader_indirect -no-metrics 2>/tmp/emulator_e2e.log & -EMULATOR_PID=$! -trap "kill $EMULATOR_PID 2>/dev/null || true" EXIT - -echo "Waiting for boot..." -for i in $(seq 1 60); do - RESULT=$("$ADB" shell getprop sys.boot_completed 2>/dev/null | tr -d '\r\n') - if [ "$RESULT" = "1" ]; then - echo "Emulator booted after ~$((i*5))s" - break - fi - if ! kill -0 "$EMULATOR_PID" 2>/dev/null; then - echo "ERROR: Emulator process died" - tail -20 /tmp/emulator_e2e.log - exit 1 - fi - sleep 5 -done - -echo "=== Step 4: Run E2E test ===" -"$ADB" push tests/e2e/e2e_test /data/local/tmp/ -"$ADB" shell chmod 755 /data/local/tmp/e2e_test -"$ADB" shell "GODEBUG=$REMOTE_GODEBUG /data/local/tmp/e2e_test" -EXIT_CODE=$? - -echo "=== Step 5: Verify logcat ===" -"$ADB" logcat -d -s "ndk-e2e" - -exit $EXIT_CODE diff --git a/thermal/errors.go b/thermal/errors.go deleted file mode 100644 index 15c7557..0000000 --- a/thermal/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package thermal - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/thermal/functions.go b/thermal/functions.go deleted file mode 100644 index fd9553d..0000000 --- a/thermal/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package thermal diff --git a/thermal/manager.go b/thermal/manager.go deleted file mode 100644 index 2cac574..0000000 --- a/thermal/manager.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package thermal - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/thermal" -) - -// Manager wraps the NDK AThermalManager handle. -type Manager struct { - ptr *capi.AThermalManager -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Manager) cptr() *capi.AThermalManager { - if h == nil { - return nil - } - return h.ptr -} - -// NewManager creates a new Manager. -func NewManager() *Manager { - return &Manager{ptr: capi.AThermal_acquireManager()} -} - -// Close releases the underlying NDK handle. -func (h *Manager) Close() error { - if h.ptr == nil { - return nil - } - capi.AThermal_releaseManager(h.ptr) - h.ptr = nil - return nil -} - -// NewManagerFromPointer wraps a raw AThermalManager pointer. -func NewManagerFromPointer(ptr unsafe.Pointer) *Manager { - return &Manager{ptr: (*capi.AThermalManager)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Manager) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Manager) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewManagerFromUintPtr wraps a uintptr as a Manager. -// The caller must ensure ptr points to a valid AThermalManager. -func NewManagerFromUintPtr(ptr uintptr) *Manager { - return &Manager{ptr: (*capi.AThermalManager)(unsafe.Pointer(ptr))} -} - -// CurrentStatus returns the value directly. -func (h *Manager) CurrentStatus() ThermalStatus { - return (ThermalStatus)(capi.AThermal_getCurrentThermalStatus(h.ptr)) -} - -// AThermal_getThermalHeadroom returns the value directly. -func (h *Manager) AThermal_getThermalHeadroom(forecastSeconds int32) float32 { - return (float32)(capi.AThermal_getThermalHeadroom(h.ptr, forecastSeconds)) -} diff --git a/thermal/package.go b/thermal/package.go deleted file mode 100644 index 781d84a..0000000 --- a/thermal/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package thermal provides Go bindings for Android thermal management. -package thermal diff --git a/thermal/thermal_headroom_threshold.go b/thermal/thermal_headroom_threshold.go deleted file mode 100644 index 2be5635..0000000 --- a/thermal/thermal_headroom_threshold.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package thermal - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/thermal" -) - -// ThermalHeadroomThreshold wraps the NDK AThermalHeadroomThreshold handle. -type ThermalHeadroomThreshold struct { - ptr *capi.AThermalHeadroomThreshold -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *ThermalHeadroomThreshold) cptr() *capi.AThermalHeadroomThreshold { - if h == nil { - return nil - } - return h.ptr -} - -// NewThermalHeadroomThresholdFromPointer wraps a raw AThermalHeadroomThreshold pointer. -func NewThermalHeadroomThresholdFromPointer(ptr unsafe.Pointer) *ThermalHeadroomThreshold { - return &ThermalHeadroomThreshold{ptr: (*capi.AThermalHeadroomThreshold)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *ThermalHeadroomThreshold) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *ThermalHeadroomThreshold) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewThermalHeadroomThresholdFromUintPtr wraps a uintptr as a ThermalHeadroomThreshold. -// The caller must ensure ptr points to a valid AThermalHeadroomThreshold. -func NewThermalHeadroomThresholdFromUintPtr(ptr uintptr) *ThermalHeadroomThreshold { - return &ThermalHeadroomThreshold{ptr: (*capi.AThermalHeadroomThreshold)(unsafe.Pointer(ptr))} -} diff --git a/thermal/thermal_status.go b/thermal/thermal_status.go deleted file mode 100644 index 8fb9dce..0000000 --- a/thermal/thermal_status.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package thermal - -import "fmt" - -type ThermalStatus int32 - -const ( - StatusError ThermalStatus = -1 - StatusNone ThermalStatus = 0 - StatusLight ThermalStatus = 1 - StatusModerate ThermalStatus = 2 - StatusSevere ThermalStatus = 3 - StatusCritical ThermalStatus = 4 - StatusEmergency ThermalStatus = 5 - StatusShutdown ThermalStatus = 6 -) - -func (v ThermalStatus) String() string { - switch v { - case StatusError: - return "StatusError" - case StatusNone: - return "StatusNone" - case StatusLight: - return "StatusLight" - case StatusModerate: - return "StatusModerate" - case StatusSevere: - return "StatusSevere" - case StatusCritical: - return "StatusCritical" - case StatusEmergency: - return "StatusEmergency" - case StatusShutdown: - return "StatusShutdown" - default: - return fmt.Sprintf("ThermalStatus(%d)", int(v)) - } -} diff --git a/tools/cmd/capigen/main.go b/tools/cmd/capigen/main.go deleted file mode 100644 index 996c7b4..0000000 --- a/tools/cmd/capigen/main.go +++ /dev/null @@ -1,102 +0,0 @@ -// Command capigen generates raw CGo binding packages from spec YAML and -// manifest configuration. -package main - -import ( - "flag" - "fmt" - "os" - - "github.com/AndroidGoLab/ndk/tools/pkg/capigen" - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - "gopkg.in/yaml.v3" -) - -func main() { - var ( - specPath = flag.String("spec", "", "path to spec YAML file (required)") - manifestPath = flag.String("manifest", "", "path to capi manifest YAML (required)") - overlayPath = flag.String("overlay", "", "path to overlay YAML (optional, for api_levels)") - outDir = flag.String("out", "", "output directory for generated package (required)") - ) - flag.Parse() - - if *specPath == "" || *manifestPath == "" || *outDir == "" { - fmt.Fprintln(os.Stderr, "usage: capigen -spec -manifest -out [-overlay ]") - os.Exit(1) - } - - spec, err := readSpec(*specPath) - if err != nil { - fmt.Fprintf(os.Stderr, "read spec: %v\n", err) - os.Exit(1) - } - - manifest, err := readManifest(*manifestPath) - if err != nil { - fmt.Fprintf(os.Stderr, "read manifest: %v\n", err) - os.Exit(1) - } - - var apiLevels map[string]int - if *overlayPath != "" { - apiLevels, err = readAPILevels(*overlayPath) - if err != nil { - fmt.Fprintf(os.Stderr, "read overlay: %v\n", err) - os.Exit(1) - } - } - - if err := capigen.GeneratePackage(spec, manifest, *outDir, apiLevels); err != nil { - fmt.Fprintf(os.Stderr, "generate: %v\n", err) - os.Exit(1) - } - - fmt.Printf("capigen: wrote %s/ (%d types, %d enums, %d functions, %d callbacks, %d structs)\n", - *outDir, len(spec.Types), len(spec.Enums), len(spec.Functions), len(spec.Callbacks), len(spec.Structs)) -} - -func readSpec(path string) (*specmodel.Spec, error) { - data, err := os.ReadFile(path) - if err != nil { - return nil, err - } - - var spec specmodel.Spec - if err := yaml.Unmarshal(data, &spec); err != nil { - return nil, err - } - - return &spec, nil -} - -func readManifest(path string) (*capigen.Manifest, error) { - data, err := os.ReadFile(path) - if err != nil { - return nil, err - } - - var m capigen.Manifest - if err := yaml.Unmarshal(data, &m); err != nil { - return nil, err - } - - return &m, nil -} - -// readAPILevels reads only the api_levels map from an overlay YAML file. -func readAPILevels(path string) (map[string]int, error) { - data, err := os.ReadFile(path) - if err != nil { - return nil, err - } - - var overlay struct { - APILevels map[string]int `yaml:"api_levels"` - } - if err := yaml.Unmarshal(data, &overlay); err != nil { - return nil, err - } - - return overlay.APILevels, nil -} diff --git a/tools/cmd/cligen/main.go b/tools/cmd/cligen/main.go deleted file mode 100644 index a7c50d3..0000000 --- a/tools/cmd/cligen/main.go +++ /dev/null @@ -1,935 +0,0 @@ -// Command cligen generates cobra CLI subcommands for all exported -// functions and methods in the NDK idiomatic packages. It parses -// Go source with go/ast and emits one _gen.go file per package -// into cmd/ndkcli/. -package main - -import ( - "bytes" - "flag" - "fmt" - "go/ast" - "go/format" - "go/parser" - "go/token" - "os" - "path/filepath" - "sort" - "strings" - "unicode" -) - -const goModule = "github.com/AndroidGoLab/ndk" - -var aliasMap = map[string]string{ - "log": "ndklog", - "sync": "ndksync", - "image": "ndkimage", -} - -var fileSuffixMap = map[string]string{ - "log": "log_cmd", - "sync": "sync_cmd", -} - -type pkgInfo struct { - name string - dir string - alias string - types map[string]*typeInfo - funcs []funcInfo - importPath string - typeAliases map[string]string // TypeName -> underlying primitive type -} - -type typeInfo struct { - name string - constructor *funcInfo - methods []funcInfo - hasClose bool -} - -type funcInfo struct { - name string - recv string - params []paramInfo - returns []returnInfo -} - -type paramInfo struct { - name string - goType string -} - -type returnInfo struct { - goType string -} - -func main() { - projectRoot := flag.String("root", ".", "Project root directory") - outputDir := flag.String("output", "cmd/ndkcli", "Output directory") - flag.Parse() - - pkgDirs := discoverPackages(*projectRoot) - for _, dir := range pkgDirs { - pkg, err := parsePackage(filepath.Join(*projectRoot, dir), dir) - if err != nil { - fmt.Fprintf(os.Stderr, "skip %s: %v\n", dir, err) - continue - } - if pkg == nil || (len(pkg.funcs) == 0 && len(pkg.types) == 0) { - fmt.Fprintf(os.Stderr, "skip %s: no exported API\n", dir) - continue - } - - code := generateFile(pkg) - if code == "" { - fmt.Fprintf(os.Stderr, "skip %s: no CLI-compatible API\n", dir) - continue - } - - formatted, err := format.Source([]byte(code)) - if err != nil { - fmt.Fprintf(os.Stderr, "format error for %s: %v\nraw:\n%s\n", dir, err, code) - continue - } - - base := dir - if s, ok := fileSuffixMap[dir]; ok { - base = s - } - outPath := filepath.Join(*projectRoot, *outputDir, base+"_gen.go") - if err := os.WriteFile(outPath, formatted, 0o644); err != nil { - fmt.Fprintf(os.Stderr, "write error: %v\n", err) - continue - } - fmt.Printf("generated %s (%d commands)\n", outPath, strings.Count(code, "RunE:")) - } -} - -func discoverPackages(root string) []string { - skip := map[string]bool{ - "capi": true, "spec": true, "templates": true, "tools": true, - "tests": true, "examples": true, "internal": true, "docs": true, - "discussion": true, "jni": true, "cmd": true, "display": true, - } - entries, _ := os.ReadDir(root) - var dirs []string - for _, e := range entries { - if !e.IsDir() || skip[e.Name()] || strings.HasPrefix(e.Name(), ".") { - continue - } - goFiles, _ := filepath.Glob(filepath.Join(root, e.Name(), "*.go")) - if len(goFiles) > 0 { - dirs = append(dirs, e.Name()) - } - } - sort.Strings(dirs) - return dirs -} - -func parsePackage(dir, dirName string) (*pkgInfo, error) { - fset := token.NewFileSet() - // Parse every target's source so the generated CLI exposes the complete NDK API. - //nolint:staticcheck // Build-aware package loading would omit cross-target declarations. - pkgs, err := parser.ParseDir(fset, dir, func(fi os.FileInfo) bool { - return !strings.HasSuffix(fi.Name(), "_test.go") - }, 0) - if err != nil { - return nil, err - } - - for pkgName, pkg := range pkgs { - info := &pkgInfo{ - name: pkgName, - dir: dirName, - alias: aliasMap[dirName], - types: map[string]*typeInfo{}, - importPath: goModule + "/" + dirName, - typeAliases: map[string]string{}, - } - - for _, file := range pkg.Files { - extractFromFile(file, info) - } - - // Identify constructors. - var remaining []funcInfo - for i := range info.funcs { - fn := &info.funcs[i] - typeName := constructorFor(fn) - if typeName != "" { - if ti, ok := info.types[typeName]; ok { - fnCopy := *fn - ti.constructor = &fnCopy - continue - } - } - remaining = append(remaining, *fn) - } - info.funcs = remaining - - // Check Close(). - for _, ti := range info.types { - for _, m := range ti.methods { - if m.name == "Close" { - ti.hasClose = true - } - } - } - - return info, nil - } - return nil, nil -} - -func extractFromFile(file *ast.File, info *pkgInfo) { - for _, decl := range file.Decls { - switch d := decl.(type) { - case *ast.GenDecl: - for _, spec := range d.Specs { - ts, ok := spec.(*ast.TypeSpec) - if !ok || !ts.Name.IsExported() { - continue - } - switch tt := ts.Type.(type) { - case *ast.StructType: - if _, exists := info.types[ts.Name.Name]; !exists { - info.types[ts.Name.Name] = &typeInfo{name: ts.Name.Name} - } - case *ast.Ident: - info.typeAliases[ts.Name.Name] = tt.Name - case *ast.SelectorExpr: - info.typeAliases[ts.Name.Name] = typeString(tt) - } - } - case *ast.FuncDecl: - if !d.Name.IsExported() { - continue - } - fn := extractFunc(d) - if fn == nil { - continue - } - if fn.recv != "" { - ti, ok := info.types[fn.recv] - if !ok { - ti = &typeInfo{name: fn.recv} - info.types[fn.recv] = ti - } - ti.methods = append(ti.methods, *fn) - } else { - info.funcs = append(info.funcs, *fn) - } - } - } -} - -func extractFunc(d *ast.FuncDecl) *funcInfo { - fn := &funcInfo{name: d.Name.Name} - if d.Recv != nil && len(d.Recv.List) > 0 { - fn.recv = recvTypeName(d.Recv.List[0].Type) - if fn.recv == "" { - return nil - } - } - if d.Type.Params != nil { - for _, field := range d.Type.Params.List { - goType := typeString(field.Type) - names := fieldNames(field) - for _, name := range names { - fn.params = append(fn.params, paramInfo{name: name, goType: goType}) - } - } - } - if d.Type.Results != nil { - for _, field := range d.Type.Results.List { - fn.returns = append(fn.returns, returnInfo{goType: typeString(field.Type)}) - } - } - return fn -} - -func recvTypeName(expr ast.Expr) string { - switch t := expr.(type) { - case *ast.StarExpr: - if id, ok := t.X.(*ast.Ident); ok { - return id.Name - } - case *ast.Ident: - return t.Name - } - return "" -} - -func typeString(expr ast.Expr) string { - switch t := expr.(type) { - case *ast.Ident: - return t.Name - case *ast.StarExpr: - return "*" + typeString(t.X) - case *ast.ArrayType: - if t.Len == nil { - return "[]" + typeString(t.Elt) - } - return "[...]" + typeString(t.Elt) - case *ast.SelectorExpr: - return typeString(t.X) + "." + t.Sel.Name - case *ast.InterfaceType: - return "interface{}" - case *ast.MapType: - return "map" - case *ast.FuncType: - return "func" - case *ast.Ellipsis: - return "..." + typeString(t.Elt) - default: - return "unknown" - } -} - -func fieldNames(field *ast.Field) []string { - if len(field.Names) == 0 { - return []string{"value"} - } - var names []string - for _, n := range field.Names { - names = append(names, n.Name) - } - return names -} - -// resolveType resolves type aliases transitively to a primitive. -func resolveType(goType string, aliases map[string]string) string { - // Handle output pointer params: *int32 → output_int32 - if strings.HasPrefix(goType, "*") { - inner := goType[1:] - resolved := resolveType(inner, aliases) - switch resolved { - case "int32", "int64", "uint32", "uint64", "float32", "float64": - return "output_" + resolved - } - return goType // can't resolve - } - // Handle []byte - if goType == "[]byte" || goType == "[]uint8" { - return "[]byte" - } - // Direct primitive check. - if isPrimitive(goType) { - return goType - } - // Resolve via alias map. - if underlying, ok := aliases[goType]; ok { - return resolveType(underlying, aliases) - } - return goType -} - -// flagReturnType returns the Go type that the cobra flag getter returns. -func flagReturnType(resolved string) string { - switch resolved { - case "string": - return "string" - case "int32": - return "int32" - case "int64": - return "int64" - case "int": - return "int" - case "uint16": - return "int32" // promoted — cobra has no uint16 flag - case "uint32": - return "uint32" - case "uint64": - return "uint64" - case "float32": - return "float32" - case "float64": - return "float64" - case "bool": - return "bool" - } - return resolved -} - -func isPrimitive(t string) bool { - switch t { - case "string", "int32", "int64", "int", "uint16", "uint32", "uint64", - "float32", "float64", "bool", "byte", "uint8": - return true - } - return false -} - -// isCLIType returns the cobra flag getter name, or "" if unsupported. -func isCLIType(goType string) string { - switch goType { - case "string": - return "GetString" - case "int32": - return "GetInt32" - case "int": - return "GetInt" - case "int64": - return "GetInt64" - case "uint16": - return "GetInt32" - case "uint32": - return "GetUint32" - case "uint64": - return "GetUint64" - case "float32": - return "GetFloat32" - case "float64": - return "GetFloat64" - case "bool": - return "GetBool" - } - // Output pointer params are handled specially (no flag needed, auto-printed). - if strings.HasPrefix(goType, "output_") { - return "output" - } - return "" -} - -// flagRegister returns the cobra flag registration method name. -func flagRegister(goType string) string { - switch goType { - case "string": - return "String" - case "int32": - return "Int32" - case "int": - return "Int" - case "int64": - return "Int64" - case "uint16": - return "Int32" - case "uint32": - return "Uint32" - case "uint64": - return "Uint64" - case "float32": - return "Float32" - case "float64": - return "Float64" - case "bool": - return "Bool" - } - if strings.HasPrefix(goType, "output_") { - return "" // output params don't need flags - } - return "" -} - -// flagDefault returns the zero-value literal for the type. -func flagDefault(goType string) string { - switch goType { - case "string": - return `""` - case "bool": - return "false" - default: - return "0" - } -} - -func isCLICompatible(fn funcInfo, aliases map[string]string) bool { - for _, p := range fn.params { - resolved := resolveType(p.goType, aliases) - if isCLIType(resolved) == "" { - return false - } - } - return true -} - -func shouldSkip(fn funcInfo) bool { - switch fn.name { - case "Pointer", "Close": - return true - } - return strings.HasSuffix(fn.name, "FromPointer") -} - -func constructorFor(fn *funcInfo) string { - if strings.HasSuffix(fn.name, "FromPointer") { - return "" - } - if fn.name == "GetInstance" { - if len(fn.returns) > 0 { - return strings.TrimPrefix(fn.returns[0].goType, "*") - } - return "" - } - if !strings.HasPrefix(fn.name, "New") { - return "" - } - typeName := strings.TrimPrefix(fn.name, "New") - - // Verify the function actually returns *TypeName or (*TypeName, error). - if len(fn.returns) == 0 { - return "" - } - firstRet := fn.returns[0].goType - if firstRet != "*"+typeName { - return "" - } - return typeName -} - -func generateFile(pkg *pkgInfo) string { - var buf bytes.Buffer - pkgPrefix := sanitizeVarPrefix(pkg.dir) - pkgRef := pkg.name - if pkg.alias != "" { - pkgRef = pkg.alias - } - - type leafCmd struct { - parentVar string - varName string - use string - short string - body string // RunE body - flagRegs []string // flag registration lines - } - type groupCmd struct { - parentVar string - varName string - use string - short string - } - - var leafs []leafCmd - var groups []groupCmd - usedVarNames := map[string]bool{} - - // Package-level functions. - for _, fn := range pkg.funcs { - if shouldSkip(fn) || !isCLICompatible(fn, pkg.typeAliases) { - continue - } - varName := uniqueVar(pkgPrefix+camelCase(fn.name)+"Cmd", usedVarNames) - body, flagRegs := genFuncBody(pkgRef, fn, varName, pkg.typeAliases) - leafs = append(leafs, leafCmd{ - parentVar: pkgPrefix + "Cmd", - varName: varName, - use: kebabCase(fn.name), - short: pkg.name + "." + fn.name + "()", - body: body, - flagRegs: flagRegs, - }) - } - - // Types with methods. - typeNames := sortedTypeNames(pkg.types) - for _, typeName := range typeNames { - ti := pkg.types[typeName] - typeVar := uniqueVar(pkgPrefix+typeName+"Cmd", usedVarNames) - var typeLeafs []leafCmd - - // Constructor. - if ti.constructor != nil && isCLICompatible(*ti.constructor, pkg.typeAliases) { - varName := uniqueVar(pkgPrefix+typeName+"NewCmd", usedVarNames) - body, flagRegs := genConstructorBody(pkgRef, ti, varName, pkg.typeAliases) - typeLeafs = append(typeLeafs, leafCmd{ - parentVar: typeVar, - varName: varName, - use: "new", - short: "Create " + typeName, - body: body, - flagRegs: flagRegs, - }) - } - - // Methods. - for _, m := range ti.methods { - if shouldSkip(m) || !isCLICompatible(m, pkg.typeAliases) { - continue - } - varName := uniqueVar(pkgPrefix+typeName+camelCase(m.name)+"Cmd", usedVarNames) - body, flagRegs := genMethodBody(pkgRef, ti, m, varName, pkg.typeAliases) - typeLeafs = append(typeLeafs, leafCmd{ - parentVar: typeVar, - varName: varName, - use: kebabCase(m.name), - short: typeName + "." + m.name + "()", - body: body, - flagRegs: flagRegs, - }) - } - - if len(typeLeafs) == 0 { - continue - } - - groups = append(groups, groupCmd{ - parentVar: pkgPrefix + "Cmd", - varName: typeVar, - use: kebabCase(typeName), - short: typeName + " operations", - }) - leafs = append(leafs, typeLeafs...) - } - - if len(leafs) == 0 { - return "" - } - - // Emit file. - buf.WriteString("// Code generated by cligen. DO NOT EDIT.\n\n") - buf.WriteString("package main\n\n") - // Check if any command actually uses the package. - needsPkgImport := false - for _, l := range leafs { - if !strings.Contains(l.body, "requires external context") { - needsPkgImport = true - break - } - } - - buf.WriteString("import (\n") - buf.WriteString("\t\"fmt\"\n\n") - buf.WriteString("\t\"github.com/spf13/cobra\"\n") - if needsPkgImport { - if pkg.alias != "" { - fmt.Fprintf(&buf, "\t%s %q\n", pkg.alias, pkg.importPath) - } else { - fmt.Fprintf(&buf, "\t%q\n", pkg.importPath) - } - } - buf.WriteString(")\n\n") - - // Top-level package command. - fmt.Fprintf(&buf, "var %sCmd = &cobra.Command{\n", pkgPrefix) - fmt.Fprintf(&buf, "\tUse: %q,\n", pkg.dir) - fmt.Fprintf(&buf, "\tShort: %q,\n", pkg.name+" NDK module") - fmt.Fprintf(&buf, "}\n\n") - - // Group commands. - for _, g := range groups { - fmt.Fprintf(&buf, "var %s = &cobra.Command{\n", g.varName) - fmt.Fprintf(&buf, "\tUse: %q,\n", g.use) - fmt.Fprintf(&buf, "\tShort: %q,\n", g.short) - fmt.Fprintf(&buf, "}\n\n") - } - - // Leaf commands. - for _, l := range leafs { - fmt.Fprintf(&buf, "var %s = &cobra.Command{\n", l.varName) - fmt.Fprintf(&buf, "\tUse: %q,\n", l.use) - fmt.Fprintf(&buf, "\tShort: %q,\n", l.short) - fmt.Fprintf(&buf, "\tRunE: func(cmd *cobra.Command, args []string) error {\n") - buf.WriteString(l.body) - fmt.Fprintf(&buf, "\t},\n") - fmt.Fprintf(&buf, "}\n\n") - } - - // init(). - buf.WriteString("func init() {\n") - - // Flag registrations. - for _, l := range leafs { - for _, reg := range l.flagRegs { - buf.WriteString(reg) - } - } - - // AddCommand. - for _, g := range groups { - fmt.Fprintf(&buf, "\t%s.AddCommand(%s)\n", g.parentVar, g.varName) - } - for _, l := range leafs { - fmt.Fprintf(&buf, "\t%s.AddCommand(%s)\n", l.parentVar, l.varName) - } - fmt.Fprintf(&buf, "\trootCmd.AddCommand(%sCmd)\n", pkgPrefix) - buf.WriteString("}\n") - - return buf.String() -} - -// genParamCode generates flag registration and body code for a set of params. -// It returns: flag registrations, body lines, and call argument expressions. -func genParamCode( - params []paramInfo, - cmdVar string, - prefix string, // "ctor" for constructor params, "" for regular - aliases map[string]string, - pkgRef string, -) ([]string, string, string) { - var flagRegs []string - var body bytes.Buffer - var callArgs []string - var outputDecls []string - - for _, p := range params { - resolved := resolveType(p.goType, aliases) - varName := prefix + p.name - if prefix != "" { - varName = prefix + camelCase(p.name) - } - flagName := kebabCase(p.name) - if prefix != "" { - flagName = prefix + "-" + flagName - } - - // Output pointer param — declare var, pass &var, print after call. - if strings.HasPrefix(resolved, "output_") { - innerType := strings.TrimPrefix(resolved, "output_") - fmt.Fprintf(&body, "\t\tvar %s %s\n", varName, innerType) - // Need cast: &varName might need (*OrigType)(unsafe.Pointer(&varName)) - if p.goType == "*"+innerType { - callArgs = append(callArgs, "&"+varName) - } else { - // The original type is e.g. *Int where Int is int32. - // We pass the address of our int32 var, cast to the named type. - origInner := strings.TrimPrefix(p.goType, "*") - callArgs = append(callArgs, "(*"+pkgRef+"."+origInner+")(unsafe.Pointer(&"+varName+"))") - } - outputDecls = append(outputDecls, varName) - continue - } - - getter := isCLIType(resolved) - regMethod := flagRegister(resolved) - defVal := flagDefault(resolved) - - // Skip params with unsupported types (no CLI flag possible). - if getter == "" || regMethod == "" { - continue - } - - flagRegs = append(flagRegs, fmt.Sprintf("\t%s.Flags().%s(%q, %s, %q)\n", - cmdVar, regMethod, flagName, defVal, p.name)) - - // The flag getter may return a different type than the param - // (e.g., uint16 → GetInt32 returns int32). Determine if we - // need a cast from the flag type to the param type. - flagType := flagReturnType(resolved) - fmt.Fprintf(&body, "\t\t%s, _ := cmd.Flags().%s(%q)\n", varName, getter, flagName) - - switch { - case p.goType == flagType: - // Types match exactly — no cast. - callArgs = append(callArgs, varName) - case isPrimitive(p.goType): - // Builtin type (uint16, int, etc.) — direct cast. - callArgs = append(callArgs, p.goType+"("+varName+")") - default: - // Package-defined type — qualified cast. - callArgs = append(callArgs, pkgRef+"."+p.goType+"("+varName+")") - } - } - - // Print output params after the call. - for _, out := range outputDecls { - body.WriteString("\t\t// output param " + out + " printed below\n") - } - - return flagRegs, body.String(), strings.Join(callArgs, ", ") -} - -func genFuncBody( - pkgRef string, - fn funcInfo, - cmdVar string, - aliases map[string]string, -) (string, []string) { - var body bytes.Buffer - - flagRegs, paramBody, callArgs := genParamCode(fn.params, cmdVar, "", aliases, pkgRef) - body.WriteString(paramBody) - - hasError := len(fn.returns) > 0 && fn.returns[len(fn.returns)-1].goType == "error" - hasResult := len(fn.returns) > 0 && fn.returns[0].goType != "error" - hasExtra := len(fn.returns) > 1 && !hasError - - writeCall(&body, pkgRef+"."+fn.name, callArgs, hasResult, hasError, hasExtra, false) - - return body.String(), flagRegs -} - -func genConstructorBody( - pkgRef string, - ti *typeInfo, - cmdVar string, - aliases map[string]string, -) (string, []string) { - var body bytes.Buffer - fn := ti.constructor - - flagRegs, paramBody, callArgs := genParamCode(fn.params, cmdVar, "", aliases, pkgRef) - body.WriteString(paramBody) - - hasError := len(fn.returns) > 1 && fn.returns[len(fn.returns)-1].goType == "error" - - if hasError { - objVar := "obj" - if !ti.hasClose { - objVar = "_" - } - fmt.Fprintf(&body, "\t\t%s, err := %s.%s(%s)\n", objVar, pkgRef, fn.name, callArgs) - body.WriteString("\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n") - } else { - if ti.hasClose { - fmt.Fprintf(&body, "\t\tobj := %s.%s(%s)\n", pkgRef, fn.name, callArgs) - } else { - fmt.Fprintf(&body, "\t\t_ = %s.%s(%s)\n", pkgRef, fn.name, callArgs) - } - } - if ti.hasClose { - body.WriteString("\t\tdefer obj.Close()\n") - } - body.WriteString("\t\tfmt.Println(\"created successfully\")\n") - body.WriteString("\t\treturn nil\n") - - return body.String(), flagRegs -} - -func genMethodBody( - pkgRef string, - ti *typeInfo, - m funcInfo, - cmdVar string, - aliases map[string]string, -) (string, []string) { - var body bytes.Buffer - var allFlagRegs []string - - // Constructor params. If constructor has non-CLI-compatible params, - // treat the type as requiring external context. - if ti.constructor != nil && !isCLICompatible(*ti.constructor, aliases) { - ti = &typeInfo{name: ti.name} // no usable constructor - } - if ti.constructor != nil { - ctorFlagRegs, ctorBody, ctorCallArgs := genParamCode(ti.constructor.params, cmdVar, "ctor", aliases, pkgRef) - allFlagRegs = append(allFlagRegs, ctorFlagRegs...) - body.WriteString(ctorBody) - _ = ctorCallArgs // used below - } - - // Method params. - mFlagRegs, mBody, mCallArgs := genParamCode(m.params, cmdVar, "", aliases, pkgRef) - allFlagRegs = append(allFlagRegs, mFlagRegs...) - - // Construct receiver. - if ti.constructor == nil { - var stubBody bytes.Buffer - stubBody.WriteString("\t\tfmt.Println(\"requires external context (NativeActivity, JNI, etc.)\")\n") - stubBody.WriteString("\t\treturn nil\n") - return stubBody.String(), nil - } - - // Re-generate ctor call args from the ctor params. - _, _, ctorCallArgs := genParamCode(ti.constructor.params, cmdVar, "ctor", aliases, pkgRef) - ctorHasError := len(ti.constructor.returns) > 1 && ti.constructor.returns[len(ti.constructor.returns)-1].goType == "error" - - if ctorHasError { - fmt.Fprintf(&body, "\t\tobj, err := %s.%s(%s)\n", pkgRef, ti.constructor.name, ctorCallArgs) - body.WriteString("\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n") - } else { - fmt.Fprintf(&body, "\t\tobj := %s.%s(%s)\n", pkgRef, ti.constructor.name, ctorCallArgs) - } - if ti.hasClose { - body.WriteString("\t\tdefer obj.Close()\n") - } - - body.WriteString(mBody) - - // Call method. - hasError := len(m.returns) > 0 && m.returns[len(m.returns)-1].goType == "error" - hasResult := len(m.returns) > 0 && m.returns[0].goType != "error" - - hasExtra := len(m.returns) > 1 && !hasError - writeCall(&body, "obj."+m.name, mCallArgs, hasResult, hasError, hasExtra, ctorHasError) - - return body.String(), allFlagRegs -} - -func writeCall( - buf *bytes.Buffer, - callExpr string, - callArgs string, - hasResult bool, - hasError bool, - hasExtra bool, - alreadyHasErr bool, -) { - errAssign := "err :=" - if alreadyHasErr { - errAssign = "err =" - } - - switch { - case hasResult && hasError: - // Always use := since result is new. err gets re-declared (valid in Go). - fmt.Fprintf(buf, "\t\tresult, err := %s(%s)\n", callExpr, callArgs) - buf.WriteString("\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n") - buf.WriteString("\t\tfmt.Println(result)\n") - case hasResult && hasExtra: - fmt.Fprintf(buf, "\t\tresult, extra := %s(%s)\n", callExpr, callArgs) - buf.WriteString("\t\t_ = extra\n") - buf.WriteString("\t\tfmt.Println(result)\n") - case hasResult: - fmt.Fprintf(buf, "\t\tresult := %s(%s)\n", callExpr, callArgs) - buf.WriteString("\t\tfmt.Println(result)\n") - case hasError: - fmt.Fprintf(buf, "\t\t%s %s(%s)\n", errAssign, callExpr, callArgs) - buf.WriteString("\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n") - buf.WriteString("\t\tfmt.Println(\"ok\")\n") - default: - fmt.Fprintf(buf, "\t\t%s(%s)\n", callExpr, callArgs) - buf.WriteString("\t\tfmt.Println(\"ok\")\n") - } - buf.WriteString("\t\treturn nil\n") -} - -func kebabCase(s string) string { - var result []rune - for i, r := range s { - if unicode.IsUpper(r) && i > 0 { - prev := rune(s[i-1]) - if unicode.IsLower(prev) || (i+1 < len(s) && unicode.IsLower(rune(s[i+1]))) { - result = append(result, '-') - } - } - result = append(result, unicode.ToLower(r)) - } - return string(result) -} - -func camelCase(s string) string { - if len(s) == 0 { - return s - } - return strings.ToUpper(s[:1]) + s[1:] -} - -func uniqueVar(name string, used map[string]bool) string { - if !used[name] { - used[name] = true - return name - } - for i := 2; ; i++ { - candidate := fmt.Sprintf("%s%d", name, i) - if !used[candidate] { - used[candidate] = true - return candidate - } - } -} - -func sanitizeVarPrefix(s string) string { - return strings.ReplaceAll(s, "-", "_") -} - -func sortedTypeNames(types map[string]*typeInfo) []string { - var names []string - for n := range types { - names = append(names, n) - } - sort.Strings(names) - return names -} diff --git a/tools/cmd/headerspec/main.go b/tools/cmd/headerspec/main.go deleted file mode 100644 index 8ccf99b..0000000 --- a/tools/cmd/headerspec/main.go +++ /dev/null @@ -1,173 +0,0 @@ -// Command headerspec generates spec YAML and capi/ Go packages from NDK C headers -// using clang AST. -// -// Usage: -// -// headerspec -manifest capi/manifests/looper.yaml \ -// -ndk-sysroot $NDK_SYSROOT \ -// -module-path github.com/AndroidGoLab/ndk \ -// -out-spec spec/generated/looper.yaml \ -// -out-capi capi/looper -package main - -import ( - "flag" - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/headerspec" -) - -func main() { - var ( - manifestPath = flag.String("manifest", "", "path to manifest YAML (e.g. capi/manifests/looper.yaml)") - ndkSysroot = flag.String("ndk-sysroot", "", "path to NDK sysroot (e.g. $NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot)") - modulePath = flag.String("module-path", "github.com/AndroidGoLab/ndk", "Go module path") - outSpec = flag.String("out-spec", "", "output spec YAML path") - outCapi = flag.String("out-capi", "", "output capi/ package directory (e.g. capi/looper)") - target = flag.String("target", "aarch64-linux-android26", "clang target triple") - ) - flag.Parse() - - if *manifestPath == "" || *ndkSysroot == "" || (*outSpec == "" && *outCapi == "") { - fmt.Fprintln(os.Stderr, "usage: headerspec -manifest -ndk-sysroot [-out-spec ] [-out-capi ] [-module-path ] [-target ]") - os.Exit(1) - } - - if err := run(*manifestPath, *ndkSysroot, *modulePath, *outSpec, *outCapi, *target); err != nil { - fmt.Fprintf(os.Stderr, "headerspec: %v\n", err) - os.Exit(1) - } -} - -func run( - manifestPath string, - ndkSysroot string, - modulePath string, - outSpec string, - outCapi string, - target string, -) error { - manifest, err := headerspec.ParseManifest(manifestPath) - if err != nil { - return err - } - - clangBin := findClang(ndkSysroot) - - jsonData, err := runClang(clangBin, ndkSysroot, target, manifest.Generator.Includes) - if err != nil { - return err - } - - root, err := headerspec.ParseClangAST(jsonData) - if err != nil { - return fmt.Errorf("parsing clang AST: %w", err) - } - - decls := headerspec.ExtractDeclarations(root, manifest.Generator.Includes) - - rules := manifest.Translator.Rules["global"] - filtered := headerspec.ApplyRules(decls, rules) - - if outSpec != "" { - sourcePackage := modulePath + "/capi/" + manifest.Generator.PackageName - spec := headerspec.GenerateSpec(manifest.Generator.PackageName, sourcePackage, filtered) - - if err := os.MkdirAll(filepath.Dir(outSpec), 0755); err != nil { - return fmt.Errorf("creating output directory: %w", err) - } - - if err := headerspec.WriteSpecYAML(spec, outSpec); err != nil { - return err - } - - nTypes := 0 - if spec.Types != nil { - nTypes = len(spec.Types) - } - nEnums := 0 - if spec.Enums != nil { - nEnums = len(spec.Enums) - } - nFuncs := 0 - if spec.Functions != nil { - nFuncs = len(spec.Functions) - } - nCallbacks := 0 - if spec.Callbacks != nil { - nCallbacks = len(spec.Callbacks) - } - - fmt.Printf("headerspec: wrote %s (%d types, %d enums, %d functions, %d callbacks)\n", - outSpec, nTypes, nEnums, nFuncs, nCallbacks) - } - - if outCapi != "" { - if err := headerspec.GenerateCapiPackage(manifest, filtered, outCapi); err != nil { - return fmt.Errorf("generating capi package: %w", err) - } - fmt.Printf("headerspec: wrote capi package to %s (%d functions, %d types)\n", - outCapi, len(filtered.Functions), len(filtered.Typedefs)) - } - - return nil -} - -// findClang locates the clang binary relative to the NDK sysroot. -// The sysroot is at .../toolchains/llvm/prebuilt//sysroot, -// so the binary is at .../toolchains/llvm/prebuilt//bin/clang. -func findClang(sysroot string) string { - // Strip trailing /sysroot to get the prebuilt prefix. - prefix := strings.TrimSuffix(sysroot, "/sysroot") - prefix = strings.TrimSuffix(prefix, "/") - return filepath.Join(prefix, "bin", "clang") -} - -// runClang invokes clang with -ast-dump=json and returns the JSON output. -func runClang( - clangBin string, - sysroot string, - target string, - includes []string, -) ([]byte, error) { - // Create a temporary .c file that includes all requested headers. - tmpFile, err := os.CreateTemp("", "headerspec-*.c") - if err != nil { - return nil, fmt.Errorf("creating temp file: %w", err) - } - defer func() { _ = os.Remove(tmpFile.Name()) }() - - var sb strings.Builder - for _, inc := range includes { - fmt.Fprintf(&sb, "#include <%s>\n", inc) - } - if _, err := tmpFile.WriteString(sb.String()); err != nil { - _ = tmpFile.Close() - return nil, fmt.Errorf("writing temp file: %w", err) - } - _ = tmpFile.Close() - - args := []string{ - "-target", target, - "--sysroot=" + sysroot, - "-I" + filepath.Join(sysroot, "usr", "include"), - "-Xclang", "-ast-dump=json", - "-fsyntax-only", - "-x", "c", - tmpFile.Name(), - } - - cmd := exec.Command(clangBin, args...) - cmd.Stderr = os.Stderr - - out, err := cmd.Output() - if err != nil { - return nil, fmt.Errorf("running clang: %w", err) - } - - return out, nil -} diff --git a/tools/cmd/idiomgen/main.go b/tools/cmd/idiomgen/main.go deleted file mode 100644 index 294e044..0000000 --- a/tools/cmd/idiomgen/main.go +++ /dev/null @@ -1,45 +0,0 @@ -// Command idiomgen generates idiomatic Go packages from specs and overlays. -package main - -import ( - "flag" - "fmt" - "os" - - "github.com/AndroidGoLab/ndk/tools/pkg/idiomgen" -) - -func main() { - var ( - specPath = flag.String("spec", "", "path to generated spec YAML") - overlayPath = flag.String("overlay", "", "path to overlay YAML (optional)") - tmplDir = flag.String("templates", "templates", "path to template directory") - outDir = flag.String("out", "", "output directory for generated Go package") - capiDir = flag.String("capi-dir", "", "output directory for generated bridge files in capi package (optional)") - ) - flag.Parse() - - if *specPath == "" || *outDir == "" { - fmt.Fprintln(os.Stderr, "usage: idiomgen -spec -out [-overlay ] [-templates ] [-capi-dir ]") - os.Exit(1) - } - - spec, err := idiomgen.LoadSpec(*specPath) - if err != nil { - fmt.Fprintf(os.Stderr, "load spec: %v\n", err) - os.Exit(1) - } - - overlay, err := idiomgen.LoadOverlayOrEmpty(*overlayPath) - if err != nil { - fmt.Fprintf(os.Stderr, "load overlay: %v\n", err) - os.Exit(1) - } - - if err := idiomgen.Generate(spec, overlay, *tmplDir, *outDir, *capiDir); err != nil { - fmt.Fprintf(os.Stderr, "generate: %v\n", err) - os.Exit(1) - } - - fmt.Printf("idiomgen: generated %s -> %s\n", spec.Module, *outDir) -} diff --git a/tools/cmd/ndk-build/main.go b/tools/cmd/ndk-build/main.go deleted file mode 100644 index 0613deb..0000000 --- a/tools/cmd/ndk-build/main.go +++ /dev/null @@ -1,75 +0,0 @@ -// Command ndk-build produces a signed Android APK from a Go package -// using the Android SDK/NDK toolchain. -package main - -import ( - "flag" - "fmt" - "os" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/apkbuild" -) - -func main() { - var ( - output = flag.String("o", "", "Output APK path (default: .apk)") - manifest = flag.String("manifest", "AndroidManifest.xml", "Path to AndroidManifest.xml") - arch = flag.String("arch", "arm64", "Target architectures, comma-separated (arm64,x86_64,arm,x86)") - apiLevel = flag.Int("api", 35, "Android API level") - keystore = flag.String("keystore", "", "Keystore for signing (default: ~/.android/debug.keystore)") - libName = flag.String("name", "", "Library name (default: derived from package)") - ) - - flag.Usage = func() { - fmt.Fprintf(os.Stderr, "Usage: go-ndk-build [flags] \n\n") - fmt.Fprintf(os.Stderr, "Build a signed Android APK from a Go package.\n\n") - fmt.Fprintf(os.Stderr, "Flags:\n") - flag.PrintDefaults() - fmt.Fprintf(os.Stderr, "\nEnvironment:\n") - fmt.Fprintf(os.Stderr, " ANDROID_HOME Android SDK path (default: ~/Android/Sdk)\n") - fmt.Fprintf(os.Stderr, " ANDROID_NDK_HOME Android NDK path (default: latest in $ANDROID_HOME/ndk/)\n") - } - - flag.Parse() - - if flag.NArg() != 1 { - flag.Usage() - os.Exit(1) - } - - goPackage := flag.Arg(0) - - var archs []string - for _, a := range strings.Split(*arch, ",") { - a = strings.TrimSpace(a) - if a != "" { - archs = append(archs, a) - } - } - - cfg := apkbuild.Config{ - GoPackage: goPackage, - OutputPath: *output, - ManifestPath: *manifest, - Architectures: archs, - APILevel: *apiLevel, - KeystorePath: *keystore, - LibName: *libName, - } - - if err := apkbuild.Build(cfg); err != nil { - fmt.Fprintf(os.Stderr, "error: %v\n", err) - os.Exit(1) - } - - outputPath := cfg.OutputPath - if outputPath == "" { - name := cfg.LibName - if name == "" { - name = goPackage - } - outputPath = name + ".apk" - } - fmt.Printf("APK: %s\n", outputPath) -} diff --git a/tools/cmd/ndkcli-commands/main.go b/tools/cmd/ndkcli-commands/main.go deleted file mode 100644 index 4d74999..0000000 --- a/tools/cmd/ndkcli-commands/main.go +++ /dev/null @@ -1,180 +0,0 @@ -// Command ndkcli-commands parses cmd/ndkcli/ source files and prints -// the full cobra command tree without compiling the binary (which -// requires Android NDK libraries). -package main - -import ( - "fmt" - "go/ast" - "go/parser" - "go/token" - "os" - "sort" - "strings" -) - -type cmdInfo struct { - varName string - use string - short string -} - -func main() { - dir := "cmd/ndkcli" - if len(os.Args) > 1 { - dir = os.Args[1] - } - - fset := token.NewFileSet() - // Parse every target's source so the report covers the complete generated CLI. - //nolint:staticcheck // Build-aware package loading would omit cross-target commands. - pkgs, err := parser.ParseDir(fset, dir, func(fi os.FileInfo) bool { - return !strings.HasSuffix(fi.Name(), "_test.go") - }, 0) - if err != nil { - fmt.Fprintf(os.Stderr, "parse error: %v\n", err) - os.Exit(1) - } - - // Collect all cobra.Command variable declarations. - commands := map[string]cmdInfo{} - // Collect AddCommand calls to build parent→child relationships. - children := map[string][]string{} // parent var → child vars - - for _, pkg := range pkgs { - for _, file := range pkg.Files { - collectCommands(file, commands) - collectAddCommands(file, children) - } - } - - // Build tree from rootCmd down. - printTree("rootCmd", commands, children, "ndkcli", 0) -} - -func collectCommands( - file *ast.File, - commands map[string]cmdInfo, -) { - for _, decl := range file.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok || genDecl.Tok != token.VAR { - continue - } - for _, spec := range genDecl.Specs { - vs, ok := spec.(*ast.ValueSpec) - if !ok || len(vs.Names) != 1 || len(vs.Values) != 1 { - continue - } - varName := vs.Names[0].Name - - // Look for &cobra.Command{...} composite literals. - unary, ok := vs.Values[0].(*ast.UnaryExpr) - if !ok { - continue - } - comp, ok := unary.X.(*ast.CompositeLit) - if !ok { - continue - } - - use, short := extractFields(comp) - if use == "" { - continue - } - commands[varName] = cmdInfo{ - varName: varName, - use: use, - short: short, - } - } - } -} - -func extractFields( - comp *ast.CompositeLit, -) (string, string) { - var use, short string - for _, elt := range comp.Elts { - kv, ok := elt.(*ast.KeyValueExpr) - if !ok { - continue - } - key, ok := kv.Key.(*ast.Ident) - if !ok { - continue - } - val, ok := kv.Value.(*ast.BasicLit) - if !ok || val.Kind != token.STRING { - continue - } - v := strings.Trim(val.Value, "\"") - switch key.Name { - case "Use": - use = v - case "Short": - short = v - } - } - return use, short -} - -func collectAddCommands( - file *ast.File, - children map[string][]string, -) { - ast.Inspect(file, func(n ast.Node) bool { - call, ok := n.(*ast.CallExpr) - if !ok { - return true - } - sel, ok := call.Fun.(*ast.SelectorExpr) - if !ok || sel.Sel.Name != "AddCommand" { - return true - } - parentIdent, ok := sel.X.(*ast.Ident) - if !ok { - return true - } - parent := parentIdent.Name - for _, arg := range call.Args { - childIdent, ok := arg.(*ast.Ident) - if !ok { - continue - } - children[parent] = append(children[parent], childIdent.Name) - } - return true - }) -} - -func printTree( - varName string, - commands map[string]cmdInfo, - children map[string][]string, - prefix string, - depth int, -) { - kids := children[varName] - sort.Slice(kids, func(i, j int) bool { - return commands[kids[i]].use < commands[kids[j]].use - }) - - for _, child := range kids { - info, ok := commands[child] - if !ok { - continue - } - use := info.use - fullPath := prefix + " " + use - - subKids := children[child] - if len(subKids) > 0 { - // This is a group command — recurse. - printTree(child, commands, children, fullPath, depth+1) - } else { - // Leaf command. - fmt.Printf("%-50s %s\n", fullPath, info.short) - } - } -} diff --git a/tools/cmd/specgen/main.go b/tools/cmd/specgen/main.go deleted file mode 100644 index 980d3dd..0000000 --- a/tools/cmd/specgen/main.go +++ /dev/null @@ -1,254 +0,0 @@ -// Command specgen extracts structured YAML specs from c2ffi JSON output -// (or legacy Go AST parsing for test fixtures). -package main - -import ( - "flag" - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/c2ffi" - "github.com/AndroidGoLab/ndk/tools/pkg/specgen" - "gopkg.in/yaml.v3" -) - -func main() { - var ( - // c2ffi mode flags. - c2ffiJSON = flag.String("c2ffi", "", "path to c2ffi JSON output file (c2ffi mode)") - manifest = flag.String("manifest", "", "path to capi manifest YAML (required for c2ffi mode)") - ndkIncDir = flag.String("ndk-include", "", "path to NDK sysroot include directory (for c2ffi invocation and callback params)") - ndkPath = flag.String("ndk-path", "", "path to NDK root directory (for finding NDK clang)") - c2ffiBin = flag.String("c2ffi-bin", "", "path to c2ffi binary (auto-invoke mode; omit -c2ffi to use)") - - // Legacy mode flags (c-for-go Go AST). - pkgDir = flag.String("pkg", "", "path to capi package directory (legacy mode)") - - // Shared flags. - module = flag.String("module", "", "module name (defaults to manifest PackageName or directory name)") - srcPkg = flag.String("source-package", "", "Go import path of source package") - out = flag.String("out", "", "output YAML path") - - // Legacy-only. - ndkHeaders = flag.String("ndk-headers", "", "path to NDK sysroot include directory for C header struct parsing (legacy mode)") - ) - flag.Parse() - - if *out == "" { - fmt.Fprintln(os.Stderr, "usage: specgen -out [-manifest -ndk-include ] [-c2ffi ] [-pkg ]") - os.Exit(1) - } - - switch { - case *c2ffiJSON != "": - // Direct c2ffi JSON file mode. - runC2FFI(*c2ffiJSON, *manifest, *ndkIncDir, *module, *srcPkg, *out) - case *manifest != "" && *ndkIncDir != "": - // Auto-invoke c2ffi mode. - runC2FFIAuto(*manifest, *ndkIncDir, *ndkPath, *c2ffiBin, *module, *srcPkg, *out) - case *pkgDir != "": - runLegacy(*pkgDir, *module, *srcPkg, *out, *ndkHeaders) - default: - fmt.Fprintln(os.Stderr, "error: specify -manifest + -ndk-include, -c2ffi, or -pkg") - os.Exit(1) - } -} - -func runC2FFIAuto( - manifestPath string, - ndkIncDir string, - ndkPath string, - c2ffiBin string, - module string, - srcPkg string, - outPath string, -) { - mf := readManifest(manifestPath) - - if c2ffiBin == "" { - c2ffiBin = "c2ffi" - } - - // Derive NDK path from sysroot include dir if not provided. - if ndkPath == "" { - // .../sysroot/usr/include → .../ndk/VERSION - ndkPath = filepath.Dir(filepath.Dir(filepath.Dir(filepath.Dir(filepath.Dir(ndkIncDir))))) - } - - jsonData, err := c2ffi.Invoke(c2ffi.InvokeOptions{ - C2FFIBin: c2ffiBin, - NDKSysroot: ndkIncDir, - NDKPath: ndkPath, - Includes: mf.Generator.Includes, - }) - if err != nil { - fmt.Fprintf(os.Stderr, "invoke c2ffi: %v\n", err) - os.Exit(1) - } - - // Filter by target headers to exclude system types from transitive includes. - convertAndWrite(jsonData, &mf, ndkIncDir, module, srcPkg, outPath) -} - -func runC2FFI( - jsonPath string, - manifestPath string, - ndkIncDir string, - module string, - srcPkg string, - outPath string, -) { - mf := readManifest(manifestPath) - - jsonData, err := os.ReadFile(jsonPath) - if err != nil { - fmt.Fprintf(os.Stderr, "read c2ffi JSON: %v\n", err) - os.Exit(1) - } - - convertAndWrite(jsonData, &mf, ndkIncDir, module, srcPkg, outPath) -} - -func readManifest(path string) c2ffi.Manifest { - var mf c2ffi.Manifest - if path == "" { - return mf - } - - data, err := os.ReadFile(path) - if err != nil { - fmt.Fprintf(os.Stderr, "read manifest: %v\n", err) - os.Exit(1) - } - if err := yaml.Unmarshal(data, &mf); err != nil { - fmt.Fprintf(os.Stderr, "parse manifest: %v\n", err) - os.Exit(1) - } - return mf -} - -func convertAndWrite( - jsonData []byte, - mf *c2ffi.Manifest, - ndkIncDir string, - module string, - srcPkg string, - outPath string, -) { - if module == "" { - module = mf.Generator.PackageName - } - if module == "" { - module = strings.TrimSuffix(filepath.Base(outPath), ".yaml") - } - if srcPkg == "" { - srcPkg = "github.com/AndroidGoLab/ndk/capi/" + module - } - - var headerDirs []string - if ndkIncDir != "" { - for _, inc := range mf.Generator.Includes { - dir := filepath.Join(ndkIncDir, filepath.Dir(inc)) - headerDirs = appendUnique(headerDirs, dir) - } - } - - opts := c2ffi.ConvertOptions{ - Module: module, - SourcePackage: srcPkg, - TargetHeaders: mf.Generator.Includes, - Rules: mf.Translator.Rules.Global, - NDKHeaderDirs: headerDirs, - NDKSysroot: ndkIncDir, - } - - spec, err := c2ffi.Convert(jsonData, opts) - if err != nil { - fmt.Fprintf(os.Stderr, "convert c2ffi: %v\n", err) - os.Exit(1) - } - - if err := specgen.WriteSpec(*spec, outPath); err != nil { - fmt.Fprintf(os.Stderr, "write: %v\n", err) - os.Exit(1) - } - - fmt.Printf("specgen: wrote %s (%d types, %d enums, %d functions, %d callbacks, %d structs)\n", - outPath, len(spec.Types), len(spec.Enums), len(spec.Functions), len(spec.Callbacks), len(spec.Structs)) -} - -func runLegacy( - pkgDir string, - module string, - srcPkg string, - outPath string, - ndkHeaders string, -) { - if module == "" { - module = filepath.Base(pkgDir) - } - if srcPkg == "" { - srcPkg = "github.com/AndroidGoLab/ndk/capi/" + module - } - - entries, err := os.ReadDir(pkgDir) - if err != nil { - fmt.Fprintf(os.Stderr, "read dir: %v\n", err) - os.Exit(1) - } - var sources []string - for _, e := range entries { - if filepath.Ext(e.Name()) == ".go" { - sources = append(sources, filepath.Join(pkgDir, e.Name())) - } - } - - spec, err := specgen.ParseSources(module, srcPkg, sources) - if err != nil { - fmt.Fprintf(os.Stderr, "parse: %v\n", err) - os.Exit(1) - } - - if ndkHeaders != "" { - headerDirs, err := specgen.ExtractIncludeDirsFromGoFiles(sources, ndkHeaders) - if err != nil { - fmt.Fprintf(os.Stderr, "extract include dirs: %v\n", err) - os.Exit(1) - } - - for _, dir := range headerDirs { - structs, err := specgen.ParseStructsFromDir(dir) - if err != nil { - fmt.Fprintf(os.Stderr, "parse structs from %s: %v\n", dir, err) - os.Exit(1) - } - specgen.MergeStructs(&spec, structs) - - funcs, err := specgen.ParseFunctionsFromDir(dir) - if err != nil { - fmt.Fprintf(os.Stderr, "parse functions from %s: %v\n", dir, err) - os.Exit(1) - } - specgen.MergeFunctions(&spec, funcs) - } - } - - if err := specgen.WriteSpec(spec, outPath); err != nil { - fmt.Fprintf(os.Stderr, "write: %v\n", err) - os.Exit(1) - } - - fmt.Printf("specgen: wrote %s (%d types, %d enums, %d functions, %d callbacks)\n", - outPath, len(spec.Types), len(spec.Enums), len(spec.Functions), len(spec.Callbacks)) -} - -func appendUnique(slice []string, s string) []string { - for _, existing := range slice { - if existing == s { - return slice - } - } - return append(slice, s) -} diff --git a/tools/pkg/apkbuild/arch.go b/tools/pkg/apkbuild/arch.go deleted file mode 100644 index 669e4d5..0000000 --- a/tools/pkg/apkbuild/arch.go +++ /dev/null @@ -1,23 +0,0 @@ -package apkbuild - -import "fmt" - -// archMapping returns the GOARCH, Android ABI name, and NDK CC prefix -// for a given architecture alias. -func archMapping( - arch string, - apiLevel int, -) (goarch, abi, ccPrefix string) { - switch arch { - case "arm64": - return "arm64", "arm64-v8a", fmt.Sprintf("aarch64-linux-android%d", apiLevel) - case "x86_64": - return "amd64", "x86_64", fmt.Sprintf("x86_64-linux-android%d", apiLevel) - case "arm": - return "arm", "armeabi-v7a", fmt.Sprintf("armv7a-linux-androideabi%d", apiLevel) - case "x86": - return "386", "x86", fmt.Sprintf("i686-linux-android%d", apiLevel) - default: - return "", "", "" - } -} diff --git a/tools/pkg/apkbuild/build.go b/tools/pkg/apkbuild/build.go deleted file mode 100644 index a07206f..0000000 --- a/tools/pkg/apkbuild/build.go +++ /dev/null @@ -1,160 +0,0 @@ -package apkbuild - -import ( - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" -) - -// Build produces a signed APK from a Go package. -// -// The pipeline mirrors what the Makefile does: -// 1. Cross-compile Go → .so (go build -buildmode=c-shared) -// 2. Package with aapt (aapt package -f -M manifest -I platform.jar -F base.apk) -// 3. Add native libs (cd buildDir && zip -r base.apk lib/) -// 4. Align (zipalign -f -p 4) -// 5. Sign (apksigner sign --ks keystore) -func Build(cfg Config) error { - if err := cfg.validate(); err != nil { - return fmt.Errorf("invalid config: %w", err) - } - cfg.setDefaults() - - buildTools, err := cfg.findBuildTools() - if err != nil { - return err - } - - platformJar := filepath.Join( - cfg.AndroidHome, "platforms", - fmt.Sprintf("android-%d", cfg.APILevel), "android.jar", - ) - if _, err := os.Stat(platformJar); err != nil { - return fmt.Errorf( - "platform jar not found: %s (install Android SDK platform %d)", - platformJar, cfg.APILevel, - ) - } - - buildDir, err := os.MkdirTemp("", "ndk-build-*") - if err != nil { - return fmt.Errorf("creating temp dir: %w", err) - } - defer func() { _ = os.RemoveAll(buildDir) }() - - for _, arch := range cfg.Architectures { - if err := crossCompile(&cfg, buildDir, arch); err != nil { - return fmt.Errorf("cross-compile %s: %w", arch, err) - } - } - - baseAPK := filepath.Join(buildDir, "base.apk") - if err := runCmd( - filepath.Join(buildTools, "aapt"), - "package", "-f", - "-M", cfg.ManifestPath, - "-I", platformJar, - "-F", baseAPK, - ); err != nil { - return fmt.Errorf("aapt package: %w", err) - } - - if err := runCmdInDir(buildDir, "zip", "-r", "base.apk", "lib/"); err != nil { - return fmt.Errorf("adding native libs: %w", err) - } - - alignedAPK := filepath.Join(buildDir, "aligned.apk") - if err := runCmd( - filepath.Join(buildTools, "zipalign"), - "-f", "-p", "4", baseAPK, alignedAPK, - ); err != nil { - return fmt.Errorf("zipalign: %w", err) - } - - if err := ensureKeystore(&cfg); err != nil { - return fmt.Errorf("keystore: %w", err) - } - - if err := runCmd( - filepath.Join(buildTools, "apksigner"), - "sign", - "--ks", cfg.KeystorePath, - "--ks-pass", "pass:"+cfg.KeystorePass, - "--key-pass", "pass:"+cfg.KeystorePass, - alignedAPK, - ); err != nil { - return fmt.Errorf("apksigner: %w", err) - } - - if err := os.MkdirAll(filepath.Dir(cfg.OutputPath), 0o755); err != nil { - return fmt.Errorf("creating output dir: %w", err) - } - if err := copyFile(alignedAPK, cfg.OutputPath); err != nil { - return fmt.Errorf("copying APK: %w", err) - } - - return nil -} - -func crossCompile(cfg *Config, buildDir, arch string) error { - goarch, abi, ccPrefix := archMapping(arch, cfg.APILevel) - if goarch == "" { - return fmt.Errorf("unsupported architecture: %s", arch) - } - - cc := filepath.Join( - cfg.NDKPath, "toolchains", "llvm", "prebuilt", - "linux-x86_64", "bin", ccPrefix+"-clang", - ) - - libDir := filepath.Join(buildDir, "lib", abi) - if err := os.MkdirAll(libDir, 0o755); err != nil { - return err - } - - soPath := filepath.Join(libDir, "lib"+cfg.LibName+".so") - - cmd := exec.Command( - "go", "build", "-buildmode=c-shared", - "-o", soPath, cfg.GoPackage, - ) - cmd.Env = append(os.Environ(), - "CGO_ENABLED=1", - "GOOS=android", - "GOARCH="+goarch, - "CC="+cc, - ) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - return err - } - - // Remove the generated .h file that go build -buildmode=c-shared produces. - _ = os.Remove(strings.TrimSuffix(soPath, ".so") + ".h") - return nil -} - -func ensureKeystore(cfg *Config) error { - if _, err := os.Stat(cfg.KeystorePath); err == nil { - return nil - } - - if err := os.MkdirAll(filepath.Dir(cfg.KeystorePath), 0o755); err != nil { - return err - } - - return runCmd("keytool", - "-genkeypair", "-v", - "-keystore", cfg.KeystorePath, - "-storepass", cfg.KeystorePass, - "-alias", "androiddebugkey", - "-keypass", cfg.KeystorePass, - "-keyalg", "RSA", - "-keysize", "2048", - "-validity", "10000", - "-dname", "CN=Debug,O=Debug,C=US", - ) -} diff --git a/tools/pkg/apkbuild/config.go b/tools/pkg/apkbuild/config.go deleted file mode 100644 index f9ae7ab..0000000 --- a/tools/pkg/apkbuild/config.go +++ /dev/null @@ -1,103 +0,0 @@ -// Package apkbuild provides functionality for building signed Android APKs -// from Go packages using the Android SDK/NDK toolchain. -package apkbuild - -import ( - "fmt" - "os" - "path/filepath" -) - -// Config holds the configuration for building an APK. -type Config struct { - // GoPackage is the Go package to build (e.g., "./examples/camera/display"). - GoPackage string - - // OutputPath is the output APK file path. - OutputPath string - - // ManifestPath is the path to AndroidManifest.xml. - ManifestPath string - - // Architectures to build for (e.g., ["arm64", "x86_64"]). - Architectures []string - - // APILevel is the Android API level (e.g., 35). - APILevel int - - // KeystorePath is the path to the signing keystore. - KeystorePath string - - // KeystorePass is the keystore password. - KeystorePass string - - // LibName is the name for the shared library (without lib prefix and .so suffix). - LibName string - - // AndroidHome is the path to the Android SDK (default: $ANDROID_HOME or ~/Android/Sdk). - AndroidHome string - - // NDKPath is the path to the Android NDK (default: latest in AndroidHome/ndk/). - NDKPath string -} - -func (cfg *Config) validate() error { - if cfg.GoPackage == "" { - return fmt.Errorf("go package is required") - } - if cfg.ManifestPath == "" { - return fmt.Errorf("manifest path is required") - } - return nil -} - -func (cfg *Config) setDefaults() { - if cfg.AndroidHome == "" { - cfg.AndroidHome = os.Getenv("ANDROID_HOME") - if cfg.AndroidHome == "" { - home, _ := os.UserHomeDir() - cfg.AndroidHome = filepath.Join(home, "Android", "Sdk") - } - } - - if cfg.NDKPath == "" { - cfg.NDKPath = os.Getenv("ANDROID_NDK_HOME") - if cfg.NDKPath == "" { - cfg.NDKPath = findLatestDir(filepath.Join(cfg.AndroidHome, "ndk")) - } - } - - if cfg.APILevel == 0 { - cfg.APILevel = 35 - } - - if len(cfg.Architectures) == 0 { - cfg.Architectures = []string{"arm64"} - } - - if cfg.LibName == "" { - cfg.LibName = filepath.Base(cfg.GoPackage) - } - - if cfg.KeystorePath == "" { - home, _ := os.UserHomeDir() - cfg.KeystorePath = filepath.Join(home, ".android", "debug.keystore") - } - - if cfg.KeystorePass == "" { - cfg.KeystorePass = "android" - } - - if cfg.OutputPath == "" { - cfg.OutputPath = cfg.LibName + ".apk" - } -} - -func (cfg *Config) findBuildTools() (string, error) { - btDir := filepath.Join(cfg.AndroidHome, "build-tools") - latest := findLatestDir(btDir) - if latest == "" { - return "", fmt.Errorf("no build-tools found in %s", btDir) - } - return latest, nil -} diff --git a/tools/pkg/apkbuild/exec.go b/tools/pkg/apkbuild/exec.go deleted file mode 100644 index 64e1a0a..0000000 --- a/tools/pkg/apkbuild/exec.go +++ /dev/null @@ -1,25 +0,0 @@ -package apkbuild - -import ( - "os" - "os/exec" -) - -// runCmd executes a command at the given path with the provided arguments, -// forwarding stdout/stderr to the current process. -func runCmd(path string, args ...string) error { - cmd := exec.Command(path, args...) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - return cmd.Run() -} - -// runCmdInDir executes a command by name (resolved via PATH) in the given -// working directory, forwarding stdout/stderr to the current process. -func runCmdInDir(dir, name string, args ...string) error { - cmd := exec.Command(name, args...) - cmd.Dir = dir - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - return cmd.Run() -} diff --git a/tools/pkg/apkbuild/file.go b/tools/pkg/apkbuild/file.go deleted file mode 100644 index 2aedb2a..0000000 --- a/tools/pkg/apkbuild/file.go +++ /dev/null @@ -1,29 +0,0 @@ -package apkbuild - -import "os" - -// findLatestDir returns the path to the last directory entry (sorted by name) -// within the given parent directory. This works for version-numbered directories -// like build-tools/35.0.0 or ndk/27.2.12479018. -func findLatestDir(parent string) string { - entries, err := os.ReadDir(parent) - if err != nil || len(entries) == 0 { - return "" - } - - for i := len(entries) - 1; i >= 0; i-- { - if entries[i].IsDir() { - return parent + "/" + entries[i].Name() - } - } - return "" -} - -// copyFile reads src and writes its contents to dst with mode 0o644. -func copyFile(src, dst string) error { - data, err := os.ReadFile(src) - if err != nil { - return err - } - return os.WriteFile(dst, data, 0o644) -} diff --git a/tools/pkg/c2ffi/callback.go b/tools/pkg/c2ffi/callback.go deleted file mode 100644 index ff4e8f4..0000000 --- a/tools/pkg/c2ffi/callback.go +++ /dev/null @@ -1,529 +0,0 @@ -package c2ffi - -import ( - "os" - "path/filepath" - "regexp" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/specgen" - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -// funcPtrTypedefRe matches: typedef RetType (*Name)(Params); -var funcPtrTypedefRe = regexp.MustCompile( - `typedef\s+(\w[\w\s\*]*?)\s*\(\s*\*\s*(\w+)\s*\)\s*\(([^)]*)\)\s*;`, -) - -// funcPtrFieldRe matches inline struct field function pointers: -// -// RetType (*fieldName)(Params); -// -// It excludes typedef lines by using a negative lookbehind approximation: -// the match must start at the beginning of the (whitespace-trimmed) line -// and NOT begin with "typedef". -var funcPtrFieldRe = regexp.MustCompile( - `(?m)^\s+(\w[\w\s\*]*?)\s*\(\s*\*\s*(\w+)\s*\)\s*\(([^)]*)\)\s*;`, -) - -// supplementCallbacks fills in callback param/return info from C headers. -// c2ffi outputs function pointer typedefs as just ":function-pointer" -// without parameter details, so we extract them with regex. -func supplementCallbacks( - spec *specmodel.Spec, - headerDirs []string, -) { - needsCallbacks := len(spec.Callbacks) > 0 - needsStructFields := false - for _, sd := range spec.Structs { - for _, f := range sd.Fields { - if f.Type == "func_ptr" && len(f.Params) == 0 { - needsStructFields = true - break - } - } - if needsStructFields { - break - } - } - - if !needsCallbacks && !needsStructFields { - return - } - - parsed := parseCallbacksFromDirs(headerDirs) - - for name, cb := range spec.Callbacks { - if len(cb.Params) > 0 || cb.Returns != "" { - continue - } - if info, ok := parsed[name]; ok { - spec.Callbacks[name] = info - } - } - - // Also resolve func_ptr struct fields using parsed callback info - // (for typedef-based callback field types). - for sname, sd := range spec.Structs { - for i, f := range sd.Fields { - if f.Type == "" || strings.HasPrefix(f.Type, "*") || isBuiltinGoType(f.Type) { - continue - } - if info, ok := parsed[f.Type]; ok { - sd.Fields[i].Type = "func_ptr" - sd.Fields[i].Params = info.Params - sd.Fields[i].Returns = info.Returns - sd.Fields[i].ReturnsCType = info.ReturnsCType - } - } - spec.Structs[sname] = sd - } - - // Resolve inline func_ptr struct fields (those already marked as - // func_ptr by addStruct but without params) using inline function - // pointer signatures parsed from headers. - if needsStructFields { - inlineFields := parseInlineFuncPtrFieldsFromDirs(headerDirs) - for sname, sd := range spec.Structs { - for i, f := range sd.Fields { - if f.Type != "func_ptr" || len(f.Params) > 0 { - continue - } - if info, ok := inlineFields[f.Name]; ok { - sd.Fields[i].Params = info.Params - sd.Fields[i].Returns = info.Returns - sd.Fields[i].ReturnsCType = info.ReturnsCType - } - } - spec.Structs[sname] = sd - } - } -} - -func supplementFunctionParams( - spec *specmodel.Spec, - headerDirs []string, -) { - for _, dir := range headerDirs { - funcs, err := specgen.ParseFunctionsFromDir(dir) - if err != nil { - continue - } - for name, headerFunc := range funcs { - specFunc, ok := spec.Functions[name] - if !ok { - continue - } - if len(specFunc.Params) != len(headerFunc.Params) { - continue - } - for idx := range specFunc.Params { - if specFunc.Params[idx].Name != headerFunc.Params[idx].Name { - continue - } - if specFunc.Params[idx].Type != headerFunc.Params[idx].Type && - (specFunc.Params[idx].CType == "" || - canonicalCType(specFunc.Params[idx].CType) != canonicalCType(headerFunc.Params[idx].CType)) { - continue - } - if specFunc.Params[idx].CType != "" || needsHeaderCTypeMetadata(headerFunc.Params[idx].CType) { - specFunc.Params[idx].CType = headerFunc.Params[idx].CType - } - if headerFunc.Params[idx].Direction != "" { - specFunc.Params[idx].Direction = headerFunc.Params[idx].Direction - } else if isExplicitInputParam(name, headerFunc.Params[idx].Name) || - hasConstInnerPointerQualifier(headerFunc.Params[idx].CType) { - // A const qualifier between pointer levels makes the - // pointed-to array an input. A base const qualifier (for - // example const char**) does not: Android APIs such as - // AMediaFormat_getString use that form for output. - specFunc.Params[idx].Direction = "" - } - if headerFunc.Params[idx].Const { - specFunc.Params[idx].Const = true - } - } - spec.Functions[name] = specFunc - } - } -} - -// inputParamOverrides records APIs whose const char** parameter is an input -// array even though the C declarator is otherwise indistinguishable from the -// output form used by other APIs. -var inputParamOverrides = map[string]map[string]bool{ - "AIBinder_dump": {"args": true}, -} - -func isExplicitInputParam(functionName, paramName string) bool { - return inputParamOverrides[functionName][paramName] -} - -func hasConstInnerPointerQualifier(cType string) bool { - canonical := strings.ReplaceAll(cType, " ", "") - return strings.Contains(canonical, "*const*") -} - -func canonicalCType(cType string) string { - cType = strings.ReplaceAll(cType, "const", "") - cType = strings.ReplaceAll(cType, " ", "") - return cType -} - -func needsHeaderCTypeMetadata(cType string) bool { - canonical := canonicalCType(cType) - stars := strings.Count(canonical, "*") - if stars < 2 { - return false - } - base := strings.TrimSuffix(canonical, strings.Repeat("*", stars)) - switch base { - case "char", "signedchar", "unsignedchar", "int8_t", "uint8_t": - return true - default: - return false - } -} - -func isBuiltinGoType(t string) bool { - switch t { - case "int8", "uint8", "int16", "uint16", - "int32", "uint32", "int64", "uint64", - "float32", "float64", "bool", - "unsafe.Pointer", "string", "func_ptr": - return true - } - return false -} - -// parseCallbacksFromDirs reads .h files from all dirs and extracts -// function pointer typedef signatures. -func parseCallbacksFromDirs(dirs []string) map[string]specmodel.CallbackDef { - result := make(map[string]specmodel.CallbackDef) - - for _, dir := range dirs { - entries, err := os.ReadDir(dir) - if err != nil { - continue - } - - for _, e := range entries { - if e.IsDir() || filepath.Ext(e.Name()) != ".h" { - continue - } - - data, err := os.ReadFile(filepath.Join(dir, e.Name())) - if err != nil { - continue - } - - for name, cb := range parseCallbacksFromSource(string(data)) { - result[name] = cb - } - } - } - - return result -} - -// parseInlineFuncPtrFieldsFromDirs reads .h files and extracts inline -// function pointer struct field signatures (e.g., void (*onStart)(ANativeActivity* activity);). -func parseInlineFuncPtrFieldsFromDirs(dirs []string) map[string]specmodel.CallbackDef { - result := make(map[string]specmodel.CallbackDef) - - for _, dir := range dirs { - entries, err := os.ReadDir(dir) - if err != nil { - continue - } - - for _, e := range entries { - if e.IsDir() || filepath.Ext(e.Name()) != ".h" { - continue - } - - data, err := os.ReadFile(filepath.Join(dir, e.Name())) - if err != nil { - continue - } - - for name, cb := range parseInlineFuncPtrFieldsFromSource(string(data)) { - result[name] = cb - } - } - } - - return result -} - -func parseInlineFuncPtrFieldsFromSource(source string) map[string]specmodel.CallbackDef { - result := make(map[string]specmodel.CallbackDef) - source = stripNullabilityAnnotations(source) - - for _, m := range funcPtrFieldRe.FindAllStringSubmatch(source, -1) { - retType := strings.TrimSpace(m[1]) - name := m[2] - paramsStr := m[3] - - // Skip typedef lines (funcPtrFieldRe may match them too). - if retType == "typedef" || strings.HasPrefix(retType, "typedef ") { - continue - } - - cb := specmodel.CallbackDef{ - Returns: cReturnTypeToGo(retType), - ReturnsCType: normalizeCReturnType(retType), - } - - cb.Params = append(cb.Params, parseCParamList(paramsStr)...) - - result[name] = cb - } - - return result -} - -func parseCallbacksFromSource(source string) map[string]specmodel.CallbackDef { - result := make(map[string]specmodel.CallbackDef) - source = stripNullabilityAnnotations(source) - - for _, m := range funcPtrTypedefRe.FindAllStringSubmatch(source, -1) { - retType := strings.TrimSpace(m[1]) - name := m[2] - paramsStr := m[3] - - cb := specmodel.CallbackDef{ - Returns: cReturnTypeToGo(retType), - ReturnsCType: normalizeCReturnType(retType), - } - - cb.Params = append(cb.Params, parseCParamList(paramsStr)...) - - result[name] = cb - } - - return result -} - -func normalizeCReturnType(cType string) string { - cType = stripNullabilityAnnotations(cType) - cType = strings.Join(strings.Fields(cType), " ") - cType = strings.ReplaceAll(cType, " *", "*") - cType = strings.ReplaceAll(cType, "* ", "*") - if cType == "void" { - return "" - } - return cType -} - -func cReturnTypeToGo(cType string) string { - cType = strings.TrimSpace(cType) - if cType == "void" { - return "" - } - - stars := 0 - for strings.HasSuffix(cType, "*") { - stars++ - cType = strings.TrimSpace(cType[:len(cType)-1]) - } - - if cType == "void" && stars > 0 { - result := "unsafe.Pointer" - for i := 1; i < stars; i++ { - result = "*" + result - } - return result - } - - goBase := cBaseToGo(cType) - for range stars { - goBase = "*" + goBase - } - return goBase -} - -func parseCParamList(paramsStr string) []specmodel.Param { - paramsStr = strings.TrimSpace(paramsStr) - if paramsStr == "" || paramsStr == "void" { - return nil - } - - var params []specmodel.Param - for _, part := range strings.Split(paramsStr, ",") { - part = strings.TrimSpace(part) - if part == "" { - continue - } - params = append(params, parseSingleCParam(part)) - } - return params -} - -func parseSingleCParam(decl string) specmodel.Param { - decl = strings.TrimSpace(decl) - - // Strip nullability annotations. - decl = stripNullabilityAnnotations(decl) - - tokens := strings.Fields(decl) - if len(tokens) == 0 { - return specmodel.Param{} - } - - name := tokens[len(tokens)-1] - typeTokens := tokens[:len(tokens)-1] - - // Count pointer stars attached to name. - nameStars := 0 - for strings.HasPrefix(name, "*") { - nameStars++ - name = name[1:] - } - cDeclarator := normalizeCDeclarator(typeTokens, nameStars) - - // If the name is empty or looks like a type, generate a synthetic name. - if name == "" { - name = "p0" - } - - // Sanitize name: if it's a Go keyword, prefix with underscore. - name = sanitizeGoName(name) - - isConst := false - stars := nameStars - var typeParts []string - for _, tok := range typeTokens { - if tok == "const" || tok == "struct" { - if tok == "const" { - isConst = true - } - continue - } - for strings.HasSuffix(tok, "*") { - stars++ - tok = tok[:len(tok)-1] - } - if tok == "const" { - isConst = true - continue - } - if tok != "" { - typeParts = append(typeParts, tok) - } - } - - typeName := strings.Join(typeParts, " ") - - // Special case: const char* → string. - if typeName == "char" && stars == 1 && isConst { - return specmodel.Param{Name: name, Type: "string", CType: cDeclarator, Const: true} - } - - goType := cBaseToGo(typeName) - if stars > 0 && typeName == "void" { - goType = "unsafe.Pointer" - stars-- - } - for range stars { - goType = "*" + goType - } - - return specmodel.Param{ - Name: name, - Type: goType, - CType: cDeclarator, - Const: isConst, - } -} - -func normalizeCDeclarator(typeTokens []string, nameStars int) string { - declarator := strings.TrimSpace(strings.Join(typeTokens, " ")) - declarator = strings.ReplaceAll(declarator, " *", "*") - declarator = strings.ReplaceAll(declarator, "* ", "*") - if declarator == "" { - declarator = "void" - } - return declarator + strings.Repeat("*", nameStars) -} - -// stripNullabilityAnnotations removes Clang nullability attributes from a C declaration. -func stripNullabilityAnnotations(s string) string { - s = strings.ReplaceAll(s, "_Nonnull", "") - s = strings.ReplaceAll(s, "_Nullable", "") - s = strings.ReplaceAll(s, "_Null_unspecified", "") - // Also handle __attribute__ forms. - s = strings.ReplaceAll(s, "__nonnull", "") - s = strings.ReplaceAll(s, "__nullable", "") - // Clean up double spaces. - for strings.Contains(s, " ") { - s = strings.ReplaceAll(s, " ", " ") - } - return strings.TrimSpace(s) -} - -// sanitizeGoName returns a safe Go identifier for a parameter name. -func sanitizeGoName(name string) string { - switch name { - case "type", "func", "var", "const", "import", "package", - "return", "range", "map", "chan", "interface", "struct", - "error", "string", "bool", "int", "uint", "byte", "rune", - "select", "case", "default", "switch", "break", "continue", - "for", "go", "goto", "if", "else", "defer", "fallthrough": - return "_" + name - } - return name -} - -func cBaseToGo(cType string) string { - cType = strings.TrimSpace(cType) - cType = strings.TrimPrefix(cType, "const ") - - switch cType { - case "void": - return "" - case "int": - return "int32" - case "unsigned int", "unsigned": - return "uint32" - case "long": - return "int64" - case "unsigned long": - return "uint64" - case "short": - return "int16" - case "unsigned short": - return "uint16" - case "char", "signed char": - return "int8" - case "unsigned char": - return "uint8" - case "int8_t": - return "int8" - case "uint8_t": - return "uint8" - case "int16_t": - return "int16" - case "uint16_t": - return "uint16" - case "int32_t": - return "int32" - case "uint32_t": - return "uint32" - case "int64_t": - return "int64" - case "uint64_t": - return "uint64" - case "float": - return "float32" - case "double": - return "float64" - case "size_t": - return "uint64" - case "ssize_t": - return "int64" - case "bool", "_Bool": - return "bool" - } - return cType -} diff --git a/tools/pkg/c2ffi/debug_test.go b/tools/pkg/c2ffi/debug_test.go deleted file mode 100644 index 5c7a23f..0000000 --- a/tools/pkg/c2ffi/debug_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package c2ffi - -import ( - "os" - "testing" -) - -func TestEnumIDCollision(t *testing.T) { - data, err := os.ReadFile("/tmp/logging_pp_c2ffi.json") - if err != nil { - t.Skip("no test data") - } - spec, err := Convert(data, ConvertOptions{ - Module: "logging", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/logging", - }) - if err != nil { - t.Fatal(err) - } - - for k, vals := range spec.Enums { - t.Logf("Enum %s:", k) - for _, v := range vals { - t.Logf(" %s = %d", v.Name, v.Value) - } - } -} diff --git a/tools/pkg/c2ffi/invoke.go b/tools/pkg/c2ffi/invoke.go deleted file mode 100644 index ea2e1b9..0000000 --- a/tools/pkg/c2ffi/invoke.go +++ /dev/null @@ -1,141 +0,0 @@ -package c2ffi - -import ( - "encoding/json" - "fmt" - "os" - "os/exec" - "path/filepath" -) - -// InvokeOptions configures how to run c2ffi on NDK headers. -type InvokeOptions struct { - // C2FFIBin is the path to the c2ffi binary. - C2FFIBin string - - // NDKSysroot is the NDK sysroot include directory - // (e.g., .../sysroot/usr/include). - NDKSysroot string - - // NDKPath is the root NDK directory (e.g., .../ndk/28.0.13004108). - // Used to find NDK clang for preprocessing. - NDKPath string - - // Includes are the header files to process - // (e.g., ["android/looper.h", "camera/NdkCameraDevice.h"]). - Includes []string - - // Target is the clang target triple (default: aarch64-linux-android35). - Target string -} - -// Invoke preprocesses each NDK header with NDK clang (to strip availability -// attributes that c2ffi can't handle), then runs c2ffi on each preprocessed -// header and merges the JSON arrays. -func Invoke(opts InvokeOptions) ([]byte, error) { - if opts.Target == "" { - opts.Target = "aarch64-linux-android35" - } - if opts.C2FFIBin == "" { - var err error - opts.C2FFIBin, err = exec.LookPath("c2ffi") - if err != nil { - return nil, fmt.Errorf("c2ffi not found in PATH: %w", err) - } - } - - ndkClang := findNDKClang(opts.NDKPath) - - var allDecls []Declaration - for _, inc := range opts.Includes { - headerPath := filepath.Join(opts.NDKSysroot, inc) - - // Preprocess with NDK clang to strip __attribute__((availability(...))) - // annotations. c2ffi silently drops declarations with these attributes. - ppPath, err := preprocessHeader(ndkClang, headerPath, opts) - if err != nil { - return nil, fmt.Errorf("preprocess %s: %w", inc, err) - } - defer func() { _ = os.Remove(ppPath) }() - - args := []string{ppPath} - - cmd := exec.Command(opts.C2FFIBin, args...) - out, err := cmd.Output() - if err != nil { - if exitErr, ok := err.(*exec.ExitError); ok { - return nil, fmt.Errorf("c2ffi failed on %s: %s\n%s", inc, err, string(exitErr.Stderr)) - } - return nil, fmt.Errorf("c2ffi failed on %s: %w", inc, err) - } - - var decls []Declaration - if err := json.Unmarshal(out, &decls); err != nil { - return nil, fmt.Errorf("parsing c2ffi JSON for %s: %w", inc, err) - } - allDecls = append(allDecls, decls...) - } - - return json.Marshal(allDecls) -} - -// preprocessHeader uses NDK clang to preprocess a header, stripping -// __attribute__ annotations that c2ffi can't handle. -func preprocessHeader( - ndkClang string, - headerPath string, - opts InvokeOptions, -) (string, error) { - sysroot := filepath.Dir(filepath.Dir(opts.NDKSysroot)) // .../sysroot - - tmpFile, err := os.CreateTemp("", "c2ffi-pp-*.h") - if err != nil { - return "", err - } - _ = tmpFile.Close() - - args := []string{ - "-E", - "-target", opts.Target, - "--sysroot", sysroot, - "-D__attribute__(x)=", - "-D_Nonnull=", - "-D_Nullable=", - "-D_Null_unspecified=", - headerPath, - } - - cmd := exec.Command(ndkClang, args...) - out, err := cmd.Output() - if err != nil { - _ = os.Remove(tmpFile.Name()) - if exitErr, ok := err.(*exec.ExitError); ok { - return "", fmt.Errorf("%s: %s", ndkClang, string(exitErr.Stderr)) - } - return "", err - } - - if err := os.WriteFile(tmpFile.Name(), out, 0o644); err != nil { - _ = os.Remove(tmpFile.Name()) - return "", err - } - - return tmpFile.Name(), nil -} - -// findNDKClang locates the NDK clang binary. -func findNDKClang(ndkPath string) string { - if ndkPath != "" { - clang := filepath.Join(ndkPath, "toolchains/llvm/prebuilt/linux-x86_64/bin/clang") - if _, err := os.Stat(clang); err == nil { - return clang - } - } - - // Fall back to PATH. - if p, err := exec.LookPath("clang"); err == nil { - return p - } - - return "clang" -} diff --git a/tools/pkg/c2ffi/macros.go b/tools/pkg/c2ffi/macros.go deleted file mode 100644 index 8400193..0000000 --- a/tools/pkg/c2ffi/macros.go +++ /dev/null @@ -1,85 +0,0 @@ -package c2ffi - -import ( - "bufio" - "fmt" - "os" - "regexp" - "strconv" - "strings" -) - -// macroRe matches "#define NAME VALUE" where VALUE is a hex or decimal integer -// literal, optionally with C integer suffixes (u, l, ul, ull, etc.). -var macroRe = regexp.MustCompile( - `^#define\s+([A-Z][A-Z0-9_]+)\s+(0[xX][0-9a-fA-F]+|[0-9]+)[uUlL]*\s*$`, -) - -// ExtractMacros parses C header files for #define integer constants. -// Only macros from headers matching targetHeaders (suffix match) are included. -func ExtractMacros( - ndkSysroot string, - targetHeaders []string, -) (map[string]int64, error) { - macros := make(map[string]int64) - - for _, header := range targetHeaders { - path := ndkSysroot + "/" + header - if err := extractMacrosFromFile(path, macros); err != nil { - return nil, fmt.Errorf("extracting macros from %s: %w", header, err) - } - } - - return macros, nil -} - -func extractMacrosFromFile( - path string, - macros map[string]int64, -) error { - f, err := os.Open(path) - if err != nil { - return err - } - defer func() { _ = f.Close() }() - - scanner := bufio.NewScanner(f) - for scanner.Scan() { - line := scanner.Text() - if !strings.HasPrefix(line, "#define") { - continue - } - - m := macroRe.FindStringSubmatch(line) - if m == nil { - continue - } - - name := m[1] - valueStr := m[2] - - // Skip version/feature-test macros (e.g. EGL_VERSION_1_0, GL_ES_VERSION_2_0). - if strings.Contains(name, "_VERSION_") { - continue - } - // Skip prototype guard macros (e.g. EGL_EGL_PROTOTYPES, GL_GLES_PROTOTYPES). - if strings.HasSuffix(name, "_PROTOTYPES") { - continue - } - - value, err := strconv.ParseInt(valueStr, 0, 64) - if err != nil { - // Handle unsigned values that overflow int64 - // (e.g. GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFF). - uval, uerr := strconv.ParseUint(valueStr, 0, 64) - if uerr != nil { - continue - } - value = int64(uval) - } - - macros[name] = value - } - - return scanner.Err() -} diff --git a/tools/pkg/c2ffi/tospec.go b/tools/pkg/c2ffi/tospec.go deleted file mode 100644 index dec0d83..0000000 --- a/tools/pkg/c2ffi/tospec.go +++ /dev/null @@ -1,744 +0,0 @@ -package c2ffi - -import ( - "encoding/json" - "fmt" - "math" - "os" - "regexp" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -// Manifest holds the relevant fields from capi/manifests/*.yaml. -type Manifest struct { - Generator struct { - PackageName string `yaml:"PackageName"` - Includes []string `yaml:"Includes"` - } `yaml:"GENERATOR"` - Translator struct { - Rules struct { - Global []Rule `yaml:"global"` - } `yaml:"Rules"` - } `yaml:"TRANSLATOR"` -} - -// Rule is one accept/ignore filter rule from the manifest. -type Rule struct { - Action string `yaml:"action"` - From string `yaml:"from"` -} - -// ConvertOptions configures the c2ffi JSON → spec YAML conversion. -type ConvertOptions struct { - Module string - SourcePackage string - - // TargetHeaders limits extraction to declarations from these headers. - // Each entry is a suffix match against the location path (e.g., "android/looper.h"). - TargetHeaders []string - - // Rules filters declarations by accept/ignore regex patterns. - Rules []Rule - - // NDKHeaderDirs are directories to scan for callback typedef params - // (c2ffi doesn't provide function pointer typedef parameters). - NDKHeaderDirs []string - - // NDKSysroot is the NDK sysroot include directory for extracting - // #define macro constants from original (pre-preprocessed) headers. - NDKSysroot string -} - -// ConvertFile reads a c2ffi JSON file and converts it to a specmodel.Spec. -func ConvertFile( - path string, - opts ConvertOptions, -) (*specmodel.Spec, error) { - data, err := os.ReadFile(path) - if err != nil { - return nil, fmt.Errorf("reading c2ffi JSON: %w", err) - } - - return Convert(data, opts) -} - -// Convert parses c2ffi JSON data and converts it to a specmodel.Spec. -func Convert( - data []byte, - opts ConvertOptions, -) (*specmodel.Spec, error) { - var decls []Declaration - if err := json.Unmarshal(data, &decls); err != nil { - return nil, fmt.Errorf("parsing c2ffi JSON: %w", err) - } - - spec := &specmodel.Spec{ - Module: opts.Module, - SourcePackage: opts.SourcePackage, - Types: make(map[string]specmodel.TypeDef), - Enums: make(map[string][]specmodel.EnumValue), - Functions: make(map[string]specmodel.FuncDef), - Callbacks: make(map[string]specmodel.CallbackDef), - Structs: make(map[string]specmodel.StructDef), - } - - // Index enums by ID so typedef→enum linkage works. - enumByID := map[int]*enumState{} - - // Compile filter rules. - filters := compileRules(opts.Rules) - - for i := range decls { - d := &decls[i] - - if !matchesTargetHeader(d.Location, opts.TargetHeaders) { - continue - } - - switch d.Tag { - case "function": - if !passesFilter(d.Name, filters) { - continue - } - addFunction(spec, d) - - case "typedef": - if !passesFilter(d.Name, filters) { - continue - } - addTypedef(spec, d, enumByID) - - case "enum": - es := addEnum(spec, d, filters) - if es != nil { - enumByID[d.ID] = es - } - - case "struct": - if d.Name == "" || d.BitSize == 0 { - continue - } - if !passesFilter(d.Name, filters) { - continue - } - addStruct(spec, d) - } - } - - // Supplement callback params from C headers. - if len(opts.NDKHeaderDirs) > 0 { - supplementCallbacks(spec, opts.NDKHeaderDirs) - supplementFunctionParams(spec, opts.NDKHeaderDirs) - } - - // Extract #define macro constants from original headers. - if opts.NDKSysroot != "" && len(opts.TargetHeaders) > 0 { - macros, err := ExtractMacros(opts.NDKSysroot, opts.TargetHeaders) - if err != nil { - return nil, fmt.Errorf("extracting macros: %w", err) - } - if len(macros) > 0 { - spec.Macros = macros - } - } - - // Remove empty maps. - if len(spec.Types) == 0 { - spec.Types = nil - } - if len(spec.Enums) == 0 { - spec.Enums = nil - } - if len(spec.Functions) == 0 { - spec.Functions = nil - } - if len(spec.Callbacks) == 0 { - spec.Callbacks = nil - } - if len(spec.Structs) == 0 { - spec.Structs = nil - } - - return spec, nil -} - -type enumState struct { - groupName string - values []specmodel.EnumValue -} - -func addFunction(spec *specmodel.Spec, d *Declaration) { - // Skip variadic functions (not callable from CGo). - if d.Variadic { - return - } - - // Skip functions with va_list parameters (not usable from Go). - for _, p := range d.Parameters { - if isVaListType(&p.Type) { - return - } - } - - fd := specmodel.FuncDef{ - CName: d.Name, - Returns: typeRefToGoType(d.ReturnType), - } - - for _, p := range d.Parameters { - goType := typeRefToGoType(&p.Type) - dir := "" - if isOutputParam(&p.Type) { - dir = "out" - } - cType := "" - if needsCTypeMetadata(&p.Type) { - cType = typeRefToCType(&p.Type) - } - fd.Params = append(fd.Params, specmodel.Param{ - Name: p.Name, - Type: goType, - CType: cType, - Direction: dir, - }) - } - - spec.Functions[d.Name] = fd -} - -// isVaListType returns true if the type reference is a va_list variant. -func isVaListType(t *TypeRef) bool { - if t == nil { - return false - } - switch t.Tag { - case "va_list", "__builtin_va_list", "__gnuc_va_list": - return true - } - return false -} - -func addTypedef( - spec *specmodel.Spec, - d *Declaration, - enumByID map[int]*enumState, -) { - if d.Type == nil { - return - } - - switch { - case d.Type.Tag == ":function-pointer": - // Function pointer typedef — add as callback with empty params. - // Params will be supplemented from C headers later. - spec.Callbacks[d.Name] = specmodel.CallbackDef{} - - case d.Type.Tag == ":enum": - // Typedef wrapping an anonymous enum — link the enum group name. - if es, ok := enumByID[d.Type.ID]; ok { - if es.groupName == "" { - es.groupName = d.Name - } - // Re-register under the typedef name. - if _, exists := spec.Enums[d.Name]; !exists { - spec.Enums[d.Name] = es.values - } - // Remove the auto-derived group name if different. - if es.groupName != d.Name { - delete(spec.Enums, es.groupName) - es.groupName = d.Name - } - } - // Also add as a type. - spec.Types[d.Name] = specmodel.TypeDef{ - Kind: "typedef_int32", - CType: d.Name, - GoType: "int32", - } - - case d.Type.Tag == "struct" || d.Type.Tag == ":struct": - // Typedef to struct — opaque pointer. - spec.Types[d.Name] = specmodel.TypeDef{ - Kind: "opaque_ptr", - CType: d.Name, - GoType: "*C." + d.Name, - } - - case d.Type.Tag == ":pointer" && d.Type.Type != nil && d.Type.Type.Tag == ":void": - // typedef void* X → pointer handle. - spec.Types[d.Name] = specmodel.TypeDef{ - Kind: "pointer_handle", - CType: d.Name, - GoType: "unsafe.Pointer", - } - - case d.Type.Tag == ":void": - // typedef void X — skip, not representable in Go. - - default: - // Scalar typedef. - goType := typeRefToGoType(d.Type) - if goType == "" { - // Skip typedefs that resolve to void. - break - } - kind := goTypeToKind(goType) - spec.Types[d.Name] = specmodel.TypeDef{ - Kind: kind, - CType: d.Name, - GoType: goType, - } - } -} - -func addEnum( - spec *specmodel.Spec, - d *Declaration, - filters []compiledRule, -) *enumState { - if len(d.Fields) == 0 { - return nil - } - - // Filter individual enum constants. - var values []specmodel.EnumValue - for _, f := range d.Fields { - if !passesFilter(f.Name, filters) { - continue - } - values = append(values, specmodel.EnumValue{ - Name: f.Name, - Value: toSignedInt64(f.Value), - }) - } - - if len(values) == 0 { - return nil - } - - // Derive group name from constant name prefix. - groupName := d.Name - if groupName == "" { - groupName = deriveEnumGroupName(values) - } - - if groupName == "" { - return nil - } - - es := &enumState{groupName: groupName, values: values} - spec.Enums[groupName] = values - return es -} - -func addStruct(spec *specmodel.Spec, d *Declaration) { - sd := specmodel.StructDef{} - - for _, f := range d.Fields { - if f.Tag != "field" || f.Type == nil { - continue - } - - sf := specmodel.StructField{ - Name: f.Name, - } - - if f.Type.Tag == ":function-pointer" { - // Mark as func_ptr; params/returns will be filled by - // supplementCallbacks from the C header source. - sf.Type = "func_ptr" - } else if isInlineAggregate(f.Type) { - sf.Type = f.Type.Tag - sf.Fields = convertInlineAggregateFields(f.Type.Fields) - } else { - sf.Type = typeRefToGoType(f.Type) - if needsCTypeMetadata(f.Type) { - sf.CType = typeRefToCType(f.Type) - } - } - - sd.Fields = append(sd.Fields, sf) - } - - if len(sd.Fields) > 0 { - spec.Structs[d.Name] = sd - } -} - -func isInlineAggregate(t *TypeRef) bool { - if t == nil { - return false - } - switch t.Tag { - case "union", ":union", "struct", ":struct": - return len(t.Fields) > 0 - default: - return false - } -} - -func convertInlineAggregateFields(fields []Field) []specmodel.StructField { - result := make([]specmodel.StructField, 0, len(fields)) - for _, f := range fields { - if f.Tag != "field" || f.Type == nil { - continue - } - - sf := specmodel.StructField{ - Name: f.Name, - } - if f.Type.Tag == ":function-pointer" { - sf.Type = "func_ptr" - } else if isInlineAggregate(f.Type) { - sf.Type = f.Type.Tag - sf.Fields = convertInlineAggregateFields(f.Type.Fields) - } else { - sf.Type = typeRefToGoType(f.Type) - if needsCTypeMetadata(f.Type) { - sf.CType = typeRefToCType(f.Type) - } - } - result = append(result, sf) - } - return result -} - -// typeRefToGoType converts a c2ffi TypeRef to a Go type string. -func typeRefToGoType(t *TypeRef) string { - if t == nil { - return "" - } - - switch t.Tag { - case ":void": - return "" - case ":int": - return "int32" - case ":unsigned-int": - return "uint32" - case ":long": - return "int64" - case ":unsigned-long": - return "uint64" - case ":short": - return "int16" - case ":unsigned-short": - return "uint16" - case ":char", ":signed-char": - return "int8" - case ":unsigned-char": - return "uint8" - case ":float": - return "float32" - case ":double": - return "float64" - case ":_Bool": - return "bool" - - case ":pointer": - if t.Type == nil { - return "unsafe.Pointer" - } - if t.Type.Tag == ":void" { - return "unsafe.Pointer" - } - if isCharTypeRef(t.Type) { - return "string" - } - if pointerDepth(t) > 1 && isCharTypeRef(pointerBaseType(t)) { - return strings.Repeat("*", pointerDepth(t)) + "int8" - } - inner := typeRefToGoType(t.Type) - return "*" + inner - - case ":array": - inner := typeRefToGoType(t.Type) - if t.Size > 0 { - return fmt.Sprintf("[%d]%s", t.Size, inner) - } - return "[]" + inner - - case ":function-pointer": - return "unsafe.Pointer" - - case ":enum": - return "int32" - case ":struct", "struct": - if t.Name != "" { - return t.Name - } - return "unsafe.Pointer" - } - - // Named type reference (typedef name like "ALooper", "int32_t", "camera_status_t"). - return resolveTypedefName(t.Tag) -} - -// typeRefToCType returns the normalized C spelling represented by a c2ffi -// type. It is retained in function parameters where Go's type system loses -// the distinction between char, signed char, and int8_t. -func typeRefToCType(t *TypeRef) string { - if t == nil { - return "" - } - - switch t.Tag { - case ":void": - return "void" - case ":char": - return "char" - case ":signed-char": - return "signed char" - case ":unsigned-char": - return "unsigned char" - case ":int": - return "int" - case ":unsigned-int": - return "unsigned int" - case ":long": - return "long" - case ":unsigned-long": - return "unsigned long" - case ":short": - return "short" - case ":unsigned-short": - return "unsigned short" - case ":float": - return "float" - case ":double": - return "double" - case ":_Bool": - return "_Bool" - case ":pointer": - if t.Type == nil { - return "void*" - } - inner := typeRefToCType(t.Type) - if inner == "" { - inner = "void" - } - return inner + "*" - case ":array": - inner := typeRefToCType(t.Type) - if t.Size > 0 { - return fmt.Sprintf("%s[%d]", inner, t.Size) - } - return inner + "[]" - case ":function-pointer": - return "function-pointer" - case ":enum", ":struct", "struct", ":union", "union": - if t.Name != "" { - return t.Name - } - return t.Tag - default: - return t.Tag - } -} - -func isCharTypeRef(t *TypeRef) bool { - if t == nil { - return false - } - return t.Tag == ":char" || t.Tag == ":signed-char" -} - -func pointerBaseType(t *TypeRef) *TypeRef { - for t != nil && t.Tag == ":pointer" { - t = t.Type - } - return t -} - -func pointerDepth(t *TypeRef) int { - depth := 0 - for t != nil && t.Tag == ":pointer" { - depth++ - t = t.Type - } - return depth -} - -func needsCTypeMetadata(t *TypeRef) bool { - if pointerDepth(t) < 2 { - return false - } - base := pointerBaseType(t) - if base == nil { - return false - } - switch base.Tag { - case ":char", ":signed-char", ":unsigned-char", "int8_t", "uint8_t": - return true - default: - return false - } -} - -// resolveTypedefName converts a C typedef name to its Go equivalent. -func resolveTypedefName(name string) string { - switch name { - case "int8_t": - return "int8" - case "uint8_t": - return "uint8" - case "int16_t": - return "int16" - case "uint16_t": - return "uint16" - case "int32_t": - return "int32" - case "uint32_t": - return "uint32" - case "int64_t": - return "int64" - case "uint64_t": - return "uint64" - case "size_t": - return "uint64" - case "ssize_t": - return "int64" - case "intptr_t": - return "int64" - case "uintptr_t": - return "uint64" - } - return name -} - -// isOutputParam detects double pointers (output parameters). -func isOutputParam(t *TypeRef) bool { - if t == nil || t.Tag != ":pointer" { - return false - } - if t.Type != nil && t.Type.Tag == ":pointer" { - return true - } - return false -} - -// toSignedInt64 converts a uint64 enum value to signed int64. -// c2ffi outputs all enum values as unsigned, so -1 becomes 4294967295. -func toSignedInt64(v uint64) int64 { - if v > math.MaxInt32 && v <= math.MaxUint32 { - return int64(int32(v)) - } - return int64(v) -} - -// goTypeToKind converts a Go type string to a spec kind string. -func goTypeToKind(goType string) string { - switch goType { - case "int8": - return "typedef_int8" - case "uint8": - return "typedef_uint8" - case "int16": - return "typedef_int16" - case "uint16": - return "typedef_uint16" - case "int32": - return "typedef_int32" - case "uint32": - return "typedef_uint32" - case "int64": - return "typedef_int64" - case "uint64": - return "typedef_uint64" - case "float32": - return "typedef_float32" - case "float64": - return "typedef_float64" - case "bool": - return "typedef_bool" - default: - return "typedef_" + goType - } -} - -// matchesTargetHeader checks if a location string contains one of the target headers. -func matchesTargetHeader(location string, headers []string) bool { - if len(headers) == 0 { - return true - } - for _, h := range headers { - // Match both "/android/looper.h:41" and "android/looper.h:41" (test data). - if strings.Contains(location, "/"+h+":") || strings.Contains(location, "/"+h+" ") || - strings.HasPrefix(location, h+":") || strings.HasPrefix(location, h+" ") { - return true - } - } - return false -} - -type compiledRule struct { - action string - re *regexp.Regexp -} - -func compileRules(rules []Rule) []compiledRule { - var compiled []compiledRule - for _, r := range rules { - re, err := regexp.Compile(r.From) - if err != nil { - continue - } - compiled = append(compiled, compiledRule{action: r.Action, re: re}) - } - return compiled -} - -// passesFilter checks if a name passes the accept/ignore rules. -// If no rules match, the name is rejected (default deny). -func passesFilter(name string, rules []compiledRule) bool { - if len(rules) == 0 { - return true - } - for _, r := range rules { - if r.re.MatchString(name) { - return r.action == "accept" - } - } - return false -} - -// deriveEnumGroupName computes a group name from the common prefix of -// enum constant names. -func deriveEnumGroupName(values []specmodel.EnumValue) string { - if len(values) == 0 { - return "" - } - if len(values) == 1 { - name := values[0].Name - parts := strings.Split(name, "_") - if len(parts) > 2 { - return strings.Join(parts[:len(parts)-2], "_") - } - if idx := strings.LastIndex(name, "_"); idx > 0 { - return name[:idx] - } - return name - } - - prefix := values[0].Name - for _, v := range values[1:] { - prefix = commonPrefix(prefix, v.Name) - } - prefix = strings.TrimRight(prefix, "_") - return prefix -} - -func commonPrefix(a, b string) string { - n := len(a) - if len(b) < n { - n = len(b) - } - for i := 0; i < n; i++ { - if a[i] != b[i] { - return a[:i] - } - } - return a[:n] -} diff --git a/tools/pkg/c2ffi/tospec_test.go b/tools/pkg/c2ffi/tospec_test.go deleted file mode 100644 index a6ad7f3..0000000 --- a/tools/pkg/c2ffi/tospec_test.go +++ /dev/null @@ -1,262 +0,0 @@ -package c2ffi - -import ( - "os" - "path/filepath" - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestConvertLooper(t *testing.T) { - input := `[ - {"tag":"struct","ns":0,"name":"ALooper","id":0,"location":"android/looper.h:41:8","bit-size":0,"bit-alignment":0,"fields":[]}, - {"tag":"typedef","ns":0,"name":"ALooper","location":"android/looper.h:55:24","type":{"tag":"struct","ns":0,"name":"ALooper","id":0}}, - {"tag":"function","name":"ALooper_forThread","ns":0,"location":"android/looper.h:61:10","variadic":false,"inline":false,"storage-class":"none","parameters":[],"return-type":{"tag":":pointer","type":{"tag":"ALooper"}}}, - {"tag":"enum","ns":0,"name":"","id":3,"location":"android/looper.h:85:1","fields":[ - {"tag":"field","name":"ALOOPER_POLL_WAKE","value":4294967295}, - {"tag":"field","name":"ALOOPER_POLL_CALLBACK","value":4294967294} - ]}, - {"tag":"typedef","ns":0,"name":"ALooper_callbackFunc","location":"android/looper.h:179:15","type":{"tag":":function-pointer"}}, - {"tag":"function","name":"ALooper_addFd","ns":0,"location":"android/looper.h:275:5","variadic":false,"inline":false,"storage-class":"none","parameters":[ - {"tag":"parameter","name":"looper","type":{"tag":":pointer","type":{"tag":"ALooper"}}}, - {"tag":"parameter","name":"fd","type":{"tag":":int","bit-size":32,"bit-alignment":32}}, - {"tag":"parameter","name":"callback","type":{"tag":"ALooper_callbackFunc"}}, - {"tag":"parameter","name":"data","type":{"tag":":pointer","type":{"tag":":void"}}} - ],"return-type":{"tag":":int","bit-size":32,"bit-alignment":32}} - ]` - - opts := ConvertOptions{ - Module: "looper", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/looper", - TargetHeaders: []string{"android/looper.h"}, - Rules: []Rule{ - {Action: "accept", From: "^ALooper"}, - {Action: "accept", From: "^ALOOPER_"}, - }, - } - - spec, err := Convert([]byte(input), opts) - require.NoError(t, err) - - // Type: ALooper → opaque_ptr. - assert.Contains(t, spec.Types, "ALooper") - assert.Equal(t, "opaque_ptr", spec.Types["ALooper"].Kind) - - // Functions. - assert.Contains(t, spec.Functions, "ALooper_forThread") - assert.Equal(t, "*ALooper", spec.Functions["ALooper_forThread"].Returns) - - assert.Contains(t, spec.Functions, "ALooper_addFd") - fd := spec.Functions["ALooper_addFd"] - assert.Equal(t, "int32", fd.Returns) - assert.Len(t, fd.Params, 4) - assert.Equal(t, "*ALooper", fd.Params[0].Type) - assert.Equal(t, "int32", fd.Params[1].Type) - assert.Equal(t, "ALooper_callbackFunc", fd.Params[2].Type) - assert.Equal(t, "unsafe.Pointer", fd.Params[3].Type) - - // Enums: negative values via unsigned-to-signed conversion. - assert.Contains(t, spec.Enums, "ALOOPER_POLL") - pollVals := spec.Enums["ALOOPER_POLL"] - assert.Len(t, pollVals, 2) - assert.Equal(t, int64(-1), pollVals[0].Value) - assert.Equal(t, int64(-2), pollVals[1].Value) - - // Callback (empty params — no header dirs for supplement). - assert.Contains(t, spec.Callbacks, "ALooper_callbackFunc") -} - -func TestConvertStructInlineUnionFields(t *testing.T) { - input := `[ - {"tag":"struct","ns":0,"name":"ACameraMetadata_const_entry","id":1,"location":"camera/NdkCameraMetadata.h:143:16","bit-size":192,"bit-alignment":64,"fields":[ - {"tag":"field","name":"tag","type":{"tag":"uint32_t"}}, - {"tag":"field","name":"count","type":{"tag":"uint32_t"}}, - {"tag":"field","name":"data","type":{"tag":"union","fields":[ - {"tag":"field","name":"u8","type":{"tag":":pointer","type":{"tag":"uint8_t"}}}, - {"tag":"field","name":"i32","type":{"tag":":pointer","type":{"tag":"int32_t"}}}, - {"tag":"field","name":"f","type":{"tag":":pointer","type":{"tag":":float","bit-size":32,"bit-alignment":32}}} - ]}} - ]} - ]` - - opts := ConvertOptions{ - Module: "camera", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/camera", - TargetHeaders: []string{"camera/NdkCameraMetadata.h"}, - } - - spec, err := Convert([]byte(input), opts) - require.NoError(t, err) - - entry, ok := spec.Structs["ACameraMetadata_const_entry"] - require.True(t, ok) - - require.Len(t, entry.Fields, 3) - data := entry.Fields[2] - assert.Equal(t, "data", data.Name) - assert.Equal(t, "union", data.Type) - - require.Len(t, data.Fields, 3) - assert.Equal(t, specmodel.StructField{Name: "u8", Type: "*uint8"}, data.Fields[0]) - assert.Equal(t, specmodel.StructField{Name: "i32", Type: "*int32"}, data.Fields[1]) - assert.Equal(t, specmodel.StructField{Name: "f", Type: "*float32"}, data.Fields[2]) -} - -func TestConvertStructPreservesNestedCharCType(t *testing.T) { - input := `[ - {"tag":"struct","name":"ACameraIdList","id":1,"location":"camera/NdkCameraDevice.h:60:16","bit-size":128,"bit-alignment":64,"fields":[ - {"tag":"field","name":"cameraIds","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":char"}}}} - ]} - ]` - - spec, err := Convert([]byte(input), ConvertOptions{Module: "camera"}) - require.NoError(t, err) - field := spec.Structs["ACameraIdList"].Fields[0] - assert.Equal(t, "**int8", field.Type) - assert.Equal(t, "char**", field.CType) -} - -func TestToSignedInt64(t *testing.T) { - assert.Equal(t, int64(-1), toSignedInt64(4294967295)) - assert.Equal(t, int64(-4), toSignedInt64(4294967292)) - assert.Equal(t, int64(1), toSignedInt64(1)) - assert.Equal(t, int64(0), toSignedInt64(0)) - assert.Equal(t, int64(2147483647), toSignedInt64(2147483647)) -} - -func TestTypeRefToGoType(t *testing.T) { - tests := []struct { - name string - ref TypeRef - want string - }{ - {"void", TypeRef{Tag: ":void"}, ""}, - {"int32", TypeRef{Tag: ":int", BitSize: 32}, "int32"}, - {"uint32", TypeRef{Tag: ":unsigned-int", BitSize: 32}, "uint32"}, - {"int64", TypeRef{Tag: ":long", BitSize: 64}, "int64"}, - {"float32", TypeRef{Tag: ":float", BitSize: 32}, "float32"}, - {"float64", TypeRef{Tag: ":double", BitSize: 64}, "float64"}, - {"bool", TypeRef{Tag: ":_Bool"}, "bool"}, - {"void*", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":void"}}, "unsafe.Pointer"}, - {"char*", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":char"}}, "string"}, - {"char**", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":char"}}}, "**int8"}, - {"char***", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":char"}}}}, "***int8"}, - {"signed char**", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":signed-char"}}}, "**int8"}, - {"int8_t**", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: "int8_t"}}}, "**int8"}, - {"int*", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":int", BitSize: 32}}, "*int32"}, - {"typedef ref", TypeRef{Tag: "ALooper"}, "ALooper"}, - {"int32_t", TypeRef{Tag: "int32_t"}, "int32"}, - {"size_t", TypeRef{Tag: "size_t"}, "uint64"}, - {"func ptr", TypeRef{Tag: ":function-pointer"}, "unsafe.Pointer"}, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := typeRefToGoType(&tt.ref) - assert.Equal(t, tt.want, got) - }) - } -} - -func TestTypeRefToCType(t *testing.T) { - tests := []struct { - name string - ref TypeRef - want string - }{ - {"char*", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":char"}}, "char*"}, - {"char**", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":char"}}}, "char**"}, - {"signed char**", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":signed-char"}}}, "signed char**"}, - {"int8_t**", TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: ":pointer", Type: &TypeRef{Tag: "int8_t"}}}, "int8_t**"}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, tt.want, typeRefToCType(&tt.ref)) - }) - } -} - -func TestConvertPreservesNestedPointerCType(t *testing.T) { - input := `[ - {"tag":"function","name":"char_out","location":"test.h:1:1","variadic":false,"parameters":[{"tag":"parameter","name":"out","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":char"}}}}],"return-type":{"tag":":void"}}, - {"tag":"function","name":"signed_out","location":"test.h:2:1","variadic":false,"parameters":[{"tag":"parameter","name":"out","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":signed-char"}}}}],"return-type":{"tag":":void"}}, - {"tag":"function","name":"int8_out","location":"test.h:3:1","variadic":false,"parameters":[{"tag":"parameter","name":"out","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":"int8_t"}}}}],"return-type":{"tag":":void"}} - ]` - - spec, err := Convert([]byte(input), ConvertOptions{Module: "test"}) - require.NoError(t, err) - assert.Equal(t, "**int8", spec.Functions["char_out"].Params[0].Type) - assert.Equal(t, "char**", spec.Functions["char_out"].Params[0].CType) - assert.Equal(t, "signed char**", spec.Functions["signed_out"].Params[0].CType) - assert.Equal(t, "int8_t**", spec.Functions["int8_out"].Params[0].CType) -} - -func TestSupplementFunctionParamsUsesExplicitPointerDirections(t *testing.T) { - dir := t.TempDir() - header := ` -void AInput(const char * const *values); -void AInputBaseConst(const char **values); -void AInputTriple(const char ***values); -void AOutput(/*out*/ char **values); -bool AMediaFormat_getString(AMediaFormat* format, const char *name, const char **out); -void AIBinder_dump(void* binder, int fd, const char **args, unsigned int numArgs); -` - require.NoError(t, os.WriteFile(filepath.Join(dir, "test.h"), []byte(header), 0o644)) - - input := `[ - {"tag":"function","name":"AInput","location":"test.h:1:1","variadic":false,"parameters":[{"tag":"parameter","name":"values","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":char"}}}}],"return-type":{"tag":":void"}}, - {"tag":"function","name":"AInputBaseConst","location":"test.h:2:1","variadic":false,"parameters":[{"tag":"parameter","name":"values","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":char"}}}}],"return-type":{"tag":":void"}}, - {"tag":"function","name":"AInputTriple","location":"test.h:3:1","variadic":false,"parameters":[{"tag":"parameter","name":"values","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":char"}}}}}],"return-type":{"tag":":void"}}, - {"tag":"function","name":"AOutput","location":"test.h:4:1","variadic":false,"parameters":[{"tag":"parameter","name":"values","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":char"}}}}],"return-type":{"tag":":void"}}, - {"tag":"function","name":"AMediaFormat_getString","location":"test.h:5:1","variadic":false,"parameters":[{"tag":"parameter","name":"format","type":{"tag":":pointer","type":{"tag":"AMediaFormat"}}},{"tag":"parameter","name":"name","type":{"tag":":pointer","type":{"tag":":char"}}},{"tag":"parameter","name":"out","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":char"}}}}],"return-type":{"tag":":_Bool"}}, - {"tag":"function","name":"AIBinder_dump","location":"test.h:6:1","variadic":false,"parameters":[{"tag":"parameter","name":"binder","type":{"tag":":pointer","type":{"tag":":void"}}},{"tag":"parameter","name":"fd","type":{"tag":":int","bit-size":32}},{"tag":"parameter","name":"args","type":{"tag":":pointer","type":{"tag":":pointer","type":{"tag":":char"}}}},{"tag":"parameter","name":"numArgs","type":{"tag":":unsigned-int","bit-size":32}}],"return-type":{"tag":":void"}} - ]` - - spec, err := Convert([]byte(input), ConvertOptions{Module: "test", NDKHeaderDirs: []string{dir}}) - require.NoError(t, err) - assert.Equal(t, "", spec.Functions["AInput"].Params[0].Direction) - assert.Equal(t, "const char*const*", spec.Functions["AInput"].Params[0].CType) - assert.True(t, spec.Functions["AInput"].Params[0].Const) - assert.Equal(t, "out", spec.Functions["AInputBaseConst"].Params[0].Direction) - assert.Equal(t, "out", spec.Functions["AInputTriple"].Params[0].Direction) - assert.Equal(t, "out", spec.Functions["AOutput"].Params[0].Direction) - assert.Equal(t, "out", spec.Functions["AMediaFormat_getString"].Params[2].Direction) - assert.Equal(t, "", spec.Functions["AIBinder_dump"].Params[2].Direction) -} - -func TestParseCallbacksPreservesCTypeAndConst(t *testing.T) { - source := ` -typedef void (*TestCallback)(const char **names, const AThing* thing, signed char* bytes); -` - - callback := parseCallbacksFromSource(source)["TestCallback"] - require.Len(t, callback.Params, 3) - - assert.Equal(t, "const char**", callback.Params[0].CType) - assert.True(t, callback.Params[0].Const) - assert.Equal(t, "const AThing*", callback.Params[1].CType) - assert.True(t, callback.Params[1].Const) - assert.Equal(t, "signed char*", callback.Params[2].CType) - assert.False(t, callback.Params[2].Const) -} - -func TestParseCallbacksPreservesReturnCTypeAndNullability(t *testing.T) { - source := ` -typedef char* _Nullable (*_Nonnull APersistableBundle_stringAllocator)(int32_t sizeBytes, - void* _Nullable context); -typedef const char* (*Getter)(const void* data); -` - - callback := parseCallbacksFromSource(source)["APersistableBundle_stringAllocator"] - require.Len(t, callback.Params, 2) - assert.Equal(t, "*int8", callback.Returns) - assert.Equal(t, "char*", callback.ReturnsCType) - assert.Equal(t, "int32_t", callback.Params[0].CType) - assert.Equal(t, "void*", callback.Params[1].CType) - getter := parseCallbacksFromSource(source)["Getter"] - assert.Equal(t, "*int8", getter.Returns) - assert.Equal(t, "const char*", getter.ReturnsCType) -} diff --git a/tools/pkg/c2ffi/types.go b/tools/pkg/c2ffi/types.go deleted file mode 100644 index 9a597ba..0000000 --- a/tools/pkg/c2ffi/types.go +++ /dev/null @@ -1,66 +0,0 @@ -// Package c2ffi parses c2ffi JSON output and converts it to specmodel.Spec. -package c2ffi - -// Declaration is one top-level entry in c2ffi's JSON output array. -// c2ffi outputs a flat JSON array of tagged objects — functions, typedefs, -// enums, structs, etc. -type Declaration struct { - Tag string `json:"tag"` - Name string `json:"name"` - NS int `json:"ns"` - ID int `json:"id"` - Location string `json:"location"` - - // Function fields. - Variadic bool `json:"variadic"` - Inline bool `json:"inline"` - Parameters []Parameter `json:"parameters"` - ReturnType *TypeRef `json:"return-type"` - - // Typedef field. - Type *TypeRef `json:"type"` - - // Enum and struct fields share the same JSON key "fields". - // Enum fields have Name+Value; struct fields have Name+Type+BitOffset. - Fields []Field `json:"fields"` - - // Struct-specific. - BitSize int `json:"bit-size"` - BitAlignment int `json:"bit-alignment"` -} - -// Parameter is a function parameter in c2ffi output. -type Parameter struct { - Tag string `json:"tag"` - Name string `json:"name"` - Type TypeRef `json:"type"` -} - -// TypeRef describes a type in c2ffi's JSON. Types are recursive: -// a pointer is {"tag": ":pointer", "type": {...}}. -type TypeRef struct { - Tag string `json:"tag"` - Type *TypeRef `json:"type"` - BitSize int `json:"bit-size"` - BitAlignment int `json:"bit-alignment"` - - // Struct/enum inline (for typedef targets like ":enum"). - Name string `json:"name"` - ID int `json:"id"` - Fields []Field `json:"fields"` - - // Array. - Size int `json:"size"` -} - -// Field is used for both enum constants and struct fields. -// c2ffi reuses the "fields" JSON key for both. -type Field struct { - Tag string `json:"tag"` - Name string `json:"name"` - Value uint64 `json:"value"` // enum constant value - BitOffset int `json:"bit-offset"` // struct field offset - BitSize int `json:"bit-size"` // struct field size - BitAlignment int `json:"bit-alignment"` // struct field alignment - Type *TypeRef `json:"type"` // struct field type -} diff --git a/tools/pkg/capigen/differential_test.go b/tools/pkg/capigen/differential_test.go deleted file mode 100644 index 72cd3da..0000000 --- a/tools/pkg/capigen/differential_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package capigen - -import ( - "bufio" - "fmt" - "os" - "os/exec" - "strings" - "testing" -) - -// leanOraclePath is the path to the Lean oracle executable built by `lake build`. -const leanOraclePath = "../../../proofs/.lake/build/bin/proofs" - -func leanOracleAvailable() bool { - _, err := os.Stat(leanOraclePath) - return err == nil -} - -// runLeanOracle sends commands to the Lean oracle and returns the outputs. -func runLeanOracle(t *testing.T, commands []string) []string { - t.Helper() - input := strings.Join(commands, "\n") + "\n" - cmd := exec.Command(leanOraclePath) - cmd.Stdin = strings.NewReader(input) - out, err := cmd.Output() - if err != nil { - t.Fatalf("lean oracle failed: %v", err) - } - var results []string - scanner := bufio.NewScanner(strings.NewReader(string(out))) - for scanner.Scan() { - results = append(results, scanner.Text()) - } - return results -} - -// TestDifferential_ExportName runs the same inputs through Go ExportName and -// Lean exportName, comparing outputs. -func TestDifferential_ExportName(t *testing.T) { - if !leanOracleAvailable() { - t.Skip("Lean oracle not built (run 'cd proofs && lake build')") - } - - inputs := []string{ - "", "_", "__", "___", - "foo", "Foo", "FOO", - "_foo", "__bar", "___baz", - "ALooper", "AImageReader", "camera_status_t", - "a", "A", "z", "Z", "0start", - } - - var commands []string - for _, in_ := range inputs { - commands = append(commands, fmt.Sprintf("exportName\t%s", in_)) - } - - leanResults := runLeanOracle(t, commands) - if len(leanResults) != len(inputs) { - t.Fatalf("expected %d results, got %d", len(inputs), len(leanResults)) - } - - for i, in_ := range inputs { - goResult := ExportName(in_) - leanResult := leanResults[i] - if goResult != leanResult { - t.Errorf("ExportName(%q): Go=%q, Lean=%q", in_, goResult, leanResult) - } - } -} - -// TestDifferential_StripPointers runs the same inputs through Go and Lean. -func TestDifferential_StripPointers(t *testing.T) { - if !leanOracleAvailable() { - t.Skip("Lean oracle not built (run 'cd proofs && lake build')") - } - - inputs := []string{ - "", "*", "**", "***", - "ALooper", "*ALooper", "**ALooper", "***int32", - "int32", "*int32", - } - - var commands []string - for _, in_ := range inputs { - commands = append(commands, fmt.Sprintf("stripPointers\t%s", in_)) - } - - leanResults := runLeanOracle(t, commands) - if len(leanResults) != len(inputs) { - t.Fatalf("expected %d results, got %d", len(inputs), len(leanResults)) - } - - for i, in_ := range inputs { - goResult := stripPointers(in_) - leanResult := leanResults[i] - if goResult != leanResult { - t.Errorf("stripPointers(%q): Go=%q, Lean=%q", in_, goResult, leanResult) - } - } -} - -// TestDifferential_IsScalarGoType compares Go and Lean classification. -func TestDifferential_IsScalarGoType(t *testing.T) { - if !leanOracleAvailable() { - t.Skip("Lean oracle not built (run 'cd proofs && lake build')") - } - - inputs := []string{ - "int8", "uint8", "int16", "uint16", "int32", "uint32", - "int64", "uint64", "float32", "float64", "bool", "int", "uint", - "string", "unsafe.Pointer", "ALooper", "", "*int32", - } - - var commands []string - for _, in_ := range inputs { - commands = append(commands, fmt.Sprintf("isScalarGoType\t%s", in_)) - } - - leanResults := runLeanOracle(t, commands) - if len(leanResults) != len(inputs) { - t.Fatalf("expected %d results, got %d", len(inputs), len(leanResults)) - } - - for i, in_ := range inputs { - goResult := fmt.Sprintf("%v", isScalarGoType(in_)) - leanResult := leanResults[i] - if goResult != leanResult { - t.Errorf("isScalarGoType(%q): Go=%s, Lean=%s", in_, goResult, leanResult) - } - } -} diff --git a/tools/pkg/capigen/generate.go b/tools/pkg/capigen/generate.go deleted file mode 100644 index 4bc8222..0000000 --- a/tools/pkg/capigen/generate.go +++ /dev/null @@ -1,1570 +0,0 @@ -// Package capigen generates raw CGo binding packages from spec YAML and -// manifest configuration. It produces the capi/{module}/ packages that -// idiomgen-generated code imports. -package capigen - -import ( - "crypto/md5" - "fmt" - "go/format" - "os" - "path/filepath" - "sort" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -const generatedHeader = "// Code generated by capigen. DO NOT EDIT.\n\n" - -// ExportName returns an exported Go identifier from a C name. -// Strips leading underscores and capitalizes the first letter. -// If the name is all underscores, returns it unchanged. -// -// Proven properties (proofs/Proofs/ExportName.lean): -// - Idempotent: ExportName(ExportName(x)) == ExportName(x) -// - Non-empty output for non-empty input -// - Differential tested against Lean oracle -func ExportName(name string) string { - s := name - for strings.HasPrefix(s, "_") { - s = s[1:] - } - if s == "" { - return name - } - // Capitalize first letter. - r := []rune(s) - if r[0] >= 'a' && r[0] <= 'z' { - r[0] = r[0] - 'a' + 'A' - } - return string(r) -} - -// exportGoType applies ExportName to a Go type, handling pointer/slice/array prefixes. -func exportGoType(goType string) string { - return exportGoTypeRenamed(goType, nil) -} - -// exportGoTypeRenamed applies ExportName to a Go type, using the rename map for -// types whose exported name collides with function names. -func exportGoTypeRenamed(goType string, typeRenameMap map[string]string) string { - if goType == "" || goType == "unsafe.Pointer" || goType == "string" || goType == "bool" { - return goType - } - if isScalarGoType(goType) { - return goType - } - // Handle pointer prefix. - stars := "" - base := goType - for strings.HasPrefix(base, "*") { - stars += "*" - base = base[1:] - } - if strings.HasPrefix(base, "[]") { - return stars + "[]" + exportGoTypeRenamed(base[2:], typeRenameMap) - } - if isScalarGoType(base) || base == "unsafe.Pointer" || base == "string" || base == "bool" || base == "" { - return goType - } - if renamed, ok := typeRenameMap[base]; ok { - return stars + renamed - } - return stars + ExportName(base) -} - -// Manifest holds the relevant manifest fields for capi package generation. -type Manifest struct { - Generator struct { - PackageName string `yaml:"PackageName"` - PackageDescription string `yaml:"PackageDescription"` - Includes []string `yaml:"Includes"` - FlagGroups []FlagGroup `yaml:"FlagGroups"` - ExcludeFunctions []string `yaml:"ExcludeFunctions"` - FunctionAliases []FunctionAlias `yaml:"FunctionAliases"` - } `yaml:"GENERATOR"` -} - -// FlagGroup is a named set of compiler/linker flags. -type FlagGroup struct { - Name string `yaml:"name"` - Flags []string `yaml:"flags"` -} - -// FunctionAlias redirects one generated Go wrapper through another generated -// wrapper instead of emitting a direct C symbol call. -type FunctionAlias struct { - Name string `yaml:"name"` - Target string `yaml:"target"` - Args []FunctionAliasArg `yaml:"args"` -} - -// FunctionAliasArg is either a source-parameter reference or a literal Go -// expression passed to the target wrapper. -type FunctionAliasArg struct { - Param string `yaml:"param,omitempty"` - Literal string `yaml:"literal,omitempty"` -} - -// BaseAPILevel is the Android 14 compatibility floor. Functions at or below this -// level go into the main generated file; functions above it are emitted into -// separate build-tagged files. -const BaseAPILevel = 34 - -// GeneratePackage generates a complete capi/ Go package from the spec -// and manifest. It writes doc.go, types.go, const.go, cgo_helpers.go, -// cgo_helpers.h, and {module}.go into outDir. -// -// apiLevels is an optional map from C function name to the minimum Android -// API level required. Functions above BaseAPILevel are placed in separate -// files with //go:build android_ndk{N} tags. -func GeneratePackage( - spec *specmodel.Spec, - manifest *Manifest, - outDir string, - apiLevels ...map[string]int, -) error { - if err := os.MkdirAll(outDir, 0o755); err != nil { - return fmt.Errorf("creating output directory %s: %w", outDir, err) - } - - pkgName := manifest.Generator.PackageName - if pkgName == "" { - pkgName = filepath.Base(outDir) - } - - // Remove excluded functions from the spec. - if len(manifest.Generator.ExcludeFunctions) > 0 { - for _, name := range manifest.Generator.ExcludeFunctions { - delete(spec.Functions, name) - } - } - - preamble := buildCGoPreamble(manifest) - - // Index types by name. - callbackSet := make(map[string]bool, len(spec.Callbacks)) - for name := range spec.Callbacks { - callbackSet[name] = true - } - - // Index enum groups by typedef name (to emit typed constants). - enumTypedefSet := buildEnumTypedefSet(spec) - - // Compute set of types that need C.struct_ prefix in CGo. - // These are structs without matching C typedefs and cross-module - // opaque pointers that are only available via struct tags. - structPrefixSet := computeStructPrefixSet(spec) - - // Compute rename map for types whose exported Go name collides with - // a function wrapper name (e.g., C has both sync_file_info() and - // struct sync_file_info). Go cannot have a type and function with - // the same name, so the type gets a "_s" suffix. - typeRenameMap := computeTypeRenameMap(spec, structPrefixSet) - - // Resolve API levels map. - var levels map[string]int - if len(apiLevels) > 0 && apiLevels[0] != nil { - levels = apiLevels[0] - } - - functionAliases, err := buildFunctionAliasMap(spec, manifest, levels) - if err != nil { - return fmt.Errorf("building function aliases: %w", err) - } - - // Split functions into base (no tag) and per-API-level groups. - baseFunctions := make(map[string]specmodel.FuncDef) - higherFunctions := make(map[int]map[string]specmodel.FuncDef) // api level -> functions - for name, fn := range spec.Functions { - level := levels[name] - if level > BaseAPILevel { - if higherFunctions[level] == nil { - higherFunctions[level] = make(map[string]specmodel.FuncDef) - } - higherFunctions[level][name] = fn - } else { - baseFunctions[name] = fn - } - } - - // Build a base spec (without higher-API functions) for the main file. - baseSpec := *spec - baseSpec.Functions = baseFunctions - - files := map[string]string{} - files["doc.go"] = generateDocGo(pkgName, manifest.Generator.PackageDescription) - files["types.go"] = generateTypesGo(pkgName, preamble, spec, callbackSet, structPrefixSet, typeRenameMap) - files["const.go"] = generateConstGo(pkgName, preamble, spec, enumTypedefSet) - files["cgo_helpers.go"] = generateCgoHelpersGo(pkgName, preamble, spec, callbackSet) - files["cgo_helpers.h"] = generateCgoHelpersH(pkgName, manifest, spec, structPrefixSet) - files["cgo_helpers.c"] = generateCgoHelpersC(pkgName, spec, structPrefixSet) - files[pkgName+".go"] = generateFunctionsGo(pkgName, preamble, &baseSpec, callbackSet, structPrefixSet, typeRenameMap, functionAliases) - - // Generate per-API-level function files with build tags. - apiLevelKeys := sortedIntKeys(higherFunctions) - for _, level := range apiLevelKeys { - funcs := higherFunctions[level] - levelSpec := *spec - levelSpec.Functions = funcs - fileName := fmt.Sprintf("%s_api%d.go", pkgName, level) - levelPreamble := buildAPILevelPreamble(manifest, level) - buildTag := fmt.Sprintf("//go:build android_ndk%d\n\n", level) - files[fileName] = buildTag + generateFunctionsGo(pkgName, levelPreamble, &levelSpec, callbackSet, structPrefixSet, typeRenameMap, functionAliases) - } - - for name, content := range files { - path := filepath.Join(outDir, name) - - if strings.HasSuffix(name, ".go") { - formatted, err := format.Source([]byte(content)) - if err != nil { - _ = os.WriteFile(path, []byte(content), 0o644) - return fmt.Errorf("formatting %s: %w", name, err) - } - content = string(formatted) - } - - if err := os.WriteFile(path, []byte(content), 0o644); err != nil { - return fmt.Errorf("writing %s: %w", path, err) - } - } - - return nil -} - -func buildFunctionAliasMap( - spec *specmodel.Spec, - manifest *Manifest, - apiLevels map[string]int, -) (map[string]FunctionAlias, error) { - if len(manifest.Generator.FunctionAliases) == 0 { - return nil, nil - } - - aliases := make(map[string]FunctionAlias, len(manifest.Generator.FunctionAliases)) - for _, alias := range manifest.Generator.FunctionAliases { - source, ok := spec.Functions[alias.Name] - if !ok { - return nil, fmt.Errorf("source %q is not in spec functions", alias.Name) - } - target, ok := spec.Functions[alias.Target] - if !ok { - return nil, fmt.Errorf("target %q for source %q is not in spec functions", alias.Target, alias.Name) - } - if source.Returns != target.Returns { - return nil, fmt.Errorf("alias %q return type %q differs from target %q return type %q", alias.Name, source.Returns, alias.Target, target.Returns) - } - if len(alias.Args) != len(target.Params) { - return nil, fmt.Errorf("alias %q has %d args for target %q with %d params", alias.Name, len(alias.Args), alias.Target, len(target.Params)) - } - if _, exists := aliases[alias.Name]; exists { - return nil, fmt.Errorf("duplicate alias for %q", alias.Name) - } - if apiLevels[alias.Target] > apiLevels[alias.Name] { - return nil, fmt.Errorf("alias %q cannot call higher API target %q", alias.Name, alias.Target) - } - - sourceParams := make(map[string]struct{}, len(source.Params)) - for _, param := range source.Params { - sourceParams[param.Name] = struct{}{} - } - - for idx, arg := range alias.Args { - switch { - case arg.Param != "" && arg.Literal != "": - return nil, fmt.Errorf("alias %q arg %d has both param and literal", alias.Name, idx) - case arg.Param == "" && arg.Literal == "": - return nil, fmt.Errorf("alias %q arg %d has neither param nor literal", alias.Name, idx) - case arg.Param != "": - if _, ok := sourceParams[arg.Param]; !ok { - return nil, fmt.Errorf("alias %q arg %d references missing param %q", alias.Name, idx, arg.Param) - } - } - } - - aliases[alias.Name] = alias - } - - return aliases, nil -} - -// buildCGoPreamble constructs the CGo comment block with LDFLAGS and includes. -func buildCGoPreamble(manifest *Manifest) string { - var sb strings.Builder - sb.WriteString("/*\n") - for _, fg := range manifest.Generator.FlagGroups { - sb.WriteString("#cgo ") - sb.WriteString(fg.Name) - sb.WriteString(": ") - sb.WriteString(strings.Join(fg.Flags, " ")) - sb.WriteString("\n") - } - for _, inc := range manifest.Generator.Includes { - fmt.Fprintf(&sb, "#include \"%s\"\n", inc) - } - sb.WriteString("#include \n") - sb.WriteString("#include \"cgo_helpers.h\"\n") - sb.WriteString("*/") - return sb.String() -} - -// buildAPILevelPreamble constructs a CGo comment block for a higher API level. -// It uses #undef + #define __ANDROID_MIN_SDK_VERSION__ before the includes -// so the preprocessor exposes declarations guarded by __INTRODUCED_IN(N). -// The #undef is necessary because the compiler's target triple (e.g. -// android35-clang) pre-defines __ANDROID_MIN_SDK_VERSION__ to the base level. -// __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ disables the strict availability -// attribute that would otherwise cause Clang to reject the declarations even -// when __BIONIC_AVAILABILITY_GUARD passes. -func buildAPILevelPreamble(manifest *Manifest, apiLevel int) string { - var sb strings.Builder - sb.WriteString("/*\n") - for _, fg := range manifest.Generator.FlagGroups { - sb.WriteString("#cgo ") - sb.WriteString(fg.Name) - sb.WriteString(": ") - sb.WriteString(strings.Join(fg.Flags, " ")) - sb.WriteString("\n") - } - sb.WriteString("#undef __ANDROID_MIN_SDK_VERSION__\n") - fmt.Fprintf(&sb, "#define __ANDROID_MIN_SDK_VERSION__ %d\n", apiLevel) - sb.WriteString("#define __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ 1\n") - for _, inc := range manifest.Generator.Includes { - fmt.Fprintf(&sb, "#include \"%s\"\n", inc) - } - sb.WriteString("#include \n") - sb.WriteString("#include \"cgo_helpers.h\"\n") - sb.WriteString("*/") - return sb.String() -} - -// sortedIntKeys returns sorted keys from a map[int]V. -func sortedIntKeys[V any](m map[int]V) []int { - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Ints(keys) - return keys -} - -// buildEnumTypedefSet returns the set of type names that have matching enum groups. -func buildEnumTypedefSet(spec *specmodel.Spec) map[string]bool { - set := make(map[string]bool) - for name := range spec.Types { - td := spec.Types[name] - if strings.HasPrefix(td.Kind, "typedef_") { - if _, hasEnum := spec.Enums[name]; hasEnum { - set[name] = true - } - } - } - return set -} - -// generateDocGo generates the doc.go file content. -func generateDocGo(pkgName string, description string) string { - var sb strings.Builder - sb.WriteString(generatedHeader) - if description != "" { - fmt.Fprintf(&sb, "/*\n%s\n*/\n", description) - } - fmt.Fprintf(&sb, "package %s\n", pkgName) - return sb.String() -} - -// generateTypesGo generates types.go with opaque struct aliases, complete struct -// aliases, enum typedef types, and callback func type declarations. -func generateTypesGo( - pkgName string, - preamble string, - spec *specmodel.Spec, - callbackSet map[string]bool, - structPrefixSet map[string]bool, - typeRenameMap map[string]string, -) string { - needsUnsafe := false - for _, cb := range spec.Callbacks { - for _, p := range cb.Params { - if p.Type == "unsafe.Pointer" { - needsUnsafe = true - break - } - } - if !needsUnsafe && cb.Returns == "unsafe.Pointer" { - needsUnsafe = true - } - if needsUnsafe { - break - } - } - if !needsUnsafe { - for _, td := range spec.Types { - if td.Kind == "pointer_handle" { - needsUnsafe = true - break - } - } - } - - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n\n", pkgName) - sb.WriteString(preamble) - sb.WriteString("\nimport \"C\"\n") - if needsUnsafe { - sb.WriteString("import \"unsafe\"\n") - } - sb.WriteString("\n") - - // Sort type names for deterministic output. - typeNames := sortedKeys(spec.Types) - - for _, name := range typeNames { - td := spec.Types[name] - goName := ExportName(name) - - switch td.Kind { - case "opaque_ptr": - fmt.Fprintf(&sb, "type %s C.%s\n\n", goName, td.CType) - - case "pointer_handle": - fmt.Fprintf(&sb, "type %s unsafe.Pointer\n\n", goName) - - default: - if strings.HasPrefix(td.Kind, "typedef_") { - baseType := goTypeBaseKind(td.Kind) - if baseType == "" { - continue - } - if baseType == ":union" { - fmt.Fprintf(&sb, "type %s C.%s\n\n", goName, td.CType) - continue - } - if strings.Contains(baseType, ":") { - continue - } - switch { - case isScalarGoType(baseType): - fmt.Fprintf(&sb, "type %s %s\n\n", goName, baseType) - case strings.HasPrefix(baseType, "*"): - fmt.Fprintf(&sb, "type %s C.%s\n\n", goName, td.CType) - case strings.HasPrefix(baseType, "["): - fmt.Fprintf(&sb, "type %s %s\n\n", goName, baseType) - default: - if _, exists := spec.Types[baseType]; exists { - fmt.Fprintf(&sb, "type %s %s\n\n", goName, ExportName(baseType)) - } else { - fmt.Fprintf(&sb, "type %s C.%s\n\n", goName, td.CType) - } - } - } - } - } - - // Complete structs. - structNames := sortedKeys(spec.Structs) - for _, name := range structNames { - // Skip structs already covered by a typedef in spec.Types. - if _, hasType := spec.Types[name]; hasType { - continue - } - goName := ExportName(name) - if structPrefixSet[name] { - fmt.Fprintf(&sb, "type %s C.struct_%s\n\n", goName, name) - } else { - fmt.Fprintf(&sb, "type %s C.%s\n\n", goName, name) - } - } - - // Auto-declare types referenced in functions/callbacks but not in - // spec.Types (e.g., off_t, EGLenum, GLuint). These are C typedefs - // that c2ffi/specgen didn't extract as explicit types. - declared := make(map[string]bool) - for name := range spec.Types { - declared[name] = true - } - for name := range spec.Structs { - declared[name] = true - } - for name := range spec.Callbacks { - declared[name] = true - } - - missing := collectUndeclaredTypes(spec, declared) - if len(missing) > 0 { - missingNames := make([]string, 0, len(missing)) - for k := range missing { - missingNames = append(missingNames, k) - } - sort.Strings(missingNames) - for _, name := range missingNames { - goName := ExportName(name) - if renamed, ok := typeRenameMap[name]; ok { - goName = renamed - } - if structPrefixSet[name] { - fmt.Fprintf(&sb, "type %s C.struct_%s\n\n", goName, name) - } else { - fmt.Fprintf(&sb, "type %s C.%s\n\n", goName, name) - } - } - } - - // Callback function types. - cbNames := sortedKeys(spec.Callbacks) - for _, name := range cbNames { - cb := spec.Callbacks[name] - fmt.Fprintf(&sb, "type %s %s\n\n", ExportName(name), callbackGoFuncSig(cb)) - } - - return sb.String() -} - -// callbackGoFuncSig builds the Go function type signature for a callback. -func callbackGoFuncSig(cb specmodel.CallbackDef) string { - var sb strings.Builder - sb.WriteString("func(") - for i, p := range cb.Params { - if i > 0 { - sb.WriteString(", ") - } - name := p.Name - if name == "" { - name = fmt.Sprintf("p%d", i) - } - fmt.Fprintf(&sb, "%s %s", name, exportGoType(p.Type)) - } - sb.WriteString(")") - if cb.Returns != "" { - fmt.Fprintf(&sb, " %s", exportGoType(cb.Returns)) - } - return sb.String() -} - -// generateConstGo generates const.go with enum constant blocks. -func generateConstGo( - pkgName string, - preamble string, - spec *specmodel.Spec, - enumTypedefSet map[string]bool, -) string { - if len(spec.Enums) == 0 { - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n", pkgName) - return sb.String() - } - - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n\n", pkgName) - - enumNames := sortedKeys(spec.Enums) - for _, groupName := range enumNames { - values := spec.Enums[groupName] - if len(values) == 0 { - continue - } - - isTyped := enumTypedefSet[groupName] - - sb.WriteString("const (\n") - for _, v := range values { - if isTyped { - fmt.Fprintf(&sb, "\t%s %s = %d\n", v.Name, ExportName(groupName), v.Value) - } else { - fmt.Fprintf(&sb, "\t%s = %d\n", v.Name, v.Value) - } - } - sb.WriteString(")\n\n") - } - - return sb.String() -} - -// generateCgoHelpersGo generates cgo_helpers.go with CgoAllocMap, SliceHeader, -// callback proxy infrastructure, and string helper. -func generateCgoHelpersGo( - pkgName string, - preamble string, - spec *specmodel.Spec, - callbackSet map[string]bool, -) string { - hasStrHelper := needsStringHelper(spec) - - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n\n", pkgName) - sb.WriteString(preamble) - sb.WriteString("\nimport \"C\"\n") - sb.WriteString("import (\n") - if hasStrHelper { - sb.WriteString("\t\"runtime\"\n") - } - sb.WriteString("\t\"sync\"\n") - sb.WriteString("\t\"unsafe\"\n") - sb.WriteString(")\n\n") - - sb.WriteString(cgoAllocMapCode) - sb.WriteString(sliceHeaderCode) - - // Callback proxies. - structPrefixSet := computeStructPrefixSet(spec) - cbNames := sortedKeys(spec.Callbacks) - for _, name := range cbNames { - cb := spec.Callbacks[name] - sb.WriteString(generateCallbackProxy(pkgName, name, cb, spec, structPrefixSet)) - } - - if hasStrHelper { - sb.WriteString(unpackPCharStringCode) - } - - return sb.String() -} - -const cgoAllocMapCode = `// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || a == b || b.IsEmpty() { - return - } - // Acquire locks in consistent pointer-address order to prevent - // ABBA deadlock when two goroutines call x.Borrow(y) and y.Borrow(x). - if uintptr(unsafe.Pointer(a)) < uintptr(unsafe.Pointer(b)) { - a.mux.Lock() - b.mux.Lock() - } else { - b.mux.Lock() - a.mux.Lock() - } - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -` - -const sliceHeaderCode = `type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -` - -const unpackPCharStringCode = `// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} - -` - -// callbackHashSuffix computes the 8-hex-digit hash suffix for callback proxy names. -// It includes pkgName so that packages sharing the same callback typedef names -// (e.g., gles2 and gles3) produce distinct C symbols. -func callbackHashSuffix(pkgName, name string) string { - h := md5.Sum([]byte(pkgName + "." + name)) - return fmt.Sprintf("%x", h[:4]) -} - -// generateCallbackProxy generates PassRef, PassValue, NewXRef, and the -// //export proxy function for a single callback typedef. -func generateCallbackProxy( - pkgName string, - name string, - cb specmodel.CallbackDef, - spec *specmodel.Spec, - structPrefixSet map[string]bool, -) string { - goName := ExportName(name) // exported Go type name - hash := callbackHashSuffix(pkgName, name) - upperHash := strings.ToUpper(hash) - lowerHash := strings.ToLower(hash) - varName := unexport(goName) + upperHash + "Func" - proxyExportName := goName + upperHash - proxyCName := name + "_" + lowerHash // C function uses original name - - var sb strings.Builder - - // PassRef method. - fmt.Fprintf(&sb, "func (x %s) PassRef() (ref *C.%s, allocs *CgoAllocMap) {\n", goName, name) - sb.WriteString("\tif x == nil {\n\t\treturn nil, nil\n\t}\n") - fmt.Fprintf(&sb, "\tif %s == nil {\n\t\t%s = x\n\t}\n", varName, varName) - fmt.Fprintf(&sb, "\treturn (*C.%s)(C.%s), nil\n", name, proxyCName) - sb.WriteString("}\n\n") - - // PassValue method. - fmt.Fprintf(&sb, "func (x %s) PassValue() (ref C.%s, allocs *CgoAllocMap) {\n", goName, name) - sb.WriteString("\tif x == nil {\n\t\treturn nil, nil\n\t}\n") - fmt.Fprintf(&sb, "\tif %s == nil {\n\t\t%s = x\n\t}\n", varName, varName) - fmt.Fprintf(&sb, "\treturn (C.%s)(C.%s), nil\n", name, proxyCName) - sb.WriteString("}\n\n") - - // NewXRef function. - fmt.Fprintf(&sb, "func New%sRef(ref unsafe.Pointer) *%s {\n", goName, goName) - fmt.Fprintf(&sb, "\treturn (*%s)(ref)\n", goName) - sb.WriteString("}\n\n") - - // //export proxy function. - fmt.Fprintf(&sb, "//export %s\n", proxyExportName) - fmt.Fprintf(&sb, "func %s(", proxyExportName) - - for i, p := range cb.Params { - if i > 0 { - sb.WriteString(", ") - } - pName := p.Name - if pName == "" { - pName = fmt.Sprintf("p%d", i) - } - cgoType := goTypeToCGoCallbackParamWithCType(p.Type, p.CType, structPrefixSet) - fmt.Fprintf(&sb, "c%s %s", pName, cgoType) - } - sb.WriteString(")") - - retCgoType := goTypeToCGoCallbackReturnWithCType(cb.Returns, cb.ReturnsCType, structPrefixSet) - if retCgoType != "" { - fmt.Fprintf(&sb, " %s", retCgoType) - } - sb.WriteString(" {\n") - - // Body: convert C params to Go and call the stored function. - fmt.Fprintf(&sb, "\tif %s != nil {\n", varName) - - var argNames []string - for i, p := range cb.Params { - pName := p.Name - if pName == "" { - pName = fmt.Sprintf("p%d", i) - } - goVarName := pName + lowerHash - convCode := cgoCallbackParamToGo("c"+pName, goVarName, p.Type) - sb.WriteString(convCode) - argNames = append(argNames, goVarName) - } - - callExpr := fmt.Sprintf("%s(%s)", varName, strings.Join(argNames, ", ")) - if cb.Returns != "" { - fmt.Fprintf(&sb, "\t\tret%s := %s\n", lowerHash, callExpr) - retConv := goToCGoReturn("ret"+lowerHash, cb.Returns) - if cb.ReturnsCType != "" { - retConv = goToCGoReturnWithCType("ret"+lowerHash, cb.Returns, cb.ReturnsCType, structPrefixSet) - } - fmt.Fprintf(&sb, "\t\tret, _ := %s, cgoAllocsUnknown\n", retConv) - sb.WriteString("\t\treturn ret\n") - } else { - fmt.Fprintf(&sb, "\t\t%s\n", callExpr) - sb.WriteString("\t\treturn\n") - } - sb.WriteString("\t}\n") - sb.WriteString("\tpanic(\"callback func has not been set (race?)\")\n") - sb.WriteString("}\n\n") - - // Variable to store the callback. - fmt.Fprintf(&sb, "var %s %s\n\n", varName, goName) - - return sb.String() -} - -// generateCgoHelpersH generates the cgo_helpers.h file with C callback proxy declarations. -func generateCgoHelpersH( - pkgName string, - manifest *Manifest, - spec *specmodel.Spec, - structPrefixSet map[string]bool, -) string { - var sb strings.Builder - sb.WriteString(generatedHeader) - for _, inc := range manifest.Generator.Includes { - fmt.Fprintf(&sb, "#include \"%s\"\n", inc) - } - sb.WriteString("#include \n") - sb.WriteString("#pragma once\n\n") - sb.WriteString("#define __CGOGEN 1\n\n") - - cbNames := sortedKeys(spec.Callbacks) - for _, name := range cbNames { - cb := spec.Callbacks[name] - hash := callbackHashSuffix(pkgName, name) - lowerHash := strings.ToLower(hash) - proxyCName := name + "_" + lowerHash - - cRetType := goTypeToCHeaderCallbackReturn(cb.Returns, cb.ReturnsCType, structPrefixSet) - - fmt.Fprintf(&sb, "// %s is a proxy for callback %s.\n", proxyCName, name) - fmt.Fprintf(&sb, "%s %s(", cRetType, proxyCName) - - for i, p := range cb.Params { - if i > 0 { - sb.WriteString(", ") - } - pName := p.Name - if pName == "" { - pName = fmt.Sprintf("p%d", i) - } - cType := goTypeToCHeaderCallbackParam(p.Type, p.CType, structPrefixSet) - fmt.Fprintf(&sb, "%s %s", cType, pName) - } - sb.WriteString(");\n\n") - } - - return sb.String() -} - -// generateCgoHelpersC generates the cgo_helpers.c file with C callback proxy -// implementations that delegate to Go export functions. -func generateCgoHelpersC(pkgName string, spec *specmodel.Spec, structPrefixSet map[string]bool) string { - if len(spec.Callbacks) == 0 { - return generatedHeader - } - - var sb strings.Builder - sb.WriteString(generatedHeader) - sb.WriteString("#include \"_cgo_export.h\"\n\n") - - cbNames := sortedKeys(spec.Callbacks) - for _, name := range cbNames { - cb := spec.Callbacks[name] - hash := callbackHashSuffix(pkgName, name) - upperHash := strings.ToUpper(hash) - lowerHash := strings.ToLower(hash) - proxyCName := name + "_" + lowerHash - goExportName := ExportName(name) + upperHash - - cRetType := goTypeToCHeaderCallbackReturn(cb.Returns, cb.ReturnsCType, structPrefixSet) - - fmt.Fprintf(&sb, "%s %s(", cRetType, proxyCName) - - var paramNames []string - for i, p := range cb.Params { - if i > 0 { - sb.WriteString(", ") - } - pName := p.Name - if pName == "" { - pName = fmt.Sprintf("p%d", i) - } - cType := goTypeToCHeaderCallbackParam(p.Type, p.CType, structPrefixSet) - fmt.Fprintf(&sb, "%s %s", cType, pName) - paramNames = append(paramNames, callbackExportArg(p, pName)) - } - sb.WriteString(") {\n") - - callExpr := fmt.Sprintf("%s(%s)", goExportName, strings.Join(paramNames, ", ")) - if cRetType != "void" { - fmt.Fprintf(&sb, "\treturn %s;\n", callExpr) - } else { - fmt.Fprintf(&sb, "\t%s;\n", callExpr) - } - sb.WriteString("}\n\n") - } - - return sb.String() -} - -// callbackExportArg casts qualified pointer parameters to the non-const CGo -// export signature emitted for the generated Go callback proxy. -func callbackExportArg(p specmodel.Param, name string) string { - if p.CType == "" || !strings.Contains(p.CType, "*") || !strings.Contains(p.CType, "const") { - return name - } - return fmt.Sprintf("(%s)%s", cTypeWithoutQualifiers(p.CType), name) -} - -// generateFunctionsGo generates the {module}.go file with function wrappers. -func generateFunctionsGo( - pkgName string, - preamble string, - spec *specmodel.Spec, - callbackSet map[string]bool, - structPrefixSet map[string]bool, - typeRenameMap map[string]string, - functionAliases map[string]FunctionAlias, -) string { - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n\n", pkgName) - sb.WriteString(preamble) - sb.WriteString("\nimport \"C\"\n") - sb.WriteString("import (\n") - sb.WriteString("\t\"runtime\"\n") - sb.WriteString("\t\"unsafe\"\n") - sb.WriteString(")\n\n") - sb.WriteString("var _ runtime.Error\n") - sb.WriteString("var _ unsafe.Pointer\n\n") - - funcNames := sortedKeys(spec.Functions) - for _, name := range funcNames { - fn := spec.Functions[name] - sb.WriteString(generateFunction(ExportName(name), name, fn, spec, callbackSet, structPrefixSet, typeRenameMap, functionAliases)) - } - - return sb.String() -} - -// generateFunction generates a single Go wrapper function. -func generateFunction( - goFuncName string, - specFuncName string, - fn specmodel.FuncDef, - spec *specmodel.Spec, - callbackSet map[string]bool, - structPrefixSet map[string]bool, - typeRenameMap map[string]string, - functionAliases map[string]FunctionAlias, -) string { - if alias, ok := functionAliases[specFuncName]; ok { - return generateFunctionAlias(goFuncName, fn, typeRenameMap, alias) - } - - var sb strings.Builder - - goRetType := fn.Returns - - // Sanitize parameter names. - params := sanitizeParams(fn.Params) - - // Function signature — use exported Go name. - // Apply type renames to resolve Go name collisions between types and functions. - // Array params ([N]T) become pointer-to-array (*[N]T) so C can write back. - fmt.Fprintf(&sb, "func %s(", goFuncName) - for i, p := range params { - if i > 0 { - sb.WriteString(", ") - } - paramType := exportGoTypeRenamed(p.Type, typeRenameMap) - if isFixedArrayType(paramType) { - paramType = "*" + paramType - } - fmt.Fprintf(&sb, "%s %s", p.Name, paramType) - } - sb.WriteString(")") - if goRetType != "" { - fmt.Fprintf(&sb, " %s", exportGoTypeRenamed(goRetType, typeRenameMap)) - } - sb.WriteString(" {\n") - - // Convert parameters. - var cArgNames []string - var keepAliveNames []string - - for _, p := range params { - conv := paramConversion(p, spec, callbackSet, structPrefixSet) - sb.WriteString(conv.code) - cArgNames = append(cArgNames, conv.cVarName) - keepAliveNames = append(keepAliveNames, conv.keepAliveName) - } - - // Call C function. - callExpr := fmt.Sprintf("C.%s(%s)", fn.CName, strings.Join(cArgNames, ", ")) - - if goRetType != "" { - fmt.Fprintf(&sb, "\t__ret := %s\n", callExpr) - } else { - fmt.Fprintf(&sb, "\t%s\n", callExpr) - } - - // runtime.KeepAlive in reverse order. - for i := len(keepAliveNames) - 1; i >= 0; i-- { - if keepAliveNames[i] != "" { - fmt.Fprintf(&sb, "\truntime.KeepAlive(%s)\n", keepAliveNames[i]) - } - } - - // Return conversion. - if goRetType != "" { - sb.WriteString(returnConversionRenamed(goRetType, spec, typeRenameMap)) - } - - sb.WriteString("}\n\n") - return sb.String() -} - -func generateFunctionAlias( - goFuncName string, - fn specmodel.FuncDef, - typeRenameMap map[string]string, - alias FunctionAlias, -) string { - var sb strings.Builder - - params := sanitizeParams(fn.Params) - paramNames := make(map[string]string, len(params)) - - fmt.Fprintf(&sb, "func %s(", goFuncName) - for i, p := range params { - if i > 0 { - sb.WriteString(", ") - } - paramType := exportGoTypeRenamed(p.Type, typeRenameMap) - if isFixedArrayType(paramType) { - paramType = "*" + paramType - } - fmt.Fprintf(&sb, "%s %s", p.Name, paramType) - paramNames[fn.Params[i].Name] = p.Name - } - sb.WriteString(")") - if fn.Returns != "" { - fmt.Fprintf(&sb, " %s", exportGoTypeRenamed(fn.Returns, typeRenameMap)) - } - sb.WriteString(" {\n") - - args := make([]string, 0, len(alias.Args)) - for _, arg := range alias.Args { - switch { - case arg.Param != "": - args = append(args, paramNames[arg.Param]) - default: - args = append(args, arg.Literal) - } - } - - callExpr := fmt.Sprintf("%s(%s)", ExportName(alias.Target), strings.Join(args, ", ")) - if fn.Returns != "" { - fmt.Fprintf(&sb, "\treturn %s\n", callExpr) - } else { - fmt.Fprintf(&sb, "\t%s\n", callExpr) - } - sb.WriteString("}\n\n") - - return sb.String() -} - -type conversionResult struct { - code string - cVarName string - keepAliveName string -} - -// paramConversion generates Go→C conversion code for one parameter. -func paramConversion( - p specmodel.Param, - spec *specmodel.Spec, - callbackSet map[string]bool, - structPrefixSet map[string]bool, -) conversionResult { - cVar := "c" + p.Name - allocVar := cVar + "AllocMap" - - goType := p.Type - - // unsafe.Pointer: pass directly. - if goType == "unsafe.Pointer" { - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := %s, cgoAllocsUnknown\n", cVar, allocVar, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // string → C.CString. - if goType == "string" { - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := UnpackPCharString(%s)\n", cVar, allocVar, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // Callback type: use PassValue. - if callbackSet[goType] { - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := %s.PassValue()\n", cVar, allocVar, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // Multi-level pointer (output param): e.g., **ACameraIdList, ***ASurfaceControl. - // CGo's pointer checker rejects Go pointers containing other pointers - // unless they are pinned with runtime.Pinner. - if strings.HasPrefix(goType, "**") { - // Count pointer depth and extract base type. - stars := 0 - base := goType - for strings.HasPrefix(base, "*") { - stars++ - base = base[1:] - } - starStr := strings.Repeat("*", stars) - var cgoTypeExpr string - switch { - case base == "string": - cgoTypeExpr = fmt.Sprintf("%s*C.char", starStr) - case isScalarGoType(base): - cgoBase := goTypeToCGoExactType(base) - if exactBase := cgoBaseTypeFromCType(p.CType, stars); exactBase != "" { - cgoBase = exactBase - } - cgoTypeExpr = fmt.Sprintf("%s%s", starStr, cgoBase) - case structPrefixSet[base]: - cgoTypeExpr = fmt.Sprintf("%sC.struct_%s", starStr, base) - default: - cgoTypeExpr = fmt.Sprintf("%sC.%s", starStr, base) - } - - pinnerName := "pinner" + cVar - code := fmt.Sprintf("\t%s, %s := (%s)(unsafe.Pointer(%s)), cgoAllocsUnknown\n", - cVar, allocVar, cgoTypeExpr, p.Name) - code += fmt.Sprintf("\tvar %s runtime.Pinner\n", pinnerName) - // Pin each reachable pointer-valued object. A nested pointer can contain - // another Go pointer at every level, all of which must remain pinned - // while C is using the pointer chain. - code += fmt.Sprintf("\t%s.Pin(%s)\n", pinnerName, p.Name) - for level := 1; level < stars; level++ { - indent := strings.Repeat("\t", level) - condition := strings.Repeat("*", level-1) + p.Name - deref := strings.Repeat("*", level) + p.Name - code += fmt.Sprintf("%sif %s != nil {\n", indent, condition) - code += fmt.Sprintf("%s\t%s.Pin(unsafe.Pointer(%s))\n", indent, pinnerName, deref) - } - for level := stars - 1; level >= 1; level-- { - code += fmt.Sprintf("%s}\n", strings.Repeat("\t", level)) - } - code += fmt.Sprintf("\tdefer %s.Unpin()\n", pinnerName) - - return conversionResult{ - code: code, - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // Pointer to type: e.g., *ALooper, *int32, *unsafe.Pointer. - if strings.HasPrefix(goType, "*") { - base := goType[1:] - - // *unsafe.Pointer = void** → pass directly. - if base == "unsafe.Pointer" { - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := %s, cgoAllocsUnknown\n", cVar, allocVar, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // *string = const char** → cast via unsafe.Pointer. - if base == "string" { - return conversionResult{ - code: "", - cVarName: fmt.Sprintf("(**C.char)(unsafe.Pointer(%s))", p.Name), - keepAliveName: "", - } - } - - // Pointer to scalar type: *int32 → (*C.int)(unsafe.Pointer(x)). - if isScalarGoType(base) { - cgoBase := goTypeToCGoType(base) - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := (*%s)(unsafe.Pointer(%s)), cgoAllocsUnknown\n", cVar, allocVar, cgoBase, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // Pointer to named type (opaque struct, struct, etc.). - cTypePrefix := "C." - if structPrefixSet[base] { - cTypePrefix = "C.struct_" - } - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := (*%s%s)(unsafe.Pointer(%s)), cgoAllocsUnknown\n", cVar, allocVar, cTypePrefix, base, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // Array type: [N]T → pointer to first element. - if len(goType) > 2 && goType[0] == '[' && goType[1] != ']' { - // Extract element type: [4]float32 → float32. - bracketEnd := strings.Index(goType, "]") - if bracketEnd > 0 { - elemType := goType[bracketEnd+1:] - cgoElem := goTypeToCGoType(elemType) - code := fmt.Sprintf("\t%s, %s := (*%s)(unsafe.Pointer(&%s[0])), cgoAllocsUnknown\n", - cVar, allocVar, cgoElem, p.Name) - return conversionResult{ - code: code, - cVarName: cVar, - keepAliveName: allocVar, - } - } - } - - // Slice type: []T → pointer to first element. - if strings.HasPrefix(goType, "[]") { - elemType := goType[2:] - cgoElem := goTypeToCGoType(elemType) - code := fmt.Sprintf("\t%s, %s := (*%s)(unsafe.Pointer((*SliceHeader)(unsafe.Pointer(&%s)).Data)), cgoAllocsUnknown\n", - cVar, allocVar, cgoElem, p.Name) - return conversionResult{ - code: code, - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // Named typedef type (e.g., camera_status_t): cast to C type. - if td, ok := spec.Types[goType]; ok { - baseType := goTypeBaseKind(td.Kind) - if strings.HasPrefix(baseType, "[") { - // Array typedef: pass pointer to first element using element's CGo type. - // E.g., AMediaUUID ([16]uint8) → (*C.uint8_t)(unsafe.Pointer(&uuid[0])) - bracketEnd := strings.Index(baseType, "]") - elemType := baseType[bracketEnd+1:] - cgoElem := goTypeToCGoType(elemType) - return conversionResult{ - code: "", - cVarName: fmt.Sprintf("(*%s)(unsafe.Pointer(&%s[0]))", cgoElem, p.Name), - keepAliveName: "", - } - } - if td.Kind == "pointer_handle" { - // void* handle: cast through C typedef. - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := (C.%s)(%s), cgoAllocsUnknown\n", cVar, allocVar, td.CType, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := (C.%s)(%s), cgoAllocsUnknown\n", cVar, allocVar, goType, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // Scalar type: cast to CGo type. - cgoType := goTypeToCGoType(goType) - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := (%s)(%s), cgoAllocsUnknown\n", cVar, allocVar, cgoType, p.Name), - cVarName: cVar, - keepAliveName: allocVar, - } -} - -// cgoBaseTypeFromCType preserves the C ABI spelling that Go's scalar type -// mapping loses. In particular, char, signed char, and int8_t all become -// int8 in the public Go signature but are distinct CGo pointer types. -func cgoBaseTypeFromCType(cType string, pointerCount int) string { - if cType == "" { - return "" - } - cType = strings.TrimSpace(cType) - cType = strings.ReplaceAll(cType, "const", "") - cType = strings.Join(strings.Fields(cType), " ") - for i := 0; i < pointerCount; i++ { - if !strings.HasSuffix(cType, "*") { - return "" - } - cType = strings.TrimSpace(strings.TrimSuffix(cType, "*")) - } - if strings.Contains(cType, "*") || cType == "" { - return "" - } - if strings.HasPrefix(cType, "struct ") { - return "C.struct_" + strings.TrimSpace(strings.TrimPrefix(cType, "struct ")) - } - switch cType { - case "char": - return "C.char" - case "signed char": - return "C.schar" - case "unsigned char": - return "C.uchar" - case "int8_t", "uint8_t", "int16_t", "uint16_t", "int32_t", "uint32_t", "int64_t", "uint64_t": - return "C." + cType - case "short": - return "C.short" - case "unsigned short": - return "C.ushort" - case "int": - return "C.int" - case "unsigned int": - return "C.uint" - case "long": - return "C.long" - case "unsigned long": - return "C.ulong" - case "float": - return "C.float" - case "double": - return "C.double" - case "_Bool": - return "C._Bool" - default: - return "C." + cType - } -} - -// returnConversion generates code to convert a C return value to Go. -func returnConversion(origRetType string, spec *specmodel.Spec) string { - return returnConversionRenamed(origRetType, spec, nil) -} - -// returnConversionRenamed generates code to convert a C return value to Go, -// using the type rename map for collision resolution. -func returnConversionRenamed(origRetType string, spec *specmodel.Spec, typeRenameMap map[string]string) string { - goRetType := exportGoTypeRenamed(origRetType, typeRenameMap) - // String return: convert *C.char to Go string. - if goRetType == "string" { - return "\t__v := C.GoString(__ret)\n\treturn __v\n" - } - - // Pointer return: direct pointer cast via unsafe.Pointer. - if strings.HasPrefix(goRetType, "*") { - return fmt.Sprintf("\t__v := (%s)(unsafe.Pointer(__ret))\n\treturn __v\n", goRetType) - } - - // Bool return. - if goRetType == "bool" { - return "\t__v := (bool)(__ret)\n\treturn __v\n" - } - - // Callback function type return: convert through unsafe.Pointer. - if _, isCb := spec.Callbacks[origRetType]; isCb { - return fmt.Sprintf("\t__v := *(*%s)(unsafe.Pointer(&__ret))\n\treturn __v\n", goRetType) - } - - // Pointer handle return: convert through unsafe.Pointer. - if td, ok := spec.Types[origRetType]; ok && td.Kind == "pointer_handle" { - return fmt.Sprintf("\t__v := (%s)(__ret)\n\treturn __v\n", goRetType) - } - - // Enum typedef or scalar return. - return fmt.Sprintf("\t__v := (%s)(__ret)\n\treturn __v\n", goRetType) -} - -// needsStringHelper returns true if any function has a string parameter. -func needsStringHelper(spec *specmodel.Spec) bool { - for _, fn := range spec.Functions { - for _, p := range fn.Params { - if p.Type == "string" { - return true - } - } - } - return false -} - -// unexport returns the unexported version of a Go identifier. -func unexport(name string) string { - if len(name) == 0 { - return name - } - return strings.ToLower(name[:1]) + name[1:] -} - -// sanitizeParams ensures parameter names are valid Go identifiers. -func sanitizeParams(params []specmodel.Param) []specmodel.Param { - result := make([]specmodel.Param, len(params)) - for i, p := range params { - result[i] = p - if p.Name == "" { - result[i].Name = fmt.Sprintf("p%d", i) - } - result[i].Name = sanitizeGoIdent(result[i].Name) - } - return result -} - -// sanitizeGoIdent ensures a name is a valid Go identifier (not a keyword). -func sanitizeGoIdent(name string) string { - switch name { - case "type", "func", "var", "const", "import", "package", - "return", "range", "map", "chan", "interface", "struct", - "error", "string", "bool", "int", "uint", "byte", "rune", - "select", "case", "default", "switch", "break", "continue", - "for", "go", "goto", "if", "else", "defer", "fallthrough": - return "_" + name - } - return name -} - -// undeclaredType holds info about a type referenced but not declared. -type undeclaredType struct { - // pointerOnly is true if the type is only used behind a pointer (*X). - // If true, it's likely an opaque struct and needs C.struct_ prefix. - // If false, it's used as a value type (likely a typedef) and uses C.X. - pointerOnly bool -} - -// collectUndeclaredTypes finds all type names used in function params/returns -// and callback params/returns that are not already declared in spec.Types, -// spec.Structs, or spec.Callbacks, and are not built-in Go types. -func collectUndeclaredTypes(spec *specmodel.Spec, declared map[string]bool) map[string]undeclaredType { - missing := make(map[string]undeclaredType) - - check := func(goType string) { - isPtr := strings.HasPrefix(goType, "*") - base := stripPointers(goType) - // Skip array types. - if len(base) > 0 && base[0] == '[' { - bracketEnd := strings.Index(base, "]") - if bracketEnd > 0 { - base = base[bracketEnd+1:] - } - } - // Skip slice types. - base = strings.TrimPrefix(base, "[]") - if base == "" || base == "string" || base == "bool" || base == "unsafe.Pointer" || base == "func_ptr" { - return - } - // Skip c2ffi artifacts, CGo expressions, and invalid Go identifiers. - if strings.Contains(base, ":") || strings.Contains(base, " ") || strings.Contains(base, "[") || strings.Contains(base, ".") { - return - } - // Skip Go keywords that can't be type names. - if base == "union" || base == "struct" || base == "enum" { - return - } - if isScalarGoType(base) { - return - } - if declared[base] { - return - } - if existing, ok := missing[base]; ok { - // If previously seen as pointer-only, and now used as a value, mark as not pointer-only. - if !isPtr { - existing.pointerOnly = false - missing[base] = existing - } - } else { - missing[base] = undeclaredType{pointerOnly: isPtr} - } - } - - for _, fn := range spec.Functions { - for _, p := range fn.Params { - check(p.Type) - } - check(fn.Returns) - } - for _, cb := range spec.Callbacks { - for _, p := range cb.Params { - check(p.Type) - } - check(cb.Returns) - } - for _, sd := range spec.Structs { - for _, f := range sd.Fields { - check(f.Type) - } - } - - return missing -} - -// computeStructPrefixSet returns the set of type names that need C.struct_ -// prefix in CGo. These are structs in spec.Structs that don't have a -// matching typedef with the same name in spec.Types. -func computeStructPrefixSet(spec *specmodel.Spec) map[string]bool { - set := make(map[string]bool) - for name := range spec.Structs { - if _, hasType := spec.Types[name]; !hasType { - set[name] = true - } - } - return set -} - -// computeTypeRenameMap detects Go name collisions between undeclared types -// and function wrappers. In C, a function and struct can share a name -// (e.g., sync_file_info), but Go forbids a type and function with the -// same exported name. The map keys are C type names; values are suffixed -// Go type names (e.g., "Sync_file_info_s"). -func computeTypeRenameMap( - spec *specmodel.Spec, - structPrefixSet map[string]bool, -) map[string]string { - declared := make(map[string]bool) - for name := range spec.Types { - declared[name] = true - } - for name := range spec.Structs { - declared[name] = true - } - for name := range spec.Callbacks { - declared[name] = true - } - - missing := collectUndeclaredTypes(spec, declared) - renameMap := make(map[string]string) - for name := range missing { - if _, isFunc := spec.Functions[name]; isFunc { - structPrefixSet[name] = true - renameMap[name] = ExportName(name) + "_s" - } - } - return renameMap -} - -// stripPointers removes leading '*' characters from a type string. -// -// Proven idempotent (proofs/Proofs/StripPointers.lean). -// Differential tested against Lean oracle. -func stripPointers(t string) string { - for strings.HasPrefix(t, "*") { - t = t[1:] - } - return t -} - -// sortedKeys returns sorted keys from a map. -func sortedKeys[V any](m map[string]V) []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} diff --git a/tools/pkg/capigen/generate_property_test.go b/tools/pkg/capigen/generate_property_test.go deleted file mode 100644 index f7b027e..0000000 --- a/tools/pkg/capigen/generate_property_test.go +++ /dev/null @@ -1,151 +0,0 @@ -package capigen - -import ( - "strings" - "testing" - "testing/quick" - "unicode" -) - -// TestExportName_Idempotent verifies that ExportName(ExportName(x)) == ExportName(x) -// for all inputs. This is the idempotency property proven in Lean 4. -func TestExportName_Idempotent(t *testing.T) { - f := func(name string) bool { - return ExportName(ExportName(name)) == ExportName(name) - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("ExportName idempotency violated: %v", err) - } -} - -// TestExportName_NonEmpty verifies that ExportName never returns "" for non-empty input. -func TestExportName_NonEmpty(t *testing.T) { - f := func(name string) bool { - if name == "" { - return true - } - return ExportName(name) != "" - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("ExportName returned empty for non-empty input: %v", err) - } -} - -// TestExportName_UppercaseStart verifies that the result starts with an uppercase -// letter (when the input has any non-underscore characters). -func TestExportName_UppercaseStart(t *testing.T) { - f := func(name string) bool { - result := ExportName(name) - if result == "" { - return true - } - // If all underscores, result is unchanged. - stripped := strings.TrimLeft(name, "_") - if stripped == "" { - return result == name - } - first := rune(result[0]) - // First char should be uppercase if it was lowercase. - if stripped[0] >= 'a' && stripped[0] <= 'z' { - return unicode.IsUpper(first) - } - return true - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("ExportName uppercase-start violated: %v", err) - } -} - -// TestExportName_AllUnderscores verifies that ExportName returns the input -// unchanged when it consists entirely of underscores. -func TestExportName_AllUnderscores(t *testing.T) { - for n := 0; n <= 10; n++ { - name := strings.Repeat("_", n) - if got := ExportName(name); got != name { - t.Errorf("ExportName(%q) = %q, want %q", name, got, name) - } - } -} - -// TestStripPointers_Idempotent verifies that stripPointers(stripPointers(x)) == stripPointers(x). -func TestStripPointers_Idempotent(t *testing.T) { - f := func(typ string) bool { - return stripPointers(stripPointers(typ)) == stripPointers(typ) - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("stripPointers idempotency violated: %v", err) - } -} - -// TestStripPointers_NoLeadingStar verifies that the result has no leading '*'. -func TestStripPointers_NoLeadingStar(t *testing.T) { - f := func(typ string) bool { - result := stripPointers(typ) - return result == "" || result[0] != '*' - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("stripPointers has leading star: %v", err) - } -} - -// TestIsScalarGoType_Exhaustive verifies all expected scalar types are recognized. -func TestIsScalarGoType_Exhaustive(t *testing.T) { - scalars := []string{ - "int8", "uint8", "int16", "uint16", "int32", "uint32", - "int64", "uint64", "float32", "float64", "bool", "int", "uint", - } - for _, s := range scalars { - if !isScalarGoType(s) { - t.Errorf("isScalarGoType(%q) = false, want true", s) - } - } - - nonScalars := []string{ - "string", "unsafe.Pointer", "ALooper", "camera_status_t", - "*int32", "[]byte", "", - } - for _, s := range nonScalars { - if isScalarGoType(s) { - t.Errorf("isScalarGoType(%q) = true, want false", s) - } - } -} - -// TestSanitizeGoIdent_CoversAllKeywords verifies that all Go keywords are sanitized. -func TestSanitizeGoIdent_CoversAllKeywords(t *testing.T) { - keywords := []string{ - "break", "case", "chan", "const", "continue", - "default", "defer", "else", "fallthrough", "for", - "func", "go", "goto", "if", "import", - "interface", "map", "package", "range", "return", - "select", "struct", "switch", "type", "var", - } - for _, kw := range keywords { - result := sanitizeGoIdent(kw) - if result == kw { - t.Errorf("sanitizeGoIdent(%q) returned keyword unchanged", kw) - } - if result != "_"+kw { - t.Errorf("sanitizeGoIdent(%q) = %q, want %q", kw, result, "_"+kw) - } - } -} - -// TestSanitizeGoIdent_NonKeyword verifies non-keywords are unchanged. -func TestSanitizeGoIdent_NonKeyword(t *testing.T) { - f := func(name string) bool { - // Skip actual keywords. - switch name { - case "type", "func", "var", "const", "import", "package", - "return", "range", "map", "chan", "interface", "struct", - "error", "string", "bool", "int", "uint", "byte", "rune", - "select", "case", "default", "switch", "break", "continue", - "for", "go", "goto", "if", "else", "defer", "fallthrough": - return true - } - return sanitizeGoIdent(name) == name - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("sanitizeGoIdent modified non-keyword: %v", err) - } -} diff --git a/tools/pkg/capigen/generate_test.go b/tools/pkg/capigen/generate_test.go deleted file mode 100644 index 6ab01b2..0000000 --- a/tools/pkg/capigen/generate_test.go +++ /dev/null @@ -1,695 +0,0 @@ -package capigen - -import ( - "os" - "path/filepath" - "strings" - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func looperSpec() *specmodel.Spec { - return &specmodel.Spec{ - Module: "looper", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/looper", - Types: map[string]specmodel.TypeDef{ - "ALooper": { - Kind: "opaque_ptr", - CType: "ALooper", - GoType: "*C.ALooper", - }, - }, - Enums: map[string][]specmodel.EnumValue{ - "ALOOPER_POLL": { - {Name: "ALOOPER_POLL_WAKE", Value: -1}, - {Name: "ALOOPER_POLL_CALLBACK", Value: -2}, - {Name: "ALOOPER_POLL_TIMEOUT", Value: -3}, - {Name: "ALOOPER_POLL_ERROR", Value: -4}, - }, - "ALOOPER_EVENT": { - {Name: "ALOOPER_EVENT_INPUT", Value: 1}, - {Name: "ALOOPER_EVENT_OUTPUT", Value: 2}, - {Name: "ALOOPER_EVENT_ERROR", Value: 4}, - }, - }, - Functions: map[string]specmodel.FuncDef{ - "ALooper_forThread": { - CName: "ALooper_forThread", - Returns: "*ALooper", - }, - "ALooper_addFd": { - CName: "ALooper_addFd", - Params: []specmodel.Param{ - {Name: "looper", Type: "*ALooper"}, - {Name: "fd", Type: "int32"}, - {Name: "ident", Type: "int32"}, - {Name: "events", Type: "int32"}, - {Name: "callback", Type: "ALooper_callbackFunc"}, - {Name: "data", Type: "unsafe.Pointer"}, - }, - Returns: "int32", - }, - "ALooper_acquire": { - CName: "ALooper_acquire", - Params: []specmodel.Param{ - {Name: "looper", Type: "*ALooper"}, - }, - }, - }, - Callbacks: map[string]specmodel.CallbackDef{ - "ALooper_callbackFunc": { - Params: []specmodel.Param{ - {Name: "fd", Type: "int32"}, - {Name: "events", Type: "int32"}, - {Name: "data", Type: "unsafe.Pointer"}, - }, - Returns: "int32", - }, - }, - } -} - -func looperManifest() *Manifest { - m := &Manifest{} - m.Generator.PackageName = "looper" - m.Generator.PackageDescription = "Raw CGo bindings for Android looper" - m.Generator.Includes = []string{"android/looper.h"} - m.Generator.FlagGroups = []FlagGroup{ - {Name: "LDFLAGS", Flags: []string{"-landroid"}}, - } - return m -} - -func nativeWindowFrameRateSpec() *specmodel.Spec { - return &specmodel.Spec{ - Module: "nativewindow", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/nativewindow", - Types: map[string]specmodel.TypeDef{ - "ANativeWindow": { - Kind: "opaque_ptr", - CType: "ANativeWindow", - GoType: "*C.ANativeWindow", - }, - }, - Enums: map[string][]specmodel.EnumValue{ - "ANativeWindow_ChangeFrameRateStrategy": { - {Name: "ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS", Value: 0}, - }, - "ANativeWindow_FrameRateCompatibility": { - {Name: "ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT", Value: 0}, - }, - }, - Functions: map[string]specmodel.FuncDef{ - "ANativeWindow_clearFrameRate": { - CName: "ANativeWindow_clearFrameRate", - Params: []specmodel.Param{ - {Name: "window", Type: "*ANativeWindow"}, - }, - Returns: "int32", - }, - "ANativeWindow_setFrameRateWithChangeStrategy": { - CName: "ANativeWindow_setFrameRateWithChangeStrategy", - Params: []specmodel.Param{ - {Name: "window", Type: "*ANativeWindow"}, - {Name: "frameRate", Type: "float32"}, - {Name: "compatibility", Type: "int8"}, - {Name: "changeFrameRateStrategy", Type: "int8"}, - }, - Returns: "int32", - }, - }, - } -} - -func nativeWindowManifest() *Manifest { - m := &Manifest{} - m.Generator.PackageName = "nativewindow" - m.Generator.PackageDescription = "Raw CGo bindings for Android native window" - m.Generator.Includes = []string{"android/native_window.h"} - m.Generator.FlagGroups = []FlagGroup{ - {Name: "LDFLAGS", Flags: []string{"-landroid", "-lnativewindow"}}, - } - m.Generator.FunctionAliases = []FunctionAlias{ - { - Name: "ANativeWindow_clearFrameRate", - Target: "ANativeWindow_setFrameRateWithChangeStrategy", - Args: []FunctionAliasArg{ - {Param: "window"}, - {Literal: "0"}, - {Literal: "ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT"}, - {Literal: "ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS"}, - }, - }, - } - return m -} - -func TestGeneratePackage(t *testing.T) { - spec := looperSpec() - manifest := looperManifest() - - outDir := t.TempDir() - err := GeneratePackage(spec, manifest, outDir) - require.NoError(t, err) - - // Verify all expected files are created. - expectedFiles := []string{ - "doc.go", - "types.go", - "const.go", - "cgo_helpers.go", - "cgo_helpers.h", - "looper.go", - } - for _, f := range expectedFiles { - path := filepath.Join(outDir, f) - _, err := os.Stat(path) - assert.NoError(t, err, "missing file: %s", f) - } -} - -func TestGeneratePackageWithAPILevels(t *testing.T) { - spec := looperSpec() - // Add an API-36 function to the spec. - spec.Functions["ALooper_newFeature"] = specmodel.FuncDef{ - CName: "ALooper_newFeature", - Params: []specmodel.Param{ - {Name: "looper", Type: "*ALooper"}, - }, - Returns: "int32", - } - manifest := looperManifest() - apiLevels := map[string]int{ - "ALooper_newFeature": 36, - } - - outDir := t.TempDir() - err := GeneratePackage(spec, manifest, outDir, apiLevels) - require.NoError(t, err) - - // Base file should exist and not contain the API-36 function. - basePath := filepath.Join(outDir, "looper.go") - baseContent, err := os.ReadFile(basePath) - require.NoError(t, err) - assert.NotContains(t, string(baseContent), "ALooper_newFeature", - "base file must not contain API-36 function") - assert.Contains(t, string(baseContent), "ALooper_forThread", - "base file must contain base-level functions") - - // API-36 file should exist with build tag and the function. - api36Path := filepath.Join(outDir, "looper_api36.go") - api36Content, err := os.ReadFile(api36Path) - require.NoError(t, err) - api36Str := string(api36Content) - assert.Contains(t, api36Str, "//go:build android_ndk36", - "API-36 file must have build tag") - assert.Contains(t, api36Str, "ALooper_newFeature", - "API-36 file must contain the higher-API function") - assert.Contains(t, api36Str, "#undef __ANDROID_MIN_SDK_VERSION__", - "API-36 preamble must undef the SDK version") - assert.Contains(t, api36Str, "#define __ANDROID_MIN_SDK_VERSION__ 36", - "API-36 preamble must define SDK version 36") - assert.Contains(t, api36Str, "__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__", - "API-36 preamble must enable weak symbols") -} - -func TestGeneratePackageWithAPI35Level(t *testing.T) { - spec := looperSpec() - spec.Functions["ALooper_android15Feature"] = specmodel.FuncDef{ - CName: "ALooper_android15Feature", - Params: []specmodel.Param{ - {Name: "looper", Type: "*ALooper"}, - }, - Returns: "int32", - } - manifest := looperManifest() - apiLevels := map[string]int{ - "ALooper_android15Feature": 35, - } - - outDir := t.TempDir() - err := GeneratePackage(spec, manifest, outDir, apiLevels) - require.NoError(t, err) - - basePath := filepath.Join(outDir, "looper.go") - baseContent, err := os.ReadFile(basePath) - require.NoError(t, err) - assert.NotContains(t, string(baseContent), "ALooper_android15Feature", - "base file must not hard-reference Android 15 symbols when target runtime is Android 14") - - api35Path := filepath.Join(outDir, "looper_api35.go") - api35Content, err := os.ReadFile(api35Path) - require.NoError(t, err) - api35Str := string(api35Content) - assert.Contains(t, api35Str, "//go:build android_ndk35", - "API-35 file must have build tag") - assert.Contains(t, api35Str, "ALooper_android15Feature", - "API-35 file must contain Android 15 function") -} - -func TestGeneratePackageWithoutAPILevels(t *testing.T) { - spec := looperSpec() - manifest := looperManifest() - - outDir := t.TempDir() - // No API levels — should produce the same output as before. - err := GeneratePackage(spec, manifest, outDir) - require.NoError(t, err) - - basePath := filepath.Join(outDir, "looper.go") - baseContent, err := os.ReadFile(basePath) - require.NoError(t, err) - assert.Contains(t, string(baseContent), "ALooper_forThread") - assert.Contains(t, string(baseContent), "ALooper_addFd") - - // No API-level files should be generated. - entries, err := os.ReadDir(outDir) - require.NoError(t, err) - for _, e := range entries { - assert.NotContains(t, e.Name(), "_api", - "no API-level files should exist without API levels") - } -} - -func TestBuildAPILevelPreamble(t *testing.T) { - manifest := looperManifest() - preamble := buildAPILevelPreamble(manifest, 36) - - assert.Contains(t, preamble, "#undef __ANDROID_MIN_SDK_VERSION__") - assert.Contains(t, preamble, "#define __ANDROID_MIN_SDK_VERSION__ 36") - assert.Contains(t, preamble, "#define __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ 1") - assert.Contains(t, preamble, "#cgo LDFLAGS: -landroid") - assert.Contains(t, preamble, "#include \"android/looper.h\"") -} - -func TestGenerateDocGo(t *testing.T) { - content := generateDocGo("looper", "Raw CGo bindings for Android looper") - assert.Contains(t, content, "package looper") - assert.Contains(t, content, "DO NOT EDIT") - assert.Contains(t, content, "Raw CGo bindings for Android looper") -} - -func TestGenerateTypesGo(t *testing.T) { - spec := looperSpec() - preamble := buildCGoPreamble(looperManifest()) - callbackSet := map[string]bool{"ALooper_callbackFunc": true} - - content := generateTypesGo("looper", preamble, spec, callbackSet, nil, nil) - - assert.Contains(t, content, "type ALooper C.ALooper") - assert.Contains(t, content, "type ALooper_callbackFunc func(") - assert.Contains(t, content, "fd int32") - assert.Contains(t, content, "data unsafe.Pointer") - assert.Contains(t, content, ") int32") -} - -func TestGenerateConstGo(t *testing.T) { - spec := looperSpec() - preamble := buildCGoPreamble(looperManifest()) - enumTypedefSet := buildEnumTypedefSet(spec) - - content := generateConstGo("looper", preamble, spec, enumTypedefSet) - - assert.Contains(t, content, "ALOOPER_POLL_WAKE = -1") - assert.Contains(t, content, "ALOOPER_POLL_CALLBACK = -2") - assert.Contains(t, content, "ALOOPER_EVENT_INPUT = 1") -} - -func TestGenerateConstGoTypedEnum(t *testing.T) { - spec := &specmodel.Spec{ - Types: map[string]specmodel.TypeDef{ - "camera_status_t": { - Kind: "typedef_int32", - CType: "camera_status_t", - GoType: "int32", - }, - }, - Enums: map[string][]specmodel.EnumValue{ - "camera_status_t": { - {Name: "ACAMERA_OK", Value: 0}, - {Name: "ACAMERA_ERROR_UNKNOWN", Value: -10000}, - }, - }, - } - enumTypedefSet := buildEnumTypedefSet(spec) - content := generateConstGo("camera", "", spec, enumTypedefSet) - - assert.Contains(t, content, "ACAMERA_OK Camera_status_t = 0") - assert.Contains(t, content, "ACAMERA_ERROR_UNKNOWN Camera_status_t = -10000") -} - -func TestGenerateCgoHelpersH(t *testing.T) { - spec := looperSpec() - manifest := looperManifest() - - content := generateCgoHelpersH("looper", manifest, spec, nil) - - assert.Contains(t, content, "#include \"android/looper.h\"") - assert.Contains(t, content, "#pragma once") - assert.Contains(t, content, "#define __CGOGEN 1") - // Callback proxy declaration. - assert.Contains(t, content, "ALooper_callbackFunc_") - assert.Contains(t, content, "int fd") - assert.Contains(t, content, "void* data") -} - -func TestGenerateFunctionsGo(t *testing.T) { - spec := looperSpec() - callbackSet := map[string]bool{"ALooper_callbackFunc": true} - preamble := buildCGoPreamble(looperManifest()) - - content := generateFunctionsGo("looper", preamble, spec, callbackSet, nil, nil, nil) - - // ALooper_forThread returns *ALooper. - assert.Contains(t, content, "func ALooper_forThread() *ALooper") - assert.Contains(t, content, "C.ALooper_forThread()") - assert.Contains(t, content, "(*ALooper)(unsafe.Pointer(__ret))") - assert.NotContains(t, content, "unsafe.Pointer(&__ret)", "pointer returns must not take address of __ret") - - // ALooper_addFd has parameters. - assert.Contains(t, content, "func ALooper_addFd(") - assert.Contains(t, content, "looper *ALooper") - assert.Contains(t, content, "fd int32") - assert.Contains(t, content, "callback ALooper_callbackFunc") - assert.Contains(t, content, "data unsafe.Pointer") - assert.Contains(t, content, "C.ALooper_addFd(") - assert.Contains(t, content, "(*C.ALooper)(unsafe.Pointer(looper))") - assert.Contains(t, content, ".PassValue()") - assert.Contains(t, content, "runtime.KeepAlive(") - - // ALooper_acquire has no return. - assert.Contains(t, content, "func ALooper_acquire(") -} - -func TestGenerateFunctionAlias(t *testing.T) { - spec := nativeWindowFrameRateSpec() - manifest := nativeWindowManifest() - - outDir := t.TempDir() - err := GeneratePackage(spec, manifest, outDir) - require.NoError(t, err) - - basePath := filepath.Join(outDir, "nativewindow.go") - baseContent, err := os.ReadFile(basePath) - require.NoError(t, err) - - content := string(baseContent) - assert.Contains(t, content, "func ANativeWindow_clearFrameRate(window *ANativeWindow) int32") - assert.Contains(t, content, "return ANativeWindow_setFrameRateWithChangeStrategy(window, 0, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT, ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS)") - assert.NotContains(t, content, "C.ANativeWindow_clearFrameRate") -} - -func TestGeneratedNativeWindowDoesNotExposeClearFrameRateAlias(t *testing.T) { - generatedFiles := []string{ - filepath.Join("..", "..", "..", "capi", "nativewindow", "nativewindow.go"), - filepath.Join("..", "..", "..", "capi", "egl", "egl.go"), - filepath.Join("..", "..", "..", "window", "window.go"), - filepath.Join("..", "..", "..", "egl", "anative_window.go"), - } - - for _, path := range generatedFiles { - content, err := os.ReadFile(path) - require.NoError(t, err) - - assert.NotContains(t, string(content), "ClearFrameRate", path) - assert.NotContains(t, string(content), "clearFrameRate", path) - assert.NotContains(t, string(content), "ANativeWindow_clearFrameRate", path) - } -} - -func TestCallbackHashSuffix(t *testing.T) { - hash := callbackHashSuffix("looper", "ALooper_callbackFunc") - // Hash is md5-based, not CRC32 like c-for-go. Both sides (caller and - // proxy) are generated by capigen so consistency is all that matters. - assert.Len(t, hash, 8) - - // Same callback name in different packages must produce different hashes. - hash2 := callbackHashSuffix("otherpackage", "ALooper_callbackFunc") - assert.NotEqual(t, hash, hash2, "different packages must produce different hashes") -} - -func TestBuildCGoPreamble(t *testing.T) { - manifest := looperManifest() - preamble := buildCGoPreamble(manifest) - - assert.Contains(t, preamble, "#cgo LDFLAGS: -landroid") - assert.Contains(t, preamble, "#include \"android/looper.h\"") - assert.Contains(t, preamble, "#include ") - assert.Contains(t, preamble, "#include \"cgo_helpers.h\"") -} - -func TestCallbackProxy(t *testing.T) { - spec := looperSpec() - cb := spec.Callbacks["ALooper_callbackFunc"] - - proxy := generateCallbackProxy("looper", "ALooper_callbackFunc", cb, spec, nil) - - hash := callbackHashSuffix("looper", "ALooper_callbackFunc") - upperHash := strings.ToUpper(hash) - - assert.Contains(t, proxy, "PassRef()") - assert.Contains(t, proxy, "PassValue()") - assert.Contains(t, proxy, "//export ALooper_callbackFunc"+upperHash) - assert.Contains(t, proxy, "func ALooper_callbackFunc"+upperHash+"(") - assert.Contains(t, proxy, "aLooper_callbackFunc"+upperHash+"Func") - - // Verify it has parameter conversion. - lines := strings.Split(proxy, "\n") - hasExport := false - for _, l := range lines { - if strings.Contains(l, "//export") { - hasExport = true - } - } - assert.True(t, hasExport) -} - -func TestCallbackProxyPreservesExactCType(t *testing.T) { - spec := &specmodel.Spec{ - Types: map[string]specmodel.TypeDef{ - "AThing": {Kind: "opaque_ptr", CType: "AThing"}, - }, - Callbacks: map[string]specmodel.CallbackDef{ - "TestCallback": { - Params: []specmodel.Param{ - {Name: "names", Type: "**int8", CType: "const char**", Const: true}, - {Name: "thing", Type: "*AThing", CType: "const AThing*", Const: true}, - {Name: "count", Type: "int32", CType: "int32_t"}, - }, - }, - }, - } - manifest := &Manifest{} - manifest.Generator.Includes = []string{"test.h"} - - proxy := generateCallbackProxy("test", "TestCallback", spec.Callbacks["TestCallback"], spec, nil) - assert.Contains(t, proxy, "cnames **C.char") - assert.Contains(t, proxy, "cthing *C.AThing") - assert.Contains(t, proxy, "ccount C.int32_t") - - header := generateCgoHelpersH("test", manifest, spec, nil) - assert.Contains(t, header, "const char** names") - assert.Contains(t, header, "const AThing* thing") - assert.Contains(t, header, "int32_t count") - - implementation := generateCgoHelpersC("test", spec, nil) - assert.Contains(t, implementation, "(char**)names") - assert.Contains(t, implementation, "(AThing*)thing") -} - -func TestCallbackProxyPreservesReturnCType(t *testing.T) { - spec := &specmodel.Spec{ - Callbacks: map[string]specmodel.CallbackDef{ - "StringCallback": { - Params: []specmodel.Param{ - {Name: "value", Type: "int32", CType: "int32_t"}, - }, - Returns: "*int8", - ReturnsCType: "const char*", - }, - }, - } - manifest := &Manifest{} - manifest.Generator.Includes = []string{"test.h"} - - proxy := generateCallbackProxy("test", "StringCallback", spec.Callbacks["StringCallback"], spec, nil) - assert.Contains(t, proxy, "*C.char") - assert.Contains(t, proxy, "unsafe.Pointer(ret") - - header := generateCgoHelpersH("test", manifest, spec, nil) - assert.Contains(t, header, "const char* StringCallback") - - implementation := generateCgoHelpersC("test", spec, nil) - assert.Contains(t, implementation, "const char* StringCallback") - assert.Contains(t, implementation, "return StringCallback") -} - -func TestParamConversionOpaque(t *testing.T) { - spec := looperSpec() - callbackSet := map[string]bool{"ALooper_callbackFunc": true} - - p := specmodel.Param{Name: "looper", Type: "*ALooper"} - conv := paramConversion(p, spec, callbackSet, nil) - - assert.Contains(t, conv.code, "(*C.ALooper)(unsafe.Pointer(looper))") - assert.Equal(t, "clooper", conv.cVarName) -} - -func TestParamConversionScalar(t *testing.T) { - spec := looperSpec() - callbackSet := map[string]bool{} - - p := specmodel.Param{Name: "fd", Type: "int32"} - conv := paramConversion(p, spec, callbackSet, nil) - - assert.Contains(t, conv.code, "(C.int)(fd)") - assert.Equal(t, "cfd", conv.cVarName) -} - -func TestParamConversionCallback(t *testing.T) { - spec := looperSpec() - callbackSet := map[string]bool{"ALooper_callbackFunc": true} - - p := specmodel.Param{Name: "callback", Type: "ALooper_callbackFunc"} - conv := paramConversion(p, spec, callbackSet, nil) - - assert.Contains(t, conv.code, ".PassValue()") - assert.Equal(t, "ccallback", conv.cVarName) -} - -func TestParamConversionUnsafePointer(t *testing.T) { - spec := looperSpec() - callbackSet := map[string]bool{} - - p := specmodel.Param{Name: "data", Type: "unsafe.Pointer"} - conv := paramConversion(p, spec, callbackSet, nil) - - assert.Contains(t, conv.code, "data, cgoAllocsUnknown") - assert.Equal(t, "cdata", conv.cVarName) -} - -func TestParamConversionMultiLevelPointer(t *testing.T) { - spec := looperSpec() - callbackSet := map[string]bool{} - - p := specmodel.Param{Name: "outPtr", Type: "**ALooper"} - conv := paramConversion(p, spec, callbackSet, nil) - - // Must use a named variable, not an inline expression. - assert.Equal(t, "coutPtr", conv.cVarName) - // Must contain runtime.Pinner to pin the Go pointer. - assert.Contains(t, conv.code, "runtime.Pinner") - assert.Contains(t, conv.code, "Pin(outPtr)") - // Must also pin the inner pointer to satisfy CGo's check. - assert.Contains(t, conv.code, "Pin(unsafe.Pointer(*outPtr))") - assert.Contains(t, conv.code, "defer") - assert.Contains(t, conv.code, "Unpin()") - // Must cast to the correct C type. - assert.Contains(t, conv.code, "(**C.ALooper)(unsafe.Pointer(outPtr))") - // Must have a KeepAlive name. - assert.NotEmpty(t, conv.keepAliveName) -} - -func TestParamConversionMultiLevelPointerScalar(t *testing.T) { - spec := looperSpec() - callbackSet := map[string]bool{} - - p := specmodel.Param{Name: "data", Type: "**uint8"} - conv := paramConversion(p, spec, callbackSet, nil) - - assert.Equal(t, "cdata", conv.cVarName) - assert.Contains(t, conv.code, "runtime.Pinner") - assert.Contains(t, conv.code, "Pin(data)") - assert.Contains(t, conv.code, "(**C.uint8_t)(unsafe.Pointer(data))") -} - -func TestParamConversionMultiLevelPointerChar(t *testing.T) { - spec := looperSpec() - callbackSet := map[string]bool{} - - p := specmodel.Param{Name: "data", Type: "**int8"} - conv := paramConversion(p, spec, callbackSet, nil) - - assert.Contains(t, conv.code, "(**C.int8_t)(unsafe.Pointer(data))") -} - -func TestParamConversionMultiLevelPointerPreservesCBase(t *testing.T) { - tests := []struct { - name string - cType string - goType string - want string - }{ - {name: "char", cType: "char**", goType: "**int8", want: "(**C.char)(unsafe.Pointer(data))"}, - {name: "signed char", cType: "signed char**", goType: "**int8", want: "(**C.schar)(unsafe.Pointer(data))"}, - {name: "int8_t", cType: "int8_t**", goType: "**int8", want: "(**C.int8_t)(unsafe.Pointer(data))"}, - {name: "char triple pointer", cType: "char***", goType: "***int8", want: "(***C.char)(unsafe.Pointer(data))"}, - {name: "qualified char triple pointer", cType: "const char*const**", goType: "***int8", want: "(***C.char)(unsafe.Pointer(data))"}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - conv := paramConversion(specmodel.Param{ - Name: "data", Type: tt.goType, CType: tt.cType, - }, looperSpec(), map[string]bool{}, nil) - assert.Contains(t, conv.code, tt.want) - }) - } -} - -func TestParamConversionTriplePointerPinsNestedPointers(t *testing.T) { - conv := paramConversion(specmodel.Param{ - Name: "data", Type: "***int8", CType: "char***", - }, looperSpec(), map[string]bool{}, nil) - - assert.Contains(t, conv.code, "if data != nil") - assert.Contains(t, conv.code, "if *data != nil") - assert.Contains(t, conv.code, "Pin(unsafe.Pointer(*data))") - assert.Contains(t, conv.code, "Pin(unsafe.Pointer(**data))") -} - -func TestReturnConversionPointer(t *testing.T) { - spec := looperSpec() - result := returnConversion("*ALooper", spec) - assert.Contains(t, result, "(*ALooper)(unsafe.Pointer(__ret))") - assert.NotContains(t, result, "unsafe.Pointer(&__ret)", "must not take address of __ret (double dereference bug)") - assert.Contains(t, result, "return __v") -} - -func TestReturnConversionOpaquePointer(t *testing.T) { - spec := &specmodel.Spec{ - Types: map[string]specmodel.TypeDef{ - "AFont": { - Kind: "opaque_ptr", - CType: "AFont", - GoType: "*C.AFont", - }, - "AFontMatcher": { - Kind: "opaque_ptr", - CType: "AFontMatcher", - GoType: "*C.AFontMatcher", - }, - }, - Functions: map[string]specmodel.FuncDef{ - "AFontMatcher_match": { - CName: "AFontMatcher_match", - Params: []specmodel.Param{ - {Name: "matcher", Type: "*AFontMatcher"}, - }, - Returns: "*AFont", - }, - }, - } - - result := returnConversion("*AFont", spec) - assert.Equal(t, "\t__v := (*AFont)(unsafe.Pointer(__ret))\n\treturn __v\n", result) - assert.NotContains(t, result, "&__ret", "must use direct pointer cast, not address-of reinterpret") -} - -func TestReturnConversionScalar(t *testing.T) { - spec := looperSpec() - result := returnConversion("int32", spec) - assert.Contains(t, result, "(int32)(__ret)") -} diff --git a/tools/pkg/capigen/typeconv.go b/tools/pkg/capigen/typeconv.go deleted file mode 100644 index e15180e..0000000 --- a/tools/pkg/capigen/typeconv.go +++ /dev/null @@ -1,308 +0,0 @@ -package capigen - -import ( - "fmt" - "sort" - "strings" -) - -// goTypeToCGoType converts a Go type string (from spec) to the CGo -// type expression used in function wrapper conversions. -func goTypeToCGoType(goType string) string { - switch goType { - case "byte": - return "C.char" - case "int8": - return "C.int8_t" - case "uint8": - return "C.uint8_t" - case "int16": - return "C.int16_t" - case "uint16": - return "C.uint16_t" - case "int32": - return "C.int" - case "uint32": - return "C.uint" - case "int64": - return "C.int64_t" - case "uint64": - return "C.uint64_t" - case "float32": - return "C.float" - case "float64": - return "C.double" - case "bool": - return "C._Bool" - case "unsafe.Pointer": - return "unsafe.Pointer" - case "": - return "" - } - return "C." + goType -} - -// goTypeToCGoExactType converts a Go type to the exact CGo typedef type. -// Unlike goTypeToCGoType which maps int32→C.int and uint32→C.uint for -// value conversions, this uses the exact C typedef names (C.int32_t, C.uint32_t) -// needed when casting pointer types where CGo enforces type identity. -func goTypeToCGoExactType(goType string) string { - switch goType { - case "int32": - return "C.int32_t" - case "uint32": - return "C.uint32_t" - } - return goTypeToCGoType(goType) -} - -// goTypeToCHeaderType converts a Go type string to its C header representation -// (for cgo_helpers.h declarations). -func goTypeToCHeaderType(goType string) string { - switch goType { - case "byte": - return "char" - case "int8": - return "int8_t" - case "uint8": - return "uint8_t" - case "int16": - return "int16_t" - case "uint16": - return "uint16_t" - case "int32": - return "int" - case "uint32": - return "unsigned int" - case "int64": - return "int64_t" - case "uint64": - return "uint64_t" - case "float32": - return "float" - case "float64": - return "double" - case "bool": - return "_Bool" - case "unsafe.Pointer": - return "void*" - case "string": - return "char*" - case "": - return "void" - } - - // Pointer to type: *ALooper → ALooper*, *int8 → int8_t* - if strings.HasPrefix(goType, "*") { - base := goType[1:] - cBase := goTypeToCHeaderType(base) // recurse for nested pointers - return cBase + "*" - } - - return goType -} - -// goTypeToCGoCallbackParam converts a Go type string to the CGo type -// used in //export callback proxy function parameters. -func goTypeToCGoCallbackParam(goType string) string { - if goType == "unsafe.Pointer" { - return "unsafe.Pointer" - } - if goType == "string" { - return "*C.char" - } - - // Count pointer depth. - stars := 0 - base := goType - for strings.HasPrefix(base, "*") { - stars++ - base = base[1:] - } - - if stars > 0 { - // For scalar base types, use the CGo type. - if isScalarGoType(base) { - cgoBase := goTypeToCGoType(base) - return strings.Repeat("*", stars) + cgoBase - } - // For named types (structs, etc.). - return strings.Repeat("*", stars) + "C." + base - } - - return goTypeToCGoType(goType) -} - -// goTypeToCGoCallbackParamWithCType converts a callback parameter using its -// original C declarator when the Go type has lost ABI identity. -func goTypeToCGoCallbackParamWithCType(goType, cType string, structPrefixSet map[string]bool) string { - if cType == "" { - return applyCGoStructPrefix(goTypeToCGoCallbackParam(goType), structPrefixSet) - } - - pointerDepth := strings.Count(cType, "*") - if pointerDepth == 0 { - if exactBase := cgoBaseTypeFromCType(cType, 0); exactBase != "" && exactBase != "C.void" { - return applyCGoStructPrefix(exactBase, structPrefixSet) - } - return applyCGoStructPrefix(goTypeToCGoCallbackParam(goType), structPrefixSet) - } - - base := cgoBaseTypeFromCType(cType, pointerDepth) - if base == "" || base == "C.void" { - return applyCGoStructPrefix(goTypeToCGoCallbackParam(goType), structPrefixSet) - } - - return applyCGoStructPrefix(strings.Repeat("*", pointerDepth)+base, structPrefixSet) -} - -func goTypeToCGoCallbackReturnWithCType(goType, cType string, structPrefixSet map[string]bool) string { - return goTypeToCGoCallbackParamWithCType(goType, cType, structPrefixSet) -} - -// goTypeToCHeaderCallbackParam returns the exact C declaration for a callback -// proxy parameter when header metadata is available. -func goTypeToCHeaderCallbackParam(goType, cType string, structPrefixSet map[string]bool) string { - if cType != "" { - return cType - } - return goTypeToCHeaderTypeWithStructPrefix(goType, structPrefixSet) -} - -func goTypeToCHeaderCallbackReturn(goType, cType string, structPrefixSet map[string]bool) string { - if cType != "" { - return cType - } - return goTypeToCHeaderTypeWithStructPrefix(goType, structPrefixSet) -} - -// cTypeWithoutQualifiers removes qualifiers that CGo cannot express in an -// exported Go callback declaration. -func cTypeWithoutQualifiers(cType string) string { - for _, qualifier := range []string{"const", "volatile", "restrict"} { - cType = strings.ReplaceAll(cType, qualifier, "") - } - for strings.Contains(cType, " ") { - cType = strings.ReplaceAll(cType, " ", " ") - } - return strings.TrimSpace(cType) -} - -// cgoCallbackParamToGo generates code to convert a CGo callback parameter -// to its Go equivalent. Uses exported Go type names. -func cgoCallbackParamToGo(cVarName string, goVarName string, goType string) string { - if goType == "unsafe.Pointer" { - return fmt.Sprintf("\t\t%s := (unsafe.Pointer)(unsafe.Pointer(%s))\n", goVarName, cVarName) - } - if goType == "string" { - return fmt.Sprintf("\t\t%s := C.GoString(%s)\n", goVarName, cVarName) - } - exported := exportGoType(goType) - if strings.HasPrefix(goType, "*") { - return fmt.Sprintf("\t\t%s := (%s)(unsafe.Pointer(%s))\n", goVarName, exported, cVarName) - } - return fmt.Sprintf("\t\t%s := (%s)(%s)\n", goVarName, exported, cVarName) -} - -// goToCGoReturn generates the CGo expression to convert a Go return value -// back to the CGo type for a callback proxy return. -func goToCGoReturn(goRetVar string, goRetType string) string { - cgoType := goTypeToCGoCallbackParam(goRetType) - return fmt.Sprintf("(%s)(%s)", cgoType, goRetVar) -} - -func goToCGoReturnWithCType(goRetVar, goRetType, cType string, structPrefixSet map[string]bool) string { - cgoType := goTypeToCGoCallbackReturnWithCType(goRetType, cType, structPrefixSet) - if strings.HasPrefix(cgoType, "*") { - return fmt.Sprintf("(%s)(unsafe.Pointer(%s))", cgoType, goRetVar) - } - return fmt.Sprintf("(%s)(%s)", cgoType, goRetVar) -} - -// isScalarGoType returns true for Go scalar types (not pointers, slices, etc.). -func isScalarGoType(t string) bool { - switch t { - case "byte", "int8", "uint8", "int16", "uint16", "int32", "uint32", - "int64", "uint64", "float32", "float64", "bool", "int", "uint": - return true - } - return false -} - -// isFixedArrayType returns true if t is a fixed-size array type like "[16]float32". -func isFixedArrayType(t string) bool { - return len(t) > 2 && t[0] == '[' && t[1] != ']' -} - -// applyCGoStructPrefix converts a CGo type expression to use C.struct_ prefix -// where needed. E.g., "*C.__android_log_message" → "*C.struct___android_log_message" -// when "__android_log_message" is in the structPrefixSet. -// -// Uses longest-match-first ordering so that "C.foobar" is not corrupted by a -// shorter prefix "C.foo" when only "foo" is in the set but "foobar" is not. -func applyCGoStructPrefix(cgoExpr string, structPrefixSet map[string]bool) string { - // Sort names by length descending so longer names are replaced first, - // preventing shorter prefixes from matching substrings of longer names. - names := make([]string, 0, len(structPrefixSet)) - for name := range structPrefixSet { - names = append(names, name) - } - sort.Slice(names, func(i, j int) bool { - return len(names[i]) > len(names[j]) - }) - - for _, name := range names { - old := "C." + name - replacement := "C.struct_" + name - // Replace only exact token matches: "C.name" must not be followed - // by an alphanumeric or underscore character (which would indicate - // a longer identifier). - result := strings.Builder{} - remaining := cgoExpr - for { - idx := strings.Index(remaining, old) - if idx < 0 { - result.WriteString(remaining) - break - } - // Check that match is not a substring of a longer identifier. - afterIdx := idx + len(old) - if afterIdx < len(remaining) { - ch := remaining[afterIdx] - if ch == '_' || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') { - // Part of a longer identifier — skip this match. - result.WriteString(remaining[:afterIdx]) - remaining = remaining[afterIdx:] - continue - } - } - result.WriteString(remaining[:idx]) - result.WriteString(replacement) - remaining = remaining[afterIdx:] - } - cgoExpr = result.String() - } - return cgoExpr -} - -// goTypeToCHeaderTypeWithStructPrefix converts a Go type to its C header -// representation, applying struct_ prefix where needed. -func goTypeToCHeaderTypeWithStructPrefix(goType string, structPrefixSet map[string]bool) string { - base := goTypeToCHeaderType(goType) - // Check if the base (without pointer stars) is a struct-prefixed type. - trimmed := strings.TrimRight(base, "*") - trimmed = strings.TrimSpace(trimmed) - if structPrefixSet[trimmed] { - return "struct " + base - } - return base -} - -// goTypeBaseKind returns the underlying Go scalar type for a typedef kind. -// e.g., "typedef_int32" → "int32". -func goTypeBaseKind(kind string) string { - if !strings.HasPrefix(kind, "typedef_") { - return "" - } - return strings.TrimPrefix(kind, "typedef_") -} diff --git a/tools/pkg/capigen/typeconv_property_test.go b/tools/pkg/capigen/typeconv_property_test.go deleted file mode 100644 index 16c25f2..0000000 --- a/tools/pkg/capigen/typeconv_property_test.go +++ /dev/null @@ -1,163 +0,0 @@ -package capigen - -import ( - "testing" -) - -// TestGoTypeToCGoType_AllScalars verifies all Go scalar types have CGo mappings. -func TestGoTypeToCGoType_AllScalars(t *testing.T) { - cases := map[string]string{ - "byte": "C.char", - "int8": "C.int8_t", - "uint8": "C.uint8_t", - "int16": "C.int16_t", - "uint16": "C.uint16_t", - "int32": "C.int", - "uint32": "C.uint", - "int64": "C.int64_t", - "uint64": "C.uint64_t", - "float32": "C.float", - "float64": "C.double", - "bool": "C._Bool", - } - for goType, want := range cases { - if got := goTypeToCGoType(goType); got != want { - t.Errorf("goTypeToCGoType(%q) = %q, want %q", goType, got, want) - } - } -} - -// TestGoTypeToCHeaderType_AllScalars verifies all Go scalar types have C header mappings. -func TestGoTypeToCHeaderType_AllScalars(t *testing.T) { - cases := map[string]string{ - "byte": "char", - "int8": "int8_t", - "uint8": "uint8_t", - "int16": "int16_t", - "uint16": "uint16_t", - "int32": "int", - "uint32": "unsigned int", - "int64": "int64_t", - "uint64": "uint64_t", - "float32": "float", - "float64": "double", - "bool": "_Bool", - } - for goType, want := range cases { - if got := goTypeToCHeaderType(goType); got != want { - t.Errorf("goTypeToCHeaderType(%q) = %q, want %q", goType, got, want) - } - } -} - -// TestGoTypeToCGoExactType_Int32Difference verifies int32/uint32 use exact typedef. -func TestGoTypeToCGoExactType_Int32Difference(t *testing.T) { - if got := goTypeToCGoExactType("int32"); got != "C.int32_t" { - t.Errorf("goTypeToCGoExactType(int32) = %q, want C.int32_t", got) - } - if got := goTypeToCGoExactType("uint32"); got != "C.uint32_t" { - t.Errorf("goTypeToCGoExactType(uint32) = %q, want C.uint32_t", got) - } - // Other types should fall through to goTypeToCGoType. - if got := goTypeToCGoExactType("int64"); got != "C.int64_t" { - t.Errorf("goTypeToCGoExactType(int64) = %q, want C.int64_t", got) - } -} - -// TestGoTypeToCHeaderType_Pointers verifies pointer type conversion. -func TestGoTypeToCHeaderType_Pointers(t *testing.T) { - cases := []struct{ in_, want string }{ - {"*ALooper", "ALooper*"}, - {"**ALooper", "ALooper**"}, - {"*int32", "int*"}, - {"unsafe.Pointer", "void*"}, - {"string", "char*"}, - {"", "void"}, - } - for _, tc := range cases { - if got := goTypeToCHeaderType(tc.in_); got != tc.want { - t.Errorf("goTypeToCHeaderType(%q) = %q, want %q", tc.in_, got, tc.want) - } - } -} - -// TestApplyCGoStructPrefix_Idempotent verifies the function is idempotent. -func TestApplyCGoStructPrefix_Idempotent(t *testing.T) { - prefixSet := map[string]bool{ - "__android_log_message": true, - "AInputEvent": true, - } - inputs := []string{ - "*C.__android_log_message", - "C.AInputEvent", - "*C.ALooper", - "C.int", - } - for _, input := range inputs { - once := applyCGoStructPrefix(input, prefixSet) - twice := applyCGoStructPrefix(once, prefixSet) - if once != twice { - t.Errorf("applyCGoStructPrefix not idempotent for %q: %q -> %q", input, once, twice) - } - } -} - -// TestApplyCGoStructPrefix_NoPrefixCollision verifies that a short name in the -// set does not corrupt a longer name not in the set. This tests the fix for -// the substring collision bug. -func TestApplyCGoStructPrefix_NoPrefixCollision(t *testing.T) { - // "foo" is in the set, "foobar" is NOT. - prefixSet := map[string]bool{"foo": true} - - // "C.foobar" should NOT become "C.struct_foobar". - input := "C.foobar" - got := applyCGoStructPrefix(input, prefixSet) - if got != "C.foobar" { - t.Errorf("prefix collision: applyCGoStructPrefix(%q, {foo}) = %q, want %q", - input, got, "C.foobar") - } - - // But "C.foo" should become "C.struct_foo". - input2 := "*C.foo" - got2 := applyCGoStructPrefix(input2, prefixSet) - if got2 != "*C.struct_foo" { - t.Errorf("applyCGoStructPrefix(%q, {foo}) = %q, want %q", - input2, got2, "*C.struct_foo") - } - - // Both in same expression. - input3 := "*C.foo, C.foobar" - got3 := applyCGoStructPrefix(input3, prefixSet) - if got3 != "*C.struct_foo, C.foobar" { - t.Errorf("applyCGoStructPrefix(%q, {foo}) = %q, want %q", - input3, got3, "*C.struct_foo, C.foobar") - } -} - -// TestApplyCGoStructPrefix_BothInSet verifies correct behavior when both -// a short and long name are in the set. -func TestApplyCGoStructPrefix_BothInSet(t *testing.T) { - prefixSet := map[string]bool{"foo": true, "foobar": true} - - got := applyCGoStructPrefix("*C.foo, C.foobar", prefixSet) - if got != "*C.struct_foo, C.struct_foobar" { - t.Errorf("applyCGoStructPrefix with both in set = %q, want %q", - got, "*C.struct_foo, C.struct_foobar") - } -} - -// TestGoTypeBaseKind_Roundtrip verifies typedef_ prefix is correctly stripped. -func TestGoTypeBaseKind_Roundtrip(t *testing.T) { - cases := map[string]string{ - "typedef_int32": "int32", - "typedef_uint32": "uint32", - "typedef_int64": "int64", - "typedef_:union": ":union", - "opaque_ptr": "", - } - for kind, want := range cases { - if got := goTypeBaseKind(kind); got != want { - t.Errorf("goTypeBaseKind(%q) = %q, want %q", kind, got, want) - } - } -} diff --git a/tools/pkg/headerspec/capigen.go b/tools/pkg/headerspec/capigen.go deleted file mode 100644 index f6fe144..0000000 --- a/tools/pkg/headerspec/capigen.go +++ /dev/null @@ -1,1305 +0,0 @@ -package headerspec - -import ( - "crypto/md5" - "fmt" - "go/format" - "os" - "path/filepath" - "strings" -) - -// GenerateCapiPackage generates a complete capi/ Go package from the manifest -// and extracted declarations. It writes doc.go, types.go, const.go, -// cgo_helpers.go, cgo_helpers.h, and functions.go into outDir. -func GenerateCapiPackage( - manifest *Manifest, - decls *Declarations, - outDir string, -) error { - if err := os.MkdirAll(outDir, 0755); err != nil { - return fmt.Errorf("creating output directory %s: %w", outDir, err) - } - - pkgName := manifest.Generator.PackageName - preamble := buildCGoPreamble(manifest) - - // Index typedefs for lookup during function generation. - typedefByName := indexTypedefs(decls) - - // Index which typedef names are enum typedefs (for typed const blocks). - enumTypedefSet := buildEnumTypedefSet(decls) - - // Collect callback typedefs. - var callbacks []TypedefInfo - for _, td := range decls.Typedefs { - if td.IsFuncPtr { - callbacks = append(callbacks, td) - } - } - - files := map[string]string{} - - files["doc.go"] = generateDocGo(pkgName, manifest.Generator.PackageDescription) - files["types.go"] = generateTypesGo(pkgName, preamble, decls, callbacks) - files["const.go"] = generateConstGo(pkgName, preamble, decls, enumTypedefSet) - files["cgo_helpers.go"] = generateCgoHelpersGo(pkgName, preamble, decls, callbacks, typedefByName) - files["cgo_helpers.h"] = generateCgoHelpersH(manifest, callbacks) - files[pkgName+".go"] = generateFunctionsGo(pkgName, preamble, decls, typedefByName, callbacks) - - for name, content := range files { - path := filepath.Join(outDir, name) - - // Format Go files with go/format; leave .h files as-is. - if strings.HasSuffix(name, ".go") { - formatted, err := format.Source([]byte(content)) - if err != nil { - // Write the unformatted file for debugging, then return the error. - _ = os.WriteFile(path, []byte(content), 0644) - return fmt.Errorf("formatting %s: %w", name, err) - } - content = string(formatted) - } - - if err := os.WriteFile(path, []byte(content), 0644); err != nil { - return fmt.Errorf("writing %s: %w", path, err) - } - } - - return nil -} - -// buildCGoPreamble constructs the CGo comment block with LDFLAGS and includes. -func buildCGoPreamble(manifest *Manifest) string { - var sb strings.Builder - sb.WriteString("/*\n") - - for _, fg := range manifest.Generator.FlagGroups { - sb.WriteString("#cgo ") - sb.WriteString(fg.Name) - sb.WriteString(": ") - sb.WriteString(strings.Join(fg.Flags, " ")) - sb.WriteString("\n") - } - - for _, inc := range manifest.Generator.Includes { - fmt.Fprintf(&sb, "#include \"%s\"\n", inc) - } - sb.WriteString("#include \n") - sb.WriteString("#include \"cgo_helpers.h\"\n") - sb.WriteString("*/") - - return sb.String() -} - -// indexTypedefs creates a map from typedef name to TypedefInfo. -func indexTypedefs(decls *Declarations) map[string]*TypedefInfo { - m := make(map[string]*TypedefInfo, len(decls.Typedefs)) - for i := range decls.Typedefs { - m[decls.Typedefs[i].Name] = &decls.Typedefs[i] - } - return m -} - -// buildEnumTypedefSet returns the set of typedef names that are enum typedefs. -func buildEnumTypedefSet(decls *Declarations) map[string]bool { - set := make(map[string]bool) - for _, ei := range decls.Enums { - if ei.TypedefName != "" { - set[ei.TypedefName] = true - } - } - return set -} - -const generatedHeader = "// Code generated by headerspec. DO NOT EDIT.\n\n" - -// generateDocGo generates the doc.go file content. -func generateDocGo(pkgName string, description string) string { - var sb strings.Builder - sb.WriteString(generatedHeader) - if description != "" { - fmt.Fprintf(&sb, "/*\n%s\n*/\n", description) - } - fmt.Fprintf(&sb, "package %s\n", pkgName) - return sb.String() -} - -// generateTypesGo generates types.go with opaque struct aliases, complete struct -// aliases, and callback func type declarations. -func generateTypesGo( - pkgName string, - preamble string, - decls *Declarations, - callbacks []TypedefInfo, -) string { - // Check if any callback param uses unsafe.Pointer. - needsUnsafe := false - for _, cb := range callbacks { - for _, p := range cb.FuncParams { - goType := cTypeToGoType(p.Type) - if goType == "unsafe.Pointer" { - needsUnsafe = true - break - } - } - if needsUnsafe { - break - } - } - - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n\n", pkgName) - sb.WriteString(preamble) - sb.WriteString("\nimport \"C\"\n") - if needsUnsafe { - sb.WriteString("import \"unsafe\"\n") - } - sb.WriteString("\n") - - callbackSet := make(map[string]bool, len(callbacks)) - for _, cb := range callbacks { - callbackSet[cb.Name] = true - } - - // Write opaque struct type aliases and complete struct aliases. - for _, td := range decls.Typedefs { - if td.IsFuncPtr { - continue - } - if td.IsEnumTypedef { - continue // Handled in const.go as typed enums. - } - if td.IsOpaqueStruct { - fmt.Fprintf(&sb, "type %s C.%s\n\n", td.Name, td.Name) - continue - } - - // Non-opaque struct typedef: type alias to C type. - if strings.HasPrefix(td.UnderlyingType, "struct ") { - fmt.Fprintf(&sb, "type %s C.%s\n\n", td.Name, td.Name) - continue - } - - // Skip plain integer/bool typedefs that will be handled as enum - // base types in const.go, or are just type aliases. - // Only emit struct-like typedefs here. - } - - // Write complete structs that are NOT typedefs (e.g. directly declared structs). - for _, si := range decls.Structs { - if si.IsComplete { - // Check if a typedef already covers this struct. - alreadyCovered := false - for _, td := range decls.Typedefs { - if td.Name == si.Name { - alreadyCovered = true - break - } - } - if !alreadyCovered { - fmt.Fprintf(&sb, "type %s C.%s\n\n", si.Name, si.Name) - } - } - } - - // Write callback func types. - for _, cb := range callbacks { - fmt.Fprintf(&sb, "type %s %s\n\n", cb.Name, callbackGoFuncType(cb, decls)) - } - - return sb.String() -} - -// callbackGoFuncType builds the Go function type signature for a callback typedef. -func callbackGoFuncType(td TypedefInfo, decls *Declarations) string { - var sb strings.Builder - sb.WriteString("func(") - for i, p := range td.FuncParams { - if i > 0 { - sb.WriteString(", ") - } - name := p.Name - if name == "" { - name = fmt.Sprintf("p%d", i) - } - goType := cTypeToGoType(p.Type) - fmt.Fprintf(&sb, "%s %s", name, goType) - } - sb.WriteString(")") - - retType := cTypeToGoType(td.FuncReturn) - if retType != "" { - fmt.Fprintf(&sb, " %s", retType) - } - - return sb.String() -} - -// generateConstGo generates const.go with enum constant blocks. -func generateConstGo( - pkgName string, - preamble string, - decls *Declarations, - enumTypedefSet map[string]bool, -) string { - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n\n", pkgName) - sb.WriteString(preamble) - sb.WriteString("\nimport \"C\"\n\n") - - for _, ei := range decls.Enums { - groupName := ei.TypedefName - if groupName == "" { - groupName = ei.Name - } - if groupName == "" { - groupName = deriveEnumGroupName(ei.Constants) - } - if groupName == "" || len(ei.Constants) == 0 { - continue - } - - isTypedEnum := enumTypedefSet[groupName] - - if isTypedEnum { - // Emit Go type for the enum typedef. - goBaseType := enumBaseGoType(ei.FixedType) - fmt.Fprintf(&sb, "type %s %s\n\n", groupName, goBaseType) - - // Typed const block. - sb.WriteString("const (\n") - for _, c := range ei.Constants { - fmt.Fprintf(&sb, "\t%s %s = %d\n", c.Name, groupName, c.Value) - } - sb.WriteString(")\n\n") - } else { - // Untyped const block. - sb.WriteString("const (\n") - for _, c := range ei.Constants { - fmt.Fprintf(&sb, "\t%s = %d\n", c.Name, c.Value) - } - sb.WriteString(")\n\n") - } - } - - return sb.String() -} - -// enumBaseGoType converts a C enum fixed type to a Go type. -// If empty (no fixed type), defaults to int32 (C enum default). -func enumBaseGoType(fixedType string) string { - if fixedType == "" { - return "int32" - } - return cTypeToGoType(fixedType) -} - -// generateCgoHelpersGo generates cgo_helpers.go with CgoAllocMap, SliceHeader, -// callback proxy infrastructure, and string/slice helper functions. -func generateCgoHelpersGo( - pkgName string, - preamble string, - decls *Declarations, - callbacks []TypedefInfo, - typedefByName map[string]*TypedefInfo, -) string { - hasStrHelper := needsStringHelper(decls) - - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n\n", pkgName) - sb.WriteString(preamble) - sb.WriteString("\nimport \"C\"\n") - sb.WriteString("import (\n") - if hasStrHelper { - sb.WriteString("\t\"runtime\"\n") - } - sb.WriteString("\t\"sync\"\n") - sb.WriteString("\t\"unsafe\"\n") - sb.WriteString(")\n\n") - - // CgoAllocMap. - sb.WriteString(cgoAllocMapCode) - - // SliceHeader. - sb.WriteString(sliceHeaderCode) - - // Callback proxy code for each callback typedef. - for _, cb := range callbacks { - sb.WriteString(generateCallbackProxy(cb, decls, typedefByName)) - } - - // UnpackPCharString helper (for string parameters). - if hasStrHelper { - sb.WriteString(unpackPCharStringCode) - } - - return sb.String() -} - -const cgoAllocMapCode = `// CgoAllocMap stores pointers to C allocated memory for future reference. -type CgoAllocMap struct { - mux sync.RWMutex - m map[unsafe.Pointer]struct{} -} - -var cgoAllocsUnknown = new(CgoAllocMap) - -func (a *CgoAllocMap) Add(ptr unsafe.Pointer) { - a.mux.Lock() - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - a.mux.Unlock() -} - -func (a *CgoAllocMap) IsEmpty() bool { - a.mux.RLock() - isEmpty := len(a.m) == 0 - a.mux.RUnlock() - return isEmpty -} - -func (a *CgoAllocMap) Borrow(b *CgoAllocMap) { - if b == nil || b.IsEmpty() { - return - } - b.mux.Lock() - a.mux.Lock() - for ptr := range b.m { - if a.m == nil { - a.m = make(map[unsafe.Pointer]struct{}) - } - a.m[ptr] = struct{}{} - delete(b.m, ptr) - } - a.mux.Unlock() - b.mux.Unlock() -} - -func (a *CgoAllocMap) Free() { - a.mux.Lock() - for ptr := range a.m { - C.free(ptr) - delete(a.m, ptr) - } - a.mux.Unlock() -} - -` - -const sliceHeaderCode = `type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -` - -const unpackPCharStringCode = `// UnpackPCharString copies the data from Go string as *C.char. -func UnpackPCharString(str string) (*C.char, *CgoAllocMap) { - allocs := new(CgoAllocMap) - defer runtime.SetFinalizer(allocs, func(a *CgoAllocMap) { - go a.Free() - }) - - mem0 := unsafe.Pointer(C.CString(str)) - allocs.Add(mem0) - return (*C.char)(mem0), allocs -} - -` - -// needsStringHelper returns true if any function has a string parameter. -func needsStringHelper(decls *Declarations) bool { - for _, fn := range decls.Functions { - for _, p := range fn.Params { - cType := stripNullabilityAnnotations(p.Type) - if cType == "const char *" || cType == "char *" || cType == "const char *const" { - return true - } - } - } - return false -} - -// callbackHashSuffix computes the 8-hex-digit hash suffix used for callback -// proxy names (matching c-for-go's CRC32-based naming). -func callbackHashSuffix(name string) string { - h := md5.Sum([]byte(name)) - return fmt.Sprintf("%x", h[:4]) -} - -// generateCallbackProxy generates PassRef, PassValue, NewXRef, and the -// //export proxy function for a single callback typedef. -func generateCallbackProxy( - cb TypedefInfo, - decls *Declarations, - typedefByName map[string]*TypedefInfo, -) string { - hash := callbackHashSuffix(cb.Name) - upperHash := strings.ToUpper(hash) - lowerHash := strings.ToLower(hash) - varName := unexport(cb.Name) + upperHash + "Func" - proxyExportName := cb.Name + upperHash - proxyCName := cb.Name + "_" + lowerHash - - var sb strings.Builder - - // PassRef method. - fmt.Fprintf(&sb, "func (x %s) PassRef() (ref *C.%s, allocs *CgoAllocMap) {\n", cb.Name, cb.Name) - sb.WriteString("\tif x == nil {\n\t\treturn nil, nil\n\t}\n") - fmt.Fprintf(&sb, "\tif %s == nil {\n\t\t%s = x\n\t}\n", varName, varName) - fmt.Fprintf(&sb, "\treturn (*C.%s)(C.%s), nil\n", cb.Name, proxyCName) - sb.WriteString("}\n\n") - - // PassValue method. - fmt.Fprintf(&sb, "func (x %s) PassValue() (ref C.%s, allocs *CgoAllocMap) {\n", cb.Name, cb.Name) - sb.WriteString("\tif x == nil {\n\t\treturn nil, nil\n\t}\n") - fmt.Fprintf(&sb, "\tif %s == nil {\n\t\t%s = x\n\t}\n", varName, varName) - fmt.Fprintf(&sb, "\treturn (C.%s)(C.%s), nil\n", cb.Name, proxyCName) - sb.WriteString("}\n\n") - - // NewXRef function. - fmt.Fprintf(&sb, "func New%sRef(ref unsafe.Pointer) *%s {\n", cb.Name, cb.Name) - fmt.Fprintf(&sb, "\treturn (*%s)(ref)\n", cb.Name) - sb.WriteString("}\n\n") - - // //export proxy function. - fmt.Fprintf(&sb, "//export %s\n", proxyExportName) - fmt.Fprintf(&sb, "func %s(", proxyExportName) - - // Build proxy parameters with C types. - for i, p := range cb.FuncParams { - if i > 0 { - sb.WriteString(", ") - } - name := p.Name - if name == "" { - name = fmt.Sprintf("p%d", i) - } - cParamType := callbackProxyCParamType(p.Type) - fmt.Fprintf(&sb, "c%s %s", name, cParamType) - } - sb.WriteString(")") - - // Return type. - retCType := callbackProxyCReturnType(cb.FuncReturn) - if retCType != "" { - fmt.Fprintf(&sb, " %s", retCType) - } - sb.WriteString(" {\n") - - // Body: convert C params to Go and call the stored function. - fmt.Fprintf(&sb, "\tif %s != nil {\n", varName) - var argNames []string - for i, p := range cb.FuncParams { - name := p.Name - if name == "" { - name = fmt.Sprintf("p%d", i) - } - goVarName := name + lowerHash - convCode := callbackParamConversion(name, goVarName, p.Type, lowerHash, decls, typedefByName) - sb.WriteString(convCode) - argNames = append(argNames, goVarName) - } - - callExpr := fmt.Sprintf("%s(%s)", varName, strings.Join(argNames, ", ")) - goRetType := cTypeToGoType(cb.FuncReturn) - if goRetType != "" { - fmt.Fprintf(&sb, "\t\tret%s := %s\n", lowerHash, callExpr) - retConv := goToCReturn(lowerHash, cb.FuncReturn) - fmt.Fprintf(&sb, "\t\tret, _ := %s, cgoAllocsUnknown\n", retConv) - sb.WriteString("\t\treturn ret\n") - } else { - fmt.Fprintf(&sb, "\t\t%s\n", callExpr) - sb.WriteString("\t\treturn\n") - } - sb.WriteString("\t}\n") - sb.WriteString("\tpanic(\"callback func has not been set (race?)\")\n") - sb.WriteString("}\n\n") - - // Variable to store the callback. - fmt.Fprintf(&sb, "var %s %s\n\n", varName, cb.Name) - - return sb.String() -} - -// callbackProxyCParamType returns the CGo type to use for a callback proxy -// parameter given the original C type. -func callbackProxyCParamType(cType string) string { - cType = stripNullabilityAnnotations(cType) - - switch cType { - case "void *", "const void *": - return "unsafe.Pointer" - case "const char *", "char *": - return "*C.char" - } - - if strings.HasSuffix(cType, " **") { - base := strings.TrimSuffix(cType, " **") - base = strings.TrimPrefix(base, "const ") - base = strings.TrimSpace(base) - return "**C." + base - } - - if strings.HasSuffix(cType, " *") || strings.HasSuffix(cType, "*") { - base := strings.TrimSuffix(cType, " *") - base = strings.TrimSuffix(base, "*") - base = strings.TrimPrefix(base, "const ") - base = strings.TrimPrefix(base, "struct ") - base = strings.TrimSpace(base) - return "*C." + base - } - - // Scalar types. - return goTypeToCGoType(cTypeToGoType(cType), cType) -} - -// callbackProxyCReturnType returns the CGo return type for a callback proxy. -func callbackProxyCReturnType(cType string) string { - goType := cTypeToGoType(cType) - if goType == "" { - return "" - } - return goTypeToCGoType(goType, cType) -} - -// callbackParamConversion generates code to convert a C callback parameter -// to its Go equivalent. -func callbackParamConversion( - paramName string, - goVarName string, - cType string, - hashSuffix string, - decls *Declarations, - typedefByName map[string]*TypedefInfo, -) string { - cType = stripNullabilityAnnotations(cType) - - switch cType { - case "void *", "const void *": - return fmt.Sprintf("\t\t%s := (unsafe.Pointer)(unsafe.Pointer(c%s))\n", goVarName, paramName) - case "const char *", "char *": - return fmt.Sprintf("\t\t%s := C.GoString(c%s)\n", goVarName, paramName) - } - - if strings.HasSuffix(cType, " *") || strings.HasSuffix(cType, "*") { - base := strings.TrimSuffix(cType, " *") - base = strings.TrimSuffix(base, "*") - base = strings.TrimPrefix(base, "const ") - base = strings.TrimPrefix(base, "struct ") - base = strings.TrimSpace(base) - - goBase := cTypeToGoType(base) - - // Check if this is an opaque struct pointer. - if td, ok := typedefByName[base]; ok && td.IsOpaqueStruct { - return fmt.Sprintf("\t\t%s := (*%s)(unsafe.Pointer(c%s))\n", goVarName, goBase, paramName) - } - - // For other struct pointers, use the SliceHeader trick (matching c-for-go). - return fmt.Sprintf("\t\t%s := (*%s)(unsafe.Pointer(c%s))\n", goVarName, goBase, paramName) - } - - // Scalar conversion. - goType := cTypeToGoType(cType) - return fmt.Sprintf("\t\t%s := (%s)(c%s)\n", goVarName, goType, paramName) -} - -// goToCReturn generates the expression to convert a Go return value to the C type. -func goToCReturn(hashSuffix string, cType string) string { - goType := cTypeToGoType(cType) - cgoType := goTypeToCGoType(goType, cType) - return fmt.Sprintf("(%s)(ret%s)", cgoType, hashSuffix) -} - -// generateCgoHelpersH generates the cgo_helpers.h file with C callback proxy declarations. -func generateCgoHelpersH( - manifest *Manifest, - callbacks []TypedefInfo, -) string { - var sb strings.Builder - sb.WriteString(generatedHeader) - - for _, inc := range manifest.Generator.Includes { - fmt.Fprintf(&sb, "#include \"%s\"\n", inc) - } - sb.WriteString("#include \n") - sb.WriteString("#pragma once\n\n") - sb.WriteString("#define __CGOGEN 1\n\n") - - for _, cb := range callbacks { - hash := callbackHashSuffix(cb.Name) - lowerHash := strings.ToLower(hash) - proxyCName := cb.Name + "_" + lowerHash - - cRetType := cTypeToHReturnType(cb.FuncReturn) - - fmt.Fprintf(&sb, "// %s is a proxy for callback %s.\n", proxyCName, cb.Name) - fmt.Fprintf(&sb, "%s %s(", cRetType, proxyCName) - - for i, p := range cb.FuncParams { - if i > 0 { - sb.WriteString(", ") - } - sb.WriteString(callbackHParamDecl(p, i)) - } - sb.WriteString(");\n\n") - } - - return sb.String() -} - -// cTypeToHReturnType converts a C type to its representation in the .h file. -func cTypeToHReturnType(cType string) string { - cType = stripNullabilityAnnotations(cType) - if cType == "" || cType == "void" { - return "void" - } - return cType -} - -// callbackHParamDecl formats one parameter for the C header declaration. -func callbackHParamDecl(p ParamInfo, index int) string { - cType := stripNullabilityAnnotations(p.Type) - name := p.Name - if name == "" { - name = fmt.Sprintf("p%d", index) - } - - // Map C types to their header representation. - switch cType { - case "void *", "const void *": - return "void* " + name - case "const char *", "char *": - return "char* " + name - } - - // Pointer types. - if strings.HasSuffix(cType, " **") { - base := strings.TrimSuffix(cType, " **") - return base + "** " + name - } - if strings.HasSuffix(cType, " *") { - base := strings.TrimSuffix(cType, " *") - return base + "* " + name - } - - // Map standard C integer types to their long forms for the header. - headerType := cTypeToHeaderType(cType) - return headerType + " " + name -} - -// cTypeToHeaderType maps C types to their header-file representation. -func cTypeToHeaderType(cType string) string { - switch cType { - case "int32_t": - return "int" - case "uint32_t": - return "unsigned int" - case "int64_t": - return "long int" - case "uint64_t": - return "unsigned long int" - case "int16_t": - return "short int" - case "uint16_t": - return "unsigned short int" - case "int8_t": - return "signed char" - case "uint8_t": - return "unsigned char" - case "size_t": - return "unsigned long int" - case "ssize_t": - return "long int" - case "float": - return "float" - case "double": - return "double" - case "_Bool", "bool": - return "_Bool" - case "int": - return "int" - } - return cType -} - -// generateFunctionsGo generates the functions.go file with wrapper functions. -func generateFunctionsGo( - pkgName string, - preamble string, - decls *Declarations, - typedefByName map[string]*TypedefInfo, - callbacks []TypedefInfo, -) string { - callbackSet := make(map[string]bool, len(callbacks)) - for _, cb := range callbacks { - callbackSet[cb.Name] = true - } - - var sb strings.Builder - sb.WriteString(generatedHeader) - fmt.Fprintf(&sb, "package %s\n\n", pkgName) - sb.WriteString(preamble) - sb.WriteString("\nimport \"C\"\n") - sb.WriteString("import (\n") - sb.WriteString("\t\"runtime\"\n") - sb.WriteString("\t\"unsafe\"\n") - sb.WriteString(")\n\n") - - // Suppress unused import warnings. - sb.WriteString("var _ runtime.Error\n") - sb.WriteString("var _ unsafe.Pointer\n\n") - - for _, fn := range decls.Functions { - sb.WriteString(generateFunction(fn, typedefByName, callbackSet)) - } - - return sb.String() -} - -// generateFunction generates a single Go wrapper function. -func generateFunction( - fn FuncDecl, - typedefByName map[string]*TypedefInfo, - callbackSet map[string]bool, -) string { - var sb strings.Builder - - goParams := buildGoParams(fn.Params, typedefByName, callbackSet) - goRetType := funcReturnGoType(fn.ReturnType, typedefByName) - - // Function signature. - fmt.Fprintf(&sb, "func %s(", fn.Name) - for i, p := range goParams { - if i > 0 { - sb.WriteString(", ") - } - fmt.Fprintf(&sb, "%s %s", p.name, p.goType) - } - sb.WriteString(")") - if goRetType != "" { - fmt.Fprintf(&sb, " %s", goRetType) - } - sb.WriteString(" {\n") - - // Convert parameters. - var cArgNames []string - var keepAliveNames []string - - for _, p := range goParams { - conv := paramConversion(p, typedefByName, callbackSet) - sb.WriteString(conv.code) - cArgNames = append(cArgNames, conv.cVarName) - keepAliveNames = append(keepAliveNames, conv.keepAliveName) - } - - // Call C function. - callExpr := fmt.Sprintf("C.%s(%s)", fn.Name, strings.Join(cArgNames, ", ")) - - if goRetType != "" { - fmt.Fprintf(&sb, "\t__ret := %s\n", callExpr) - } else { - fmt.Fprintf(&sb, "\t%s\n", callExpr) - } - - // runtime.KeepAlive calls in reverse order (matching c-for-go). - for i := len(keepAliveNames) - 1; i >= 0; i-- { - if keepAliveNames[i] != "" { - fmt.Fprintf(&sb, "\truntime.KeepAlive(%s)\n", keepAliveNames[i]) - } - } - - // Convert and return. - if goRetType != "" { - retConv := returnConversion(fn.ReturnType, goRetType, typedefByName) - sb.WriteString(retConv) - } - - sb.WriteString("}\n\n") - return sb.String() -} - -type goParam struct { - name string - goType string - origCType string - isCallback bool - isSlice bool - isString bool - isPtr bool - isDoublePtr bool - isUnsafePtr bool - sliceElemGo string - ptrBaseGo string - doublePtrGo string -} - -// buildGoParams converts C parameters to Go parameter descriptors. -func buildGoParams( - params []ParamInfo, - typedefByName map[string]*TypedefInfo, - callbackSet map[string]bool, -) []goParam { - var result []goParam - for _, p := range params { - gp := classifyParam(p, typedefByName, callbackSet) - result = append(result, gp) - } - return result -} - -// classifyParam determines the Go type and conversion strategy for a parameter. -func classifyParam( - p ParamInfo, - typedefByName map[string]*TypedefInfo, - callbackSet map[string]bool, -) goParam { - cType := stripNullabilityAnnotations(p.Type) - gp := goParam{ - name: p.Name, - origCType: cType, - } - - // void * / const void * - if cType == "void *" || cType == "const void *" { - gp.goType = "unsafe.Pointer" - gp.isUnsafePtr = true - return gp - } - - // void ** - if cType == "void **" { - gp.goType = "[]unsafe.Pointer" - gp.isSlice = true - gp.sliceElemGo = "unsafe.Pointer" - return gp - } - - // const char * / char * - if cType == "const char *" || cType == "char *" || cType == "const char *const" { - gp.goType = "string" - gp.isString = true - return gp - } - - // Double pointer: X ** - if strings.HasSuffix(cType, " **") || (strings.HasSuffix(cType, "**") && !strings.Contains(cType, "(")) { - base := strings.TrimSuffix(cType, "**") - base = strings.TrimSuffix(base, " ") - base = strings.TrimPrefix(base, "const ") - base = strings.TrimSpace(base) - goBase := cTypeToGoType(base) - gp.goType = "**" + goBase - gp.isDoublePtr = true - gp.doublePtrGo = goBase - return gp - } - - // Single pointer to typedef. - if strings.HasSuffix(cType, " *") { - base := strings.TrimSuffix(cType, " *") - base = strings.TrimPrefix(base, "const ") - base = strings.TrimSpace(base) - - // Check if base is an opaque struct typedef. - if td, ok := typedefByName[base]; ok { - if td.IsOpaqueStruct { - gp.goType = "*" + base - gp.isPtr = true - gp.ptrBaseGo = base - return gp - } - if td.IsEnumTypedef { - // Pointer to enum typedef → slice. - gp.goType = "[]" + base - gp.isSlice = true - gp.sliceElemGo = base - return gp - } - // Pointer to struct typedef (complete struct). - if strings.HasPrefix(td.UnderlyingType, "struct ") { - gp.goType = "*" + base - gp.isPtr = true - gp.ptrBaseGo = base - return gp - } - } - - // Pointer to scalar types become slices. - goBase := cTypeToGoType(base) - if isScalarGoType(goBase) { - gp.goType = "[]" + goBase - gp.isSlice = true - gp.sliceElemGo = goBase - return gp - } - - // Pointer to non-scalar: use pointer. - gp.goType = "*" + goBase - gp.isPtr = true - gp.ptrBaseGo = goBase - return gp - } - - // Check if it's a callback type. - if callbackSet[cType] { - gp.goType = cType - gp.isCallback = true - return gp - } - - // Check if it's a typedef. - if td, ok := typedefByName[cType]; ok { - if td.IsEnumTypedef { - gp.goType = cType - return gp - } - if td.IsOpaqueStruct || strings.HasPrefix(td.UnderlyingType, "struct ") { - gp.goType = cType - return gp - } - } - - // Plain scalar. - gp.goType = cTypeToGoType(cType) - return gp -} - -type conversionResult struct { - code string - cVarName string - keepAliveName string -} - -// paramConversion generates the Go→C conversion code for one parameter. -func paramConversion( - p goParam, - typedefByName map[string]*TypedefInfo, - callbackSet map[string]bool, -) conversionResult { - cVar := "c" + p.name - allocVar := cVar + "AllocMap" - - if p.isUnsafePtr { - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := %s, cgoAllocsUnknown\n", cVar, allocVar, p.name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - if p.isString { - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := UnpackPCharString(%s)\n", cVar, allocVar, p.name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - if p.isCallback { - return conversionResult{ - code: fmt.Sprintf("\t%s, %s := %s.PassValue()\n", cVar, allocVar, p.name), - cVarName: cVar, - keepAliveName: allocVar, - } - } - - if p.isDoublePtr { - cgoType := goToCGoPtrType(p.doublePtrGo, p.origCType, typedefByName) - // Double pointers are cast inline through unsafe.Pointer. - return conversionResult{ - code: "", - cVarName: fmt.Sprintf("(%s)(unsafe.Pointer(%s))", cgoType, p.name), - keepAliveName: "", - } - } - - if p.isSlice { - cgoElem := sliceElemToCGoType(p.sliceElemGo, p.origCType) - code := fmt.Sprintf("\t%s, %s := (*%s)(unsafe.Pointer((*SliceHeader)(unsafe.Pointer(&%s)).Data)), cgoAllocsUnknown\n", - cVar, allocVar, cgoElem, p.name) - return conversionResult{ - code: code, - cVarName: cVar, - keepAliveName: allocVar, - } - } - - if p.isPtr { - cgoType := goToCGoType(p.ptrBaseGo, p.origCType, typedefByName) - code := fmt.Sprintf("\t%s, %s := (%s)(unsafe.Pointer(%s)), cgoAllocsUnknown\n", - cVar, allocVar, cgoType, p.name) - return conversionResult{ - code: code, - cVarName: cVar, - keepAliveName: allocVar, - } - } - - // Scalar conversion. - cgoType := scalarGoToCGoType(p.goType, p.origCType) - code := fmt.Sprintf("\t%s, %s := (%s)(%s), cgoAllocsUnknown\n", - cVar, allocVar, cgoType, p.name) - return conversionResult{ - code: code, - cVarName: cVar, - keepAliveName: allocVar, - } -} - -// sliceElemToCGoType maps a Go slice element type to the corresponding C type -// for pointer dereferencing. -func sliceElemToCGoType(goElemType string, origCType string) string { - // Determine the base C type from the original pointer type. - cBase := strings.TrimSuffix(origCType, " *") - cBase = strings.TrimSuffix(cBase, "*") - cBase = strings.TrimPrefix(cBase, "const ") - cBase = strings.TrimSpace(cBase) - - switch cBase { - case "int", "int32_t": - if cBase == "int" { - return "C.int" - } - return "C.int32_t" - case "uint32_t": - return "C.uint32_t" - case "int64_t": - return "C.int64_t" - case "uint64_t": - return "C.uint64_t" - case "int16_t": - return "C.int16_t" - case "uint16_t": - return "C.uint16_t" - case "int8_t": - return "C.int8_t" - case "uint8_t": - return "C.uint8_t" - case "float": - return "C.float" - case "double": - return "C.double" - case "size_t": - return "C.size_t" - case "ssize_t": - return "C.ssize_t" - case "void": - return "unsafe.Pointer" - } - - // Default: use the C type name directly. - return "C." + cBase -} - -// goToCGoType maps a Go pointer base type + original C type to a CGo pointer type. -func goToCGoType(goBase string, origCType string, typedefByName map[string]*TypedefInfo) string { - // Extract the base C type. - cBase := strings.TrimSuffix(origCType, " *") - cBase = strings.TrimSuffix(cBase, "*") - cBase = strings.TrimPrefix(cBase, "const ") - cBase = strings.TrimPrefix(cBase, "struct ") - cBase = strings.TrimSpace(cBase) - - return "*C." + cBase -} - -// goToCGoPtrType maps a double-pointer Go type to the CGo expression. -func goToCGoPtrType(goBase string, origCType string, typedefByName map[string]*TypedefInfo) string { - cBase := strings.TrimSuffix(origCType, " **") - cBase = strings.TrimSuffix(cBase, "**") - cBase = strings.TrimPrefix(cBase, "const ") - cBase = strings.TrimSpace(cBase) - - return "**C." + cBase -} - -// scalarGoToCGoType maps a Go scalar type + original C type to the CGo cast type. -func scalarGoToCGoType(goType string, origCType string) string { - origCType = stripNullabilityAnnotations(origCType) - - switch origCType { - case "int": - return "C.int" - case "unsigned int", "unsigned": - return "C.uint" - case "int32_t": - return "C.int32_t" - case "uint32_t": - return "C.uint32_t" - case "int64_t": - return "C.int64_t" - case "uint64_t": - return "C.uint64_t" - case "int16_t": - return "C.int16_t" - case "uint16_t": - return "C.uint16_t" - case "int8_t": - return "C.int8_t" - case "uint8_t": - return "C.uint8_t" - case "float": - return "C.float" - case "double": - return "C.double" - case "size_t": - return "C.size_t" - case "ssize_t": - return "C.ssize_t" - case "_Bool", "bool": - return "C._Bool" - case "long": - return "C.long" - case "unsigned long": - return "C.ulong" - case "long long": - return "C.longlong" - case "unsigned long long": - return "C.ulonglong" - } - - // For typedef types (like Camera_status_t), cast to the C type. - return "C." + origCType -} - -// goTypeToCGoType maps a Go type to the CGo type expression for use in -// callback proxy conversions. -func goTypeToCGoType(goType string, origCType string) string { - origCType = stripNullabilityAnnotations(origCType) - - // If the original C type is known, prefer that mapping. - switch origCType { - case "int": - return "C.int" - case "unsigned int", "unsigned": - return "C.uint" - case "int32_t": - return "C.int32_t" - case "uint32_t": - return "C.uint32_t" - case "int64_t": - return "C.int64_t" - case "uint64_t": - return "C.uint64_t" - case "int16_t": - return "C.int16_t" - case "uint16_t": - return "C.uint16_t" - case "int8_t": - return "C.int8_t" - case "uint8_t": - return "C.uint8_t" - case "float": - return "C.float" - case "double": - return "C.double" - case "size_t": - return "C.size_t" - case "ssize_t": - return "C.ssize_t" - case "_Bool", "bool": - return "C._Bool" - } - - // Fall back to Go type mapping. - switch goType { - case "int32": - return "C.int" - case "uint32": - return "C.uint" - case "int64": - return "C.long" - case "uint64": - return "C.ulong" - case "int16": - return "C.short" - case "uint16": - return "C.ushort" - case "int8": - return "C.schar" - case "uint8": - return "C.uchar" - case "float32": - return "C.float" - case "float64": - return "C.double" - case "bool": - return "C._Bool" - } - - return "C." + goType -} - -// funcReturnGoType determines the Go return type for a function. -func funcReturnGoType( - cRetType string, - typedefByName map[string]*TypedefInfo, -) string { - cRetType = stripNullabilityAnnotations(cRetType) - - if cRetType == "" || cRetType == "void" { - return "" - } - - // Pointer to opaque struct. - if strings.HasSuffix(cRetType, " *") { - base := strings.TrimSuffix(cRetType, " *") - base = strings.TrimPrefix(base, "const ") - base = strings.TrimPrefix(base, "struct ") - base = strings.TrimSpace(base) - - if td, ok := typedefByName[base]; ok && td.IsOpaqueStruct { - return "*" + base - } - return "*" + cTypeToGoType(base) - } - - // Check for typedef types (enum typedefs get their own Go type). - if td, ok := typedefByName[cRetType]; ok { - if td.IsEnumTypedef { - return cRetType - } - } - - return cTypeToGoType(cRetType) -} - -// returnConversion generates code to convert a C return value to Go. -func returnConversion( - cRetType string, - goRetType string, - typedefByName map[string]*TypedefInfo, -) string { - // Pointer return: reinterpret the C pointer via unsafe.Pointer. - // The pattern *(**ALooper)(unsafe.Pointer(&__ret)) takes the address of - // the *C.ALooper value, casts to **ALooper, and dereferences to get *ALooper. - if strings.HasPrefix(goRetType, "*") { - return fmt.Sprintf("\t__v := *(*%s)(unsafe.Pointer(&__ret))\n\treturn __v\n", goRetType) - } - - // Bool return. - if goRetType == "bool" { - return "\t__v := (bool)(__ret)\n\treturn __v\n" - } - - // Enum typedef or scalar return. - return fmt.Sprintf("\t__v := (%s)(__ret)\n\treturn __v\n", goRetType) -} - -// unexport returns the unexported version of a Go identifier. -func unexport(name string) string { - if len(name) == 0 { - return name - } - first := strings.ToLower(name[:1]) - return first + name[1:] -} diff --git a/tools/pkg/headerspec/clangast.go b/tools/pkg/headerspec/clangast.go deleted file mode 100644 index fc3c5f8..0000000 --- a/tools/pkg/headerspec/clangast.go +++ /dev/null @@ -1,67 +0,0 @@ -// Package headerspec parses clang JSON AST output and generates spec YAML. -package headerspec - -import "encoding/json" - -// ASTNode represents a node in clang's JSON AST dump. -type ASTNode struct { - ID string `json:"id"` - Kind string `json:"kind"` - Name string `json:"name,omitempty"` - MangledName string `json:"mangledName,omitempty"` - Type *TypeInfo `json:"type,omitempty"` - Inner []ASTNode `json:"inner,omitempty"` - Loc *Location `json:"loc,omitempty"` - Range *Range `json:"range,omitempty"` - IsImplicit bool `json:"isImplicit,omitempty"` - IsReferenced bool `json:"isReferenced,omitempty"` - CompleteDefinition bool `json:"completeDefinition,omitempty"` - TagUsed string `json:"tagUsed,omitempty"` - FixedUnderlyingType *TypeInfo `json:"fixedUnderlyingType,omitempty"` - StorageClass string `json:"storageClass,omitempty"` - Value string `json:"value,omitempty"` - CastKind string `json:"castKind,omitempty"` - CC string `json:"cc,omitempty"` - OwnedTagDecl *ASTNode `json:"ownedTagDecl,omitempty"` - Decl *ASTNode `json:"decl,omitempty"` - ValueCategory string `json:"valueCategory,omitempty"` -} - -// TypeInfo holds type qualification data from a clang AST node. -type TypeInfo struct { - QualType string `json:"qualType"` - DesugaredQualType string `json:"desugaredQualType,omitempty"` - TypeAliasDeclID string `json:"typeAliasDeclId,omitempty"` -} - -// Location holds source location information from a clang AST node. -type Location struct { - File string `json:"file,omitempty"` - Line int `json:"line,omitempty"` - Col int `json:"col,omitempty"` - Offset int `json:"offset,omitempty"` - TokLen int `json:"tokLen,omitempty"` - IncludedFrom *IncluRef `json:"includedFrom,omitempty"` - SpellingLoc *Location `json:"spellingLoc,omitempty"` - ExpansionLoc *Location `json:"expansionLoc,omitempty"` -} - -// IncluRef references the file that included this location. -type IncluRef struct { - File string `json:"file,omitempty"` -} - -// Range holds a source range (begin/end locations). -type Range struct { - Begin *Location `json:"begin,omitempty"` - End *Location `json:"end,omitempty"` -} - -// ParseClangAST unmarshals clang's -ast-dump=json output into an ASTNode tree. -func ParseClangAST(jsonData []byte) (*ASTNode, error) { - var root ASTNode - if err := json.Unmarshal(jsonData, &root); err != nil { - return nil, err - } - return &root, nil -} diff --git a/tools/pkg/headerspec/extract.go b/tools/pkg/headerspec/extract.go deleted file mode 100644 index 02c3d59..0000000 --- a/tools/pkg/headerspec/extract.go +++ /dev/null @@ -1,523 +0,0 @@ -package headerspec - -import ( - "strconv" - "strings" -) - -// Declarations holds all extracted C declarations from the AST. -type Declarations struct { - Functions []FuncDecl - Typedefs []TypedefInfo - Enums []EnumInfo - Structs []StructInfo -} - -// FuncDecl represents an extracted C function declaration. -type FuncDecl struct { - Name string - ReturnType string - Params []ParamInfo -} - -// ParamInfo describes one function/callback parameter. -type ParamInfo struct { - Name string - Type string -} - -// TypedefInfo describes a typedef declaration. -type TypedefInfo struct { - Name string - UnderlyingType string - DesugaredType string // desugared qualType from clang (resolves typedef chains) - IsOpaqueStruct bool - IsEnumTypedef bool // true if this typedefs an enum - IsFuncPtr bool - FuncParams []ParamInfo - FuncReturn string -} - -// EnumInfo describes an enum declaration with its constants. -type EnumInfo struct { - Name string - TypedefName string - FixedType string - Constants []EnumConstant -} - -// EnumConstant is one value in an enum. -type EnumConstant struct { - Name string - Value int64 -} - -// StructInfo describes a struct declaration. -type StructInfo struct { - Name string - IsComplete bool - Fields []FieldInfo -} - -// FieldInfo describes one field of a struct. -type FieldInfo struct { - Name string - Type string - IsFuncPtr bool - FuncParams []ParamInfo - FuncReturn string -} - -// ExtractDeclarations walks the root AST node and extracts all declarations -// from the specified target header files. -// -// Clang only emits loc.file for the FIRST node from each file; subsequent -// nodes only have line/col. We track the "current file" while iterating -// through root.Inner to correctly filter by target headers. -func ExtractDeclarations( - root *ASTNode, - targetHeaders []string, -) *Declarations { - decls := &Declarations{} - headerSet := buildHeaderSet(targetHeaders) - - // Track anonymous enums by their AST ID so we can link them to - // wrapping TypedefDecl nodes via ownedTagDecl. - enumByID := map[string]*EnumInfo{} - - currentFile := "" - for i := range root.Inner { - node := &root.Inner[i] - - if file := resolveFile(node.Loc); file != "" { - currentFile = file - } - - if !matchesTargetHeader(currentFile, headerSet) { - continue - } - - // Skip compiler-implicit declarations. - if node.IsImplicit { - continue - } - - switch node.Kind { - case "FunctionDecl": - if fn := extractFunction(node); fn != nil { - decls.Functions = append(decls.Functions, *fn) - } - - case "TypedefDecl": - td := extractTypedef(node) - if td == nil { - continue - } - - // Check if this typedef wraps an anonymous enum. - ownedID := findOwnedTagDeclID(node) - if ownedID != "" { - if ei, ok := enumByID[ownedID]; ok { - ei.TypedefName = td.Name - } - } - - decls.Typedefs = append(decls.Typedefs, *td) - - case "EnumDecl": - ei := extractEnum(node) - if ei == nil { - continue - } - decls.Enums = append(decls.Enums, *ei) - enumByID[node.ID] = &decls.Enums[len(decls.Enums)-1] - - case "RecordDecl": - si := extractStruct(node) - if si == nil { - continue - } - decls.Structs = append(decls.Structs, *si) - } - } - - return decls -} - -// buildHeaderSet normalizes target header paths into a set of suffixes -// for matching against absolute paths from clang. -func buildHeaderSet(headers []string) map[string]bool { - set := make(map[string]bool, len(headers)) - for _, h := range headers { - set[h] = true - } - return set -} - -// matchesTargetHeader checks if the current file path ends with any of -// the target header suffixes (e.g., "android/looper.h"). -func matchesTargetHeader(filePath string, headers map[string]bool) bool { - if filePath == "" { - return false - } - for h := range headers { - if strings.HasSuffix(filePath, "/"+h) || filePath == h { - return true - } - } - return false -} - -// resolveFile extracts the file path from a node's location. Clang may -// place the file in loc.file, loc.spellingLoc.file, or loc.expansionLoc.file. -func resolveFile(loc *Location) string { - if loc == nil { - return "" - } - if loc.File != "" { - return loc.File - } - if loc.SpellingLoc != nil && loc.SpellingLoc.File != "" { - return loc.SpellingLoc.File - } - if loc.ExpansionLoc != nil && loc.ExpansionLoc.File != "" { - return loc.ExpansionLoc.File - } - return "" -} - -// extractFunction builds a FuncDecl from a FunctionDecl AST node. -func extractFunction(node *ASTNode) *FuncDecl { - if node.Name == "" { - return nil - } - - retType, paramTypes := parseFunctionQualType(node.Type) - - fd := &FuncDecl{ - Name: node.Name, - ReturnType: retType, - } - - // Extract parameters from ParmVarDecl inner nodes. - paramIdx := 0 - for i := range node.Inner { - child := &node.Inner[i] - if child.Kind != "ParmVarDecl" { - continue - } - - p := ParamInfo{Name: child.Name} - switch { - case child.Type != nil: - p.Type = child.Type.QualType - case paramIdx < len(paramTypes): - p.Type = paramTypes[paramIdx] - } - fd.Params = append(fd.Params, p) - paramIdx++ - } - - return fd -} - -// parseFunctionQualType splits a C function qualType like "int (int, void *)" -// into its return type and parameter types. -func parseFunctionQualType(ti *TypeInfo) (string, []string) { - if ti == nil { - return "void", nil - } - qt := ti.QualType - - // Find the opening paren that starts the parameter list. - // For "int (*)(int, int)" style, we need to be more careful, but for - // FunctionDecl qualTypes the format is "ReturnType (Param1, Param2, ...)" - parenIdx := strings.Index(qt, "(") - if parenIdx < 0 { - return qt, nil - } - - retType := strings.TrimSpace(qt[:parenIdx]) - paramsPart := qt[parenIdx+1 : len(qt)-1] - if paramsPart == "" || paramsPart == "void" { - return retType, nil - } - - params := splitCParams(paramsPart) - return retType, params -} - -// splitCParams splits a comma-separated C parameter list, respecting nested -// parentheses (for function pointer parameters). -func splitCParams(s string) []string { - var params []string - depth := 0 - start := 0 - for i, c := range s { - switch c { - case '(': - depth++ - case ')': - depth-- - case ',': - if depth == 0 { - params = append(params, strings.TrimSpace(s[start:i])) - start = i + 1 - } - } - } - if rest := strings.TrimSpace(s[start:]); rest != "" { - params = append(params, rest) - } - return params -} - -// extractTypedef builds a TypedefInfo from a TypedefDecl AST node. -func extractTypedef(node *ASTNode) *TypedefInfo { - if node.Name == "" || node.Type == nil { - return nil - } - - td := &TypedefInfo{ - Name: node.Name, - UnderlyingType: node.Type.QualType, - DesugaredType: node.Type.DesugaredQualType, - } - - qt := node.Type.QualType - desugared := node.Type.DesugaredQualType - - // Detect opaque struct: "struct X" typedef with no complete definition. - // Also check the desugared type for typedef-to-typedef chains that - // ultimately resolve to a struct. - if strings.HasPrefix(qt, "struct ") || strings.HasPrefix(desugared, "struct ") { - td.IsOpaqueStruct = true - } - - // Detect enum typedef: "enum X" qualType or desugared type. - if strings.HasPrefix(qt, "enum ") { - td.IsEnumTypedef = true - } - - // Detect function pointer: qualType contains "(*)" pattern. - if isFuncPtrQualType(qt) { - td.IsFuncPtr = true - td.FuncReturn, td.FuncParams = parseFuncPtrFromAST(node) - } - - return td -} - -// isFuncPtrQualType checks whether a qualType string represents a function pointer. -func isFuncPtrQualType(qt string) bool { - return strings.Contains(qt, "(*)") -} - -// parseFuncPtrFromAST extracts function pointer return type and parameter -// types from the inner AST nodes of a TypedefDecl. -// -// The inner node chain is: -// -// PointerType → ParenType → FunctionProtoType -// -// FunctionProtoType.Inner contains: [returnType, param1Type, param2Type, ...] -// Note: parameter NAMES are not available in the AST for function pointer -// typedefs; only types. -func parseFuncPtrFromAST(node *ASTNode) (string, []ParamInfo) { - fpt := findFunctionProtoType(node.Inner) - if fpt == nil { - // Fall back to parsing the qualType string. - return parseFuncPtrQualType(node.Type.QualType) - } - - if len(fpt.Inner) == 0 { - return "void", nil - } - - // First inner node is the return type. - retType := "void" - if fpt.Inner[0].Type != nil { - retType = fpt.Inner[0].Type.QualType - } - - // Remaining inner nodes are parameter types. - var params []ParamInfo - for i := 1; i < len(fpt.Inner); i++ { - child := &fpt.Inner[i] - paramType := "" - if child.Type != nil { - paramType = child.Type.QualType - } - params = append(params, ParamInfo{ - Name: "", // Names aren't available in the AST for func ptr typedefs. - Type: paramType, - }) - } - - return retType, params -} - -// findFunctionProtoType recursively searches inner nodes for a FunctionProtoType. -func findFunctionProtoType(nodes []ASTNode) *ASTNode { - for i := range nodes { - n := &nodes[i] - if n.Kind == "FunctionProtoType" { - return n - } - if found := findFunctionProtoType(n.Inner); found != nil { - return found - } - } - return nil -} - -// parseFuncPtrQualType is a fallback that parses "RetType (*)(P1, P2, ...)" -// from the qualType string. -func parseFuncPtrQualType(qt string) (string, []ParamInfo) { - // Format: "RetType (*)(P1, P2, ...)" - starIdx := strings.Index(qt, "(*)") - if starIdx < 0 { - return "void", nil - } - - retType := strings.TrimSpace(qt[:starIdx]) - - // Extract params between the last "(" and ")" - rest := qt[starIdx+3:] - if len(rest) < 2 || rest[0] != '(' { - return retType, nil - } - rest = rest[1 : len(rest)-1] // strip outer parens - - if rest == "" || rest == "void" { - return retType, nil - } - - parts := splitCParams(rest) - var params []ParamInfo - for _, p := range parts { - params = append(params, ParamInfo{Type: strings.TrimSpace(p)}) - } - return retType, params -} - -// findOwnedTagDeclID looks for an ownedTagDecl in the inner nodes of a -// TypedefDecl, which links a typedef to its anonymous enum or struct. -func findOwnedTagDeclID(node *ASTNode) string { - for i := range node.Inner { - child := &node.Inner[i] - if child.OwnedTagDecl != nil { - return child.OwnedTagDecl.ID - } - if id := findOwnedTagDeclID(child); id != "" { - return id - } - } - return "" -} - -// extractEnum builds an EnumInfo from an EnumDecl AST node. -func extractEnum(node *ASTNode) *EnumInfo { - ei := &EnumInfo{ - Name: node.Name, - } - - if node.FixedUnderlyingType != nil { - ei.FixedType = node.FixedUnderlyingType.QualType - } - - for i := range node.Inner { - child := &node.Inner[i] - if child.Kind != "EnumConstantDecl" { - continue - } - - ec := EnumConstant{Name: child.Name} - ec.Value = extractEnumConstantValue(child) - ei.Constants = append(ei.Constants, ec) - } - - if len(ei.Constants) == 0 { - return nil - } - - return ei -} - -// extractEnumConstantValue extracts the integer value from an EnumConstantDecl. -// The value is typically in a ConstantExpr node, which may be a direct child -// or nested inside an ImplicitCastExpr (for typed enums like "enum X : int8_t"). -func extractEnumConstantValue(node *ASTNode) int64 { - if v, ok := findConstantExprValue(node.Inner); ok { - return v - } - return 0 -} - -// findConstantExprValue recursively searches for a ConstantExpr with a value. -func findConstantExprValue(nodes []ASTNode) (int64, bool) { - for i := range nodes { - child := &nodes[i] - if child.Kind == "ConstantExpr" && child.Value != "" { - v, err := strconv.ParseInt(child.Value, 10, 64) - if err == nil { - return v, true - } - } - if v, ok := findConstantExprValue(child.Inner); ok { - return v, ok - } - } - return 0, false -} - -// extractStruct builds a StructInfo from a RecordDecl AST node. -func extractStruct(node *ASTNode) *StructInfo { - if node.Name == "" || node.TagUsed != "struct" { - return nil - } - - si := &StructInfo{ - Name: node.Name, - IsComplete: node.CompleteDefinition, - } - - if !si.IsComplete { - return si - } - - for i := range node.Inner { - child := &node.Inner[i] - if child.Kind != "FieldDecl" { - continue - } - fi := extractField(child) - si.Fields = append(si.Fields, fi) - } - - return si -} - -// extractField builds a FieldInfo from a FieldDecl AST node. -func extractField(node *ASTNode) FieldInfo { - fi := FieldInfo{ - Name: node.Name, - } - - if node.Type != nil { - fi.Type = node.Type.QualType - - // Use desugared type for function pointer detection when available. - desugared := node.Type.DesugaredQualType - if desugared == "" { - desugared = fi.Type - } - - if isFuncPtrQualType(desugared) { - fi.IsFuncPtr = true - fi.FuncReturn, fi.FuncParams = parseFuncPtrQualType(desugared) - } - } - - return fi -} diff --git a/tools/pkg/headerspec/extract_test.go b/tools/pkg/headerspec/extract_test.go deleted file mode 100644 index a200628..0000000 --- a/tools/pkg/headerspec/extract_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package headerspec - -import ( - "encoding/json" - "os" - "os/exec" - "path/filepath" - "testing" -) - -func TestExtractDeclarationsLooper(t *testing.T) { - ndkBase := os.ExpandEnv("${HOME}/Android/Sdk/ndk/28.0.13004108/toolchains/llvm/prebuilt/linux-x86_64") - sysroot := filepath.Join(ndkBase, "sysroot") - clang := filepath.Join(ndkBase, "bin/clang") - - if _, err := os.Stat(clang); err != nil { - t.Skipf("clang not found at %s: %v", clang, err) - } - - tmpFile, err := os.CreateTemp("", "test-*.c") - if err != nil { - t.Fatalf("creating temp file: %v", err) - } - defer func() { _ = os.Remove(tmpFile.Name()) }() - - if _, err := tmpFile.WriteString("#include \n"); err != nil { - t.Fatalf("writing temp file: %v", err) - } - _ = tmpFile.Close() - - args := []string{ - "-target", "aarch64-linux-android26", - "--sysroot=" + sysroot, - "-I" + filepath.Join(sysroot, "usr", "include"), - "-Xclang", "-ast-dump=json", - "-fsyntax-only", - "-x", "c", - tmpFile.Name(), - } - - cmd := exec.Command(clang, args...) - out, err := cmd.Output() - if err != nil { - t.Fatalf("clang: %v", err) - } - - root, err := ParseClangAST(out) - if err != nil { - t.Fatalf("parsing: %v", err) - } - - decls := ExtractDeclarations(root, []string{"android/looper.h"}) - - data, _ := json.MarshalIndent(decls, "", " ") - t.Logf("Extracted declarations:\n%s", string(data)) - - // Verify functions. - funcNames := map[string]bool{} - for _, fn := range decls.Functions { - funcNames[fn.Name] = true - } - expectedFuncs := []string{ - "ALooper_forThread", "ALooper_prepare", "ALooper_acquire", - "ALooper_release", "ALooper_pollOnce", "ALooper_pollAll", - "ALooper_wake", "ALooper_addFd", "ALooper_removeFd", - } - for _, name := range expectedFuncs { - if !funcNames[name] { - t.Errorf("missing function: %s", name) - } - } - - // Verify typedefs. - typedefNames := map[string]bool{} - for _, td := range decls.Typedefs { - typedefNames[td.Name] = true - } - if !typedefNames["ALooper"] { - t.Error("missing typedef: ALooper") - } - if !typedefNames["ALooper_callbackFunc"] { - t.Error("missing typedef: ALooper_callbackFunc") - } - - // Verify enums. - t.Logf("Found %d enums", len(decls.Enums)) - totalConstants := 0 - for _, e := range decls.Enums { - totalConstants += len(e.Constants) - t.Logf("Enum: name=%q typedefName=%q constants=%d", e.Name, e.TypedefName, len(e.Constants)) - for _, c := range e.Constants { - t.Logf(" %s = %d", c.Name, c.Value) - } - } - if totalConstants < 10 { - t.Errorf("expected at least 10 enum constants, got %d", totalConstants) - } - - // Verify the ALooper_callbackFunc is detected as a function pointer. - for _, td := range decls.Typedefs { - if td.Name == "ALooper_callbackFunc" { - if !td.IsFuncPtr { - t.Error("ALooper_callbackFunc should be detected as function pointer") - } - if td.FuncReturn != "int" { - t.Errorf("ALooper_callbackFunc return type: got %q, want %q", td.FuncReturn, "int") - } - if len(td.FuncParams) != 3 { - t.Errorf("ALooper_callbackFunc params: got %d, want 3", len(td.FuncParams)) - } - } - } -} diff --git a/tools/pkg/headerspec/filter.go b/tools/pkg/headerspec/filter.go deleted file mode 100644 index 99f1011..0000000 --- a/tools/pkg/headerspec/filter.go +++ /dev/null @@ -1,111 +0,0 @@ -package headerspec - -import "regexp" - -// ApplyRules filters declarations using accept/ignore rules from the manifest. -// -// Rules are evaluated in order. For each declaration name: -// 1. Check all ignore rules first; if any match, the declaration is excluded. -// 2. Check all accept rules; if any match, the declaration is included. -// 3. If no rule matches, the declaration is excluded (default deny). -func ApplyRules(decls *Declarations, rules []Rule) *Declarations { - if len(rules) == 0 { - return decls - } - - compiled := compileRules(rules) - - out := &Declarations{} - - for i := range decls.Functions { - if shouldAccept(decls.Functions[i].Name, compiled) { - out.Functions = append(out.Functions, decls.Functions[i]) - } - } - - for i := range decls.Typedefs { - if shouldAccept(decls.Typedefs[i].Name, compiled) { - out.Typedefs = append(out.Typedefs, decls.Typedefs[i]) - } - } - - for i := range decls.Enums { - e := &decls.Enums[i] - name := e.TypedefName - if name == "" { - name = e.Name - } - - // For enums, also check if any of their constants match. - if shouldAccept(name, compiled) || anyConstantAccepted(e.Constants, compiled) { - out.Enums = append(out.Enums, *e) - } - } - - for i := range decls.Structs { - if shouldAccept(decls.Structs[i].Name, compiled) { - out.Structs = append(out.Structs, decls.Structs[i]) - } - } - - return out -} - -type compiledRule struct { - action string - re *regexp.Regexp -} - -func compileRules(rules []Rule) []compiledRule { - compiled := make([]compiledRule, 0, len(rules)) - for _, r := range rules { - re, err := regexp.Compile(r.From) - if err != nil { - continue - } - compiled = append(compiled, compiledRule{ - action: r.Action, - re: re, - }) - } - return compiled -} - -// shouldAccept checks whether a given name is accepted by the rules. -// Ignore rules are checked first (any match rejects). Then accept rules -// are checked (any match accepts). No match means reject. -func shouldAccept(name string, rules []compiledRule) bool { - if name == "" { - return false - } - - // First pass: check if any ignore rule matches. - for _, r := range rules { - if r.action == "ignore" && r.re.MatchString(name) { - return false - } - } - - // Second pass: check if any accept rule matches. - for _, r := range rules { - if r.action == "accept" && r.re.MatchString(name) { - return true - } - } - - return false -} - -// anyConstantAccepted checks whether any enum constant name matches an accept -// rule (and no ignore rule). -func anyConstantAccepted( - constants []EnumConstant, - rules []compiledRule, -) bool { - for _, c := range constants { - if shouldAccept(c.Name, rules) { - return true - } - } - return false -} diff --git a/tools/pkg/headerspec/manifest.go b/tools/pkg/headerspec/manifest.go deleted file mode 100644 index e2c72bd..0000000 --- a/tools/pkg/headerspec/manifest.go +++ /dev/null @@ -1,64 +0,0 @@ -package headerspec - -import ( - "fmt" - "os" - - "gopkg.in/yaml.v3" -) - -// Manifest is the top-level manifest YAML used by capigen/headerspec. -type Manifest struct { - Generator GeneratorConfig `yaml:"GENERATOR"` - Parser ParserConfig `yaml:"PARSER"` - Translator TranslatorConfig `yaml:"TRANSLATOR"` -} - -// GeneratorConfig holds package generation settings. -type GeneratorConfig struct { - PackageName string `yaml:"PackageName"` - PackageDescription string `yaml:"PackageDescription"` - PackageLicense string `yaml:"PackageLicense"` - Includes []string `yaml:"Includes"` - FlagGroups []FlagGroup `yaml:"FlagGroups"` -} - -// FlagGroup is a named set of compiler/linker flags. -type FlagGroup struct { - Name string `yaml:"name"` - Flags []string `yaml:"flags"` -} - -// ParserConfig holds parser-specific settings (used by c-for-go, kept for compatibility). -type ParserConfig struct { - IncludePaths []string `yaml:"IncludePaths"` - SourcesPaths []string `yaml:"SourcesPaths"` -} - -// TranslatorConfig holds accept/ignore rules and const evaluation settings. -type TranslatorConfig struct { - ConstRules map[string]string `yaml:"ConstRules"` - Rules map[string][]Rule `yaml:"Rules"` -} - -// Rule is a single accept/ignore rule with a regex pattern. -type Rule struct { - Action string `yaml:"action"` - From string `yaml:"from"` - To string `yaml:"to,omitempty"` -} - -// ParseManifest reads and unmarshals a manifest YAML file. -func ParseManifest(path string) (*Manifest, error) { - data, err := os.ReadFile(path) - if err != nil { - return nil, fmt.Errorf("reading manifest %s: %w", path, err) - } - - var m Manifest - if err := yaml.Unmarshal(data, &m); err != nil { - return nil, fmt.Errorf("parsing manifest %s: %w", path, err) - } - - return &m, nil -} diff --git a/tools/pkg/headerspec/specgen.go b/tools/pkg/headerspec/specgen.go deleted file mode 100644 index 4ceaaed..0000000 --- a/tools/pkg/headerspec/specgen.go +++ /dev/null @@ -1,471 +0,0 @@ -package headerspec - -import ( - "fmt" - "os" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - "gopkg.in/yaml.v3" -) - -// GenerateSpec converts filtered declarations into a specmodel.Spec. -func GenerateSpec( - moduleName string, - sourcePackage string, - decls *Declarations, -) *specmodel.Spec { - spec := &specmodel.Spec{ - Module: moduleName, - SourcePackage: sourcePackage, - Types: make(map[string]specmodel.TypeDef), - Enums: make(map[string][]specmodel.EnumValue), - Functions: make(map[string]specmodel.FuncDef), - Callbacks: make(map[string]specmodel.CallbackDef), - Structs: make(map[string]specmodel.StructDef), - } - - // Index typedefs by name so we can look them up when resolving - // parameter types that reference typedefs. - typedefByName := map[string]*TypedefInfo{} - for i := range decls.Typedefs { - td := &decls.Typedefs[i] - typedefByName[td.Name] = td - } - - // Process typedefs → types and callbacks. - for _, td := range decls.Typedefs { - if td.IsFuncPtr { - cb := specmodel.CallbackDef{ - Returns: cTypeToGoType(td.FuncReturn), - } - for i, p := range td.FuncParams { - cb.Params = append(cb.Params, specmodel.Param{ - Name: paramName(p.Name, i), - Type: cTypeToGoType(p.Type), - }) - } - spec.Callbacks[td.Name] = cb - continue - } - - typeDef := classifyTypedef(&td) - spec.Types[td.Name] = typeDef - } - - // Process enums. - for _, ei := range decls.Enums { - groupName := ei.TypedefName - if groupName == "" { - groupName = ei.Name - } - if groupName == "" { - // Anonymous enum without a typedef: derive a group name from - // the common prefix of its constant names. - groupName = deriveEnumGroupName(ei.Constants) - } - if groupName == "" { - continue - } - - var values []specmodel.EnumValue - for _, c := range ei.Constants { - values = append(values, specmodel.EnumValue{ - Name: c.Name, - Value: c.Value, - }) - } - spec.Enums[groupName] = values - } - - // Process functions. - for _, fn := range decls.Functions { - fd := specmodel.FuncDef{ - CName: fn.Name, - Returns: cTypeToGoType(fn.ReturnType), - } - - for _, p := range fn.Params { - sp := cParamToSpecParam(p, typedefByName) - fd.Params = append(fd.Params, sp) - } - - spec.Functions[fn.Name] = fd - } - - // Process complete structs. - for _, si := range decls.Structs { - if !si.IsComplete { - continue - } - - sd := specmodel.StructDef{} - for _, fi := range si.Fields { - sf := specmodel.StructField{ - Name: fi.Name, - Type: cTypeToGoType(fi.Type), - } - - if fi.IsFuncPtr { - sf.Type = "func_ptr" - sf.Returns = cTypeToGoType(fi.FuncReturn) - for i, p := range fi.FuncParams { - sf.Params = append(sf.Params, specmodel.Param{ - Name: paramName(p.Name, i), - Type: cTypeToGoType(p.Type), - }) - } - } - - sd.Fields = append(sd.Fields, sf) - } - - spec.Structs[si.Name] = sd - } - - // Remove empty maps so they don't appear in YAML output. - if len(spec.Types) == 0 { - spec.Types = nil - } - if len(spec.Enums) == 0 { - spec.Enums = nil - } - if len(spec.Functions) == 0 { - spec.Functions = nil - } - if len(spec.Callbacks) == 0 { - spec.Callbacks = nil - } - if len(spec.Structs) == 0 { - spec.Structs = nil - } - - return spec -} - -// classifyTypedef determines the specmodel.TypeDef for a non-function-pointer typedef. -func classifyTypedef(td *TypedefInfo) specmodel.TypeDef { - ut := td.UnderlyingType - - // typedef struct X X → opaque_ptr - if td.IsOpaqueStruct { - return specmodel.TypeDef{ - Kind: "opaque_ptr", - CType: td.Name, - GoType: "*C." + td.Name, - } - } - - // typedef void * → pointer_handle - if ut == "void *" { - return specmodel.TypeDef{ - Kind: "pointer_handle", - CType: td.Name, - GoType: "unsafe.Pointer", - } - } - - // typedef enum X → typedef_int32 (C enums are int-sized by default). - if strings.HasPrefix(ut, "enum ") { - return specmodel.TypeDef{ - Kind: "typedef_int32", - CType: td.Name, - GoType: "int32", - } - } - - // typedef to integer types → typedef_intN / typedef_uintN - goType := cTypeToGoType(ut) - kind := goTypeToKind(goType) - - return specmodel.TypeDef{ - Kind: kind, - CType: td.Name, - GoType: goType, - } -} - -// goTypeToKind converts a Go type string to a spec kind string. -func goTypeToKind(goType string) string { - switch goType { - case "int8": - return "typedef_int8" - case "uint8": - return "typedef_uint8" - case "int16": - return "typedef_int16" - case "uint16": - return "typedef_uint16" - case "int32": - return "typedef_int32" - case "uint32": - return "typedef_uint32" - case "int64": - return "typedef_int64" - case "uint64": - return "typedef_uint64" - case "bool": - return "typedef_bool" - case "float32": - return "typedef_float32" - case "float64": - return "typedef_float64" - default: - return "typedef_" + goType - } -} - -// cParamToSpecParam converts a C parameter to a spec Param, applying type -// conversions and detecting output parameters (double pointers). -func cParamToSpecParam( - p ParamInfo, - typedefByName map[string]*TypedefInfo, -) specmodel.Param { - sp := specmodel.Param{ - Name: p.Name, - } - - cType := stripNullabilityAnnotations(p.Type) - - // Detect const qualifier. - if strings.HasPrefix(cType, "const ") { - sp.Const = true - } - - // Handle special pointer types before generic pointer logic. - switch cType { - case "void *", "const void *": - sp.Type = "unsafe.Pointer" - return sp - case "void **": - sp.Type = "[]unsafe.Pointer" - return sp - case "const char *", "const char *const", "char *": - sp.Type = "string" - return sp - } - - // Detect output parameters: double pointer "X **" - if strings.HasSuffix(cType, " **") || strings.HasSuffix(cType, "**") { - base := strings.TrimSpace(strings.TrimSuffix(cType, "**")) - base = strings.TrimPrefix(base, "const ") - sp.Type = "*" + cTypeToGoType(base+" *") - sp.Direction = "out" - return sp - } - - // Single pointer to known type: "int *" → "[]int32" (pointer-to-scalar = out/array). - if strings.HasSuffix(cType, " *") { - base := strings.TrimSpace(strings.TrimSuffix(cType, " *")) - base = strings.TrimPrefix(base, "const ") - - // Check if base is a typedef that we know. - if td, ok := typedefByName[base]; ok { - if td.IsOpaqueStruct { - sp.Type = "*" + base - return sp - } - } - - // Pointer to scalar types become slices (matching specgen behavior). - goBase := cTypeToGoType(base) - if isScalarGoType(goBase) { - sp.Type = "[]" + goBase - return sp - } - - sp.Type = "*" + goBase - return sp - } - - sp.Type = cTypeToGoType(cType) - return sp -} - -// isScalarGoType returns true for Go scalar/primitive types. -func isScalarGoType(t string) bool { - switch t { - case "int8", "uint8", "int16", "uint16", - "int32", "uint32", "int64", "uint64", - "float32", "float64", "bool": - return true - } - return false -} - -// stripNullabilityAnnotations removes Clang nullability annotations from a type string. -func stripNullabilityAnnotations(s string) string { - s = strings.ReplaceAll(s, " _Nonnull", "") - s = strings.ReplaceAll(s, " _Nullable", "") - s = strings.ReplaceAll(s, " _Null_unspecified", "") - return strings.TrimSpace(s) -} - -// cTypeToGoType converts a C type string to a Go type string. -func cTypeToGoType(cType string) string { - cType = strings.TrimSpace(cType) - cType = stripNullabilityAnnotations(cType) - - // Handle pointer types first. - if cType == "void *" || cType == "const void *" { - return "unsafe.Pointer" - } - if cType == "const char *" || cType == "const char *const" || cType == "const char *const *" { - return "string" - } - if cType == "char *" { - return "string" - } - - // Strip pointer suffix and recurse. - if strings.HasSuffix(cType, " *") { - base := strings.TrimSpace(strings.TrimSuffix(cType, " *")) - return "*" + cTypeToGoType(base) - } - if strings.HasSuffix(cType, "*") && !strings.Contains(cType, "(") { - base := strings.TrimSpace(strings.TrimSuffix(cType, "*")) - return "*" + cTypeToGoType(base) - } - - // Strip "const " prefix for base type lookups. - base := strings.TrimPrefix(cType, "const ") - - // Strip "struct " prefix. - base = strings.TrimPrefix(base, "struct ") - - // Strip "enum " prefix. - base = strings.TrimPrefix(base, "enum ") - - switch base { - case "void": - return "" - case "int": - return "int32" - case "unsigned int", "unsigned": - return "uint32" - case "long": - return "int64" - case "unsigned long": - return "uint64" - case "long long": - return "int64" - case "unsigned long long": - return "uint64" - case "short": - return "int16" - case "unsigned short": - return "uint16" - case "char", "signed char": - return "int8" - case "unsigned char": - return "uint8" - case "int8_t": - return "int8" - case "uint8_t": - return "uint8" - case "int16_t": - return "int16" - case "uint16_t": - return "uint16" - case "int32_t": - return "int32" - case "uint32_t": - return "uint32" - case "int64_t": - return "int64" - case "uint64_t": - return "uint64" - case "float": - return "float32" - case "double": - return "float64" - case "size_t": - return "uint64" - case "ssize_t": - return "int64" - case "_Bool", "bool": - return "bool" - } - - // If it's a known NDK typedef name (like ALooper), return as-is. - return base -} - -// paramName returns a parameter name, using a generated placeholder if empty. -func paramName(name string, index int) string { - if name != "" { - return name - } - return fmt.Sprintf("p%d", index) -} - -// deriveEnumGroupName computes a group name from the common prefix of -// enum constant names. For example, constants ["ALOOPER_POLL_WAKE", -// "ALOOPER_POLL_CALLBACK"] yield "ALOOPER_POLL". -// -// For single-constant enums, the prefix up to the second-to-last -// underscore is used (e.g., "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS" -// yields "ALOOPER_PREPARE"). -func deriveEnumGroupName(constants []EnumConstant) string { - if len(constants) == 0 { - return "" - } - if len(constants) == 1 { - // Single constant: find a meaningful prefix by dropping the - // last two underscore-delimited segments. - name := constants[0].Name - parts := strings.Split(name, "_") - if len(parts) > 2 { - return strings.Join(parts[:len(parts)-2], "_") - } - if idx := strings.LastIndex(name, "_"); idx > 0 { - return name[:idx] - } - return name - } - - prefix := constants[0].Name - for _, c := range constants[1:] { - prefix = commonPrefix(prefix, c.Name) - } - - // Trim trailing underscore. - prefix = strings.TrimRight(prefix, "_") - - if prefix == "" { - return "" - } - - return prefix -} - -// commonPrefix returns the common prefix of two strings. -func commonPrefix(a, b string) string { - n := len(a) - if len(b) < n { - n = len(b) - } - for i := 0; i < n; i++ { - if a[i] != b[i] { - return a[:i] - } - } - return a[:n] -} - -// WriteSpecYAML marshals a Spec to YAML and writes it to the given path. -func WriteSpecYAML(spec *specmodel.Spec, path string) error { - data, err := yaml.Marshal(spec) - if err != nil { - return fmt.Errorf("marshalling spec: %w", err) - } - - header := "# Code generated by headerspec. DO NOT EDIT.\n\n" - content := header + string(data) - - if err := os.WriteFile(path, []byte(content), 0644); err != nil { - return fmt.Errorf("writing %s: %w", path, err) - } - - return nil -} diff --git a/tools/pkg/headerspec/specgen_test.go b/tools/pkg/headerspec/specgen_test.go deleted file mode 100644 index cc7f65a..0000000 --- a/tools/pkg/headerspec/specgen_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package headerspec - -import ( - "os" - "os/exec" - "path/filepath" - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func runClangForTest(t *testing.T, includes []string) []byte { - t.Helper() - - ndkBase := os.ExpandEnv("${HOME}/Android/Sdk/ndk/28.0.13004108/toolchains/llvm/prebuilt/linux-x86_64") - sysroot := filepath.Join(ndkBase, "sysroot") - clang := filepath.Join(ndkBase, "bin/clang") - - if _, err := os.Stat(clang); err != nil { - t.Skipf("clang not found: %v", err) - } - - tmpFile, err := os.CreateTemp("", "test-*.c") - require.NoError(t, err) - defer func() { _ = os.Remove(tmpFile.Name()) }() - - for _, inc := range includes { - _, err := tmpFile.WriteString("#include <" + inc + ">\n") - require.NoError(t, err) - } - _ = tmpFile.Close() - - args := []string{ - "-target", "aarch64-linux-android26", - "--sysroot=" + sysroot, - "-I" + filepath.Join(sysroot, "usr", "include"), - "-Xclang", "-ast-dump=json", - "-fsyntax-only", - "-x", "c", - tmpFile.Name(), - } - - cmd := exec.Command(clang, args...) - out, err := cmd.Output() - require.NoError(t, err) - - return out -} - -func TestGenerateSpecLooper(t *testing.T) { - jsonData := runClangForTest(t, []string{"android/looper.h"}) - - root, err := ParseClangAST(jsonData) - require.NoError(t, err) - - decls := ExtractDeclarations(root, []string{"android/looper.h"}) - rules := []Rule{ - {Action: "ignore", From: "^ALooper_pollAll$"}, - {Action: "accept", From: "^ALooper"}, - {Action: "accept", From: "^ALOOPER_"}, - } - filtered := ApplyRules(decls, rules) - spec := GenerateSpec("looper", "github.com/AndroidGoLab/ndk/capi/looper", filtered) - - // Types. - require.Contains(t, spec.Types, "ALooper") - assert.Equal(t, "opaque_ptr", spec.Types["ALooper"].Kind) - assert.Equal(t, "*C.ALooper", spec.Types["ALooper"].GoType) - - // Functions: ALooper_pollAll should be ignored, everything else accepted. - require.Contains(t, spec.Functions, "ALooper_pollOnce") - require.NotContains(t, spec.Functions, "ALooper_pollAll") - require.Contains(t, spec.Functions, "ALooper_addFd") - require.Contains(t, spec.Functions, "ALooper_acquire") - require.Contains(t, spec.Functions, "ALooper_release") - require.Contains(t, spec.Functions, "ALooper_wake") - require.Contains(t, spec.Functions, "ALooper_forThread") - require.Contains(t, spec.Functions, "ALooper_prepare") - require.Contains(t, spec.Functions, "ALooper_removeFd") - - // ALooper_pollOnce parameter types. - pollOnce := spec.Functions["ALooper_pollOnce"] - require.Len(t, pollOnce.Params, 4) - assert.Equal(t, "int32", pollOnce.Params[0].Type) - assert.Equal(t, "[]int32", pollOnce.Params[1].Type) - assert.Equal(t, "[]int32", pollOnce.Params[2].Type) - assert.Equal(t, "[]unsafe.Pointer", pollOnce.Params[3].Type) - - // ALooper_addFd parameters. - addFd := spec.Functions["ALooper_addFd"] - require.Len(t, addFd.Params, 6) - assert.Equal(t, "*ALooper", addFd.Params[0].Type) - assert.Equal(t, "int32", addFd.Params[1].Type) - assert.Equal(t, "ALooper_callbackFunc", addFd.Params[4].Type) - assert.Equal(t, "unsafe.Pointer", addFd.Params[5].Type) - - // Callbacks. - require.Contains(t, spec.Callbacks, "ALooper_callbackFunc") - cb := spec.Callbacks["ALooper_callbackFunc"] - assert.Equal(t, "int32", cb.Returns) - require.Len(t, cb.Params, 3) - assert.Equal(t, "int32", cb.Params[0].Type) - assert.Equal(t, "int32", cb.Params[1].Type) - assert.Equal(t, "unsafe.Pointer", cb.Params[2].Type) - - // Enums: all three groups should be present. - require.NotNil(t, spec.Enums) - assert.GreaterOrEqual(t, len(spec.Enums), 3) - - // Check that ALOOPER_ enum constants are present in some group. - foundConstants := map[string]bool{} - for _, values := range spec.Enums { - for _, v := range values { - foundConstants[v.Name] = true - } - } - assert.True(t, foundConstants["ALOOPER_EVENT_INPUT"]) - assert.True(t, foundConstants["ALOOPER_POLL_WAKE"]) - assert.True(t, foundConstants["ALOOPER_PREPARE_ALLOW_NON_CALLBACKS"]) - assert.Equal(t, int64(-1), findEnumValue(spec.Enums, "ALOOPER_POLL_WAKE")) - assert.Equal(t, int64(1), findEnumValue(spec.Enums, "ALOOPER_EVENT_INPUT")) -} - -func findEnumValue(enums map[string][]specmodel.EnumValue, name string) int64 { - for _, values := range enums { - for _, v := range values { - if v.Name == name { - return v.Value - } - } - } - return 0 -} - -func TestApplyRulesIgnoreOverridesAccept(t *testing.T) { - decls := &Declarations{ - Functions: []FuncDecl{ - {Name: "ALooper_pollAll"}, - {Name: "ALooper_pollOnce"}, - {Name: "ALooper_acquire"}, - {Name: "Unrelated_func"}, - }, - } - rules := []Rule{ - {Action: "ignore", From: "^ALooper_pollAll$"}, - {Action: "accept", From: "^ALooper"}, - } - - filtered := ApplyRules(decls, rules) - - funcNames := map[string]bool{} - for _, fn := range filtered.Functions { - funcNames[fn.Name] = true - } - - assert.True(t, funcNames["ALooper_pollOnce"]) - assert.True(t, funcNames["ALooper_acquire"]) - assert.False(t, funcNames["ALooper_pollAll"], "ALooper_pollAll should be ignored") - assert.False(t, funcNames["Unrelated_func"], "unmatched functions should be rejected") -} - -func TestCTypeToGoType(t *testing.T) { - tests := []struct { - cType string - goType string - }{ - {"int", "int32"}, - {"unsigned int", "uint32"}, - {"int32_t", "int32"}, - {"uint32_t", "uint32"}, - {"int64_t", "int64"}, - {"uint64_t", "uint64"}, - {"int8_t", "int8"}, - {"uint8_t", "uint8"}, - {"int16_t", "int16"}, - {"uint16_t", "uint16"}, - {"float", "float32"}, - {"double", "float64"}, - {"size_t", "uint64"}, - {"ssize_t", "int64"}, - {"_Bool", "bool"}, - {"bool", "bool"}, - {"void", ""}, - {"void *", "unsafe.Pointer"}, - {"const void *", "unsafe.Pointer"}, - {"const char *", "string"}, - {"char *", "string"}, - {"ALooper *", "*ALooper"}, - {"struct ALooper", "ALooper"}, - } - - for _, tt := range tests { - t.Run(tt.cType, func(t *testing.T) { - got := cTypeToGoType(tt.cType) - assert.Equal(t, tt.goType, got) - }) - } -} - -func TestDeriveEnumGroupName(t *testing.T) { - tests := []struct { - name string - constants []EnumConstant - want string - }{ - { - name: "multiple with shared prefix", - constants: []EnumConstant{ - {Name: "ALOOPER_POLL_WAKE"}, - {Name: "ALOOPER_POLL_CALLBACK"}, - {Name: "ALOOPER_POLL_TIMEOUT"}, - }, - want: "ALOOPER_POLL", - }, - { - name: "single constant", - constants: []EnumConstant{ - {Name: "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS"}, - }, - want: "ALOOPER_PREPARE_ALLOW", - }, - { - name: "empty", - constants: nil, - want: "", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := deriveEnumGroupName(tt.constants) - assert.Equal(t, tt.want, got) - }) - } -} diff --git a/tools/pkg/idiomgen/.gitkeep b/tools/pkg/idiomgen/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tools/pkg/idiomgen/differential_test.go b/tools/pkg/idiomgen/differential_test.go deleted file mode 100644 index 3ed6bf1..0000000 --- a/tools/pkg/idiomgen/differential_test.go +++ /dev/null @@ -1,206 +0,0 @@ -package idiomgen - -import ( - "bufio" - "fmt" - "os" - "os/exec" - "strings" - "testing" -) - -const leanOraclePath = "../../../proofs/.lake/build/bin/proofs" - -func leanOracleAvailable() bool { - _, err := os.Stat(leanOraclePath) - return err == nil -} - -func runLeanOracle(t *testing.T, commands []string) []string { - t.Helper() - input := strings.Join(commands, "\n") + "\n" - cmd := exec.Command(leanOraclePath) - cmd.Stdin = strings.NewReader(input) - out, err := cmd.Output() - if err != nil { - t.Fatalf("lean oracle failed: %v", err) - } - var results []string - scanner := bufio.NewScanner(strings.NewReader(string(out))) - for scanner.Scan() { - results = append(results, scanner.Text()) - } - return results -} - -// TestDifferential_CommonPrefix compares Go and Lean commonPrefix. -func TestDifferential_CommonPrefix(t *testing.T) { - if !leanOracleAvailable() { - t.Skip("Lean oracle not built (run 'cd proofs && lake build')") - } - - type pair struct{ a, b string } - inputs := []pair{ - {"", ""}, - {"", "hello"}, - {"hello", ""}, - {"hello", "help"}, - {"abc", "abd"}, - {"abc", "xyz"}, - {"test", "test"}, - {"ab", "abcde"}, - {"AAUDIO_DIRECTION_OUTPUT", "AAUDIO_DIRECTION_INPUT"}, - {"ASensor_create", "ASensor_delete"}, - } - - var commands []string - for _, p := range inputs { - commands = append(commands, fmt.Sprintf("commonPrefix\t%s\t%s", p.a, p.b)) - } - - leanResults := runLeanOracle(t, commands) - if len(leanResults) != len(inputs) { - t.Fatalf("expected %d results, got %d", len(inputs), len(leanResults)) - } - - for i, p := range inputs { - goResult := commonPrefix(p.a, p.b) - leanResult := leanResults[i] - if goResult != leanResult { - t.Errorf("commonPrefix(%q, %q): Go=%q, Lean=%q", p.a, p.b, goResult, leanResult) - } - } -} - -// commonPrefix is the Go implementation matching c2ffi.commonPrefix. -func commonPrefix(a, b string) string { - n := len(a) - if len(b) < n { - n = len(b) - } - for i := 0; i < n; i++ { - if a[i] != b[i] { - return a[:i] - } - } - return a[:n] -} - -// TestDifferential_IsConstructorDestructorFunc compares Go and Lean classification. -func TestDifferential_IsConstructorDestructorFunc(t *testing.T) { - if !leanOracleAvailable() { - t.Skip("Lean oracle not built (run 'cd proofs && lake build')") - } - - type testCase struct { - funcName, specTypeName string - } - inputs := []testCase{ - {"ASensor_create", "ASensor"}, - {"ASensor_new", "ASensor"}, - {"ASensor_delete", "ASensor"}, - {"ASensor_free", "ASensor"}, - {"ASensor_destroy", "ASensor"}, - {"ASensor_release", "ASensor"}, - {"ASensor_close", "ASensor"}, - {"ASensor_getName", "ASensor"}, - {"ALooper_create", "ALooper"}, - {"unrelated", "ALooper"}, - } - - var ctorCommands, dtorCommands []string - for _, tc := range inputs { - ctorCommands = append(ctorCommands, fmt.Sprintf("isConstructorFunc\t%s\t%s", tc.funcName, tc.specTypeName)) - dtorCommands = append(dtorCommands, fmt.Sprintf("isDestructorFunc\t%s\t%s", tc.funcName, tc.specTypeName)) - } - - ctorResults := runLeanOracle(t, ctorCommands) - dtorResults := runLeanOracle(t, dtorCommands) - - for i, tc := range inputs { - goCtorResult := fmt.Sprintf("%v", isConstructorFunc(tc.funcName, tc.specTypeName)) - goDtorResult := fmt.Sprintf("%v", isDestructorFunc(tc.funcName, tc.specTypeName)) - - if goCtorResult != ctorResults[i] { - t.Errorf("isConstructorFunc(%q, %q): Go=%s, Lean=%s", tc.funcName, tc.specTypeName, goCtorResult, ctorResults[i]) - } - if goDtorResult != dtorResults[i] { - t.Errorf("isDestructorFunc(%q, %q): Go=%s, Lean=%s", tc.funcName, tc.specTypeName, goDtorResult, dtorResults[i]) - } - } -} - -// TestDifferential_CountGoParams compares Go and Lean countGoParams. -func TestDifferential_CountGoParams(t *testing.T) { - if !leanOracleAvailable() { - t.Skip("Lean oracle not built (run 'cd proofs && lake build')") - } - - inputs := []string{ - "func()", - "func(int)", - "func(int, string)", - "func(int, string, bool)", - "func( )", - "hello", - "", - } - - var commands []string - for _, sig := range inputs { - commands = append(commands, fmt.Sprintf("countGoParams\t%s", sig)) - } - - leanResults := runLeanOracle(t, commands) - if len(leanResults) != len(inputs) { - t.Fatalf("expected %d results, got %d", len(inputs), len(leanResults)) - } - - for i, sig := range inputs { - goResult := fmt.Sprintf("%d", countGoParams(sig)) - leanResult := leanResults[i] - if goResult != leanResult { - t.Errorf("countGoParams(%q): Go=%s, Lean=%s", sig, goResult, leanResult) - } - } -} - -// TestDifferential_ResolveType compares Go and Lean resolveType. -func TestDifferential_ResolveType(t *testing.T) { - if !leanOracleAvailable() { - t.Skip("Lean oracle not built (run 'cd proofs && lake build')") - } - - type testCase struct { - specType string - mapStr string // comma-separated key=value for Lean - goMap map[string]string - } - inputs := []testCase{ - {"foo", "foo=Bar", map[string]string{"foo": "Bar"}}, - {"*foo", "foo=Bar", map[string]string{"foo": "Bar"}}, - {"**foo", "foo=Bar", map[string]string{"foo": "Bar"}}, - {"[]foo", "foo=Bar", map[string]string{"foo": "Bar"}}, - {"unknown", "foo=Bar", map[string]string{"foo": "Bar"}}, - {"*foo", "*foo=Direct,foo=Prefix", map[string]string{"*foo": "Direct", "foo": "Prefix"}}, - {"baz", "", nil}, - } - - var commands []string - for _, tc := range inputs { - commands = append(commands, fmt.Sprintf("resolveType\t%s\t%s", tc.specType, tc.mapStr)) - } - - leanResults := runLeanOracle(t, commands) - if len(leanResults) != len(inputs) { - t.Fatalf("expected %d results, got %d", len(inputs), len(leanResults)) - } - - for i, tc := range inputs { - goResult := resolveType(tc.specType, tc.goMap) - leanResult := leanResults[i] - if goResult != leanResult { - t.Errorf("resolveType(%q, %v): Go=%q, Lean=%q", tc.specType, tc.goMap, goResult, leanResult) - } - } -} diff --git a/tools/pkg/idiomgen/funcmap.go b/tools/pkg/idiomgen/funcmap.go deleted file mode 100644 index 92bfe8f..0000000 --- a/tools/pkg/idiomgen/funcmap.go +++ /dev/null @@ -1,578 +0,0 @@ -package idiomgen - -import ( - "fmt" - "regexp" - "sort" - "strings" - "text/template" - "unicode" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -// capiArg returns the expression to pass a parameter to a capi function. -// Handles need .ptr unwrapping; remapped types need capi.Type() conversion. -func capiArg(p MergedParam) string { - if p.GoType == "time.Duration" { - unit := p.DurationUnit - if unit == "" { - unit = "ns" - } - // All Duration methods return int64; cast to match the capi param type. - switch unit { - case "ms": - return p.CapiType + "(" + p.Name + ".Milliseconds())" - case "us": - return p.CapiType + "(" + p.Name + ".Microseconds())" - case "s": - return p.CapiType + "(" + p.Name + ".Seconds())" - default: // "ns" - return p.CapiType + "(" + p.Name + ".Nanoseconds())" - } - } - if p.IsHandle && p.GoType != "unsafe.Pointer" { - // Pointer params (e.g. *Window) can be nil — use the nil-safe - // cptr() method instead of direct .ptr field access. - if strings.HasPrefix(p.GoType, "*") { - return p.Name + ".cptr()" - } - return p.Name + ".ptr" - } - if p.IsString { - return "&" + p.Name + "Bytes[0]" - } - if p.CapiType != "" && (p.CapiType != p.GoType || p.Remapped) { - if strings.HasPrefix(p.CapiType, "[]") { - // Slice of a renamed type: reinterpret via unsafe.Pointer. - // []Int and []capi.EGLint have identical layout. - return "*(*[]capi." + p.CapiType[2:] + ")(unsafe.Pointer(&" + p.Name + "))" - } - if strings.HasPrefix(p.CapiType, "*") { - // Pointer type: strip all stars, prefix with capi., re-add stars outside. - // E.g. *Type → (*capi.Type)(name), **Type → (**capi.Type)(name) - stars := 0 - base := p.CapiType - for strings.HasPrefix(base, "*") { - stars++ - base = base[1:] - } - return "(" + strings.Repeat("*", stars) + "capi." + base + ")(" + p.Name + ")" - } - // Scalar Go types (int32, uint32, etc.) don't need a capi. prefix — - // they're built-in types, not capi package types. - if isScalarGoType(p.CapiType) { - return p.CapiType + "(" + p.Name + ")" - } - return "capi." + p.CapiType + "(" + p.Name + ")" - } - return p.Name -} - -// FuncMap returns template helper functions for code generation templates. -func FuncMap() template.FuncMap { - return template.FuncMap{ - "safeGoName": safeGoName, - "unexport": unexport, - "lower": strings.ToLower, - "upper": strings.ToUpper, - "contains": strings.Contains, - "hasPrefix": strings.HasPrefix, - "trimPrefix": strings.TrimPrefix, - "skip": func(params []MergedParam, n int) []MergedParam { - if n >= len(params) { - return nil - } - return params[n:] - }, - // skipAndFilterOut filters out params with direction "out". - // The receiver is already stripped by the merger, so no index-based skipping. - "skipAndFilterOut": func(params []MergedParam) []MergedParam { - var out []MergedParam - for _, p := range params { - if p.Direction == "out" { - continue - } - out = append(out, p) - } - return out - }, - "lookupCapiType": func(types map[string]MergedOpaqueType, goName string) string { - if t, ok := types[goName]; ok { - return t.CapiType - } - return goName - }, - // sortedOpaqueTypes returns opaque types sorted by Go name for deterministic output. - "sortedOpaqueTypes": func(m map[string]MergedOpaqueType) []MergedOpaqueType { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - result := make([]MergedOpaqueType, len(keys)) - for i, k := range keys { - result[i] = m[k] - } - return result - }, - // anyStringMethod returns true if any value enum has StringMethod enabled. - "anyStringMethod": func(enums []MergedValueEnum) bool { - for _, e := range enums { - if e.StringMethod { - return true - } - } - return false - }, - // anyUnsafeParam returns true if any method has an unsafe.Pointer parameter. - "anyUnsafeParam": func(methods []MergedMethod) bool { - for _, m := range methods { - for _, p := range m.Params { - if strings.Contains(p.GoType, "unsafe.Pointer") { - return true - } - } - } - return false - }, - // anyDurationParam returns true if any method or free function has a time.Duration parameter. - "anyDurationParam": func(methods []MergedMethod, fns []MergedFreeFunction) bool { - for _, m := range methods { - for _, p := range m.Params { - if p.GoType == "time.Duration" { - return true - } - } - } - for _, f := range fns { - for _, p := range f.Params { - if p.GoType == "time.Duration" { - return true - } - } - } - return false - }, - // anyDurationFreeFunc returns true if any free function has a time.Duration parameter. - "anyDurationFreeFunc": func(fns []MergedFreeFunction) bool { - for _, f := range fns { - for _, p := range f.Params { - if p.GoType == "time.Duration" { - return true - } - } - } - return false - }, - // anyUnsafeFreeFunc returns true if any free function has an unsafe.Pointer parameter or return, - // or if any parameter needs a slice type reinterpret cast. - "anyUnsafeFreeFunc": func(fns []MergedFreeFunction) bool { - for _, f := range fns { - if strings.Contains(f.Returns, "unsafe.Pointer") { - return true - } - for _, p := range f.Params { - if strings.Contains(p.GoType, "unsafe.Pointer") { - return true - } - // Slice of a renamed type needs unsafe reinterpret. - if p.CapiType != "" && p.CapiType != p.GoType && strings.HasPrefix(p.CapiType, "[]") { - return true - } - } - } - return false - }, - // capiArg returns the expression to pass a parameter to a capi function. - // Handles need .ptr unwrapping; remapped types need capi.Type() conversion. - "capiArg": capiArg, - // capiArgBuf returns the expression for a buffer parameter, converting - // typed slices (e.g., []byte) to unsafe.Pointer for capi calls. - "capiArgBuf": func(p MergedParam, bufGoType string) string { - if strings.HasPrefix(p.GoType, "[]") { - return "unsafe.Pointer(&" + p.Name + "[0])" - } - return capiArg(p) - }, - // trimStar removes a leading "*" from a string. - "trimStar": func(s string) string { - return strings.TrimPrefix(s, "*") - }, - "lowerFirst": func(s string) string { - if s == "" { - return s - } - return strings.ToLower(s[:1]) + s[1:] - }, - "toSnakeCase": toSnakeCase, - // skipSpecParams skips the first n parameters from a specmodel.Param slice. - "skipSpecParams": func(params []specmodel.Param, n int) []specmodel.Param { - if n >= len(params) { - return nil - } - return params[n:] - }, - // cTypeToGo maps a C/spec type string to a Go CGo type for use in //export functions. - "cTypeToGo": func(cType string) string { - if cType == "void*" || cType == "unsafe.Pointer" { - return "unsafe.Pointer" - } - // Go integer types → C integer types. - goToCGoMap := map[string]string{ - "int8": "C.int8_t", "uint8": "C.uint8_t", - "int16": "C.int16_t", "uint16": "C.uint16_t", - "int32": "C.int32_t", "uint32": "C.uint32_t", - "int64": "C.int64_t", "uint64": "C.uint64_t", - "float32": "C.float", "float64": "C.double", - "int": "C.int", - } - if cgoType, ok := goToCGoMap[cType]; ok { - return cgoType - } - if strings.HasPrefix(cType, "*") { - base := cType[1:] - if cgoBase, ok := goToCGoMap[base]; ok { - return "*" + cgoBase - } - return "*C." + base - } - return "C." + cType - }, - // toCType converts a spec type (Go-style) to C declaration syntax. - // "*ACameraDevice" becomes "ACameraDevice*", "void*" stays "void*", - // "int" stays "int", "**ACameraDevice" becomes "ACameraDevice**". - "toCType": toCType, - // filterFixedParams returns params whose names are not in fixedParams. - "filterFixedParams": func(params []MergedParam, fixedParams map[string]string) []MergedParam { - if len(fixedParams) == 0 { - return params - } - var out []MergedParam - for _, p := range params { - if _, fixed := fixedParams[p.Name]; !fixed { - out = append(out, p) - } - } - return out - }, - // capiArgOrFixed returns the fixed literal value if the param is fixed, - // otherwise returns the normal capiArg expression. - "capiArgOrFixed": func(p MergedParam, fixedParams map[string]string) string { - if v, ok := fixedParams[p.Name]; ok { - return v - } - if p.GoType == "time.Duration" { - unit := p.DurationUnit - if unit == "" { - unit = "ns" - } - switch unit { - case "ms": - return p.CapiType + "(" + p.Name + ".Milliseconds())" - case "us": - return p.CapiType + "(" + p.Name + ".Microseconds())" - case "s": - return p.CapiType + "(" + p.Name + ".Seconds())" - default: - return p.CapiType + "(" + p.Name + ".Nanoseconds())" - } - } - if p.IsHandle { - if strings.HasPrefix(p.GoType, "*") { - return p.Name + ".cptr()" - } - return p.Name + ".ptr" - } - if p.IsString { - return "&" + p.Name + "Bytes[0]" - } - if p.CapiType != "" && (p.CapiType != p.GoType || p.Remapped) { - if strings.HasPrefix(p.CapiType, "[]") { - return "*(*[]capi." + p.CapiType[2:] + ")(unsafe.Pointer(&" + p.Name + "))" - } - if strings.HasPrefix(p.CapiType, "*") { - // Count all pointer levels to handle **Type correctly. - stars := 0 - base := p.CapiType - for strings.HasPrefix(base, "*") { - stars++ - base = base[1:] - } - return "(" + strings.Repeat("*", stars) + "capi." + base + ")(" + p.Name + ")" - } - if isScalarGoType(p.CapiType) { - return p.CapiType + "(" + p.Name + ")" - } - return "capi." + p.CapiType + "(" + p.Name + ")" - } - return p.Name - }, - // callbackVisibleParams returns params visible in the Go signature for callback methods. - // Excludes direction:out params and the callback param itself. Converts *byte to string. - "callbackVisibleParams": func(params []MergedParam, callbackParam string) []MergedParam { - var out []MergedParam - for _, p := range params { - if p.Direction == "out" || p.Name == callbackParam { - continue - } - out = append(out, p) - } - return out - }, - // callbackCapiArg returns the capi expression for a param in a callback method call. - "callbackCapiArg": func(p MergedParam, callbackParam string) string { - if p.Name == callbackParam { - return "&cbsC" - } - if p.IsString { - return "&" + p.Name + "Bytes[0]" - } - if p.IsHandle { - if strings.HasPrefix(p.GoType, "*") { - return p.Name + ".cptr()" - } - return p.Name + ".ptr" - } - if p.CapiType != "" && (p.CapiType != p.GoType || p.Remapped) { - if strings.HasPrefix(p.CapiType, "[]") { - return "*(*[]capi." + p.CapiType[2:] + ")(unsafe.Pointer(&" + p.Name + "))" - } - if strings.HasPrefix(p.CapiType, "*") { - // Count all pointer levels to handle **Type correctly. - stars := 0 - base := p.CapiType - for strings.HasPrefix(base, "*") { - stars++ - base = base[1:] - } - return "(" + strings.Repeat("*", stars) + "capi." + base + ")(" + p.Name + ")" - } - if isScalarGoType(p.CapiType) { - return p.CapiType + "(" + p.Name + ")" - } - return "capi." + p.CapiType + "(" + p.Name + ")" - } - return p.Name - }, - // filterOutputParams returns params whose names are not in the output params set. - "filterOutputParams": func(params []MergedParam, outputParams []MergedOutputParam) []MergedParam { - if len(outputParams) == 0 { - return params - } - opNames := make(map[string]bool, len(outputParams)) - for _, op := range outputParams { - opNames[op.CParamName] = true - } - var out []MergedParam - for _, p := range params { - if !opNames[p.Name] { - out = append(out, p) - } - } - return out - }, - // trimStarPrefix removes the leading "*" from a type string (e.g., "*ImageReader" -> "ImageReader"). - "trimStarPrefix": func(s string) string { - return strings.TrimPrefix(s, "*") - }, - // zeroValue returns the Go zero value literal for a type. - // Pointer and handle types return "nil", value structs return "Type{}", - // unsafe.Pointer returns "nil", numeric types return "0". - "zeroValue": func(op MergedOutputParam) string { - if strings.HasPrefix(op.GoType, "*") || op.IsHandle || op.GoType == "unsafe.Pointer" { - return "nil" - } - if op.IsValueStruct { - return op.GoType + "{}" - } - return "0" - }, - // stringParams returns only params that need string→byte conversion. - "stringParams": func(params []MergedParam) []MergedParam { - var out []MergedParam - for _, p := range params { - if p.IsString { - out = append(out, p) - } - } - return out - }, - // add returns a + b. Used for index arithmetic in templates. - "add": func(a, b int) int { return a + b }, - // lifecycleGoParamType converts a C param type to a Go type for lifecycle callbacks. - // Pointer types → unsafe.Pointer, int → int, size_t → uintptr, etc. - "lifecycleGoParamType": func(cType string) string { - switch cType { - case "int", "int32_t": - return "int32" - case "int64_t": - return "int64" - case "size_t": - return "uintptr" - case "void*", "unsafe.Pointer": - return "unsafe.Pointer" - default: - if strings.HasPrefix(cType, "*") { - return "unsafe.Pointer" - } - return cType - } - }, - // lifecycleConvertParam returns Go expression to convert a C param for lifecycle callback dispatch. - "lifecycleConvertParam": func(p specmodel.Param) string { - switch p.Type { - case "int", "int32_t", "int32": - return "int32(" + p.Name + ")" - case "int64_t", "int64": - return "int64(" + p.Name + ")" - case "uint32_t", "uint32": - return "uint32(" + p.Name + ")" - case "uint64_t", "uint64": - return "uint64(" + p.Name + ")" - case "size_t": - return "uintptr(" + p.Name + ")" - default: - return "unsafe.Pointer(" + p.Name + ")" - } - }, - // toCParamDecl converts a specmodel.Param to a C declaration string (e.g., "const ARect* rect"). - "toCParamDecl": func(p specmodel.Param) string { - cType := toCType(p.Type) - if p.Const { - return "const " + cType + " " + p.Name - } - return cType + " " + p.Name - }, - // tailSpecParams returns the last n params from a specmodel.Param slice. - "tailSpecParams": func(params []specmodel.Param, n int) []specmodel.Param { - if n >= len(params) { - return params - } - return params[len(params)-n:] - }, - // goConvertSpecParam converts a C param to a Go expression for callback dispatch. - "goConvertSpecParam": func(p specmodel.Param) string { - switch p.Type { - case "int": - return "int(" + p.Name + ")" - case "int32_t", "int32": - return "int(" + p.Name + ")" - case "int64_t", "int64": - return "int64(" + p.Name + ")" - case "uint32_t", "uint32": - return "uint32(" + p.Name + ")" - case "void*", "unsafe.Pointer": - return p.Name - default: - if strings.HasPrefix(p.Type, "*") { - return "unsafe.Pointer(" + p.Name + ")" - } - return p.Name - } - }, - } -} - -// unexport lowercases the first rune of a string. -func unexport(s string) string { - if s == "" { - return s - } - r := []rune(s) - r[0] = unicode.ToLower(r[0]) - return string(r) -} - -// toCType converts a spec type (Go-style) to C declaration syntax. -// "*ACameraDevice" becomes "ACameraDevice*", "void*" stays "void*". -func toCType(specType string) string { - if specType == "void*" || specType == "unsafe.Pointer" { - return "void*" - } - stars := 0 - base := specType - for strings.HasPrefix(base, "*") { - stars++ - base = base[1:] - } - // Convert Go integer types to C types. - goToCMap := map[string]string{ - "int8": "int8_t", "uint8": "uint8_t", - "int16": "int16_t", "uint16": "uint16_t", - "int32": "int32_t", "uint32": "uint32_t", - "int64": "int64_t", "uint64": "uint64_t", - "float32": "float", "float64": "double", - "int": "int", - } - if cType, ok := goToCMap[base]; ok { - base = cType - } - if stars == 0 { - return base - } - return base + strings.Repeat("*", stars) -} - -// goReservedWords is the set of Go keywords and predeclared identifiers that -// cannot be used as parameter names. -var goReservedWords = map[string]bool{ - "break": true, "case": true, "chan": true, "const": true, "continue": true, - "default": true, "defer": true, "else": true, "fallthrough": true, "for": true, - "func": true, "go": true, "goto": true, "if": true, "import": true, - "interface": true, "map": true, "package": true, "range": true, "return": true, - "select": true, "struct": true, "switch": true, "type": true, "var": true, -} - -// safeGoName returns a Go-safe version of a name by prefixing reserved words -// with _ and normalizing common acronyms (e.g. "deviceId" → "deviceID"). -func safeGoName(name string) string { - if goReservedWords[name] { - return "_" + name - } - return fixGoAcronyms(name) -} - -// safeGoParamName returns a Go-safe parameter name, synthesizing positional -// names for unnamed C parameters: index 0 → "arg0", index 1 → "arg1", etc. -func safeGoParamName(name string, index int) string { - if name == "" { - return fmt.Sprintf("arg%d", index) - } - return safeGoName(name) -} - -// acronymRe matches "Id" when it appears as a complete word segment -// (at end of string or followed by a non-lowercase letter). -// This avoids false positives like "Idle", "Identify", "Identity". -var acronymRe = regexp.MustCompile(`Id([^a-z]|$)`) - -// fixGoAcronyms normalizes common acronyms in Go identifiers to follow -// Go conventions (e.g. "Id" → "ID"). -func fixGoAcronyms(s string) string { - return acronymRe.ReplaceAllString(s, "ID$1") -} - -// toSnakeCase converts PascalCase or UPPER_CASE to snake_case. -// Examples: StreamBuilder → stream_builder, Model → model, AUDIO → audio, -// LOOPER_POLL → looper_poll, IMAGE_FORMATS → image_formats. -func toSnakeCase(s string) string { - var b strings.Builder - for i, r := range s { - if unicode.IsUpper(r) { - // Insert underscore only when transitioning from a lowercase - // letter or digit to an uppercase letter. Consecutive uppercase - // letters (e.g. "AUDIO") are treated as a single word. - if i > 0 { - prev := rune(s[i-1]) - if unicode.IsLower(prev) || unicode.IsDigit(prev) { - b.WriteByte('_') - } - } - b.WriteRune(unicode.ToLower(r)) - } else { - b.WriteRune(r) - } - } - return b.String() -} diff --git a/tools/pkg/idiomgen/generate.go b/tools/pkg/idiomgen/generate.go deleted file mode 100644 index ad67611..0000000 --- a/tools/pkg/idiomgen/generate.go +++ /dev/null @@ -1,978 +0,0 @@ -package idiomgen - -import ( - "bufio" - "bytes" - "fmt" - "go/format" - "os" - "path/filepath" - "sort" - "strings" - "text/template" - - "gopkg.in/yaml.v3" - - "github.com/AndroidGoLab/ndk/tools/pkg/capigen" - "github.com/AndroidGoLab/ndk/tools/pkg/overlaymodel" - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -const generatedHeader = "// Code generated by idiomgen. DO NOT EDIT." - -// Generate runs the full idiomgen pipeline: merge spec+overlay, render templates, write files. -// If capiDir is non-empty and the merged spec has bridge-worthy features, bridge files -// are generated into capiDir. -func Generate( - spec specmodel.Spec, - overlay overlaymodel.Overlay, - tmplDir string, - outDir string, - capiDir ...string, -) error { - merged := Merge(spec, overlay) - - if err := os.MkdirAll(outDir, 0o755); err != nil { - return fmt.Errorf("mkdir: %w", err) - } - - // Track all files we intend to write, for stale file cleanup. - written := make(map[string]bool) - - // Partition free functions: factory functions (returning an opaque type) go - // into that type's per-type file; the rest stay in functions.go. - typeFreeFuncs := make(map[string][]MergedFreeFunction) // key: Go type name - var sharedFreeFuncs []MergedFreeFunction - for _, f := range merged.FreeFunctions { - // Route factory functions to their type's file: - // - IsHandleReturn: C function returns a pointer directly - // - ReturnsNew + OutputParams: C function uses an output param for the new object - if f.IsHandleReturn { - targetType := strings.TrimPrefix(f.Returns, "*") - if _, ok := merged.OpaqueTypes[targetType]; ok { - typeFreeFuncs[targetType] = append(typeFreeFuncs[targetType], f) - continue - } - } - if f.ReturnsNew != "" && len(f.OutputParams) > 0 { - if _, ok := merged.OpaqueTypes[f.ReturnsNew]; ok { - typeFreeFuncs[f.ReturnsNew] = append(typeFreeFuncs[f.ReturnsNew], f) - continue - } - } - sharedFreeFuncs = append(sharedFreeFuncs, f) - } - merged.FreeFunctions = sharedFreeFuncs - - // Pre-filter: remove higher-API-level free functions from merged.FreeFunctions - // so that shared templates (functions.go) only contain base-level functions. - // Higher-API functions are emitted into separate build-tagged files below. - var baseSharedFreeFuncs []MergedFreeFunction - for _, f := range merged.FreeFunctions { - if f.APILevel <= capigen.BaseAPILevel { - baseSharedFreeFuncs = append(baseSharedFreeFuncs, f) - } - } - allSharedFreeFuncs := merged.FreeFunctions - merged.FreeFunctions = baseSharedFreeFuncs - - // Shared templates rendered against the MergedSpec (with base-level functions only). - sharedTemplates := map[string]string{ - "package.go": "package.go.tmpl", - "errors.go": "errors.go.tmpl", - "functions.go": "functions.go.tmpl", - } - if merged.Lifecycle != nil { - sharedTemplates["lifecycle.go"] = "lifecycle.go.tmpl" - } - - for outFile, tmplFile := range sharedTemplates { - tmplPath := filepath.Join(tmplDir, tmplFile) - if _, err := os.Stat(tmplPath); os.IsNotExist(err) { - continue - } - - content, err := RenderTemplateFile(tmplPath, merged) - if err != nil { - return fmt.Errorf("render %s: %w", tmplFile, err) - } - - outPath := filepath.Join(outDir, outFile) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", outFile, err) - } - written[outFile] = true - } - - // Restore all free functions for later processing. - merged.FreeFunctions = allSharedFreeFuncs - - // Per-value-enum files: one file per value enum type. - enumTmplPath := filepath.Join(tmplDir, "value_enum_file.go.tmpl") - if _, err := os.Stat(enumTmplPath); err == nil { - for _, ve := range merged.ValueEnums { - data := PerValueEnumData{ - PackageName: merged.PackageName, - Enum: ve, - } - content, err := RenderAny(enumTmplPath, data) - if err != nil { - return fmt.Errorf("render enum %s: %w", ve.GoName, err) - } - fileName := toSnakeCase(ve.GoName) + ".go" - outPath := filepath.Join(outDir, fileName) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", fileName, err) - } - written[fileName] = true - } - } - - // Per-type-alias files: one file per type alias. - aliasTmplPath := filepath.Join(tmplDir, "type_alias_file.go.tmpl") - if _, err := os.Stat(aliasTmplPath); err == nil { - allAliases := make([]MergedTypeAlias, 0, len(merged.TypeAliases)+len(merged.CallbackStructAliases)) - allAliases = append(allAliases, merged.TypeAliases...) - allAliases = append(allAliases, merged.CallbackStructAliases...) - for _, alias := range allAliases { - data := PerTypeAliasData{ - PackageName: merged.PackageName, - SourcePackage: merged.SourcePackage, - Alias: alias, - } - content, err := RenderAny(aliasTmplPath, data) - if err != nil { - return fmt.Errorf("render alias %s: %w", alias.GoName, err) - } - fileName := toSnakeCase(alias.GoName) + ".go" - outPath := filepath.Join(outDir, fileName) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", fileName, err) - } - written[fileName] = true - } - } - - // Per-callback files: one file per callback type with a Go type declaration. - cbTmplPath := filepath.Join(tmplDir, "callback_file.go.tmpl") - if _, err := os.Stat(cbTmplPath); err == nil { - for _, cb := range merged.Callbacks { - if cb.GoCallbackType == "" { - continue - } - data := PerCallbackData{ - PackageName: merged.PackageName, - Callback: cb, - } - content, err := RenderAny(cbTmplPath, data) - if err != nil { - return fmt.Errorf("render callback %s: %w", cb.GoCallbackType, err) - } - fileName := toSnakeCase(cb.GoCallbackType) + ".go" - outPath := filepath.Join(outDir, fileName) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", fileName, err) - } - written[fileName] = true - } - } - - // Per-value-struct files: one file per value struct type. - vsTmplPath := filepath.Join(tmplDir, "value_struct_file.go.tmpl") - if _, err := os.Stat(vsTmplPath); err == nil { - for _, vs := range merged.ValueStructs { - data := PerValueStructData{ - PackageName: merged.PackageName, - SourcePackage: merged.SourcePackage, - Type: vs, - } - content, err := RenderAny(vsTmplPath, data) - if err != nil { - return fmt.Errorf("render value struct %s: %w", vs.GoName, err) - } - fileName := toSnakeCase(vs.GoName) + ".go" - outPath := filepath.Join(outDir, fileName) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", fileName, err) - } - written[fileName] = true - } - } - - // Collect higher-API-level methods and free functions for separate files. - // Methods and functions at or below BaseAPILevel stay in the main files; - // those above go into build-tagged files ({type}_api{N}.go, functions_api{N}.go). - higherMethodsByLevel := make(map[int][]MergedMethod) // api level -> methods - higherFreeFuncsByLevel := make(map[int][]MergedFreeFunction) // api level -> free functions - - // Separate methods by API level. - var baseMethods []MergedMethod - for _, m := range merged.Methods { - if m.APILevel > capigen.BaseAPILevel { - higherMethodsByLevel[m.APILevel] = append(higherMethodsByLevel[m.APILevel], m) - } else { - baseMethods = append(baseMethods, m) - } - } - - // Separate shared free functions by API level. - for _, f := range merged.FreeFunctions { - if f.APILevel > capigen.BaseAPILevel { - higherFreeFuncsByLevel[f.APILevel] = append(higherFreeFuncsByLevel[f.APILevel], f) - } - } - - // Separate per-type free functions by API level. - baseTypeFreeFuncs := make(map[string][]MergedFreeFunction) - higherTypeFreeFuncsByLevel := make(map[int]map[string][]MergedFreeFunction) - for typeName, funcs := range typeFreeFuncs { - for _, f := range funcs { - if f.APILevel > capigen.BaseAPILevel { - level := f.APILevel - if higherTypeFreeFuncsByLevel[level] == nil { - higherTypeFreeFuncsByLevel[level] = make(map[string][]MergedFreeFunction) - } - higherTypeFreeFuncsByLevel[level][typeName] = append(higherTypeFreeFuncsByLevel[level][typeName], f) - } else { - baseTypeFreeFuncs[typeName] = append(baseTypeFreeFuncs[typeName], f) - } - } - } - - // Per-type files: one file per opaque type containing struct + constructor + destructor + methods + factory functions. - typeTmplPath := filepath.Join(tmplDir, "type_file.go.tmpl") - if _, err := os.Stat(typeTmplPath); err == nil { - // Sort type names for deterministic output. - typeNames := make([]string, 0, len(merged.OpaqueTypes)) - for name := range merged.OpaqueTypes { - typeNames = append(typeNames, name) - } - sort.Strings(typeNames) - - for _, typeName := range typeNames { - opaqueType := merged.OpaqueTypes[typeName] - - // Collect base-level methods belonging to this type. - var methods []MergedMethod - for _, m := range baseMethods { - if m.ReceiverType == typeName { - methods = append(methods, m) - } - } - - data := PerTypeData{ - PackageName: merged.PackageName, - SourcePackage: merged.SourcePackage, - Type: opaqueType, - Methods: methods, - FreeFunctions: baseTypeFreeFuncs[typeName], - OpaqueTypes: merged.OpaqueTypes, - } - - content, err := RenderPerType(typeTmplPath, data) - if err != nil { - return fmt.Errorf("render type %s: %w", typeName, err) - } - - fileName := toSnakeCase(typeName) + ".go" - outPath := filepath.Join(outDir, fileName) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", fileName, err) - } - written[fileName] = true - } - } - - // Generate per-API-level files for methods and free functions above BaseAPILevel. - apiLevelMethodsTmplPath := filepath.Join(tmplDir, "type_file.go.tmpl") - allHigherLevels := collectHigherAPILevels(higherMethodsByLevel, higherFreeFuncsByLevel, higherTypeFreeFuncsByLevel) - for _, level := range allHigherLevels { - // Per-type higher-API files: methods and factory functions for this API level. - if _, err := os.Stat(apiLevelMethodsTmplPath); err == nil { - typeNames := make([]string, 0, len(merged.OpaqueTypes)) - for name := range merged.OpaqueTypes { - typeNames = append(typeNames, name) - } - sort.Strings(typeNames) - - for _, typeName := range typeNames { - // Collect methods for this type at this API level. - var levelMethods []MergedMethod - for _, m := range higherMethodsByLevel[level] { - if m.ReceiverType == typeName { - levelMethods = append(levelMethods, m) - } - } - - // Collect factory functions for this type at this API level. - var levelFreeFuncs []MergedFreeFunction - if higherTypeFreeFuncsByLevel[level] != nil { - levelFreeFuncs = higherTypeFreeFuncsByLevel[level][typeName] - } - - if len(levelMethods) == 0 && len(levelFreeFuncs) == 0 { - continue - } - - // Render a methods-only template (no struct/constructor/destructor). - data := PerTypeData{ - PackageName: merged.PackageName, - SourcePackage: merged.SourcePackage, - Type: merged.OpaqueTypes[typeName], - Methods: levelMethods, - FreeFunctions: levelFreeFuncs, - OpaqueTypes: merged.OpaqueTypes, - } - - content, err := renderAPILevelTypeFile(apiLevelMethodsTmplPath, data, level) - if err != nil { - return fmt.Errorf("render type %s api%d: %w", typeName, level, err) - } - - fileName := fmt.Sprintf("%s_api%d.go", toSnakeCase(typeName), level) - outPath := filepath.Join(outDir, fileName) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", fileName, err) - } - written[fileName] = true - } - } - - // Higher-API free functions file. - levelFreeFuncs := higherFreeFuncsByLevel[level] - if len(levelFreeFuncs) > 0 { - levelMerged := MergedSpec{ - PackageName: merged.PackageName, - SourcePackage: merged.SourcePackage, - FreeFunctions: levelFreeFuncs, - } - funcsTmplPath := filepath.Join(tmplDir, "functions.go.tmpl") - if _, err := os.Stat(funcsTmplPath); err == nil { - content, err := RenderTemplateFile(funcsTmplPath, levelMerged) - if err != nil { - return fmt.Errorf("render functions api%d: %w", level, err) - } - // Prepend build tag. - content = fmt.Sprintf("//go:build android_ndk%d\n\n%s", level, content) - - fileName := fmt.Sprintf("functions_api%d.go", level) - outPath := filepath.Join(outDir, fileName) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", fileName, err) - } - written[fileName] = true - } - } - } - - // Clean up stale generated files. - if err := cleanStaleFiles(outDir, written); err != nil { - return fmt.Errorf("cleanup: %w", err) - } - - // Generate bridge files into capi directory if requested. - resolvedCapiDir := "" - if len(capiDir) > 0 { - resolvedCapiDir = capiDir[0] - } - hasBridgeFeatures := len(merged.CallbackStructs) > 0 || len(merged.StructAccessors) > 0 || merged.Lifecycle != nil || merged.ExtraBridgeC != "" || merged.ExtraBridgeGo != "" - if resolvedCapiDir != "" && hasBridgeFeatures { - if err := generateBridgeFiles(merged, tmplDir, resolvedCapiDir); err != nil { - return fmt.Errorf("bridge: %w", err) - } - } - - // Generate untyped macro constants (macros not assigned to any typed enum). - if len(merged.UntypedMacros) > 0 { - content := generateUntypedMacros(merged.PackageName, merged.UntypedMacros) - fileName := "constants.go" - outPath := filepath.Join(outDir, fileName) - if err := os.WriteFile(outPath, []byte(content), 0o644); err != nil { - return fmt.Errorf("write %s: %w", fileName, err) - } - written[fileName] = true - } - - // Format all generated Go files. - if err := formatGoFilesInDir(outDir); err != nil { - return fmt.Errorf("format: %w", err) - } - - return nil -} - -// generateUntypedMacros renders #define macro constants as untyped Go constants. -func generateUntypedMacros( - packageName string, - macros map[string]int64, -) string { - names := make([]string, 0, len(macros)) - for name := range macros { - names = append(names, name) - } - sort.Strings(names) - - var b strings.Builder - b.WriteString(generatedHeader + "\n\npackage " + packageName + "\n\nconst (\n") - for _, name := range names { - v := macros[name] - // Emit negative values as hex to preserve the unsigned bit pattern. - // E.g. GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFF, not -1, so it - // can be used with both signed and unsigned Go types. - if v < 0 { - fmt.Fprintf(&b, "\t%s = 0x%X\n", name, uint64(v)) - } else { - fmt.Fprintf(&b, "\t%s = %d\n", name, v) - } - } - b.WriteString(")\n") - return b.String() -} - -// collectHigherAPILevels returns sorted unique API levels from the higher-level maps. -func collectHigherAPILevels( - methodsByLevel map[int][]MergedMethod, - freeFuncsByLevel map[int][]MergedFreeFunction, - typeFreeFuncsByLevel map[int]map[string][]MergedFreeFunction, -) []int { - seen := make(map[int]bool) - for level := range methodsByLevel { - seen[level] = true - } - for level := range freeFuncsByLevel { - seen[level] = true - } - for level := range typeFreeFuncsByLevel { - seen[level] = true - } - levels := make([]int, 0, len(seen)) - for level := range seen { - levels = append(levels, level) - } - sort.Ints(levels) - return levels -} - -// renderAPILevelTypeFile renders a type file for a specific API level, -// containing only methods (no struct definition, constructor, or destructor). -func renderAPILevelTypeFile( - tmplPath string, - data PerTypeData, - apiLevel int, -) (string, error) { - // Render using a minimal template that only emits methods and free functions. - tmplText := fmt.Sprintf(`//go:build android_ndk%d - -// Code generated by idiomgen. DO NOT EDIT. - -package {{ .PackageName }} - -import ( -{{- if anyDurationParam .Methods .FreeFunctions }} - "time" -{{- end }} -{{- if or (anyUnsafeParam .Methods) (anyUnsafeFreeFunc .FreeFunctions) }} - "unsafe" -{{- end }} - - capi "{{ .SourcePackage }}" -) - -var _ = capi.CgoAllocsUnknown -`, apiLevel) - - // Append method rendering from the type_file template. - // We render each method using the same patterns as type_file.go.tmpl. - tmplText += `{{ range $m := .Methods }} -{{- if $m.CustomCall }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := $m.CustomCall.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) error { - return result(int32(capi.{{ $m.CName }}(h.ptr, {{ $m.CustomCall.Args }}))) -} -{{- else if $m.OutputParams }} -{{- if $m.ReturnsBool }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterOutputParams (skipAndFilterOut $m.Params) $m.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $m.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, bool) { -{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ok := capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}) - if !ok { - return {{ range $op := $m.OutputParams }}{{ zeroValue $op }}, {{ end }}false - } - return {{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}true -} -{{- else if eq $m.Returns "" }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterOutputParams (skipAndFilterOut $m.Params) $m.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $m.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}) { -{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}) - return {{ range $i, $op := $m.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}{{ end }} -} -{{- else }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterOutputParams (skipAndFilterOut $m.Params) $m.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $m.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, error) { -{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ret := capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}{{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}) - if err := result(int32(ret)); err != nil { - return {{ range $op := $m.OutputParams }}{{ zeroValue $op }}, {{ end }}err - } - return {{ range $op := $m.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}nil -} -{{- end }} -{{- else if and $m.CallbackParam $m.ReturnsNew }} -// {{ $m.GoName }} creates a new {{ $m.ReturnsNew }} from this {{ $m.ReceiverType }}. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := callbackVisibleParams $m.Params $m.CallbackParam }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}{{ if callbackVisibleParams $m.Params $m.CallbackParam }}, {{ end }}cbs {{ $m.CallbackGoType }}) (*{{ $m.ReturnsNew }}, error) { -{{ range $p := stringParams (callbackVisibleParams $m.Params $m.CallbackParam) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }} cbID := capi.BridgeRegister{{ $m.CallbackGoType }}(cbs) - var cbsC capi.{{ $m.CallbackStruct }} - capi.BridgeInit{{ $m.CallbackGoType }}(&cbsC, cbID) - var ptr *capi.{{ lookupCapiType $.OpaqueTypes $m.ReturnsNew }} - if err := result(int32(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ callbackCapiArg . $m.CallbackParam }}{{ end }}, &ptr))); err != nil { - capi.BridgeUnregister{{ $m.CallbackGoType }}(cbID) - return nil, err - } - return &{{ $m.ReturnsNew }}{ptr: ptr}, nil -} -{{- else if $m.ReturnsListAccessor }} -// {{ $m.GoName }} returns items from the underlying list. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ([]{{ $m.ReturnsListAccessor.ItemType }}, error) { - var list *capi.{{ $m.ReturnsListAccessor.SpecName }} - if err := result(int32(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}, &list))); err != nil { - return nil, err - } - defer capi.{{ $m.ReturnsListAccessor.DeleteFunc }}(list) - count := capi.Bridge{{ $m.ReturnsListAccessor.SpecName }}Count(list) - items := make([]{{ $m.ReturnsListAccessor.ItemType }}, count) - for i := range items { - items[i] = capi.Bridge{{ $m.ReturnsListAccessor.SpecName }}Item(list, i) - } - return items, nil -} -{{- else if $m.FixedParams }} -{{- if $m.ReturnsNew }} -// {{ $m.GoName }} creates a new {{ $m.ReturnsNew }} from this {{ $m.ReceiverType }}. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterFixedParams (skipAndFilterOut $m.Params) $m.FixedParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) (*{{ $m.ReturnsNew }}, error) { - var ptr *capi.{{ lookupCapiType $.OpaqueTypes $m.ReturnsNew }} - if err := result(int32(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArgOrFixed . $m.FixedParams }}{{ end }}, &ptr))); err != nil { - return nil, err - } - return &{{ $m.ReturnsNew }}{ptr: ptr}, nil -} -{{- else if eq $m.Returns "" }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterFixedParams (skipAndFilterOut $m.Params) $m.FixedParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) { - capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArgOrFixed . $m.FixedParams }}{{ end }}) -} -{{- else }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterFixedParams (skipAndFilterOut $m.Params) $m.FixedParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) error { - return result(int32(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArgOrFixed . $m.FixedParams }}{{ end }}))) -} -{{- end }} -{{ else if $m.Chain }} -// {{ $m.GoName }} sets a property and returns the receiver for chaining. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) *{{ $m.ReceiverType }} { - capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}) - return h -} -{{ else if and $m.Pure (ne $m.Returns "") }} -// {{ $m.GoName }} returns the value directly. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) {{ $m.Returns }} { - return ({{ $m.Returns }})(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }})) -} -{{ else if $m.ReturnsNew }} -{{ if $m.ReturnsNewDirect }} -// {{ $m.GoName }} creates a new {{ $m.ReturnsNew }} from this {{ $m.ReceiverType }}. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) *{{ $m.ReturnsNew }} { - return &{{ $m.ReturnsNew }}{ptr: capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }})} -} -{{ else }} -// {{ $m.GoName }} creates a new {{ $m.ReturnsNew }} from this {{ $m.ReceiverType }}. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) (*{{ $m.ReturnsNew }}, error) { -{{ range $p := stringParams (skipAndFilterOut $m.Params) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }} var ptr *capi.{{ lookupCapiType $.OpaqueTypes $m.ReturnsNew }} - if err := result(int32(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}, &ptr))); err != nil { - return nil, err - } - return &{{ $m.ReturnsNew }}{ptr: ptr}, nil -} -{{ end }} -{{ else if $m.ReturnsFrames }} -// {{ $m.GoName }} calls the underlying NDK function and returns the frame count. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) (int32, error) { -{{- if $m.BufGoType }} - r := capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArgBuf . $m.BufGoType }}{{ end }}) -{{- else }} - r := capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}) -{{- end }} - if r < 0 { - return 0, Error(r) - } - return int32(r), nil -} -{{ else if eq $m.Returns "" }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) { - capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}) -} -{{ else }} -// {{ $m.GoName }} calls the underlying NDK function. -func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilterOut $m.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) error { - return result(int32(capi.{{ $m.CName }}(h.ptr{{ range skipAndFilterOut $m.Params }}, {{ capiArg . }}{{ end }}))) -} -{{ end }} -{{- end }} -{{ range $f := .FreeFunctions }} -{{- if $f.OutputParams }} -{{- if $f.ReturnsBool }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, bool) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ok := capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - if !ok { - return {{ range $op := $f.OutputParams }}{{ zeroValue $op }}, {{ end }}false - } - return {{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}true -} -{{- else if eq $f.Returns "" }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - return {{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}{{ end }} -} -{{- else }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}) ({{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ $op.GoType }}{{ end }}, error) { -{{ range $p := stringParams (filterOutputParams $f.Params $f.OutputParams) }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }} var {{ $op.CParamName }}Val {{ $op.CapiType }} -{{ else }} var {{ $op.CParamName }}Ptr {{ $op.CapiType }} -{{ end }}{{ end }} ret := capi.{{ $f.CName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f.Params $f.OutputParams }}{{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}, &{{ $op.CParamName }}Val{{ else }}, &{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ else }}{{ range $i, $op := $f.OutputParams }}{{ if $i }}, {{ end }}{{ if $op.IsValueStruct }}&{{ $op.CParamName }}Val{{ else }}&{{ $op.CParamName }}Ptr{{ end }}{{ end }}{{ end }}) - if err := result(int32(ret)); err != nil { - return {{ range $op := $f.OutputParams }}{{ zeroValue $op }}, {{ end }}err - } - return {{ range $op := $f.OutputParams }}{{ if $op.IsValueStruct }}{{ lowerFirst (trimStarPrefix $op.GoType) }}FromCapi(&{{ $op.CParamName }}Val){{ else if $op.IsHandle }}&{{ trimStarPrefix $op.GoType }}{ptr: {{ $op.CParamName }}Ptr}{{ else }}{{ $op.CParamName }}Ptr{{ end }}, {{ end }}nil -} -{{- end }} -{{- else }} -// {{ $f.GoName }} calls the underlying C function. -func {{ $f.GoName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ $p.Name }} {{ $p.GoType }}{{ end }}){{ if $f.Returns }} {{ $f.Returns }}{{ end }} { -{{ range $p := stringParams $f.Params }} {{ $p.Name }}Bytes := append([]byte({{ $p.Name }}), 0) -{{ end }} {{ if $f.IsHandleReturn -}} - return &{{ trimStar $f.Returns }}{ptr: capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }})} - {{- else if $f.Returns -}} - return ({{ $f.Returns }})(capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }})) - {{- else -}} - capi.{{ $f.CName }}({{ range $i, $p := $f.Params }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}) - {{- end }} -} -{{- end }} -{{ end }} -` - - tmpl, err := template.New("api_level_type").Funcs(FuncMap()).Parse(tmplText) - if err != nil { - return "", fmt.Errorf("parse api level type template: %w", err) - } - var buf bytes.Buffer - if err := tmpl.Execute(&buf, data); err != nil { - return "", fmt.Errorf("execute api level type template: %w", err) - } - return buf.String(), nil -} - -// cleanStaleFiles removes generated .go files in outDir that are not in the written set. -func cleanStaleFiles(outDir string, written map[string]bool) error { - entries, err := os.ReadDir(outDir) - if err != nil { - return err - } - for _, e := range entries { - if e.IsDir() || !strings.HasSuffix(e.Name(), ".go") { - continue - } - if written[e.Name()] { - continue - } - // Only remove files that were generated by idiomgen. - path := filepath.Join(outDir, e.Name()) - content, err := os.ReadFile(path) - if err != nil { - continue - } - if strings.HasPrefix(string(content), generatedHeader) { - if err := os.Remove(path); err != nil { - return fmt.Errorf("remove stale %s: %w", e.Name(), err) - } - } - } - return nil -} - -// LoadSpec reads and parses a spec YAML file. -func LoadSpec(path string) (specmodel.Spec, error) { - data, err := os.ReadFile(path) - if err != nil { - return specmodel.Spec{}, err - } - var spec specmodel.Spec - if err := yaml.Unmarshal(data, &spec); err != nil { - return specmodel.Spec{}, err - } - return spec, nil -} - -// LoadOverlay reads and parses an overlay YAML file. -func LoadOverlay(path string) (overlaymodel.Overlay, error) { - data, err := os.ReadFile(path) - if err != nil { - return overlaymodel.Overlay{}, err - } - var ov overlaymodel.Overlay - if err := yaml.Unmarshal(data, &ov); err != nil { - return overlaymodel.Overlay{}, err - } - return ov, nil -} - -// LoadOverlayOrEmpty loads an overlay from path, or returns a zero-value Overlay if path is empty. -func LoadOverlayOrEmpty(path string) (overlaymodel.Overlay, error) { - if path == "" { - return overlaymodel.Overlay{}, nil - } - return LoadOverlay(path) -} - -// generateBridgeFiles renders bridge templates into the capi directory. -func generateBridgeFiles( - merged MergedSpec, - tmplDir string, - capiDir string, -) error { - if err := os.MkdirAll(capiDir, 0o755); err != nil { - return fmt.Errorf("mkdir capi: %w", err) - } - - // Extract C #include lines from existing .go files in capiDir. - cIncludes, err := extractCIncludes(capiDir) - if err != nil { - return fmt.Errorf("extract includes: %w", err) - } - - // Determine the capi package name from the directory name. - pkgName := filepath.Base(capiDir) - - data := BridgeData{ - PackageName: pkgName, - CIncludes: cIncludes, - CallbackStructs: merged.CallbackStructs, - StructAccessors: merged.StructAccessors, - Lifecycle: merged.Lifecycle, - ExtraBridgeC: merged.ExtraBridgeC, - ExtraBridgeGo: merged.ExtraBridgeGo, - } - - bridgeWritten := make(map[string]bool) - - // Render bridge files if there are callbacks, struct accessors, or generated bridge helpers. - if len(merged.CallbackStructs) > 0 || len(merged.StructAccessors) > 0 || merged.ExtraBridgeC != "" || merged.ExtraBridgeGo != "" { - bridgeTemplates := map[string]string{ - "bridge_registry.go": "bridge_registry.go.tmpl", - "bridge_c.go": "bridge_c.go.tmpl", - "bridge_export.go": "bridge_export.go.tmpl", - } - for outFile, tmplFile := range bridgeTemplates { - tmplPath := filepath.Join(tmplDir, tmplFile) - if _, statErr := os.Stat(tmplPath); os.IsNotExist(statErr) { - continue - } - - content, renderErr := RenderBridgeTemplate(tmplPath, data) - if renderErr != nil { - return fmt.Errorf("render %s: %w", tmplFile, renderErr) - } - - outPath := filepath.Join(capiDir, outFile) - if writeErr := os.WriteFile(outPath, []byte(content), 0o644); writeErr != nil { - return fmt.Errorf("write %s: %w", outFile, writeErr) - } - bridgeWritten[outFile] = true - } - } - - // Render lifecycle bridge files if lifecycle is configured. - if merged.Lifecycle != nil { - lifecycleTemplates := map[string]string{ - "bridge_lifecycle.go": "bridge_lifecycle.go.tmpl", - "bridge_lifecycle_export.go": "bridge_lifecycle_export.go.tmpl", - } - for outFile, tmplFile := range lifecycleTemplates { - tmplPath := filepath.Join(tmplDir, tmplFile) - if _, statErr := os.Stat(tmplPath); os.IsNotExist(statErr) { - continue - } - - content, renderErr := RenderBridgeTemplate(tmplPath, data) - if renderErr != nil { - return fmt.Errorf("render %s: %w", tmplFile, renderErr) - } - - outPath := filepath.Join(capiDir, outFile) - if writeErr := os.WriteFile(outPath, []byte(content), 0o644); writeErr != nil { - return fmt.Errorf("write %s: %w", outFile, writeErr) - } - bridgeWritten[outFile] = true - } - } - - // Clean stale bridge_*.go files. - if cleanErr := cleanStaleBridgeFiles(capiDir, bridgeWritten); cleanErr != nil { - return fmt.Errorf("cleanup bridge: %w", cleanErr) - } - - // Format generated bridge files. - for name := range bridgeWritten { - if err := formatGoFile(filepath.Join(capiDir, name)); err != nil { - return fmt.Errorf("format bridge: %w", err) - } - } - - return nil -} - -// extractCIncludes reads all .go files in dir and extracts #include lines from CGo preambles. -func extractCIncludes(dir string) ([]string, error) { - entries, err := os.ReadDir(dir) - if err != nil { - if os.IsNotExist(err) { - return nil, nil - } - return nil, err - } - - seen := make(map[string]bool) - var includes []string - - for _, e := range entries { - if e.IsDir() || !strings.HasSuffix(e.Name(), ".go") { - continue - } - // Skip bridge files to avoid reading our own generated includes. - if strings.HasPrefix(e.Name(), "bridge_") { - continue - } - - path := filepath.Join(dir, e.Name()) - fileIncludes, readErr := extractIncludesFromFile(path) - if readErr != nil { - continue - } - for _, inc := range fileIncludes { - if !seen[inc] { - seen[inc] = true - includes = append(includes, inc) - } - } - } - - return includes, nil -} - -// extractIncludesFromFile reads a Go source file and extracts #include lines -// from the CGo preamble (the comment block immediately preceding `import "C"`). -func extractIncludesFromFile(path string) ([]string, error) { - f, err := os.Open(path) - if err != nil { - return nil, err - } - defer func() { _ = f.Close() }() - - var includes []string - inComment := false - scanner := bufio.NewScanner(f) - for scanner.Scan() { - line := scanner.Text() - trimmed := strings.TrimSpace(line) - - if trimmed == "/*" { - inComment = true - continue - } - if trimmed == "*/" { - inComment = false - continue - } - if inComment && strings.HasPrefix(trimmed, "#include") { - includes = append(includes, trimmed) - } - } - - return includes, scanner.Err() -} - -// formatGoFile formats a single Go source file in place using go/format. -func formatGoFile(path string) error { - src, err := os.ReadFile(path) - if err != nil { - return fmt.Errorf("reading %s: %w", filepath.Base(path), err) - } - formatted, err := format.Source(src) - if err != nil { - return fmt.Errorf("formatting %s: %w", filepath.Base(path), err) - } - return os.WriteFile(path, formatted, 0o644) -} - -// formatGoFilesInDir formats all .go files in the given directory using go/format. -func formatGoFilesInDir(dir string) error { - entries, err := os.ReadDir(dir) - if err != nil { - return err - } - for _, e := range entries { - if e.IsDir() || !strings.HasSuffix(e.Name(), ".go") { - continue - } - if err := formatGoFile(filepath.Join(dir, e.Name())); err != nil { - return err - } - } - return nil -} - -// cleanStaleBridgeFiles removes bridge_*.go files in capiDir that are not in the written set. -func cleanStaleBridgeFiles(capiDir string, written map[string]bool) error { - entries, err := os.ReadDir(capiDir) - if err != nil { - return err - } - for _, e := range entries { - if e.IsDir() || !strings.HasSuffix(e.Name(), ".go") { - continue - } - if !strings.HasPrefix(e.Name(), "bridge_") { - continue - } - if written[e.Name()] { - continue - } - // Only remove files that were generated by idiomgen. - path := filepath.Join(capiDir, e.Name()) - content, readErr := os.ReadFile(path) - if readErr != nil { - continue - } - if strings.HasPrefix(string(content), generatedHeader) { - if removeErr := os.Remove(path); removeErr != nil { - return fmt.Errorf("remove stale bridge %s: %w", e.Name(), removeErr) - } - } - } - return nil -} diff --git a/tools/pkg/idiomgen/generate_test.go b/tools/pkg/idiomgen/generate_test.go deleted file mode 100644 index e028c7c..0000000 --- a/tools/pkg/idiomgen/generate_test.go +++ /dev/null @@ -1,416 +0,0 @@ -package idiomgen_test - -import ( - "os" - "path/filepath" - "strings" - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/idiomgen" - "github.com/AndroidGoLab/ndk/tools/pkg/overlaymodel" - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -func TestGenerate(t *testing.T) { - spec, overlay := buildFixture() - - tmplDir := filepath.Join("..", "..", "..", "templates") - // Verify templates directory exists before running. - if _, err := os.Stat(tmplDir); os.IsNotExist(err) { - t.Fatalf("templates dir not found at %s", tmplDir) - } - - outDir := t.TempDir() - - if err := idiomgen.Generate(spec, overlay, tmplDir, outDir); err != nil { - t.Fatalf("Generate: %v", err) - } - - // Verify shared output files exist. - sharedFiles := []string{ - "package.go", - "errors.go", - "functions.go", - } - for _, name := range sharedFiles { - path := filepath.Join(outDir, name) - info, err := os.Stat(path) - if err != nil { - t.Errorf("expected file %s: %v", name, err) - continue - } - if info.Size() == 0 { - t.Errorf("file %s is empty", name) - } - } - - // Verify per-type file exists for StreamBuilder. - sbPath := filepath.Join(outDir, "stream_builder.go") - if _, err := os.Stat(sbPath); err != nil { - t.Errorf("expected per-type file stream_builder.go: %v", err) - } - - // Verify per-type file contains struct + method. - sbContent, err := os.ReadFile(sbPath) - if err != nil { - t.Fatalf("read stream_builder.go: %v", err) - } - sbStr := string(sbContent) - if !strings.Contains(sbStr, "type StreamBuilder struct") { - t.Error("stream_builder.go missing 'type StreamBuilder struct'") - } - if !strings.Contains(sbStr, "SetDeviceID") { - t.Error("stream_builder.go missing 'SetDeviceID' method") - } - - // Verify per-enum file contains expected enum type. - dirPath := filepath.Join(outDir, "direction.go") - dirContent, err := os.ReadFile(dirPath) - if err != nil { - t.Fatalf("read direction.go: %v", err) - } - dirStr := string(dirContent) - if !strings.Contains(dirStr, "type Direction int32") { - t.Error("direction.go missing 'type Direction int32'") - } - if !strings.Contains(dirStr, "package audio") { - t.Error("direction.go missing 'package audio'") - } - - // Verify errors.go contains the error type. - errorsContent, err := os.ReadFile(filepath.Join(outDir, "errors.go")) - if err != nil { - t.Fatalf("read errors.go: %v", err) - } - errorsStr := string(errorsContent) - if !strings.Contains(errorsStr, "type Error int32") { - t.Error("errors.go missing 'type Error int32'") - } - if !strings.Contains(errorsStr, "func result[") { - t.Error("errors.go missing result() helper") - } -} - -func TestGenerate_APILevelSplitting(t *testing.T) { - spec, overlay := buildFixture() - - // Add a higher-API method to test splitting. - spec.Functions["AAudioStreamBuilder_setNewFeature"] = specmodel.FuncDef{ - CName: "AAudioStreamBuilder_setNewFeature", - Params: []specmodel.Param{ - {Name: "builder", Type: "*AAudioStreamBuilder"}, - {Name: "value", Type: "int32"}, - }, - } - overlay.Functions["AAudioStreamBuilder_setNewFeature"] = overlaymodel.FuncOverlay{ - Receiver: "StreamBuilder", - GoName: "SetNewFeature", - Chain: true, - } - overlay.APILevels["AAudioStreamBuilder_setNewFeature"] = 36 - - tmplDir := filepath.Join("..", "..", "..", "templates") - if _, err := os.Stat(tmplDir); os.IsNotExist(err) { - t.Fatalf("templates dir not found at %s", tmplDir) - } - - outDir := t.TempDir() - if err := idiomgen.Generate(spec, overlay, tmplDir, outDir); err != nil { - t.Fatalf("Generate: %v", err) - } - - // Base per-type file should have base methods but NOT the API-36 method. - sbPath := filepath.Join(outDir, "stream_builder.go") - sbContent, err := os.ReadFile(sbPath) - if err != nil { - t.Fatalf("read stream_builder.go: %v", err) - } - sbStr := string(sbContent) - if !strings.Contains(sbStr, "SetDeviceID") { - t.Error("stream_builder.go missing base method SetDeviceID") - } - if strings.Contains(sbStr, "SetNewFeature") { - t.Error("stream_builder.go must NOT contain API-36 method SetNewFeature") - } - - // API-36 file should exist with build tag and the higher-API method. - api36Path := filepath.Join(outDir, "stream_builder_api36.go") - api36Content, err := os.ReadFile(api36Path) - if err != nil { - t.Fatalf("expected stream_builder_api36.go: %v", err) - } - api36Str := string(api36Content) - if !strings.Contains(api36Str, "//go:build android_ndk36") { - t.Error("stream_builder_api36.go missing build tag") - } - if !strings.Contains(api36Str, "SetNewFeature") { - t.Error("stream_builder_api36.go missing API-36 method SetNewFeature") - } -} - -func TestGenerate_CameraMissingFeatureWrappers(t *testing.T) { - specPath := filepath.Join("..", "..", "..", "spec", "generated", "camera.yaml") - spec, err := idiomgen.LoadSpec(specPath) - if err != nil { - t.Fatalf("LoadSpec(%s): %v", specPath, err) - } - - overlayPath := filepath.Join("..", "..", "..", "spec", "overlays", "camera.yaml") - overlay, err := idiomgen.LoadOverlay(overlayPath) - if err != nil { - t.Fatalf("LoadOverlay(%s): %v", overlayPath, err) - } - - tmplDir := filepath.Join("..", "..", "..", "templates") - outDir := t.TempDir() - capiDir := filepath.Join(t.TempDir(), "camera") - - if err := idiomgen.Generate(spec, overlay, tmplDir, outDir, capiDir); err != nil { - t.Fatalf("Generate camera: %v", err) - } - - metadataContent, err := os.ReadFile(filepath.Join(outDir, "metadata.go")) - if err != nil { - t.Fatalf("read metadata.go: %v", err) - } - metadata := string(metadataContent) - for _, want := range []string{ - "func (h *Metadata) U8Count(tag uint32) int32", - "func (h *Metadata) U8At(tag uint32, idx int32) uint8", - "func (h *Metadata) FloatCount(tag uint32) int32", - "func (h *Metadata) FloatAt(tag uint32, idx int32) float32", - } { - if !strings.Contains(metadata, want) { - t.Errorf("metadata.go missing %q", want) - } - } - - sessionOutputContent, err := os.ReadFile(filepath.Join(outDir, "session_output.go")) - if err != nil { - t.Fatalf("read session_output.go: %v", err) - } - sessionOutput := string(sessionOutputContent) - for _, want := range []string{ - "func NewPhysicalSessionOutput(anw *ANativeWindow, physicalID string) (*SessionOutput, error)", - "capi.ACaptureSessionPhysicalOutput_create((*capi.ANativeWindow)(anw), physicalID, &outputPtr)", - } { - if !strings.Contains(sessionOutput, want) { - t.Errorf("session_output.go missing %q", want) - } - } - if strings.Contains(sessionOutput, "func NewSharedSessionOutput(") { - t.Error("session_output.go generated same-signature shared output factory") - } - - bridgeContent, err := os.ReadFile(filepath.Join(capiDir, "bridge_c.go")) - if err != nil { - t.Fatalf("read bridge_c.go: %v", err) - } - bridge := string(bridgeContent) - for _, want := range []string{ - "entry.data.u8[idx]", - "entry.data.f[idx]", - "func BridgeMetadataU8Count(metadata *ACameraMetadata, tag uint32) int32", - "func BridgeMetadataFloatAt(metadata *ACameraMetadata, tag uint32, idx int32) float32", - } { - if !strings.Contains(bridge, want) { - t.Errorf("bridge_c.go missing %q", want) - } - } -} - -func TestGenerate_MissingTemplate_Skipped(t *testing.T) { - spec, overlay := buildFixture() - - // Use an empty template directory; no templates means no output files, - // but Generate should not error. - tmplDir := t.TempDir() - outDir := t.TempDir() - - if err := idiomgen.Generate(spec, overlay, tmplDir, outDir); err != nil { - t.Fatalf("Generate with empty templates: %v", err) - } - - // Output dir should exist but contain no generated files. - entries, err := os.ReadDir(outDir) - if err != nil { - t.Fatalf("read outDir: %v", err) - } - if len(entries) != 0 { - t.Errorf("expected empty outDir, got %d entries", len(entries)) - } -} - -func TestLoadSpec(t *testing.T) { - yaml := `module: aaudio -source_package: github.com/AndroidGoLab/ndk/capi/aaudio -types: - AAudioStream: - kind: opaque_ptr - c_type: AAudioStream - go_type: "*C.AAudioStream" -enums: - Aaudio_direction_t: - - name: AAUDIO_DIRECTION_OUTPUT - value: 0 - - name: AAUDIO_DIRECTION_INPUT - value: 1 -functions: - AAudioStream_close: - c_name: AAudioStream_close - params: - - name: stream - type: "*AAudioStream" - returns: Aaudio_result_t -` - path := filepath.Join(t.TempDir(), "spec.yaml") - if err := os.WriteFile(path, []byte(yaml), 0o644); err != nil { - t.Fatal(err) - } - - spec, err := idiomgen.LoadSpec(path) - if err != nil { - t.Fatalf("LoadSpec: %v", err) - } - if spec.Module != "aaudio" { - t.Errorf("Module = %q, want %q", spec.Module, "aaudio") - } - if spec.SourcePackage != "github.com/AndroidGoLab/ndk/capi/aaudio" { - t.Errorf("SourcePackage = %q", spec.SourcePackage) - } - if len(spec.Types) != 1 { - t.Errorf("Types count = %d, want 1", len(spec.Types)) - } - if spec.Types["AAudioStream"].Kind != "opaque_ptr" { - t.Errorf("Types[AAudioStream].Kind = %q", spec.Types["AAudioStream"].Kind) - } - if len(spec.Enums) != 1 { - t.Errorf("Enums count = %d, want 1", len(spec.Enums)) - } - if len(spec.Functions) != 1 { - t.Errorf("Functions count = %d, want 1", len(spec.Functions)) - } -} - -func TestLoadSpec_FileNotFound(t *testing.T) { - _, err := idiomgen.LoadSpec("/nonexistent/spec.yaml") - if err == nil { - t.Fatal("expected error for nonexistent file") - } -} - -func TestLoadOverlay(t *testing.T) { - yaml := `module: aaudio -package: - go_name: audio - go_import: github.com/AndroidGoLab/ndk/audio - doc: "Package audio provides Go bindings for Android AAudio." -types: - AAudioStream: - go_name: Stream - pattern: ref_counted -functions: - AAudioStream_close: - receiver: Stream - go_name: Close -api_levels: - AAudioStream_close: 26 -` - path := filepath.Join(t.TempDir(), "overlay.yaml") - if err := os.WriteFile(path, []byte(yaml), 0o644); err != nil { - t.Fatal(err) - } - - ov, err := idiomgen.LoadOverlay(path) - if err != nil { - t.Fatalf("LoadOverlay: %v", err) - } - if ov.Module != "aaudio" { - t.Errorf("Module = %q, want %q", ov.Module, "aaudio") - } - if ov.Package.GoName != "audio" { - t.Errorf("Package.GoName = %q", ov.Package.GoName) - } - if ov.Package.GoImport != "github.com/AndroidGoLab/ndk/audio" { - t.Errorf("Package.GoImport = %q", ov.Package.GoImport) - } - if len(ov.Types) != 1 { - t.Errorf("Types count = %d, want 1", len(ov.Types)) - } - if ov.Types["AAudioStream"].GoName != "Stream" { - t.Errorf("Types[AAudioStream].GoName = %q", ov.Types["AAudioStream"].GoName) - } - if len(ov.Functions) != 1 { - t.Errorf("Functions count = %d, want 1", len(ov.Functions)) - } - if ov.APILevels["AAudioStream_close"] != 26 { - t.Errorf("APILevels[AAudioStream_close] = %d, want 26", ov.APILevels["AAudioStream_close"]) - } -} - -func TestLoadOverlay_FileNotFound(t *testing.T) { - _, err := idiomgen.LoadOverlay("/nonexistent/overlay.yaml") - if err == nil { - t.Fatal("expected error for nonexistent file") - } -} - -func TestLoadOverlayOrEmpty_EmptyPath(t *testing.T) { - ov, err := idiomgen.LoadOverlayOrEmpty("") - if err != nil { - t.Fatalf("LoadOverlayOrEmpty: %v", err) - } - if ov.Module != "" { - t.Errorf("Module = %q, want empty", ov.Module) - } -} - -func TestLoadOverlayOrEmpty_WithPath(t *testing.T) { - yaml := `module: test -package: - go_name: testpkg - go_import: github.com/AndroidGoLab/ndk/testpkg -` - path := filepath.Join(t.TempDir(), "overlay.yaml") - if err := os.WriteFile(path, []byte(yaml), 0o644); err != nil { - t.Fatal(err) - } - - ov, err := idiomgen.LoadOverlayOrEmpty(path) - if err != nil { - t.Fatalf("LoadOverlayOrEmpty: %v", err) - } - if ov.Module != "test" { - t.Errorf("Module = %q, want %q", ov.Module, "test") - } -} - -func TestGenerate_CreatesOutputDir(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{ - GoName: "testpkg", - GoImport: "github.com/AndroidGoLab/ndk/testpkg", - }, - } - - // Use a nested output dir that does not yet exist. - outDir := filepath.Join(t.TempDir(), "sub", "dir", "out") - tmplDir := t.TempDir() // empty templates dir - - if err := idiomgen.Generate(spec, overlay, tmplDir, outDir); err != nil { - t.Fatalf("Generate: %v", err) - } - - info, err := os.Stat(outDir) - if err != nil { - t.Fatalf("outDir does not exist: %v", err) - } - if !info.IsDir() { - t.Error("outDir is not a directory") - } -} diff --git a/tools/pkg/idiomgen/integration_test.go b/tools/pkg/idiomgen/integration_test.go deleted file mode 100644 index b44e814..0000000 --- a/tools/pkg/idiomgen/integration_test.go +++ /dev/null @@ -1,210 +0,0 @@ -package idiomgen_test - -import ( - "os" - "path/filepath" - "runtime" - "strings" - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/idiomgen" - "github.com/AndroidGoLab/ndk/tools/pkg/overlaymodel" - "github.com/AndroidGoLab/ndk/tools/pkg/specgen" -) - -// projectRoot returns the absolute path to the project root. -func projectRoot(t *testing.T) string { - t.Helper() - _, filename, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("unable to determine test file path") - } - // This file is at tools/pkg/idiomgen/integration_test.go, so go up three times. - return filepath.Join(filepath.Dir(filename), "..", "..", "..") -} - -// TestIntegration_FullPipeline runs the complete specgen -> idiomgen pipeline: -// -// 1. Parse the test fixture (specgen stage 2) -// 2. Write the spec to a temp file -// 3. Load the spec back from the temp file -// 4. Run idiomgen.Generate with the loaded spec, empty overlay, and real templates -// 5. Verify the output directory has generated files with expected content -func TestIntegration_FullPipeline(t *testing.T) { - root := projectRoot(t) - - // Stage 2 (specgen): Parse the test fixture. - fixturePath := filepath.Join(root, "tools", "pkg", "specgen", "testdata", "simple", "simple.go") - if _, err := os.Stat(fixturePath); err != nil { - t.Fatalf("fixture not found: %v", err) - } - - spec, err := specgen.ParseSources("simple", "github.com/AndroidGoLab/ndk/capi/simple", []string{fixturePath}) - if err != nil { - t.Fatalf("ParseSources: %v", err) - } - - // Verify the parsed spec is non-empty. - if len(spec.Types) == 0 { - t.Fatal("ParseSources returned empty Types") - } - if len(spec.Functions) == 0 { - t.Fatal("ParseSources returned empty Functions") - } - - // Write spec to temp file. - tmpDir := t.TempDir() - specPath := filepath.Join(tmpDir, "simple.yaml") - if err := specgen.WriteSpec(spec, specPath); err != nil { - t.Fatalf("WriteSpec: %v", err) - } - - // Verify the spec file was written. - info, err := os.Stat(specPath) - if err != nil { - t.Fatalf("spec file not found: %v", err) - } - if info.Size() == 0 { - t.Fatal("spec file is empty") - } - - // Load spec back (idiomgen input). - loadedSpec, err := idiomgen.LoadSpec(specPath) - if err != nil { - t.Fatalf("LoadSpec: %v", err) - } - - // Verify round-trip preserved data. - if loadedSpec.Module != "simple" { - t.Errorf("round-trip Module = %q, want %q", loadedSpec.Module, "simple") - } - if loadedSpec.SourcePackage != "github.com/AndroidGoLab/ndk/capi/simple" { - t.Errorf("round-trip SourcePackage = %q", loadedSpec.SourcePackage) - } - if len(loadedSpec.Types) != len(spec.Types) { - t.Errorf("round-trip Types count = %d, want %d", len(loadedSpec.Types), len(spec.Types)) - } - - // Stage 3 (idiomgen): Generate with empty overlay and real templates. - overlay := overlaymodel.Overlay{ - Module: "simple", - Package: overlaymodel.PackageOverlay{ - GoName: "simple", - GoImport: "github.com/AndroidGoLab/ndk/simple", - Doc: "Package simple is a test package.", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "FakeStream": { - GoName: "Stream", - Destructor: "FakeStream_close", - }, - "FakeBuilder": { - GoName: "Builder", - Constructor: "Fake_createBuilder", - Destructor: "FakeBuilder_delete", - Pattern: "builder", - }, - "Fake_result_t": { - GoError: true, - SuccessValue: "FAKE_OK", - ErrorPrefix: "fake", - }, - "Fake_direction_t": { - GoName: "Direction", - StripPrefix: "FAKE_DIRECTION_", - StringMethod: true, - }, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "FakeBuilder_setDeviceId": { - Receiver: "Builder", - GoName: "SetDeviceID", - Chain: true, - }, - "FakeBuilder_openStream": { - Receiver: "Builder", - GoName: "Open", - ReturnsNew: "Stream", - }, - "FakeStream_close": { - Receiver: "Stream", - GoName: "Close", - }, - "FakeStream_requestStart": { - Receiver: "Stream", - GoName: "Start", - }, - "FakeStream_getSampleRate": { - Receiver: "Stream", - GoName: "SampleRate", - Pure: true, - }, - }, - } - - tmplDir := filepath.Join(root, "templates") - if _, err := os.Stat(tmplDir); err != nil { - t.Fatalf("templates dir not found: %v", err) - } - - outDir := filepath.Join(tmpDir, "output") - if err := idiomgen.Generate(loadedSpec, overlay, tmplDir, outDir); err != nil { - t.Fatalf("Generate: %v", err) - } - - // Verify output directory has generated files. - entries, err := os.ReadDir(outDir) - if err != nil { - t.Fatalf("read output dir: %v", err) - } - if len(entries) == 0 { - t.Fatal("output directory is empty") - } - - generatedFiles := make(map[string]bool) - for _, e := range entries { - generatedFiles[e.Name()] = true - } - - sharedFiles := []string{"package.go", "errors.go", "functions.go"} - for _, name := range sharedFiles { - if !generatedFiles[name] { - t.Errorf("missing generated file %q", name) - } - } - - // Per-type files should exist. - expectedFiles := []string{"builder.go", "stream.go", "direction.go"} - for _, name := range expectedFiles { - if !generatedFiles[name] { - t.Errorf("missing per-type file %q", name) - } - } - - // direction.go should contain the Direction enum. - assertFileContains(t, filepath.Join(outDir, "direction.go"), "package simple", "package declaration") - assertFileContains(t, filepath.Join(outDir, "direction.go"), "type Direction int32", "Direction enum type") - assertFileContains(t, filepath.Join(outDir, "direction.go"), "Output", "stripped enum value") - - // errors.go should contain error type for Fake_result_t. - assertFileContains(t, filepath.Join(outDir, "errors.go"), "type Error int32", "error type") - - // Per-type files should contain opaque wrapper types and methods. - assertFileContains(t, filepath.Join(outDir, "builder.go"), "type Builder struct", "Builder opaque type") - assertFileContains(t, filepath.Join(outDir, "builder.go"), "SetDeviceID", "builder setter method") - assertFileContains(t, filepath.Join(outDir, "stream.go"), "type Stream struct", "Stream opaque type") - assertFileContains(t, filepath.Join(outDir, "stream.go"), "SampleRate", "getter method") -} - -// assertFileContains reads a file and checks that it contains the expected substring. -func assertFileContains(t *testing.T, path, expected, description string) { - t.Helper() - data, err := os.ReadFile(path) - if err != nil { - t.Errorf("read %s: %v", filepath.Base(path), err) - return - } - if !strings.Contains(string(data), expected) { - t.Errorf("%s: %s does not contain %q", filepath.Base(path), description, expected) - } -} diff --git a/tools/pkg/idiomgen/merge.go b/tools/pkg/idiomgen/merge.go deleted file mode 100644 index 426bdb6..0000000 --- a/tools/pkg/idiomgen/merge.go +++ /dev/null @@ -1,2097 +0,0 @@ -package idiomgen - -import ( - "fmt" - "math" - "sort" - "strings" - "unicode" - - "github.com/AndroidGoLab/ndk/tools/pkg/capigen" - "github.com/AndroidGoLab/ndk/tools/pkg/overlaymodel" - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -// capiExportName returns the exported Go name that capigen generates for a C symbol. -func capiExportName(cName string) string { - return capigen.ExportName(cName) -} - -// capiExportType applies capiExportName to the base type name of a spec type, -// handling pointer and slice prefixes. Scalar Go types are left unchanged. -// E.g. "*camera_status_t" → "*Camera_status_t", "*int32" → "*int32". -func capiExportType(specType string) string { - if specType == "" || specType == "unsafe.Pointer" || specType == "string" || specType == "bool" { - return specType - } - if isScalarGoType(specType) { - return specType - } - if strings.HasPrefix(specType, "[]") { - elem := specType[2:] - if isScalarGoType(elem) { - return specType - } - return "[]" + capiExportName(elem) - } - stars := "" - base := specType - for strings.HasPrefix(base, "*") { - stars += "*" - base = base[1:] - } - if base == "" || base == "unsafe.Pointer" || base == "string" || base == "bool" || isScalarGoType(base) { - return specType - } - return stars + capiExportName(base) -} - -// exportName capitalizes the first letter of a string to make it an exported Go name. -func exportName(s string) string { - if s == "" { - return s - } - return strings.ToUpper(s[:1]) + s[1:] -} - -// isScalarGoType returns true for Go scalar types. -func isScalarGoType(t string) bool { - switch t { - case "int8", "uint8", "int16", "uint16", "int32", "uint32", - "int64", "uint64", "float32", "float64", "bool", "int", "uint": - return true - } - return false -} - -// inferEnumType checks whether an int32 param's name matches a value enum -// GoName in this module. If so, returns the enum GoName; otherwise returns -// goType unchanged. This replaces bare int32 with typed enums like sensor.Type. -func inferEnumType( - specParamName string, - goType string, - enumGoNames map[string]bool, -) string { - if goType != "int32" || specParamName == "" { - return goType - } - - candidate := strings.ToUpper(specParamName[:1]) + specParamName[1:] - candidate = fixGoAcronyms(candidate) - if enumGoNames[candidate] { - return candidate - } - - return goType -} - -// autoGoTypeName derives an idiomatic Go type name from a C/spec type name. -// It strips the common Android NDK "A" prefix when followed by an uppercase -// letter: "AImageReader" → "ImageReader", "ALooper" → "Looper". -// Names without that pattern are kept as-is: "GLenum" stays "GLenum". -func autoGoTypeName(specName string) string { - // Strip leading "A" if followed by uppercase (Android NDK convention). - if len(specName) >= 2 && specName[0] == 'A' && unicode.IsUpper(rune(specName[1])) { - return specName[1:] - } - return specName -} - -// isDestructorFunc returns true if funcName matches common destructor patterns -// for the given spec type name: TypeName_delete, TypeName_free, -// TypeName_destroy, TypeName_release, TypeName_close. -// -// Proven disjoint with isConstructorFunc for all type names -// (proofs/Proofs/ConstructorDestructor.lean). -// Differential tested against Lean oracle. -func isDestructorFunc(funcName, specTypeName string) bool { - for _, suffix := range []string{"_delete", "_free", "_destroy", "_release", "_close"} { - if funcName == specTypeName+suffix { - return true - } - } - return false -} - -// destructorPriority returns a priority value for destructor suffix ordering. -// Higher values indicate preferred destructor names. -func destructorPriority(funcName string) int { - switch { - case strings.HasSuffix(funcName, "_release"): - return 5 - case strings.HasSuffix(funcName, "_delete"): - return 4 - case strings.HasSuffix(funcName, "_free"): - return 3 - case strings.HasSuffix(funcName, "_destroy"): - return 2 - case strings.HasSuffix(funcName, "_close"): - return 1 - default: - return 0 - } -} - -// isConstructorFunc returns true if funcName matches common constructor patterns -// for the given spec type name: TypeName_create, TypeName_new. -// Also matches ModuleName_createTypeName patterns (e.g. AAudio_createStreamBuilder). -// -// Proven disjoint with isDestructorFunc for all type names -// (proofs/Proofs/ConstructorDestructor.lean). -// Differential tested against Lean oracle. -func isConstructorFunc(funcName, specTypeName string) bool { - for _, suffix := range []string{"_create", "_new"} { - if funcName == specTypeName+suffix { - return true - } - } - return false -} - -// autoDetectReceiver tries to find the best opaque type receiver for a function -// based on the function name prefix and first parameter type. -// Returns the Go name of the receiver type, or "" if no receiver can be detected. -func autoDetectReceiver( - funcName string, - fd specmodel.FuncDef, - opaqueSpecNames map[string]bool, - specToGoName map[string]string, -) string { - // Strategy 1: Match function name prefix against known opaque type names. - // E.g. "ASensor_getName" matches "ASensor" if ASensor is an opaque type. - // Try longest match first to handle types like "ASensorEventQueue" vs "ASensor". - type candidate struct { - specName string - goName string - } - var candidates []candidate - for specName := range opaqueSpecNames { - prefix := specName + "_" - if strings.HasPrefix(funcName, prefix) { - candidates = append(candidates, candidate{specName, specToGoName[specName]}) - } - } - // Sort by spec name length descending (longest prefix first). - sort.Slice(candidates, func(i, j int) bool { - return len(candidates[i].specName) > len(candidates[j].specName) - }) - - if len(candidates) > 0 { - // Verify the first param is a pointer to this type. - best := candidates[0] - if len(fd.Params) > 0 { - firstParamBase := strings.TrimPrefix(fd.Params[0].Type, "*") - if firstParamBase == best.specName && fd.Params[0].Direction != "out" { - return best.goName - } - } - } - - // Strategy 2: If the first param is a pointer to a known opaque type, - // use that as receiver. - if len(fd.Params) > 0 && strings.HasPrefix(fd.Params[0].Type, "*") && fd.Params[0].Direction != "out" { - firstParamBase := strings.TrimPrefix(fd.Params[0].Type, "*") - if opaqueSpecNames[firstParamBase] { - return specToGoName[firstParamBase] - } - } - - return "" -} - -// autoFuncGoName derives a Go function/method name from a C function name. -// For methods, it strips the receiver's spec type prefix and capitalizes. -// For free functions, it strips a common module prefix if present. -func autoFuncGoName(funcName, receiverSpecName string) string { - if receiverSpecName != "" { - prefix := receiverSpecName + "_" - if strings.HasPrefix(funcName, prefix) { - suffix := funcName[len(prefix):] - if len(suffix) > 0 { - return fixGoAcronyms(strings.ToUpper(suffix[:1]) + suffix[1:]) - } - } - } - // For free functions or unmatched methods, capitalize the function name. - return fixGoAcronyms(strings.ToUpper(funcName[:1]) + funcName[1:]) -} - -// isAutoGeneratable returns true if a function can be safely auto-generated -// without overlay annotations. Functions with out-params, non-scalar return -// types (except known opaque types and void), or parameters with types that -// can't be auto-resolved are not safe to auto-generate. -func isAutoGeneratable(fd specmodel.FuncDef, opaqueSpecNames map[string]bool) bool { - // Functions with out-params need output_params overlay annotations. - if hasOutParams(fd) { - return false - } - - // Functions returning pointers to unknown types (not opaque, not scalar) - // can't be auto-generated because the template can't wrap them correctly. - if strings.HasPrefix(fd.Returns, "*") { - base := strings.TrimPrefix(fd.Returns, "*") - if !opaqueSpecNames[base] && !isScalarGoType(base) { - return false - } - } - - // Functions returning non-scalar, non-void, non-pointer types (like structs) - // can't be auto-generated. - ret := fd.Returns - if ret != "" && ret != "void" && ret != "string" && ret != "bool" && - ret != "unsafe.Pointer" && !isScalarGoType(ret) && - !strings.HasPrefix(ret, "*") { - return false - } - - // Functions with callback-type parameters (non-pointer, non-scalar types) - // can't be auto-generated without overlay annotations. - for _, p := range fd.Params { - base := p.Type - for strings.HasPrefix(base, "*") { - base = base[1:] - } - if base == "unsafe.Pointer" || base == "string" || base == "bool" || - base == "byte" || isScalarGoType(base) || base == "" { - continue - } - // Opaque pointer params are handled (as handles or receivers). - if strings.HasPrefix(p.Type, "*") && opaqueSpecNames[base] { - continue - } - // Non-pointer, non-scalar type — likely a callback func type or - // struct value that the template can't handle. - if !strings.HasPrefix(p.Type, "*") { - return false - } - } - - return true -} - -// hasOutParams returns true if any parameter has direction "out". -func hasOutParams(fd specmodel.FuncDef) bool { - for _, p := range fd.Params { - if p.Direction == "out" { - return true - } - } - return false -} - -// isAutoDetectedPure returns true if a function's return type indicates it -// should be treated as a "pure" getter (return value directly) rather than -// an error-returning function. This is used for auto-generated methods -// where no overlay specifies the pattern. -// -// Pure: string, bool, float*, uint64, int64, unsafe.Pointer, *scalar. -// Not pure: int32 (might be an error code), error types, void, -// pointers to opaque types (need struct wrapping via ReturnsNew). -func isAutoDetectedPure(returns string, errorTypes map[string]bool) bool { - switch { - case returns == "" || returns == "void": - return false - case errorTypes[returns]: - return false - case returns == "string" || returns == "bool": - return true - case returns == "float32" || returns == "float64": - return true - case returns == "int64" || returns == "uint64": - return true - case returns == "unsafe.Pointer": - return true - case strings.HasPrefix(returns, "*"): - // Pointers to scalar types (e.g., *uint8) are safe for pure. - base := strings.TrimPrefix(returns, "*") - return isScalarGoType(base) - default: - // int32, uint32 — might be error codes, treat as error-returning. - return false - } -} - -// Merge combines a specmodel.Spec and overlaymodel.Overlay into a fully -// resolved MergedSpec ready for template rendering. -func Merge(spec specmodel.Spec, overlay overlaymodel.Overlay) MergedSpec { - m := MergedSpec{ - PackageName: overlay.Package.GoName, - PackageImport: overlay.Package.GoImport, - PackageDoc: overlay.Package.Doc, - SourcePackage: spec.SourcePackage, - OpaqueTypes: make(map[string]MergedOpaqueType), - APILevels: overlay.APILevels, - } - if m.APILevels == nil { - m.APILevels = make(map[string]int) - } - - // Build error type set for determining destructor return types. - errorTypes := make(map[string]bool) - for eName, tov := range overlay.Types { - if tov.GoError { - errorTypes[eName] = true - } - } - - // typeMap resolves spec type names to Go type names. - typeMap := make(map[string]string) - - // Build set of value enum GoNames for param-name-based enum inference. - // Constructed early so constructor params can also benefit. - // Includes both spec enums and overlay extra_enums (which may define - // enum types that don't exist in the generated spec). - enumGoNames := make(map[string]bool) - allEnumNames := make(map[string]bool) - for name := range spec.Enums { - allEnumNames[name] = true - } - for name := range overlay.ExtraEnums { - allEnumNames[name] = true - } - for enumName := range allEnumNames { - tov := overlay.Types[enumName] - if tov.GoError { - continue - } - goName := tov.GoName - if goName == "" { - goName = autoGoTypeName(enumName) - } - enumGoNames[goName] = true - } - - // Build set of types that are callback structs or struct accessors (not opaque handles). - bridgeStructTypes := make(map[string]bool) - for specName := range overlay.CallbackStructs { - bridgeStructTypes[specName] = true - } - for specName := range overlay.StructAccessors { - bridgeStructTypes[specName] = true - } - - // specToGoName maps spec type names to Go type names for all opaque types. - // Built during opaque type processing, used for auto-receiver detection. - specToGoName := make(map[string]string) - - // Build opaque spec name set for handle detection. - // Auto-include ALL opaque_ptr types (not just those with overlays). - // Exclude transparent types — they are type aliases, not struct wrappers. - opaqueSpecNames := make(map[string]bool) - for specName, td := range spec.Types { - if td.Kind != "opaque_ptr" { - continue - } - if bridgeStructTypes[specName] { - continue - } - tov := overlay.Types[specName] - if tov.Transparent { - continue - } - opaqueSpecNames[specName] = true - } - - // Value struct types also need to be in opaqueSpecNames so that - // capiArg calls .cptr() on value struct params in merged functions. - // Build a separate set for value struct detection in output params. - valueStructSpecNames := make(map[string]bool) - for specName, tov := range overlay.Types { - if tov.ValueStruct { - opaqueSpecNames[specName] = true - valueStructSpecNames[specName] = true - } - } - - // Auto-detect destructors and constructors from spec function names. - // These are used when the overlay doesn't specify them explicitly. - // Functions with explicit overlay entries are NOT auto-claimed, because - // the overlay takes precedence over auto-detection. - // Functions above BaseAPILevel are also skipped, because the generated - // constructor/destructor would go into the base file without build tags. - autoDestructors := make(map[string]string) // spec type name → destructor func name - autoConstructors := make(map[string]string) // spec type name → constructor func name - for funcName, fd := range spec.Functions { - // Skip functions that have explicit overlay entries — the overlay - // author decided what this function should be. - if _, hasOverlay := overlay.Functions[funcName]; hasOverlay { - continue - } - // Skip higher-API-level functions — their constructor/destructor code - // would be generated without build tags, causing compilation failures. - if overlay.APILevels != nil && overlay.APILevels[funcName] > capigen.BaseAPILevel { - continue - } - for specName := range opaqueSpecNames { - if isDestructorFunc(funcName, specName) { - // Prefer _release > _delete > _free > _destroy > _close for - // auto-detection. Higher-priority suffixes overwrite lower ones. - existing := autoDestructors[specName] - if existing == "" || destructorPriority(funcName) > destructorPriority(existing) { - autoDestructors[specName] = funcName - } - } - if isConstructorFunc(funcName, specName) { - if fd.Returns == "" || fd.Returns == "void" { - // Constructor that doesn't return anything — check for out-param. - hasOutParam := false - for _, p := range fd.Params { - if p.Direction == "out" { - hasOutParam = true - break - } - } - if !hasOutParam { - continue - } - } - autoConstructors[specName] = funcName - } - } - } - - // Build opaque types and populate typeMap for pointer types. - // Process ALL opaque_ptr types, not just those with overlay entries. - for _, specName := range sortedKeys(spec.Types) { - td := spec.Types[specName] - if td.Kind != "opaque_ptr" { - continue - } - if bridgeStructTypes[specName] { - continue - } - tov, hasOverlay := overlay.Types[specName] - - // Determine Go name: overlay takes precedence, then auto-naming. - goName := "" - switch { - case hasOverlay && tov.GoName != "": - goName = tov.GoName - case hasOverlay: - goName = specName - default: - goName = autoGoTypeName(specName) - } - - specToGoName[specName] = goName - - // Transparent types become simple type aliases (no struct wrapper). - // Used for void* typedefs like EGLDisplay that are value types in Go. - if hasOverlay && tov.Transparent { - m.TypeAliases = append(m.TypeAliases, MergedTypeAlias{ - GoName: goName, - CapiType: capiExportName(specName), - }) - typeMap[specName] = goName - typeMap["*"+specName] = "*" + goName - continue - } - - // Value struct types are handled separately — they get exported Go - // fields instead of an opaque pointer wrapper. - if hasOverlay && tov.ValueStruct { - typeMap[specName] = goName - typeMap["*"+specName] = "*" + goName - continue - } - - // Resolve destructor: overlay takes precedence, then auto-detected. - destructor := "" - if hasOverlay && tov.Destructor != "" { - destructor = tov.Destructor - } else if d, ok := autoDestructors[specName]; ok { - destructor = d - } - - // Resolve constructor: overlay takes precedence, then auto-detected. - constructor := "" - if hasOverlay && tov.Constructor != "" { - constructor = tov.Constructor - } else if c, ok := autoConstructors[specName]; ok { - constructor = c - } - - destructorReturnsError := false - if destructor != "" { - if fd, ok := spec.Functions[destructor]; ok { - destructorReturnsError = errorTypes[fd.Returns] - } - } - constructorReturnsPointer := false - var constructorParams []MergedParam - if constructor != "" { - if fd, ok := spec.Functions[constructor]; ok { - constructorReturnsPointer = strings.HasPrefix(fd.Returns, "*") - ctorParamIdx := 0 - for _, p := range fd.Params { - if p.Direction == "out" { - continue - } - goType := resolveType(p.Type, typeMap) - goType = inferEnumType(p.Name, goType, enumGoNames) - remapped := goType != resolveType(p.Type, typeMap) - isString := p.Type == "*byte" - if isString { - goType = "string" - } - baseType := strings.TrimPrefix(p.Type, "*") - isHandle := strings.HasPrefix(p.Type, "*") && opaqueSpecNames[baseType] - if isHandle { - goType = "unsafe.Pointer" - } - capiType := capiExportType(p.Type) - if isFixedArrayGoType(goType) { - goType = "*" + goType - capiType = "*" + capiType - } - constructorParams = append(constructorParams, MergedParam{ - Name: safeGoParamName(p.Name, ctorParamIdx), - GoType: goType, - CapiType: capiType, - Remapped: remapped, - IsString: isString, - IsHandle: isHandle, - }) - ctorParamIdx++ - } - } - } - exportedConstructor := "" - if constructor != "" { - exportedConstructor = capiExportName(constructor) - } - exportedDestructor := "" - if destructor != "" { - exportedDestructor = capiExportName(destructor) - } - - pattern := "" - var interfaces []string - if hasOverlay { - pattern = tov.Pattern - interfaces = tov.Interfaces - } - - m.OpaqueTypes[goName] = MergedOpaqueType{ - GoName: goName, - CapiType: capiExportName(specName), - Constructor: exportedConstructor, - ConstructorReturnsPointer: constructorReturnsPointer, - ConstructorParams: constructorParams, - Destructor: exportedDestructor, - DestructorReturnsError: destructorReturnsError, - Pattern: pattern, - Interfaces: interfaces, - } - typeMap["*"+specName] = "*" + goName - } - - // Pre-processing: link overlay enum sources to spec enums. - // When an overlay type has enum_source, copy the spec enum values - // to spec.Enums[overlayKey] so the existing merge logic finds them. - // This handles NDK's pattern of separate `typedef int32_t foo_t;` - // and `enum { FOO_X, FOO_Y };` where the typedef and enum have - // different names. - if spec.Enums == nil { - spec.Enums = make(map[string][]specmodel.EnumValue) - } - for typeName, tov := range overlay.Types { - if tov.EnumSource == "" { - continue - } - if vals, ok := spec.Enums[tov.EnumSource]; ok { - spec.Enums[typeName] = vals - } - } - - // Merge extra enum values from the overlay into the spec enums. - // When the spec has macros, auto-resolve values from headers instead - // of relying on manually specified values in the overlay. - // This must happen before the type alias loop so that extra_enums-only - // types (like MetadataTag) are recognized as enums, not type aliases. - consumedMacros := make(map[string]bool) - for enumName, extras := range overlay.ExtraEnums { - for _, ev := range extras { - value := ev.Value - if macroVal, ok := spec.Macros[ev.Name]; ok { - value = macroVal - consumedMacros[ev.Name] = true - } - spec.Enums[enumName] = append(spec.Enums[enumName], specmodel.EnumValue{ - Name: ev.Name, - Value: value, - }) - } - } - - // Also consume macros that already appear in spec enums (from real C enums). - for _, vals := range spec.Enums { - for _, v := range vals { - consumedMacros[v.Name] = true - } - } - - // Store unconsumed macros for generation as untyped constants. - m.UntypedMacros = make(map[string]int64) - for name, value := range spec.Macros { - if !consumedMacros[name] { - m.UntypedMacros[name] = value - } - } - - // Build type aliases for typedef and pointer_handle types. - for _, specName := range sortedKeys(spec.Types) { - td := spec.Types[specName] - if td.Kind == "opaque_ptr" { - continue // Already handled above as OpaqueTypes. - } - if !isTypedefKind(td.Kind) { - continue - } - // Skip function pointer typedefs and other non-Go types - // (capigen skips these too). - baseType := strings.TrimPrefix(td.Kind, "typedef_") - if strings.Contains(baseType, ":") { - continue - } - // Skip if this type is classified as an enum (has spec enum values and - // either has an overlay entry or will be auto-generated as a value enum). - if _, isEnum := spec.Enums[specName]; isEnum { - continue - } - goName := specName - if tov, ok := overlay.Types[specName]; ok && tov.GoName != "" { - goName = tov.GoName - } - m.TypeAliases = append(m.TypeAliases, MergedTypeAlias{ - GoName: goName, - CapiType: capiExportName(specName), - }) - typeMap[specName] = goName - typeMap["*"+specName] = "*" + goName - } - - // Classify enums: error vs. value. - // Process ALL enums in the spec, not just those with overlay entries. - // Overlay entries customize naming; auto-generation uses defaults. - enumNames := sortedKeys(spec.Enums) - for _, enumName := range enumNames { - tov, hasOverlay := overlay.Types[enumName] - values := spec.Enums[enumName] - - if hasOverlay && tov.GoError { - m.ErrorEnums = append(m.ErrorEnums, mergeErrorEnum(enumName, tov, values)) - typeMap[enumName] = "Error" - typeMap["*"+enumName] = "*Error" - } else { - goName := "" - switch { - case hasOverlay && tov.GoName != "": - goName = tov.GoName - case hasOverlay: - goName = enumName - default: - goName = autoGoTypeName(enumName) - } - // Use overlay settings if available, otherwise empty TypeOverlay for defaults. - enumOverlay := tov - baseType := kindToBaseType(spec.Types[enumName].Kind) - m.ValueEnums = append(m.ValueEnums, mergeValueEnum(enumName, goName, baseType, enumOverlay, values)) - typeMap[enumName] = goName - typeMap["*"+enumName] = "*" + goName - } - } - - // Build value structs from overlay annotations + spec struct definitions. - for _, specName := range sortedKeys(overlay.Types) { - tov := overlay.Types[specName] - if !tov.ValueStruct { - continue - } - sd, ok := spec.Structs[specName] - if !ok { - continue - } - goName := tov.GoName - if goName == "" { - goName = specName - } - capiType := capiExportName(specName) - var fields []MergedValueStructField - for _, sf := range sd.Fields { - fields = append(fields, MergedValueStructField{ - GoName: exportName(sf.Name), - CName: sf.Name, - GoType: sf.Type, - CapiType: sf.Type, - }) - } - m.ValueStructs = append(m.ValueStructs, MergedValueStruct{ - GoName: goName, - CapiType: capiType, - Fields: fields, - }) - } - - // Build callback annotation lookup by cross-referencing function overlays - // with spec function parameters to find which callback type each overlay targets. - cbAnnotations := make(map[string]callbackAnnotation) - for fname, fov := range overlay.Functions { - if fov.CallbackParam == "" || fov.GoCallbackType == "" { - continue - } - if fd, ok := spec.Functions[fname]; ok { - for _, p := range fd.Params { - if p.Name == fov.CallbackParam { - cbAnnotations[p.Type] = callbackAnnotation{ - goType: fov.GoCallbackType, - goSig: fov.GoCallbackSig, - } - typeMap[p.Type] = fov.GoCallbackType - break - } - } - } - } - - // Build receiver capi type lookup for GoName auto-derivation. - receiverCapiTypes := make(map[string]string) // Go name → capi type - for _, ot := range m.OpaqueTypes { - receiverCapiTypes[ot.GoName] = ot.CapiType - } - - // Auto-generate type aliases for types used in function params/returns - // that aren't in the typeMap yet. This covers cross-module types (off_t, - // ANativeWindow, etc.) and callback types without explicit overlay entries. - autoAliasTypes := collectUnresolvedFuncTypes(spec, overlay, typeMap, opaqueSpecNames, specToGoName) - for _, typeName := range sortedKeys(autoAliasTypes) { - // If this cross-module type has an overlay entry with a go_name, - // create a handle struct instead of a simple type alias. - // This handles cases like ANativeWindow in surfacetexture where the - // overlay wants go_name: NativeWindow to create a proper wrapper struct. - if tov, ok := overlay.Types[typeName]; ok && tov.GoName != "" { - goName := tov.GoName - if tov.Transparent { - // Transparent types become simple type aliases, not struct wrappers. - m.TypeAliases = append(m.TypeAliases, MergedTypeAlias{ - GoName: goName, - CapiType: capiExportName(typeName), - }) - typeMap[typeName] = goName - typeMap["*"+typeName] = "*" + goName - continue - } - m.OpaqueTypes[goName] = MergedOpaqueType{ - GoName: goName, - CapiType: capiExportName(typeName), - } - typeMap["*"+typeName] = "*" + goName - opaqueSpecNames[typeName] = true - continue - } - goName := capiExportName(typeName) - m.TypeAliases = append(m.TypeAliases, MergedTypeAlias{ - GoName: goName, - CapiType: capiExportName(typeName), - }) - typeMap[typeName] = goName - typeMap["*"+typeName] = "*" + goName - } - - // Build a set of functions that are already claimed as constructors or - // destructors, so they are not also emitted as regular methods. - // Also claim ALL destructor-like functions (even non-winners) to prevent - // them from generating methods that conflict with the Close() destructor. - claimedFuncs := make(map[string]bool) - for specName := range opaqueSpecNames { - tov := overlay.Types[specName] - destructor := "" - switch { - case tov.Destructor != "": - destructor = tov.Destructor - default: - destructor = autoDestructors[specName] - } - if destructor != "" { - claimedFuncs[destructor] = true - } - constructor := "" - switch { - case tov.Constructor != "": - constructor = tov.Constructor - default: - constructor = autoConstructors[specName] - } - if constructor != "" { - claimedFuncs[constructor] = true - } - - // Claim ALL destructor-like and constructor-like functions for this - // type, not just the chosen one. This prevents auto-generating methods - // like Close() that would conflict with the destructor's Close(). - // But do NOT claim functions that have explicit overlay entries — - // the overlay author controls those. - for funcName := range spec.Functions { - if _, hasOverlay := overlay.Functions[funcName]; hasOverlay { - continue - } - if isDestructorFunc(funcName, specName) || isConstructorFunc(funcName, specName) { - claimedFuncs[funcName] = true - } - } - } - - // Resolve functions → methods or free functions. - // Process ALL spec functions, not just those with overlay entries. - // Overlay entries customize behavior; auto-generation uses defaults. - funcNames := sortedKeys(spec.Functions) - for _, funcName := range funcNames { - fd := spec.Functions[funcName] - fov, hasOverlay := overlay.Functions[funcName] - - // If explicitly skipped in overlay, skip. - if hasOverlay && fov.Skip { - continue - } - - // Skip functions claimed as constructors/destructors. - if claimedFuncs[funcName] { - continue - } - - if hasOverlay { - // Overlay-directed processing (original behavior). - switch { - case fov.Receiver != "": - m.Methods = append(m.Methods, mergeMethod(funcName, fd, fov, overlay.APILevels, typeMap, enumGoNames, receiverCapiTypes, opaqueSpecNames, overlay.CallbackStructs, overlay.StructAccessors, valueStructSpecNames)) - case fov.GoName != "": - m.FreeFunctions = append(m.FreeFunctions, mergeFreeFunction(funcName, fd, fov, overlay.APILevels, typeMap, enumGoNames, opaqueSpecNames, valueStructSpecNames)) - } - } else { - // Auto-generate: detect receiver and derive Go name. - receiver := autoDetectReceiver(funcName, fd, opaqueSpecNames, specToGoName) - switch { - case receiver != "": - // Skip auto-generation for functions that would produce - // invalid code without overlay annotations. - if !isAutoGeneratable(fd, opaqueSpecNames) { - break - } - - // Find the spec type name for this receiver to derive the method name. - receiverSpecName := "" - for sn, gn := range specToGoName { - if gn == receiver { - receiverSpecName = sn - break - } - } - goName := autoFuncGoName(funcName, receiverSpecName) - autoFov := overlaymodel.FuncOverlay{ - Receiver: receiver, - GoName: goName, - } - // Auto-detect Pure for functions that return non-error types. - autoFov.Pure = isAutoDetectedPure(fd.Returns, errorTypes) - - // For methods returning a pointer to a known opaque type - // in this module, use ReturnsNew instead of Pure, because - // the template needs to wrap the capi pointer in a Go struct. - returnBase := strings.TrimPrefix(fd.Returns, "*") - if strings.HasPrefix(fd.Returns, "*") && opaqueSpecNames[returnBase] { - autoFov.Pure = false - autoFov.ReturnsNew = specToGoName[returnBase] - } - - m.Methods = append(m.Methods, mergeMethod(funcName, fd, autoFov, overlay.APILevels, typeMap, enumGoNames, receiverCapiTypes, opaqueSpecNames, overlay.CallbackStructs, overlay.StructAccessors, valueStructSpecNames)) - - default: - if autoFov, ok := detectOutputFactory(funcName, fd, spec.Functions, errorTypes, opaqueSpecNames, specToGoName); ok { - m.FreeFunctions = append(m.FreeFunctions, mergeFreeFunction(funcName, fd, autoFov, overlay.APILevels, typeMap, enumGoNames, opaqueSpecNames, valueStructSpecNames)) - break - } - - // Skip auto-generation for free functions that would produce - // invalid code without overlay annotations. - if !isAutoGeneratable(fd, opaqueSpecNames) { - break - } - - // Package-level free function. - goName := autoFuncGoName(funcName, "") - autoFov := overlaymodel.FuncOverlay{ - GoName: goName, - } - m.FreeFunctions = append(m.FreeFunctions, mergeFreeFunction(funcName, fd, autoFov, overlay.APILevels, typeMap, enumGoNames, opaqueSpecNames, valueStructSpecNames)) - } - } - } - - // Resolve bridge functions defined only in the overlay (with bridge_params). - for _, funcName := range sortedKeys(overlay.Functions) { - if _, inSpec := spec.Functions[funcName]; inSpec { - continue - } - fov := overlay.Functions[funcName] - if fov.Skip || len(fov.BridgeParams) == 0 { - continue - } - var params []specmodel.Param - for _, bp := range fov.BridgeParams { - params = append(params, specmodel.Param{Name: bp.Name, Type: bp.Type}) - } - fd := specmodel.FuncDef{ - CName: funcName, - Params: params, - Returns: fov.BridgeReturns, - } - switch { - case fov.Receiver != "": - m.Methods = append(m.Methods, mergeMethod(funcName, fd, fov, overlay.APILevels, typeMap, enumGoNames, receiverCapiTypes, opaqueSpecNames, overlay.CallbackStructs, overlay.StructAccessors, valueStructSpecNames)) - case fov.GoName != "": - m.FreeFunctions = append(m.FreeFunctions, mergeFreeFunction(funcName, fd, fov, overlay.APILevels, typeMap, enumGoNames, opaqueSpecNames, valueStructSpecNames)) - } - } - - // Resolve callbacks. - cbNames := sortedKeys(spec.Callbacks) - for _, cbName := range cbNames { - cbd := spec.Callbacks[cbName] - m.Callbacks = append(m.Callbacks, mergeCallback(cbName, cbd, cbAnnotations)) - } - - // Generate type aliases for callback structs so idiomatic packages re-export them. - for _, specName := range sortedKeys(overlay.CallbackStructs) { - csov := overlay.CallbackStructs[specName] - m.CallbackStructAliases = append(m.CallbackStructAliases, MergedTypeAlias{ - GoName: csov.GoName, - CapiType: csov.GoName, // bridge generates Go struct with GoName in the capi package - }) - } - - // Merge callback struct overlays with spec struct definitions. - for _, specName := range sortedKeys(overlay.CallbackStructs) { - csov := overlay.CallbackStructs[specName] - sd, hasSpec := spec.Structs[specName] - mcs := MergedCallbackStruct{ - SpecName: specName, - GoName: csov.GoName, - ContextField: csov.ContextField, - } - - if hasSpec { - for _, field := range sd.Fields { - if field.Name == csov.ContextField { - continue - } - fov, hasFieldOverlay := csov.Fields[field.Name] - if !hasFieldOverlay { - continue - } - mcs.Fields = append(mcs.Fields, MergedCallbackField{ - CName: field.Name, - GoName: fov.GoName, - GoSignature: fov.GoSignature, - GoParamCount: countGoParams(fov.GoSignature), - Params: field.Params, - }) - } - } else { - for _, cName := range sortedKeys(csov.Fields) { - fov := csov.Fields[cName] - goParamCount := fov.GoParamCount - if goParamCount == 0 { - goParamCount = countGoParams(fov.GoSignature) - } - // Look up callback type params from spec. - var params []specmodel.Param - if fov.CallbackType != "" { - if cbDef, ok := spec.Callbacks[fov.CallbackType]; ok { - params = cbDef.Params - } - } - mcs.Fields = append(mcs.Fields, MergedCallbackField{ - CName: cName, - GoName: fov.GoName, - GoSignature: fov.GoSignature, - GoParamCount: goParamCount, - Params: params, - }) - } - } - m.CallbackStructs = append(m.CallbackStructs, mcs) - } - - // Merge struct accessor overlays. - for _, specName := range sortedKeys(overlay.StructAccessors) { - saov := overlay.StructAccessors[specName] - m.StructAccessors = append(m.StructAccessors, MergedStructAccessor{ - SpecName: capiExportName(specName), - CountField: saov.CountField, - ItemsField: saov.ItemsField, - ItemType: saov.ItemType, - DeleteFunc: capiExportName(saov.DeleteFunc), - }) - } - - // Merge lifecycle overlay. - if overlay.Lifecycle != nil { - ml := &MergedLifecycle{ - EntryPoint: overlay.Lifecycle.EntryPoint, - ActivityType: overlay.Lifecycle.ActivityType, - CallbacksAccessor: overlay.Lifecycle.CallbacksAccessor, - CallbackStruct: overlay.Lifecycle.CallbackStruct, - EntryCallback: overlay.Lifecycle.EntryCallback, - } - - // Resolve Go activity type name. - if tov, ok := overlay.Types[overlay.Lifecycle.ActivityType]; ok && tov.GoName != "" { - ml.GoActivityType = tov.GoName - } else { - ml.GoActivityType = overlay.Lifecycle.ActivityType - } - - // Extract lifecycle fields from spec struct definition. - if sd, ok := spec.Structs[overlay.Lifecycle.CallbackStruct]; ok { - for _, field := range sd.Fields { - if field.Type != "func_ptr" { - continue - } - goName := fixGoAcronyms(strings.ToUpper(field.Name[:1]) + field.Name[1:]) - ml.Fields = append(ml.Fields, MergedCallbackField{ - CName: field.Name, - GoName: goName, - Params: field.Params, - Returns: field.Returns, - }) - } - } - - m.Lifecycle = ml - } - - m.ExtraBridgeC = overlay.ExtraBridgeC - m.ExtraBridgeGo = overlay.ExtraBridgeGo - addAutoMetadataUnionAccessors(&m, spec, overlay, typeMap, enumGoNames, receiverCapiTypes, opaqueSpecNames, valueStructSpecNames) - - return m -} - -func detectOutputFactory( - funcName string, - fd specmodel.FuncDef, - functions map[string]specmodel.FuncDef, - errorTypes map[string]bool, - opaqueSpecNames map[string]bool, - specToGoName map[string]string, -) (overlaymodel.FuncOverlay, bool) { - if !isCreateFunction(funcName) { - return overlaymodel.FuncOverlay{}, false - } - if !errorTypes[fd.Returns] { - return overlaymodel.FuncOverlay{}, false - } - - var outputParam *specmodel.Param - var outputSpecName string - for i := range fd.Params { - p := &fd.Params[i] - if p.Direction != "out" { - continue - } - if outputParam != nil { - return overlaymodel.FuncOverlay{}, false - } - if !strings.HasPrefix(p.Type, "**") { - return overlaymodel.FuncOverlay{}, false - } - base := strings.TrimPrefix(p.Type, "**") - if !opaqueSpecNames[base] { - return overlaymodel.FuncOverlay{}, false - } - outputParam = p - outputSpecName = base - } - if outputParam == nil { - return overlaymodel.FuncOverlay{}, false - } - - outputGoName := specToGoName[outputSpecName] - if outputGoName == "" { - return overlaymodel.FuncOverlay{}, false - } - - subject := strings.TrimSuffix(strings.TrimSuffix(funcName, "_create"), "_new") - inserted := insertedTypeQualifier(subject, outputSpecName) - if inserted != "" && !hasDistinctFactoryParams(fd, functions, outputSpecName) { - return overlaymodel.FuncOverlay{}, false - } - - return overlaymodel.FuncOverlay{ - GoName: deriveOutputFactoryGoName(funcName, outputSpecName, outputGoName), - ReturnsNew: outputGoName, - OutputParams: map[string]string{ - outputParam.Name: "*" + outputGoName, - }, - }, true -} - -func hasDistinctFactoryParams( - fd specmodel.FuncDef, - functions map[string]specmodel.FuncDef, - outputSpecName string, -) bool { - params := visibleParamTypes(fd.Params) - for _, suffix := range []string{"_create", "_new"} { - baseFD, ok := functions[outputSpecName+suffix] - if !ok { - continue - } - if equalStrings(params, visibleParamTypes(baseFD.Params)) { - return false - } - } - return true -} - -func visibleParamTypes(params []specmodel.Param) []string { - result := make([]string, 0, len(params)) - for _, p := range params { - if p.Direction == "out" { - continue - } - result = append(result, p.Type) - } - return result -} - -func equalStrings(a []string, b []string) bool { - if len(a) != len(b) { - return false - } - for i := range a { - if a[i] != b[i] { - return false - } - } - return true -} - -func isCreateFunction(funcName string) bool { - return strings.HasSuffix(funcName, "_create") || strings.HasSuffix(funcName, "_new") -} - -func deriveOutputFactoryGoName( - funcName string, - outputSpecName string, - outputGoName string, -) string { - subject := strings.TrimSuffix(strings.TrimSuffix(funcName, "_create"), "_new") - if subject == outputSpecName { - return "New" + outputGoName - } - - inserted := insertedTypeQualifier(subject, outputSpecName) - if inserted != "" { - return "New" + fixGoAcronyms(exportName(inserted)) + outputGoName - } - - return "New" + autoGoTypeName(subject) -} - -func insertedTypeQualifier(subject string, base string) string { - prefixLen := commonPrefixLen(subject, base) - subjectTail := subject[prefixLen:] - baseTail := base[prefixLen:] - suffixLen := commonSuffixLen(subjectTail, baseTail) - if suffixLen == 0 { - return subjectTail - } - return subjectTail[:len(subjectTail)-suffixLen] -} - -func commonPrefixLen(a string, b string) int { - n := len(a) - if len(b) < n { - n = len(b) - } - for i := 0; i < n; i++ { - if a[i] != b[i] { - return i - } - } - return n -} - -func commonSuffixLen(a string, b string) int { - n := len(a) - if len(b) < n { - n = len(b) - } - for i := 0; i < n; i++ { - if a[len(a)-1-i] != b[len(b)-1-i] { - return i - } - } - return n -} - -func addAutoMetadataUnionAccessors( - m *MergedSpec, - spec specmodel.Spec, - overlay overlaymodel.Overlay, - typeMap map[string]string, - enumGoNames map[string]bool, - receiverCapiTypes map[string]string, - opaqueSpecNames map[string]bool, - valueStructSpecNames map[string]bool, -) { - methodKeys := make(map[string]bool) - for _, method := range m.Methods { - methodKeys[method.ReceiverType+"."+method.GoName] = true - } - - for _, funcName := range sortedKeys(spec.Functions) { - fd := spec.Functions[funcName] - accessor, ok := metadataUnionAccessorFromFunction(funcName, fd, spec, opaqueSpecNames, specToGoNameFromMerged(m)) - if !ok { - continue - } - - for _, field := range accessor.Fields { - for _, suffix := range []string{"Count", "At"} { - goName := field.MethodStem + suffix - methodKey := accessor.ReceiverGoName + "." + goName - if methodKeys[methodKey] { - continue - } - - bridgeName := "Bridge" + accessor.ReceiverGoName + field.MethodStem + suffix - methodFD := specmodel.FuncDef{ - CName: bridgeName, - Params: []specmodel.Param{ - {Name: unexport(accessor.ReceiverGoName), Type: "*" + accessor.ReceiverSpecName}, - {Name: "tag", Type: "uint32"}, - }, - Returns: "int32", - } - if suffix == "At" { - methodFD.Params = append(methodFD.Params, specmodel.Param{Name: "idx", Type: "int32"}) - methodFD.Returns = field.GoType - } - - fov := overlaymodel.FuncOverlay{ - Receiver: accessor.ReceiverGoName, - GoName: goName, - Pure: true, - } - m.Methods = append(m.Methods, mergeMethod(bridgeName, methodFD, fov, overlay.APILevels, typeMap, enumGoNames, receiverCapiTypes, opaqueSpecNames, overlay.CallbackStructs, overlay.StructAccessors, valueStructSpecNames)) - methodKeys[methodKey] = true - } - } - - m.ExtraBridgeC += renderMetadataUnionBridgeC(accessor) - m.ExtraBridgeGo += renderMetadataUnionBridgeGo(accessor) - } -} - -type metadataUnionAccessor struct { - ReceiverSpecName string - ReceiverGoName string - GetterCName string - EntrySpecName string - Fields []metadataUnionAccessorField -} - -type metadataUnionAccessorField struct { - CName string - MethodStem string - GoType string - CType string - CastType string -} - -func specToGoNameFromMerged(m *MergedSpec) map[string]string { - result := make(map[string]string, len(m.OpaqueTypes)) - for goName, opaqueType := range m.OpaqueTypes { - result[opaqueType.CapiType] = goName - } - return result -} - -func metadataUnionAccessorFromFunction( - funcName string, - fd specmodel.FuncDef, - spec specmodel.Spec, - opaqueSpecNames map[string]bool, - specToGoName map[string]string, -) (metadataUnionAccessor, bool) { - if !strings.HasSuffix(funcName, "_getConstEntry") { - return metadataUnionAccessor{}, false - } - if len(fd.Params) < 3 { - return metadataUnionAccessor{}, false - } - - receiverParam := fd.Params[0] - if !strings.HasPrefix(receiverParam.Type, "*") || receiverParam.Direction == "out" { - return metadataUnionAccessor{}, false - } - receiverSpecName := strings.TrimPrefix(receiverParam.Type, "*") - if !opaqueSpecNames[receiverSpecName] { - return metadataUnionAccessor{}, false - } - receiverGoName := specToGoName[receiverSpecName] - if receiverGoName == "" { - return metadataUnionAccessor{}, false - } - - tagParam := fd.Params[1] - if tagParam.Type != "uint32" { - return metadataUnionAccessor{}, false - } - - entryParam := fd.Params[len(fd.Params)-1] - if entryParam.Direction != "out" || !strings.HasPrefix(entryParam.Type, "*") { - return metadataUnionAccessor{}, false - } - entrySpecName := strings.TrimPrefix(entryParam.Type, "*") - entryStruct, ok := spec.Structs[entrySpecName] - if !ok { - return metadataUnionAccessor{}, false - } - - unionFields := metadataDataUnionFields(entryStruct) - if len(unionFields) == 0 { - return metadataUnionAccessor{}, false - } - - return metadataUnionAccessor{ - ReceiverSpecName: receiverSpecName, - ReceiverGoName: receiverGoName, - GetterCName: funcName, - EntrySpecName: entrySpecName, - Fields: unionFields, - }, true -} - -func metadataDataUnionFields(entryStruct specmodel.StructDef) []metadataUnionAccessorField { - hasCount := false - var dataField *specmodel.StructField - for i := range entryStruct.Fields { - field := &entryStruct.Fields[i] - switch field.Name { - case "count": - hasCount = field.Type == "uint32" - case "data": - if field.Type == "union" || field.Type == ":union" { - dataField = field - } - } - } - if !hasCount || dataField == nil { - return nil - } - - var result []metadataUnionAccessorField - for _, field := range dataField.Fields { - accessorField, ok := metadataUnionAccessorFieldFromStructField(field) - if !ok { - continue - } - result = append(result, accessorField) - } - return result -} - -func metadataUnionAccessorFieldFromStructField( - field specmodel.StructField, -) (metadataUnionAccessorField, bool) { - baseType := strings.TrimPrefix(field.Type, "*") - if baseType == field.Type { - return metadataUnionAccessorField{}, false - } - - switch baseType { - case "uint8": - return metadataUnionAccessorField{CName: field.Name, MethodStem: "U8", GoType: "uint8", CType: "uint8_t", CastType: "uint8"}, true - case "int32": - return metadataUnionAccessorField{CName: field.Name, MethodStem: "I32", GoType: "int32", CType: "int32_t", CastType: "int32"}, true - case "float32": - return metadataUnionAccessorField{CName: field.Name, MethodStem: "Float", GoType: "float32", CType: "float", CastType: "float32"}, true - default: - return metadataUnionAccessorField{}, false - } -} - -func renderMetadataUnionBridgeC(accessor metadataUnionAccessor) string { - var b strings.Builder - for _, field := range accessor.Fields { - cPrefix := "bridge_" + unexport(accessor.ReceiverGoName) + field.MethodStem - fmt.Fprintf(&b, "\nstatic inline int32_t %sCount(\n", cPrefix) - fmt.Fprintf(&b, " const %s* %s, uint32_t tag\n", accessor.ReceiverSpecName, unexport(accessor.ReceiverGoName)) - b.WriteString(") {\n") - fmt.Fprintf(&b, " %s entry;\n", accessor.EntrySpecName) - fmt.Fprintf(&b, " if (%s(%s, tag, &entry) != ACAMERA_OK) return 0;\n", accessor.GetterCName, unexport(accessor.ReceiverGoName)) - b.WriteString(" return (int32_t)entry.count;\n") - b.WriteString("}\n\n") - - fmt.Fprintf(&b, "static inline %s %sAt(\n", field.CType, cPrefix) - fmt.Fprintf(&b, " const %s* %s, uint32_t tag, int32_t idx\n", accessor.ReceiverSpecName, unexport(accessor.ReceiverGoName)) - b.WriteString(") {\n") - fmt.Fprintf(&b, " %s entry;\n", accessor.EntrySpecName) - fmt.Fprintf(&b, " if (%s(%s, tag, &entry) != ACAMERA_OK) return 0;\n", accessor.GetterCName, unexport(accessor.ReceiverGoName)) - b.WriteString(" if ((uint32_t)idx >= entry.count) return 0;\n") - fmt.Fprintf(&b, " return entry.data.%s[idx];\n", field.CName) - b.WriteString("}\n") - } - return b.String() -} - -func renderMetadataUnionBridgeGo(accessor metadataUnionAccessor) string { - var b strings.Builder - receiverParamName := unexport(accessor.ReceiverGoName) - for _, field := range accessor.Fields { - bridgePrefix := "Bridge" + accessor.ReceiverGoName + field.MethodStem - cPrefix := "bridge_" + unexport(accessor.ReceiverGoName) + field.MethodStem - - fmt.Fprintf(&b, "\n// %sCount returns the count of %s values for a metadata tag.\n", bridgePrefix, field.GoType) - fmt.Fprintf(&b, "func %sCount(%s *%s, tag uint32) int32 {\n", bridgePrefix, receiverParamName, capiExportName(accessor.ReceiverSpecName)) - fmt.Fprintf(&b, "\treturn int32(C.%sCount((*C.%s)(unsafe.Pointer(%s)), C.uint32_t(tag)))\n", cPrefix, accessor.ReceiverSpecName, receiverParamName) - b.WriteString("}\n\n") - - fmt.Fprintf(&b, "// %sAt returns the %s value at the given index for a metadata tag.\n", bridgePrefix, field.GoType) - fmt.Fprintf(&b, "func %sAt(%s *%s, tag uint32, idx int32) %s {\n", bridgePrefix, receiverParamName, capiExportName(accessor.ReceiverSpecName), field.GoType) - fmt.Fprintf(&b, "\treturn %s(C.%sAt((*C.%s)(unsafe.Pointer(%s)), C.uint32_t(tag), C.int32_t(idx)))\n", field.CastType, cPrefix, accessor.ReceiverSpecName, receiverParamName) - b.WriteString("}\n") - } - return b.String() -} - -func mergeErrorEnum(specName string, tov overlaymodel.TypeOverlay, values []specmodel.EnumValue) MergedErrorEnum { - ee := MergedErrorEnum{ - GoName: specName, - Prefix: tov.ErrorPrefix, - SuccessValue: tov.SuccessValue, - } - for _, v := range values { - goName := v.Name - if tov.StripPrefix != "" && v.Name != tov.SuccessValue { - goName = "Err" + stripAndTitle(v.Name, tov.StripPrefix) - } - ee.Values = append(ee.Values, MergedEnumValue{ - GoName: goName, - SpecName: v.Name, - Value: v.Value, - }) - } - return ee -} - -func mergeValueEnum(specName, goName, baseType string, tov overlaymodel.TypeOverlay, values []specmodel.EnumValue) MergedValueEnum { - if baseType == "" { - baseType = "int32" - } - - // If any enum value exceeds the int32 range, promote to uint64. - if baseType == "int32" { - for _, v := range values { - if v.Value > math.MaxInt32 || v.Value < math.MinInt32 { - baseType = "uint64" - break - } - } - } - - ve := MergedValueEnum{ - GoName: goName, - SpecName: specName, - BaseType: baseType, - StripPrefix: tov.StripPrefix, - StringMethod: tov.StringMethod, - } - isUnsigned := baseType == "uint32" || baseType == "uint64" - seen := make(map[string]bool) - for _, v := range values { - // Skip _MAX_ENUM sentinel values (present in all Vulkan enums). - if strings.HasSuffix(v.Name, "_MAX_ENUM") { - continue - } - stripped := stripAndTitle(v.Name, tov.StripPrefix) - // Skip duplicate Go names (e.g., Vulkan aliases that produce the same name). - if seen[stripped] { - continue - } - seen[stripped] = true - - // For unsigned base types, render negative int64 values as hex - // so that Go interprets them as their unsigned equivalent. - var valueStr string - if isUnsigned && v.Value < 0 { - valueStr = fmt.Sprintf("0x%X", uint64(v.Value)) - } - - ve.Values = append(ve.Values, MergedEnumValue{ - GoName: stripped, - SpecName: v.Name, - Value: v.Value, - ValueStr: valueStr, - }) - } - return ve -} - -// kindToBaseType converts a spec type kind to a Go base type string. -func kindToBaseType(kind string) string { - switch kind { - case "typedef_uint32": - return "uint32" - case "typedef_int64": - return "int64" - case "typedef_uint64": - return "uint64" - default: - return "int32" - } -} - -// stripAndTitle removes the given prefix from name and converts the -// remainder to TitleCase. For example: "AAUDIO_DIRECTION_OUTPUT" with -// prefix "AAUDIO_DIRECTION_" becomes "Output". -func stripAndTitle(name, prefix string) string { - if prefix == "" { - return name - } - s := strings.TrimPrefix(name, prefix) - if s == "" { - return name - } - return toTitleCase(s) -} - -// toTitleCase converts an UPPER_SNAKE_CASE string to TitleCase, -// normalizing common acronyms (e.g. "DEVICE_ID" → "DeviceID", not "DeviceId"). -func toTitleCase(s string) string { - parts := strings.Split(strings.ToLower(s), "_") - var b strings.Builder - for _, p := range parts { - if p == "" { - continue - } - runes := []rune(p) - runes[0] = unicode.ToUpper(runes[0]) - b.WriteString(string(runes)) - } - return fixGoAcronyms(b.String()) -} - -func mergeMethod(funcName string, fd specmodel.FuncDef, fov overlaymodel.FuncOverlay, apiLevels map[string]int, typeMap map[string]string, enumGoNames map[string]bool, receiverCapiTypes map[string]string, opaqueSpecNames map[string]bool, callbackStructOverlays map[string]overlaymodel.CallbackStructOverlay, structAccessors map[string]overlaymodel.StructAccessorOverlay, valueStructSpecNames map[string]bool) MergedMethod { - var params []MergedParam - receiverFound := false - paramIdx := 0 - for _, p := range fd.Params { - if !receiverFound && isReceiverParam(p) { - receiverFound = true - continue - } - goType := resolveType(p.Type, typeMap) - // Overlay explicit override takes priority over heuristic inference. - if override, ok := fov.ParamTypes[p.Name]; ok { - goType = override - } else { - goType = inferEnumType(p.Name, goType, enumGoNames) - } - baseType := strings.TrimPrefix(p.Type, "*") - isHandle := strings.HasPrefix(p.Type, "*") && opaqueSpecNames[baseType] - isString := p.Type == "*byte" - remapped := isTypeRemapped(p.Type, typeMap) || goType != resolveType(p.Type, typeMap) - if isString { - goType = "string" - } - capiType := capiExportType(p.Type) - if isFixedArrayGoType(goType) { - goType = "*" + goType - capiType = "*" + capiType - } - params = append(params, MergedParam{ - Name: safeGoParamName(p.Name, paramIdx), - GoType: goType, - CapiType: capiType, - IsHandle: isHandle, - IsString: isString, - Remapped: remapped, - Direction: p.Direction, - }) - paramIdx++ - } - - // If BufGoType is set, override the GoType of the buffer param. - if fov.BufGoType != "" && fov.BufParam != "" { - for i := range params { - if params[i].Name == safeGoName(fov.BufParam) { - params[i].GoType = fov.BufGoType - break - } - } - } - - // If TimeoutParam is set, override the GoType to time.Duration. - if fov.TimeoutParam != "" { - unit := fov.TimeoutUnit - if unit == "" { - unit = "ns" - } - for i := range params { - if params[i].Name == safeGoName(fov.TimeoutParam) { - params[i].GoType = "time.Duration" - params[i].DurationUnit = unit - params[i].Name = durationParamName(fov.TimeoutParam) - break - } - } - } - - // Auto-derive GoName if not specified in overlay. - goName := fov.GoName - if goName == "" { - goName = deriveGoName(funcName, fov.Receiver, receiverCapiTypes) - } - - // Resolve return type through typeMap. - returns := resolveType(fd.Returns, typeMap) - - returnsNewDirect := false - if fov.ReturnsNew != "" { - returnsNewDirect = strings.HasPrefix(fd.Returns, "*") - } - mm := MergedMethod{ - GoName: goName, - CName: capiExportName(funcName), - ReceiverType: fov.Receiver, - Params: params, - Returns: returns, - Chain: fov.Chain, - Pure: fov.Pure, - ReturnsNew: fov.ReturnsNew, - ReturnsNewDirect: returnsNewDirect, - ReturnsFrames: fov.ReturnsFrames, - BufGoType: fov.BufGoType, - TimeoutUnit: fov.TimeoutUnit, - FixedParams: fov.FixedParams, - CallbackParam: fov.CallbackParam, - } - - // If CallbackParam is set, find the matching callback struct and its Go name. - if fov.CallbackParam != "" { - for _, p := range fd.Params { - if p.Name == fov.CallbackParam { - specName := strings.TrimPrefix(p.Type, "*") - mm.CallbackStruct = capiExportName(specName) - if csov, ok := callbackStructOverlays[specName]; ok { - mm.CallbackGoType = csov.GoName - } - break - } - } - } - - // If ReturnsListStruct is set, look up the struct accessor. - if fov.ReturnsListStruct != "" { - if saov, ok := structAccessors[fov.ReturnsListStruct]; ok { - mm.ReturnsListAccessor = &MergedStructAccessor{ - SpecName: capiExportName(fov.ReturnsListStruct), - CountField: saov.CountField, - ItemsField: saov.ItemsField, - ItemType: saov.ItemType, - DeleteFunc: capiExportName(saov.DeleteFunc), - } - } - } - - // If CustomCall is set, populate the merged custom call. - if fov.CustomCall != nil { - mcc := &MergedCustomCall{ - Args: fov.CustomCall.Args, - } - for _, p := range fov.CustomCall.Params { - mcc.Params = append(mcc.Params, MergedCustomCallParam{ - Name: p.Name, - GoType: p.GoType, - }) - } - mm.CustomCall = mcc - } - - // Resolve output_params: convert C output pointer params to Go return values. - if len(fov.OutputParams) > 0 { - mm.OutputParams = resolveOutputParams(fov.OutputParams, fd, opaqueSpecNames, valueStructSpecNames) - mm.ReturnsBool = fd.Returns == "bool" - // Mark output params with direction "out" so skipAndFilterOut removes them. - for i := range mm.Params { - if _, isOutput := fov.OutputParams[mm.Params[i].Name]; isOutput { - mm.Params[i].Direction = "out" - } - } - } - - if apiLevels != nil { - mm.APILevel = apiLevels[funcName] - } - return mm -} - -// deriveGoName auto-derives a Go method name from a C function name by -// durationParamName derives a Go parameter name from a C duration/timeout param name. -// "timeoutNanoseconds" → "timeout", "actualDurationNanos" → "actualDuration", -// "initialTargetWorkDurationNanos" → "initialTargetWorkDuration". -func durationParamName(cName string) string { - for _, suffix := range []string{"Nanoseconds", "Nanos", "Millis", "Microseconds", "Micros"} { - if strings.HasSuffix(cName, suffix) { - trimmed := strings.TrimSuffix(cName, suffix) - if trimmed == "" || trimmed == "timeout" { - return "timeout" - } - return trimmed - } - } - return cName -} - -// stripping the receiver's capi type prefix and capitalizing the first letter. -// "AAudioStreamBuilder_setChannelCount" with receiver "StreamBuilder" → "SetChannelCount". -func deriveGoName(funcName, receiver string, receiverCapiTypes map[string]string) string { - if capiType, ok := receiverCapiTypes[receiver]; ok { - prefix := capiType + "_" - if strings.HasPrefix(funcName, prefix) { - suffix := funcName[len(prefix):] - if len(suffix) > 0 { - return fixGoAcronyms(strings.ToUpper(suffix[:1]) + suffix[1:]) - } - } - } - return fixGoAcronyms(funcName) -} - -func mergeFreeFunction(funcName string, fd specmodel.FuncDef, fov overlaymodel.FuncOverlay, apiLevels map[string]int, typeMap map[string]string, enumGoNames map[string]bool, opaqueSpecNames map[string]bool, valueStructSpecNames map[string]bool) MergedFreeFunction { - var params []MergedParam - for i, p := range fd.Params { - goType := resolveType(p.Type, typeMap) - if override, ok := fov.ParamTypes[p.Name]; ok { - goType = override - } else { - goType = inferEnumType(p.Name, goType, enumGoNames) - } - baseType := strings.TrimPrefix(p.Type, "*") - isHandle := strings.HasPrefix(p.Type, "*") && opaqueSpecNames[baseType] - isString := p.Type == "*byte" - remapped := isTypeRemapped(p.Type, typeMap) || goType != resolveType(p.Type, typeMap) - if isString { - goType = "string" - } - capiType := capiExportType(p.Type) - if isFixedArrayGoType(goType) { - goType = "*" + goType - capiType = "*" + capiType - } - params = append(params, MergedParam{ - Name: safeGoParamName(p.Name, i), - GoType: goType, - CapiType: capiType, - IsHandle: isHandle, - IsString: isString, - Remapped: remapped, - Direction: p.Direction, - }) - } - // If TimeoutParam is set, override the GoType to time.Duration. - if fov.TimeoutParam != "" { - unit := fov.TimeoutUnit - if unit == "" { - unit = "ns" - } - for i := range params { - if params[i].Name == safeGoName(fov.TimeoutParam) { - params[i].GoType = "time.Duration" - params[i].Name = durationParamName(fov.TimeoutParam) - params[i].DurationUnit = unit - break - } - } - } - - returns := resolveType(fd.Returns, typeMap) - isHandleReturn := strings.HasPrefix(fd.Returns, "*") && opaqueSpecNames[strings.TrimPrefix(fd.Returns, "*")] - ff := MergedFreeFunction{ - GoName: fov.GoName, - CName: capiExportName(funcName), - Params: params, - Returns: returns, - CapiReturns: fd.Returns, - IsHandleReturn: isHandleReturn, - ReturnsNew: fov.ReturnsNew, - } - - // Resolve output_params: convert C output pointer params to Go return values. - if len(fov.OutputParams) > 0 { - ff.OutputParams = resolveOutputParams(fov.OutputParams, fd, opaqueSpecNames, valueStructSpecNames) - ff.ReturnsBool = fd.Returns == "bool" - // Mark output params with direction "out" so they are filtered from visible params. - for i := range ff.Params { - if _, isOutput := fov.OutputParams[ff.Params[i].Name]; isOutput { - ff.Params[i].Direction = "out" - } - } - } - - if apiLevels != nil { - ff.APILevel = apiLevels[funcName] - } - return ff -} - -// resolveOutputParams builds MergedOutputParam entries from the overlay's output_params map. -// It matches param names against the function's spec params to determine capi types. -func resolveOutputParams( - outputParams map[string]string, - fd specmodel.FuncDef, - opaqueSpecNames map[string]bool, - valueStructSpecNames map[string]bool, -) []MergedOutputParam { - // Process output params in the order they appear in the function signature. - var result []MergedOutputParam - for _, p := range fd.Params { - goType, isOutput := outputParams[p.Name] - if !isOutput { - continue - } - - // Strip one level of pointer from the C param type to get the local var type. - // **AImageReader -> *AImageReader (opaque handle pointer) - // **uint8 -> *uint8 (scalar pointer) - // *int32 -> int32 (scalar value) - // *AHardwareBuffer_Desc -> AHardwareBuffer_Desc (value struct) - localType := strings.TrimPrefix(p.Type, "*") - - // Determine the base type name (without pointer stars). - specBase := localType - for strings.HasPrefix(specBase, "*") { - specBase = specBase[1:] - } - - // Check if this is a value struct (before checking opaque handles, - // since value struct names are also in opaqueSpecNames). - isValueStruct := valueStructSpecNames[specBase] - - // Determine if the Go type is an opaque handle wrapper. - // Value structs are NOT opaque handles even though they appear in opaqueSpecNames. - isHandle := !isValueStruct && opaqueSpecNames[specBase] - - // Build the capi type for the local variable declaration. - // Opaque types need capi. prefix (e.g., *capi.AImageReader). - // Value structs need capi. prefix without pointer (e.g., capi.AHardwareBuffer_Desc). - // Scalar types and unsafe.Pointer use the Go type directly. - var capiType string - if isHandle || isValueStruct || (!isScalarGoType(specBase) && specBase != "unsafe.Pointer") { - // Reconstruct with capi. prefix on the base type. - stars := strings.TrimSuffix(localType, specBase) - capiType = stars + "capi." + capiExportName(specBase) - } else { - capiType = localType - } - - result = append(result, MergedOutputParam{ - CParamName: p.Name, - GoType: goType, - CapiType: capiType, - IsHandle: isHandle, - IsValueStruct: isValueStruct, - }) - } - return result -} - -// isTypeRemapped returns true if the spec type was resolved through typeMap. -func isTypeRemapped(specType string, typeMap map[string]string) bool { - if _, ok := typeMap[specType]; ok { - return true - } - for _, prefix := range []string{"[]", "**", "*"} { - if strings.HasPrefix(specType, prefix) { - base := specType[len(prefix):] - if _, ok := typeMap[base]; ok { - return true - } - } - } - return false -} - -// resolveType maps a spec type to its Go equivalent using the typeMap. -// Handles composite types like []EGLint → []Int and **EGLint → **Int. -// -// Proven properties (proofs/Proofs/ResolveType.lean): -// - Identity for empty typeMap -// - Direct lookup takes precedence over prefix-based -// - Preserves [], **, * prefix structure -// -// Differential tested against Lean oracle. -func resolveType(specType string, typeMap map[string]string) string { - if goType, ok := typeMap[specType]; ok { - return goType - } - // Strip slice/pointer prefixes and resolve the base type. - for _, prefix := range []string{"[]", "**", "*"} { - if strings.HasPrefix(specType, prefix) { - base := specType[len(prefix):] - if goType, ok := typeMap[base]; ok { - return prefix + goType - } - } - } - return specType -} - -// isFixedArrayGoType returns true if t is a fixed-size array type like "[16]float32". -func isFixedArrayGoType(t string) bool { - return len(t) > 2 && t[0] == '[' && t[1] != ']' -} - -// isReceiverParam returns true if the parameter looks like a method receiver -// (a pointer to an opaque type, not an output parameter). -func isReceiverParam(p specmodel.Param) bool { - return strings.HasPrefix(p.Type, "*") && p.Direction != "out" -} - -// isTypedefKind returns true for all typedef and pointer_handle kind strings. -func isTypedefKind(kind string) bool { - return strings.HasPrefix(kind, "typedef_") || kind == "pointer_handle" -} - -// countGoParams counts the number of parameters in a Go function signature string. -// "func()" → 0, "func(int)" → 1, "func(int, string)" → 2. -// -// Verified by concrete cases (proofs/Proofs/CountGoParams.lean). -// Differential tested against Lean oracle. -func countGoParams(sig string) int { - // Extract content between ( and ). - start := strings.Index(sig, "(") - end := strings.LastIndex(sig, ")") - if start < 0 || end < 0 || end <= start+1 { - return 0 - } - inner := strings.TrimSpace(sig[start+1 : end]) - if inner == "" { - return 0 - } - return strings.Count(inner, ",") + 1 -} - -// callbackAnnotation holds Go callback type info resolved from function overlays. -type callbackAnnotation struct { - goType string - goSig string -} - -func mergeCallback(cbName string, cbd specmodel.CallbackDef, annotations map[string]callbackAnnotation) MergedCallback { - mc := MergedCallback{ - SpecName: cbName, - Returns: cbd.Returns, - } - - if ann, ok := annotations[cbName]; ok { - mc.GoCallbackType = ann.goType - mc.GoCallbackSig = ann.goSig - } - - for _, p := range cbd.Params { - mc.Params = append(mc.Params, MergedParam{ - Name: safeGoName(p.Name), - GoType: p.Type, - Direction: p.Direction, - }) - } - return mc -} - -// collectUnresolvedFuncTypes finds type names used in function params/returns -// that are not yet in the typeMap and are not Go built-in types. -// These need auto-generated type aliases. Scans ALL spec functions (not just -// those with overlay entries) since auto-generation now processes all functions. -func collectUnresolvedFuncTypes( - spec specmodel.Spec, - overlay overlaymodel.Overlay, - typeMap map[string]string, - opaqueSpecNames map[string]bool, - specToGoName map[string]string, -) map[string]bool { - result := make(map[string]bool) - - checkType := func(t string) { - base := t - for strings.HasPrefix(base, "*") { - base = base[1:] - } - base = strings.TrimPrefix(base, "[]") - // Skip array types like [16]float32. - if len(base) > 0 && base[0] == '[' { - return - } - if base == "" || base == "unsafe.Pointer" || base == "string" || - base == "bool" || base == "byte" || base == "func_ptr" { - return - } - if isScalarGoType(base) { - return - } - if typeMap[base] != "" || typeMap["*"+base] != "" { - return - } - // Skip types that are already registered as opaque types. - if opaqueSpecNames[base] { - return - } - result[base] = true - } - - // Scan ALL spec functions, not just overlay-listed ones. - // Skip functions that are explicitly skipped in the overlay. - for funcName, fd := range spec.Functions { - if fov, ok := overlay.Functions[funcName]; ok && fov.Skip { - continue - } - for _, p := range fd.Params { - checkType(p.Type) - } - checkType(fd.Returns) - } - - // Also scan constructor params of opaque types — these reference - // cross-module types (e.g. ANativeWindow in camera constructors) - // that need auto-generated type aliases. - for _, tov := range overlay.Types { - if tov.Constructor == "" { - continue - } - if fd, ok := spec.Functions[tov.Constructor]; ok { - for _, p := range fd.Params { - if p.Direction == "out" { - continue - } - checkType(p.Type) - } - } - } - - return result -} - -// sortedKeys returns the sorted keys of a map. It works with any map type -// that has string keys via type parameters. -func sortedKeys[V any](m map[string]V) []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} diff --git a/tools/pkg/idiomgen/merge_property_test.go b/tools/pkg/idiomgen/merge_property_test.go deleted file mode 100644 index 07dc601..0000000 --- a/tools/pkg/idiomgen/merge_property_test.go +++ /dev/null @@ -1,422 +0,0 @@ -package idiomgen - -import ( - "strings" - "testing" - "testing/quick" -) - -// TestResolveType_EmptyMap verifies resolveType returns input when map is empty. -func TestResolveType_EmptyMap(t *testing.T) { - f := func(specType string) bool { - return resolveType(specType, nil) == specType - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("resolveType with nil map changed input: %v", err) - } -} - -// TestResolveType_DirectPrecedence verifies direct lookup takes precedence. -func TestResolveType_DirectPrecedence(t *testing.T) { - typeMap := map[string]string{ - "*foo": "Direct", - "foo": "Prefix", - } - if got := resolveType("*foo", typeMap); got != "Direct" { - t.Errorf("resolveType(*foo) = %q, want Direct", got) - } -} - -// TestResolveType_PrefixPreservation verifies prefix structure is preserved. -func TestResolveType_PrefixPreservation(t *testing.T) { - typeMap := map[string]string{"foo": "Bar"} - - cases := []struct{ in_, want string }{ - {"foo", "Bar"}, - {"*foo", "*Bar"}, - {"**foo", "**Bar"}, - {"[]foo", "[]Bar"}, - {"unknown", "unknown"}, - } - for _, tc := range cases { - if got := resolveType(tc.in_, typeMap); got != tc.want { - t.Errorf("resolveType(%q) = %q, want %q", tc.in_, got, tc.want) - } - } -} - -// TestResolveType_Identity verifies unmapped types are returned unchanged. -func TestResolveType_Identity(t *testing.T) { - typeMap := map[string]string{"foo": "Bar"} - unmapped := []string{"baz", "*baz", "**baz", "[]baz", "int32", "unsafe.Pointer"} - for _, typ := range unmapped { - if got := resolveType(typ, typeMap); got != typ { - t.Errorf("resolveType(%q) = %q, want %q", typ, got, typ) - } - } -} - -// TestIsConstructorDestructor_Disjoint verifies the critical invariant that -// no function name can be both a constructor and destructor for the same type. -func TestIsConstructorDestructor_Disjoint(t *testing.T) { - types := []string{ - "ASensor", "ALooper", "ACameraManager", "AImageReader", - "AAudioStreamBuilder", "ANativeWindow", "AMediaCodec", - } - suffixes := append( - []string{"_create", "_new"}, - "_delete", "_free", "_destroy", "_release", "_close", - ) - - for _, typ := range types { - for _, suffix := range suffixes { - funcName := typ + suffix - isCtor := isConstructorFunc(funcName, typ) - isDtor := isDestructorFunc(funcName, typ) - if isCtor && isDtor { - t.Errorf("DISJOINTNESS VIOLATION: %q is both constructor and destructor for %q", - funcName, typ) - } - } - } -} - -// TestIsConstructorDestructor_Detection verifies correct detection. -func TestIsConstructorDestructor_Detection(t *testing.T) { - typ := "ALooper" - - ctorNames := []string{typ + "_create", typ + "_new"} - for _, name := range ctorNames { - if !isConstructorFunc(name, typ) { - t.Errorf("isConstructorFunc(%q, %q) = false, want true", name, typ) - } - } - - dtorNames := []string{ - typ + "_delete", typ + "_free", typ + "_destroy", - typ + "_release", typ + "_close", - } - for _, name := range dtorNames { - if !isDestructorFunc(name, typ) { - t.Errorf("isDestructorFunc(%q, %q) = false, want true", name, typ) - } - } -} - -// TestCountGoParams_Property verifies countGoParams matches comma-counting. -func TestCountGoParams_Property(t *testing.T) { - cases := []struct { - sig string - want int - }{ - {"func()", 0}, - {"func(int)", 1}, - {"func(int, string)", 2}, - {"func(int, string, bool)", 3}, - {"func( )", 0}, - {"hello", 0}, - {"", 0}, - } - for _, tc := range cases { - if got := countGoParams(tc.sig); got != tc.want { - t.Errorf("countGoParams(%q) = %d, want %d", tc.sig, got, tc.want) - } - } -} - -// TestAutoGoTypeName_StripAndroidPrefix verifies the "A" prefix stripping. -func TestAutoGoTypeName_StripAndroidPrefix(t *testing.T) { - cases := []struct{ in_, want string }{ - {"AImageReader", "ImageReader"}, - {"ALooper", "Looper"}, - {"ASensor", "Sensor"}, - {"GLenum", "GLenum"}, // No strip — not A+uppercase. - {"Abcdef", "Abcdef"}, // No strip — A+lowercase b. - {"A", "A"}, // Too short. - {"AB", "B"}, // Strip — A+B. - {"a_type", "a_type"}, // lowercase a, no strip. - } - for _, tc := range cases { - if got := autoGoTypeName(tc.in_); got != tc.want { - t.Errorf("autoGoTypeName(%q) = %q, want %q", tc.in_, got, tc.want) - } - } -} - -// TestInferEnumType_OnlyInt32 verifies inference only applies to int32 params. -func TestInferEnumType_OnlyInt32(t *testing.T) { - enums := map[string]bool{"Type": true, "Status": true} - - // Only int32 params get inference. - if got := inferEnumType("type", "int32", enums); got != "Type" { - t.Errorf("inferEnumType(type, int32) = %q, want Type", got) - } - - // Non-int32 types are unchanged. - if got := inferEnumType("type", "uint32", enums); got != "uint32" { - t.Errorf("inferEnumType(type, uint32) = %q, want uint32", got) - } -} - -// TestToSnakeCase verifies PascalCase → snake_case conversion. -func TestToSnakeCase_Property(t *testing.T) { - f := func(s string) bool { - result := toSnakeCase(s) - // Result should never contain uppercase letters. - for _, r := range result { - if r >= 'A' && r <= 'Z' { - return false - } - } - return true - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("toSnakeCase produced uppercase: %v", err) - } -} - -// TestToSnakeCase_Vectors verifies specific conversions. -func TestToSnakeCase_Vectors(t *testing.T) { - cases := []struct{ in_, want string }{ - {"StreamBuilder", "stream_builder"}, - {"Model", "model"}, - {"AUDIO", "audio"}, - } - for _, tc := range cases { - if got := toSnakeCase(tc.in_); got != tc.want { - t.Errorf("toSnakeCase(%q) = %q, want %q", tc.in_, got, tc.want) - } - } -} - -// TestFixGoAcronyms verifies "Id" → "ID" normalization. -func TestFixGoAcronyms(t *testing.T) { - cases := []struct{ in_, want string }{ - {"DeviceId", "DeviceID"}, - {"GetId", "GetID"}, - {"Idle", "Idle"}, // "Id" followed by lowercase — no change. - {"Identity", "Identity"}, // "Id" followed by lowercase — no change. - {"Id", "ID"}, // "Id" at end. - {"CameraIdList", "CameraIDList"}, - } - for _, tc := range cases { - if got := fixGoAcronyms(tc.in_); got != tc.want { - t.Errorf("fixGoAcronyms(%q) = %q, want %q", tc.in_, got, tc.want) - } - } -} - -// TestCapiExportType_ScalarUnchanged verifies scalars are passed through. -func TestCapiExportType_ScalarUnchanged(t *testing.T) { - scalars := []string{ - "int8", "uint8", "int16", "uint16", "int32", "uint32", - "int64", "uint64", "float32", "float64", "bool", "int", "uint", - } - for _, s := range scalars { - if got := capiExportType(s); got != s { - t.Errorf("capiExportType(%q) = %q, want unchanged", s, got) - } - } -} - -// TestCapiExportType_PointerPreservation verifies pointer prefixes are preserved. -func TestCapiExportType_PointerPreservation(t *testing.T) { - cases := []struct{ in_, want string }{ - {"*camera_status_t", "*Camera_status_t"}, - {"*int32", "*int32"}, - {"[]int32", "[]int32"}, - {"unsafe.Pointer", "unsafe.Pointer"}, - {"string", "string"}, - {"", ""}, - } - for _, tc := range cases { - if got := capiExportType(tc.in_); got != tc.want { - t.Errorf("capiExportType(%q) = %q, want %q", tc.in_, got, tc.want) - } - } -} - -// TestIsTypeRemapped verifies type remapping detection. -func TestIsTypeRemapped(t *testing.T) { - typeMap := map[string]string{"foo": "Bar"} - - cases := []struct { - specType string - want bool - }{ - {"foo", true}, - {"*foo", true}, - {"**foo", true}, - {"[]foo", true}, - {"bar", false}, - {"*bar", false}, - } - for _, tc := range cases { - if got := isTypeRemapped(tc.specType, typeMap); got != tc.want { - t.Errorf("isTypeRemapped(%q) = %v, want %v", tc.specType, got, tc.want) - } - } -} - -// TestStripAndTitle verifies UPPER_SNAKE_CASE to TitleCase conversion. -func TestStripAndTitle(t *testing.T) { - cases := []struct { - name, prefix, want string - }{ - {"AAUDIO_DIRECTION_OUTPUT", "AAUDIO_DIRECTION_", "Output"}, - {"AAUDIO_DIRECTION_INPUT", "AAUDIO_DIRECTION_", "Input"}, - {"FOO_BAR_BAZ", "FOO_BAR_", "Baz"}, - {"FOO_BAR_BAZ", "", "FOO_BAR_BAZ"}, - {"FOO", "FOO", "FOO"}, // Empty remainder returns original. - } - for _, tc := range cases { - if got := stripAndTitle(tc.name, tc.prefix); got != tc.want { - t.Errorf("stripAndTitle(%q, %q) = %q, want %q", tc.name, tc.prefix, got, tc.want) - } - } -} - -// TestDestructorPriority verifies the priority ordering. -func TestDestructorPriority(t *testing.T) { - // release > delete > free > destroy > close - priorities := []struct { - suffix string - want int - }{ - {"_release", 5}, - {"_delete", 4}, - {"_free", 3}, - {"_destroy", 2}, - {"_close", 1}, - {"_other", 0}, - } - for _, tc := range priorities { - if got := destructorPriority("Type" + tc.suffix); got != tc.want { - t.Errorf("destructorPriority(%q) = %d, want %d", "Type"+tc.suffix, got, tc.want) - } - } - - // Verify strict ordering. - for i := 0; i < len(priorities)-1; i++ { - for j := i + 1; j < len(priorities); j++ { - a := destructorPriority("T" + priorities[i].suffix) - b := destructorPriority("T" + priorities[j].suffix) - if a <= b { - t.Errorf("destructorPriority(%q) = %d should be > destructorPriority(%q) = %d", - priorities[i].suffix, a, priorities[j].suffix, b) - } - } - } -} - -// TestIsAutoDetectedPure verifies the auto-detection heuristic. -func TestIsAutoDetectedPure(t *testing.T) { - errorTypes := map[string]bool{"camera_status_t": true} - - pureTypes := []string{"string", "bool", "float32", "float64", "int64", "uint64", "unsafe.Pointer"} - for _, typ := range pureTypes { - if !isAutoDetectedPure(typ, errorTypes) { - t.Errorf("isAutoDetectedPure(%q) = false, want true", typ) - } - } - - notPureTypes := []string{"", "void", "int32", "uint32", "camera_status_t", "*ALooper"} - for _, typ := range notPureTypes { - if isAutoDetectedPure(typ, errorTypes) { - t.Errorf("isAutoDetectedPure(%q) = true, want false", typ) - } - } - - // *uint8 (pointer to scalar) should be pure. - if !isAutoDetectedPure("*uint8", errorTypes) { - t.Error("isAutoDetectedPure(*uint8) = false, want true") - } -} - -// TestDurationParamName verifies duration parameter name normalization. -func TestDurationParamName(t *testing.T) { - cases := []struct{ in_, want string }{ - {"timeoutNanoseconds", "timeout"}, - {"actualDurationNanos", "actualDuration"}, - {"initialTargetWorkDurationNanos", "initialTargetWorkDuration"}, - {"timeoutMillis", "timeout"}, - {"delayMicroseconds", "delay"}, - {"someOtherParam", "someOtherParam"}, - } - for _, tc := range cases { - if got := durationParamName(tc.in_); got != tc.want { - t.Errorf("durationParamName(%q) = %q, want %q", tc.in_, got, tc.want) - } - } -} - -// TestCapiArg_MultiLevelPointer verifies the fix for the multi-level pointer bug. -func TestCapiArg_MultiLevelPointer(t *testing.T) { - p := MergedParam{ - Name: "x", - GoType: "**Foo", - CapiType: "**Foo", - Remapped: true, - } - got := capiArg(p) - want := "(**capi.Foo)(x)" - if got != want { - t.Errorf("capiArg with **Foo = %q, want %q", got, want) - } - - // Single pointer should also work. - p2 := MergedParam{ - Name: "y", - GoType: "*Bar", - CapiType: "*Bar", - Remapped: true, - } - got2 := capiArg(p2) - want2 := "(*capi.Bar)(y)" - if got2 != want2 { - t.Errorf("capiArg with *Bar = %q, want %q", got2, want2) - } -} - -// TestCapiArgOrFixed_MultiLevelPointer verifies the fix applied to capiArgOrFixed. -func TestCapiArgOrFixed_MultiLevelPointer(t *testing.T) { - fm := FuncMap() - capiArgOrFixed := fm["capiArgOrFixed"].(func(MergedParam, map[string]string) string) - - p := MergedParam{ - Name: "x", - GoType: "**Foo", - CapiType: "**Foo", - Remapped: true, - } - got := capiArgOrFixed(p, nil) - // After fix: should produce (**capi.Foo)(x), not (*capi.*Foo)(x). - if strings.Contains(got, "*capi.*") { - t.Errorf("capiArgOrFixed produced invalid Go: %q", got) - } - want := "(**capi.Foo)(x)" - if got != want { - t.Errorf("capiArgOrFixed = %q, want %q", got, want) - } -} - -// TestCallbackCapiArg_MultiLevelPointer verifies the fix applied to callbackCapiArg. -func TestCallbackCapiArg_MultiLevelPointer(t *testing.T) { - fm := FuncMap() - callbackCapiArgFn := fm["callbackCapiArg"].(func(MergedParam, string) string) - - p := MergedParam{ - Name: "x", - GoType: "**Foo", - CapiType: "**Foo", - Remapped: true, - } - got := callbackCapiArgFn(p, "other") - if strings.Contains(got, "*capi.*") { - t.Errorf("callbackCapiArg produced invalid Go: %q", got) - } - want := "(**capi.Foo)(x)" - if got != want { - t.Errorf("callbackCapiArg = %q, want %q", got, want) - } -} diff --git a/tools/pkg/idiomgen/merge_test.go b/tools/pkg/idiomgen/merge_test.go deleted file mode 100644 index b77565a..0000000 --- a/tools/pkg/idiomgen/merge_test.go +++ /dev/null @@ -1,1713 +0,0 @@ -package idiomgen_test - -import ( - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/idiomgen" - "github.com/AndroidGoLab/ndk/tools/pkg/overlaymodel" - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -// buildFixture creates AAudio-like spec and overlay data for testing. -func buildFixture() (specmodel.Spec, overlaymodel.Overlay) { - spec := specmodel.Spec{ - Module: "aaudio", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/aaudio", - Types: map[string]specmodel.TypeDef{ - "AAudioStreamBuilder": { - Kind: "opaque_ptr", - CType: "AAudioStreamBuilder", - GoType: "*C.AAudioStreamBuilder", - }, - "Aaudio_result_t": { - Kind: "typedef_int32", - CType: "aaudio_result_t", - GoType: "int32", - }, - "Aaudio_direction_t": { - Kind: "typedef_int32", - CType: "aaudio_direction_t", - GoType: "int32", - }, - }, - Enums: map[string][]specmodel.EnumValue{ - "Aaudio_result_t": { - {Name: "AAUDIO_OK", Value: 0}, - {Name: "AAUDIO_ERROR_BASE", Value: -900}, - {Name: "AAUDIO_ERROR_DISCONNECTED", Value: -899}, - }, - "Aaudio_direction_t": { - {Name: "AAUDIO_DIRECTION_OUTPUT", Value: 0}, - {Name: "AAUDIO_DIRECTION_INPUT", Value: 1}, - }, - }, - Functions: map[string]specmodel.FuncDef{ - "AAudioStreamBuilder_setDeviceId": { - CName: "AAudioStreamBuilder_setDeviceId", - Params: []specmodel.Param{ - {Name: "builder", Type: "*AAudioStreamBuilder"}, - {Name: "deviceId", Type: "int32"}, - }, - Returns: "void", - }, - }, - Callbacks: map[string]specmodel.CallbackDef{ - "AAudioStream_dataCallback": { - Params: []specmodel.Param{ - {Name: "stream", Type: "*AAudioStream"}, - {Name: "userData", Type: "unsafe.Pointer"}, - {Name: "audioData", Type: "*void"}, - {Name: "numFrames", Type: "int32"}, - }, - Returns: "Aaudio_data_callback_result_t", - }, - }, - } - - overlay := overlaymodel.Overlay{ - Module: "aaudio", - Package: overlaymodel.PackageOverlay{ - GoName: "audio", - GoImport: "github.com/AndroidGoLab/ndk/audio", - Doc: "Package audio provides Go bindings for Android AAudio.", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "AAudioStreamBuilder": { - GoName: "StreamBuilder", - Constructor: "AAudio_createStreamBuilder", - Destructor: "AAudioStreamBuilder_delete", - Pattern: "builder", - }, - "Aaudio_result_t": { - GoError: true, - SuccessValue: "AAUDIO_OK", - ErrorPrefix: "audio", - }, - "Aaudio_direction_t": { - GoName: "Direction", - StripPrefix: "AAUDIO_DIRECTION_", - StringMethod: true, - }, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "AAudioStreamBuilder_setDeviceId": { - Receiver: "StreamBuilder", - GoName: "SetDeviceID", - Chain: true, - }, - }, - APILevels: map[string]int{ - "AAudioStream_release": 30, - }, - } - - return spec, overlay -} - -func TestMerge_PackageName(t *testing.T) { - spec, overlay := buildFixture() - merged := idiomgen.Merge(spec, overlay) - - if merged.PackageName != "audio" { - t.Errorf("PackageName = %q, want %q", merged.PackageName, "audio") - } - if merged.PackageImport != "github.com/AndroidGoLab/ndk/audio" { - t.Errorf("PackageImport = %q, want %q", merged.PackageImport, "github.com/AndroidGoLab/ndk/audio") - } - if merged.PackageDoc != "Package audio provides Go bindings for Android AAudio." { - t.Errorf("PackageDoc = %q", merged.PackageDoc) - } - if merged.SourcePackage != "github.com/AndroidGoLab/ndk/capi/aaudio" { - t.Errorf("SourcePackage = %q, want %q", merged.SourcePackage, "github.com/AndroidGoLab/ndk/capi/aaudio") - } -} - -func TestMerge_OpaqueTypes(t *testing.T) { - spec, overlay := buildFixture() - merged := idiomgen.Merge(spec, overlay) - - if len(merged.OpaqueTypes) != 1 { - t.Fatalf("OpaqueTypes count = %d, want 1", len(merged.OpaqueTypes)) - } - sb, ok := merged.OpaqueTypes["StreamBuilder"] - if !ok { - t.Fatal("OpaqueTypes missing StreamBuilder") - } - if sb.GoName != "StreamBuilder" { - t.Errorf("GoName = %q, want %q", sb.GoName, "StreamBuilder") - } - if sb.CapiType != "AAudioStreamBuilder" { - t.Errorf("CapiType = %q, want %q", sb.CapiType, "AAudioStreamBuilder") - } - if sb.Constructor != "AAudio_createStreamBuilder" { - t.Errorf("Constructor = %q", sb.Constructor) - } - if sb.Destructor != "AAudioStreamBuilder_delete" { - t.Errorf("Destructor = %q", sb.Destructor) - } - if sb.Pattern != "builder" { - t.Errorf("Pattern = %q, want %q", sb.Pattern, "builder") - } -} - -func TestMerge_ErrorEnums(t *testing.T) { - spec, overlay := buildFixture() - merged := idiomgen.Merge(spec, overlay) - - if len(merged.ErrorEnums) != 1 { - t.Fatalf("ErrorEnums count = %d, want 1", len(merged.ErrorEnums)) - } - ee := merged.ErrorEnums[0] - if ee.GoName != "Aaudio_result_t" { - t.Errorf("GoName = %q, want %q", ee.GoName, "Aaudio_result_t") - } - if ee.Prefix != "audio" { - t.Errorf("Prefix = %q, want %q", ee.Prefix, "audio") - } - if ee.SuccessValue != "AAUDIO_OK" { - t.Errorf("SuccessValue = %q", ee.SuccessValue) - } - if len(ee.Values) != 3 { - t.Fatalf("error enum values count = %d, want 3", len(ee.Values)) - } - // Values should preserve the spec names as both GoName and SpecName. - if ee.Values[0].SpecName != "AAUDIO_OK" { - t.Errorf("Values[0].SpecName = %q", ee.Values[0].SpecName) - } -} - -func TestMerge_ValueEnums(t *testing.T) { - spec, overlay := buildFixture() - merged := idiomgen.Merge(spec, overlay) - - if len(merged.ValueEnums) != 1 { - t.Fatalf("ValueEnums count = %d, want 1", len(merged.ValueEnums)) - } - ve := merged.ValueEnums[0] - if ve.GoName != "Direction" { - t.Errorf("GoName = %q, want %q", ve.GoName, "Direction") - } - if ve.SpecName != "Aaudio_direction_t" { - t.Errorf("SpecName = %q, want %q", ve.SpecName, "Aaudio_direction_t") - } - if !ve.StringMethod { - t.Error("StringMethod = false, want true") - } - if len(ve.Values) != 2 { - t.Fatalf("value enum values count = %d, want 2", len(ve.Values)) - } - // Prefix stripping: "AAUDIO_DIRECTION_OUTPUT" → "Output" - if ve.Values[0].GoName != "Output" { - t.Errorf("Values[0].GoName = %q, want %q", ve.Values[0].GoName, "Output") - } - if ve.Values[0].SpecName != "AAUDIO_DIRECTION_OUTPUT" { - t.Errorf("Values[0].SpecName = %q", ve.Values[0].SpecName) - } - if ve.Values[1].GoName != "Input" { - t.Errorf("Values[1].GoName = %q, want %q", ve.Values[1].GoName, "Input") - } -} - -func TestMerge_Methods(t *testing.T) { - spec, overlay := buildFixture() - merged := idiomgen.Merge(spec, overlay) - - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - m := merged.Methods[0] - if m.GoName != "SetDeviceID" { - t.Errorf("GoName = %q, want %q", m.GoName, "SetDeviceID") - } - if m.CName != "AAudioStreamBuilder_setDeviceId" { - t.Errorf("CName = %q", m.CName) - } - if m.ReceiverType != "StreamBuilder" { - t.Errorf("ReceiverType = %q, want %q", m.ReceiverType, "StreamBuilder") - } - if !m.Chain { - t.Error("Chain = false, want true") - } - // The receiver param should be excluded from Params. - // The function has builder (*AAudioStreamBuilder) and deviceId (int32). - // builder is the receiver, so only deviceId should remain (normalized to deviceID). - if len(m.Params) != 1 { - t.Fatalf("Params count = %d, want 1", len(m.Params)) - } - if m.Params[0].Name != "deviceID" { - t.Errorf("Params[0].Name = %q, want %q", m.Params[0].Name, "deviceID") - } -} - -func TestMerge_Callbacks(t *testing.T) { - spec, overlay := buildFixture() - merged := idiomgen.Merge(spec, overlay) - - if len(merged.Callbacks) != 1 { - t.Fatalf("Callbacks count = %d, want 1", len(merged.Callbacks)) - } - cb := merged.Callbacks[0] - if cb.SpecName != "AAudioStream_dataCallback" { - t.Errorf("SpecName = %q", cb.SpecName) - } - if len(cb.Params) != 4 { - t.Fatalf("Params count = %d, want 4", len(cb.Params)) - } - if cb.Returns != "Aaudio_data_callback_result_t" { - t.Errorf("Returns = %q", cb.Returns) - } -} - -func TestMerge_APILevels(t *testing.T) { - spec, overlay := buildFixture() - merged := idiomgen.Merge(spec, overlay) - - if len(merged.APILevels) != 1 { - t.Fatalf("APILevels count = %d, want 1", len(merged.APILevels)) - } - if merged.APILevels["AAudioStream_release"] != 30 { - t.Errorf("APILevel = %d, want 30", merged.APILevels["AAudioStream_release"]) - } -} - -func TestMerge_FunctionWithoutReceiver_Skipped(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Functions: map[string]specmodel.FuncDef{ - "freeFunction": { - CName: "freeFunction", - Returns: "void", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{ - GoName: "test", - GoImport: "github.com/AndroidGoLab/ndk/test", - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "freeFunction": { - GoName: "FreeFunction", - // No Receiver → should be skipped - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 0 { - t.Errorf("Methods count = %d, want 0 (free functions skipped)", len(merged.Methods)) - } -} - -func TestMerge_TypeWithoutOverlayGoName_UsesSpecName(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "SomeOpaqueHandle": { - Kind: "opaque_ptr", - CType: "SomeOpaqueHandle", - GoType: "*C.SomeOpaqueHandle", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{ - GoName: "test", - GoImport: "github.com/AndroidGoLab/ndk/test", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "SomeOpaqueHandle": { - // No GoName → should use spec name - Pattern: "ref_counted", - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.OpaqueTypes) != 1 { - t.Fatalf("OpaqueTypes count = %d, want 1", len(merged.OpaqueTypes)) - } - ot, ok := merged.OpaqueTypes["SomeOpaqueHandle"] - if !ok { - t.Fatal("OpaqueTypes missing SomeOpaqueHandle") - } - if ot.GoName != "SomeOpaqueHandle" { - t.Errorf("GoName = %q, want %q", ot.GoName, "SomeOpaqueHandle") - } - if ot.Pattern != "ref_counted" { - t.Errorf("Pattern = %q, want %q", ot.Pattern, "ref_counted") - } -} - -func TestMerge_MethodAPILevel(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "Handle": {Kind: "opaque_ptr", CType: "Handle", GoType: "*C.Handle"}, - }, - Functions: map[string]specmodel.FuncDef{ - "Handle_doSomething": { - CName: "Handle_doSomething", - Params: []specmodel.Param{ - {Name: "h", Type: "*Handle"}, - }, - Returns: "void", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{ - GoName: "test", - GoImport: "github.com/AndroidGoLab/ndk/test", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "Handle": {GoName: "Handle"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "Handle_doSomething": { - Receiver: "Handle", - GoName: "DoSomething", - }, - }, - APILevels: map[string]int{ - "Handle_doSomething": 31, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - if merged.Methods[0].APILevel != 31 { - t.Errorf("APILevel = %d, want 31", merged.Methods[0].APILevel) - } -} - -func TestMerge_ValueEnum_NoStripPrefix(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "Color_t": {Kind: "typedef_int32", CType: "color_t", GoType: "int32"}, - }, - Enums: map[string][]specmodel.EnumValue{ - "Color_t": { - {Name: "RED", Value: 0}, - {Name: "GREEN", Value: 1}, - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{ - GoName: "test", - GoImport: "github.com/AndroidGoLab/ndk/test", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "Color_t": {GoName: "Color"}, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.ValueEnums) != 1 { - t.Fatalf("ValueEnums count = %d, want 1", len(merged.ValueEnums)) - } - // Without strip_prefix, GoName should be the raw spec name. - if merged.ValueEnums[0].Values[0].GoName != "RED" { - t.Errorf("Values[0].GoName = %q, want %q", merged.ValueEnums[0].Values[0].GoName, "RED") - } -} - -func TestMerge_CallbackWithoutOverlayAnnotation(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Callbacks: map[string]specmodel.CallbackDef{ - "myCallback": { - Params: []specmodel.Param{{Name: "x", Type: "int32"}}, - Returns: "void", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{ - GoName: "test", - GoImport: "github.com/AndroidGoLab/ndk/test", - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Callbacks) != 1 { - t.Fatalf("Callbacks count = %d, want 1", len(merged.Callbacks)) - } - cb := merged.Callbacks[0] - if cb.SpecName != "myCallback" { - t.Errorf("SpecName = %q", cb.SpecName) - } - if cb.GoCallbackType != "" { - t.Errorf("GoCallbackType = %q, want empty", cb.GoCallbackType) - } -} - -func TestMerge_CallbackAnnotationMatchesByType(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Functions: map[string]specmodel.FuncDef{ - "setDataCallback": { - CName: "setDataCallback", - Params: []specmodel.Param{ - {Name: "h", Type: "*Handle"}, - {Name: "cb", Type: "myDataCallback"}, - {Name: "userData", Type: "unsafe.Pointer"}, - }, - Returns: "void", - }, - "setErrorCallback": { - CName: "setErrorCallback", - Params: []specmodel.Param{ - {Name: "h", Type: "*Handle"}, - {Name: "cb", Type: "myErrorCallback"}, - {Name: "userData", Type: "unsafe.Pointer"}, - }, - Returns: "void", - }, - }, - Callbacks: map[string]specmodel.CallbackDef{ - "myDataCallback": { - Params: []specmodel.Param{{Name: "data", Type: "*byte"}}, - Returns: "int32", - }, - "myErrorCallback": { - Params: []specmodel.Param{{Name: "err", Type: "int32"}}, - Returns: "void", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{ - GoName: "test", - GoImport: "github.com/AndroidGoLab/ndk/test", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "Handle": {GoName: "Handle"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "setDataCallback": { - Receiver: "Handle", - GoName: "SetDataCallback", - Chain: true, - CallbackParam: "cb", - GoCallbackType: "DataCallback", - GoCallbackSig: "func(data []byte) int", - }, - "setErrorCallback": { - Receiver: "Handle", - GoName: "SetErrorCallback", - Chain: true, - CallbackParam: "cb", - GoCallbackType: "ErrorCallback", - GoCallbackSig: "func(err error)", - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - - if len(merged.Callbacks) != 2 { - t.Fatalf("Callbacks count = %d, want 2", len(merged.Callbacks)) - } - - // Callbacks are sorted by name, so myDataCallback comes first. - dataCb := merged.Callbacks[0] - if dataCb.SpecName != "myDataCallback" { - t.Errorf("Callbacks[0].SpecName = %q, want %q", dataCb.SpecName, "myDataCallback") - } - if dataCb.GoCallbackType != "DataCallback" { - t.Errorf("Callbacks[0].GoCallbackType = %q, want %q", dataCb.GoCallbackType, "DataCallback") - } - if dataCb.GoCallbackSig != "func(data []byte) int" { - t.Errorf("Callbacks[0].GoCallbackSig = %q", dataCb.GoCallbackSig) - } - - errCb := merged.Callbacks[1] - if errCb.SpecName != "myErrorCallback" { - t.Errorf("Callbacks[1].SpecName = %q, want %q", errCb.SpecName, "myErrorCallback") - } - if errCb.GoCallbackType != "ErrorCallback" { - t.Errorf("Callbacks[1].GoCallbackType = %q, want %q", errCb.GoCallbackType, "ErrorCallback") - } -} - -func TestMerge_FunctionNotInOverlay_AutoGenerated(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Functions: map[string]specmodel.FuncDef{ - "unknownFunc": { - CName: "unknownFunc", - Returns: "void", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{ - GoName: "test", - GoImport: "github.com/AndroidGoLab/ndk/test", - }, - } - merged := idiomgen.Merge(spec, overlay) - // Without overlay, unknownFunc has no receiver match — becomes a free function. - if len(merged.Methods) != 0 { - t.Errorf("Methods count = %d, want 0", len(merged.Methods)) - } - if len(merged.FreeFunctions) != 1 { - t.Fatalf("FreeFunctions count = %d, want 1", len(merged.FreeFunctions)) - } - if merged.FreeFunctions[0].GoName != "UnknownFunc" { - t.Errorf("GoName = %q, want %q", merged.FreeFunctions[0].GoName, "UnknownFunc") - } -} - -func TestMerge_ErrorEnumWithStripPrefix(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "Result_t": {Kind: "typedef_int32"}, - }, - Enums: map[string][]specmodel.EnumValue{ - "Result_t": { - {Name: "OK", Value: 0}, - {Name: "ERROR_DISCONNECTED", Value: -1}, - {Name: "ERROR_TIMEOUT", Value: -2}, - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - Types: map[string]overlaymodel.TypeOverlay{ - "Result_t": { - GoError: true, - SuccessValue: "OK", - ErrorPrefix: "test", - StripPrefix: "ERROR_", - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.ErrorEnums) != 1 { - t.Fatalf("ErrorEnums count = %d, want 1", len(merged.ErrorEnums)) - } - ee := merged.ErrorEnums[0] - // Success value keeps its raw name. - if ee.Values[0].GoName != "OK" { - t.Errorf("Values[0].GoName = %q, want %q", ee.Values[0].GoName, "OK") - } - // Error values get Err prefix + stripped + title-cased. - if ee.Values[1].GoName != "ErrDisconnected" { - t.Errorf("Values[1].GoName = %q, want %q", ee.Values[1].GoName, "ErrDisconnected") - } - if ee.Values[2].GoName != "ErrTimeout" { - t.Errorf("Values[2].GoName = %q, want %q", ee.Values[2].GoName, "ErrTimeout") - } -} - -func TestMerge_AutoDeriveGoName(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "MyHandle": {Kind: "opaque_ptr", CType: "MyHandle", GoType: "*C.MyHandle"}, - }, - Functions: map[string]specmodel.FuncDef{ - "MyHandle_setChannelCount": { - CName: "MyHandle_setChannelCount", - Params: []specmodel.Param{ - {Name: "h", Type: "*MyHandle"}, - {Name: "count", Type: "int32"}, - }, - Returns: "void", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - Types: map[string]overlaymodel.TypeOverlay{ - "MyHandle": {GoName: "Handle"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "MyHandle_setChannelCount": { - Receiver: "Handle", - // No GoName — should auto-derive "SetChannelCount" - Chain: true, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - if merged.Methods[0].GoName != "SetChannelCount" { - t.Errorf("GoName = %q, want %q", merged.Methods[0].GoName, "SetChannelCount") - } -} - -func TestMerge_ParamTypeMapping(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "Handle": {Kind: "opaque_ptr", CType: "Handle", GoType: "*C.Handle"}, - "Direction_t": {Kind: "typedef_int32", CType: "direction_t", GoType: "int32"}, - }, - Enums: map[string][]specmodel.EnumValue{ - "Direction_t": {{Name: "DIR_OUT", Value: 0}}, - }, - Functions: map[string]specmodel.FuncDef{ - "Handle_setDirection": { - CName: "Handle_setDirection", - Params: []specmodel.Param{ - {Name: "h", Type: "*Handle"}, - {Name: "dir", Type: "Direction_t"}, - }, - Returns: "void", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - Types: map[string]overlaymodel.TypeOverlay{ - "Handle": {GoName: "Handle"}, - "Direction_t": {GoName: "Direction", StripPrefix: "DIR_"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "Handle_setDirection": { - Receiver: "Handle", - GoName: "SetDirection", - Chain: true, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - // Param type should be resolved from "Direction_t" to "Direction". - if len(merged.Methods[0].Params) != 1 { - t.Fatalf("Params count = %d, want 1", len(merged.Methods[0].Params)) - } - if merged.Methods[0].Params[0].GoType != "Direction" { - t.Errorf("Param GoType = %q, want %q", merged.Methods[0].Params[0].GoType, "Direction") - } -} - -func TestMerge_EnumWithoutOverlay_AutoGenerated(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "Orphan_t": {Kind: "typedef_int32", CType: "orphan_t", GoType: "int32"}, - }, - Enums: map[string][]specmodel.EnumValue{ - "Orphan_t": {{Name: "ORPHAN_A", Value: 0}}, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - // No type overlay for Orphan_t — should be auto-generated with auto-naming. - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.ValueEnums) != 1 { - t.Fatalf("ValueEnums count = %d, want 1 (enum should be auto-generated)", len(merged.ValueEnums)) - } - ve := merged.ValueEnums[0] - // Auto-naming: "Orphan_t" stays as "Orphan_t" (no leading A to strip). - if ve.GoName != "Orphan_t" { - t.Errorf("GoName = %q, want %q", ve.GoName, "Orphan_t") - } - if ve.SpecName != "Orphan_t" { - t.Errorf("SpecName = %q, want %q", ve.SpecName, "Orphan_t") - } -} - -func TestMerge_CallbackStructs(t *testing.T) { - spec := specmodel.Spec{ - Module: "camera", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/camera", - Types: map[string]specmodel.TypeDef{ - "ACameraDevice_StateCallbacks": {Kind: "opaque_ptr", CType: "ACameraDevice_StateCallbacks"}, - }, - Structs: map[string]specmodel.StructDef{ - "ACameraDevice_StateCallbacks": { - Fields: []specmodel.StructField{ - {Name: "context", Type: "void*"}, - {Name: "onDisconnected", Type: "func_ptr", Params: []specmodel.Param{ - {Name: "context", Type: "void*"}, - {Name: "device", Type: "*ACameraDevice"}, - }}, - {Name: "onError", Type: "func_ptr", Params: []specmodel.Param{ - {Name: "context", Type: "void*"}, - {Name: "device", Type: "*ACameraDevice"}, - {Name: "error", Type: "int"}, - }}, - }, - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "camera", - Package: overlaymodel.PackageOverlay{GoName: "camera", GoImport: "github.com/AndroidGoLab/ndk/camera"}, - Types: map[string]overlaymodel.TypeOverlay{ - "ACameraDevice_StateCallbacks": {GoName: "DeviceStateCallbacks"}, - }, - CallbackStructs: map[string]overlaymodel.CallbackStructOverlay{ - "ACameraDevice_StateCallbacks": { - GoName: "DeviceStateCallbacks", - ContextField: "context", - Fields: map[string]overlaymodel.CallbackFieldOverlay{ - "onDisconnected": {GoName: "OnDisconnected", GoSignature: "func()"}, - "onError": {GoName: "OnError", GoSignature: "func(int)"}, - }, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - - if len(merged.CallbackStructs) != 1 { - t.Fatalf("CallbackStructs count = %d, want 1", len(merged.CallbackStructs)) - } - cs := merged.CallbackStructs[0] - if cs.GoName != "DeviceStateCallbacks" { - t.Errorf("GoName = %q, want %q", cs.GoName, "DeviceStateCallbacks") - } - if cs.ContextField != "context" { - t.Errorf("ContextField = %q", cs.ContextField) - } - if len(cs.Fields) != 2 { - t.Fatalf("Fields count = %d, want 2", len(cs.Fields)) - } - if cs.Fields[0].CName != "onDisconnected" { - t.Errorf("Fields[0].CName = %q", cs.Fields[0].CName) - } - if cs.Fields[0].GoName != "OnDisconnected" { - t.Errorf("Fields[0].GoName = %q", cs.Fields[0].GoName) - } - if cs.Fields[0].GoSignature != "func()" { - t.Errorf("Fields[0].GoSignature = %q", cs.Fields[0].GoSignature) - } - if len(cs.Fields[0].Params) != 2 { - t.Fatalf("Fields[0].Params count = %d, want 2", len(cs.Fields[0].Params)) - } -} - -func TestMerge_StructAccessors(t *testing.T) { - spec := specmodel.Spec{ - Module: "camera", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/camera", - } - overlay := overlaymodel.Overlay{ - Module: "camera", - Package: overlaymodel.PackageOverlay{GoName: "camera", GoImport: "github.com/AndroidGoLab/ndk/camera"}, - StructAccessors: map[string]overlaymodel.StructAccessorOverlay{ - "ACameraIdList": { - CountField: "numCameras", - ItemsField: "cameraIds", - ItemType: "string", - DeleteFunc: "ACameraManager_deleteCameraIdList", - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - - if len(merged.StructAccessors) != 1 { - t.Fatalf("StructAccessors count = %d, want 1", len(merged.StructAccessors)) - } - sa := merged.StructAccessors[0] - if sa.SpecName != "ACameraIdList" { - t.Errorf("SpecName = %q", sa.SpecName) - } - if sa.CountField != "numCameras" { - t.Errorf("CountField = %q", sa.CountField) - } - if sa.ItemType != "string" { - t.Errorf("ItemType = %q", sa.ItemType) - } - if sa.DeleteFunc != "ACameraManager_deleteCameraIdList" { - t.Errorf("DeleteFunc = %q", sa.DeleteFunc) - } -} - -func TestMerge_Lifecycle(t *testing.T) { - spec := specmodel.Spec{ - Module: "nativeactivity", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/nativeactivity", - Types: map[string]specmodel.TypeDef{ - "ANativeActivity": {Kind: "opaque_ptr", CType: "ANativeActivity"}, - }, - Structs: map[string]specmodel.StructDef{ - "ANativeActivityCallbacks": { - Fields: []specmodel.StructField{ - {Name: "onStart", Type: "func_ptr", Params: []specmodel.Param{ - {Name: "activity", Type: "*ANativeActivity"}, - }}, - {Name: "onResume", Type: "func_ptr", Params: []specmodel.Param{ - {Name: "activity", Type: "*ANativeActivity"}, - }}, - }, - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "nativeactivity", - Package: overlaymodel.PackageOverlay{GoName: "activity", GoImport: "github.com/AndroidGoLab/ndk/activity"}, - Types: map[string]overlaymodel.TypeOverlay{ - "ANativeActivity": {GoName: "Activity"}, - }, - Lifecycle: &overlaymodel.LifecycleOverlay{ - EntryPoint: "ANativeActivity_onCreate", - ActivityType: "ANativeActivity", - CallbacksAccessor: "activity->callbacks", - CallbackStruct: "ANativeActivityCallbacks", - }, - } - merged := idiomgen.Merge(spec, overlay) - - if merged.Lifecycle == nil { - t.Fatal("Lifecycle is nil") - } - if merged.Lifecycle.EntryPoint != "ANativeActivity_onCreate" { - t.Errorf("EntryPoint = %q", merged.Lifecycle.EntryPoint) - } - if merged.Lifecycle.GoActivityType != "Activity" { - t.Errorf("GoActivityType = %q", merged.Lifecycle.GoActivityType) - } - if len(merged.Lifecycle.Fields) != 2 { - t.Fatalf("Lifecycle fields = %d, want 2", len(merged.Lifecycle.Fields)) - } - if merged.Lifecycle.Fields[0].CName != "onStart" { - t.Errorf("Fields[0].CName = %q", merged.Lifecycle.Fields[0].CName) - } - if merged.Lifecycle.Fields[0].GoName != "OnStart" { - t.Errorf("Fields[0].GoName = %q", merged.Lifecycle.Fields[0].GoName) - } -} - -func TestMerge_FixedParams(t *testing.T) { - spec := specmodel.Spec{ - Module: "camera", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/camera", - Types: map[string]specmodel.TypeDef{ - "CaptureSession": {Kind: "opaque_ptr", CType: "CaptureSession"}, - }, - Functions: map[string]specmodel.FuncDef{ - "CaptureSession_setRepeatingRequest": { - CName: "CaptureSession_setRepeatingRequest", - Params: []specmodel.Param{ - {Name: "session", Type: "*CaptureSession"}, - {Name: "callbacks", Type: "*CaptureCallbacks"}, - {Name: "numRequests", Type: "int"}, - {Name: "requests", Type: "**CaptureRequest"}, - {Name: "sequenceId", Type: "*int"}, - }, - Returns: "Camera_status_t", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "camera", - Package: overlaymodel.PackageOverlay{GoName: "camera", GoImport: "github.com/AndroidGoLab/ndk/camera"}, - Types: map[string]overlaymodel.TypeOverlay{ - "CaptureSession": {GoName: "CaptureSession"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "CaptureSession_setRepeatingRequest": { - Receiver: "CaptureSession", - GoName: "SetRepeatingRequest", - FixedParams: map[string]string{ - "callbacks": "nil", - "numRequests": "1", - "sequenceId": "nil", - }, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - m := merged.Methods[0] - if len(m.FixedParams) != 3 { - t.Fatalf("FixedParams count = %d, want 3", len(m.FixedParams)) - } - if m.FixedParams["callbacks"] != "nil" { - t.Errorf("FixedParams[callbacks] = %q", m.FixedParams["callbacks"]) - } - if m.FixedParams["numRequests"] != "1" { - t.Errorf("FixedParams[numRequests] = %q", m.FixedParams["numRequests"]) - } -} - -func TestMerge_MethodWithCallbackParam(t *testing.T) { - spec := specmodel.Spec{ - Module: "camera", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/camera", - Types: map[string]specmodel.TypeDef{ - "ACameraManager": {Kind: "opaque_ptr", CType: "ACameraManager"}, - }, - Functions: map[string]specmodel.FuncDef{ - "ACameraManager_openCamera": { - CName: "ACameraManager_openCamera", - Params: []specmodel.Param{ - {Name: "manager", Type: "*ACameraManager"}, - {Name: "cameraId", Type: "string"}, - {Name: "callbacks", Type: "*ACameraDevice_StateCallbacks"}, - {Name: "device", Type: "**ACameraDevice", Direction: "out"}, - }, - Returns: "Camera_status_t", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "camera", - Package: overlaymodel.PackageOverlay{GoName: "camera", GoImport: "github.com/AndroidGoLab/ndk/camera"}, - Types: map[string]overlaymodel.TypeOverlay{ - "ACameraManager": {GoName: "Manager"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "ACameraManager_openCamera": { - Receiver: "Manager", - GoName: "OpenCamera", - ReturnsNew: "Device", - CallbackParam: "callbacks", - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - m := merged.Methods[0] - if m.CallbackParam != "callbacks" { - t.Errorf("CallbackParam = %q, want %q", m.CallbackParam, "callbacks") - } - if m.CallbackStruct != "ACameraDevice_StateCallbacks" { - t.Errorf("CallbackStruct = %q, want %q", m.CallbackStruct, "ACameraDevice_StateCallbacks") - } -} - -func TestMerge_ReturnsFrames(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "Stream": {Kind: "opaque_ptr", CType: "Stream", GoType: "*C.Stream"}, - }, - Functions: map[string]specmodel.FuncDef{ - "Stream_write": { - CName: "Stream_write", - Params: []specmodel.Param{ - {Name: "s", Type: "*Stream"}, - {Name: "data", Type: "unsafe.Pointer"}, - {Name: "frames", Type: "int32"}, - }, - Returns: "int32", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - Types: map[string]overlaymodel.TypeOverlay{ - "Stream": {GoName: "Stream"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "Stream_write": { - Receiver: "Stream", - GoName: "Write", - ReturnsFrames: true, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - if !merged.Methods[0].ReturnsFrames { - t.Error("ReturnsFrames = false, want true") - } -} - -func TestMerge_OutputParams_Method(t *testing.T) { - spec := specmodel.Spec{ - Module: "media", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/media", - Types: map[string]specmodel.TypeDef{ - "AImageReader": {Kind: "opaque_ptr", CType: "AImageReader", GoType: "*C.AImageReader"}, - "AImage": {Kind: "opaque_ptr", CType: "AImage", GoType: "*C.AImage"}, - }, - Functions: map[string]specmodel.FuncDef{ - "AImageReader_acquireNextImage": { - CName: "AImageReader_acquireNextImage", - Params: []specmodel.Param{ - {Name: "reader", Type: "*AImageReader"}, - {Name: "image", Type: "**AImage", Direction: "out"}, - }, - Returns: "media_status_t", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "media", - Package: overlaymodel.PackageOverlay{ - GoName: "media", - GoImport: "github.com/AndroidGoLab/ndk/media", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "AImageReader": {GoName: "ImageReader"}, - "AImage": {GoName: "Image"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "AImageReader_acquireNextImage": { - Receiver: "ImageReader", - GoName: "AcquireNextImage", - OutputParams: map[string]string{ - "image": "*Image", - }, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - m := merged.Methods[0] - if m.GoName != "AcquireNextImage" { - t.Errorf("GoName = %q, want %q", m.GoName, "AcquireNextImage") - } - if len(m.OutputParams) != 1 { - t.Fatalf("OutputParams count = %d, want 1", len(m.OutputParams)) - } - op := m.OutputParams[0] - if op.CParamName != "image" { - t.Errorf("CParamName = %q, want %q", op.CParamName, "image") - } - if op.GoType != "*Image" { - t.Errorf("GoType = %q, want %q", op.GoType, "*Image") - } - if op.CapiType != "*capi.AImage" { - t.Errorf("CapiType = %q, want %q", op.CapiType, "*capi.AImage") - } - if !op.IsHandle { - t.Error("IsHandle = false, want true") - } - // media_status_t is not bool, so ReturnsBool must be false. - if m.ReturnsBool { - t.Error("ReturnsBool = true, want false") - } - // The image param should be marked as "out" so it's filtered from visible params. - foundOut := false - for _, p := range m.Params { - if p.Name == "image" && p.Direction == "out" { - foundOut = true - } - } - if !foundOut { - t.Error("output param 'image' not marked as direction=out") - } -} - -func TestMerge_OutputParams_FreeFunction(t *testing.T) { - spec := specmodel.Spec{ - Module: "media", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/media", - Types: map[string]specmodel.TypeDef{ - "AImageReader": {Kind: "opaque_ptr", CType: "AImageReader", GoType: "*C.AImageReader"}, - }, - Functions: map[string]specmodel.FuncDef{ - "AImageReader_new": { - CName: "AImageReader_new", - Params: []specmodel.Param{ - {Name: "width", Type: "int32"}, - {Name: "height", Type: "int32"}, - {Name: "format", Type: "int32"}, - {Name: "maxImages", Type: "int32"}, - {Name: "reader", Type: "**AImageReader", Direction: "out"}, - }, - Returns: "media_status_t", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "media", - Package: overlaymodel.PackageOverlay{ - GoName: "media", - GoImport: "github.com/AndroidGoLab/ndk/media", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "AImageReader": {GoName: "ImageReader"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "AImageReader_new": { - GoName: "NewImageReader", - ReturnsNew: "ImageReader", - OutputParams: map[string]string{ - "reader": "*ImageReader", - }, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.FreeFunctions) != 1 { - t.Fatalf("FreeFunctions count = %d, want 1", len(merged.FreeFunctions)) - } - f := merged.FreeFunctions[0] - if f.GoName != "NewImageReader" { - t.Errorf("GoName = %q, want %q", f.GoName, "NewImageReader") - } - if f.ReturnsNew != "ImageReader" { - t.Errorf("ReturnsNew = %q, want %q", f.ReturnsNew, "ImageReader") - } - if len(f.OutputParams) != 1 { - t.Fatalf("OutputParams count = %d, want 1", len(f.OutputParams)) - } - op := f.OutputParams[0] - if op.CParamName != "reader" { - t.Errorf("CParamName = %q, want %q", op.CParamName, "reader") - } - if op.GoType != "*ImageReader" { - t.Errorf("GoType = %q, want %q", op.GoType, "*ImageReader") - } - if !op.IsHandle { - t.Error("IsHandle = false, want true") - } -} - -func TestMerge_OutputParams_ScalarTypes(t *testing.T) { - spec := specmodel.Spec{ - Module: "media", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/media", - Types: map[string]specmodel.TypeDef{ - "AImage": {Kind: "opaque_ptr", CType: "AImage", GoType: "*C.AImage"}, - }, - Functions: map[string]specmodel.FuncDef{ - "AImage_getPlaneData": { - CName: "AImage_getPlaneData", - Params: []specmodel.Param{ - {Name: "image", Type: "*AImage"}, - {Name: "planeIdx", Type: "int32"}, - {Name: "data", Type: "**uint8", Direction: "out"}, - {Name: "dataLength", Type: "*int32"}, - }, - Returns: "media_status_t", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "media", - Package: overlaymodel.PackageOverlay{ - GoName: "media", - GoImport: "github.com/AndroidGoLab/ndk/media", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "AImage": {GoName: "Image"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "AImage_getPlaneData": { - Receiver: "Image", - GoName: "PlaneData", - OutputParams: map[string]string{ - "data": "*uint8", - "dataLength": "int32", - }, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - m := merged.Methods[0] - if len(m.OutputParams) != 2 { - t.Fatalf("OutputParams count = %d, want 2", len(m.OutputParams)) - } - // data: **uint8 -> local var *uint8, scalar pointer - dataOp := m.OutputParams[0] - if dataOp.CParamName != "data" { - t.Errorf("OutputParams[0].CParamName = %q, want %q", dataOp.CParamName, "data") - } - if dataOp.GoType != "*uint8" { - t.Errorf("OutputParams[0].GoType = %q, want %q", dataOp.GoType, "*uint8") - } - if dataOp.CapiType != "*uint8" { - t.Errorf("OutputParams[0].CapiType = %q, want %q", dataOp.CapiType, "*uint8") - } - if dataOp.IsHandle { - t.Error("OutputParams[0].IsHandle = true, want false") - } - // dataLength: *int32 -> local var int32, scalar value - lenOp := m.OutputParams[1] - if lenOp.CParamName != "dataLength" { - t.Errorf("OutputParams[1].CParamName = %q, want %q", lenOp.CParamName, "dataLength") - } - if lenOp.GoType != "int32" { - t.Errorf("OutputParams[1].GoType = %q, want %q", lenOp.GoType, "int32") - } - if lenOp.CapiType != "int32" { - t.Errorf("OutputParams[1].CapiType = %q, want %q", lenOp.CapiType, "int32") - } - if lenOp.IsHandle { - t.Error("OutputParams[1].IsHandle = true, want false") - } -} - -func TestMerge_OutputParams_ReturnsBool_Method(t *testing.T) { - spec := specmodel.Spec{ - Module: "persistablebundle", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/persistablebundle", - Types: map[string]specmodel.TypeDef{ - "APersistableBundle": {Kind: "opaque_ptr", CType: "APersistableBundle", GoType: "*C.APersistableBundle"}, - }, - Functions: map[string]specmodel.FuncDef{ - "APersistableBundle_getPersistableBundle": { - CName: "APersistableBundle_getPersistableBundle", - Params: []specmodel.Param{ - {Name: "pBundle", Type: "*APersistableBundle"}, - {Name: "key", Type: "string"}, - {Name: "val", Type: "**APersistableBundle", Direction: "out"}, - }, - Returns: "bool", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "persistablebundle", - Package: overlaymodel.PackageOverlay{ - GoName: "persistablebundle", - GoImport: "github.com/AndroidGoLab/ndk/persistablebundle", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "APersistableBundle": {GoName: "PersistableBundle"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "APersistableBundle_getPersistableBundle": { - Receiver: "PersistableBundle", - GoName: "PersistableBundle", - OutputParams: map[string]string{ - "val": "*PersistableBundle", - }, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - m := merged.Methods[0] - if m.GoName != "PersistableBundle" { - t.Errorf("GoName = %q, want %q", m.GoName, "PersistableBundle") - } - // The C function returns bool, so ReturnsBool must be true. - if !m.ReturnsBool { - t.Error("ReturnsBool = false, want true") - } - if len(m.OutputParams) != 1 { - t.Fatalf("OutputParams count = %d, want 1", len(m.OutputParams)) - } - op := m.OutputParams[0] - if op.CParamName != "val" { - t.Errorf("CParamName = %q, want %q", op.CParamName, "val") - } - if op.GoType != "*PersistableBundle" { - t.Errorf("GoType = %q, want %q", op.GoType, "*PersistableBundle") - } - if op.CapiType != "*capi.APersistableBundle" { - t.Errorf("CapiType = %q, want %q", op.CapiType, "*capi.APersistableBundle") - } - if !op.IsHandle { - t.Error("IsHandle = false, want true") - } -} - -func TestMerge_OutputParams_ReturnsBool_FreeFunction(t *testing.T) { - spec := specmodel.Spec{ - Module: "persistablebundle", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/persistablebundle", - Types: map[string]specmodel.TypeDef{ - "APersistableBundle": {Kind: "opaque_ptr", CType: "APersistableBundle", GoType: "*C.APersistableBundle"}, - }, - Functions: map[string]specmodel.FuncDef{ - "APersistableBundle_createFromBytes": { - CName: "APersistableBundle_createFromBytes", - Params: []specmodel.Param{ - {Name: "data", Type: "*uint8"}, - {Name: "size", Type: "int32"}, - {Name: "outBundle", Type: "**APersistableBundle", Direction: "out"}, - }, - Returns: "bool", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "persistablebundle", - Package: overlaymodel.PackageOverlay{ - GoName: "persistablebundle", - GoImport: "github.com/AndroidGoLab/ndk/persistablebundle", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "APersistableBundle": {GoName: "PersistableBundle"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "APersistableBundle_createFromBytes": { - GoName: "CreateFromBytes", - OutputParams: map[string]string{ - "outBundle": "*PersistableBundle", - }, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.FreeFunctions) != 1 { - t.Fatalf("FreeFunctions count = %d, want 1", len(merged.FreeFunctions)) - } - f := merged.FreeFunctions[0] - if f.GoName != "CreateFromBytes" { - t.Errorf("GoName = %q, want %q", f.GoName, "CreateFromBytes") - } - // The C function returns bool, so ReturnsBool must be true. - if !f.ReturnsBool { - t.Error("ReturnsBool = false, want true") - } - if len(f.OutputParams) != 1 { - t.Fatalf("OutputParams count = %d, want 1", len(f.OutputParams)) - } - op := f.OutputParams[0] - if op.CParamName != "outBundle" { - t.Errorf("CParamName = %q, want %q", op.CParamName, "outBundle") - } - if op.GoType != "*PersistableBundle" { - t.Errorf("GoType = %q, want %q", op.GoType, "*PersistableBundle") - } - if !op.IsHandle { - t.Error("IsHandle = false, want true") - } -} - -func TestMerge_AutoOpaqueType_NoOverlay(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "AImageReader": {Kind: "opaque_ptr", CType: "AImageReader", GoType: "*C.AImageReader"}, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - // No type overlay — should auto-generate with stripped "A" prefix. - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.OpaqueTypes) != 1 { - t.Fatalf("OpaqueTypes count = %d, want 1", len(merged.OpaqueTypes)) - } - ot, ok := merged.OpaqueTypes["ImageReader"] - if !ok { - t.Fatal("OpaqueTypes missing ImageReader (auto-named from AImageReader)") - } - if ot.GoName != "ImageReader" { - t.Errorf("GoName = %q, want %q", ot.GoName, "ImageReader") - } - if ot.CapiType != "AImageReader" { - t.Errorf("CapiType = %q, want %q", ot.CapiType, "AImageReader") - } -} - -func TestMerge_AutoMethod_NoOverlay(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "ASensor": {Kind: "opaque_ptr", CType: "ASensor", GoType: "*C.ASensor"}, - }, - Functions: map[string]specmodel.FuncDef{ - "ASensor_getName": { - CName: "ASensor_getName", - Params: []specmodel.Param{ - {Name: "sensor", Type: "*ASensor"}, - }, - Returns: "string", - }, - "ASensor_getType": { - CName: "ASensor_getType", - Params: []specmodel.Param{ - {Name: "sensor", Type: "*ASensor"}, - }, - Returns: "int32", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - // No function overlays — should auto-generate methods. - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 2 { - t.Fatalf("Methods count = %d, want 2", len(merged.Methods)) - } - // Methods are sorted by function name, so ASensor_getName comes first. - m0 := merged.Methods[0] - if m0.GoName != "GetName" { - t.Errorf("Methods[0].GoName = %q, want %q", m0.GoName, "GetName") - } - if m0.ReceiverType != "Sensor" { - t.Errorf("Methods[0].ReceiverType = %q, want %q", m0.ReceiverType, "Sensor") - } - m1 := merged.Methods[1] - if m1.GoName != "GetType" { - t.Errorf("Methods[1].GoName = %q, want %q", m1.GoName, "GetType") - } -} - -func TestMerge_AutoDestructor_Detection(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "ABuffer": {Kind: "opaque_ptr", CType: "ABuffer", GoType: "*C.ABuffer"}, - }, - Functions: map[string]specmodel.FuncDef{ - "ABuffer_release": { - CName: "ABuffer_release", - Params: []specmodel.Param{ - {Name: "buffer", Type: "*ABuffer"}, - }, - Returns: "", - }, - "ABuffer_getSize": { - CName: "ABuffer_getSize", - Params: []specmodel.Param{ - {Name: "buffer", Type: "*ABuffer"}, - }, - Returns: "int32", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - // No overlays — should auto-detect ABuffer_release as destructor. - } - merged := idiomgen.Merge(spec, overlay) - ot, ok := merged.OpaqueTypes["Buffer"] - if !ok { - t.Fatal("OpaqueTypes missing Buffer") - } - if ot.Destructor != "ABuffer_release" { - t.Errorf("Destructor = %q, want %q", ot.Destructor, "ABuffer_release") - } - // ABuffer_release should be claimed as destructor, not emitted as method. - // Only ABuffer_getSize should appear as a method. - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - if merged.Methods[0].GoName != "GetSize" { - t.Errorf("Methods[0].GoName = %q, want %q", merged.Methods[0].GoName, "GetSize") - } -} - -func TestMerge_AutoEnum_NoOverlay(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "ASENSOR_TYPE": {Kind: "typedef_int32", CType: "int32_t", GoType: "int32"}, - }, - Enums: map[string][]specmodel.EnumValue{ - "ASENSOR_TYPE": { - {Name: "ASENSOR_TYPE_ACCELEROMETER", Value: 1}, - {Name: "ASENSOR_TYPE_GYROSCOPE", Value: 4}, - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - // No type overlay — enum should be auto-generated. - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.ValueEnums) != 1 { - t.Fatalf("ValueEnums count = %d, want 1", len(merged.ValueEnums)) - } - ve := merged.ValueEnums[0] - // Auto-naming strips leading A: ASENSOR_TYPE → SENSOR_TYPE - // But autoGoTypeName only strips "A" followed by uppercase, so - // "ASENSOR_TYPE" starts with "A" followed by "S" (uppercase) → "SENSOR_TYPE". - if ve.GoName != "SENSOR_TYPE" { - t.Errorf("GoName = %q, want %q", ve.GoName, "SENSOR_TYPE") - } - if len(ve.Values) != 2 { - t.Fatalf("values count = %d, want 2", len(ve.Values)) - } -} - -func TestMerge_OverlayOverridesAutoName(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "AImageReader": {Kind: "opaque_ptr", CType: "AImageReader", GoType: "*C.AImageReader"}, - }, - Functions: map[string]specmodel.FuncDef{ - "AImageReader_getWidth": { - CName: "AImageReader_getWidth", - Params: []specmodel.Param{ - {Name: "reader", Type: "*AImageReader"}, - }, - Returns: "int32", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - Types: map[string]overlaymodel.TypeOverlay{ - "AImageReader": {GoName: "Reader"}, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "AImageReader_getWidth": { - Receiver: "Reader", - GoName: "Width", - Pure: true, - }, - }, - } - merged := idiomgen.Merge(spec, overlay) - // Overlay name should override auto-generated name. - _, ok := merged.OpaqueTypes["Reader"] - if !ok { - t.Fatal("OpaqueTypes missing Reader (overlay-named)") - } - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - if merged.Methods[0].GoName != "Width" { - t.Errorf("GoName = %q, want %q", merged.Methods[0].GoName, "Width") - } - if !merged.Methods[0].Pure { - t.Error("Pure = false, want true (from overlay)") - } -} - -func TestMerge_SkipStillRespected(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "AWidget": {Kind: "opaque_ptr", CType: "AWidget", GoType: "*C.AWidget"}, - }, - Functions: map[string]specmodel.FuncDef{ - "AWidget_internal": { - CName: "AWidget_internal", - Params: []specmodel.Param{ - {Name: "widget", Type: "*AWidget"}, - }, - Returns: "void", - }, - "AWidget_getName": { - CName: "AWidget_getName", - Params: []specmodel.Param{ - {Name: "widget", Type: "*AWidget"}, - }, - Returns: "string", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - Functions: map[string]overlaymodel.FuncOverlay{ - "AWidget_internal": {Skip: true}, - }, - } - merged := idiomgen.Merge(spec, overlay) - // AWidget_internal should be skipped (overlay says skip: true). - // AWidget_getName should be auto-generated. - if len(merged.Methods) != 1 { - t.Fatalf("Methods count = %d, want 1", len(merged.Methods)) - } - if merged.Methods[0].GoName != "GetName" { - t.Errorf("GoName = %q, want %q", merged.Methods[0].GoName, "GetName") - } -} - -func TestMerge_AutoFreeFunction_NoReceiver(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Functions: map[string]specmodel.FuncDef{ - "globalInit": { - CName: "globalInit", - Returns: "int32", - }, - }, - } - overlay := overlaymodel.Overlay{ - Module: "test", - Package: overlaymodel.PackageOverlay{GoName: "test", GoImport: "github.com/AndroidGoLab/ndk/test"}, - } - merged := idiomgen.Merge(spec, overlay) - if len(merged.Methods) != 0 { - t.Errorf("Methods count = %d, want 0", len(merged.Methods)) - } - if len(merged.FreeFunctions) != 1 { - t.Fatalf("FreeFunctions count = %d, want 1", len(merged.FreeFunctions)) - } - if merged.FreeFunctions[0].GoName != "GlobalInit" { - t.Errorf("GoName = %q, want %q", merged.FreeFunctions[0].GoName, "GlobalInit") - } -} - -func TestMerge_ValueStruct(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "example.com/capi/test", - Types: map[string]specmodel.TypeDef{ - "TestDesc": {Kind: "opaque_ptr", CType: "TestDesc", GoType: "*C.TestDesc"}, - }, - Structs: map[string]specmodel.StructDef{ - "TestDesc": { - Fields: []specmodel.StructField{ - {Name: "width", Type: "uint32"}, - {Name: "height", Type: "uint32"}, - }, - }, - }, - } - overlay := overlaymodel.Overlay{ - Package: overlaymodel.PackageOverlay{GoName: "test"}, - Types: map[string]overlaymodel.TypeOverlay{ - "TestDesc": {GoName: "Desc", ValueStruct: true}, - }, - } - merged := idiomgen.Merge(spec, overlay) - require.Len(t, merged.ValueStructs, 1) - vs := merged.ValueStructs[0] - assert.Equal(t, "Desc", vs.GoName) - assert.Equal(t, "TestDesc", vs.CapiType) - require.Len(t, vs.Fields, 2) - assert.Equal(t, "Width", vs.Fields[0].GoName) - assert.Equal(t, "uint32", vs.Fields[0].GoType) - assert.Equal(t, "Height", vs.Fields[1].GoName) -} diff --git a/tools/pkg/idiomgen/merged.go b/tools/pkg/idiomgen/merged.go deleted file mode 100644 index 481db5b..0000000 --- a/tools/pkg/idiomgen/merged.go +++ /dev/null @@ -1,254 +0,0 @@ -package idiomgen - -import "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - -// MergedSpec is the fully resolved model passed to templates. -type MergedSpec struct { - PackageName string - PackageImport string - PackageDoc string - SourcePackage string - - OpaqueTypes map[string]MergedOpaqueType - TypeAliases []MergedTypeAlias - ErrorEnums []MergedErrorEnum - ValueEnums []MergedValueEnum - Methods []MergedMethod - FreeFunctions []MergedFreeFunction - Callbacks []MergedCallback - APILevels map[string]int - CallbackStructs []MergedCallbackStruct - CallbackStructAliases []MergedTypeAlias // type aliases re-exporting capi callback struct types - StructAccessors []MergedStructAccessor - ValueStructs []MergedValueStruct - Lifecycle *MergedLifecycle - ExtraBridgeC string - ExtraBridgeGo string - UntypedMacros map[string]int64 // #define constants not assigned to any typed enum -} - -// MergedOpaqueType is an opaque C handle with Go lifecycle. -type MergedOpaqueType struct { - GoName string - CapiType string // Name in capi package - Constructor string // capi function name - ConstructorReturnsPointer bool // true if constructor returns pointer directly (not out-param) - ConstructorParams []MergedParam // additional params for constructor (excluding out-param) - Destructor string // capi function name - DestructorReturnsError bool // true if destructor returns an error type - Pattern string // builder, ref_counted, singleton - Interfaces []string -} - -// MergedErrorEnum is an enum that implements the error interface. -type MergedErrorEnum struct { - GoName string // Original spec type name (used for capi reference) - Prefix string // Error string prefix - SuccessValue string - Values []MergedEnumValue -} - -// MergedValueEnum is a non-error enum with stripped prefixes. -type MergedValueEnum struct { - GoName string - SpecName string // Original spec type name - BaseType string // Go base type (e.g., "int32", "uint32"); defaults to "int32" - StripPrefix string - StringMethod bool - Values []MergedEnumValue -} - -// MergedEnumValue is one constant in a merged enum. -type MergedEnumValue struct { - GoName string - SpecName string // Original C-style constant name - Value int64 - ValueStr string // Formatted value for template rendering (e.g., "0x80000000" for unsigned types) -} - -// MergedMethod is a function resolved to a method on an opaque type. -type MergedMethod struct { - GoName string - CName string - ReceiverType string // Go name of the receiver opaque type - Params []MergedParam - Returns string - Chain bool - Pure bool - ReturnsNew string - ReturnsNewDirect bool // true if returns_new function returns pointer directly (not out-param) - ReturnsFrames bool - BufGoType string // Go type override for buffer param (e.g., "[]byte") - TimeoutUnit string // "ns" (default), "ms", "us", "s" — for time.Duration conversion - APILevel int - FixedParams map[string]string // param name → literal Go value - CallbackParam string // name of callback struct param (triggers bridge call) - CallbackStruct string // spec name of the callback struct - CallbackGoType string // Go name of the callback struct (e.g., "DeviceStateCallbacks") - ReturnsListAccessor *MergedStructAccessor // if set, method returns a list via struct accessor - CustomCall *MergedCustomCall // if set, method uses custom capi call args - OutputParams []MergedOutputParam // C output params converted to Go return values - ReturnsBool bool // true when the C function returns bool (not a numeric status code) -} - -// MergedParam is a resolved parameter. -type MergedParam struct { - Name string - GoType string - CapiType string // Original spec type (before typeMap resolution) - IsHandle bool // True if param is an opaque handle needing .ptr unwrap - IsString bool // True if param is *byte (C string) needing Go string conversion - Remapped bool // True if the type was remapped through typeMap (needs cast even if names match) - Direction string - DurationUnit string // "ns", "ms", "us", "s" — set when GoType is time.Duration -} - -// MergedFreeFunction is a package-level function without a receiver (e.g., GL/EGL procedural APIs). -type MergedFreeFunction struct { - GoName string - CName string - Params []MergedParam - Returns string - CapiReturns string // Original spec return type (before typeMap resolution) - IsHandleReturn bool // True if return is an opaque handle type - APILevel int - OutputParams []MergedOutputParam // C output params converted to Go return values - ReturnsBool bool // true when the C function returns bool (not a numeric status code) - ReturnsNew string // Go type name for constructor-style functions -} - -// MergedTypeAlias is a type alias re-exporting a capi type. -type MergedTypeAlias struct { - GoName string // Name in idiomatic package - CapiType string // Name in capi package -} - -// PerTypeData holds the data for rendering a single opaque type's file. -type PerTypeData struct { - PackageName string - SourcePackage string - Type MergedOpaqueType - Methods []MergedMethod - FreeFunctions []MergedFreeFunction // factory functions that return this type - OpaqueTypes map[string]MergedOpaqueType // needed by lookupCapiType in templates -} - -// MergedCallback is a resolved callback type. -type MergedCallback struct { - SpecName string - GoCallbackType string - GoCallbackSig string - Params []MergedParam - Returns string -} - -// MergedCallbackStruct is a C callback struct with Go type mapping. -type MergedCallbackStruct struct { - SpecName string // C struct name (e.g., "ACameraDevice_StateCallbacks") - GoName string // Go struct name (e.g., "DeviceStateCallbacks") - ContextField string // Name of the void* context field - Fields []MergedCallbackField -} - -// MergedCallbackField is one callback function pointer in a struct. -type MergedCallbackField struct { - CName string // C field name (e.g., "onDisconnected") - GoName string // Go field name (e.g., "OnDisconnected") - GoSignature string // Go function signature (e.g., "func()") - GoParamCount int // number of params in Go callback signature - Params []specmodel.Param // C params from spec (for generating //export) - Returns string // non-void C return type (e.g., "void*") -} - -// MergedStructAccessor describes a C struct with list-like fields. -type MergedStructAccessor struct { - SpecName string // C struct name (e.g., "ACameraIdList") - CountField string // Field name for count (e.g., "numCameras") - ItemsField string // Field name for items (e.g., "cameraIds") - ItemType string // Go type of each item (e.g., "string") - DeleteFunc string // capi function to free the list -} - -// MergedValueStructField describes one field of a value struct. -type MergedValueStructField struct { - GoName string - CName string - GoType string - CapiType string -} - -// MergedValueStruct describes a C struct mapped to a Go value struct with exported fields. -type MergedValueStruct struct { - GoName string - CapiType string - Fields []MergedValueStructField -} - -// MergedOutputParam describes a C output parameter converted to a Go return value. -type MergedOutputParam struct { - CParamName string // Original C param name (e.g., "reader") - GoType string // Go idiomatic type (e.g., "*ImageReader") - CapiType string // Capi pointer type to declare (e.g., "*capi.AImageReader") - IsHandle bool // True if the Go type is an opaque handle wrapper - IsValueStruct bool // True if the Go type is a value struct (not an opaque handle) -} - -// MergedCustomCall holds custom call information for methods with non-standard capi patterns. -type MergedCustomCall struct { - Params []MergedCustomCallParam // Go visible params - Args string // literal capi args after receiver -} - -// MergedCustomCallParam is a param in a custom call method's Go signature. -type MergedCustomCallParam struct { - Name string - GoType string -} - -// MergedLifecycle describes a NativeActivity lifecycle pattern. -type MergedLifecycle struct { - EntryPoint string // Exported symbol (e.g., "ANativeActivity_onCreate") - ActivityType string // C type name (e.g., "ANativeActivity") - GoActivityType string // Go type name (e.g., "Activity") - CallbacksAccessor string // C expression (e.g., "activity->callbacks") - CallbackStruct string // C struct name (e.g., "ANativeActivityCallbacks") - EntryCallback string // Go field name for entry point callback (e.g., "OnCreate") - Fields []MergedCallbackField // Lifecycle event callbacks -} - -// PerValueEnumData holds data for rendering a single value enum file. -type PerValueEnumData struct { - PackageName string - Enum MergedValueEnum -} - -// PerTypeAliasData holds data for rendering a single type alias file. -type PerTypeAliasData struct { - PackageName string - SourcePackage string - Alias MergedTypeAlias -} - -// PerValueStructData holds data for rendering a single value struct file. -type PerValueStructData struct { - PackageName string - SourcePackage string - Type MergedValueStruct -} - -// PerCallbackData holds data for rendering a single callback type file. -type PerCallbackData struct { - PackageName string - Callback MergedCallback -} - -// BridgeData holds data for rendering bridge templates into a capi package. -type BridgeData struct { - PackageName string - CIncludes []string - CallbackStructs []MergedCallbackStruct - StructAccessors []MergedStructAccessor - Lifecycle *MergedLifecycle - ExtraBridgeC string - ExtraBridgeGo string -} diff --git a/tools/pkg/idiomgen/render.go b/tools/pkg/idiomgen/render.go deleted file mode 100644 index f681aeb..0000000 --- a/tools/pkg/idiomgen/render.go +++ /dev/null @@ -1,81 +0,0 @@ -package idiomgen - -import ( - "bytes" - "os" - "path/filepath" - "text/template" -) - -// RenderTemplate parses and executes a Go text/template against a MergedSpec. -func RenderTemplate(name, tmplText string, data MergedSpec) (string, error) { - tmpl, err := template.New(name).Funcs(FuncMap()).Parse(tmplText) - if err != nil { - return "", err - } - var buf bytes.Buffer - if err := tmpl.Execute(&buf, data); err != nil { - return "", err - } - return buf.String(), nil -} - -// RenderTemplateFile reads a template file from disk and renders it against a MergedSpec. -func RenderTemplateFile(path string, data MergedSpec) (string, error) { - content, err := os.ReadFile(path) - if err != nil { - return "", err - } - return RenderTemplate(filepath.Base(path), string(content), data) -} - -// RenderPerType renders a template against a PerTypeData (single opaque type + its methods). -func RenderPerType(tmplPath string, data PerTypeData) (string, error) { - content, err := os.ReadFile(tmplPath) - if err != nil { - return "", err - } - tmpl, err := template.New(filepath.Base(tmplPath)).Funcs(FuncMap()).Parse(string(content)) - if err != nil { - return "", err - } - var buf bytes.Buffer - if err := tmpl.Execute(&buf, data); err != nil { - return "", err - } - return buf.String(), nil -} - -// RenderAny renders a template file against arbitrary data. -func RenderAny(tmplPath string, data any) (string, error) { - content, err := os.ReadFile(tmplPath) - if err != nil { - return "", err - } - tmpl, err := template.New(filepath.Base(tmplPath)).Funcs(FuncMap()).Parse(string(content)) - if err != nil { - return "", err - } - var buf bytes.Buffer - if err := tmpl.Execute(&buf, data); err != nil { - return "", err - } - return buf.String(), nil -} - -// RenderBridgeTemplate renders a bridge template against BridgeData. -func RenderBridgeTemplate(tmplPath string, data BridgeData) (string, error) { - content, err := os.ReadFile(tmplPath) - if err != nil { - return "", err - } - tmpl, err := template.New(filepath.Base(tmplPath)).Funcs(FuncMap()).Parse(string(content)) - if err != nil { - return "", err - } - var buf bytes.Buffer - if err := tmpl.Execute(&buf, data); err != nil { - return "", err - } - return buf.String(), nil -} diff --git a/tools/pkg/idiomgen/render_test.go b/tools/pkg/idiomgen/render_test.go deleted file mode 100644 index f01b3f7..0000000 --- a/tools/pkg/idiomgen/render_test.go +++ /dev/null @@ -1,601 +0,0 @@ -package idiomgen_test - -import ( - "path/filepath" - "runtime" - "strings" - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/idiomgen" -) - -func TestRenderTemplate_Enum(t *testing.T) { - // Test that the inline enum template still works for basic rendering. - spec := idiomgen.MergedSpec{ - PackageName: "audio", - ValueEnums: []idiomgen.MergedValueEnum{ - { - GoName: "Direction", - SpecName: "aaudio_direction_t", - StripPrefix: "AAUDIO_DIRECTION_", - StringMethod: true, - Values: []idiomgen.MergedEnumValue{ - {GoName: "DirectionOutput", SpecName: "AAUDIO_DIRECTION_OUTPUT", Value: 0}, - {GoName: "DirectionInput", SpecName: "AAUDIO_DIRECTION_INPUT", Value: 1}, - }, - }, - }, - } - - // Use a simple inline template to test RenderTemplate still works. - tmpl := `package {{ .PackageName }} -{{ range $enum := .ValueEnums }} -type {{ $enum.GoName }} int32 -{{ end }} -` - out, err := idiomgen.RenderTemplate("test.go.tmpl", tmpl, spec) - if err != nil { - t.Fatalf("RenderTemplate: %v", err) - } - if !strings.Contains(out, "type Direction int32") { - t.Errorf("output missing 'type Direction int32'\n\ngot:\n%s", out) - } -} - -func TestRenderValueEnumFile(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "value_enum_file.go.tmpl") - - data := idiomgen.PerValueEnumData{ - PackageName: "audio", - Enum: idiomgen.MergedValueEnum{ - GoName: "Direction", - SpecName: "aaudio_direction_t", - BaseType: "int32", - StripPrefix: "AAUDIO_DIRECTION_", - StringMethod: true, - Values: []idiomgen.MergedEnumValue{ - {GoName: "Output", SpecName: "AAUDIO_DIRECTION_OUTPUT", Value: 0}, - {GoName: "Input", SpecName: "AAUDIO_DIRECTION_INPUT", Value: 1}, - }, - }, - } - - out, err := idiomgen.RenderAny(tmplPath, data) - if err != nil { - t.Fatalf("RenderAny: %v", err) - } - - for _, want := range []string{ - "package audio", - "type Direction int32", - "Output Direction = 0", - "Input Direction = 1", - "func (v Direction) String() string", - `return "Output"`, - `return "Input"`, - `return fmt.Sprintf("Direction(%d)", int(v))`, - } { - if !strings.Contains(out, want) { - t.Errorf("output missing %q\n\ngot:\n%s", want, out) - } - } -} - -func TestRenderValueEnumFile_WithoutStringMethod(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "value_enum_file.go.tmpl") - - data := idiomgen.PerValueEnumData{ - PackageName: "audio", - Enum: idiomgen.MergedValueEnum{ - GoName: "Format", - SpecName: "aaudio_format_t", - BaseType: "int32", - StringMethod: false, - Values: []idiomgen.MergedEnumValue{ - {GoName: "FormatPCMI16", Value: 1}, - {GoName: "FormatPCMFloat", Value: 2}, - }, - }, - } - - out, err := idiomgen.RenderAny(tmplPath, data) - if err != nil { - t.Fatalf("RenderAny: %v", err) - } - - if strings.Contains(out, "func (v Format) String()") { - t.Errorf("String() method should not be generated when StringMethod is false\n\ngot:\n%s", out) - } - if strings.Contains(out, `import "fmt"`) { - t.Errorf("import fmt should not be generated when StringMethod is false\n\ngot:\n%s", out) - } - if !strings.Contains(out, "type Format int32") { - t.Errorf("output missing type declaration\n\ngot:\n%s", out) - } -} - -func TestRenderTypeAliasFile(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "type_alias_file.go.tmpl") - - data := idiomgen.PerTypeAliasData{ - PackageName: "vulkan", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/vulkan", - Alias: idiomgen.MergedTypeAlias{GoName: "VkInstance", CapiType: "VkInstance"}, - } - - out, err := idiomgen.RenderAny(tmplPath, data) - if err != nil { - t.Fatalf("RenderAny: %v", err) - } - - for _, want := range []string{ - "package vulkan", - "type VkInstance = capi.VkInstance", - } { - if !strings.Contains(out, want) { - t.Errorf("output missing %q\n\ngot:\n%s", want, out) - } - } - - if strings.Contains(out, "struct") { - t.Errorf("type alias file should not contain struct definitions\n\ngot:\n%s", out) - } -} - -func TestRenderCallbackFile(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "callback_file.go.tmpl") - - data := idiomgen.PerCallbackData{ - PackageName: "audio", - Callback: idiomgen.MergedCallback{ - SpecName: "AAudioStream_dataCallback", - GoCallbackType: "DataCallback", - GoCallbackSig: "func(stream *Stream, buf []byte, numFrames int) DataCallbackResult", - }, - } - - out, err := idiomgen.RenderAny(tmplPath, data) - if err != nil { - t.Fatalf("RenderAny: %v", err) - } - - want := "type DataCallback func(stream *Stream, buf []byte, numFrames int) DataCallbackResult" - if !strings.Contains(out, want) { - t.Errorf("output missing %q\n\ngot:\n%s", want, out) - } -} - -func TestToSnakeCase(t *testing.T) { - tests := []struct { - in, want string - }{ - {"StreamBuilder", "stream_builder"}, - {"Stream", "stream"}, - {"CaptureRequest", "capture_request"}, - {"Model", "model"}, - {"Manager", "manager"}, - {"SessionOutputContainer", "session_output_container"}, - {"AUDIO", "audio"}, - {"LOOPER_POLL", "looper_poll"}, - {"IMAGE_FORMATS", "image_formats"}, - {"NDROID_BITMAP_FLAGS", "ndroid_bitmap_flags"}, - {"STATUS", "status"}, - {"", ""}, - } - fm := idiomgen.FuncMap() - toSnakeCase := fm["toSnakeCase"].(func(string) string) - for _, tt := range tests { - if got := toSnakeCase(tt.in); got != tt.want { - t.Errorf("toSnakeCase(%q) = %q, want %q", tt.in, got, tt.want) - } - } -} - -func TestFixGoAcronyms(t *testing.T) { - fm := idiomgen.FuncMap() - safeGoName := fm["safeGoName"].(func(string) string) - tests := []struct { - in, want string - }{ - {"deviceId", "deviceID"}, - {"sessionId", "sessionID"}, - {"SetDeviceId", "SetDeviceID"}, - {"CameraIdList", "CameraIDList"}, - {"VsyncId", "VsyncID"}, - // Must NOT change words where "Id" is followed by lowercase. - {"Identify", "Identify"}, - {"Idle", "Idle"}, - {"Identity", "Identity"}, - {"DeviceWaitIdle", "DeviceWaitIdle"}, - // Plain names without "Id" are unchanged. - {"count", "count"}, - {"StreamBuilder", "StreamBuilder"}, - } - for _, tt := range tests { - if got := safeGoName(tt.in); got != tt.want { - t.Errorf("safeGoName(%q) = %q, want %q", tt.in, got, tt.want) - } - } -} - -func TestFuncMapUnexport(t *testing.T) { - fm := idiomgen.FuncMap() - unexport := fm["unexport"].(func(string) string) - - tests := []struct { - in, want string - }{ - {"Direction", "direction"}, - {"ABC", "aBC"}, - {"", ""}, - {"a", "a"}, - } - for _, tt := range tests { - if got := unexport(tt.in); got != tt.want { - t.Errorf("unexport(%q) = %q, want %q", tt.in, got, tt.want) - } - } -} - -func TestFuncMapSkip(t *testing.T) { - fm := idiomgen.FuncMap() - skip := fm["skip"].(func([]idiomgen.MergedParam, int) []idiomgen.MergedParam) - - params := []idiomgen.MergedParam{ - {Name: "self", GoType: "*StreamBuilder"}, - {Name: "rate", GoType: "int32"}, - {Name: "channels", GoType: "int32"}, - } - - got := skip(params, 1) - if len(got) != 2 { - t.Fatalf("skip(params, 1) returned %d elements, want 2", len(got)) - } - if got[0].Name != "rate" { - t.Errorf("skip(params, 1)[0].Name = %q, want %q", got[0].Name, "rate") - } - - // skip beyond length returns nil - got = skip(params, 5) - if got != nil { - t.Errorf("skip(params, 5) = %v, want nil", got) - } -} - -func TestFuncMapSkipAndFilterOut(t *testing.T) { - fm := idiomgen.FuncMap() - skipAndFilterOut := fm["skipAndFilterOut"].(func([]idiomgen.MergedParam) []idiomgen.MergedParam) - - // Receiver is already stripped by the merger, so params here don't include it. - params := []idiomgen.MergedParam{ - {Name: "rate", GoType: "int32", Direction: "in"}, - {Name: "result", GoType: "*int32", Direction: "out"}, - {Name: "channels", GoType: "int32", Direction: "in"}, - } - - got := skipAndFilterOut(params) - if len(got) != 2 { - t.Fatalf("skipAndFilterOut returned %d elements, want 2", len(got)) - } - if got[0].Name != "rate" || got[1].Name != "channels" { - t.Errorf("skipAndFilterOut = %v, want [rate, channels]", got) - } -} - -func TestFuncMapLookupCapiType(t *testing.T) { - fm := idiomgen.FuncMap() - lookup := fm["lookupCapiType"].(func(map[string]idiomgen.MergedOpaqueType, string) string) - - types := map[string]idiomgen.MergedOpaqueType{ - "StreamBuilder": {CapiType: "AAudioStreamBuilder"}, - } - - if got := lookup(types, "StreamBuilder"); got != "AAudioStreamBuilder" { - t.Errorf("lookupCapiType(StreamBuilder) = %q, want %q", got, "AAudioStreamBuilder") - } - if got := lookup(types, "Unknown"); got != "Unknown" { - t.Errorf("lookupCapiType(Unknown) = %q, want %q", got, "Unknown") - } -} - -func TestRenderErrors(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "errors.go.tmpl") - - spec := idiomgen.MergedSpec{ - PackageName: "audio", - SourcePackage: "github.com/AndroidGoLab/ndk/tools/pkg/capi/aaudio", - ErrorEnums: []idiomgen.MergedErrorEnum{ - { - GoName: "Aaudio_result_t", - Prefix: "audio", - SuccessValue: "AAUDIO_OK", - Values: []idiomgen.MergedEnumValue{ - {GoName: "AAUDIO_OK", SpecName: "AAUDIO_OK", Value: 0}, - {GoName: "ErrorBase", SpecName: "AAUDIO_ERROR_BASE", Value: -900}, - {GoName: "ErrorDisconnected", SpecName: "AAUDIO_ERROR_DISCONNECTED", Value: -899}, - }, - }, - }, - } - - out, err := idiomgen.RenderTemplateFile(tmplPath, spec) - if err != nil { - t.Fatalf("RenderTemplateFile: %v", err) - } - - for _, want := range []string{ - "type Error int32", - "func (e Error) Error() string", - "func result[T ~int32 | ~uint32 | ~int64](", - "ErrorBase Error = -900", - "ErrorDisconnected Error = -899", - } { - if !strings.Contains(out, want) { - t.Errorf("output missing %q\n\ngot:\n%s", want, out) - } - } - - // The success value must NOT appear in the const block. - if strings.Contains(out, "AAUDIO_OK Error =") { - t.Errorf("success value AAUDIO_OK should not appear in const block\n\ngot:\n%s", out) - } -} - -func TestRenderPerTypeFile(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "type_file.go.tmpl") - - data := idiomgen.PerTypeData{ - PackageName: "audio", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/aaudio", - Type: idiomgen.MergedOpaqueType{ - GoName: "StreamBuilder", - CapiType: "AAudioStreamBuilder", - Constructor: "AAudioStreamBuilder_create", - Destructor: "AAudioStreamBuilder_delete", - }, - Methods: []idiomgen.MergedMethod{ - { - GoName: "SetDeviceID", - CName: "AAudioStreamBuilder_setDeviceId", - ReceiverType: "StreamBuilder", - Chain: true, - Params: []idiomgen.MergedParam{ - {Name: "deviceID", GoType: "int32", Direction: "in"}, - }, - }, - }, - OpaqueTypes: map[string]idiomgen.MergedOpaqueType{ - "StreamBuilder": {CapiType: "AAudioStreamBuilder"}, - }, - } - - out, err := idiomgen.RenderPerType(tmplPath, data) - if err != nil { - t.Fatalf("RenderPerType: %v", err) - } - - for _, want := range []string{ - "package audio", - "type StreamBuilder struct", - "ptr *capi.AAudioStreamBuilder", - "NewStreamBuilder", - "func (h *StreamBuilder) Close() error", - "capi.AAudioStreamBuilder_delete(h.ptr)", - "func (h *StreamBuilder) SetDeviceID(deviceID int32) *StreamBuilder", - "return h", - } { - if !strings.Contains(out, want) { - t.Errorf("output missing %q\n\ngot:\n%s", want, out) - } - } -} - -func TestRenderPerTypeFile_OutputParams(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "type_file.go.tmpl") - - data := idiomgen.PerTypeData{ - PackageName: "media", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/media", - Type: idiomgen.MergedOpaqueType{ - GoName: "ImageReader", - CapiType: "AImageReader", - Destructor: "AImageReader_delete", - }, - Methods: []idiomgen.MergedMethod{ - { - GoName: "AcquireNextImage", - CName: "AImageReader_acquireNextImage", - ReceiverType: "ImageReader", - Returns: "int32", - Params: []idiomgen.MergedParam{ - {Name: "image", GoType: "**Image", Direction: "out"}, - }, - OutputParams: []idiomgen.MergedOutputParam{ - {CParamName: "image", GoType: "*Image", CapiType: "*capi.AImage", IsHandle: true}, - }, - }, - }, - FreeFunctions: []idiomgen.MergedFreeFunction{ - { - GoName: "NewImageReader", - CName: "AImageReader_new", - Returns: "int32", - ReturnsNew: "ImageReader", - Params: []idiomgen.MergedParam{ - {Name: "width", GoType: "int32"}, - {Name: "height", GoType: "int32"}, - {Name: "reader", GoType: "**ImageReader", Direction: "out"}, - }, - OutputParams: []idiomgen.MergedOutputParam{ - {CParamName: "reader", GoType: "*ImageReader", CapiType: "*capi.AImageReader", IsHandle: true}, - }, - }, - }, - OpaqueTypes: map[string]idiomgen.MergedOpaqueType{ - "ImageReader": {CapiType: "AImageReader"}, - "Image": {CapiType: "AImage"}, - }, - } - - out, err := idiomgen.RenderPerType(tmplPath, data) - if err != nil { - t.Fatalf("RenderPerType: %v", err) - } - - for _, want := range []string{ - // Method with output_params - "func (h *ImageReader) AcquireNextImage() (*Image, error)", - "var imagePtr *capi.AImage", - "ret := capi.AImageReader_acquireNextImage(h.ptr, &imagePtr)", - "return nil, err", - "return &Image{ptr: imagePtr}, nil", - // Free function with output_params - "func NewImageReader(width int32, height int32) (*ImageReader, error)", - "var readerPtr *capi.AImageReader", - "ret := capi.AImageReader_new(width, height, &readerPtr)", - "return &ImageReader{ptr: readerPtr}, nil", - } { - if !strings.Contains(out, want) { - t.Errorf("output missing %q\n\ngot:\n%s", want, out) - } - } - - // Verify output params are excluded from Go signature. - if strings.Contains(out, "AcquireNextImage(image") { - t.Errorf("output param 'image' should NOT appear in method signature\n\ngot:\n%s", out) - } -} - -func TestRenderPerTypeFile_OutputParams_Scalar(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "type_file.go.tmpl") - - data := idiomgen.PerTypeData{ - PackageName: "media", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/media", - Type: idiomgen.MergedOpaqueType{ - GoName: "Image", - CapiType: "AImage", - Destructor: "AImage_delete", - }, - Methods: []idiomgen.MergedMethod{ - { - GoName: "PlaneData", - CName: "AImage_getPlaneData", - ReceiverType: "Image", - Returns: "int32", - Params: []idiomgen.MergedParam{ - {Name: "planeIdx", GoType: "int32"}, - {Name: "data", GoType: "*uint8", Direction: "out"}, - {Name: "dataLength", GoType: "int32", Direction: "out"}, - }, - OutputParams: []idiomgen.MergedOutputParam{ - {CParamName: "data", GoType: "*uint8", CapiType: "*uint8", IsHandle: false}, - {CParamName: "dataLength", GoType: "int32", CapiType: "int32", IsHandle: false}, - }, - }, - }, - OpaqueTypes: map[string]idiomgen.MergedOpaqueType{ - "Image": {CapiType: "AImage"}, - }, - } - - out, err := idiomgen.RenderPerType(tmplPath, data) - if err != nil { - t.Fatalf("RenderPerType: %v", err) - } - - for _, want := range []string{ - "func (h *Image) PlaneData(planeIdx int32) (*uint8, int32, error)", - "var dataPtr *uint8", - "var dataLengthPtr int32", - "ret := capi.AImage_getPlaneData(h.ptr, planeIdx, &dataPtr, &dataLengthPtr)", - "return nil, 0, err", - "return dataPtr, dataLengthPtr, nil", - } { - if !strings.Contains(out, want) { - t.Errorf("output missing %q\n\ngot:\n%s", want, out) - } - } -} - -func TestRenderFunctions(t *testing.T) { - _, thisFile, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller failed") - } - tmplPath := filepath.Join(filepath.Dir(thisFile), "..", "..", "..", "templates", "functions.go.tmpl") - - spec := idiomgen.MergedSpec{ - PackageName: "egl", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/egl", - FreeFunctions: []idiomgen.MergedFreeFunction{ - { - GoName: "GetDisplay", - CName: "eglGetDisplay", - Returns: "EGLDisplay", - Params: []idiomgen.MergedParam{ - {Name: "displayID", GoType: "unsafe.Pointer"}, - }, - }, - { - GoName: "Terminate", - CName: "eglTerminate", - Returns: "EGLBoolean", - Params: []idiomgen.MergedParam{ - {Name: "display", GoType: "EGLDisplay"}, - }, - }, - }, - } - - out, err := idiomgen.RenderTemplateFile(tmplPath, spec) - if err != nil { - t.Fatalf("RenderTemplateFile: %v", err) - } - - for _, want := range []string{ - "func GetDisplay(displayID unsafe.Pointer) EGLDisplay", - "func Terminate(display EGLDisplay) EGLBoolean", - } { - if !strings.Contains(out, want) { - t.Errorf("output missing %q\n\ngot:\n%s", want, out) - } - } - - // functions.go should NOT contain methods (those are in per-type files now). - if strings.Contains(out, "func (h *") { - t.Errorf("functions.go should not contain methods\n\ngot:\n%s", out) - } -} diff --git a/tools/pkg/overlaymodel/.gitkeep b/tools/pkg/overlaymodel/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tools/pkg/overlaymodel/overlay.go b/tools/pkg/overlaymodel/overlay.go deleted file mode 100644 index c926725..0000000 --- a/tools/pkg/overlaymodel/overlay.go +++ /dev/null @@ -1,125 +0,0 @@ -// Package overlaymodel defines the YAML overlay schema for hand-written semantic annotations. -package overlaymodel - -// Overlay is the top-level structure for one module's overlay file. -type Overlay struct { - Module string `yaml:"module"` - Package PackageOverlay `yaml:"package"` - Types map[string]TypeOverlay `yaml:"types,omitempty"` - Functions map[string]FuncOverlay `yaml:"functions,omitempty"` - APILevels map[string]int `yaml:"api_levels,omitempty"` - CallbackStructs map[string]CallbackStructOverlay `yaml:"callback_structs,omitempty"` - StructAccessors map[string]StructAccessorOverlay `yaml:"struct_accessors,omitempty"` - Lifecycle *LifecycleOverlay `yaml:"lifecycle,omitempty"` - ExtraEnums map[string][]ExtraEnumValue `yaml:"extra_enums,omitempty"` - ExtraBridgeC string `yaml:"extra_bridge_c,omitempty"` - ExtraBridgeGo string `yaml:"extra_bridge_go,omitempty"` -} - -// ExtraEnumValue defines an additional enum constant not present in the -// auto-generated spec (e.g. from extension headers not parsed by specgen). -type ExtraEnumValue struct { - Name string `yaml:"name"` - Value int64 `yaml:"value"` -} - -// PackageOverlay configures the idiomatic Go package. -type PackageOverlay struct { - GoName string `yaml:"go_name"` - GoImport string `yaml:"go_import"` - Doc string `yaml:"doc"` -} - -// TypeOverlay provides idiomatic annotations for a type. -type TypeOverlay struct { - GoName string `yaml:"go_name,omitempty"` - GoError bool `yaml:"go_error,omitempty"` - SuccessValue string `yaml:"success_value,omitempty"` - ErrorPrefix string `yaml:"error_prefix,omitempty"` - StripPrefix string `yaml:"strip_prefix,omitempty"` - StringMethod bool `yaml:"string_method,omitempty"` - Constructor string `yaml:"constructor,omitempty"` - Destructor string `yaml:"destructor,omitempty"` - Pattern string `yaml:"pattern,omitempty"` // builder, ref_counted, singleton - Interfaces []string `yaml:"interfaces,omitempty"` - Transparent bool `yaml:"transparent,omitempty"` // type alias instead of struct wrapper - ValueStruct bool `yaml:"value_struct,omitempty"` - EnumSource string `yaml:"enum_source,omitempty"` // spec enum key when typedef name differs from enum group name -} - -// FuncOverlay provides idiomatic annotations for a function. -type FuncOverlay struct { - Receiver string `yaml:"receiver,omitempty"` - GoName string `yaml:"go_name,omitempty"` - Skip bool `yaml:"skip,omitempty"` - Chain bool `yaml:"chain,omitempty"` - Pure bool `yaml:"pure,omitempty"` - ReturnsNew string `yaml:"returns_new,omitempty"` - CallbackParam string `yaml:"callback_param,omitempty"` - UserdataParam string `yaml:"userdata_param,omitempty"` - GoCallbackType string `yaml:"go_callback_type,omitempty"` - GoCallbackSig string `yaml:"go_callback_sig,omitempty"` - BufParam string `yaml:"buf_param,omitempty"` - BufFramesParam string `yaml:"buf_frames_param,omitempty"` - BufGoType string `yaml:"buf_go_type,omitempty"` // Go type for buffer param (e.g., "[]byte") - TimeoutParam string `yaml:"timeout_param,omitempty"` - TimeoutUnit string `yaml:"timeout_unit,omitempty"` // "ns" (default), "ms", "us", "s" - ReturnsFrames bool `yaml:"returns_frames,omitempty"` - FixedParams map[string]string `yaml:"fixed_params,omitempty"` - ReturnsListStruct string `yaml:"returns_list_struct,omitempty"` // spec name of list struct for iteration - CustomCall *CustomCallOverlay `yaml:"custom_call,omitempty"` - BridgeParams []BridgeParam `yaml:"bridge_params,omitempty"` // params for bridge functions not in spec - BridgeReturns string `yaml:"bridge_returns,omitempty"` // return type for bridge functions not in spec - OutputParams map[string]string `yaml:"output_params,omitempty"` // param name -> Go type; converted from C out-param to Go return value - ParamTypes map[string]string `yaml:"param_types,omitempty"` // param name -> Go type; override or suppress enum inference -} - -// BridgeParam is a parameter for a bridge function defined only in the overlay. -type BridgeParam struct { - Name string `yaml:"name"` - Type string `yaml:"type"` -} - -// CallbackStructOverlay configures Go bindings for a C callback struct. -type CallbackStructOverlay struct { - GoName string `yaml:"go_name"` - ContextField string `yaml:"context_field"` - Fields map[string]CallbackFieldOverlay `yaml:"fields"` -} - -// CallbackFieldOverlay configures one field of a callback struct. -type CallbackFieldOverlay struct { - GoName string `yaml:"go_name"` - GoSignature string `yaml:"go_signature"` - CallbackType string `yaml:"callback_type,omitempty"` - GoParamCount int `yaml:"go_param_count,omitempty"` -} - -// StructAccessorOverlay configures Go accessors for a C struct with list-like fields. -type StructAccessorOverlay struct { - CountField string `yaml:"count_field"` - ItemsField string `yaml:"items_field"` - ItemType string `yaml:"item_type"` - DeleteFunc string `yaml:"delete_func"` -} - -// CustomCallOverlay specifies a method with custom capi call arguments. -type CustomCallOverlay struct { - Params []CustomCallParam `yaml:"params"` - Args string `yaml:"args"` // literal capi args after receiver (e.g., "nil, 1, &req.ptr, nil") -} - -// CustomCallParam is a param in a custom call method's Go signature. -type CustomCallParam struct { - Name string `yaml:"name"` - GoType string `yaml:"go_type"` -} - -// LifecycleOverlay configures NativeActivity lifecycle callback generation. -type LifecycleOverlay struct { - EntryPoint string `yaml:"entry_point"` - ActivityType string `yaml:"activity_type"` - CallbacksAccessor string `yaml:"callbacks_accessor"` - CallbackStruct string `yaml:"callback_struct"` - EntryCallback string `yaml:"entry_callback"` // Go field name for entry point callback (e.g., "OnCreate") -} diff --git a/tools/pkg/overlaymodel/overlay_test.go b/tools/pkg/overlaymodel/overlay_test.go deleted file mode 100644 index b3f47ed..0000000 --- a/tools/pkg/overlaymodel/overlay_test.go +++ /dev/null @@ -1,288 +0,0 @@ -package overlaymodel_test - -import ( - "os" - "path/filepath" - "runtime" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" - - "github.com/AndroidGoLab/ndk/tools/pkg/overlaymodel" -) - -func TestOverlayRoundTrip(t *testing.T) { - ov := overlaymodel.Overlay{ - Module: "aaudio", - Package: overlaymodel.PackageOverlay{ - GoName: "audio", - GoImport: "github.com/AndroidGoLab/ndk/audio", - Doc: "Package audio provides Go bindings for Android AAudio.", - }, - Types: map[string]overlaymodel.TypeOverlay{ - "Aaudio_result_t": { - GoError: true, - SuccessValue: "AAUDIO_OK", - ErrorPrefix: "audio", - }, - "AAudioStreamBuilder": { - GoName: "StreamBuilder", - Constructor: "AAudio_createStreamBuilder", - Destructor: "AAudioStreamBuilder_delete", - Pattern: "builder", - }, - "AAudioStream": { - GoName: "Stream", - Destructor: "AAudioStream_close", - Interfaces: []string{"io.Closer"}, - }, - "Aaudio_direction_t": { - GoName: "Direction", - StripPrefix: "AAUDIO_DIRECTION_", - StringMethod: true, - }, - }, - Functions: map[string]overlaymodel.FuncOverlay{ - "AAudioStreamBuilder_setDeviceId": { - Receiver: "StreamBuilder", - GoName: "SetDeviceID", - Chain: true, - }, - "AAudioStreamBuilder_openStream": { - Receiver: "StreamBuilder", - GoName: "Open", - ReturnsNew: "Stream", - }, - "AAudioStreamBuilder_setDataCallback": { - Receiver: "StreamBuilder", - Chain: true, - CallbackParam: "callback", - UserdataParam: "userData", - GoCallbackType: "DataCallback", - GoCallbackSig: "func(stream *Stream, buf []byte, numFrames int) DataCallbackResult", - }, - "AAudioStream_getState": { - Receiver: "Stream", - GoName: "State", - Pure: true, - }, - }, - APILevels: map[string]int{ - "AAudioStream_release": 30, - "AAudioStream_getChannelMask": 32, - }, - } - - data, err := yaml.Marshal(&ov) - if err != nil { - t.Fatalf("marshal: %v", err) - } - - var got overlaymodel.Overlay - if err := yaml.Unmarshal(data, &got); err != nil { - t.Fatalf("unmarshal: %v", err) - } - - if got.Module != "aaudio" { - t.Errorf("module = %q", got.Module) - } - if got.Package.GoName != "audio" { - t.Errorf("go_name = %q", got.Package.GoName) - } - td := got.Types["AAudioStreamBuilder"] - if td.Pattern != "builder" || td.Constructor != "AAudio_createStreamBuilder" { - t.Errorf("builder type = %+v", td) - } - fd := got.Functions["AAudioStreamBuilder_setDeviceId"] - if !fd.Chain || fd.Receiver != "StreamBuilder" { - t.Errorf("builder setter = %+v", fd) - } - fd2 := got.Functions["AAudioStreamBuilder_setDataCallback"] - if fd2.GoCallbackType != "DataCallback" { - t.Errorf("callback func = %+v", fd2) - } - if got.APILevels["AAudioStream_release"] != 30 { - t.Errorf("api_level = %d", got.APILevels["AAudioStream_release"]) - } -} - -// repoRoot returns the project root (two levels up from this test file). -func repoRoot(t *testing.T) string { - t.Helper() - _, filename, _, ok := runtime.Caller(0) - if !ok { - t.Fatal("unable to determine test file path") - } - // overlay_test.go is in tools/pkg/overlaymodel/, so go up three times. - return filepath.Join(filepath.Dir(filename), "..", "..", "..") -} - -func TestLoadAAudioOverlay(t *testing.T) { - path := filepath.Join(repoRoot(t), "spec", "overlays", "aaudio.yaml") - data, err := os.ReadFile(path) - if err != nil { - t.Fatalf("read overlay: %v", err) - } - - var ov overlaymodel.Overlay - if err := yaml.Unmarshal(data, &ov); err != nil { - t.Fatalf("unmarshal overlay: %v", err) - } - - // Module - if ov.Module != "aaudio" { - t.Errorf("module = %q, want %q", ov.Module, "aaudio") - } - - // Package - if ov.Package.GoName != "audio" { - t.Errorf("package.go_name = %q, want %q", ov.Package.GoName, "audio") - } - if ov.Package.GoImport != "github.com/AndroidGoLab/ndk/audio" { - t.Errorf("package.go_import = %q", ov.Package.GoImport) - } - - // Types: 9 entries - expectedTypes := []string{ - "aaudio_result_t", "AAudioStreamBuilder", "AAudioStream", - "aaudio_direction_t", "aaudio_format_t", "aaudio_sharing_mode_t", - "aaudio_performance_mode_t", "aaudio_stream_state_t", - "aaudio_data_callback_result_t", - } - if len(ov.Types) != len(expectedTypes) { - t.Errorf("types count = %d, want %d", len(ov.Types), len(expectedTypes)) - } - for _, name := range expectedTypes { - if _, ok := ov.Types[name]; !ok { - t.Errorf("missing type %q", name) - } - } - - // Spot-check type annotations - if !ov.Types["aaudio_result_t"].GoError { - t.Error("aaudio_result_t.go_error should be true") - } - if ov.Types["AAudioStreamBuilder"].Pattern != "builder" { - t.Error("AAudioStreamBuilder.pattern should be 'builder'") - } - if ov.Types["AAudioStream"].GoName != "Stream" { - t.Error("AAudioStream.go_name should be 'Stream'") - } - if len(ov.Types["AAudioStream"].Interfaces) != 1 || ov.Types["AAudioStream"].Interfaces[0] != "io.Closer" { - t.Errorf("AAudioStream.interfaces = %v", ov.Types["AAudioStream"].Interfaces) - } - if !ov.Types["aaudio_stream_state_t"].StringMethod { - t.Error("aaudio_stream_state_t.string_method should be true") - } - - // Functions: 21 entries (8 builder setters + openStream + setDataCallback + - // 5 stream getters + 4 stream control + read + write) - if len(ov.Functions) != 21 { - t.Errorf("functions count = %d, want 21", len(ov.Functions)) - } - - // Spot-check function annotations - setDir := ov.Functions["AAudioStreamBuilder_setDirection"] - if !setDir.Chain || setDir.Receiver != "StreamBuilder" { - t.Errorf("setDirection = %+v", setDir) - } - open := ov.Functions["AAudioStreamBuilder_openStream"] - if open.ReturnsNew != "Stream" { - t.Errorf("openStream.returns_new = %q", open.ReturnsNew) - } - cb := ov.Functions["AAudioStreamBuilder_setDataCallback"] - if !cb.Skip { - t.Errorf("setDataCallback should be skipped, got %+v", cb) - } - state := ov.Functions["AAudioStream_getState"] - if !state.Pure || state.GoName != "State" { - t.Errorf("getState = %+v", state) - } - write := ov.Functions["AAudioStream_write"] - if write.BufParam != "buffer" || !write.ReturnsFrames || write.BufGoType != "[]byte" { - t.Errorf("write = %+v", write) - } - - // API levels: 6 entries - if len(ov.APILevels) != 6 { - t.Errorf("api_levels count = %d, want 6", len(ov.APILevels)) - } - if ov.APILevels["AAudioStream_release"] != 30 { - t.Errorf("api_level[release] = %d, want 30", ov.APILevels["AAudioStream_release"]) - } - if ov.APILevels["AAudioStream_getHardwareFormat"] != 34 { - t.Errorf("api_level[getHardwareFormat] = %d, want 34", ov.APILevels["AAudioStream_getHardwareFormat"]) - } -} - -func TestOverlay_NewFields(t *testing.T) { - yamlData := ` -module: camera -package: - go_name: camera - go_import: github.com/AndroidGoLab/ndk/camera -callback_structs: - ACameraDevice_StateCallbacks: - go_name: DeviceStateCallbacks - context_field: context - fields: - onDisconnected: - go_name: OnDisconnected - go_signature: "func()" - onError: - go_name: OnError - go_signature: "func(int)" -struct_accessors: - ACameraIdList: - count_field: numCameras - items_field: cameraIds - item_type: string - delete_func: ACameraManager_deleteCameraIdList -functions: - someFunc: - receiver: Manager - go_name: SomeFunc - fixed_params: - callbacks: "nil" - numRequests: "1" -lifecycle: - entry_point: ANativeActivity_onCreate - activity_type: ANativeActivity - callbacks_accessor: "activity->callbacks" - callback_struct: ANativeActivityCallbacks -` - var ov overlaymodel.Overlay - err := yaml.Unmarshal([]byte(yamlData), &ov) - require.NoError(t, err) - - // CallbackStructs - require.Len(t, ov.CallbackStructs, 1) - cs := ov.CallbackStructs["ACameraDevice_StateCallbacks"] - assert.Equal(t, "DeviceStateCallbacks", cs.GoName) - assert.Equal(t, "context", cs.ContextField) - require.Len(t, cs.Fields, 2) - assert.Equal(t, "OnDisconnected", cs.Fields["onDisconnected"].GoName) - assert.Equal(t, "func()", cs.Fields["onDisconnected"].GoSignature) - - // StructAccessors - require.Len(t, ov.StructAccessors, 1) - sa := ov.StructAccessors["ACameraIdList"] - assert.Equal(t, "numCameras", sa.CountField) - assert.Equal(t, "cameraIds", sa.ItemsField) - assert.Equal(t, "string", sa.ItemType) - assert.Equal(t, "ACameraManager_deleteCameraIdList", sa.DeleteFunc) - - // FixedParams - require.Len(t, ov.Functions["someFunc"].FixedParams, 2) - assert.Equal(t, "nil", ov.Functions["someFunc"].FixedParams["callbacks"]) - assert.Equal(t, "1", ov.Functions["someFunc"].FixedParams["numRequests"]) - - // Lifecycle - require.NotNil(t, ov.Lifecycle) - assert.Equal(t, "ANativeActivity_onCreate", ov.Lifecycle.EntryPoint) - assert.Equal(t, "ANativeActivity", ov.Lifecycle.ActivityType) - assert.Equal(t, "activity->callbacks", ov.Lifecycle.CallbacksAccessor) - assert.Equal(t, "ANativeActivityCallbacks", ov.Lifecycle.CallbackStruct) -} diff --git a/tools/pkg/specgen/.gitkeep b/tools/pkg/specgen/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tools/pkg/specgen/cheader.go b/tools/pkg/specgen/cheader.go deleted file mode 100644 index 7fe9253..0000000 --- a/tools/pkg/specgen/cheader.go +++ /dev/null @@ -1,692 +0,0 @@ -package specgen - -import ( - "fmt" - "os" - "path/filepath" - "regexp" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -// cFuncDeclRe matches a top-level C function declaration after comment stripping -// and line joining: RetType FuncName(Params); -// It captures: (1) return type, (2) function name, (3) params string. -var cFuncDeclRe = regexp.MustCompile( - `(?m)^(\w[\w\s]*(?:\*\s*)?)\b([A-Z]\w+)\s*\(([^)]*)\)\s*(?:__\w+\s*\([^)]*\)\s*)*;`, -) - -var ( - // Matches: typedef RetType (*Name)(Params); - // Also handles: typedef RetType* (*Name)(Params); - funcPtrTypedefRe = regexp.MustCompile( - `typedef\s+(\w[\w\s\*]*?)\s*\(\s*\*\s*(\w+)\s*\)\s*\(([^)]*)\)\s*;`, - ) - - // Matches: typedef struct Name { ... } Name; - namedStructRe = regexp.MustCompile( - `(?s)typedef\s+struct\s+(\w+)\s*\{(.*?)\}\s*(\w+)\s*;`, - ) - - // Matches: typedef struct { ... } Name; - anonStructRe = regexp.MustCompile( - `(?s)typedef\s+struct\s*\{(.*?)\}\s*(\w+)\s*;`, - ) - - // Matches inline function pointer field: RetType (*name)(Params); - // Also handles: RetType* (*name)(Params); - inlineFuncPtrFieldRe = regexp.MustCompile( - `^\s*(\w[\w\s\*]*?)\s*\(\s*\*\s*(\w+)\s*\)\s*\(([^)]*)\)\s*;`, - ) - - // Matches regular struct field: Type name; - // Handles qualifiers like const, pointers, etc. - dataFieldRe = regexp.MustCompile( - `^\s*([\w][\w\s\*]*?)\s+(\w+)\s*;`, - ) -) - -// ParseStructsFromDir reads all .h files in dir and extracts struct definitions. -func ParseStructsFromDir(dir string) (map[string]specmodel.StructDef, error) { - entries, err := os.ReadDir(dir) - if err != nil { - return nil, fmt.Errorf("read dir %s: %w", dir, err) - } - - result := make(map[string]specmodel.StructDef) - for _, e := range entries { - if e.IsDir() || filepath.Ext(e.Name()) != ".h" { - continue - } - - data, err := os.ReadFile(filepath.Join(dir, e.Name())) - if err != nil { - return nil, fmt.Errorf("read %s: %w", e.Name(), err) - } - - for name, sd := range parseStructsFromSource(string(data)) { - result[name] = sd - } - } - - return result, nil -} - -// parseStructsFromSource extracts struct definitions from C header source text. -// -// Two passes: -// 1. Collect typedef'd function pointer signatures into a lookup map. -// 2. Parse typedef struct bodies, resolving fields against the function pointer map. -func parseStructsFromSource(source string) map[string]specmodel.StructDef { - source = stripConditionalBlocks(source, "__ANDROID_VNDK__") - funcPtrTypedefs := parseFuncPtrTypedefs(source) - result := make(map[string]specmodel.StructDef) - - for _, m := range namedStructRe.FindAllStringSubmatch(source, -1) { - name := m[1] - body := m[2] - fields := parseStructBody(body, funcPtrTypedefs) - if len(fields) > 0 { - result[name] = specmodel.StructDef{Fields: fields} - } - } - - for _, m := range anonStructRe.FindAllStringSubmatch(source, -1) { - body := m[1] - name := m[2] - fields := parseStructBody(body, funcPtrTypedefs) - if len(fields) > 0 { - result[name] = specmodel.StructDef{Fields: fields} - } - } - - return result -} - -// funcPtrTypedef holds the parsed return type and parameters -// of a C function pointer typedef. -type funcPtrTypedef struct { - returnType string - params []specmodel.Param -} - -// parseFuncPtrTypedefs extracts all typedef'd function pointers from source. -func parseFuncPtrTypedefs(source string) map[string]funcPtrTypedef { - result := make(map[string]funcPtrTypedef) - for _, m := range funcPtrTypedefRe.FindAllStringSubmatch(source, -1) { - retType := strings.TrimSpace(m[1]) - name := m[2] - paramsStr := m[3] - result[name] = funcPtrTypedef{ - returnType: retType, - params: parseCParams(paramsStr), - } - } - return result -} - -// parseStructBody parses the fields between { } of a struct definition. -// It handles doc comments (single-line and multi-line), inline function pointer -// fields, typedef'd function pointer fields, and regular data fields. -func parseStructBody( - body string, - funcPtrTypedefs map[string]funcPtrTypedef, -) []specmodel.StructField { - var fields []specmodel.StructField - - lines := strings.Split(body, "\n") - inBlockComment := false - - for _, line := range lines { - trimmed := strings.TrimSpace(line) - - // Handle block comment start/end. - if inBlockComment { - if strings.Contains(trimmed, "*/") { - inBlockComment = false - } - continue - } - - if strings.HasPrefix(trimmed, "/*") { - if !strings.Contains(trimmed, "*/") { - inBlockComment = true - } - continue - } - - // Skip single-line comments and empty lines. - if trimmed == "" || strings.HasPrefix(trimmed, "//") || strings.HasPrefix(trimmed, "*") { - continue - } - - // Try inline function pointer field first. - if m := inlineFuncPtrFieldRe.FindStringSubmatch(line); m != nil { - retType := strings.TrimSpace(m[1]) - fieldName := m[2] - paramsStr := m[3] - params := parseCParams(paramsStr) - - field := specmodel.StructField{ - Name: fieldName, - Type: "func_ptr", - Params: params, - } - if retType != "void" { - field.Returns = normalizeCType(retType) - } - fields = append(fields, field) - continue - } - - // Try regular data field (which might be a typedef'd func ptr). - if m := dataFieldRe.FindStringSubmatch(line); m != nil { - typeName := strings.TrimSpace(m[1]) - fieldName := m[2] - - if fpt, ok := funcPtrTypedefs[typeName]; ok { - field := specmodel.StructField{ - Name: fieldName, - Type: "func_ptr", - Params: fpt.params, - } - if fpt.returnType != "void" { - field.Returns = normalizeCType(fpt.returnType) - } - fields = append(fields, field) - } else { - fields = append(fields, specmodel.StructField{ - Name: fieldName, - Type: normalizeCType(typeName), - }) - } - } - } - - return fields -} - -// parseCParams parses a C function parameter list string into Param slices. -// Handles formats like: -// -// "void* context, ACameraDevice* device, int error" -func parseCParams(paramsStr string) []specmodel.Param { - paramsStr = strings.TrimSpace(paramsStr) - if paramsStr == "" || paramsStr == "void" { - return nil - } - - var params []specmodel.Param - for _, p := range strings.Split(paramsStr, ",") { - p = strings.TrimSpace(p) - if p == "" { - continue - } - param := parseSingleCParam(p) - params = append(params, param) - } - return params -} - -// parseSingleCParam parses a single C parameter declaration like "const ARect* rect" -// into a specmodel.Param with normalized Go-style type. -func parseSingleCParam(decl string) specmodel.Param { - decl = strings.TrimSpace(decl) - decl = stripNullabilityAnnotations(decl) - - // Split into tokens. - tokens := strings.Fields(decl) - if len(tokens) == 0 { - return specmodel.Param{} - } - - // Last token is the name (may have trailing *). - name := tokens[len(tokens)-1] - typeTokens := tokens[:len(tokens)-1] - - // Handle cases where the name has leading * (e.g., "*outSize") or - // the pointer is attached to the name. - nameStars := 0 - for strings.HasPrefix(name, "*") { - nameStars++ - name = name[1:] - } - - // Build up the type from remaining tokens, counting pointers. - isConst := false - ptrCount := nameStars - var typeNameParts []string - - for _, tok := range typeTokens { - if tok == "const" { - isConst = true - continue - } - - // Count and strip trailing asterisks from type tokens. - for strings.HasSuffix(tok, "*") { - ptrCount++ - tok = tok[:len(tok)-1] - } - - // Strip remaining "const" after pointer removal (e.g., "char* const**"). - if tok == "const" { - isConst = true - continue - } - - if tok != "" { - typeNameParts = append(typeNameParts, tok) - } - } - - typeName := strings.Join(typeNameParts, " ") - cDeclarator := normalizeCDeclarator(typeTokens, nameStars) - - // Normalize to Go-style pointer notation. - goType := typeName - if ptrCount > 0 { - if typeName == "void" { - goType = "void*" - ptrCount-- - } - - for range ptrCount { - goType = "*" + goType - } - } - - // Handle "char**" → "**char" etc. - if typeName == "char" && goType == "**char" { - goType = "**char" - } - - return specmodel.Param{ - Name: name, - Type: goType, - CType: cDeclarator, - Const: isConst, - } -} - -// stripNullabilityAnnotations removes Clang nullability attributes from a C declaration. -func stripNullabilityAnnotations(s string) string { - for _, annotation := range []string{ - "_Nonnull", - "_Nullable", - "_Null_unspecified", - "__nonnull", - "__nullable", - } { - s = strings.ReplaceAll(s, annotation, "") - } - for strings.Contains(s, " ") { - s = strings.ReplaceAll(s, " ", " ") - } - return strings.TrimSpace(s) -} - -func normalizeCDeclarator(typeTokens []string, nameStars int) string { - declarator := strings.TrimSpace(strings.Join(typeTokens, " ")) - declarator = strings.ReplaceAll(declarator, " *", "*") - declarator = strings.ReplaceAll(declarator, "* ", "*") - if declarator == "" { - declarator = "void" - } - return declarator + strings.Repeat("*", nameStars) -} - -// ParseFunctionsFromDir reads all .h files in dir and extracts function declarations. -func ParseFunctionsFromDir(dir string) (map[string]specmodel.FuncDef, error) { - entries, err := os.ReadDir(dir) - if err != nil { - return nil, fmt.Errorf("read dir %s: %w", dir, err) - } - - result := make(map[string]specmodel.FuncDef) - for _, e := range entries { - if e.IsDir() || filepath.Ext(e.Name()) != ".h" { - continue - } - - data, err := os.ReadFile(filepath.Join(dir, e.Name())) - if err != nil { - return nil, fmt.Errorf("read %s: %w", e.Name(), err) - } - - for name, fd := range parseFunctionsFromSource(string(data)) { - result[name] = fd - } - } - - return result, nil -} - -// parseFunctionsFromSource extracts C function declarations from header source. -// It strips comments, joins multi-line declarations, then matches function -// declarations starting with an uppercase letter (NDK API convention). -func parseFunctionsFromSource(source string) map[string]specmodel.FuncDef { - result := make(map[string]specmodel.FuncDef) - - cleaned := stripCComments(source) - cleaned = stripConditionalBlocks(cleaned, "__ANDROID_VNDK__") - joined := joinCLines(cleaned) - - for _, m := range cFuncDeclRe.FindAllStringSubmatch(joined, -1) { - retTypeStr := strings.TrimSpace(m[1]) - funcName := m[2] - paramsStr := m[3] - - // Skip typedef'd function pointers and macros. - if strings.Contains(retTypeStr, "typedef") { - continue - } - - // Skip JNI infrastructure and non-NDK functions. - if strings.HasPrefix(funcName, "JNI_") { - continue - } - - // Parse parameters using the existing C param parser. - params := parseCFuncParams(paramsStr) - - // Convert C return type to spec Go type. - goRetType := cTypeToGoType(retTypeStr) - if goRetType == "void" { - goRetType = "" - } - - result[funcName] = specmodel.FuncDef{ - CName: funcName, - Params: params, - Returns: goRetType, - } - } - - return result -} - -// parseCFuncParams parses a C function parameter list and converts types to -// Go/spec format for function definitions. -func parseCFuncParams(paramsStr string) []specmodel.Param { - paramsStr = strings.TrimSpace(paramsStr) - if paramsStr == "" || paramsStr == "void" { - return nil - } - - var params []specmodel.Param - for _, p := range strings.Split(paramsStr, ",") { - p = strings.TrimSpace(p) - if p == "" { - continue - } - - // Strip /*out*/ annotation. - isOut := strings.Contains(p, "/*out*/") - p = strings.ReplaceAll(p, "/*out*/", "") - p = strings.TrimSpace(p) - - raw := parseSingleCParam(p) - - goType := cTypeToGoType(raw.Type) - - dir := "" - if isOut || (isDoublePointerType(goType) && !raw.Const) { - dir = "out" - } - - params = append(params, specmodel.Param{ - Name: raw.Name, - Type: goType, - CType: raw.CType, - Direction: dir, - Const: raw.Const, - }) - } - return params -} - -// isDoublePointerType returns true if the type string represents a double pointer. -func isDoublePointerType(t string) bool { - return strings.HasPrefix(t, "**") -} - -// cTypeToGoType converts a C type to the Go/spec type format used in function -// definitions. Handles both C notation (trailing *) and Go notation (leading *). -func cTypeToGoType(cType string) string { - cType = strings.TrimSpace(cType) - cType = strings.TrimPrefix(cType, "const ") - - // Count pointer indirections from both ends. - stars := 0 - for strings.HasSuffix(cType, "*") { - stars++ - cType = strings.TrimSpace(cType[:len(cType)-1]) - } - for strings.HasPrefix(cType, "*") { - stars++ - cType = cType[1:] - } - - if cType == "void" { - if stars == 0 { - return "void" - } - if stars == 1 { - return "unsafe.Pointer" - } - result := "unsafe.Pointer" - for range stars - 1 { - result = "*" + result - } - return result - } - - goBase := cBaseTypeToGo(cType) - result := goBase - for range stars { - result = "*" + result - } - return result -} - -// cBaseTypeToGo converts a C base type name to its Go equivalent. -func cBaseTypeToGo(cType string) string { - switch cType { - case "char": - return "byte" - case "int32_t": - return "int32" - case "uint32_t": - return "uint32" - case "int64_t": - return "int64" - case "uint64_t": - return "uint64" - case "int16_t": - return "int16" - case "uint16_t": - return "uint16" - case "int8_t": - return "int8" - case "uint8_t": - return "uint8" - case "float": - return "float32" - case "double": - return "float64" - case "bool", "_Bool": - return "bool" - case "size_t": - return "uint" - case "uintptr_t": - return "uintptr" - default: - // Capitalize first letter for C typedef types (e.g., camera_status_t → Camera_status_t). - if len(cType) > 0 && cType[0] >= 'a' && cType[0] <= 'z' && strings.Contains(cType, "_") { - return strings.ToUpper(cType[:1]) + cType[1:] - } - return cType - } -} - -// stripCComments removes both line (//) and block (/* */) comments from C source, -// except for /*out*/ annotations which are handled separately. -func stripCComments(source string) string { - var b strings.Builder - i := 0 - for i < len(source) { - if i+1 < len(source) && source[i] == '/' && source[i+1] == '/' { - // Line comment — skip to end of line. - for i < len(source) && source[i] != '\n' { - i++ - } - continue - } - if i+1 < len(source) && source[i] == '/' && source[i+1] == '*' { - // Check for /*out*/ annotation — preserve it. - if i+6 < len(source) && source[i:i+7] == "/*out*/" { - b.WriteString("/*out*/") - i += 7 - continue - } - // Block comment — skip until closing */. - i += 2 - closed := false - for i+1 < len(source) { - if source[i] == '*' && source[i+1] == '/' { - i += 2 - closed = true - break - } - i++ - } - // If unterminated, consume all remaining bytes so the - // outer loop doesn't leak the last byte as non-comment. - if !closed { - i = len(source) - } - continue - } - b.WriteByte(source[i]) - i++ - } - return b.String() -} - -// stripConditionalBlocks removes #ifdef MACRO ... #endif blocks from source. -// Handles nested #ifdef/#endif. Used to exclude vendor-only (VNDK) code. -func stripConditionalBlocks(source, macro string) string { - lines := strings.Split(source, "\n") - var result []string - depth := 0 - for _, line := range lines { - trimmed := strings.TrimSpace(line) - if trimmed == "#ifdef "+macro { - depth++ - continue - } - if depth > 0 { - switch { - case strings.HasPrefix(trimmed, "#ifdef") || strings.HasPrefix(trimmed, "#ifndef"): - depth++ - case trimmed == "#endif": - depth-- - } - continue - } - result = append(result, line) - } - return strings.Join(result, "\n") -} - -// joinCLines collapses multi-line C declarations into single lines. -// It joins any line that doesn't end with ';', '{', '}', or '#' (preprocessor) -// with the following line. -func joinCLines(source string) string { - lines := strings.Split(source, "\n") - var result []string - var current strings.Builder - - for _, line := range lines { - trimmed := strings.TrimSpace(line) - if trimmed == "" { - if current.Len() > 0 { - result = append(result, current.String()) - current.Reset() - } - continue - } - - // Skip preprocessor directives. - if strings.HasPrefix(trimmed, "#") { - if current.Len() > 0 { - result = append(result, current.String()) - current.Reset() - } - continue - } - - if current.Len() > 0 { - current.WriteByte(' ') - } - current.WriteString(trimmed) - - // If line ends with ; or { or }, flush. - if strings.HasSuffix(trimmed, ";") || strings.HasSuffix(trimmed, "{") || strings.HasSuffix(trimmed, "}") { - result = append(result, current.String()) - current.Reset() - } - } - if current.Len() > 0 { - result = append(result, current.String()) - } - - return strings.Join(result, "\n") -} - -// normalizeCType converts a C type string to a normalized form for the spec. -// Examples: -// -// "int" → "int" -// "void*" → "void*" -// "const char**" → "**char" -func normalizeCType(cType string) string { - cType = strings.TrimSpace(cType) - - tokens := strings.Fields(cType) - ptrCount := 0 - var typeNameParts []string - - for _, tok := range tokens { - if tok == "const" { - continue - } - - for strings.HasSuffix(tok, "*") { - ptrCount++ - tok = tok[:len(tok)-1] - } - - if tok != "" { - typeNameParts = append(typeNameParts, tok) - } - } - - typeName := strings.Join(typeNameParts, " ") - - if ptrCount > 0 { - if typeName == "void" { - return "void*" - } - - result := typeName - for range ptrCount { - result = "*" + result - } - return result - } - - return typeName -} diff --git a/tools/pkg/specgen/cheader_property_test.go b/tools/pkg/specgen/cheader_property_test.go deleted file mode 100644 index 58292d8..0000000 --- a/tools/pkg/specgen/cheader_property_test.go +++ /dev/null @@ -1,135 +0,0 @@ -package specgen - -import ( - "strings" - "testing" - "testing/quick" -) - -// TestStripCComments_UnterminatedBlockComment verifies the fix for the -// unterminated block comment bug: no bytes from an unterminated comment -// should leak into the output. -func TestStripCComments_UnterminatedBlockComment(t *testing.T) { - cases := []struct { - name, input, want string - }{ - { - "unterminated at end", - "int x; /* incomplete", - "int x; ", - }, - { - "unterminated only comment", - "/* everything is a comment", - "", - }, - { - "normal terminated comment", - "int x; /* comment */ int y;", - "int x; int y;", - }, - { - "out annotation preserved", - "int /*out*/ x;", - "int /*out*/ x;", - }, - { - "line comment", - "int x; // comment\nint y;", - "int x; \nint y;", - }, - { - "empty input", - "", - "", - }, - { - "no comments", - "int x; int y;", - "int x; int y;", - }, - } - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - got := stripCComments(tc.input) - if got != tc.want { - t.Errorf("stripCComments(%q) = %q, want %q", tc.input, got, tc.want) - } - }) - } -} - -// TestStripCComments_NoCommentCharsInOutput verifies that /* sequences -// from comments don't appear in the output (except preserved /*out*/). -func TestStripCComments_NoCommentCharsInOutput(t *testing.T) { - f := func(s string) bool { - result := stripCComments(s) - // The only /* that should remain is /*out*/. - cleaned := strings.ReplaceAll(result, "/*out*/", "") - return !strings.Contains(cleaned, "/*") - } - if err := quick.Check(f, nil); err != nil { - t.Errorf("stripCComments leaked comment markers: %v", err) - } -} - -// TestNormalizeCType_Idempotent verifies normalizeCType produces consistent output. -func TestNormalizeCType_Idempotent(t *testing.T) { - cases := []struct{ in_, want string }{ - {"int", "int"}, - {"void*", "void*"}, - {"const char**", "**char"}, - {"ALooper*", "*ALooper"}, - {"const ARect*", "*ARect"}, - } - for _, tc := range cases { - if got := normalizeCType(tc.in_); got != tc.want { - t.Errorf("normalizeCType(%q) = %q, want %q", tc.in_, got, tc.want) - } - } -} - -// TestParseSingleCParam_Vectors verifies C parameter parsing. -func TestParseSingleCParam_Vectors(t *testing.T) { - cases := []struct { - decl string - wantName string - wantType string - }{ - {"int x", "x", "int"}, - {"void* context", "context", "void*"}, - {"const char* name", "name", "*char"}, - {"ALooper* looper", "looper", "*ALooper"}, - {"int32_t *outSize", "outSize", "*int32_t"}, - } - for _, tc := range cases { - p := parseSingleCParam(tc.decl) - if p.Name != tc.wantName { - t.Errorf("parseSingleCParam(%q).Name = %q, want %q", tc.decl, p.Name, tc.wantName) - } - if p.Type != tc.wantType { - t.Errorf("parseSingleCParam(%q).Type = %q, want %q", tc.decl, p.Type, tc.wantType) - } - } -} - -// TestCTypeToGoType_Roundtrip verifies common C types map correctly. -func TestCTypeToGoType_Roundtrip(t *testing.T) { - cases := []struct{ cType, want string }{ - {"int32_t", "int32"}, - {"uint32_t", "uint32"}, - {"int64_t", "int64"}, - {"float", "float32"}, - {"double", "float64"}, - {"void", "void"}, - {"void*", "unsafe.Pointer"}, - {"void**", "*unsafe.Pointer"}, - {"char", "byte"}, - {"bool", "bool"}, - } - for _, tc := range cases { - if got := cTypeToGoType(tc.cType); got != tc.want { - t.Errorf("cTypeToGoType(%q) = %q, want %q", tc.cType, got, tc.want) - } - } -} diff --git a/tools/pkg/specgen/cheader_test.go b/tools/pkg/specgen/cheader_test.go deleted file mode 100644 index 3201650..0000000 --- a/tools/pkg/specgen/cheader_test.go +++ /dev/null @@ -1,422 +0,0 @@ -package specgen - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestParseStructsFromDir(t *testing.T) { - structs, err := ParseStructsFromDir("testdata/headers") - require.NoError(t, err) - - // Should find structs from both header files. - require.Contains(t, structs, "ACameraDevice_StateCallbacks") - require.Contains(t, structs, "ACameraIdList") - require.Contains(t, structs, "ANativeActivityCallbacks") -} - -func TestParseStructsFromDir_NonexistentDir(t *testing.T) { - _, err := ParseStructsFromDir("testdata/nonexistent") - require.Error(t, err) -} - -func TestParseStructsFromSource_TypedefFuncPtrFields(t *testing.T) { - source := ` -typedef void (*ACameraDevice_StateCallback)(void* context, ACameraDevice* device); -typedef void (*ACameraDevice_ErrorStateCallback)(void* context, ACameraDevice* device, int error); - -typedef struct ACameraDevice_StateCallbacks { - /// optional application context. - void* context; - - /** - * Called when a camera device is no longer available for use. - * - *

Any attempt to call API methods on this ACameraDevice will return - * {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}.

- */ - ACameraDevice_StateCallback onDisconnected; - - /** - * Called when a camera device has encountered a serious error. - */ - ACameraDevice_ErrorStateCallback onError; -} ACameraDevice_StateCallbacks; -` - structs := parseStructsFromSource(source) - require.Contains(t, structs, "ACameraDevice_StateCallbacks") - - sd := structs["ACameraDevice_StateCallbacks"] - require.Len(t, sd.Fields, 3) - - // Field 0: void* context - assert.Equal(t, "context", sd.Fields[0].Name) - assert.Equal(t, "void*", sd.Fields[0].Type) - assert.Empty(t, sd.Fields[0].Params) - - // Field 1: onDisconnected (func_ptr via typedef lookup) - assert.Equal(t, "onDisconnected", sd.Fields[1].Name) - assert.Equal(t, "func_ptr", sd.Fields[1].Type) - require.Len(t, sd.Fields[1].Params, 2) - assert.Equal(t, "context", sd.Fields[1].Params[0].Name) - assert.Equal(t, "void*", sd.Fields[1].Params[0].Type) - assert.Equal(t, "device", sd.Fields[1].Params[1].Name) - assert.Equal(t, "*ACameraDevice", sd.Fields[1].Params[1].Type) - - // Field 2: onError (func_ptr via typedef lookup) - assert.Equal(t, "onError", sd.Fields[2].Name) - assert.Equal(t, "func_ptr", sd.Fields[2].Type) - require.Len(t, sd.Fields[2].Params, 3) - assert.Equal(t, "context", sd.Fields[2].Params[0].Name) - assert.Equal(t, "device", sd.Fields[2].Params[1].Name) - assert.Equal(t, "error", sd.Fields[2].Params[2].Name) - assert.Equal(t, "int", sd.Fields[2].Params[2].Type) -} - -func TestParseStructsFromSource_DataFields(t *testing.T) { - source := ` -typedef struct ACameraIdList { - int numCameras; ///< Number of camera device Ids - const char** cameraIds; ///< list of camera device Ids -} ACameraIdList; -` - structs := parseStructsFromSource(source) - require.Contains(t, structs, "ACameraIdList") - - sd := structs["ACameraIdList"] - require.Len(t, sd.Fields, 2) - - assert.Equal(t, "numCameras", sd.Fields[0].Name) - assert.Equal(t, "int", sd.Fields[0].Type) - - assert.Equal(t, "cameraIds", sd.Fields[1].Name) - assert.Equal(t, "**char", sd.Fields[1].Type) -} - -func TestParseStructsFromSource_InlineFuncPtrFields(t *testing.T) { - source := ` -typedef struct ANativeActivityCallbacks { - /** - * NativeActivity has started. - */ - void (*onStart)(ANativeActivity* activity); - - /** - * Save instance state callback. - */ - void* (*onSaveInstanceState)(ANativeActivity* activity, size_t* outSize); - - /** - * Window focus changed. - */ - void (*onWindowFocusChanged)(ANativeActivity* activity, int hasFocus); - - /** - * Native window created. - */ - void (*onNativeWindowCreated)(ANativeActivity* activity, ANativeWindow* window); - - /** - * Content rect changed. - */ - void (*onContentRectChanged)(ANativeActivity* activity, const ARect* rect); -} ANativeActivityCallbacks; -` - structs := parseStructsFromSource(source) - require.Contains(t, structs, "ANativeActivityCallbacks") - - sd := structs["ANativeActivityCallbacks"] - require.Len(t, sd.Fields, 5) - - // onStart - assert.Equal(t, "onStart", sd.Fields[0].Name) - assert.Equal(t, "func_ptr", sd.Fields[0].Type) - require.Len(t, sd.Fields[0].Params, 1) - assert.Equal(t, "activity", sd.Fields[0].Params[0].Name) - assert.Equal(t, "*ANativeActivity", sd.Fields[0].Params[0].Type) - - // onSaveInstanceState - assert.Equal(t, "onSaveInstanceState", sd.Fields[1].Name) - assert.Equal(t, "func_ptr", sd.Fields[1].Type) - require.Len(t, sd.Fields[1].Params, 2) - assert.Equal(t, "activity", sd.Fields[1].Params[0].Name) - assert.Equal(t, "*ANativeActivity", sd.Fields[1].Params[0].Type) - assert.Equal(t, "outSize", sd.Fields[1].Params[1].Name) - assert.Equal(t, "*size_t", sd.Fields[1].Params[1].Type) - - // onWindowFocusChanged - assert.Equal(t, "onWindowFocusChanged", sd.Fields[2].Name) - assert.Equal(t, "func_ptr", sd.Fields[2].Type) - require.Len(t, sd.Fields[2].Params, 2) - assert.Equal(t, "hasFocus", sd.Fields[2].Params[1].Name) - assert.Equal(t, "int", sd.Fields[2].Params[1].Type) - - // onNativeWindowCreated - assert.Equal(t, "onNativeWindowCreated", sd.Fields[3].Name) - assert.Equal(t, "func_ptr", sd.Fields[3].Type) - require.Len(t, sd.Fields[3].Params, 2) - assert.Equal(t, "window", sd.Fields[3].Params[1].Name) - assert.Equal(t, "*ANativeWindow", sd.Fields[3].Params[1].Type) - - // onContentRectChanged - assert.Equal(t, "onContentRectChanged", sd.Fields[4].Name) - assert.Equal(t, "func_ptr", sd.Fields[4].Type) - require.Len(t, sd.Fields[4].Params, 2) - assert.Equal(t, "rect", sd.Fields[4].Params[1].Name) - assert.Equal(t, "*ARect", sd.Fields[4].Params[1].Type) -} - -func TestParseStructsFromSource_AnonymousStruct(t *testing.T) { - source := ` -typedef struct { - int width; - int height; -} ASize; -` - structs := parseStructsFromSource(source) - require.Contains(t, structs, "ASize") - - sd := structs["ASize"] - require.Len(t, sd.Fields, 2) - assert.Equal(t, "width", sd.Fields[0].Name) - assert.Equal(t, "int", sd.Fields[0].Type) - assert.Equal(t, "height", sd.Fields[1].Name) - assert.Equal(t, "int", sd.Fields[1].Type) -} - -func TestParseStructsFromSource_EmptyStruct(t *testing.T) { - source := ` -typedef struct EmptyThing { -} EmptyThing; -` - structs := parseStructsFromSource(source) - assert.NotContains(t, structs, "EmptyThing") -} - -func TestParseCParams(t *testing.T) { - tests := []struct { - name string - input string - wantLen int - wantName string - wantType string - }{ - {"empty", "", 0, "", ""}, - {"void", "void", 0, "", ""}, - { - "simple int", - "int error", - 1, "error", "int", - }, - { - "pointer type", - "ACameraDevice* device", - 1, "device", "*ACameraDevice", - }, - { - "void pointer", - "void* context", - 1, "context", "void*", - }, - { - "const pointer", - "const ARect* rect", - 1, "rect", "*ARect", - }, - { - "pointer attached to name", - "size_t* outSize", - 1, "outSize", "*size_t", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - params := parseCParams(tt.input) - assert.Len(t, params, tt.wantLen) - if tt.wantLen > 0 { - assert.Equal(t, tt.wantName, params[0].Name) - assert.Equal(t, tt.wantType, params[0].Type) - } - }) - } -} - -func TestParseCParams_Multiple(t *testing.T) { - params := parseCParams("void* context, ACameraDevice* device, int error") - require.Len(t, params, 3) - - assert.Equal(t, "context", params[0].Name) - assert.Equal(t, "void*", params[0].Type) - - assert.Equal(t, "device", params[1].Name) - assert.Equal(t, "*ACameraDevice", params[1].Type) - - assert.Equal(t, "error", params[2].Name) - assert.Equal(t, "int", params[2].Type) -} - -func TestParseFunctionsFromSource_SingleLine(t *testing.T) { - source := ` -ACameraManager* ACameraManager_create() __INTRODUCED_IN(24); -void ACameraManager_delete(ACameraManager* manager) __INTRODUCED_IN(24); -` - funcs := parseFunctionsFromSource(source) - - require.Contains(t, funcs, "ACameraManager_create") - fd := funcs["ACameraManager_create"] - assert.Equal(t, "ACameraManager_create", fd.CName) - assert.Empty(t, fd.Params) - assert.Equal(t, "*ACameraManager", fd.Returns) - - require.Contains(t, funcs, "ACameraManager_delete") - fd = funcs["ACameraManager_delete"] - assert.Equal(t, "ACameraManager_delete", fd.CName) - require.Len(t, fd.Params, 1) - assert.Equal(t, "manager", fd.Params[0].Name) - assert.Equal(t, "*ACameraManager", fd.Params[0].Type) - assert.Equal(t, "", fd.Returns) -} - -func TestParseFunctionsFromSource_MultiLine(t *testing.T) { - source := ` -/** - * Gets camera characteristics. - */ -camera_status_t ACameraManager_getCameraCharacteristics( - ACameraManager* manager, const char* cameraId, - /*out*/ACameraMetadata** characteristics) __INTRODUCED_IN(24); -` - funcs := parseFunctionsFromSource(source) - - require.Contains(t, funcs, "ACameraManager_getCameraCharacteristics") - fd := funcs["ACameraManager_getCameraCharacteristics"] - assert.Equal(t, "ACameraManager_getCameraCharacteristics", fd.CName) - assert.Equal(t, "Camera_status_t", fd.Returns) - - require.Len(t, fd.Params, 3) - assert.Equal(t, "manager", fd.Params[0].Name) - assert.Equal(t, "*ACameraManager", fd.Params[0].Type) - - assert.Equal(t, "cameraId", fd.Params[1].Name) - assert.Equal(t, "*byte", fd.Params[1].Type) - - assert.Equal(t, "characteristics", fd.Params[2].Name) - assert.Equal(t, "**ACameraMetadata", fd.Params[2].Type) - assert.Equal(t, "out", fd.Params[2].Direction) -} - -func TestParseFunctionsFromSource_SkipsStaticInline(t *testing.T) { - source := ` -static inline int helper_func(int x) { return x + 1; } -ACameraManager* ACameraManager_create(void); -` - funcs := parseFunctionsFromSource(source) - - assert.NotContains(t, funcs, "helper_func") - assert.Contains(t, funcs, "ACameraManager_create") -} - -func TestParseFunctionsFromSource_IntTypes(t *testing.T) { - source := ` -camera_status_t ACameraMetadata_getConstEntry( - const ACameraMetadata* metadata, - uint32_t tag, /*out*/ACameraMetadata_const_entry* entry) __INTRODUCED_IN(24); -` - funcs := parseFunctionsFromSource(source) - - require.Contains(t, funcs, "ACameraMetadata_getConstEntry") - fd := funcs["ACameraMetadata_getConstEntry"] - - require.Len(t, fd.Params, 3) - assert.Equal(t, "metadata", fd.Params[0].Name) - assert.Equal(t, "*ACameraMetadata", fd.Params[0].Type) - - assert.Equal(t, "tag", fd.Params[1].Name) - assert.Equal(t, "uint32", fd.Params[1].Type) - - assert.Equal(t, "entry", fd.Params[2].Name) - assert.Equal(t, "*ACameraMetadata_const_entry", fd.Params[2].Type) - assert.Equal(t, "out", fd.Params[2].Direction) -} - -func TestParseFunctionsFromSource_ConstPointerArrayIsInput(t *testing.T) { - source := ` -void AInput(const char * const *values); -void AOutput(/*out*/ char **values); -` - funcs := parseFunctionsFromSource(source) - - input := funcs["AInput"].Params[0] - assert.Equal(t, "**byte", input.Type) - assert.Equal(t, "const char*const*", input.CType) - assert.True(t, input.Const) - assert.Empty(t, input.Direction) - - output := funcs["AOutput"].Params[0] - assert.Equal(t, "**byte", output.Type) - assert.Equal(t, "char**", output.CType) - assert.Equal(t, "out", output.Direction) -} - -func TestParseFunctionsFromSource_StripsParameterNullability(t *testing.T) { - source := ` -void ANullable(const char* _Nonnull value, int* _Nullable out); -` - - params := parseFunctionsFromSource(source)["ANullable"].Params - require.Len(t, params, 2) - - assert.Equal(t, "*byte", params[0].Type) - assert.Equal(t, "const char*", params[0].CType) - assert.Equal(t, "*int", params[1].Type) - assert.Equal(t, "int*", params[1].CType) -} - -func TestCTypeToGoType(t *testing.T) { - tests := []struct { - input string - want string - }{ - {"void", "void"}, - {"void*", "unsafe.Pointer"}, - {"*char", "*byte"}, - {"**char", "**byte"}, - {"*ACameraManager", "*ACameraManager"}, - {"**ACameraMetadata", "**ACameraMetadata"}, - {"int32_t", "int32"}, - {"uint32_t", "uint32"}, - {"camera_status_t", "Camera_status_t"}, - {"int", "int"}, - } - - for _, tt := range tests { - t.Run(tt.input, func(t *testing.T) { - got := cTypeToGoType(tt.input) - assert.Equal(t, tt.want, got) - }) - } -} - -func TestNormalizeCType(t *testing.T) { - tests := []struct { - input string - want string - }{ - {"int", "int"}, - {"void*", "void*"}, - {"const char**", "**char"}, - {"ACameraDevice*", "*ACameraDevice"}, - {"const ARect*", "*ARect"}, - {"size_t", "size_t"}, - } - - for _, tt := range tests { - t.Run(tt.input, func(t *testing.T) { - got := normalizeCType(tt.input) - assert.Equal(t, tt.want, got) - }) - } -} diff --git a/tools/pkg/specgen/parser.go b/tools/pkg/specgen/parser.go deleted file mode 100644 index 2567441..0000000 --- a/tools/pkg/specgen/parser.go +++ /dev/null @@ -1,427 +0,0 @@ -// Package specgen extracts structured API specs from Go source files produced by c-for-go. -package specgen - -import ( - "bufio" - "fmt" - "go/ast" - "go/parser" - "go/token" - "os" - "path/filepath" - "regexp" - "strconv" - "strings" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -// ParseSources parses Go source files and extracts types, enums, functions, -// and callbacks into a Spec. The files are expected to be c-for-go output -// (pure Go with C.* selector expressions for opaque handle types). -func ParseSources(module, sourcePkg string, filePaths []string) (specmodel.Spec, error) { - spec := specmodel.Spec{ - Module: module, - SourcePackage: sourcePkg, - Types: make(map[string]specmodel.TypeDef), - Enums: make(map[string][]specmodel.EnumValue), - Functions: make(map[string]specmodel.FuncDef), - Callbacks: make(map[string]specmodel.CallbackDef), - } - - fset := token.NewFileSet() - for _, path := range filePaths { - f, err := parser.ParseFile(fset, path, nil, 0) - if err != nil { - return spec, fmt.Errorf("parse %s: %w", path, err) - } - extractTypes(f, &spec) - extractConsts(f, &spec) - extractFunctions(f, &spec) - } - - return spec, nil -} - -// extractTypes processes type declarations: opaque handles (C.* selectors), -// integer typedefs, and callback function types. -func extractTypes(f *ast.File, spec *specmodel.Spec) { - for _, decl := range f.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok || genDecl.Tok != token.TYPE { - continue - } - for _, s := range genDecl.Specs { - ts := s.(*ast.TypeSpec) - name := ts.Name.Name - - switch typ := ts.Type.(type) { - case *ast.SelectorExpr: - ident, ok := typ.X.(*ast.Ident) - if !ok { - break - } - switch { - case ident.Name == "C": - // type Foo C.Bar → opaque handle (C package selector). - spec.Types[name] = specmodel.TypeDef{ - Kind: "opaque_ptr", - CType: typ.Sel.Name, - GoType: "*C." + typ.Sel.Name, - } - case ident.Name == "unsafe" && typ.Sel.Name == "Pointer": - // type Foo unsafe.Pointer → pointer-sized handle (EGL/etc). - spec.Types[name] = specmodel.TypeDef{ - Kind: "pointer_handle", - CType: name, - GoType: "unsafe.Pointer", - } - } - - case *ast.Ident: - // type Foo int32 → integer typedef. - kind := classifyIdent(typ.Name) - if kind != "" { - spec.Types[name] = specmodel.TypeDef{ - Kind: kind, - CType: name, - GoType: typ.Name, - } - } - - case *ast.FuncType: - // type Foo func(...) → callback. - spec.Callbacks[name] = specmodel.CallbackDef{ - Params: extractParamList(typ.Params), - Returns: returnTypeString(typ.Results), - } - } - } - } -} - -// classifyIdent maps Go built-in integer type names to spec kind strings. -func classifyIdent(name string) string { - switch name { - case "int32": - return "typedef_int32" - case "uint32": - return "typedef_uint32" - case "int64": - return "typedef_int64" - case "uint64": - return "typedef_uint64" - case "int": - return "typedef_int" - case "uint": - return "typedef_uint" - case "int8": - return "typedef_int8" - case "uint8": - return "typedef_uint8" - case "int16": - return "typedef_int16" - case "uint16": - return "typedef_uint16" - case "float32": - return "typedef_float32" - case "float64": - return "typedef_float64" - default: - return "" - } -} - -// extractConsts processes const blocks, grouping typed constants into enum values. -// Handles negative values expressed as UnaryExpr with SUB operator. -func extractConsts(f *ast.File, spec *specmodel.Spec) { - for _, decl := range f.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok || genDecl.Tok != token.CONST { - continue - } - - var currentType string - for _, s := range genDecl.Specs { - vs := s.(*ast.ValueSpec) - - // Track the current type (iota-style const blocks carry the type forward). - if vs.Type != nil { - currentType = typeString(vs.Type) - } - if currentType == "" { - continue - } - - for i, name := range vs.Names { - if i >= len(vs.Values) { - continue - } - val, ok := evalConstInt(vs.Values[i]) - if !ok { - continue - } - spec.Enums[currentType] = append(spec.Enums[currentType], specmodel.EnumValue{ - Name: name.Name, - Value: val, - }) - } - } - } -} - -// evalConstInt evaluates a constant expression to an int64. -// Supports BasicLit (integer) and UnaryExpr with SUB (negative). -func evalConstInt(expr ast.Expr) (int64, bool) { - switch v := expr.(type) { - case *ast.BasicLit: - if v.Kind != token.INT { - return 0, false - } - n, err := strconv.ParseInt(v.Value, 0, 64) - return n, err == nil - - case *ast.UnaryExpr: - if v.Op != token.SUB { - return 0, false - } - inner, ok := evalConstInt(v.X) - if !ok { - return 0, false - } - return -inner, true - - default: - return 0, false - } -} - -// extractFunctions processes package-level exported function declarations. -// Double-pointer params (**SomeType) are detected as output params. -func extractFunctions(f *ast.File, spec *specmodel.Spec) { - for _, decl := range f.Decls { - funcDecl, ok := decl.(*ast.FuncDecl) - if !ok { - continue - } - // Skip methods (have a receiver) and unexported functions. - if funcDecl.Recv != nil || !funcDecl.Name.IsExported() { - continue - } - // Skip JNI infrastructure, bridge, and c-for-go ref-helper functions - // (not part of the NDK API). - name := funcDecl.Name.Name - if strings.HasPrefix(name, "JNI_") || strings.HasPrefix(name, "Bridge") || strings.HasPrefix(name, "New") { - continue - } - - fd := specmodel.FuncDef{ - CName: funcDecl.Name.Name, - Params: extractParamList(funcDecl.Type.Params), - Returns: returnTypeString(funcDecl.Type.Results), - } - spec.Functions[funcDecl.Name.Name] = fd - } -} - -// extractParamList converts an ast.FieldList into a slice of Param. -// Detects double-pointer params (**T) as output direction. -func extractParamList(fields *ast.FieldList) []specmodel.Param { - if fields == nil { - return nil - } - var params []specmodel.Param - for _, field := range fields.List { - ts := typeString(field.Type) - dir := "" - if isDoublePointer(field.Type) { - dir = "out" - } - - if len(field.Names) == 0 { - // Unnamed parameter. - params = append(params, specmodel.Param{ - Name: "", - Type: ts, - Direction: dir, - }) - continue - } - for _, name := range field.Names { - params = append(params, specmodel.Param{ - Name: name.Name, - Type: ts, - Direction: dir, - }) - } - } - return params -} - -// returnTypeString extracts the return type string from a function's result list. -// Returns empty string for no return or multiple returns. -func returnTypeString(results *ast.FieldList) string { - if results == nil || len(results.List) == 0 { - return "" - } - if len(results.List) == 1 { - return typeString(results.List[0].Type) - } - return "" -} - -// isDoublePointer returns true if expr is **T (StarExpr wrapping StarExpr). -func isDoublePointer(expr ast.Expr) bool { - outer, ok := expr.(*ast.StarExpr) - if !ok { - return false - } - _, ok = outer.X.(*ast.StarExpr) - return ok -} - -// typeString converts an AST type expression to its string representation. -func typeString(expr ast.Expr) string { - switch t := expr.(type) { - case *ast.Ident: - return t.Name - case *ast.StarExpr: - return "*" + typeString(t.X) - case *ast.SelectorExpr: - return typeString(t.X) + "." + t.Sel.Name - case *ast.ArrayType: - if t.Len == nil { - return "[]" + typeString(t.Elt) - } - return "[...]" + typeString(t.Elt) - case *ast.Ellipsis: - return "..." + typeString(t.Elt) - case *ast.MapType: - return "map[" + typeString(t.Key) + "]" + typeString(t.Value) - case *ast.InterfaceType: - return "interface{}" - default: - return fmt.Sprintf("%T", expr) - } -} - -// MergeFunctions adds function definitions from parsed C headers into the spec. -// Only adds functions that are not already present (Go AST extraction takes priority). -func MergeFunctions( - spec *specmodel.Spec, - funcs map[string]specmodel.FuncDef, -) { - if spec.Functions == nil { - spec.Functions = make(map[string]specmodel.FuncDef) - } - - for name, fd := range funcs { - if _, exists := spec.Functions[name]; exists { - continue - } - spec.Functions[name] = fd - } -} - -// MergeStructs adds struct definitions from parsed C headers into the spec. -// Only includes structs whose type name exists in spec.Types. -func MergeStructs( - spec *specmodel.Spec, - structs map[string]specmodel.StructDef, -) { - if spec.Structs == nil { - spec.Structs = make(map[string]specmodel.StructDef) - } - - for name, sd := range structs { - spec.Structs[name] = sd - } -} - -var cgoIncludeRe = regexp.MustCompile(`#include\s+[<"]([^>"]+)[>"]`) - -// ExtractIncludeDirsFromGoFiles scans Go source files for CGo preamble -// #include directives and returns the unique set of parent directories -// resolved under the given sysroot include path. -func ExtractIncludeDirsFromGoFiles( - goFiles []string, - sysrootInclude string, -) ([]string, error) { - seen := make(map[string]struct{}) - var dirs []string - - for _, goFile := range goFiles { - includes, err := extractCGoIncludes(goFile) - if err != nil { - return nil, fmt.Errorf("extract includes from %s: %w", goFile, err) - } - - for _, inc := range includes { - dir := filepath.Dir(inc) - fullDir := filepath.Join(sysrootInclude, dir) - - if _, ok := seen[fullDir]; ok { - continue - } - seen[fullDir] = struct{}{} - - if info, err := os.Stat(fullDir); err == nil && info.IsDir() { - dirs = append(dirs, fullDir) - } - } - } - - return dirs, nil -} - -// extractCGoIncludes reads a Go source file and returns all #include -// directives found in CGo comment preambles. -func extractCGoIncludes(goFile string) ([]string, error) { - f, err := os.Open(goFile) - if err != nil { - return nil, err - } - defer func() { _ = f.Close() }() - - var includes []string - scanner := bufio.NewScanner(f) - inCgo := false - - for scanner.Scan() { - line := scanner.Text() - trimmed := strings.TrimSpace(line) - - // Detect CGo preamble blocks: lines starting with // #include or - // following a // #cgo directive, or lines with #include inside /* */ blocks. - if strings.HasPrefix(trimmed, "// #") || strings.HasPrefix(trimmed, "//#") { - inCgo = true - text := strings.TrimPrefix(trimmed, "//") - text = strings.TrimSpace(text) - if m := cgoIncludeRe.FindStringSubmatch(text); m != nil { - includes = append(includes, m[1]) - } - continue - } - - // Also handle multi-line /* */ CGo comments. - if strings.HasPrefix(trimmed, "/*") { - inCgo = true - } - if inCgo && strings.Contains(trimmed, "*/") { - inCgo = false - } - if inCgo { - if m := cgoIncludeRe.FindStringSubmatch(line); m != nil { - includes = append(includes, m[1]) - } - continue - } - - // CGo preamble ends at a non-comment line. - if inCgo && !strings.HasPrefix(trimmed, "//") { - inCgo = false - } - } - - return includes, scanner.Err() -} diff --git a/tools/pkg/specgen/parser_test.go b/tools/pkg/specgen/parser_test.go deleted file mode 100644 index f51b85d..0000000 --- a/tools/pkg/specgen/parser_test.go +++ /dev/null @@ -1,414 +0,0 @@ -package specgen - -import ( - "go/ast" - "os" - "path/filepath" - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestParseSource(t *testing.T) { - spec, err := ParseSources("fake", "github.com/AndroidGoLab/ndk/capi/fake", []string{ - "testdata/simple/simple.go", - }) - if err != nil { - t.Fatalf("ParseSources: %v", err) - } - - // Module and source package. - if spec.Module != "fake" { - t.Errorf("module = %q, want %q", spec.Module, "fake") - } - if spec.SourcePackage != "github.com/AndroidGoLab/ndk/capi/fake" { - t.Errorf("source_package = %q, want %q", spec.SourcePackage, "github.com/AndroidGoLab/ndk/capi/fake") - } - - // Types: at least 4 (2 opaque + 2 typedef). - if len(spec.Types) < 4 { - t.Fatalf("types count = %d, want >= 4; got: %v", len(spec.Types), spec.Types) - } - - // FakeStream is opaque_ptr. - td, ok := spec.Types["FakeStream"] - require.True(t, ok, "missing type FakeStream") - assert.Equal(t, "opaque_ptr", td.Kind, "FakeStream.Kind") - - // FakeBuilder is opaque_ptr. - td, ok = spec.Types["FakeBuilder"] - require.True(t, ok, "missing type FakeBuilder") - assert.Equal(t, "opaque_ptr", td.Kind, "FakeBuilder.Kind") - - // Fake_result_t is typedef_int32. - td, ok = spec.Types["Fake_result_t"] - require.True(t, ok, "missing type Fake_result_t") - assert.Equal(t, "typedef_int32", td.Kind, "Fake_result_t.Kind") - - // Fake_direction_t is typedef_int32. - td, ok = spec.Types["Fake_direction_t"] - require.True(t, ok, "missing type Fake_direction_t") - assert.Equal(t, "typedef_int32", td.Kind, "Fake_direction_t.Kind") - - // Enums: 2 groups with 2 values each. - if len(spec.Enums) != 2 { - t.Fatalf("enum groups = %d, want 2; got: %v", len(spec.Enums), spec.Enums) - } - - resultEnums := spec.Enums["Fake_result_t"] - if len(resultEnums) != 2 { - t.Fatalf("Fake_result_t enum values = %d, want 2", len(resultEnums)) - } - // Check FAKE_OK = 0. - if resultEnums[0].Name != "FAKE_OK" || resultEnums[0].Value != 0 { - t.Errorf("resultEnums[0] = %+v, want FAKE_OK=0", resultEnums[0]) - } - // Check FAKE_ERROR_BASE = -900 (negative value via UnaryExpr). - if resultEnums[1].Name != "FAKE_ERROR_BASE" || resultEnums[1].Value != -900 { - t.Errorf("resultEnums[1] = %+v, want FAKE_ERROR_BASE=-900", resultEnums[1]) - } - - dirEnums := spec.Enums["Fake_direction_t"] - if len(dirEnums) != 2 { - t.Fatalf("Fake_direction_t enum values = %d, want 2", len(dirEnums)) - } - if dirEnums[0].Name != "FAKE_DIRECTION_OUTPUT" || dirEnums[0].Value != 0 { - t.Errorf("dirEnums[0] = %+v, want FAKE_DIRECTION_OUTPUT=0", dirEnums[0]) - } - if dirEnums[1].Name != "FAKE_DIRECTION_INPUT" || dirEnums[1].Value != 1 { - t.Errorf("dirEnums[1] = %+v, want FAKE_DIRECTION_INPUT=1", dirEnums[1]) - } - - // Functions: at least 7. - if len(spec.Functions) < 7 { - t.Fatalf("functions count = %d, want >= 7; got: %v", len(spec.Functions), spec.Functions) - } - - // Fake_createBuilder: returns Fake_result_t, 1 out param. - fn, ok := spec.Functions["Fake_createBuilder"] - if !ok { - t.Fatal("missing function Fake_createBuilder") - } - if fn.Returns != "Fake_result_t" { - t.Errorf("Fake_createBuilder.Returns = %q, want Fake_result_t", fn.Returns) - } - if len(fn.Params) != 1 { - t.Fatalf("Fake_createBuilder params = %d, want 1", len(fn.Params)) - } - if fn.Params[0].Direction != "out" { - t.Errorf("Fake_createBuilder param direction = %q, want out", fn.Params[0].Direction) - } - if fn.Params[0].Name != "builder" { - t.Errorf("Fake_createBuilder param name = %q, want builder", fn.Params[0].Name) - } - - // FakeBuilder_setDeviceId: no return, 2 params. - fn2, ok := spec.Functions["FakeBuilder_setDeviceId"] - if !ok { - t.Fatal("missing function FakeBuilder_setDeviceId") - } - if fn2.Returns != "" { - t.Errorf("FakeBuilder_setDeviceId.Returns = %q, want empty", fn2.Returns) - } - if len(fn2.Params) != 2 { - t.Fatalf("FakeBuilder_setDeviceId params = %d, want 2", len(fn2.Params)) - } - - // FakeBuilder_openStream: returns Fake_result_t, 2 params, second is out. - fn3, ok := spec.Functions["FakeBuilder_openStream"] - if !ok { - t.Fatal("missing function FakeBuilder_openStream") - } - if fn3.Returns != "Fake_result_t" { - t.Errorf("FakeBuilder_openStream.Returns = %q, want Fake_result_t", fn3.Returns) - } - if len(fn3.Params) != 2 { - t.Fatalf("FakeBuilder_openStream params = %d, want 2", len(fn3.Params)) - } - if fn3.Params[1].Direction != "out" { - t.Errorf("FakeBuilder_openStream param[1].Direction = %q, want out", fn3.Params[1].Direction) - } - - // FakeStream_getSampleRate: returns int32. - fn4, ok := spec.Functions["FakeStream_getSampleRate"] - if !ok { - t.Fatal("missing function FakeStream_getSampleRate") - } - if fn4.Returns != "int32" { - t.Errorf("FakeStream_getSampleRate.Returns = %q, want int32", fn4.Returns) - } - - // Callbacks: FakeStream_dataCallback. - if len(spec.Callbacks) < 1 { - t.Fatalf("callbacks count = %d, want >= 1", len(spec.Callbacks)) - } - cb, ok := spec.Callbacks["FakeStream_dataCallback"] - if !ok { - t.Fatal("missing callback FakeStream_dataCallback") - } - if cb.Returns != "Fake_result_t" { - t.Errorf("FakeStream_dataCallback.Returns = %q, want Fake_result_t", cb.Returns) - } - if len(cb.Params) != 4 { - t.Fatalf("FakeStream_dataCallback params = %d, want 4", len(cb.Params)) - } -} - -func TestClassifyIdent(t *testing.T) { - tests := []struct { - input string - want string - }{ - {"int32", "typedef_int32"}, - {"uint32", "typedef_uint32"}, - {"int64", "typedef_int64"}, - {"uint64", "typedef_uint64"}, - {"int", "typedef_int"}, - {"uint", "typedef_uint"}, - {"int8", "typedef_int8"}, - {"uint8", "typedef_uint8"}, - {"int16", "typedef_int16"}, - {"uint16", "typedef_uint16"}, - {"float32", "typedef_float32"}, - {"float64", "typedef_float64"}, - {"string", ""}, - {"bool", ""}, - {"MyCustomType", ""}, - } - for _, tt := range tests { - got := classifyIdent(tt.input) - if got != tt.want { - t.Errorf("classifyIdent(%q) = %q, want %q", tt.input, got, tt.want) - } - } -} - -func TestTypeString(t *testing.T) { - tests := []struct { - name string - expr ast.Expr - want string - }{ - { - name: "ident", - expr: &ast.Ident{Name: "int32"}, - want: "int32", - }, - { - name: "star", - expr: &ast.StarExpr{X: &ast.Ident{Name: "Foo"}}, - want: "*Foo", - }, - { - name: "double star", - expr: &ast.StarExpr{X: &ast.StarExpr{X: &ast.Ident{Name: "Foo"}}}, - want: "**Foo", - }, - { - name: "selector", - expr: &ast.SelectorExpr{X: &ast.Ident{Name: "unsafe"}, Sel: &ast.Ident{Name: "Pointer"}}, - want: "unsafe.Pointer", - }, - { - name: "slice", - expr: &ast.ArrayType{Elt: &ast.Ident{Name: "byte"}}, - want: "[]byte", - }, - { - name: "map", - expr: &ast.MapType{Key: &ast.Ident{Name: "string"}, Value: &ast.Ident{Name: "int"}}, - want: "map[string]int", - }, - { - name: "interface", - expr: &ast.InterfaceType{Methods: &ast.FieldList{}}, - want: "interface{}", - }, - { - name: "ellipsis", - expr: &ast.Ellipsis{Elt: &ast.Ident{Name: "int"}}, - want: "...int", - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := typeString(tt.expr) - if got != tt.want { - t.Errorf("typeString = %q, want %q", got, tt.want) - } - }) - } -} - -func TestParseSourceEdgeCases(t *testing.T) { - spec, err := ParseSources("edge", "github.com/AndroidGoLab/ndk/capi/edge", []string{ - "testdata/edgecases/edgecases.go", - }) - if err != nil { - t.Fatalf("ParseSources: %v", err) - } - - // No enums from untyped or string const blocks. - if len(spec.Enums) != 0 { - t.Errorf("enums = %v, want empty", spec.Enums) - } - - // Unexported function should not appear. - if _, ok := spec.Functions["unexported"]; ok { - t.Error("unexported function should not be extracted") - } - - // Multi-return function: Returns should be empty (we don't capture multi-return). - if fn, ok := spec.Functions["Edge_multiReturn"]; ok { - if fn.Returns != "" { - t.Errorf("Edge_multiReturn.Returns = %q, want empty", fn.Returns) - } - } else { - t.Error("missing function Edge_multiReturn") - } - - // c-for-go ref-helper (New* prefix) should be filtered. - require.NotContains(t, spec.Functions, "NewFakeStreamRef") - - // Unnamed param function. - if fn, ok := spec.Functions["Edge_unnamedParam"]; ok { - if len(fn.Params) != 1 { - t.Fatalf("Edge_unnamedParam params = %d, want 1", len(fn.Params)) - } - if fn.Params[0].Name != "" { - t.Errorf("Edge_unnamedParam param name = %q, want empty", fn.Params[0].Name) - } - if fn.Params[0].Type != "int32" { - t.Errorf("Edge_unnamedParam param type = %q, want int32", fn.Params[0].Type) - } - } else { - t.Error("missing function Edge_unnamedParam") - } -} - -func TestParseSourcesError(t *testing.T) { - _, err := ParseSources("bad", "pkg", []string{"nonexistent.go"}) - if err == nil { - t.Error("expected error for nonexistent file") - } -} - -func TestEvalConstInt(t *testing.T) { - // Test unsupported expression type. - _, ok := evalConstInt(&ast.Ident{Name: "iota"}) - if ok { - t.Error("expected false for unsupported expression") - } - - // Test non-SUB unary. - _, ok = evalConstInt(&ast.UnaryExpr{ - Op: 17, // some non-SUB op - X: &ast.BasicLit{Kind: 5, Value: "1"}, - }) - if ok { - t.Error("expected false for non-SUB unary") - } -} - -func TestMergeStructs_IncludesAllStructs(t *testing.T) { - spec := specmodel.Spec{ - Types: map[string]specmodel.TypeDef{ - "ACameraDevice_StateCallbacks": { - Kind: "opaque_ptr", - CType: "ACameraDevice_StateCallbacks", - GoType: "*C.ACameraDevice_StateCallbacks", - }, - }, - } - - structs := map[string]specmodel.StructDef{ - "ACameraDevice_StateCallbacks": { - Fields: []specmodel.StructField{ - {Name: "context", Type: "void*"}, - {Name: "onDisconnected", Type: "func_ptr"}, - }, - }, - "UnrelatedStruct": { - Fields: []specmodel.StructField{ - {Name: "x", Type: "int"}, - }, - }, - } - - MergeStructs(&spec, structs) - - require.Len(t, spec.Structs, 2) - require.Contains(t, spec.Structs, "ACameraDevice_StateCallbacks") - require.Contains(t, spec.Structs, "UnrelatedStruct") - assert.Len(t, spec.Structs["ACameraDevice_StateCallbacks"].Fields, 2) -} - -func TestMergeStructs_NilStructsMap(t *testing.T) { - spec := specmodel.Spec{ - Types: map[string]specmodel.TypeDef{ - "Foo": {Kind: "opaque_ptr"}, - }, - } - - structs := map[string]specmodel.StructDef{ - "Foo": {Fields: []specmodel.StructField{{Name: "x", Type: "int"}}}, - } - - MergeStructs(&spec, structs) - - require.NotNil(t, spec.Structs) - require.Contains(t, spec.Structs, "Foo") -} - -func TestMergeStructs_EmptyStructs(t *testing.T) { - spec := specmodel.Spec{ - Types: map[string]specmodel.TypeDef{ - "Foo": {Kind: "opaque_ptr"}, - }, - } - - MergeStructs(&spec, map[string]specmodel.StructDef{}) - - require.NotNil(t, spec.Structs) - assert.Empty(t, spec.Structs) -} - -func TestExtractIncludeDirsFromGoFiles(t *testing.T) { - // Create a temporary sysroot with a header directory. - sysroot := t.TempDir() - cameraDir := filepath.Join(sysroot, "camera") - require.NoError(t, os.MkdirAll(cameraDir, 0o755)) - - // Create a Go file with CGo includes. - goDir := t.TempDir() - goFile := filepath.Join(goDir, "camera.go") - content := `package camera - -// #include -// #include -import "C" -` - require.NoError(t, os.WriteFile(goFile, []byte(content), 0o644)) - - dirs, err := ExtractIncludeDirsFromGoFiles([]string{goFile}, sysroot) - require.NoError(t, err) - - require.Len(t, dirs, 1) - assert.Equal(t, cameraDir, dirs[0]) -} - -func TestExtractIncludeDirsFromGoFiles_NoCGoIncludes(t *testing.T) { - goDir := t.TempDir() - goFile := filepath.Join(goDir, "noop.go") - content := `package noop - -func Noop() {} -` - require.NoError(t, os.WriteFile(goFile, []byte(content), 0o644)) - - dirs, err := ExtractIncludeDirsFromGoFiles([]string{goFile}, "/nonexistent") - require.NoError(t, err) - assert.Empty(t, dirs) -} diff --git a/tools/pkg/specgen/testdata/aaudio/aaudio.go b/tools/pkg/specgen/testdata/aaudio/aaudio.go deleted file mode 100644 index 73b9065..0000000 --- a/tools/pkg/specgen/testdata/aaudio/aaudio.go +++ /dev/null @@ -1,123 +0,0 @@ -// Simulates c-for-go output for Android AAudio. -// This file is parsed at AST level only; it does not compile. -package aaudio - -import "unsafe" - -// Opaque handle types. -type AAudioStreamBuilder C.AAudioStreamBuilder -type AAudioStream C.AAudioStream - -// Integer typedefs. -type Aaudio_result_t int32 -type Aaudio_direction_t int32 -type Aaudio_format_t int32 -type Aaudio_sharing_mode_t int32 -type Aaudio_performance_mode_t int32 -type Aaudio_stream_state_t int32 -type Aaudio_data_callback_result_t int32 - -// Result codes. -const ( - AAUDIO_OK Aaudio_result_t = 0 - AAUDIO_ERROR_BASE Aaudio_result_t = -900 - AAUDIO_ERROR_DISCONNECTED Aaudio_result_t = -899 - AAUDIO_ERROR_ILLEGAL_ARGUMENT Aaudio_result_t = -898 - AAUDIO_ERROR_INTERNAL Aaudio_result_t = -896 - AAUDIO_ERROR_INVALID_STATE Aaudio_result_t = -895 - AAUDIO_ERROR_INVALID_HANDLE Aaudio_result_t = -892 - AAUDIO_ERROR_UNIMPLEMENTED Aaudio_result_t = -890 - AAUDIO_ERROR_UNAVAILABLE Aaudio_result_t = -889 - AAUDIO_ERROR_NO_FREE_HANDLES Aaudio_result_t = -888 - AAUDIO_ERROR_NO_MEMORY Aaudio_result_t = -887 - AAUDIO_ERROR_NULL Aaudio_result_t = -886 - AAUDIO_ERROR_TIMEOUT Aaudio_result_t = -885 - AAUDIO_ERROR_WOULD_BLOCK Aaudio_result_t = -884 - AAUDIO_ERROR_INVALID_FORMAT Aaudio_result_t = -883 - AAUDIO_ERROR_OUT_OF_RANGE Aaudio_result_t = -882 - AAUDIO_ERROR_NO_SERVICE Aaudio_result_t = -881 - AAUDIO_ERROR_INVALID_RATE Aaudio_result_t = -880 -) - -// Direction enum. -const ( - AAUDIO_DIRECTION_OUTPUT Aaudio_direction_t = 0 - AAUDIO_DIRECTION_INPUT Aaudio_direction_t = 1 -) - -// Format enum. -const ( - AAUDIO_FORMAT_INVALID Aaudio_format_t = -1 - AAUDIO_FORMAT_UNSPECIFIED Aaudio_format_t = 0 - AAUDIO_FORMAT_PCM_I16 Aaudio_format_t = 1 - AAUDIO_FORMAT_PCM_FLOAT Aaudio_format_t = 2 -) - -// Sharing mode enum. -const ( - AAUDIO_SHARING_MODE_EXCLUSIVE Aaudio_sharing_mode_t = 0 - AAUDIO_SHARING_MODE_SHARED Aaudio_sharing_mode_t = 1 -) - -// Performance mode enum. -const ( - AAUDIO_PERFORMANCE_MODE_NONE Aaudio_performance_mode_t = 10 - AAUDIO_PERFORMANCE_MODE_POWER_SAVING Aaudio_performance_mode_t = 11 - AAUDIO_PERFORMANCE_MODE_LOW_LATENCY Aaudio_performance_mode_t = 12 -) - -// Stream state enum. -const ( - AAUDIO_STREAM_STATE_UNINITIALIZED Aaudio_stream_state_t = 0 - AAUDIO_STREAM_STATE_UNKNOWN Aaudio_stream_state_t = 1 - AAUDIO_STREAM_STATE_OPEN Aaudio_stream_state_t = 2 - AAUDIO_STREAM_STATE_STARTING Aaudio_stream_state_t = 3 - AAUDIO_STREAM_STATE_STARTED Aaudio_stream_state_t = 4 - AAUDIO_STREAM_STATE_PAUSING Aaudio_stream_state_t = 5 - AAUDIO_STREAM_STATE_PAUSED Aaudio_stream_state_t = 6 - AAUDIO_STREAM_STATE_FLUSHING Aaudio_stream_state_t = 7 - AAUDIO_STREAM_STATE_FLUSHED Aaudio_stream_state_t = 8 - AAUDIO_STREAM_STATE_STOPPING Aaudio_stream_state_t = 9 - AAUDIO_STREAM_STATE_STOPPED Aaudio_stream_state_t = 10 - AAUDIO_STREAM_STATE_CLOSING Aaudio_stream_state_t = 11 - AAUDIO_STREAM_STATE_CLOSED Aaudio_stream_state_t = 12 - AAUDIO_STREAM_STATE_DISCONNECTED Aaudio_stream_state_t = 13 -) - -// Data callback result enum. -const ( - AAUDIO_CALLBACK_RESULT_CONTINUE Aaudio_data_callback_result_t = 0 - AAUDIO_CALLBACK_RESULT_STOP Aaudio_data_callback_result_t = 1 -) - -// Callback type. -type AAudioStream_dataCallback func(stream *AAudioStream, userData unsafe.Pointer, audioData unsafe.Pointer, numFrames int32) Aaudio_data_callback_result_t - -// --- StreamBuilder functions --- -func AAudio_createStreamBuilder(builder **AAudioStreamBuilder) Aaudio_result_t { return 0 } -func AAudioStreamBuilder_setDeviceId(builder *AAudioStreamBuilder, deviceId int32) {} -func AAudioStreamBuilder_setDirection(builder *AAudioStreamBuilder, direction Aaudio_direction_t) {} -func AAudioStreamBuilder_setSharingMode(builder *AAudioStreamBuilder, sharingMode Aaudio_sharing_mode_t) {} -func AAudioStreamBuilder_setPerformanceMode(builder *AAudioStreamBuilder, mode Aaudio_performance_mode_t) {} -func AAudioStreamBuilder_setSampleRate(builder *AAudioStreamBuilder, sampleRate int32) {} -func AAudioStreamBuilder_setChannelCount(builder *AAudioStreamBuilder, channelCount int32) {} -func AAudioStreamBuilder_setFormat(builder *AAudioStreamBuilder, format Aaudio_format_t) {} -func AAudioStreamBuilder_setBufferCapacityInFrames(builder *AAudioStreamBuilder, numFrames int32) {} -func AAudioStreamBuilder_setDataCallback(builder *AAudioStreamBuilder, callback AAudioStream_dataCallback, userData unsafe.Pointer) {} -func AAudioStreamBuilder_openStream(builder *AAudioStreamBuilder, stream **AAudioStream) Aaudio_result_t { return 0 } -func AAudioStreamBuilder_delete(builder *AAudioStreamBuilder) {} - -// --- Stream functions --- -func AAudioStream_close(stream *AAudioStream) Aaudio_result_t { return 0 } -func AAudioStream_getState(stream *AAudioStream) Aaudio_stream_state_t { return 0 } -func AAudioStream_getFramesPerBurst(stream *AAudioStream) int32 { return 0 } -func AAudioStream_getSampleRate(stream *AAudioStream) int32 { return 0 } -func AAudioStream_getChannelCount(stream *AAudioStream) int32 { return 0 } -func AAudioStream_getXRunCount(stream *AAudioStream) int32 { return 0 } -func AAudioStream_requestStart(stream *AAudioStream) Aaudio_result_t { return 0 } -func AAudioStream_requestPause(stream *AAudioStream) Aaudio_result_t { return 0 } -func AAudioStream_requestStop(stream *AAudioStream) Aaudio_result_t { return 0 } -func AAudioStream_requestFlush(stream *AAudioStream) Aaudio_result_t { return 0 } -func AAudioStream_write(stream *AAudioStream, audioData unsafe.Pointer, numFrames int32, timeoutNanos int64) Aaudio_result_t { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/asset/asset.go b/tools/pkg/specgen/testdata/asset/asset.go deleted file mode 100644 index 8e7294f..0000000 --- a/tools/pkg/specgen/testdata/asset/asset.go +++ /dev/null @@ -1,43 +0,0 @@ -// Simulates c-for-go output for Android Asset Manager. -// This file is parsed at AST level only; it does not compile. -package asset - -import "unsafe" - -// Opaque handle types. -type AAssetManager C.AAssetManager -type AAssetDir C.AAssetDir -type AAsset C.AAsset - -// Integer typedefs. -type Asset_mode_t int32 - -// Mode enum. -const ( - AASSET_MODE_UNKNOWN Asset_mode_t = 0 - AASSET_MODE_RANDOM Asset_mode_t = 1 - AASSET_MODE_STREAMING Asset_mode_t = 2 - AASSET_MODE_BUFFER Asset_mode_t = 3 -) - -// --- AssetManager functions --- -func AAssetManager_openDir(mgr *AAssetManager, dirName *byte) *AAssetDir { return nil } -func AAssetManager_open(mgr *AAssetManager, filename *byte, mode int32) *AAsset { return nil } - -// --- AssetDir functions --- -func AAssetDir_getNextFileName(assetDir *AAssetDir) *byte { return nil } -func AAssetDir_rewind(assetDir *AAssetDir) {} -func AAssetDir_close(assetDir *AAssetDir) {} - -// --- Asset functions --- -func AAsset_read(asset *AAsset, buf unsafe.Pointer, count int64) int32 { return 0 } -func AAsset_seek(asset *AAsset, offset int64, whence int32) int64 { return 0 } -func AAsset_close(asset *AAsset) {} -func AAsset_getBuffer(asset *AAsset) unsafe.Pointer { return nil } -func AAsset_getLength(asset *AAsset) int64 { return 0 } -func AAsset_getLength64(asset *AAsset) int64 { return 0 } -func AAsset_getRemainingLength(asset *AAsset) int64 { return 0 } -func AAsset_getRemainingLength64(asset *AAsset) int64 { return 0 } -func AAsset_isAllocated(asset *AAsset) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/binder/binder.go b/tools/pkg/specgen/testdata/binder/binder.go deleted file mode 100644 index 4da9887..0000000 --- a/tools/pkg/specgen/testdata/binder/binder.go +++ /dev/null @@ -1,63 +0,0 @@ -// Simulates c-for-go output for Android Binder. -// This file is parsed at AST level only; it does not compile. -package binder - -import "unsafe" - -// Opaque handle types. -type AIBinder C.AIBinder -type AIBinder_Class C.AIBinder_Class -type AParcel C.AParcel -type AStatus C.AStatus - -// Integer typedefs. -type Binder_status_t int32 - -// Status codes. -const ( - STATUS_OK Binder_status_t = 0 - STATUS_UNKNOWN_ERROR Binder_status_t = -2147483647 - STATUS_NO_MEMORY Binder_status_t = -12 - STATUS_INVALID_OPERATION Binder_status_t = -38 - STATUS_BAD_VALUE Binder_status_t = -22 - STATUS_DEAD_OBJECT Binder_status_t = -32 - STATUS_PERMISSION_DENIED Binder_status_t = -1 - STATUS_NAME_NOT_FOUND Binder_status_t = -2 - STATUS_WOULD_BLOCK Binder_status_t = -11 - STATUS_FDS_NOT_ALLOWED Binder_status_t = -2147483641 -) - -// Callback type. -type AIBinder_Class_onTransact func(binder *AIBinder, code uint32, in *AParcel, out *AParcel) int32 - -// --- Class functions --- -func AIBinder_Class_define(interfaceDescriptor *byte, onCreate unsafe.Pointer, onDestroy unsafe.Pointer, onTransact AIBinder_Class_onTransact) *AIBinder_Class { - return nil -} - -// --- Binder functions --- -func AIBinder_new(clazz *AIBinder_Class, args unsafe.Pointer) *AIBinder { return nil } -func AIBinder_incStrong(binder *AIBinder) {} -func AIBinder_decStrong(binder *AIBinder) {} -func AIBinder_prepareTransaction(binder *AIBinder, in **AParcel) int32 { return 0 } -func AIBinder_transact(binder *AIBinder, code uint32, in **AParcel, out **AParcel, flags uint32) int32 { - return 0 -} -func AIBinder_getUserData(binder *AIBinder) unsafe.Pointer { return nil } - -// --- Parcel functions --- -func AParcel_writeInt32(parcel *AParcel, value int32) int32 { return 0 } -func AParcel_writeString(parcel *AParcel, string *byte, length int32) int32 { return 0 } -func AParcel_readInt32(parcel *AParcel, value *int32) int32 { return 0 } -func AParcel_readString(parcel *AParcel, stringData unsafe.Pointer, allocator unsafe.Pointer) int32 { - return 0 -} -func AParcel_delete(parcel *AParcel) {} - -// --- Status functions --- -func AStatus_newOk() *AStatus { return nil } -func AStatus_delete(status *AStatus) {} -func AStatus_isOk(status *AStatus) bool { return false } -func AStatus_getStatus(status *AStatus) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/bitmap/bitmap.go b/tools/pkg/specgen/testdata/bitmap/bitmap.go deleted file mode 100644 index 75d5efd..0000000 --- a/tools/pkg/specgen/testdata/bitmap/bitmap.go +++ /dev/null @@ -1,25 +0,0 @@ -// Simulates c-for-go output for Android Bitmap (android/bitmap.h, jnigraphics). -// This file is parsed at AST level only; it does not compile. -package bitmap - -// Integer typedefs. -type AndroidBitmap_result_t int32 -type AndroidBitmap_format_t int32 - -// Result codes. -const ( - ANDROID_BITMAP_RESULT_SUCCESS AndroidBitmap_result_t = 0 - ANDROID_BITMAP_RESULT_BAD_PARAMETER AndroidBitmap_result_t = -1 - ANDROID_BITMAP_RESULT_JNI_EXCEPTION AndroidBitmap_result_t = -2 - ANDROID_BITMAP_RESULT_ALLOCATION_FAILED AndroidBitmap_result_t = -3 -) - -// Format constants. -const ( - ANDROID_BITMAP_FORMAT_NONE AndroidBitmap_format_t = 0 - ANDROID_BITMAP_FORMAT_RGBA_8888 AndroidBitmap_format_t = 1 - ANDROID_BITMAP_FORMAT_RGB_565 AndroidBitmap_format_t = 4 - ANDROID_BITMAP_FORMAT_RGBA_4444 AndroidBitmap_format_t = 7 - ANDROID_BITMAP_FORMAT_A_8 AndroidBitmap_format_t = 8 - ANDROID_BITMAP_FORMAT_RGBA_F16 AndroidBitmap_format_t = 9 -) diff --git a/tools/pkg/specgen/testdata/camera/camera.go b/tools/pkg/specgen/testdata/camera/camera.go deleted file mode 100644 index 4224445..0000000 --- a/tools/pkg/specgen/testdata/camera/camera.go +++ /dev/null @@ -1,115 +0,0 @@ -// Simulates c-for-go output for Android Camera2 NDK. -// This file is parsed at AST level only; it does not compile. -package camera - -import "unsafe" - -// Opaque handle types. -type ACameraManager C.ACameraManager -type ACameraDevice C.ACameraDevice -type ACameraCaptureSession C.ACameraCaptureSession -type ACaptureRequest C.ACaptureRequest -type ACameraOutputTarget C.ACameraOutputTarget -type ACaptureSessionOutputContainer C.ACaptureSessionOutputContainer -type ACaptureSessionOutput C.ACaptureSessionOutput -type ACameraMetadata C.ACameraMetadata - -// Integer typedefs. -type Camera_status_t int32 - -// Status codes. -const ( - ACAMERA_OK Camera_status_t = 0 - ACAMERA_ERROR_UNKNOWN Camera_status_t = -10000 - ACAMERA_ERROR_INVALID_PARAMETER Camera_status_t = -10001 - ACAMERA_ERROR_CAMERA_DISCONNECTED Camera_status_t = -10002 - ACAMERA_ERROR_NOT_ENOUGH_MEMORY Camera_status_t = -10003 - ACAMERA_ERROR_METADATA_NOT_FOUND Camera_status_t = -10004 - ACAMERA_ERROR_CAMERA_DEVICE Camera_status_t = -10005 - ACAMERA_ERROR_CAMERA_SERVICE Camera_status_t = -10006 - ACAMERA_ERROR_SESSION_CLOSED Camera_status_t = -10007 - ACAMERA_ERROR_INVALID_OPERATION Camera_status_t = -10008 - ACAMERA_ERROR_STREAM_CONFIGURE_FAIL Camera_status_t = -10009 - ACAMERA_ERROR_CAMERA_IN_USE Camera_status_t = -10010 - ACAMERA_ERROR_MAX_CAMERA_IN_USE Camera_status_t = -10011 - ACAMERA_ERROR_CAMERA_DISABLED Camera_status_t = -10012 - ACAMERA_ERROR_PERMISSION_DENIED Camera_status_t = -10013 -) - -// Template ID enum. -type ACameraDevice_request_template int32 - -const ( - TEMPLATE_PREVIEW ACameraDevice_request_template = 1 - TEMPLATE_STILL_CAPTURE ACameraDevice_request_template = 2 - TEMPLATE_RECORD ACameraDevice_request_template = 3 - TEMPLATE_VIDEO_SNAPSHOT ACameraDevice_request_template = 4 - TEMPLATE_ZERO_SHUTTER_LAG ACameraDevice_request_template = 5 - TEMPLATE_MANUAL ACameraDevice_request_template = 6 -) - -// Camera ID list returned by ACameraManager_getCameraIdList. -type ACameraIdList C.ACameraIdList - -// Callback structs (opaque to the generator). -type ACameraDevice_StateCallbacks C.ACameraDevice_StateCallbacks -type ACameraCaptureSession_stateCallbacks C.ACameraCaptureSession_stateCallbacks -type ACameraCaptureSession_captureCallbacks C.ACameraCaptureSession_captureCallbacks - -// --- CameraManager functions --- -func ACameraManager_create() *ACameraManager { return nil } -func ACameraManager_delete(manager *ACameraManager) {} -func ACameraManager_getCameraIdList(manager *ACameraManager, cameraIdList **ACameraIdList) Camera_status_t { - return 0 -} -func ACameraManager_deleteCameraIdList(list *ACameraIdList) {} -func ACameraManager_openCamera(manager *ACameraManager, cameraId *byte, callbacks *ACameraDevice_StateCallbacks, device **ACameraDevice) Camera_status_t { - return 0 -} - -// --- CameraDevice functions --- -func ACameraDevice_close(device *ACameraDevice) Camera_status_t { return 0 } -func ACameraDevice_createCaptureRequest(device *ACameraDevice, templateId ACameraDevice_request_template, request **ACaptureRequest) Camera_status_t { - return 0 -} -func ACameraDevice_createCaptureSession(device *ACameraDevice, outputs *ACaptureSessionOutputContainer, callbacks *ACameraCaptureSession_stateCallbacks, session **ACameraCaptureSession) Camera_status_t { - return 0 -} - -// --- CaptureRequest functions --- -func ACaptureRequest_free(request *ACaptureRequest) {} -func ACaptureRequest_addTarget(request *ACaptureRequest, target *ACameraOutputTarget) Camera_status_t { return 0 } -func ACaptureRequest_removeTarget(request *ACaptureRequest, target *ACameraOutputTarget) Camera_status_t { return 0 } - -// --- OutputTarget functions --- -func ACameraOutputTarget_create(window unsafe.Pointer, target **ACameraOutputTarget) Camera_status_t { return 0 } -func ACameraOutputTarget_free(target *ACameraOutputTarget) {} - -// --- CaptureSessionOutputContainer functions --- -func ACaptureSessionOutputContainer_create(container **ACaptureSessionOutputContainer) Camera_status_t { return 0 } -func ACaptureSessionOutputContainer_free(container *ACaptureSessionOutputContainer) {} -func ACaptureSessionOutputContainer_add(container *ACaptureSessionOutputContainer, output *ACaptureSessionOutput) Camera_status_t { - return 0 -} -func ACaptureSessionOutputContainer_remove(container *ACaptureSessionOutputContainer, output *ACaptureSessionOutput) Camera_status_t { - return 0 -} - -// --- CaptureSessionOutput functions --- -func ACaptureSessionOutput_create(window unsafe.Pointer, output **ACaptureSessionOutput) Camera_status_t { return 0 } -func ACaptureSessionOutput_free(output *ACaptureSessionOutput) {} - -// --- CameraCaptureSession functions --- -func ACameraCaptureSession_close(session *ACameraCaptureSession) {} -func ACameraCaptureSession_setRepeatingRequest(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_captureCallbacks, numRequests int32, requests **ACaptureRequest, sequenceId *int32) Camera_status_t { - return 0 -} -func ACameraCaptureSession_stopRepeating(session *ACameraCaptureSession) Camera_status_t { return 0 } -func ACameraCaptureSession_capture(session *ACameraCaptureSession, callbacks *ACameraCaptureSession_captureCallbacks, numRequests int32, requests **ACaptureRequest, sequenceId *int32) Camera_status_t { - return 0 -} - -// --- Metadata functions --- -func ACameraMetadata_free(metadata *ACameraMetadata) {} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/choreographer/choreographer.go b/tools/pkg/specgen/testdata/choreographer/choreographer.go deleted file mode 100644 index 60110eb..0000000 --- a/tools/pkg/specgen/testdata/choreographer/choreographer.go +++ /dev/null @@ -1,25 +0,0 @@ -// Simulates c-for-go output for Android AChoreographer. -// This file is parsed at AST level only; it does not compile. -package choreographer - -import "unsafe" - -// Opaque handle types. -type AChoreographer C.AChoreographer - -// Callback types. -type AChoreographer_frameCallback func(frameTimeNanos int64, data unsafe.Pointer) -type AChoreographer_frameCallback64 func(frameTimeNanos int64, data unsafe.Pointer) - -// --- Choreographer functions --- -func AChoreographer_getInstance() *AChoreographer { return nil } -func AChoreographer_postFrameCallback(choreographer *AChoreographer, callback AChoreographer_frameCallback, data unsafe.Pointer) { -} -func AChoreographer_postFrameCallbackDelayed(choreographer *AChoreographer, callback AChoreographer_frameCallback, data unsafe.Pointer, delayMillis int64) { -} -func AChoreographer_postFrameCallback64(choreographer *AChoreographer, callback AChoreographer_frameCallback64, data unsafe.Pointer) { -} -func AChoreographer_postFrameCallbackDelayed64(choreographer *AChoreographer, callback AChoreographer_frameCallback64, data unsafe.Pointer, delayMillis uint32) { -} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/configuration/configuration.go b/tools/pkg/specgen/testdata/configuration/configuration.go deleted file mode 100644 index 45f20f1..0000000 --- a/tools/pkg/specgen/testdata/configuration/configuration.go +++ /dev/null @@ -1,45 +0,0 @@ -// Simulates c-for-go output for Android AConfiguration. -// This file is parsed at AST level only; it does not compile. -package configuration - -import "unsafe" - -// Opaque handle types. -type AConfiguration C.AConfiguration -type AAssetManager C.AAssetManager - -// Integer typedefs. -type Configuration_orientation int32 -type Configuration_screenSize int32 - -// Orientation enum. -const ( - ACONFIGURATION_ORIENTATION_ANY Configuration_orientation = 0 - ACONFIGURATION_ORIENTATION_PORT Configuration_orientation = 1 - ACONFIGURATION_ORIENTATION_LAND Configuration_orientation = 2 - ACONFIGURATION_ORIENTATION_SQUARE Configuration_orientation = 3 -) - -// Screen size enum. -const ( - ACONFIGURATION_SCREENSIZE_ANY Configuration_screenSize = 0 - ACONFIGURATION_SCREENSIZE_SMALL Configuration_screenSize = 1 - ACONFIGURATION_SCREENSIZE_NORMAL Configuration_screenSize = 2 - ACONFIGURATION_SCREENSIZE_LARGE Configuration_screenSize = 3 - ACONFIGURATION_SCREENSIZE_XLARGE Configuration_screenSize = 4 -) - -// --- Configuration functions --- -func AConfiguration_new() *AConfiguration { return nil } -func AConfiguration_delete(config *AConfiguration) {} -func AConfiguration_fromAssetManager(config *AConfiguration, mgr *AAssetManager) {} -func AConfiguration_getLanguage(config *AConfiguration, outLanguage *byte) {} -func AConfiguration_getCountry(config *AConfiguration, outCountry *byte) {} -func AConfiguration_getOrientation(config *AConfiguration) int32 { return 0 } -func AConfiguration_getDensity(config *AConfiguration) int32 { return 0 } -func AConfiguration_getScreenSize(config *AConfiguration) int32 { return 0 } -func AConfiguration_getScreenWidthDp(config *AConfiguration) int32 { return 0 } -func AConfiguration_getScreenHeightDp(config *AConfiguration) int32 { return 0 } -func AConfiguration_getSdkVersion(config *AConfiguration) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/edgecases/edgecases.go b/tools/pkg/specgen/testdata/edgecases/edgecases.go deleted file mode 100644 index 7c737b8..0000000 --- a/tools/pkg/specgen/testdata/edgecases/edgecases.go +++ /dev/null @@ -1,25 +0,0 @@ -package edgecases - -type FakeStream struct{} - -// Untyped const block (should be skipped). -const ( - untypedConst = 42 -) - -// String const (non-integer, should be skipped). -const ( - stringConst = "hello" -) - -// Function with no params and multiple returns (multi-return not captured). -func Edge_multiReturn() (int32, bool) { return 0, false } - -// Unexported function (should be skipped). -func unexported() {} - -// Function with unnamed params. -func Edge_unnamedParam(int32) {} - -// c-for-go ref-helper function (should be filtered). -func NewFakeStreamRef(ref *FakeStream) *FakeStream { return ref } diff --git a/tools/pkg/specgen/testdata/egl/egl.go b/tools/pkg/specgen/testdata/egl/egl.go deleted file mode 100644 index b7be2f2..0000000 --- a/tools/pkg/specgen/testdata/egl/egl.go +++ /dev/null @@ -1,155 +0,0 @@ -// Simulates c-for-go output for EGL (EGL/egl.h and EGL/eglext.h). -// This file is parsed at AST level only; it does not compile. -package egl - -import "unsafe" - -// Opaque handle types — pointer-sized handles, not C struct pointers. -type EGLDisplay unsafe.Pointer -type EGLSurface unsafe.Pointer -type EGLContext unsafe.Pointer -type EGLConfig unsafe.Pointer -type EGLNativeWindowType unsafe.Pointer -type EGLNativeDisplayType unsafe.Pointer - -// Integer typedefs. -type EGLint int32 -type EGLBoolean uint32 - -// Error codes. -const ( - EGL_SUCCESS EGLint = 0x3000 - EGL_NOT_INITIALIZED EGLint = 0x3001 - EGL_BAD_ACCESS EGLint = 0x3002 - EGL_BAD_ALLOC EGLint = 0x3003 - EGL_BAD_ATTRIBUTE EGLint = 0x3004 - EGL_BAD_CONFIG EGLint = 0x3005 - EGL_BAD_CONTEXT EGLint = 0x3006 - EGL_BAD_CURRENT_SURFACE EGLint = 0x3007 - EGL_BAD_DISPLAY EGLint = 0x3008 - EGL_BAD_MATCH EGLint = 0x3009 - EGL_BAD_NATIVE_PIXMAP EGLint = 0x300A - EGL_BAD_NATIVE_WINDOW EGLint = 0x300B - EGL_BAD_PARAMETER EGLint = 0x300C - EGL_BAD_SURFACE EGLint = 0x300D - EGL_CONTEXT_LOST EGLint = 0x300E -) - -// Config attributes. -const ( - EGL_BUFFER_SIZE EGLint = 0x3020 - EGL_ALPHA_SIZE EGLint = 0x3021 - EGL_BLUE_SIZE EGLint = 0x3022 - EGL_GREEN_SIZE EGLint = 0x3023 - EGL_RED_SIZE EGLint = 0x3024 - EGL_DEPTH_SIZE EGLint = 0x3025 - EGL_STENCIL_SIZE EGLint = 0x3026 - EGL_CONFIG_CAVEAT EGLint = 0x3027 - EGL_CONFIG_ID EGLint = 0x3028 - EGL_MAX_PBUFFER_HEIGHT EGLint = 0x302A - EGL_MAX_PBUFFER_PIXELS EGLint = 0x302B - EGL_MAX_PBUFFER_WIDTH EGLint = 0x302C - EGL_NATIVE_RENDERABLE EGLint = 0x302D - EGL_NATIVE_VISUAL_ID EGLint = 0x302E - EGL_NATIVE_VISUAL_TYPE EGLint = 0x302F - EGL_SAMPLES EGLint = 0x3031 - EGL_SAMPLE_BUFFERS EGLint = 0x3032 - EGL_SURFACE_TYPE EGLint = 0x3033 - EGL_RENDERABLE_TYPE EGLint = 0x3040 - EGL_CONFORMANT EGLint = 0x3042 - EGL_NONE EGLint = 0x3038 -) - -// Renderable type bits. -const ( - EGL_OPENGL_ES2_BIT EGLint = 0x0004 - EGL_OPENGL_ES3_BIT EGLint = 0x0040 -) - -// Context attributes. -const ( - EGL_CONTEXT_CLIENT_VERSION EGLint = 0x3098 - EGL_CONTEXT_MAJOR_VERSION EGLint = 0x3098 - EGL_CONTEXT_MINOR_VERSION EGLint = 0x30FB -) - -// Special values. -const ( - EGL_DEFAULT_DISPLAY EGLint = 0 - EGL_NO_DISPLAY EGLint = 0 - EGL_NO_SURFACE EGLint = 0 - EGL_NO_CONTEXT EGLint = 0 - EGL_TRUE EGLint = 1 - EGL_FALSE EGLint = 0 -) - -// Surface type bits. -const ( - EGL_WINDOW_BIT EGLint = 0x0004 - EGL_PBUFFER_BIT EGLint = 0x0001 - EGL_PIXMAP_BIT EGLint = 0x0002 -) - -// Surface query attributes. -const ( - EGL_WIDTH EGLint = 0x3057 - EGL_HEIGHT EGLint = 0x3056 -) - -// --- Display lifecycle --- -func EglGetDisplay(displayId EGLNativeDisplayType) EGLDisplay { return unsafe.Pointer(nil) } -func EglInitialize(display EGLDisplay, major *EGLint, minor *EGLint) EGLBoolean { return 0 } -func EglTerminate(display EGLDisplay) EGLBoolean { return 0 } -func EglGetError() EGLint { return 0 } - -// --- Config functions --- -func EglChooseConfig(display EGLDisplay, attribList *EGLint, configs *EGLConfig, configSize EGLint, numConfig *EGLint) EGLBoolean { - return 0 -} -func EglGetConfigAttrib(display EGLDisplay, config EGLConfig, attribute EGLint, value *EGLint) EGLBoolean { - return 0 -} - -// --- Surface functions --- -func EglCreateWindowSurface(display EGLDisplay, config EGLConfig, win EGLNativeWindowType, attribList *EGLint) EGLSurface { - return unsafe.Pointer(nil) -} -func EglCreatePbufferSurface(display EGLDisplay, config EGLConfig, attribList *EGLint) EGLSurface { - return unsafe.Pointer(nil) -} -func EglDestroySurface(display EGLDisplay, surface EGLSurface) EGLBoolean { return 0 } -func EglQuerySurface(display EGLDisplay, surface EGLSurface, attribute EGLint, value *EGLint) EGLBoolean { - return 0 -} - -// --- Context functions --- -func EglCreateContext(display EGLDisplay, config EGLConfig, shareContext EGLContext, attribList *EGLint) EGLContext { - return unsafe.Pointer(nil) -} -func EglDestroyContext(display EGLDisplay, ctx EGLContext) EGLBoolean { return 0 } -func EglMakeCurrent(display EGLDisplay, draw EGLSurface, read EGLSurface, ctx EGLContext) EGLBoolean { - return 0 -} - -// --- Swap functions --- -func EglSwapBuffers(display EGLDisplay, surface EGLSurface) EGLBoolean { return 0 } -func EglSwapInterval(display EGLDisplay, interval EGLint) EGLBoolean { return 0 } - -// --- Query current state --- -func EglGetCurrentDisplay() EGLDisplay { return unsafe.Pointer(nil) } -func EglGetCurrentSurface(readdraw EGLint) EGLSurface { return unsafe.Pointer(nil) } -func EglGetCurrentContext() EGLContext { return unsafe.Pointer(nil) } - -// --- String query --- -func EglQueryString(display EGLDisplay, name EGLint) *byte { return nil } - -// --- Thread and sync --- -func EglReleaseThread() EGLBoolean { return 0 } -func EglWaitGL() EGLBoolean { return 0 } -func EglWaitNative(engine EGLint) EGLBoolean { return 0 } - -// --- API binding --- -func EglBindAPI(api uint32) EGLBoolean { return 0 } -func EglQueryAPI() uint32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/font/font.go b/tools/pkg/specgen/testdata/font/font.go deleted file mode 100644 index fa34ed1..0000000 --- a/tools/pkg/specgen/testdata/font/font.go +++ /dev/null @@ -1,33 +0,0 @@ -// Simulates c-for-go output for Android Font (android/font.h). -// This file is parsed at AST level only; it does not compile. -package font - -// Opaque handle types. -type AFont C.AFont -type AFontMatcher C.AFontMatcher - -// Integer typedefs. -type Font_weight_t int32 - -// Font weight constants. -const ( - AFONT_WEIGHT_THIN Font_weight_t = 100 - AFONT_WEIGHT_LIGHT Font_weight_t = 300 - AFONT_WEIGHT_NORMAL Font_weight_t = 400 - AFONT_WEIGHT_MEDIUM Font_weight_t = 500 - AFONT_WEIGHT_BOLD Font_weight_t = 700 - AFONT_WEIGHT_BLACK Font_weight_t = 900 -) - -// --- Font functions --- -func AFont_close(font *AFont) {} -func AFont_getWeight(font *AFont) uint16 { return 0 } -func AFont_isItalic(font *AFont) bool { return false } - -// --- FontMatcher functions --- -func AFontMatcher_create() *AFontMatcher { return nil } -func AFontMatcher_destroy(matcher *AFontMatcher) {} -func AFontMatcher_setStyle(matcher *AFontMatcher, weight uint16, italic bool) {} -func AFontMatcher_match(matcher *AFontMatcher, familyName *byte, text *uint16, length uint32, runLengthOut *uint32) *AFont { - return nil -} diff --git a/tools/pkg/specgen/testdata/gles2/gles2.go b/tools/pkg/specgen/testdata/gles2/gles2.go deleted file mode 100644 index 6896ebc..0000000 --- a/tools/pkg/specgen/testdata/gles2/gles2.go +++ /dev/null @@ -1,216 +0,0 @@ -// Simulates c-for-go output for OpenGL ES 2.0. -// This file is parsed at AST level only; it does not compile. -package gles2 - -import "unsafe" - -// Integer typedefs. -type GLenum uint32 -type GLint int32 -type GLuint uint32 -type GLsizei int32 -type GLfloat float32 -type GLboolean uint8 -type GLbitfield uint32 -type GLclampf float32 -type GLsizeiptr int64 -type GLintptr int64 - -// Error code enum. -const ( - GL_NO_ERROR GLenum = 0 - GL_INVALID_ENUM GLenum = 0x0500 - GL_INVALID_VALUE GLenum = 0x0501 - GL_INVALID_OPERATION GLenum = 0x0502 - GL_OUT_OF_MEMORY GLenum = 0x0505 -) - -// Primitive type enum. -const ( - GL_POINTS GLenum = 0x0000 - GL_LINES GLenum = 0x0001 - GL_LINE_STRIP GLenum = 0x0003 - GL_TRIANGLES GLenum = 0x0004 - GL_TRIANGLE_STRIP GLenum = 0x0005 - GL_TRIANGLE_FAN GLenum = 0x0006 -) - -// Buffer target enum. -const ( - GL_ARRAY_BUFFER GLenum = 0x8892 - GL_ELEMENT_ARRAY_BUFFER GLenum = 0x8893 -) - -// Buffer usage enum. -const ( - GL_STREAM_DRAW GLenum = 0x88E0 - GL_STATIC_DRAW GLenum = 0x88E4 - GL_DYNAMIC_DRAW GLenum = 0x88E8 -) - -// Shader type enum. -const ( - GL_FRAGMENT_SHADER GLenum = 0x8B30 - GL_VERTEX_SHADER GLenum = 0x8B31 -) - -// Shader/program status enum. -const ( - GL_COMPILE_STATUS GLenum = 0x8B81 - GL_LINK_STATUS GLenum = 0x8B82 -) - -// Texture target and parameter enum. -const ( - GL_TEXTURE_2D GLenum = 0x0DE1 - GL_TEXTURE0 GLenum = 0x84C0 - GL_TEXTURE_MAG_FILTER GLenum = 0x2800 - GL_TEXTURE_MIN_FILTER GLenum = 0x2801 - GL_TEXTURE_WRAP_S GLenum = 0x2802 - GL_TEXTURE_WRAP_T GLenum = 0x2803 - GL_NEAREST GLenum = 0x2600 - GL_LINEAR GLenum = 0x2601 - GL_CLAMP_TO_EDGE GLenum = 0x812F - GL_REPEAT GLenum = 0x2901 -) - -// Framebuffer and renderbuffer enum. -const ( - GL_FRAMEBUFFER GLenum = 0x8D40 - GL_RENDERBUFFER GLenum = 0x8D41 - GL_FRAMEBUFFER_COMPLETE GLenum = 0x8CD5 -) - -// Clear buffer bits. -const ( - GL_DEPTH_BUFFER_BIT GLbitfield = 0x00000100 - GL_STENCIL_BUFFER_BIT GLbitfield = 0x00000400 - GL_COLOR_BUFFER_BIT GLbitfield = 0x00004000 -) - -// Capability enum. -const ( - GL_DEPTH_TEST GLenum = 0x0B71 - GL_STENCIL_TEST GLenum = 0x0B90 - GL_SCISSOR_TEST GLenum = 0x0C11 - GL_BLEND GLenum = 0x0BE2 - GL_CULL_FACE GLenum = 0x0B44 -) - -// Pixel format enum. -const ( - GL_RGB GLenum = 0x1907 - GL_RGBA GLenum = 0x1908 -) - -// Data type enum. -const ( - GL_UNSIGNED_BYTE GLenum = 0x1401 - GL_UNSIGNED_SHORT GLenum = 0x1403 - GL_FLOAT GLenum = 0x1406 -) - -// Boolean enum. -const ( - GL_FALSE GLboolean = 0 - GL_TRUE GLboolean = 1 -) - -// Blend factor enum. -const ( - GL_ZERO GLenum = 0 - GL_ONE GLenum = 1 - GL_SRC_ALPHA GLenum = 0x0302 - GL_ONE_MINUS_SRC_ALPHA GLenum = 0x0303 -) - -// --- State functions --- -func GlClearColor(red GLclampf, green GLclampf, blue GLclampf, alpha GLclampf) {} -func GlClear(mask GLbitfield) {} -func GlEnable(cap GLenum) {} -func GlDisable(cap GLenum) {} -func GlViewport(x GLint, y GLint, width GLsizei, height GLsizei) {} -func GlScissor(x GLint, y GLint, width GLsizei, height GLsizei) {} - -// --- Shader functions --- -func GlCreateShader(shaderType GLenum) GLuint { return 0 } -func GlDeleteShader(shader GLuint) {} -func GlShaderSource(shader GLuint, count GLsizei, str **byte, length *GLint) {} -func GlCompileShader(shader GLuint) {} -func GlGetShaderiv(shader GLuint, pname GLenum, params *GLint) {} - -// --- Program functions --- -func GlCreateProgram() GLuint { return 0 } -func GlDeleteProgram(program GLuint) {} -func GlAttachShader(program GLuint, shader GLuint) {} -func GlLinkProgram(program GLuint) {} -func GlUseProgram(program GLuint) {} -func GlGetProgramiv(program GLuint, pname GLenum, params *GLint) {} - -// --- Uniform functions --- -func GlGetUniformLocation(program GLuint, name *byte) GLint { return 0 } -func GlUniform1f(location GLint, v0 GLfloat) {} -func GlUniform1i(location GLint, v0 GLint) {} -func GlUniform4fv(location GLint, count GLsizei, value *GLfloat) {} -func GlUniformMatrix4fv(location GLint, count GLsizei, transpose GLboolean, value *GLfloat) {} - -// --- Vertex attribute functions --- -func GlGetAttribLocation(program GLuint, name *byte) GLint { return 0 } -func GlEnableVertexAttribArray(index GLuint) {} -func GlDisableVertexAttribArray(index GLuint) {} -func GlVertexAttribPointer(index GLuint, size GLint, xtype GLenum, normalized GLboolean, stride GLsizei, pointer unsafe.Pointer) {} - -// --- Buffer functions --- -func GlGenBuffers(n GLsizei, buffers *GLuint) {} -func GlDeleteBuffers(n GLsizei, buffers *GLuint) {} -func GlBindBuffer(target GLenum, buffer GLuint) {} -func GlBufferData(target GLenum, size GLsizeiptr, data unsafe.Pointer, usage GLenum) {} -func GlBufferSubData(target GLenum, offset GLintptr, size GLsizeiptr, data unsafe.Pointer) {} - -// --- Texture functions --- -func GlGenTextures(n GLsizei, textures *GLuint) {} -func GlDeleteTextures(n GLsizei, textures *GLuint) {} -func GlBindTexture(target GLenum, texture GLuint) {} -func GlTexImage2D(target GLenum, level GLint, internalformat GLint, width GLsizei, height GLsizei, border GLint, format GLenum, xtype GLenum, pixels unsafe.Pointer) {} -func GlTexParameteri(target GLenum, pname GLenum, param GLint) {} -func GlActiveTexture(texture GLenum) {} - -// --- Draw functions --- -func GlDrawArrays(mode GLenum, first GLint, count GLsizei) {} -func GlDrawElements(mode GLenum, count GLsizei, xtype GLenum, indices unsafe.Pointer) {} - -// --- Framebuffer functions --- -func GlGenFramebuffers(n GLsizei, framebuffers *GLuint) {} -func GlDeleteFramebuffers(n GLsizei, framebuffers *GLuint) {} -func GlBindFramebuffer(target GLenum, framebuffer GLuint) {} -func GlFramebufferTexture2D(target GLenum, attachment GLenum, textarget GLenum, texture GLuint, level GLint) {} -func GlCheckFramebufferStatus(target GLenum) GLenum { return 0 } - -// --- Renderbuffer functions --- -func GlGenRenderbuffers(n GLsizei, renderbuffers *GLuint) {} -func GlDeleteRenderbuffers(n GLsizei, renderbuffers *GLuint) {} -func GlBindRenderbuffer(target GLenum, renderbuffer GLuint) {} -func GlRenderbufferStorage(target GLenum, internalformat GLenum, width GLsizei, height GLsizei) {} -func GlFramebufferRenderbuffer(target GLenum, attachment GLenum, renderbuffertarget GLenum, renderbuffer GLuint) {} - -// --- Query functions --- -func GlGetError() GLenum { return 0 } -func GlGetString(name GLenum) *byte { return nil } -func GlGetIntegerv(pname GLenum, data *GLint) {} -func GlFlush() {} -func GlFinish() {} - -// --- Blending and depth functions --- -func GlBlendFunc(sfactor GLenum, dfactor GLenum) {} -func GlBlendFuncSeparate(srcRGB GLenum, dstRGB GLenum, srcAlpha GLenum, dstAlpha GLenum) {} -func GlDepthFunc(fn GLenum) {} -func GlDepthMask(flag GLboolean) {} -func GlStencilFunc(fn GLenum, ref GLint, mask GLuint) {} -func GlStencilOp(fail GLenum, zfail GLenum, zpass GLenum) {} - -// --- Pixel functions --- -func GlPixelStorei(pname GLenum, param GLint) {} -func GlReadPixels(x GLint, y GLint, width GLsizei, height GLsizei, format GLenum, xtype GLenum, pixels unsafe.Pointer) {} -func GlLineWidth(width GLfloat) {} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/gles3/gles3.go b/tools/pkg/specgen/testdata/gles3/gles3.go deleted file mode 100644 index cf0fde8..0000000 --- a/tools/pkg/specgen/testdata/gles3/gles3.go +++ /dev/null @@ -1,161 +0,0 @@ -// Simulates c-for-go output for OpenGL ES 3.0 (additions beyond ES 2.0). -// This file is parsed at AST level only; it does not compile. -package gles3 - -import "unsafe" - -// Integer typedefs (GL types). -type GLenum uint32 -type GLint int32 -type GLuint uint32 -type GLsizei int32 -type GLfloat float32 -type GLsizeiptr int64 -type GLintptr int64 -type GLbitfield uint32 -type GLboolean uint8 -type GLsync unsafe.Pointer - -// Buffer target and framebuffer enum. -const ( - GL_READ_BUFFER GLenum = 0x0C02 - GL_DRAW_BUFFER GLenum = 0x0C01 - GL_READ_FRAMEBUFFER GLenum = 0x8CA8 - GL_DRAW_FRAMEBUFFER GLenum = 0x8CA9 - GL_COLOR_ATTACHMENT0 GLenum = 0x8CE0 - GL_DEPTH_ATTACHMENT GLenum = 0x8D00 - GL_STENCIL_ATTACHMENT GLenum = 0x8D20 - GL_FRAMEBUFFER_DEFAULT GLenum = 0x8218 -) - -// Buffer mapping bits enum. -const ( - GL_MAP_READ_BIT GLbitfield = 0x0001 - GL_MAP_WRITE_BIT GLbitfield = 0x0002 - GL_MAP_INVALIDATE_RANGE_BIT GLbitfield = 0x0004 - GL_MAP_INVALIDATE_BUFFER_BIT GLbitfield = 0x0008 - GL_MAP_FLUSH_EXPLICIT_BIT GLbitfield = 0x0010 - GL_MAP_UNSYNCHRONIZED_BIT GLbitfield = 0x0020 -) - -// Buffer binding target enum. -const ( - GL_UNIFORM_BUFFER GLenum = 0x8A11 - GL_TRANSFORM_FEEDBACK_BUFFER GLenum = 0x8C8E - GL_PIXEL_PACK_BUFFER GLenum = 0x88EB - GL_PIXEL_UNPACK_BUFFER GLenum = 0x88EC - GL_COPY_READ_BUFFER GLenum = 0x8F36 - GL_COPY_WRITE_BUFFER GLenum = 0x8F37 -) - -// Texture target and format enum. -const ( - GL_TEXTURE_3D GLenum = 0x806F - GL_TEXTURE_2D_ARRAY GLenum = 0x8C1A - GL_TEXTURE_WRAP_R GLenum = 0x8072 - GL_R8 GLenum = 0x8229 - GL_RG8 GLenum = 0x822B - GL_RGB8 GLenum = 0x8051 - GL_RGBA8 GLenum = 0x8058 - GL_R16F GLenum = 0x822D - GL_RG16F GLenum = 0x822F - GL_RGBA16F GLenum = 0x881A - GL_R32F GLenum = 0x822E - GL_RG32F GLenum = 0x8230 - GL_RGBA32F GLenum = 0x8814 -) - -// Vertex array binding enum. -const ( - GL_VERTEX_ARRAY_BINDING GLenum = 0x85B5 -) - -// Sync enum. -const ( - GL_SYNC_GPU_COMMANDS_COMPLETE GLenum = 0x9117 - GL_ALREADY_SIGNALED GLenum = 0x911A - GL_TIMEOUT_EXPIRED GLenum = 0x911B - GL_CONDITION_SATISFIED GLenum = 0x911C - GL_WAIT_FAILED GLenum = 0x911D - GL_SYNC_FLUSH_COMMANDS_BIT GLbitfield = 0x00000001 - GL_TIMEOUT_IGNORED int64 = -1 -) - -// Transform feedback and query enum. -const ( - GL_TRANSFORM_FEEDBACK GLenum = 0x8E22 - GL_ANY_SAMPLES_PASSED GLenum = 0x8C2F - GL_SAMPLER_BINDING GLenum = 0x8919 -) - -// --- Vertex array object functions --- -func GlGenVertexArrays(n GLsizei, arrays *GLuint) {} -func GlDeleteVertexArrays(n GLsizei, arrays *GLuint) {} -func GlBindVertexArray(array GLuint) {} - -// --- Buffer mapping functions --- -func GlMapBufferRange(target GLenum, offset GLintptr, length GLsizeiptr, access GLbitfield) unsafe.Pointer { return nil } -func GlUnmapBuffer(target GLenum) GLboolean { return 0 } -func GlFlushMappedBufferRange(target GLenum, offset GLintptr, length GLsizeiptr) {} - -// --- Framebuffer functions --- -func GlBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1 GLint, mask GLbitfield, filter GLenum) {} -func GlRenderbufferStorageMultisample(target GLenum, samples GLsizei, internalformat GLenum, width, height GLsizei) {} -func GlFramebufferTextureLayer(target, attachment GLenum, texture GLuint, level GLint, layer GLint) {} -func GlInvalidateFramebuffer(target GLenum, numAttachments GLsizei, attachments *GLenum) {} - -// --- Buffer binding functions --- -func GlBindBufferBase(target GLenum, index GLuint, buffer GLuint) {} -func GlBindBufferRange(target GLenum, index GLuint, buffer GLuint, offset GLintptr, size GLsizeiptr) {} -func GlCopyBufferSubData(readTarget, writeTarget GLenum, readOffset, writeOffset GLintptr, size GLsizeiptr) {} - -// --- Transform feedback functions --- -func GlBeginTransformFeedback(primitiveMode GLenum) {} -func GlEndTransformFeedback() {} -func GlTransformFeedbackVaryings(program GLuint, count GLsizei, varyings **byte, bufferMode GLenum) {} -func GlGenTransformFeedbacks(n GLsizei, ids *GLuint) {} -func GlDeleteTransformFeedbacks(n GLsizei, ids *GLuint) {} -func GlBindTransformFeedback(target GLenum, id GLuint) {} - -// --- Sync functions --- -func GlFenceSync(condition GLenum, flags GLbitfield) GLsync { return nil } -func GlDeleteSync(sync GLsync) {} -func GlClientWaitSync(sync GLsync, flags GLbitfield, timeout uint64) GLenum { return 0 } -func GlWaitSync(sync GLsync, flags GLbitfield, timeout uint64) {} - -// --- Sampler functions --- -func GlGenSamplers(count GLsizei, samplers *GLuint) {} -func GlDeleteSamplers(count GLsizei, samplers *GLuint) {} -func GlBindSampler(unit GLuint, sampler GLuint) {} -func GlSamplerParameteri(sampler GLuint, pname GLenum, param GLint) {} - -// --- Query functions --- -func GlBeginQuery(target GLenum, id GLuint) {} -func GlEndQuery(target GLenum) {} -func GlGenQueries(n GLsizei, ids *GLuint) {} -func GlDeleteQueries(n GLsizei, ids *GLuint) {} -func GlGetQueryObjectuiv(id GLuint, pname GLenum, params *GLuint) {} - -// --- Texture functions --- -func GlTexStorage2D(target GLenum, levels GLsizei, internalformat GLenum, width, height GLsizei) {} -func GlTexStorage3D(target GLenum, levels GLsizei, internalformat GLenum, width, height, depth GLsizei) {} -func GlTexSubImage3D(target GLenum, level GLint, xoffset, yoffset, zoffset GLint, width, height, depth GLsizei, format, typ GLenum, pixels unsafe.Pointer) {} - -// --- Draw functions --- -func GlDrawArraysInstanced(mode GLenum, first GLint, count GLsizei, instancecount GLsizei) {} -func GlDrawElementsInstanced(mode GLenum, count GLsizei, typ GLenum, indices unsafe.Pointer, instancecount GLsizei) {} -func GlDrawRangeElements(mode GLenum, start, end GLuint, count GLsizei, typ GLenum, indices unsafe.Pointer) {} - -// --- Clear functions --- -func GlClearBufferfv(buffer GLenum, drawbuffer GLint, value *GLfloat) {} -func GlClearBufferiv(buffer GLenum, drawbuffer GLint, value *GLint) {} -func GlClearBufferfi(buffer GLenum, drawbuffer GLint, depth GLfloat, stencil GLint) {} - -// --- Read/Draw buffer functions --- -func GlReadBuffer(src GLenum) {} -func GlDrawBuffers(n GLsizei, bufs *GLenum) {} - -// --- String query functions --- -func GlGetStringi(name GLenum, index GLuint) *byte { return nil } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/hardwarebuffer/hardwarebuffer.go b/tools/pkg/specgen/testdata/hardwarebuffer/hardwarebuffer.go deleted file mode 100644 index 41536df..0000000 --- a/tools/pkg/specgen/testdata/hardwarebuffer/hardwarebuffer.go +++ /dev/null @@ -1,44 +0,0 @@ -// Simulates c-for-go output for Android HardwareBuffer. -// This file is parsed at AST level only; it does not compile. -package hardwarebuffer - -import "unsafe" - -// Opaque handle type. -type AHardwareBuffer C.AHardwareBuffer - -// Struct type for buffer description. -type AHardwareBuffer_Desc C.AHardwareBuffer_Desc - -// Integer typedefs. -type HardwareBuffer_format_t int32 -type HardwareBuffer_usage_t uint64 - -// Format enum. -const ( - AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM HardwareBuffer_format_t = 1 - AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM HardwareBuffer_format_t = 2 - AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM HardwareBuffer_format_t = 3 - AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM HardwareBuffer_format_t = 4 - AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT HardwareBuffer_format_t = 0x16 - AHARDWAREBUFFER_FORMAT_BLOB HardwareBuffer_format_t = 0x21 -) - -// Usage enum. -const ( - AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE HardwareBuffer_usage_t = 0x100 - AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT HardwareBuffer_usage_t = 0x200 - AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN HardwareBuffer_usage_t = 3 - AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN HardwareBuffer_usage_t = 0x30 -) - -// --- HardwareBuffer functions --- -func AHardwareBuffer_allocate(desc *AHardwareBuffer_Desc, outBuffer **AHardwareBuffer) int32 { return 0 } -func AHardwareBuffer_release(buffer *AHardwareBuffer) {} -func AHardwareBuffer_acquire(buffer *AHardwareBuffer) {} -func AHardwareBuffer_describe(buffer *AHardwareBuffer, outDesc *AHardwareBuffer_Desc) {} -func AHardwareBuffer_lock(buffer *AHardwareBuffer, usage uint64, fence int32, rect unsafe.Pointer, outVirtualAddress *unsafe.Pointer) int32 { return 0 } -func AHardwareBuffer_unlock(buffer *AHardwareBuffer, fence *int32) int32 { return 0 } -func AHardwareBuffer_isSupported(desc *AHardwareBuffer_Desc) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/headers/NdkCameraDevice.h b/tools/pkg/specgen/testdata/headers/NdkCameraDevice.h deleted file mode 100644 index 857ac0d..0000000 --- a/tools/pkg/specgen/testdata/headers/NdkCameraDevice.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - */ - -#ifndef _NDK_CAMERA_DEVICE_H -#define _NDK_CAMERA_DEVICE_H - -#include - -__BEGIN_DECLS - -/** - * ACameraDevice is opaque type that provides access to a camera device. - */ -typedef struct ACameraDevice ACameraDevice; - -/** - * Camera device state callbacks to be used in {@link ACameraDevice_StateCallbacks}. - * - * @param context The optional application context provided by the user when - * the callbacks were registered. - * @param device The {@link ACameraDevice} that is being disconnected. - */ -typedef void (*ACameraDevice_StateCallback)(void* context, ACameraDevice* device); - -/** - * Camera device error state callbacks to be used in {@link ACameraDevice_StateCallbacks}. - * - * @param context The optional application context provided by the user when - * the callbacks were registered. - * @param device The {@link ACameraDevice} that is in error state. - * @param error The error code associated with this error state. - * One of {@link ERROR_CAMERA_IN_USE}, {@link ERROR_MAX_CAMERAS_IN_USE}, - * {@link ERROR_CAMERA_DISABLED}, {@link ERROR_CAMERA_DEVICE}, - * {@link ERROR_CAMERA_SERVICE}. - */ -typedef void (*ACameraDevice_ErrorStateCallback)(void* context, ACameraDevice* device, int error); - -/** - * A set of callbacks for monitoring events on camera device. - * - *

When a callback is invoked, the calling code should return as quickly as possible - * and avoid blocking or running expensive operations.

- */ -typedef struct ACameraDevice_StateCallbacks { - /// optional application context. - void* context; - - /** - * Called when a camera device is no longer available for use. - * - *

Any attempt to call API methods on this ACameraDevice will return - * {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}. The disconnection could be - * due to a change in security policy or permissions.

- */ - ACameraDevice_StateCallback onDisconnected; - - /** - * Called when a camera device has encountered a serious error. - * - *

This callback indicates that the device can no longer be used.

- */ - ACameraDevice_ErrorStateCallback onError; -} ACameraDevice_StateCallbacks; - -/** - * ACameraIdList represents a list of camera device Ids. - */ -typedef struct ACameraIdList { - int numCameras; ///< Number of camera device Ids - const char** cameraIds; ///< list of camera device Ids -} ACameraIdList; - -__END_DECLS - -#endif /* _NDK_CAMERA_DEVICE_H */ diff --git a/tools/pkg/specgen/testdata/headers/native_activity.h b/tools/pkg/specgen/testdata/headers/native_activity.h deleted file mode 100644 index d1c0af8..0000000 --- a/tools/pkg/specgen/testdata/headers/native_activity.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - */ - -#ifndef ANDROID_NATIVE_ACTIVITY_H -#define ANDROID_NATIVE_ACTIVITY_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct ANativeActivity; -struct ANativeWindow; - -/** - * These are the callbacks the framework makes into a native application. - * All of these callbacks happen on the main thread of the application. - * By default, all callbacks are NULL; set to a function pointer to have - * them called. - */ -typedef struct ANativeActivityCallbacks { - /** - * NativeActivity has started. See Java documentation for Activity.onStart() - * for more information. - */ - void (*onStart)(ANativeActivity* activity); - - /** - * The framework is asking NativeActivity to save its current instance state. - * See Java documentation for Activity.onSaveInstanceState() for more - * information. The returned pointer needs to be created with malloc(); - * the framework will call free() on it for you. You also must fill in - * outSize with the number of bytes in the allocation. Note that the - * saved state will be persisted, so it can not contain any active - * entities (pointers to memory, file descriptors, etc). - */ - void* (*onSaveInstanceState)(ANativeActivity* activity, size_t* outSize); - - /** - * NativeActivity window focus has changed. - */ - void (*onWindowFocusChanged)(ANativeActivity* activity, int hasFocus); - - /** - * The drawing window for this native activity has been created. You - * can use the given native window object to start drawing. - */ - void (*onNativeWindowCreated)(ANativeActivity* activity, ANativeWindow* window); - - /** - * The rectangle in the window in which content should be placed has changed. - */ - void (*onContentRectChanged)(ANativeActivity* activity, const ARect* rect); -} ANativeActivityCallbacks; - -#ifdef __cplusplus -} -#endif - -#endif // ANDROID_NATIVE_ACTIVITY_H diff --git a/tools/pkg/specgen/testdata/hint/hint.go b/tools/pkg/specgen/testdata/hint/hint.go deleted file mode 100644 index 496b44a..0000000 --- a/tools/pkg/specgen/testdata/hint/hint.go +++ /dev/null @@ -1,21 +0,0 @@ -// Simulates c-for-go output for Android performance hint API. -// This file is parsed at AST level only; it does not compile. -package hint - -import "unsafe" - -// Opaque handle types. -type APerformanceHintManager C.APerformanceHintManager -type APerformanceHintSession C.APerformanceHintSession - -// --- Manager functions --- -func APerformanceHint_getManager() *APerformanceHintManager { return nil } -func APerformanceHint_createSession(manager *APerformanceHintManager, tids *int32, size int32, initialTargetWorkDurationNanos int64) *APerformanceHintSession { return nil } -func APerformanceHint_getPreferredUpdateRateNanos(manager *APerformanceHintManager) int64 { return 0 } - -// --- Session functions --- -func APerformanceHint_updateTargetWorkDuration(session *APerformanceHintSession, targetDurationNanos int64) int32 { return 0 } -func APerformanceHint_reportActualWorkDuration(session *APerformanceHintSession, actualDurationNanos int64) int32 { return 0 } -func APerformanceHint_closeSession(session *APerformanceHintSession) {} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/imagedecoder/imagedecoder.go b/tools/pkg/specgen/testdata/imagedecoder/imagedecoder.go deleted file mode 100644 index 8a7cf97..0000000 --- a/tools/pkg/specgen/testdata/imagedecoder/imagedecoder.go +++ /dev/null @@ -1,44 +0,0 @@ -// Simulates c-for-go output for Android ImageDecoder (android/imagedecoder.h). -// This file is parsed at AST level only; it does not compile. -package imagedecoder - -import "unsafe" - -// Opaque handle types. -type AImageDecoder C.AImageDecoder -type AImageDecoderHeaderInfo C.AImageDecoderHeaderInfo - -// Integer typedefs. -type ImageDecoder_result_t int32 - -// Result codes. -const ( - ANDROID_IMAGE_DECODER_SUCCESS ImageDecoder_result_t = 0 - ANDROID_IMAGE_DECODER_INCOMPLETE ImageDecoder_result_t = -1 - ANDROID_IMAGE_DECODER_ERROR ImageDecoder_result_t = -2 - ANDROID_IMAGE_DECODER_INVALID_CONVERSION ImageDecoder_result_t = -3 - ANDROID_IMAGE_DECODER_INVALID_SCALE ImageDecoder_result_t = -4 - ANDROID_IMAGE_DECODER_BAD_PARAMETER ImageDecoder_result_t = -5 - ANDROID_IMAGE_DECODER_INVALID_INPUT ImageDecoder_result_t = -6 - ANDROID_IMAGE_DECODER_SEEK_ERROR ImageDecoder_result_t = -7 - ANDROID_IMAGE_DECODER_INTERNAL_ERROR ImageDecoder_result_t = -8 - ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT ImageDecoder_result_t = -9 - ANDROID_IMAGE_DECODER_FINISHED ImageDecoder_result_t = -10 - ANDROID_IMAGE_DECODER_INVALID_STATE ImageDecoder_result_t = -11 -) - -// --- Decoder functions --- -func AImageDecoder_createFromFd(fd int32, outDecoder **AImageDecoder) int32 { return 0 } -func AImageDecoder_createFromBuffer(buffer unsafe.Pointer, length int64, outDecoder **AImageDecoder) int32 { return 0 } -func AImageDecoder_delete(decoder *AImageDecoder) {} -func AImageDecoder_setTargetSize(decoder *AImageDecoder, width int32, height int32) int32 { return 0 } -func AImageDecoder_getHeaderInfo(decoder *AImageDecoder) *AImageDecoderHeaderInfo { return nil } -func AImageDecoder_getMinimumStride(decoder *AImageDecoder) int32 { return 0 } -func AImageDecoder_decodeImage(decoder *AImageDecoder, pixels unsafe.Pointer, stride int64, size int64) int32 { return 0 } - -// --- HeaderInfo functions --- -func AImageDecoderHeaderInfo_getWidth(info *AImageDecoderHeaderInfo) int32 { return 0 } -func AImageDecoderHeaderInfo_getHeight(info *AImageDecoderHeaderInfo) int32 { return 0 } -func AImageDecoderHeaderInfo_getMimeType(info *AImageDecoderHeaderInfo) *byte { return nil } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/input/input.go b/tools/pkg/specgen/testdata/input/input.go deleted file mode 100644 index 0b8dbc2..0000000 --- a/tools/pkg/specgen/testdata/input/input.go +++ /dev/null @@ -1,66 +0,0 @@ -// Simulates c-for-go output for Android Input. -// This file is parsed at AST level only; it does not compile. -package input - -import "unsafe" - -// Opaque handle types. -type AInputEvent C.AInputEvent -type AInputQueue C.AInputQueue - -// Integer typedefs. -type Input_event_type_t int32 -type Key_action_t int32 -type Motion_action_t int32 -type Key_source_t int32 - -// Event type enum. -const ( - AINPUT_EVENT_TYPE_KEY Input_event_type_t = 1 - AINPUT_EVENT_TYPE_MOTION Input_event_type_t = 2 -) - -// Key action enum. -const ( - AKEY_EVENT_ACTION_DOWN Key_action_t = 0 - AKEY_EVENT_ACTION_UP Key_action_t = 1 - AKEY_EVENT_ACTION_MULTIPLE Key_action_t = 2 -) - -// Motion action enum. -const ( - AMOTION_EVENT_ACTION_DOWN Motion_action_t = 0 - AMOTION_EVENT_ACTION_UP Motion_action_t = 1 - AMOTION_EVENT_ACTION_MOVE Motion_action_t = 2 - AMOTION_EVENT_ACTION_CANCEL Motion_action_t = 3 - AMOTION_EVENT_ACTION_POINTER_DOWN Motion_action_t = 5 - AMOTION_EVENT_ACTION_POINTER_UP Motion_action_t = 6 -) - -// Input source enum. -const ( - AINPUT_SOURCE_KEYBOARD Key_source_t = 257 - AINPUT_SOURCE_TOUCHSCREEN Key_source_t = 4098 - AINPUT_SOURCE_MOUSE Key_source_t = 8194 - AINPUT_SOURCE_JOYSTICK Key_source_t = 16777232 -) - -// --- Input event functions --- -func AInputEvent_getType(event *AInputEvent) int32 { return 0 } -func AInputEvent_getSource(event *AInputEvent) int32 { return 0 } -func AKeyEvent_getAction(event *AInputEvent) int32 { return 0 } -func AKeyEvent_getKeyCode(event *AInputEvent) int32 { return 0 } -func AKeyEvent_getRepeatCount(event *AInputEvent) int32 { return 0 } -func AMotionEvent_getAction(event *AInputEvent) int32 { return 0 } -func AMotionEvent_getPointerCount(event *AInputEvent) int32 { return 0 } -func AMotionEvent_getX(event *AInputEvent, pointerIndex int64) float32 { return 0 } -func AMotionEvent_getY(event *AInputEvent, pointerIndex int64) float32 { return 0 } -func AMotionEvent_getPressure(event *AInputEvent, pointerIndex int64) float32 { return 0 } - -// --- Input queue functions --- -func AInputQueue_detachLooper(queue *AInputQueue) {} -func AInputQueue_hasEvents(queue *AInputQueue) int32 { return 0 } -func AInputQueue_getEvent(queue *AInputQueue, outEvent **AInputEvent) int32 { return 0 } -func AInputQueue_finishEvent(queue *AInputQueue, event *AInputEvent, handled int32) {} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/logging/logging.go b/tools/pkg/specgen/testdata/logging/logging.go deleted file mode 100644 index 7b48a0c..0000000 --- a/tools/pkg/specgen/testdata/logging/logging.go +++ /dev/null @@ -1,22 +0,0 @@ -// Simulates c-for-go output for Android logging. -// This file is parsed at AST level only; it does not compile. -package logging - -// Log priority enum. -type Android_LogPriority int32 - -const ( - ANDROID_LOG_UNKNOWN Android_LogPriority = 0 - ANDROID_LOG_DEFAULT Android_LogPriority = 1 - ANDROID_LOG_VERBOSE Android_LogPriority = 2 - ANDROID_LOG_DEBUG Android_LogPriority = 3 - ANDROID_LOG_INFO Android_LogPriority = 4 - ANDROID_LOG_WARN Android_LogPriority = 5 - ANDROID_LOG_ERROR Android_LogPriority = 6 - ANDROID_LOG_FATAL Android_LogPriority = 7 - ANDROID_LOG_SILENT Android_LogPriority = 8 -) - -// --- Log functions --- -func __android_log_write(prio int32, tag *byte, text *byte) int32 { return 0 } -func __android_log_print(prio int32, tag *byte, fmt *byte) int32 { return 0 } diff --git a/tools/pkg/specgen/testdata/looper/looper.go b/tools/pkg/specgen/testdata/looper/looper.go deleted file mode 100644 index e092192..0000000 --- a/tools/pkg/specgen/testdata/looper/looper.go +++ /dev/null @@ -1,46 +0,0 @@ -// Simulates c-for-go output for Android ALooper. -// This file is parsed at AST level only; it does not compile. -package looper - -import "unsafe" - -// Opaque handle types. -type ALooper C.ALooper - -// Integer typedefs. -type Looper_event_t int32 - -// Event enum. -const ( - ALOOPER_EVENT_INPUT Looper_event_t = 1 - ALOOPER_EVENT_OUTPUT Looper_event_t = 2 - ALOOPER_EVENT_ERROR Looper_event_t = 4 - ALOOPER_EVENT_HANGUP Looper_event_t = 8 - ALOOPER_EVENT_INVALID Looper_event_t = 16 -) - -// Poll result constants. -const ( - ALOOPER_POLL_WAKE int32 = -1 - ALOOPER_POLL_CALLBACK int32 = -2 - ALOOPER_POLL_TIMEOUT int32 = -3 - ALOOPER_POLL_ERROR int32 = -4 -) - -// Callback type. -type ALooper_callbackFunc func(fd int32, events int32, data unsafe.Pointer) int32 - -// --- Looper functions --- -func ALooper_prepare(opts int32) *ALooper { return nil } -func ALooper_acquire(looper *ALooper) {} -func ALooper_release(looper *ALooper) {} -func ALooper_pollOnce(timeoutMillis int32, outFd *int32, outEvents *int32, outData *unsafe.Pointer) int32 { - return 0 -} -func ALooper_wake(looper *ALooper) {} -func ALooper_addFd(looper *ALooper, fd int32, ident int32, events int32, callback ALooper_callbackFunc, data unsafe.Pointer) int32 { - return 0 -} -func ALooper_removeFd(looper *ALooper, fd int32) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/media/media.go b/tools/pkg/specgen/testdata/media/media.go deleted file mode 100644 index 05a0082..0000000 --- a/tools/pkg/specgen/testdata/media/media.go +++ /dev/null @@ -1,91 +0,0 @@ -// Simulates c-for-go output for Android Media NDK. -// This file is parsed at AST level only; it does not compile. -package media - -import "unsafe" - -// Opaque handle types. -type AMediaCodec C.AMediaCodec -type AMediaFormat C.AMediaFormat -type AMediaExtractor C.AMediaExtractor -type AMediaMuxer C.AMediaMuxer -type AMediaDrm C.AMediaDrm -type AMediaCrypto C.AMediaCrypto - -// Buffer info (opaque for CGo bridge). -type AMediaCodecBufferInfo C.AMediaCodecBufferInfo - -// Integer typedefs. -type Media_status_t int32 - -// Status codes. -const ( - AMEDIA_OK Media_status_t = 0 - AMEDIA_ERROR_UNKNOWN Media_status_t = -10000 - AMEDIA_ERROR_MALFORMED Media_status_t = -10001 - AMEDIA_ERROR_UNSUPPORTED Media_status_t = -10002 - AMEDIA_ERROR_INVALID_OBJECT Media_status_t = -10003 - AMEDIA_ERROR_INVALID_PARAMETER Media_status_t = -10004 - AMEDIA_ERROR_INVALID_OPERATION Media_status_t = -10005 - AMEDIA_ERROR_END_OF_STREAM Media_status_t = -10006 - AMEDIA_ERROR_IO Media_status_t = -10007 - AMEDIA_ERROR_WOULD_BLOCK Media_status_t = -10008 -) - -// --- MediaCodec functions --- -func AMediaCodec_createDecoderByType(mimeType *byte) *AMediaCodec { return nil } -func AMediaCodec_createEncoderByType(mimeType *byte) *AMediaCodec { return nil } -func AMediaCodec_delete(codec *AMediaCodec) Media_status_t { return 0 } -func AMediaCodec_configure(codec *AMediaCodec, format *AMediaFormat, window unsafe.Pointer, crypto *AMediaCrypto, flags uint32) Media_status_t { - return 0 -} -func AMediaCodec_start(codec *AMediaCodec) Media_status_t { return 0 } -func AMediaCodec_stop(codec *AMediaCodec) Media_status_t { return 0 } -func AMediaCodec_flush(codec *AMediaCodec) Media_status_t { return 0 } -func AMediaCodec_dequeueInputBuffer(codec *AMediaCodec, timeoutUs int64) int32 { - return 0 -} -func AMediaCodec_dequeueOutputBuffer(codec *AMediaCodec, info *AMediaCodecBufferInfo, timeoutUs int64) int32 { - return 0 -} -func AMediaCodec_getOutputFormat(codec *AMediaCodec) *AMediaFormat { return nil } -func AMediaCodec_queueInputBuffer(codec *AMediaCodec, index int32, offset int32, size int32, time uint64, flags uint32) Media_status_t { - return 0 -} -func AMediaCodec_releaseOutputBuffer(codec *AMediaCodec, index int32, render bool) Media_status_t { - return 0 -} - -// --- MediaFormat functions --- -func AMediaFormat_new() *AMediaFormat { return nil } -func AMediaFormat_delete(format *AMediaFormat) Media_status_t { return 0 } -func AMediaFormat_setString(format *AMediaFormat, name *byte, value *byte) {} -func AMediaFormat_setInt32(format *AMediaFormat, name *byte, value int32) {} -func AMediaFormat_getInt32(format *AMediaFormat, name *byte, out *int32) bool { return false } -func AMediaFormat_getString(format *AMediaFormat, name *byte, out **byte) bool { return false } - -// --- MediaExtractor functions --- -func AMediaExtractor_new() *AMediaExtractor { return nil } -func AMediaExtractor_delete(ex *AMediaExtractor) Media_status_t { return 0 } -func AMediaExtractor_setDataSourceFd(ex *AMediaExtractor, fd int32, offset int64, length int64) Media_status_t { - return 0 -} -func AMediaExtractor_getTrackCount(ex *AMediaExtractor) int32 { return 0 } -func AMediaExtractor_getTrackFormat(ex *AMediaExtractor, idx int32) *AMediaFormat { - return nil -} -func AMediaExtractor_selectTrack(ex *AMediaExtractor, idx int32) Media_status_t { return 0 } -func AMediaExtractor_advance(ex *AMediaExtractor) bool { return false } -func AMediaExtractor_readSampleData(ex *AMediaExtractor, buffer unsafe.Pointer, capacity int32) int32 { - return 0 -} -func AMediaExtractor_getSampleTime(ex *AMediaExtractor) int64 { return 0 } - -// --- MediaMuxer functions --- -func AMediaMuxer_new(fd int32, format int32) *AMediaMuxer { return nil } -func AMediaMuxer_delete(muxer *AMediaMuxer) Media_status_t { return 0 } -func AMediaMuxer_addTrack(muxer *AMediaMuxer, format *AMediaFormat) int32 { return 0 } -func AMediaMuxer_start(muxer *AMediaMuxer) Media_status_t { return 0 } -func AMediaMuxer_stop(muxer *AMediaMuxer) Media_status_t { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/midi/midi.go b/tools/pkg/specgen/testdata/midi/midi.go deleted file mode 100644 index e911ac1..0000000 --- a/tools/pkg/specgen/testdata/midi/midi.go +++ /dev/null @@ -1,36 +0,0 @@ -// Simulates c-for-go output for Android MIDI (amidi/AMidi.h). -// This file is parsed at AST level only; it does not compile. -package midi - -import "unsafe" - -// Opaque handle types. -type AMidiDevice C.AMidiDevice -type AMidiInputPort C.AMidiInputPort -type AMidiOutputPort C.AMidiOutputPort - -// Integer typedefs. -type Midi_result_t int32 - -// Result codes. -const ( - AMIDI_OK Midi_result_t = 0 - AMIDI_ERROR_UNKNOWN Midi_result_t = -1 - AMIDI_ERROR_WOULD_BLOCK Midi_result_t = -2 -) - -// --- Device functions --- -func AMidiDevice_release(device *AMidiDevice) {} -func AMidiDevice_getNumInputPorts(device *AMidiDevice) int32 { return 0 } -func AMidiDevice_getNumOutputPorts(device *AMidiDevice) int32 { return 0 } - -// --- InputPort functions --- -func AMidiInputPort_open(device *AMidiDevice, portNumber int32, outPort **AMidiInputPort) int32 { return 0 } -func AMidiInputPort_close(port *AMidiInputPort) {} -func AMidiInputPort_send(port *AMidiInputPort, buffer *byte, numBytes int32) int32 { return 0 } - -// --- OutputPort functions --- -func AMidiOutputPort_open(device *AMidiDevice, portNumber int32, outPort **AMidiOutputPort) int32 { return 0 } -func AMidiOutputPort_close(port *AMidiOutputPort) {} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/multinetwork/multinetwork.go b/tools/pkg/specgen/testdata/multinetwork/multinetwork.go deleted file mode 100644 index 02b1df2..0000000 --- a/tools/pkg/specgen/testdata/multinetwork/multinetwork.go +++ /dev/null @@ -1,20 +0,0 @@ -// Simulates c-for-go output for Android Multinetwork. -// This file is parsed at AST level only; it does not compile. -package multinetwork - -import "unsafe" - -// Integer typedefs. -type Net_handle_t int64 - -// --- Network functions --- -func android_getaddrinfofornetwork(network int64, node *byte, service *byte, hints unsafe.Pointer, res *unsafe.Pointer) int32 { - return 0 -} -func android_setprocnetwork(network int64) int32 { return 0 } -func android_setsocknetwork(network int64, fd int32) int32 { return 0 } -func android_getprocnetwork(network *int64) int32 { return 0 } -func android_tag_socket(sockfd int32, tag uint32) int32 { return 0 } -func android_untag_socket(sockfd int32) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/nativeactivity/nativeactivity.go b/tools/pkg/specgen/testdata/nativeactivity/nativeactivity.go deleted file mode 100644 index 989bff0..0000000 --- a/tools/pkg/specgen/testdata/nativeactivity/nativeactivity.go +++ /dev/null @@ -1,36 +0,0 @@ -// Simulates c-for-go output for Android NativeActivity. -// This file is parsed at AST level only; it does not compile. -package nativeactivity - -import "unsafe" - -// Opaque handle types. -type ANativeActivity C.ANativeActivity -type ANativeWindow C.ANativeWindow -type AInputQueue C.AInputQueue -type ARect C.ARect - -// Integer typedefs. -type Show_soft_input_flags_t uint32 -type Hide_soft_input_flags_t uint32 - -// ShowSoftInput flags. -const ( - ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT Show_soft_input_flags_t = 0x0001 - ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED Show_soft_input_flags_t = 0x0002 -) - -// HideSoftInput flags. -const ( - ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY Hide_soft_input_flags_t = 0x0001 - ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS Hide_soft_input_flags_t = 0x0002 -) - -// --- NativeActivity functions --- -func ANativeActivity_finish(activity *ANativeActivity) {} -func ANativeActivity_setWindowFormat(activity *ANativeActivity, format int32) {} -func ANativeActivity_setWindowFlags(activity *ANativeActivity, addFlags uint32, removeFlags uint32) {} -func ANativeActivity_showSoftInput(activity *ANativeActivity, flags uint32) {} -func ANativeActivity_hideSoftInput(activity *ANativeActivity, flags uint32) {} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/nativewindow/nativewindow.go b/tools/pkg/specgen/testdata/nativewindow/nativewindow.go deleted file mode 100644 index 5cf6cdc..0000000 --- a/tools/pkg/specgen/testdata/nativewindow/nativewindow.go +++ /dev/null @@ -1,32 +0,0 @@ -// Simulates c-for-go output for Android NativeWindow. -// This file is parsed at AST level only; it does not compile. -package nativewindow - -import "unsafe" - -// Opaque handle types. -type ANativeWindow C.ANativeWindow -type ANativeWindow_Buffer C.ANativeWindow_Buffer -type ARect C.ARect - -// Integer typedefs. -type Window_format_t int32 - -// Window format enum. -const ( - WINDOW_FORMAT_RGBA_8888 Window_format_t = 1 - WINDOW_FORMAT_RGBX_8888 Window_format_t = 2 - WINDOW_FORMAT_RGB_565 Window_format_t = 4 -) - -// --- Window functions --- -func ANativeWindow_acquire(window *ANativeWindow) {} -func ANativeWindow_release(window *ANativeWindow) {} -func ANativeWindow_getWidth(window *ANativeWindow) int32 { return 0 } -func ANativeWindow_getHeight(window *ANativeWindow) int32 { return 0 } -func ANativeWindow_getFormat(window *ANativeWindow) int32 { return 0 } -func ANativeWindow_setBuffersGeometry(window *ANativeWindow, width int32, height int32, format int32) int32 { return 0 } -func ANativeWindow_lock(window *ANativeWindow, outBuffer *ANativeWindow_Buffer, inOutDirtyBounds unsafe.Pointer) int32 { return 0 } -func ANativeWindow_unlockAndPost(window *ANativeWindow) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/neuralnetworks/neuralnetworks.go b/tools/pkg/specgen/testdata/neuralnetworks/neuralnetworks.go deleted file mode 100644 index eb0384d..0000000 --- a/tools/pkg/specgen/testdata/neuralnetworks/neuralnetworks.go +++ /dev/null @@ -1,228 +0,0 @@ -// Simulates c-for-go output for Android Neural Networks API (NeuralNetworks.h). -// This file is parsed at AST level only; it does not compile. -package neuralnetworks - -import "unsafe" - -// Opaque handle types. -type ANeuralNetworksModel C.ANeuralNetworksModel -type ANeuralNetworksCompilation C.ANeuralNetworksCompilation -type ANeuralNetworksExecution C.ANeuralNetworksExecution -type ANeuralNetworksMemory C.ANeuralNetworksMemory -type ANeuralNetworksBurst C.ANeuralNetworksBurst -type ANeuralNetworksDevice C.ANeuralNetworksDevice -type ANeuralNetworksEvent C.ANeuralNetworksEvent - -// Integer typedefs. -type Nnapi_result_t int32 -type Nnapi_operand_type_t int32 -type Nnapi_operation_type_t int32 -type Nnapi_fuse_code_t int32 -type Nnapi_preference_t int32 -type Nnapi_device_type_t int32 -type Nnapi_priority_t int32 - -// Result codes. -const ( - ANEURALNETWORKS_NO_ERROR Nnapi_result_t = 0 - ANEURALNETWORKS_OUT_OF_MEMORY Nnapi_result_t = 1 - ANEURALNETWORKS_INCOMPLETE Nnapi_result_t = 2 - ANEURALNETWORKS_UNEXPECTED_NULL Nnapi_result_t = 3 - ANEURALNETWORKS_BAD_DATA Nnapi_result_t = 4 - ANEURALNETWORKS_OP_FAILED Nnapi_result_t = 5 - ANEURALNETWORKS_BAD_STATE Nnapi_result_t = 6 - ANEURALNETWORKS_UNMAPPABLE Nnapi_result_t = 7 - ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE Nnapi_result_t = 8 - ANEURALNETWORKS_UNAVAILABLE_DEVICE Nnapi_result_t = 9 - ANEURALNETWORKS_MISSED_DEADLINE_TRANSIENT Nnapi_result_t = 10 - ANEURALNETWORKS_MISSED_DEADLINE_PERSISTENT Nnapi_result_t = 11 - ANEURALNETWORKS_RESOURCE_EXHAUSTED_TRANSIENT Nnapi_result_t = 12 - ANEURALNETWORKS_RESOURCE_EXHAUSTED_PERSISTENT Nnapi_result_t = 13 - ANEURALNETWORKS_DEAD_OBJECT Nnapi_result_t = 14 -) - -// Operand types. -const ( - ANEURALNETWORKS_FLOAT32 Nnapi_operand_type_t = 0 - ANEURALNETWORKS_INT32 Nnapi_operand_type_t = 1 - ANEURALNETWORKS_UINT32 Nnapi_operand_type_t = 2 - ANEURALNETWORKS_TENSOR_FLOAT32 Nnapi_operand_type_t = 3 - ANEURALNETWORKS_TENSOR_INT32 Nnapi_operand_type_t = 4 - ANEURALNETWORKS_TENSOR_QUANT8_ASYMM Nnapi_operand_type_t = 5 - ANEURALNETWORKS_BOOL Nnapi_operand_type_t = 6 - ANEURALNETWORKS_TENSOR_QUANT16_SYMM Nnapi_operand_type_t = 7 - ANEURALNETWORKS_TENSOR_FLOAT16 Nnapi_operand_type_t = 8 - ANEURALNETWORKS_TENSOR_BOOL8 Nnapi_operand_type_t = 9 - ANEURALNETWORKS_FLOAT16 Nnapi_operand_type_t = 10 - ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL Nnapi_operand_type_t = 11 - ANEURALNETWORKS_TENSOR_QUANT16_ASYMM Nnapi_operand_type_t = 12 - ANEURALNETWORKS_TENSOR_QUANT8_SYMM Nnapi_operand_type_t = 13 - ANEURALNETWORKS_TENSOR_QUANT8_ASYMM_SIGNED Nnapi_operand_type_t = 14 -) - -// Operation types. -const ( - ANEURALNETWORKS_ADD Nnapi_operation_type_t = 0 - ANEURALNETWORKS_AVERAGE_POOL_2D Nnapi_operation_type_t = 1 - ANEURALNETWORKS_CONCATENATION Nnapi_operation_type_t = 2 - ANEURALNETWORKS_CONV_2D Nnapi_operation_type_t = 3 - ANEURALNETWORKS_DEPTHWISE_CONV_2D Nnapi_operation_type_t = 4 - ANEURALNETWORKS_FULLY_CONNECTED Nnapi_operation_type_t = 9 - ANEURALNETWORKS_L2_NORMALIZATION Nnapi_operation_type_t = 11 - ANEURALNETWORKS_LOGISTIC Nnapi_operation_type_t = 14 - ANEURALNETWORKS_LSTM Nnapi_operation_type_t = 16 - ANEURALNETWORKS_MAX_POOL_2D Nnapi_operation_type_t = 17 - ANEURALNETWORKS_MUL Nnapi_operation_type_t = 18 - ANEURALNETWORKS_RELU Nnapi_operation_type_t = 19 - ANEURALNETWORKS_RELU1 Nnapi_operation_type_t = 20 - ANEURALNETWORKS_RELU6 Nnapi_operation_type_t = 21 - ANEURALNETWORKS_RESHAPE Nnapi_operation_type_t = 22 - ANEURALNETWORKS_SOFTMAX Nnapi_operation_type_t = 25 - ANEURALNETWORKS_TANH Nnapi_operation_type_t = 28 - ANEURALNETWORKS_BATCH_NORMALIZATION Nnapi_operation_type_t = 29 -) - -// Fuse codes. -const ( - ANEURALNETWORKS_FUSED_NONE Nnapi_fuse_code_t = 0 - ANEURALNETWORKS_FUSED_RELU Nnapi_fuse_code_t = 1 - ANEURALNETWORKS_FUSED_RELU1 Nnapi_fuse_code_t = 2 - ANEURALNETWORKS_FUSED_RELU6 Nnapi_fuse_code_t = 3 -) - -// Preference constants. -const ( - ANEURALNETWORKS_PREFER_LOW_POWER Nnapi_preference_t = 0 - ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER Nnapi_preference_t = 1 - ANEURALNETWORKS_PREFER_SUSTAINED_SPEED Nnapi_preference_t = 2 -) - -// Device types. -const ( - ANEURALNETWORKS_DEVICE_UNKNOWN Nnapi_device_type_t = 0 - ANEURALNETWORKS_DEVICE_OTHER Nnapi_device_type_t = 1 - ANEURALNETWORKS_DEVICE_CPU Nnapi_device_type_t = 2 - ANEURALNETWORKS_DEVICE_GPU Nnapi_device_type_t = 3 - ANEURALNETWORKS_DEVICE_ACCELERATOR Nnapi_device_type_t = 4 -) - -// Priority constants. -const ( - ANEURALNETWORKS_PRIORITY_LOW Nnapi_priority_t = 90 - ANEURALNETWORKS_PRIORITY_MEDIUM Nnapi_priority_t = 100 - ANEURALNETWORKS_PRIORITY_HIGH Nnapi_priority_t = 110 - ANEURALNETWORKS_PRIORITY_DEFAULT Nnapi_priority_t = 100 -) - -// Operand type descriptor (opaque for CGo bridge). -type ANeuralNetworksOperandType C.ANeuralNetworksOperandType - -// --- Model functions --- -func ANeuralNetworksModel_create(model **ANeuralNetworksModel) Nnapi_result_t { return 0 } -func ANeuralNetworksModel_free(model *ANeuralNetworksModel) {} -func ANeuralNetworksModel_finish(model *ANeuralNetworksModel) Nnapi_result_t { return 0 } -func ANeuralNetworksModel_addOperand(model *ANeuralNetworksModel, operandType *ANeuralNetworksOperandType) Nnapi_result_t { - return 0 -} -func ANeuralNetworksModel_setOperandValue(model *ANeuralNetworksModel, index int32, buffer unsafe.Pointer, length uint32) Nnapi_result_t { - return 0 -} -func ANeuralNetworksModel_addOperation(model *ANeuralNetworksModel, operationType Nnapi_operation_type_t, inputCount uint32, inputs *uint32, outputCount uint32, outputs *uint32) Nnapi_result_t { - return 0 -} -func ANeuralNetworksModel_identifyInputsAndOutputs(model *ANeuralNetworksModel, inputCount uint32, inputs *uint32, outputCount uint32, outputs *uint32) Nnapi_result_t { - return 0 -} -func ANeuralNetworksModel_relaxComputationFloat32toFloat16(model *ANeuralNetworksModel, allow int32) Nnapi_result_t { - return 0 -} - -// --- Compilation functions --- -func ANeuralNetworksCompilation_create(model *ANeuralNetworksModel, compilation **ANeuralNetworksCompilation) Nnapi_result_t { - return 0 -} -func ANeuralNetworksCompilation_free(compilation *ANeuralNetworksCompilation) {} -func ANeuralNetworksCompilation_setPreference(compilation *ANeuralNetworksCompilation, preference Nnapi_preference_t) Nnapi_result_t { - return 0 -} -func ANeuralNetworksCompilation_finish(compilation *ANeuralNetworksCompilation) Nnapi_result_t { - return 0 -} -func ANeuralNetworksCompilation_setPriority(compilation *ANeuralNetworksCompilation, priority Nnapi_priority_t) Nnapi_result_t { - return 0 -} -func ANeuralNetworksCompilation_setTimeout(compilation *ANeuralNetworksCompilation, duration uint64) Nnapi_result_t { - return 0 -} -func ANeuralNetworksCompilation_setCaching(compilation *ANeuralNetworksCompilation, cacheDir *byte, token *byte) Nnapi_result_t { - return 0 -} - -// --- Execution functions --- -func ANeuralNetworksExecution_create(compilation *ANeuralNetworksCompilation, execution **ANeuralNetworksExecution) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_free(execution *ANeuralNetworksExecution) {} -func ANeuralNetworksExecution_setInput(execution *ANeuralNetworksExecution, index int32, operandType *ANeuralNetworksOperandType, buffer unsafe.Pointer, length uint32) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_setOutput(execution *ANeuralNetworksExecution, index int32, operandType *ANeuralNetworksOperandType, buffer unsafe.Pointer, length uint32) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_compute(execution *ANeuralNetworksExecution) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_startCompute(execution *ANeuralNetworksExecution, event **ANeuralNetworksEvent) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_setTimeout(execution *ANeuralNetworksExecution, duration uint64) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_setMeasureTiming(execution *ANeuralNetworksExecution, measure int32) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_getDuration(execution *ANeuralNetworksExecution, durationCode int32, duration *uint64) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_setInputFromMemory(execution *ANeuralNetworksExecution, index int32, operandType *ANeuralNetworksOperandType, memory *ANeuralNetworksMemory, offset uint32, length uint32) Nnapi_result_t { - return 0 -} -func ANeuralNetworksExecution_setOutputFromMemory(execution *ANeuralNetworksExecution, index int32, operandType *ANeuralNetworksOperandType, memory *ANeuralNetworksMemory, offset uint32, length uint32) Nnapi_result_t { - return 0 -} - -// --- Memory functions --- -func ANeuralNetworksMemory_createFromFd(size uint32, prot int32, fd int32, offset uint32, memory **ANeuralNetworksMemory) Nnapi_result_t { - return 0 -} -func ANeuralNetworksMemory_free(memory *ANeuralNetworksMemory) {} - -// --- Burst functions --- -func ANeuralNetworksBurst_create(compilation *ANeuralNetworksCompilation, burst **ANeuralNetworksBurst) Nnapi_result_t { - return 0 -} -func ANeuralNetworksBurst_free(burst *ANeuralNetworksBurst) {} - -// --- Event functions --- -func ANeuralNetworksEvent_wait(event *ANeuralNetworksEvent) Nnapi_result_t { return 0 } -func ANeuralNetworksEvent_free(event *ANeuralNetworksEvent) {} - -// --- Device enumeration functions --- -func ANeuralNetworks_getDeviceCount(numDevices *uint32) Nnapi_result_t { return 0 } -func ANeuralNetworks_getDevice(devIndex uint32, device **ANeuralNetworksDevice) Nnapi_result_t { - return 0 -} -func ANeuralNetworksDevice_getName(device *ANeuralNetworksDevice, name **byte) Nnapi_result_t { - return 0 -} -func ANeuralNetworksDevice_getType(device *ANeuralNetworksDevice, devType *Nnapi_device_type_t) Nnapi_result_t { - return 0 -} -func ANeuralNetworksDevice_getVersion(device *ANeuralNetworksDevice, version **byte) Nnapi_result_t { - return 0 -} -func ANeuralNetworksDevice_getFeatureLevel(device *ANeuralNetworksDevice, featureLevel *int64) Nnapi_result_t { - return 0 -} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/permission/permission.go b/tools/pkg/specgen/testdata/permission/permission.go deleted file mode 100644 index 56a66e2..0000000 --- a/tools/pkg/specgen/testdata/permission/permission.go +++ /dev/null @@ -1,15 +0,0 @@ -// Simulates c-for-go output for Android Permission Manager (android/permission_manager.h). -// This file is parsed at AST level only; it does not compile. -package permission - -// Integer typedefs. -type Permission_result_t int32 - -// Result codes. -const ( - PERMISSION_MANAGER_PERMISSION_GRANTED Permission_result_t = 0 - PERMISSION_MANAGER_PERMISSION_DENIED Permission_result_t = -1 -) - -// --- Permission functions --- -func APermissionManager_checkPermission(permission *byte, pid int32, uid uint32, outResult *int32) int32 { return 0 } diff --git a/tools/pkg/specgen/testdata/sensor/sensor.go b/tools/pkg/specgen/testdata/sensor/sensor.go deleted file mode 100644 index fa6272c..0000000 --- a/tools/pkg/specgen/testdata/sensor/sensor.go +++ /dev/null @@ -1,75 +0,0 @@ -// Simulates c-for-go output for Android Sensor NDK. -// This file is parsed at AST level only; it does not compile. -package sensor - -import "unsafe" - -// Opaque handle types. -type ASensorManager C.ASensorManager -type ASensor C.ASensor -type ASensorEventQueue C.ASensorEventQueue - -// ASensorList is a pointer to a list of sensor pointers. -type ASensorList **ASensor - -// Integer typedefs. -type Sensor_type_t int32 -type Sensor_status_t int32 - -// Sensor type enum. -const ( - ASENSOR_TYPE_ACCELEROMETER Sensor_type_t = 1 - ASENSOR_TYPE_MAGNETIC_FIELD Sensor_type_t = 2 - ASENSOR_TYPE_GYROSCOPE Sensor_type_t = 4 - ASENSOR_TYPE_LIGHT Sensor_type_t = 5 - ASENSOR_TYPE_PRESSURE Sensor_type_t = 6 - ASENSOR_TYPE_PROXIMITY Sensor_type_t = 8 - ASENSOR_TYPE_GRAVITY Sensor_type_t = 9 - ASENSOR_TYPE_LINEAR_ACCELERATION Sensor_type_t = 10 - ASENSOR_TYPE_ROTATION_VECTOR Sensor_type_t = 11 - ASENSOR_TYPE_RELATIVE_HUMIDITY Sensor_type_t = 12 - ASENSOR_TYPE_AMBIENT_TEMPERATURE Sensor_type_t = 13 - ASENSOR_TYPE_GAME_ROTATION_VECTOR Sensor_type_t = 15 - ASENSOR_TYPE_STEP_DETECTOR Sensor_type_t = 18 - ASENSOR_TYPE_STEP_COUNTER Sensor_type_t = 19 - ASENSOR_TYPE_HEART_RATE Sensor_type_t = 21 -) - -// Sensor status enum. -const ( - ASENSOR_STATUS_NO_CONTACT Sensor_status_t = -1 - ASENSOR_STATUS_UNRELIABLE Sensor_status_t = 0 - ASENSOR_STATUS_ACCURACY_LOW Sensor_status_t = 1 - ASENSOR_STATUS_ACCURACY_MEDIUM Sensor_status_t = 2 - ASENSOR_STATUS_ACCURACY_HIGH Sensor_status_t = 3 -) - -// --- SensorManager functions --- -func ASensorManager_getInstance() *ASensorManager { return nil } -func ASensorManager_getDefaultSensor(manager *ASensorManager, sensorType int32) *ASensor { - return nil -} -func ASensorManager_getSensorList(manager *ASensorManager, list **ASensor) int32 { return 0 } -func ASensorManager_createEventQueue(manager *ASensorManager, looper unsafe.Pointer, ident int32, callback unsafe.Pointer, data unsafe.Pointer) *ASensorEventQueue { - return nil -} -func ASensorManager_destroyEventQueue(manager *ASensorManager, queue *ASensorEventQueue) int32 { - return 0 -} - -// --- SensorEventQueue functions --- -func ASensorEventQueue_enableSensor(queue *ASensorEventQueue, sensor *ASensor) int32 { return 0 } -func ASensorEventQueue_disableSensor(queue *ASensorEventQueue, sensor *ASensor) int32 { return 0 } -func ASensorEventQueue_setEventRate(queue *ASensorEventQueue, sensor *ASensor, usec int32) int32 { - return 0 -} -func ASensorEventQueue_hasEvents(queue *ASensorEventQueue) int32 { return 0 } - -// --- Sensor info functions --- -func ASensor_getName(sensor *ASensor) *byte { return nil } -func ASensor_getVendor(sensor *ASensor) *byte { return nil } -func ASensor_getType(sensor *ASensor) int32 { return 0 } -func ASensor_getResolution(sensor *ASensor) float32 { return 0 } -func ASensor_getMinDelay(sensor *ASensor) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/sharedmem/sharedmem.go b/tools/pkg/specgen/testdata/sharedmem/sharedmem.go deleted file mode 100644 index 257db02..0000000 --- a/tools/pkg/specgen/testdata/sharedmem/sharedmem.go +++ /dev/null @@ -1,8 +0,0 @@ -// Simulates c-for-go output for Android SharedMemory. -// This file is parsed at AST level only; it does not compile. -package sharedmem - -// --- SharedMemory functions --- -func ASharedMemory_create(name *byte, size int32) int32 { return 0 } -func ASharedMemory_getSize(fd int32) int32 { return 0 } -func ASharedMemory_setProt(fd int32, prot int32) int32 { return 0 } diff --git a/tools/pkg/specgen/testdata/simple/simple.go b/tools/pkg/specgen/testdata/simple/simple.go deleted file mode 100644 index aaf930d..0000000 --- a/tools/pkg/specgen/testdata/simple/simple.go +++ /dev/null @@ -1,36 +0,0 @@ -package simple - -import "unsafe" - -// Opaque handle types (c-for-go pattern: type alias to C struct pointer). -type FakeStream C.FakeStream -type FakeBuilder C.FakeBuilder - -// Integer typedefs. -type Fake_result_t int32 -type Fake_direction_t int32 - -// Enum values. -const ( - FAKE_OK Fake_result_t = 0 - FAKE_ERROR_BASE Fake_result_t = -900 -) - -const ( - FAKE_DIRECTION_OUTPUT Fake_direction_t = 0 - FAKE_DIRECTION_INPUT Fake_direction_t = 1 -) - -// Callback type. -type FakeStream_dataCallback func(stream *FakeStream, userData unsafe.Pointer, audioData unsafe.Pointer, numFrames int32) Fake_result_t - -// Functions. -func Fake_createBuilder(builder **FakeBuilder) Fake_result_t { return 0 } -func FakeBuilder_setDeviceId(builder *FakeBuilder, deviceId int32) {} -func FakeBuilder_openStream(builder *FakeBuilder, stream **FakeStream) Fake_result_t { return 0 } -func FakeBuilder_delete(builder *FakeBuilder) {} -func FakeStream_close(stream *FakeStream) Fake_result_t { return 0 } -func FakeStream_requestStart(stream *FakeStream) Fake_result_t { return 0 } -func FakeStream_getSampleRate(stream *FakeStream) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/storage/storage.go b/tools/pkg/specgen/testdata/storage/storage.go deleted file mode 100644 index 9088ac3..0000000 --- a/tools/pkg/specgen/testdata/storage/storage.go +++ /dev/null @@ -1,18 +0,0 @@ -// Simulates c-for-go output for Android Storage Manager (android/storage_manager.h). -// This file is parsed at AST level only; it does not compile. -package storage - -import "unsafe" - -// Opaque handle types. -type AStorageManager C.AStorageManager - -// --- StorageManager functions --- -func AStorageManager_new() *AStorageManager { return nil } -func AStorageManager_delete(manager *AStorageManager) {} -func AStorageManager_mountObb(manager *AStorageManager, filename *byte, key *byte, callback unsafe.Pointer, data unsafe.Pointer) {} -func AStorageManager_unmountObb(manager *AStorageManager, filename *byte, force int32, callback unsafe.Pointer, data unsafe.Pointer) {} -func AStorageManager_isObbMounted(manager *AStorageManager, filename *byte) int32 { return 0 } -func AStorageManager_getMountedObbPath(manager *AStorageManager, filename *byte) *byte { return nil } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/surfacecontrol/surfacecontrol.go b/tools/pkg/specgen/testdata/surfacecontrol/surfacecontrol.go deleted file mode 100644 index a46c93e..0000000 --- a/tools/pkg/specgen/testdata/surfacecontrol/surfacecontrol.go +++ /dev/null @@ -1,59 +0,0 @@ -// Simulates c-for-go output for Android SurfaceControl. -// This file is parsed at AST level only; it does not compile. -package surfacecontrol - -import "unsafe" - -// Opaque handle types. -type ASurfaceControl C.ASurfaceControl -type ASurfaceTransaction C.ASurfaceTransaction -type ANativeWindow C.ANativeWindow -type AHardwareBuffer C.AHardwareBuffer - -// Integer typedefs. -type ASurfaceTransaction_visibility_t int32 -type ASurfaceTransaction_transparency_t int32 - -// Visibility enum. -const ( - ASURFACE_TRANSACTION_VISIBILITY_SHOW ASurfaceTransaction_visibility_t = 0 - ASURFACE_TRANSACTION_VISIBILITY_HIDE ASurfaceTransaction_visibility_t = 1 -) - -// Transparency enum. -const ( - ASURFACE_TRANSACTION_TRANSPARENCY_TRANSPARENT ASurfaceTransaction_transparency_t = 0 - ASURFACE_TRANSACTION_TRANSPARENCY_TRANSLUCENT ASurfaceTransaction_transparency_t = 1 - ASURFACE_TRANSACTION_TRANSPARENCY_OPAQUE ASurfaceTransaction_transparency_t = 2 -) - -// --- SurfaceControl lifecycle --- -func ASurfaceControl_createFromWindow(parent *ANativeWindow, debugName *byte) *ASurfaceControl { return nil } -func ASurfaceControl_create(parent *ASurfaceControl, debugName *byte) *ASurfaceControl { return nil } -func ASurfaceControl_acquire(surfaceControl *ASurfaceControl) {} -func ASurfaceControl_release(surfaceControl *ASurfaceControl) {} - -// --- SurfaceTransaction lifecycle --- -func ASurfaceTransaction_create() *ASurfaceTransaction { return nil } -func ASurfaceTransaction_delete(transaction *ASurfaceTransaction) {} -func ASurfaceTransaction_apply(transaction *ASurfaceTransaction) {} - -// --- Transaction operations --- -func ASurfaceTransaction_setVisibility(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, visibility ASurfaceTransaction_visibility_t) {} -func ASurfaceTransaction_setZOrder(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, zOrder int32) {} -func ASurfaceTransaction_setBuffer(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, buffer *AHardwareBuffer, fenceFd int32) {} -// setGeometry removed: uses C++ references (const ARect&) incompatible with CGo. -func ASurfaceTransaction_setBufferTransparency(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, transparency ASurfaceTransaction_transparency_t) {} -func ASurfaceTransaction_setDamageRegion(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, rects unsafe.Pointer, count uint32) {} -func ASurfaceTransaction_setPosition(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, x int32, y int32) {} -func ASurfaceTransaction_setBufferAlpha(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, alpha float32) {} -// setCrop removed: uses C++ references (const ARect&) incompatible with CGo. -func ASurfaceTransaction_setScale(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, xScale float32, yScale float32) {} -func ASurfaceTransaction_setColor(transaction *ASurfaceTransaction, surfaceControl *ASurfaceControl, r float32, g float32, b float32, a float32, dataspace int32) {} - -// --- OnComplete callback --- -type ASurfaceTransaction_OnComplete func(context unsafe.Pointer, stats unsafe.Pointer) - -func ASurfaceTransaction_setOnComplete(transaction *ASurfaceTransaction, context unsafe.Pointer, callback ASurfaceTransaction_OnComplete) {} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/surfacetexture/surfacetexture.go b/tools/pkg/specgen/testdata/surfacetexture/surfacetexture.go deleted file mode 100644 index 75e7aee..0000000 --- a/tools/pkg/specgen/testdata/surfacetexture/surfacetexture.go +++ /dev/null @@ -1,24 +0,0 @@ -// Simulates c-for-go output for Android SurfaceTexture. -// This file is parsed at AST level only; it does not compile. -package surfacetexture - -import "unsafe" - -// Opaque handle types. -type ASurfaceTexture C.ASurfaceTexture -type ANativeWindow C.ANativeWindow - -// --- SurfaceTexture lifecycle --- -func ASurfaceTexture_release(surfaceTexture *ASurfaceTexture) {} - -// --- SurfaceTexture operations --- -func ASurfaceTexture_acquireANativeWindow(surfaceTexture *ASurfaceTexture) *ANativeWindow { return nil } -func ASurfaceTexture_attachToGLContext(surfaceTexture *ASurfaceTexture, texName uint32) int32 { - return 0 -} -func ASurfaceTexture_detachFromGLContext(surfaceTexture *ASurfaceTexture) int32 { return 0 } -func ASurfaceTexture_updateTexImage(surfaceTexture *ASurfaceTexture) int32 { return 0 } -func ASurfaceTexture_getTransformMatrix(surfaceTexture *ASurfaceTexture, mtx *float32) { -} -func ASurfaceTexture_getTimestamp(surfaceTexture *ASurfaceTexture) int64 { return 0 } -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/sync/sync.go b/tools/pkg/specgen/testdata/sync/sync.go deleted file mode 100644 index c16975b..0000000 --- a/tools/pkg/specgen/testdata/sync/sync.go +++ /dev/null @@ -1,11 +0,0 @@ -// Simulates c-for-go output for Android Sync. -// This file is parsed at AST level only; it does not compile. -package sync - -import "unsafe" - -// --- Sync functions --- -func sync_merge(name *byte, fd1 int32, fd2 int32) int32 { return 0 } -func sync_file_info_free(info unsafe.Pointer) {} - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/thermal/thermal.go b/tools/pkg/specgen/testdata/thermal/thermal.go deleted file mode 100644 index 2acdd75..0000000 --- a/tools/pkg/specgen/testdata/thermal/thermal.go +++ /dev/null @@ -1,33 +0,0 @@ -// Simulates c-for-go output for Android thermal API. -// This file is parsed at AST level only; it does not compile. -package thermal - -import "unsafe" - -// Opaque handle types. -type AThermalManager C.AThermalManager - -// Thermal status enum. -type Thermal_status_t int32 - -const ( - ATHERMAL_STATUS_NONE Thermal_status_t = 0 - ATHERMAL_STATUS_LIGHT Thermal_status_t = 1 - ATHERMAL_STATUS_MODERATE Thermal_status_t = 2 - ATHERMAL_STATUS_SEVERE Thermal_status_t = 3 - ATHERMAL_STATUS_CRITICAL Thermal_status_t = 4 - ATHERMAL_STATUS_EMERGENCY Thermal_status_t = 5 - ATHERMAL_STATUS_SHUTDOWN Thermal_status_t = 6 -) - -// Callback type. -type AThermal_StatusCallback func(data unsafe.Pointer, status int32) - -// --- Thermal functions --- -func AThermal_acquireManager() *AThermalManager { return nil } -func AThermal_releaseManager(manager *AThermalManager) {} -func AThermal_getCurrentThermalStatus(manager *AThermalManager) int32 { return 0 } -func AThermal_registerThermalStatusListener(manager *AThermalManager, callback AThermal_StatusCallback, data unsafe.Pointer) int32 { return 0 } -func AThermal_unregisterThermalStatusListener(manager *AThermalManager, callback AThermal_StatusCallback, data unsafe.Pointer) int32 { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/testdata/trace/trace.go b/tools/pkg/specgen/testdata/trace/trace.go deleted file mode 100644 index 50e05b5..0000000 --- a/tools/pkg/specgen/testdata/trace/trace.go +++ /dev/null @@ -1,11 +0,0 @@ -// Simulates c-for-go output for Android trace. -// This file is parsed at AST level only; it does not compile. -package trace - -// --- Trace functions --- -func ATrace_isEnabled() bool { return false } -func ATrace_beginSection(sectionName *byte) {} -func ATrace_endSection() {} -func ATrace_beginAsyncSection(sectionName *byte, cookie int32) {} -func ATrace_endAsyncSection(sectionName *byte, cookie int32) {} -func ATrace_setCounter(counterName *byte, counterValue int64) {} diff --git a/tools/pkg/specgen/testdata/vulkan/vulkan.go b/tools/pkg/specgen/testdata/vulkan/vulkan.go deleted file mode 100644 index ba251fd..0000000 --- a/tools/pkg/specgen/testdata/vulkan/vulkan.go +++ /dev/null @@ -1,237 +0,0 @@ -// Simulates c-for-go output for Vulkan (vulkan/vulkan.h and vulkan/vulkan_android.h). -// This file is parsed at AST level only; it does not compile. -package vulkan - -import "unsafe" - -// Dispatchable handle types (already pointers in C: typedef struct VkX_T* VkX). -type VkInstance unsafe.Pointer -type VkPhysicalDevice unsafe.Pointer -type VkDevice unsafe.Pointer -type VkQueue unsafe.Pointer -type VkCommandBuffer unsafe.Pointer - -// Non-dispatchable handle types (uint64). -type VkSemaphore uint64 -type VkFence uint64 -type VkDeviceMemory uint64 -type VkBuffer uint64 -type VkImage uint64 -type VkEvent uint64 -type VkQueryPool uint64 -type VkBufferView uint64 -type VkImageView uint64 -type VkShaderModule uint64 -type VkPipelineCache uint64 -type VkPipelineLayout uint64 -type VkRenderPass uint64 -type VkPipeline uint64 -type VkDescriptorSetLayout uint64 -type VkSampler uint64 -type VkDescriptorPool uint64 -type VkDescriptorSet uint64 -type VkFramebuffer uint64 -type VkCommandPool uint64 -type VkSurfaceKHR uint64 -type VkSwapchainKHR uint64 - -// Integer typedefs. -type VkResult int32 -type VkFormat int32 -type VkImageUsageFlags uint32 -type VkSharingMode int32 -type VkPresentModeKHR int32 -type VkColorSpaceKHR int32 -type VkCompositeAlphaFlagBitsKHR uint32 -type VkSurfaceTransformFlagBitsKHR uint32 -type VkBool32 uint32 -type VkFlags uint32 -type VkDeviceSize uint64 -type VkStructureType int32 - -// VkResult values. -const ( - VK_SUCCESS VkResult = 0 - VK_NOT_READY VkResult = 1 - VK_TIMEOUT VkResult = 2 - VK_EVENT_SET VkResult = 3 - VK_EVENT_RESET VkResult = 4 - VK_INCOMPLETE VkResult = 5 - VK_ERROR_OUT_OF_HOST_MEMORY VkResult = -1 - VK_ERROR_OUT_OF_DEVICE_MEMORY VkResult = -2 - VK_ERROR_INITIALIZATION_FAILED VkResult = -3 - VK_ERROR_DEVICE_LOST VkResult = -4 - VK_ERROR_MEMORY_MAP_FAILED VkResult = -5 - VK_ERROR_LAYER_NOT_PRESENT VkResult = -6 - VK_ERROR_EXTENSION_NOT_PRESENT VkResult = -7 - VK_ERROR_FEATURE_NOT_PRESENT VkResult = -8 - VK_ERROR_INCOMPATIBLE_DRIVER VkResult = -9 - VK_ERROR_TOO_MANY_OBJECTS VkResult = -10 - VK_ERROR_FORMAT_NOT_SUPPORTED VkResult = -11 - VK_ERROR_FRAGMENTED_POOL VkResult = -12 - VK_ERROR_SURFACE_LOST_KHR VkResult = -1000000000 - VK_ERROR_NATIVE_WINDOW_IN_USE_KHR VkResult = -1000000001 - VK_SUBOPTIMAL_KHR VkResult = 1000001003 - VK_ERROR_OUT_OF_DATE_KHR VkResult = -1000001004 -) - -// VkStructureType values. -const ( - VK_STRUCTURE_TYPE_APPLICATION_INFO VkStructureType = 0 - VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO VkStructureType = 1 - VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR VkStructureType = 1000008000 - VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR VkStructureType = 1000001000 - VK_STRUCTURE_TYPE_PRESENT_INFO_KHR VkStructureType = 1000001001 -) - -// VkFormat values. -const ( - VK_FORMAT_UNDEFINED VkFormat = 0 - VK_FORMAT_R8G8B8A8_UNORM VkFormat = 37 - VK_FORMAT_R8G8B8A8_SRGB VkFormat = 43 - VK_FORMAT_B8G8R8A8_UNORM VkFormat = 44 - VK_FORMAT_B8G8R8A8_SRGB VkFormat = 50 - VK_FORMAT_D16_UNORM VkFormat = 124 - VK_FORMAT_D32_SFLOAT VkFormat = 126 - VK_FORMAT_D24_UNORM_S8_UINT VkFormat = 129 - VK_FORMAT_D32_SFLOAT_S8_UINT VkFormat = 130 -) - -// VkPresentModeKHR values. -const ( - VK_PRESENT_MODE_IMMEDIATE_KHR VkPresentModeKHR = 0 - VK_PRESENT_MODE_MAILBOX_KHR VkPresentModeKHR = 1 - VK_PRESENT_MODE_FIFO_KHR VkPresentModeKHR = 2 - VK_PRESENT_MODE_FIFO_RELAXED_KHR VkPresentModeKHR = 3 -) - -// --- Instance --- -func VkCreateInstance(pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pInstance *VkInstance) VkResult { - return 0 -} -func VkDestroyInstance(instance VkInstance, pAllocator unsafe.Pointer) {} -func VkEnumeratePhysicalDevices(instance VkInstance, pPhysicalDeviceCount *uint32, pPhysicalDevices *VkPhysicalDevice) VkResult { - return 0 -} - -// --- Device --- -func VkCreateDevice(physicalDevice VkPhysicalDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pDevice *VkDevice) VkResult { - return 0 -} -func VkDestroyDevice(device VkDevice, pAllocator unsafe.Pointer) {} -func VkGetDeviceQueue(device VkDevice, queueFamilyIndex uint32, queueIndex uint32, pQueue *VkQueue) { -} -func VkDeviceWaitIdle(device VkDevice) VkResult { return 0 } -func VkQueueWaitIdle(queue VkQueue) VkResult { return 0 } - -// --- Memory --- -func VkAllocateMemory(device VkDevice, pAllocateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pMemory *VkDeviceMemory) VkResult { - return 0 -} -func VkFreeMemory(device VkDevice, memory VkDeviceMemory, pAllocator unsafe.Pointer) {} -func VkMapMemory(device VkDevice, memory VkDeviceMemory, offset VkDeviceSize, size VkDeviceSize, flags VkFlags, ppData *unsafe.Pointer) VkResult { - return 0 -} -func VkUnmapMemory(device VkDevice, memory VkDeviceMemory) {} - -// --- Buffer --- -func VkCreateBuffer(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pBuffer *VkBuffer) VkResult { - return 0 -} -func VkDestroyBuffer(device VkDevice, buffer VkBuffer, pAllocator unsafe.Pointer) {} - -// --- Image --- -func VkCreateImage(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pImage *VkImage) VkResult { - return 0 -} -func VkDestroyImage(device VkDevice, image VkImage, pAllocator unsafe.Pointer) {} -func VkCreateImageView(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pView *VkImageView) VkResult { - return 0 -} -func VkDestroyImageView(device VkDevice, imageView VkImageView, pAllocator unsafe.Pointer) {} - -// --- Pipeline --- -func VkCreateGraphicsPipelines(device VkDevice, pipelineCache VkPipelineCache, createInfoCount uint32, pCreateInfos unsafe.Pointer, pAllocator unsafe.Pointer, pPipelines *VkPipeline) VkResult { - return 0 -} -func VkDestroyPipeline(device VkDevice, pipeline VkPipeline, pAllocator unsafe.Pointer) {} -func VkCreateShaderModule(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pShaderModule *VkShaderModule) VkResult { - return 0 -} -func VkDestroyShaderModule(device VkDevice, shaderModule VkShaderModule, pAllocator unsafe.Pointer) { -} - -// --- Render pass --- -func VkCreateRenderPass(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pRenderPass *VkRenderPass) VkResult { - return 0 -} -func VkDestroyRenderPass(device VkDevice, renderPass VkRenderPass, pAllocator unsafe.Pointer) {} - -// --- Framebuffer --- -func VkCreateFramebuffer(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pFramebuffer *VkFramebuffer) VkResult { - return 0 -} -func VkDestroyFramebuffer(device VkDevice, framebuffer VkFramebuffer, pAllocator unsafe.Pointer) {} - -// --- Command --- -func VkCreateCommandPool(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pCommandPool *VkCommandPool) VkResult { - return 0 -} -func VkDestroyCommandPool(device VkDevice, commandPool VkCommandPool, pAllocator unsafe.Pointer) {} -func VkAllocateCommandBuffers(device VkDevice, pAllocateInfo unsafe.Pointer, pCommandBuffers *VkCommandBuffer) VkResult { - return 0 -} -func VkBeginCommandBuffer(commandBuffer VkCommandBuffer, pBeginInfo unsafe.Pointer) VkResult { - return 0 -} -func VkEndCommandBuffer(commandBuffer VkCommandBuffer) VkResult { return 0 } -func VkQueueSubmit(queue VkQueue, submitCount uint32, pSubmits unsafe.Pointer, fence VkFence) VkResult { - return 0 -} - -// --- Synchronization --- -func VkCreateSemaphore(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pSemaphore *VkSemaphore) VkResult { - return 0 -} -func VkDestroySemaphore(device VkDevice, semaphore VkSemaphore, pAllocator unsafe.Pointer) {} -func VkCreateFence(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pFence *VkFence) VkResult { - return 0 -} -func VkDestroyFence(device VkDevice, fence VkFence, pAllocator unsafe.Pointer) {} -func VkWaitForFences(device VkDevice, fenceCount uint32, pFences *VkFence, waitAll VkBool32, timeout uint64) VkResult { - return 0 -} -func VkResetFences(device VkDevice, fenceCount uint32, pFences *VkFence) VkResult { return 0 } - -// --- Android surface (VK_KHR_android_surface) --- -func VkCreateAndroidSurfaceKHR(instance VkInstance, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pSurface *VkSurfaceKHR) VkResult { - return 0 -} -func VkDestroySurfaceKHR(instance VkInstance, surface VkSurfaceKHR, pAllocator unsafe.Pointer) {} -func VkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice VkPhysicalDevice, queueFamilyIndex uint32, surface VkSurfaceKHR, pSupported *VkBool32) VkResult { - return 0 -} -func VkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice VkPhysicalDevice, surface VkSurfaceKHR, pSurfaceCapabilities unsafe.Pointer) VkResult { - return 0 -} -func VkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice VkPhysicalDevice, surface VkSurfaceKHR, pSurfaceFormatCount *uint32, pSurfaceFormats unsafe.Pointer) VkResult { - return 0 -} -func VkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice VkPhysicalDevice, surface VkSurfaceKHR, pPresentModeCount *uint32, pPresentModes *VkPresentModeKHR) VkResult { - return 0 -} - -// --- Swapchain (VK_KHR_swapchain) --- -func VkCreateSwapchainKHR(device VkDevice, pCreateInfo unsafe.Pointer, pAllocator unsafe.Pointer, pSwapchain *VkSwapchainKHR) VkResult { - return 0 -} -func VkDestroySwapchainKHR(device VkDevice, swapchain VkSwapchainKHR, pAllocator unsafe.Pointer) {} -func VkGetSwapchainImagesKHR(device VkDevice, swapchain VkSwapchainKHR, pSwapchainImageCount *uint32, pSwapchainImages *VkImage) VkResult { - return 0 -} -func VkAcquireNextImageKHR(device VkDevice, swapchain VkSwapchainKHR, timeout uint64, semaphore VkSemaphore, fence VkFence, pImageIndex *uint32) VkResult { - return 0 -} -func VkQueuePresentKHR(queue VkQueue, pPresentInfo unsafe.Pointer) VkResult { return 0 } - -var _ = unsafe.Pointer(nil) diff --git a/tools/pkg/specgen/write.go b/tools/pkg/specgen/write.go deleted file mode 100644 index 39ca2d7..0000000 --- a/tools/pkg/specgen/write.go +++ /dev/null @@ -1,33 +0,0 @@ -package specgen - -import ( - "fmt" - "os" - "path/filepath" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - - "gopkg.in/yaml.v3" -) - -const generatedHeader = "# Code generated by specgen. DO NOT EDIT.\n\n" - -// WriteSpec marshals spec to YAML and writes it to path, creating parent -// directories as needed. The file is prefixed with a generated-code header. -func WriteSpec(spec specmodel.Spec, path string) error { - if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { - return fmt.Errorf("create directories: %w", err) - } - - data, err := yaml.Marshal(spec) - if err != nil { - return fmt.Errorf("marshal spec: %w", err) - } - - out := append([]byte(generatedHeader), data...) - if err := os.WriteFile(path, out, 0o644); err != nil { - return fmt.Errorf("write file: %w", err) - } - - return nil -} diff --git a/tools/pkg/specgen/write_test.go b/tools/pkg/specgen/write_test.go deleted file mode 100644 index 299d395..0000000 --- a/tools/pkg/specgen/write_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package specgen - -import ( - "os" - "path/filepath" - "strings" - "testing" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "gopkg.in/yaml.v3" -) - -func TestWriteSpec(t *testing.T) { - spec := specmodel.Spec{ - Module: "test", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/test", - Types: map[string]specmodel.TypeDef{ - "TestHandle": { - Kind: "opaque_ptr", - CType: "TestHandle", - GoType: "*C.TestHandle", - }, - }, - Enums: map[string][]specmodel.EnumValue{}, - Functions: map[string]specmodel.FuncDef{}, - Callbacks: map[string]specmodel.CallbackDef{}, - } - - dir := t.TempDir() - // Use a nested path to verify MkdirAll. - outPath := filepath.Join(dir, "sub", "dir", "spec.yaml") - - if err := WriteSpec(spec, outPath); err != nil { - t.Fatalf("WriteSpec: %v", err) - } - - data, err := os.ReadFile(outPath) - if err != nil { - t.Fatalf("read output: %v", err) - } - content := string(data) - - // Verify header. - if !strings.HasPrefix(content, "# Code generated by specgen. DO NOT EDIT.\n\n") { - t.Errorf("missing or incorrect header; got prefix: %q", content[:min(len(content), 60)]) - } - - // Verify YAML contains "module: test". - if !strings.Contains(content, "module: test") { - t.Errorf("YAML does not contain 'module: test'; got:\n%s", content) - } - - // Unmarshal and verify round-trip. - // Strip the header comment before unmarshalling. - yamlBody := content[strings.Index(content, "\n\n")+2:] - var roundTrip specmodel.Spec - if err := yaml.Unmarshal([]byte(yamlBody), &roundTrip); err != nil { - t.Fatalf("unmarshal round-trip: %v", err) - } - - if roundTrip.Module != "test" { - t.Errorf("round-trip module = %q, want %q", roundTrip.Module, "test") - } - if roundTrip.SourcePackage != "github.com/AndroidGoLab/ndk/capi/test" { - t.Errorf("round-trip source_package = %q, want %q", roundTrip.SourcePackage, "github.com/AndroidGoLab/ndk/capi/test") - } - td, ok := roundTrip.Types["TestHandle"] - require.True(t, ok, "round-trip missing type TestHandle") - assert.Equal(t, "opaque_ptr", td.Kind, "round-trip TestHandle.Kind") -} - -func TestWriteSpec_WithStructs(t *testing.T) { - spec := specmodel.Spec{ - Module: "camera", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/camera", - Structs: map[string]specmodel.StructDef{ - "ACameraDevice_StateCallbacks": { - Fields: []specmodel.StructField{ - {Name: "context", Type: "void*"}, - {Name: "onDisconnected", Type: "func_ptr", Params: []specmodel.Param{ - {Name: "context", Type: "void*"}, - {Name: "device", Type: "*ACameraDevice"}, - }}, - {Name: "onError", Type: "func_ptr", Params: []specmodel.Param{ - {Name: "context", Type: "void*"}, - {Name: "device", Type: "*ACameraDevice"}, - {Name: "error", Type: "int"}, - }}, - }, - }, - }, - } - - dir := t.TempDir() - path := filepath.Join(dir, "test.yaml") - err := WriteSpec(spec, path) - require.NoError(t, err) - - data, err := os.ReadFile(path) - require.NoError(t, err) - - var loaded specmodel.Spec - err = yaml.Unmarshal(data, &loaded) - require.NoError(t, err) - - require.Len(t, loaded.Structs["ACameraDevice_StateCallbacks"].Fields, 3) - assert.Equal(t, "context", loaded.Structs["ACameraDevice_StateCallbacks"].Fields[0].Name) - assert.Equal(t, "void*", loaded.Structs["ACameraDevice_StateCallbacks"].Fields[0].Type) - assert.Equal(t, "func_ptr", loaded.Structs["ACameraDevice_StateCallbacks"].Fields[1].Type) - assert.Len(t, loaded.Structs["ACameraDevice_StateCallbacks"].Fields[1].Params, 2) -} - -func TestWriteSpecBadPath(t *testing.T) { - spec := specmodel.Spec{Module: "x"} - // /dev/null/impossible is not a valid directory. - err := WriteSpec(spec, "/dev/null/impossible/spec.yaml") - if err == nil { - t.Error("expected error for invalid path") - } -} diff --git a/tools/pkg/specmodel/.gitkeep b/tools/pkg/specmodel/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tools/pkg/specmodel/spec.go b/tools/pkg/specmodel/spec.go deleted file mode 100644 index 1e303b6..0000000 --- a/tools/pkg/specmodel/spec.go +++ /dev/null @@ -1,50 +0,0 @@ -// Package specmodel defines the YAML spec schema produced by specgen and consumed by idiomgen. -package specmodel - -// Spec is the top-level structure representing one NDK module's extracted API. -type Spec struct { - Module string `yaml:"module"` - SourcePackage string `yaml:"source_package"` - Types map[string]TypeDef `yaml:"types,omitempty"` - Enums map[string][]EnumValue `yaml:"enums,omitempty"` - Functions map[string]FuncDef `yaml:"functions,omitempty"` - Callbacks map[string]CallbackDef `yaml:"callbacks,omitempty"` - Structs map[string]StructDef `yaml:"structs,omitempty"` - Macros map[string]int64 `yaml:"macros,omitempty"` -} - -// TypeDef describes an extracted Go type. -type TypeDef struct { - Kind string `yaml:"kind"` // opaque_ptr, typedef_int32, typedef_uint32, etc. - CType string `yaml:"c_type"` - GoType string `yaml:"go_type"` -} - -// EnumValue is one constant in an enum group. -type EnumValue struct { - Name string `yaml:"name"` - Value int64 `yaml:"value"` -} - -// FuncDef describes an extracted function. -type FuncDef struct { - CName string `yaml:"c_name"` - Params []Param `yaml:"params,omitempty"` - Returns string `yaml:"returns"` -} - -// Param describes a function or callback parameter. -type Param struct { - Name string `yaml:"name"` - Type string `yaml:"type"` - CType string `yaml:"c_type,omitempty"` // normalized C declarator (e.g. char**) - Direction string `yaml:"direction,omitempty"` // "out" for output params - Const bool `yaml:"const,omitempty"` // true if param has const qualifier -} - -// CallbackDef describes an extracted callback function type. -type CallbackDef struct { - Params []Param `yaml:"params,omitempty"` - Returns string `yaml:"returns"` - ReturnsCType string `yaml:"returns_c_type,omitempty"` -} diff --git a/tools/pkg/specmodel/spec_test.go b/tools/pkg/specmodel/spec_test.go deleted file mode 100644 index 5174fd9..0000000 --- a/tools/pkg/specmodel/spec_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package specmodel_test - -import ( - "testing" - - "gopkg.in/yaml.v3" - - "github.com/AndroidGoLab/ndk/tools/pkg/specmodel" -) - -func TestSpecRoundTrip(t *testing.T) { - spec := specmodel.Spec{ - Module: "aaudio", - SourcePackage: "github.com/AndroidGoLab/ndk/capi/aaudio", - Types: map[string]specmodel.TypeDef{ - "AAudioStream": { - Kind: "opaque_ptr", - CType: "AAudioStream", - GoType: "*C.AAudioStream", - }, - }, - Enums: map[string][]specmodel.EnumValue{ - "Aaudio_result_t": { - {Name: "AAUDIO_OK", Value: 0}, - {Name: "AAUDIO_ERROR_BASE", Value: -900}, - }, - }, - Functions: map[string]specmodel.FuncDef{ - "AAudio_createStreamBuilder": { - CName: "AAudio_createStreamBuilder", - Params: []specmodel.Param{ - {Name: "builder", Type: "**AAudioStreamBuilder", CType: "AAudioStreamBuilder**", Direction: "out"}, - }, - Returns: "Aaudio_result_t", - }, - }, - Callbacks: map[string]specmodel.CallbackDef{ - "AAudioStream_dataCallback": { - Params: []specmodel.Param{ - {Name: "stream", Type: "*AAudioStream"}, - {Name: "userData", Type: "unsafe.Pointer"}, - }, - Returns: "Aaudio_data_callback_result_t", - }, - }, - } - - data, err := yaml.Marshal(&spec) - if err != nil { - t.Fatalf("marshal: %v", err) - } - - var got specmodel.Spec - if err := yaml.Unmarshal(data, &got); err != nil { - t.Fatalf("unmarshal: %v", err) - } - - if got.Module != spec.Module { - t.Errorf("module = %q, want %q", got.Module, spec.Module) - } - if got.SourcePackage != spec.SourcePackage { - t.Errorf("source_package = %q, want %q", got.SourcePackage, spec.SourcePackage) - } - if len(got.Types) != 1 { - t.Fatalf("types count = %d, want 1", len(got.Types)) - } - td := got.Types["AAudioStream"] - if td.Kind != "opaque_ptr" || td.CType != "AAudioStream" { - t.Errorf("type = %+v", td) - } - if len(got.Enums["Aaudio_result_t"]) != 2 { - t.Errorf("enums count = %d, want 2", len(got.Enums["Aaudio_result_t"])) - } - if len(got.Functions) != 1 { - t.Errorf("functions count = %d, want 1", len(got.Functions)) - } - fn := got.Functions["AAudio_createStreamBuilder"] - if fn.Params[0].Direction != "out" { - t.Errorf("param direction = %q, want out", fn.Params[0].Direction) - } - if fn.Params[0].CType != "AAudioStreamBuilder**" { - t.Errorf("param C type = %q, want AAudioStreamBuilder**", fn.Params[0].CType) - } - if len(got.Callbacks) != 1 { - t.Errorf("callbacks count = %d, want 1", len(got.Callbacks)) - } -} diff --git a/tools/pkg/specmodel/struct_def.go b/tools/pkg/specmodel/struct_def.go deleted file mode 100644 index e403c52..0000000 --- a/tools/pkg/specmodel/struct_def.go +++ /dev/null @@ -1,6 +0,0 @@ -package specmodel - -// StructDef describes a C struct's fields extracted from NDK headers. -type StructDef struct { - Fields []StructField `yaml:"fields"` -} diff --git a/tools/pkg/specmodel/struct_field.go b/tools/pkg/specmodel/struct_field.go deleted file mode 100644 index 24ee354..0000000 --- a/tools/pkg/specmodel/struct_field.go +++ /dev/null @@ -1,12 +0,0 @@ -package specmodel - -// StructField is one field in a C struct. -type StructField struct { - Name string `yaml:"name"` - Type string `yaml:"type"` - CType string `yaml:"c_type,omitempty"` // normalized C declarator when Go loses pointer identity - Params []Param `yaml:"params,omitempty"` - Returns string `yaml:"returns,omitempty"` // non-void return type for func_ptr fields - ReturnsCType string `yaml:"returns_c_type,omitempty"` - Fields []StructField `yaml:"fields,omitempty"` // nested fields for inline union/struct members -} diff --git a/trace/errors.go b/trace/errors.go deleted file mode 100644 index 5774855..0000000 --- a/trace/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package trace diff --git a/trace/functions.go b/trace/functions.go deleted file mode 100644 index 276c39c..0000000 --- a/trace/functions.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package trace - -import ( - capi "github.com/AndroidGoLab/ndk/capi/trace" -) - -// BeginAsyncSection calls the underlying C function. -func BeginAsyncSection(sectionName string, cookie int32) { - capi.ATrace_beginAsyncSection(sectionName, cookie) -} - -// BeginSection calls the underlying C function. -func BeginSection(sectionName string) { - capi.ATrace_beginSection(sectionName) -} - -// EndAsyncSection calls the underlying C function. -func EndAsyncSection(sectionName string, cookie int32) { - capi.ATrace_endAsyncSection(sectionName, cookie) -} - -// EndSection calls the underlying C function. -func EndSection() { - capi.ATrace_endSection() -} - -// IsEnabled calls the underlying C function. -func IsEnabled() bool { - return (bool)(capi.ATrace_isEnabled()) -} - -// SetCounter calls the underlying C function. -func SetCounter(counterName string, counterValue int64) { - capi.ATrace_setCounter(counterName, counterValue) -} diff --git a/trace/package.go b/trace/package.go deleted file mode 100644 index e867ff6..0000000 --- a/trace/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package trace provides Go bindings for Android native tracing. -package trace diff --git a/util/assert.go b/util/assert.go new file mode 100644 index 0000000..fd3f752 --- /dev/null +++ b/util/assert.go @@ -0,0 +1,156 @@ +// utility +package util + +import ( + "fmt" + "log" + "os" + "runtime" + "runtime/debug" + "strings" +) + +const iCallerSkip = 3 + +type iMode int + +const ( + Fatal = iMode(iota) + Panic + Trace + StackTrace + Print +) + +type iType int + +type AssertPrint interface { + Print(v ...interface{}) +} + +type asserter struct { + mode iMode + out AssertPrint +} + +func New(mode iMode, out AssertPrint) *asserter { + return &asserter{mode: mode, out: out} +} + +func (a *asserter) Mode(mode iMode) (ret iMode) { + std.Assert(mode >= Fatal && Fatal <= Print, "error mode = ", mode) + ret, a.mode = a.mode, mode + return +} + +func (a *asserter) Output(out AssertPrint) { + a.out = out +} + +func (a *asserter) assert(con interface{}, v ...interface{}) { + if con == nil { + return + } + + var s string + switch obj := con.(type) { + case bool: + if !obj { + if len(v) > 0 { + s = assertFmt(a.mode, v...) + } else { + mode := a.mode + if mode != StackTrace { + mode = Trace + } + s = assertFmt(a.mode, "Assert(false)") + } + } + + case error: + s = assertFmt(a.mode, append(v, con)...) + + default: + s = assertFmt(Print, "error <", con, "> must is bool/error.") + } + if s != "" { + switch a.mode { + case Fatal: + a.out.Print(s) + os.Exit(1) + case Panic: + a.out.Print(s) + panic(s) + case Print, Trace, StackTrace: + a.out.Print(s) + } + } +} + +func (a *asserter) Assert(con interface{}, v ...interface{}) { + a.assert(con, v...) +} + +func assertFmt(mode iMode, a ...interface{}) string { + s := fmt.Sprintln(a...) + if mode == StackTrace { + stack := string(debug.Stack()) + + if i := strings.Index(stack, strThisFile); i >= 0 { + i += strings.Index(stack[i:], "\n") + stack = stack[i+1:] + } + + for { + stacks := strings.SplitN(stack, "\n", 3) + if strings.HasPrefix(strings.TrimSpace(stacks[1]), strThisFile) { + stack = stacks[2] + } else { + stack = strings.Join(stacks, "\n") + break + } + } + if stack != "" { + s += "--- caller stack ---\n" + stack + } + } else if mode == Trace { + _, file, line, ok := runtime.Caller(iCallerSkip) + if ok { + s += fmt.Sprint("\t@Caller : ", file, ":", line, "\n") + } + } + return s +} + +type fmtOutput struct{} + +func (*fmtOutput) Print(v ...interface{}) { + fmt.Print(v...) +} + +var ( + Log = log.New(os.Stderr, "", log.LstdFlags) + Fmt = &fmtOutput{} + std = New(Fatal, Log) +) + +// Set assert out mode +func Mode(mode iMode) (ret iMode) { + return std.Mode(mode) +} + +func Output(out AssertPrint) { + std.Output(out) +} + +func Assert(con interface{}, v ...interface{}) { + std.assert(con, v...) +} + +var strThisFile = "assert.go" + +func init() { + if _, file, _, ok := runtime.Caller(0); ok { + strThisFile = file + } +} diff --git a/util/assert_test.go b/util/assert_test.go new file mode 100644 index 0000000..d970096 --- /dev/null +++ b/util/assert_test.go @@ -0,0 +1,82 @@ +// utility +package util + +import "fmt" +import "testing" + +func doAssert(con interface{}, v ...interface{}) { + defer func() { + if err := recover(); err != nil { + fmt.Print(" recover:\n", err) + } + }() + Assert(con, v...) +} + +func testAssert(t *testing.T) { + var err error + doAssert(true) + doAssert(nil) + doAssert(err) + doAssert(true, "bool", "(true)", 1) + doAssert(nil, "nil", "(nil)", 2) + doAssert(err, "error", "(err)", 3) + + doAssert(false) + err = fmt.Errorf("Errof(%d)", 1) + doAssert(err) + + doAssert(false, "bool", "(false)", 4) + doAssert(err, "error", "(err)", 5) +} + +func TestAssert(t *testing.T) { + Mode(Print) + Output(Fmt) + Fmt.Print(">>>>>>>>>> Fmt Print\n") + testAssert(t) + Output(Log) + Log.Print(">>>>>>>>>> Log Print\n") + testAssert(t) + + Mode(Trace) + Output(Fmt) + Fmt.Print(">>>>>>>>>> Fmt Trace\n") + testAssert(t) + Output(Log) + Log.Print(">>>>>>>>>> Log Trace\n") + testAssert(t) + + Mode(StackTrace) + Output(Fmt) + Fmt.Print(">>>>>>>>>> Fmt StackTrace\n") + testAssert(t) + Output(Log) + Log.Print(">>>>>>>>>> Log StackTrace\n") + testAssert(t) +} + +func TestAssertPanic(t *testing.T) { + Mode(Panic) + Output(Fmt) + testAssert(t) + Output(Log) + testAssert(t) +} + +func TestAssertObject(t *testing.T) { + a := New(Print, Fmt) + a.Assert(false, "TestAssertObject Print") + a.Mode(Trace) + a.Assert(false, "TestAssertObject Trace") + a.Mode(StackTrace) + a.Assert(false, "TestAssertObject StackTrace") +} + +func _TestAssertF(t *testing.T) { + Mode(Fatal) + Output(Fmt) + testAssert(t) + Output(Log) + testAssert(t) +} diff --git a/vulkan/constants.go b/vulkan/constants.go deleted file mode 100644 index 9f9120c..0000000 --- a/vulkan/constants.go +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package vulkan - -const ( - VULKAN_H_ = 1 -) diff --git a/vulkan/errors.go b/vulkan/errors.go deleted file mode 100644 index fcd996c..0000000 --- a/vulkan/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package vulkan diff --git a/vulkan/functions.go b/vulkan/functions.go deleted file mode 100644 index fcd996c..0000000 --- a/vulkan/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package vulkan diff --git a/vulkan/package.go b/vulkan/package.go deleted file mode 100644 index 2d51b39..0000000 --- a/vulkan/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package vulkan provides Go bindings for Vulkan on Android. -package vulkan diff --git a/window/errors.go b/window/errors.go deleted file mode 100644 index 21f1bdc..0000000 --- a/window/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package window - -import "fmt" - -// Error represents an NDK error code. -type Error int32 - -func (e Error) Error() string { - return fmt.Sprintf("ndk: error %d", int(e)) -} - -// result converts a C result code to nil or an Error. -func result[T ~int32 | ~uint32 | ~int64](r T) error { - if r >= 0 { - return nil - } - return Error(r) -} diff --git a/window/format.go b/window/format.go deleted file mode 100644 index fed53cf..0000000 --- a/window/format.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package window - -import "fmt" - -type Format int32 - -const ( - Rgba8888 Format = 1 - Rgbx8888 Format = 2 - Rgb565 Format = 4 -) - -func (v Format) String() string { - switch v { - case Rgba8888: - return "Rgba8888" - case Rgbx8888: - return "Rgbx8888" - case Rgb565: - return "Rgb565" - default: - return fmt.Sprintf("Format(%d)", int(v)) - } -} diff --git a/window/functions.go b/window/functions.go deleted file mode 100644 index da8e88f..0000000 --- a/window/functions.go +++ /dev/null @@ -1,3 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package window diff --git a/window/native_window_buffer.go b/window/native_window_buffer.go deleted file mode 100644 index 1a34070..0000000 --- a/window/native_window_buffer.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package window - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/nativewindow" -) - -// NativeWindow_Buffer wraps the NDK ANativeWindow_Buffer handle. -type NativeWindow_Buffer struct { - ptr *capi.ANativeWindow_Buffer -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *NativeWindow_Buffer) cptr() *capi.ANativeWindow_Buffer { - if h == nil { - return nil - } - return h.ptr -} - -// NewNativeWindow_BufferFromPointer wraps a raw ANativeWindow_Buffer pointer. -func NewNativeWindow_BufferFromPointer(ptr unsafe.Pointer) *NativeWindow_Buffer { - return &NativeWindow_Buffer{ptr: (*capi.ANativeWindow_Buffer)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *NativeWindow_Buffer) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *NativeWindow_Buffer) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewNativeWindow_BufferFromUintPtr wraps a uintptr as a NativeWindow_Buffer. -// The caller must ensure ptr points to a valid ANativeWindow_Buffer. -func NewNativeWindow_BufferFromUintPtr(ptr uintptr) *NativeWindow_Buffer { - return &NativeWindow_Buffer{ptr: (*capi.ANativeWindow_Buffer)(unsafe.Pointer(ptr))} -} diff --git a/window/native_window_change_frame_rate_strategy.go b/window/native_window_change_frame_rate_strategy.go deleted file mode 100644 index affb101..0000000 --- a/window/native_window_change_frame_rate_strategy.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package window - -type NativeWindow_ChangeFrameRateStrategy int32 - -const ( - ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS NativeWindow_ChangeFrameRateStrategy = 0 - ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS NativeWindow_ChangeFrameRateStrategy = 1 -) diff --git a/window/native_window_frame_rate_compatibility.go b/window/native_window_frame_rate_compatibility.go deleted file mode 100644 index 91a8ed3..0000000 --- a/window/native_window_frame_rate_compatibility.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package window - -type NativeWindow_FrameRateCompatibility int32 - -const ( - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT NativeWindow_FrameRateCompatibility = 0 - ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE NativeWindow_FrameRateCompatibility = 1 -) diff --git a/window/native_window_transform.go b/window/native_window_transform.go deleted file mode 100644 index 7cb416a..0000000 --- a/window/native_window_transform.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package window - -type NativeWindowTransform int32 - -const ( - ANATIVEWINDOW_TRANSFORM_IDENTITY NativeWindowTransform = 0 - ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL NativeWindowTransform = 1 - ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL NativeWindowTransform = 2 - ANATIVEWINDOW_TRANSFORM_ROTATE_90 NativeWindowTransform = 4 - ANATIVEWINDOW_TRANSFORM_ROTATE_180 NativeWindowTransform = 3 - ANATIVEWINDOW_TRANSFORM_ROTATE_270 NativeWindowTransform = 7 -) diff --git a/window/package.go b/window/package.go deleted file mode 100644 index 0d6d27e..0000000 --- a/window/package.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -// Package window provides Go bindings for Android NativeWindow. -package window diff --git a/window/window.go b/window/window.go deleted file mode 100644 index bd68415..0000000 --- a/window/window.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by idiomgen. DO NOT EDIT. - -package window - -import ( - "unsafe" - - capi "github.com/AndroidGoLab/ndk/capi/nativewindow" -) - -// Window wraps the NDK ANativeWindow handle. -type Window struct { - ptr *capi.ANativeWindow -} - -// cptr returns the underlying C pointer, or nil if h is nil. -// This allows passing optional (nullable) handle parameters to capi functions. -func (h *Window) cptr() *capi.ANativeWindow { - if h == nil { - return nil - } - return h.ptr -} - -// Close releases the underlying NDK handle. -func (h *Window) Close() error { - if h.ptr == nil { - return nil - } - capi.ANativeWindow_release(h.ptr) - h.ptr = nil - return nil -} - -// NewWindowFromPointer wraps a raw ANativeWindow pointer. -func NewWindowFromPointer(ptr unsafe.Pointer) *Window { - return &Window{ptr: (*capi.ANativeWindow)(ptr)} -} - -// Pointer returns the underlying pointer as unsafe.Pointer. -func (h *Window) Pointer() unsafe.Pointer { - return unsafe.Pointer(h.ptr) -} - -// UintPtr returns the underlying pointer as a uintptr. -// This is useful for interop with gomobile bind, golang.org/x/mobile, -// gioui.org, and other packages that represent native handles as uintptr. -func (h *Window) UintPtr() uintptr { - return uintptr(unsafe.Pointer(h.ptr)) -} - -// NewWindowFromUintPtr wraps a uintptr as a Window. -// The caller must ensure ptr points to a valid ANativeWindow. -func NewWindowFromUintPtr(ptr uintptr) *Window { - return &Window{ptr: (*capi.ANativeWindow)(unsafe.Pointer(ptr))} -} - -// Acquire calls the underlying NDK function. -func (h *Window) Acquire() { - capi.ANativeWindow_acquire(h.ptr) -} - -// GetBuffersDataSpace calls the underlying NDK function. -func (h *Window) GetBuffersDataSpace() error { - return result(capi.ANativeWindow_getBuffersDataSpace(h.ptr)) -} - -// GetBuffersDefaultDataSpace calls the underlying NDK function. -func (h *Window) GetBuffersDefaultDataSpace() error { - return result(capi.ANativeWindow_getBuffersDefaultDataSpace(h.ptr)) -} - -// Format returns the value directly. -func (h *Window) Format() int32 { - return (int32)(capi.ANativeWindow_getFormat(h.ptr)) -} - -// Height returns the value directly. -func (h *Window) Height() int32 { - return (int32)(capi.ANativeWindow_getHeight(h.ptr)) -} - -// Width returns the value directly. -func (h *Window) Width() int32 { - return (int32)(capi.ANativeWindow_getWidth(h.ptr)) -} - -// SetBuffersDataSpace calls the underlying NDK function. -func (h *Window) SetBuffersDataSpace(dataSpace int32) error { - return result(capi.ANativeWindow_setBuffersDataSpace(h.ptr, dataSpace)) -} - -// SetBuffersGeometry calls the underlying NDK function. -func (h *Window) SetBuffersGeometry(width int32, height int32, format Format) error { - return result(capi.ANativeWindow_setBuffersGeometry(h.ptr, width, height, int32(format))) -} - -// SetBuffersTransform calls the underlying NDK function. -func (h *Window) SetBuffersTransform(transform int32) error { - return result(capi.ANativeWindow_setBuffersTransform(h.ptr, transform)) -} - -// SetFrameRate calls the underlying NDK function. -func (h *Window) SetFrameRate(frameRate float32, compatibility int8) error { - return result(capi.ANativeWindow_setFrameRate(h.ptr, frameRate, compatibility)) -} - -// SetFrameRateWithChangeStrategy calls the underlying NDK function. -func (h *Window) SetFrameRateWithChangeStrategy(frameRate float32, compatibility int8, changeFrameRateStrategy int8) error { - return result(capi.ANativeWindow_setFrameRateWithChangeStrategy(h.ptr, frameRate, compatibility, changeFrameRateStrategy)) -} - -// TryAllocateBuffers calls the underlying NDK function. -func (h *Window) TryAllocateBuffers() { - capi.ANativeWindow_tryAllocateBuffers(h.ptr) -} - -// UnlockAndPost calls the underlying NDK function. -func (h *Window) UnlockAndPost() error { - return result(capi.ANativeWindow_unlockAndPost(h.ptr)) -}