#pragma once #include #include #if defined(__GNUC__) #define MC_X4_API __attribute__((visibility("default"))) #else #define MC_X4_API #endif #ifdef __cplusplus extern "C" { #endif // Private ABI v2. One handle in each physically isolated camera worker. The // caller must restrict USB access BEFORE loading this library or discovering. typedef struct mc_x4 mc_x4; enum mc_x4_action { MC_X4_STATUS = 1, MC_X4_SETTINGS_READ = 2, MC_X4_SETTINGS_APPLY = 3, MC_X4_PREVIEW_START = 4, MC_X4_PREVIEW_STOP = 5, MC_X4_RECORD_START = 6, MC_X4_RECORD_STOP = 7, MC_X4_PHOTO = 8, MC_X4_FILES = 9 }; typedef struct mc_x4_video { uint64_t sequence; uint64_t generation; // changes on queue overflow / preview restart int64_t timestamp; // camera clock; units are not assumed by the bridge int32_t stream_index; int32_t codec; // 0 = H264, 1 = H265 uint32_t bytes; int32_t stream_type; // original CameraSDK callback marker, NOT a codec enum uint64_t calibration_revision; // identifies this preview's exact metadata } mc_x4_video; MC_X4_API int mc_x4_abi(void); MC_X4_API mc_x4* mc_x4_open(const char* expected_serial, const char* private_log_directory); // JSON result owned by the handle; copy before the next call. Calls are // serialized by the worker. No vendor exception or C++ object crosses the ABI. MC_X4_API const char* mc_x4_call(mc_x4*, int action, int mode, const char* key, double value); // Serialized with control calls. Only an exact current camera-list entry is // admitted. Destination is selected inside the private worker, never by a UI. typedef void (*mc_x4_download_progress)(int64_t downloaded, int64_t total); MC_X4_API int mc_x4_download(mc_x4*, const char* remote, const char* local, mc_x4_download_progress); // The SDK explicitly provides cancellation for an in-progress download. MC_X4_API void mc_x4_cancel_download(mc_x4*); MC_X4_API int mc_x4_read_video(mc_x4*, mc_x4_video*, uint8_t* buffer, size_t capacity); // Does not call StopRecording or change auto-stop-on-disconnect policy. MC_X4_API void mc_x4_close(mc_x4*); #ifdef __cplusplus } #endif