Initial commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#ifndef CAMERA_HAL_ICAMERA_DEVICE_H
|
||||
#define CAMERA_HAL_ICAMERA_DEVICE_H
|
||||
|
||||
#include "types.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace camera_hal {
|
||||
|
||||
// ICameraDevice AIDL v4 interface
|
||||
// Mirrors: hardware/interfaces/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl
|
||||
class ICameraDevice {
|
||||
public:
|
||||
virtual ~ICameraDevice() = default;
|
||||
|
||||
virtual int32_t open(void* callback) = 0;
|
||||
virtual int32_t openInjectionSession(void* callback) = 0;
|
||||
virtual int32_t setTorchMode(bool enabled) = 0;
|
||||
virtual int32_t dumpState(int32_t fd) = 0;
|
||||
virtual int32_t getCameraCharacteristics(void* characteristics) = 0;
|
||||
virtual int32_t getPhysicalCameraCharacteristics(
|
||||
const char* physical_camera_id,
|
||||
void* characteristics) = 0;
|
||||
virtual int32_t close() = 0;
|
||||
};
|
||||
|
||||
// Function pointer types for dlsym
|
||||
typedef int32_t (*ICameraDevice_open_t)(void* self, void* callback);
|
||||
typedef int32_t (*ICameraDevice_close_t)(void* self);
|
||||
typedef int32_t (*ICameraDevice_getCameraCharacteristics_t)(
|
||||
void* self, void* characteristics);
|
||||
|
||||
} // namespace camera_hal
|
||||
|
||||
#endif // CAMERA_HAL_ICAMERA_DEVICE_H
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef CAMERA_HAL_ICAMERA_DEVICE_SESSION_H
|
||||
#define CAMERA_HAL_ICAMERA_DEVICE_SESSION_H
|
||||
|
||||
#include "types.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace camera_hal {
|
||||
|
||||
// ICameraDeviceSession AIDL v4 interface
|
||||
// Mirrors: hardware/interfaces/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl
|
||||
class ICameraDeviceSession {
|
||||
public:
|
||||
virtual ~ICameraDeviceSession() = default;
|
||||
|
||||
virtual int32_t configureStreams(
|
||||
const Stream* streams,
|
||||
int32_t stream_count,
|
||||
StreamConfigurationMode mode,
|
||||
HalStreamConfiguration* out_config) = 0;
|
||||
|
||||
virtual int32_t processCaptureRequest(
|
||||
const CaptureRequest* requests,
|
||||
int32_t request_count,
|
||||
int32_t* out_num_request_processed) = 0;
|
||||
|
||||
virtual int32_t flush() = 0;
|
||||
virtual int32_t close() = 0;
|
||||
virtual int32_t signalStreamFlush(const int32_t* stream_ids, int32_t count) = 0;
|
||||
virtual int32_t getCaptureRequestMetadataQueue(void* queue) = 0;
|
||||
virtual int32_t getCaptureResultMetadataQueue(void* queue) = 0;
|
||||
virtual int32_t switchToOffline(
|
||||
const int32_t* streams_to_keep,
|
||||
int32_t count,
|
||||
void* out_offline_session) = 0;
|
||||
virtual int32_t isReconfigurationRequired(
|
||||
const void* old_session_params,
|
||||
const void* new_session_params,
|
||||
bool* out_required) = 0;
|
||||
};
|
||||
|
||||
// Function pointer types for dlsym
|
||||
typedef int32_t (*ICameraDeviceSession_configureStreams_t)(
|
||||
void* self,
|
||||
const Stream* streams,
|
||||
int32_t stream_count,
|
||||
StreamConfigurationMode mode,
|
||||
HalStreamConfiguration* out_config);
|
||||
|
||||
typedef int32_t (*ICameraDeviceSession_processCaptureRequest_t)(
|
||||
void* self,
|
||||
const CaptureRequest* requests,
|
||||
int32_t request_count,
|
||||
int32_t* out_num_request_processed);
|
||||
|
||||
typedef int32_t (*ICameraDeviceSession_flush_t)(void* self);
|
||||
typedef int32_t (*ICameraDeviceSession_close_t)(void* self);
|
||||
|
||||
} // namespace camera_hal
|
||||
|
||||
#endif // CAMERA_HAL_ICAMERA_DEVICE_SESSION_H
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef CAMERA_HAL_ICAMERA_PROVIDER_H
|
||||
#define CAMERA_HAL_ICAMERA_PROVIDER_H
|
||||
|
||||
#include "types.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace camera_hal {
|
||||
|
||||
// ICameraProvider AIDL v3 interface
|
||||
// Mirrors: hardware/interfaces/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl
|
||||
class ICameraProvider {
|
||||
public:
|
||||
virtual ~ICameraProvider() = default;
|
||||
|
||||
virtual int32_t setCallback(void* callback) = 0;
|
||||
virtual int32_t getCameraIdList(char*** camera_ids, int32_t* count) = 0;
|
||||
virtual int32_t getCameraDeviceInterface(
|
||||
const char* camera_id,
|
||||
void** out_device) = 0;
|
||||
virtual int32_t notifyDeviceStateChange(int64_t device_state) = 0;
|
||||
virtual int32_t getConcurrentStreamingCameraIds(
|
||||
char*** camera_ids, int32_t* count) = 0;
|
||||
virtual int32_t openSession(
|
||||
const char* camera_id,
|
||||
void* callback,
|
||||
void** out_session) = 0;
|
||||
virtual int32_t getVendorTags(void* tags) = 0;
|
||||
virtual int32_t getCameraCharacteristics(
|
||||
const char* camera_id,
|
||||
void* characteristics) = 0;
|
||||
};
|
||||
|
||||
typedef int32_t (*ICameraProvider_getCameraIdList_t)(
|
||||
void* self, char*** camera_ids, int32_t* count);
|
||||
typedef int32_t (*ICameraProvider_getCameraDeviceInterface_t)(
|
||||
void* self, const char* camera_id, void** out_device);
|
||||
typedef int32_t (*ICameraProvider_openSession_t)(
|
||||
void* self, const char* camera_id, void* callback, void** out_session);
|
||||
|
||||
} // namespace camera_hal
|
||||
|
||||
#endif // CAMERA_HAL_ICAMERA_PROVIDER_H
|
||||
@@ -0,0 +1,103 @@
|
||||
#ifndef CAMERA_HAL_TYPES_H
|
||||
#define CAMERA_HAL_TYPES_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
// AIDL Camera HAL v4 common types
|
||||
// These mirror the AIDL interface types from hardware/interfaces/camera/
|
||||
|
||||
namespace camera_hal {
|
||||
|
||||
// Stream format constants (matching AIDL CameraMetadata)
|
||||
enum StreamFormat : int32_t {
|
||||
FORMAT_YUV_420_888 = 32,
|
||||
FORMAT_IMPLEMENTATION_DEFINED = 35,
|
||||
FORMAT_BLOB_JPEG = 37,
|
||||
FORMAT_RAW16 = 38,
|
||||
FORMAT_RAW_PRIVATE = 39,
|
||||
FORMAT_RAW10 = 40,
|
||||
FORMAT_RAW12 = 41,
|
||||
FORMAT_DEPTH16 = 42,
|
||||
FORMAT_DEPTH_POINT_CLOUD = 43,
|
||||
FORMAT_PRIVATE = 50,
|
||||
};
|
||||
|
||||
// Stream direction
|
||||
enum StreamDirection : int32_t {
|
||||
STREAM_OUTPUT = 0,
|
||||
STREAM_INPUT = 1,
|
||||
};
|
||||
|
||||
// Stream configuration
|
||||
struct Stream {
|
||||
int32_t id;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
StreamFormat format;
|
||||
StreamDirection direction;
|
||||
int32_t usage;
|
||||
int32_t rotation;
|
||||
int32_t data_space;
|
||||
void* physical_camera_id; // nullable
|
||||
};
|
||||
|
||||
// Buffer status
|
||||
enum BufferStatus : int32_t {
|
||||
BUFFER_STATUS_OK = 0,
|
||||
BUFFER_STATUS_ERROR = 1,
|
||||
BUFFER_STATUS_NO_BUFFER = 2,
|
||||
};
|
||||
|
||||
// Camera buffer descriptor (wraps AHardwareBuffer / GraphicBuffer)
|
||||
struct CameraBuffer {
|
||||
int32_t stream_id;
|
||||
int64_t buffer_id;
|
||||
void* handle; // AHardwareBuffer* or native_handle_t*
|
||||
int32_t status;
|
||||
int64_t timestamp;
|
||||
void* acquire_fence;
|
||||
void* release_fence;
|
||||
};
|
||||
|
||||
// Capture request
|
||||
struct CaptureRequest {
|
||||
int32_t frame_number;
|
||||
int32_t settings_count;
|
||||
void* settings; // CameraMetadata*
|
||||
int32_t input_buffer_present;
|
||||
CameraBuffer* input_buffer;
|
||||
int32_t output_buffer_count;
|
||||
CameraBuffer* output_buffers;
|
||||
int32_t physical_camera_id_count;
|
||||
void* physical_camera_ids;
|
||||
void* physical_camera_settings;
|
||||
};
|
||||
|
||||
// Capture result
|
||||
struct CaptureResult {
|
||||
int32_t frame_number;
|
||||
void* result; // CameraMetadata*
|
||||
int32_t output_buffer_count;
|
||||
CameraBuffer* output_buffers;
|
||||
int32_t physical_camera_metadata_count;
|
||||
void* physical_camera_ids;
|
||||
void* physical_camera_metadata;
|
||||
};
|
||||
|
||||
// Stream configuration mode
|
||||
enum StreamConfigurationMode : int32_t {
|
||||
NORMAL_MODE = 0,
|
||||
CONSTRAINED_HIGH_SPEED_MODE = 1,
|
||||
};
|
||||
|
||||
// HalStreamConfiguration (result of configureStreams)
|
||||
struct HalStreamConfiguration {
|
||||
int32_t stream_count;
|
||||
Stream* streams;
|
||||
StreamConfigurationMode mode;
|
||||
};
|
||||
|
||||
} // namespace camera_hal
|
||||
|
||||
#endif // CAMERA_HAL_TYPES_H
|
||||
Reference in New Issue
Block a user