Skip to main content

SPECS NDK Overview

The SPECS NDK builds native C and C++ libraries for Lenses on SPECS, with C APIs for media, audio, camera, location and logging.

The SPECS NDK is a cross-compilation toolkit for building native C and C++ libraries for Lenses on SPECS (ARMv8-A 64-bit). A Lens uses such a library for code that needs native performance or the SPECS platform APIs, and you can build the same library for the macOS Simulator to run it in Lens Studio. The SPECS NDK provides C APIs for media playback, audio I/O, camera access, encoded camera/AR/audio recording, finalized MP4 capture, GPU texture output of media frames, foreground audio session coordination, location services, system logging, and app directory resolution.

These pages document SPECS NDK v1.3.0.

What's included in the SPECS NDK

  • Clang cross-compiler for macOS and Windows hosts (18.1.8 on macOS, 22 on Windows through llvm-mingw)
  • CMake toolchain files for immediate project integration, plus a macOS Simulator toolchain (see macOS Simulator)
  • Platform APIs:
    • SpecsPlayer: high-level media playback (video + audio); supports live video device capture, dual-track AR overlay, and display-layer visibility control
    • SpecsMediaCodec: low-level encode/decode pipeline
    • SpecsMediaExtractor: demux raw samples from media files
    • SpecsMediaPresenter: timed presentation of decoded media buffers to display
    • SpecsMediaBuffer: reference-counted hardware buffer management
    • SpecsMediaGLTexture: zero-copy update of caller-owned OpenGL ES textures from SpecsMediaBuffer video frames
    • SpecsRecorder: encoded camera video, AR video, and audio stream recording (H.264 / H.265, AAC)
    • SpecsCapture: one-shot camera+microphone recording finalized to an MP4 file descriptor
    • SpecsAudioPlayback: PCM audio output to speaker/submix, with listener-relative source pose updates for spatial audio
    • SpecsAudioRecord: microphone and audio input capture
    • SpecsForegroundAudioSession: system-managed foreground audio session coordinator (audio content, call, and audio focus sessions)
    • SpecsCamera: camera stream management with ISP control
    • SpecsLocation: fused location provider (GPS, heading, speed)
    • SpecsLog: system logging (printf-style, per-level macros)
    • SpecsFs: the app's well-known data and library root directories (header-only on the device)
  • Permission annotations and tooling: SpecsPermissions.h declares the OS permission each SPECS API requires; the toolchain automatically embeds a .snap.permissions manifest into your .so (see Permission Annotations and Manifest Embedding)
  • Version header: SpecsNDKVersion.h exposes the NDK release version as compile-time macros (SPECS_NDK_VERSION_MAJOR/MINOR/PATCH, SPECS_NDK_VERSION_STRING)
  • Open source libraries you can link: OpenSSL 3.5.7 (security and cryptography), libcurl 8.7.1 (networking) and zlib 1.3.1 (compression); see Open Source Libraries

SPECS NDK platform details

PropertyValue
Target architectureARMv8-A 64-bit (aarch64)
Target OSSPECS (aarch64-snap-linux)
HostmacOS (darwin21) or Windows
NDK version1.3.0
Minimum SPECS OSSPECS OS 3.0.0 or later on the device

Get the SPECS NDK

The SPECS NDK ships as a host tarball for each supported build host: macOS and Windows. Both produce identical aarch64 target binaries; only the host tools differ. The packages, and their matching OSS source packages, are on the Downloads page.

Quick start

# Configure your project with the Clang toolchain
cmake -B build \
-DCMAKE_TOOLCHAIN_FILE=/path/to/specsndk-armv8-1.3.0/SpecsNDK-Toolchain-Clang.cmake \
-DCMAKE_BUILD_TYPE=Release

cmake --build build

For a full walkthrough including a minimal project example, start with Prerequisites and NDK Layout.

SPECS NDK API summary

APIHeaderLibraryUse case
SpecsPlayerSpecsPlayer.h-lspecs_playerPlay media files with minimal setup
SpecsMediaCodecSpecsMediaCodec.h-lspecs_mediaLow-level encode/decode pipeline
SpecsMediaExtractorSpecsMediaExtractor.h-lspecs_mediaDemux raw samples from media files
SpecsMediaPresenterSpecsMediaPresenter.h-lspecs_mediaTimed presentation of decoded buffers to display
SpecsMediaBufferSpecsMediaBuffer.h-lspecs_mediaReference-counted hardware buffer management
SpecsMediaGLTextureSpecsMediaGLTexture.h-lspecs_mediaUpdate a caller-owned OpenGL ES texture from a SpecsMediaBuffer video frame without a CPU copy
SpecsRecorderSpecsRecorder.h-lspecs_mediaEncoded camera video, AR video, or audio stream recording
SpecsCaptureSpecsCapture.h-lspecs_mediaOne-shot camera+mic recording finalized to an MP4 file descriptor
SpecsAudioPlaybackSpecsAudioPlayback.h-lspecs_audio_playbackOutput PCM audio to speaker/submix
SpecsAudioRecordSpecsAudioRecord.h-lspecs_audio_recordCapture audio from microphone
SpecsForegroundAudioSessionSpecsForegroundAudioSessionCoordinator.h-lspecs_foreground_audioRegister audio content, call, and focus sessions with the system coordinator
SpecsCameraSpecsCameraManager.h-lspecs_cameraCamera stream management
SpecsLocationSpecsLocationProvider.h-lspecs_locationFused location (GPS, heading, speed)
SpecsLogSpecsLog.h-lspecs_logSystem logging (printf-style, per-level macros)
SpecsFsSpecsFs.hNone (header-only on the device)Resolve the app's data and library root directories