From: Chanwoo Choi Date: Thu, 20 Jun 2024 04:49:48 +0000 (+0900) Subject: Add support for HAL_MODULE_CAMERA v1.0 interface X-Git-Tag: accepted/tizen/unified/20240805.114552~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0236b9d15a73d73fa785e44dc6253d0b3aa5c5c7;p=platform%2Fhal%2Fapi%2Fcamera.git Add support for HAL_MODULE_CAMERA v1.0 interface HAL_MODULE_CAMERA will support the multiple version of HAL interface. So that v1.0 is first supported version of HAL_MODULE_CAMERA. hal-camera-interface-1.h contains v1.0 HAL interface. Change-Id: I9552ba5cd1bf5079641b55a767129fd9ffdd97ee Signed-off-by: Chanwoo Choi --- diff --git a/include/hal-camera-interface-1.h b/include/hal-camera-interface-1.h new file mode 100644 index 0000000..91be795 --- /dev/null +++ b/include/hal-camera-interface-1.h @@ -0,0 +1,697 @@ +/* + * HAL (Hardware Abstract Layer) interface API for Camera + * + * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * + * 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. + */ + +#ifndef __HAL_CAMERA_INTERFACE_1__ +#define __HAL_CAMERA_INTERFACE_1__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file hal-camera-interface.h + * @brief This file contains the Tizen camera HAL interface API, related structures and enumerations. + * @since_tizen 6.5 + */ + +#define BUFFER_PLANE_MAX 4 +#define DEVICE_COUNT_MAX 16 +#define RESOLUTION_COUNT_MAX 32 +#define FPS_COUNT_MAX 16 +#define DEVICE_NAME_LENGTH_MAX 16 +#define DEVICE_NODE_PATH_LENGTH_MAX 16 + +/** + * @addtogroup HAL_CAMERA_INTERFACE_MODULE + * @{ + */ + +/** + * @brief Enumeration for the camera error. + * @since_tizen 6.5 + */ +typedef enum camera_error { + CAMERA_ERROR_NONE = 0, + CAMERA_ERROR_INVALID_PARAMETER = (int32_t)0x80002001, + CAMERA_ERROR_INVALID_STATE = (int32_t)0x80002002, + CAMERA_ERROR_PERMISSION_DENIED = (int32_t)0x80002003, + CAMERA_ERROR_OUT_OF_MEMORY = (int32_t)0x80002004, + CAMERA_ERROR_DEVICE_OPEN = (int32_t)0x80002005, + CAMERA_ERROR_DEVICE_NOT_FOUND = (int32_t)0x80002006, + CAMERA_ERROR_DEVICE_UNAVAILABLE = (int32_t)0x80002007, + CAMERA_ERROR_DEVICE_NOT_SUPPORTED = (int32_t)0x80002008, + CAMERA_ERROR_DEVICE_READ = (int32_t)0x80002009, + CAMERA_ERROR_DEVICE_WRITE = (int32_t)0x8000200a, + CAMERA_ERROR_DEVICE_BUSY = (int32_t)0x8000200b, + CAMERA_ERROR_DEVICE_TIME_OUT = (int32_t)0x8000200c, + CAMERA_ERROR_DEVICE_ESD = (int32_t)0x8000200d, + CAMERA_ERROR_INTERNAL = (int32_t)0x8000200e, + + CAMERA_ERROR_NOT_IMPLEMENTED = (int32_t)0x80002ffe, + CAMERA_ERROR_UNKNOWN = (int32_t)0x80002fff +} camera_error_e; + +/** + * @brief Enumeration for the camera state. + * @since_tizen 6.5 + */ +typedef enum camera_state { + CAMERA_STATE_INITIALIZED, + CAMERA_STATE_OPENED, + CAMERA_STATE_PREVIEWING, + CAMERA_STATE_CAPTURING, + CAMERA_STATE_RECORDING, + CAMERA_STATE_RECORDING_SNAPSHOT +} camera_state_e; + +/** + * @brief Enumeration for the camera network state. + * @since_tizen 8.0 + */ +typedef enum camera_network_state { + CAMERA_NETWORK_STATE_PLAYING, + CAMERA_NETWORK_STATE_PAUSED +} camera_network_state_e; + +/** + * @brief The structure type of the resolution. + * @since_tizen 6.5 + */ +typedef struct camera_resolution { + uint32_t width; + uint32_t height; +} camera_resolution_s; + +/** + * @brief The structure type of the fraction. + * @since_tizen 6.5 + */ +typedef struct camera_fraction { + int numerator; + int denominator; +} camera_fraction_s; + +/** + * @brief The structure type of the rectangle. + * @since_tizen 6.5 + */ +typedef struct camera_rectangle { + int x; + int y; + uint32_t width; + uint32_t height; +} camera_rectangle_s; + +/** + * @brief Enumeration for the camera pixel format. + * @since_tizen 6.5 + */ +typedef enum camera_pixel_format { + /* YUV */ + CAMERA_PIXEL_FORMAT_NV12 = 0x0000, + CAMERA_PIXEL_FORMAT_NV21, + CAMERA_PIXEL_FORMAT_I420, + CAMERA_PIXEL_FORMAT_YV12, + CAMERA_PIXEL_FORMAT_YUYV, + CAMERA_PIXEL_FORMAT_UYVY, + + /* RGB */ + CAMERA_PIXEL_FORMAT_BGRA8888, + CAMERA_PIXEL_FORMAT_ARGB8888, + + /* ENCODED */ + CAMERA_PIXEL_FORMAT_JPEG, + CAMERA_PIXEL_FORMAT_H264, + CAMERA_PIXEL_FORMAT_MJPEG, + CAMERA_PIXEL_FORMAT_VP8, + CAMERA_PIXEL_FORMAT_VP9, + + /* DEPTH */ + CAMERA_PIXEL_FORMAT_DEPTH, + + /* MAX */ + CAMERA_PIXEL_FORMAT_MAX +} camera_pixel_format_e; + +/** + * @brief Enumeration for the focus state. + * @since_tizen 6.5 + */ +typedef enum camera_focus_state { + CAMERA_FOCUS_STATE_RELEASED, + CAMERA_FOCUS_STATE_ONGOING, + CAMERA_FOCUS_STATE_FOCUSED, + CAMERA_FOCUS_STATE_FAILED +} camera_focus_state_e; + +/** + * @brief Enumeration for the facing direction of camera device. + * @since_tizen 6.5 + */ +typedef enum camera_facing_direction { + CAMERA_FACING_DIRECTION_REAR, + CAMERA_FACING_DIRECTION_FRONT, + CAMERA_FACING_DIRECTION_EXTERNAL +} camera_facing_direction_e; + +/** + * @brief Enumeration for the camera rotation. + * @since_tizen 6.5 + */ +typedef enum camera_rotation { + CAMERA_ROTATION_0, + CAMERA_ROTATION_90, + CAMERA_ROTATION_180, + CAMERA_ROTATION_270 +} camera_rotation_e; + +/** + * @brief Enumeration for the auto exposure status. + * @since_tizen 7.0 + */ +typedef enum camera_status_auto_exposure { + CAMERA_STATUS_AUTO_EXPOSURE_NONE, + CAMERA_STATUS_AUTO_EXPOSURE_UNSTABLE, + CAMERA_STATUS_AUTO_EXPOSURE_STABLE +} camera_status_auto_exposure_e; + +/** + * @brief Enumeration for the auto white balance status. + * @since_tizen 7.0 + */ +typedef enum camera_status_auto_white_balance { + CAMERA_STATUS_AUTO_WHITE_BALANCE_NONE, + CAMERA_STATUS_AUTO_WHITE_BALANCE_UNSTABLE, + CAMERA_STATUS_AUTO_WHITE_BALANCE_STABLE +} camera_status_auto_white_balance_e; + +/** + * @brief Enumeration for the camera flip. + * @since_tizen 6.5 + */ +typedef enum camera_flip { + CAMERA_FLIP_NONE, + CAMERA_FLIP_HORIZONTAL, + CAMERA_FLIP_VERTICAL, + CAMERA_FLIP_BOTH +} camera_flip_e; + +/** + * @brief The structure type of the camera plane. + * @since_tizen 6.5 + */ +typedef struct camera_plane { + unsigned char *data; + uint32_t align_width; + uint32_t align_height; + uint32_t size; + uint32_t bytesused; /* The number of bytes occupied by data (Since 7.0) */ +} camera_plane_s; + +/** + * @brief The structure type of the camera buffer. + * @since_tizen 6.5 + */ +typedef struct camera_buffer { + int index; + camera_pixel_format_e format; + camera_resolution_s resolution; + uint32_t total_size; + uint32_t num_planes; + camera_plane_s planes[BUFFER_PLANE_MAX]; + uint32_t num_bos; + void *bos[BUFFER_PLANE_MAX]; +} camera_buffer_s; + +/** + * @brief The structure type of the camera metadata. + * @since_tizen 6.5 + */ +typedef struct camera_metadata { + int is_flashed; + camera_fraction_s focal_length; + camera_fraction_s aperture_f_number; + camera_fraction_s shutter_speed; + camera_fraction_s exposure_time; + camera_fraction_s brightness; + camera_resolution_s exif_image; + int iso; + int metering_mode; + int color_space; + int component_configuration; + int aperture_in_apex; + int is_delta_frame; /* Flag for encoded delta frame */ + camera_focus_state_e focus_state; + camera_facing_direction_e facing_direction; + camera_flip_e flip; + camera_rotation_e rotation; + camera_status_auto_exposure_e status_ae; + camera_status_auto_white_balance_e status_awb; +} camera_metadata_s; + +/** + * @brief The structure type of the camera format. + * @since_tizen 6.5 + */ +typedef struct camera_format { + camera_pixel_format_e stream_format; + camera_resolution_s stream_resolution; + uint32_t stream_fps; + camera_rotation_e stream_rotation; + camera_pixel_format_e capture_format; + camera_resolution_s capture_resolution; + uint32_t capture_quality; + uint32_t stream_bitrate; +} camera_format_s; + +/** + * @brief Enumeration for the focus mode. + * @since_tizen 6.5 + */ +typedef enum camera_focus_mode { + CAMERA_FOCUS_MODE_NONE, + CAMERA_FOCUS_MODE_PAN, + CAMERA_FOCUS_MODE_AUTO, + CAMERA_FOCUS_MODE_CONTINUOUS_AUTO +} camera_focus_mode_e; + +/** + * @brief Enumeration for the focus range. + * @since_tizen 6.5 + */ +typedef enum camera_focus_range { + CAMERA_FOCUS_RANGE_NONE, + CAMERA_FOCUS_RANGE_NORMAL, + CAMERA_FOCUS_RANGE_MACRO, + CAMERA_FOCUS_RANGE_FULL +} camera_focus_range_e; + +/** + * @brief Enumeration for the white balance. + * @since_tizen 6.5 + */ +typedef enum camera_white_balance { + CAMERA_WHITE_BALANCE_AUTO, /**< Automatic */ + CAMERA_WHITE_BALANCE_DAYLIGHT, /**< Daylight */ + CAMERA_WHITE_BALANCE_CLOUDY, /**< Cloudy */ + CAMERA_WHITE_BALANCE_FLUORESCENT, /**< Fluorescent */ + CAMERA_WHITE_BALANCE_INCANDESCENT, /**< Incandescent */ + CAMERA_WHITE_BALANCE_SHADE, /**< Shade */ + CAMERA_WHITE_BALANCE_HORIZON, /**< Horizon */ + CAMERA_WHITE_BALANCE_FLASH /**< Flash */ +} camera_white_balance_e; + +/** + * @brief Enumeration for the effect. + * @since_tizen 6.5 + */ +typedef enum camera_effect { + CAMERA_EFFECT_NONE, /**< None */ + CAMERA_EFFECT_MONO, /**< Mono */ + CAMERA_EFFECT_SEPIA, /**< Sepia */ + CAMERA_EFFECT_NEGATIVE, /**< Negative */ + CAMERA_EFFECT_RED, /**< Red */ + CAMERA_EFFECT_GREEN, /**< Green */ + CAMERA_EFFECT_BLUE, /**< Blue */ + CAMERA_EFFECT_AQUA, /**< Aqua */ + CAMERA_EFFECT_ANTIQUE, /**< Antique */ + CAMERA_EFFECT_WARM, /**< Warm */ + CAMERA_EFFECT_EMBOSS, /**< Emboss */ + CAMERA_EFFECT_SKETCH, /**< Sketch */ + CAMERA_EFFECT_SOLARIZATION, /**< Solarization */ + CAMERA_EFFECT_POSTERIZATION, /**< Posterization */ + CAMERA_EFFECT_CARTOON /**< Cartoon */ +} camera_effect_e; + +/** + * @brief Enumeration for the scene mode. + * @since_tizen 6.5 + */ +typedef enum camera_scene_mode { + CAMERA_SCENE_MODE_NORMAL, /**< Normal */ + CAMERA_SCENE_MODE_PORTRAIT, /**< Portrait */ + CAMERA_SCENE_MODE_LANDSCAPE, /**< Landscape */ + CAMERA_SCENE_MODE_SPORTS, /**< Sports */ + CAMERA_SCENE_MODE_PARTY_N_INDOOR, /**< Party & indoor */ + CAMERA_SCENE_MODE_BEACH_N_INDOOR, /**< Beach & indoor */ + CAMERA_SCENE_MODE_SUNSET, /**< Sunset */ + CAMERA_SCENE_MODE_DUSK_N_DAWN, /**< Dusk & dawn */ + CAMERA_SCENE_MODE_FALL_COLOR, /**< Fall */ + CAMERA_SCENE_MODE_NIGHT_SCENE, /**< Night scene */ + CAMERA_SCENE_MODE_FIREWORK, /**< Firework */ + CAMERA_SCENE_MODE_TEXT, /**< Text */ + CAMERA_SCENE_MODE_SHOW_WINDOW, /**< Show window */ + CAMERA_SCENE_MODE_CANDLE_LIGHT, /**< Candle light */ + CAMERA_SCENE_MODE_BACKLIGHT, /**< Backlight */ + CAMERA_SCENE_MODE_AQUA /**< Aqua */ +} camera_scene_mode_e; + +/** + * @brief Enumeration for the exposure mode. + * @since_tizen 6.5 + */ +typedef enum camera_exposure_mode { + CAMERA_EXPOSURE_MODE_OFF = 0, /**< Off */ + CAMERA_EXPOSURE_MODE_ALL, /**< All mode */ + CAMERA_EXPOSURE_MODE_CENTER, /**< Center mode */ + CAMERA_EXPOSURE_MODE_SPOT, /**< Spot mode */ + CAMERA_EXPOSURE_MODE_CUSTOM, /**< Custom mode */ + CAMERA_EXPOSURE_MODE_SHUTTER_PRIORITY, /**< Shutter priority mode */ + CAMERA_EXPOSURE_MODE_APERTURE_PRIORITY /**< Aperture priority mode */ +} camera_exposure_mode_e; + +/** + * @brief Enumeration for the shot mode. + * @since_tizen 6.5 + */ +typedef enum camera_shot_mode { + CAMERA_SHOT_MODE_NORMAL = 0, /**< Normal */ + CAMERA_SHOT_MODE_CONTINUOUS, /**< Continuous */ + CAMERA_SHOT_MODE_HDR, /**< HDR */ + CAMERA_SHOT_MODE_NIGHT /**< Night */ +} camera_shot_mode_e; + +/** + * @brief Enumeration for the flash mode. + * @since_tizen 6.5 + */ +typedef enum camera_flash_mode { + CAMERA_FLASH_MODE_OFF = 0, /**< Always off */ + CAMERA_FLASH_MODE_ON, /**< Always splashes */ + CAMERA_FLASH_MODE_AUTO, /**< Depending on intensity of light, strobe starts to flash */ + CAMERA_FLASH_MODE_REDEYE_REDUCTION, /**< Red eye reduction. Multiple flash before capturing */ + CAMERA_FLASH_MODE_SLOW_SYNC, /**< Slow sync curtain synchronization */ + CAMERA_FLASH_MODE_FRONT_CURTAIN, /**< Front curtain synchronization */ + CAMERA_FLASH_MODE_REAR_CURTAIN, /**< Rear curtain synchronization */ + CAMERA_FLASH_MODE_PERMANENT, /**< Keep turned on until turning off */ +} camera_flash_mode_e; + +/** + * @brief Enumeration for the face detection. + * @since_tizen 6.5 + */ +typedef enum camera_face_detection { + CAMERA_FACE_DETECTION_OFF = 0, /**< Face detection off */ + CAMERA_FACE_DETECTION_ON /**< Face detection on */ +} camera_face_detection_e; + +/** + * @brief Enumeration for the PTZ(Pan Tilt Zoom) type. + * @since_tizen 6.5 + */ +typedef enum camera_ptz_type { + CAMERA_PTZ_TYPE_MECHANICAL = 0, /**< Move the camera device physically */ + CAMERA_PTZ_TYPE_ELECTRONIC /**< Zoom digitally and move into portion of the image */ +} camera_ptz_type_e; + +/** + * @brief Definitions for the camera command. + * @since_tizen 6.5 + */ +#define CAMERA_COMMAND_BASE ((int64_t)1) +#define CAMERA_COMMAND_WHITE_BALANCE ((int64_t)(CAMERA_COMMAND_BASE << 1)) +#define CAMERA_COMMAND_ISO ((int64_t)(CAMERA_COMMAND_BASE << 2)) +#define CAMERA_COMMAND_CONTRAST ((int64_t)(CAMERA_COMMAND_BASE << 3)) +#define CAMERA_COMMAND_SATURATION ((int64_t)(CAMERA_COMMAND_BASE << 4)) +#define CAMERA_COMMAND_HUE ((int64_t)(CAMERA_COMMAND_BASE << 5)) +#define CAMERA_COMMAND_SHARPNESS ((int64_t)(CAMERA_COMMAND_BASE << 6)) +#define CAMERA_COMMAND_EFFECT ((int64_t)(CAMERA_COMMAND_BASE << 7)) +#define CAMERA_COMMAND_SCENE_MODE ((int64_t)(CAMERA_COMMAND_BASE << 8)) +#define CAMERA_COMMAND_EXPOSURE_MODE ((int64_t)(CAMERA_COMMAND_BASE << 9)) +#define CAMERA_COMMAND_EXPOSURE ((int64_t)(CAMERA_COMMAND_BASE << 10)) +#define CAMERA_COMMAND_ROTATION ((int64_t)(CAMERA_COMMAND_BASE << 11)) +#define CAMERA_COMMAND_FLIP ((int64_t)(CAMERA_COMMAND_BASE << 12)) +#define CAMERA_COMMAND_FOCUS_MODE ((int64_t)(CAMERA_COMMAND_BASE << 13)) +#define CAMERA_COMMAND_FOCUS_RANGE ((int64_t)(CAMERA_COMMAND_BASE << 14)) +#define CAMERA_COMMAND_SHOT_MODE ((int64_t)(CAMERA_COMMAND_BASE << 15)) +#define CAMERA_COMMAND_ANTI_SHAKE ((int64_t)(CAMERA_COMMAND_BASE << 16)) +#define CAMERA_COMMAND_FOCUS_AREA ((int64_t)(CAMERA_COMMAND_BASE << 17)) +#define CAMERA_COMMAND_DIGITAL_ZOOM ((int64_t)(CAMERA_COMMAND_BASE << 18)) +#define CAMERA_COMMAND_OPTICAL_ZOOM ((int64_t)(CAMERA_COMMAND_BASE << 19)) +#define CAMERA_COMMAND_RECORDING_HINT ((int64_t)(CAMERA_COMMAND_BASE << 20)) +#define CAMERA_COMMAND_WDR ((int64_t)(CAMERA_COMMAND_BASE << 21)) +#define CAMERA_COMMAND_SHUTTER_SPEED ((int64_t)(CAMERA_COMMAND_BASE << 22)) +#define CAMERA_COMMAND_FLASH_MODE ((int64_t)(CAMERA_COMMAND_BASE << 23)) +#define CAMERA_COMMAND_FACE_DETECTION ((int64_t)(CAMERA_COMMAND_BASE << 24)) +#define CAMERA_COMMAND_BITRATE ((int64_t)(CAMERA_COMMAND_BASE << 25)) +#define CAMERA_COMMAND_PTZ_TYPE ((int64_t)(CAMERA_COMMAND_BASE << 26)) +#define CAMERA_COMMAND_PAN ((int64_t)(CAMERA_COMMAND_BASE << 27)) +#define CAMERA_COMMAND_TILT ((int64_t)(CAMERA_COMMAND_BASE << 28)) +#define CAMERA_COMMAND_BRIGHTNESS ((int64_t)(CAMERA_COMMAND_BASE << 29)) +#define CAMERA_COMMAND_GOP_INTERVAL ((int64_t)(CAMERA_COMMAND_BASE << 30)) +#define CAMERA_COMMAND_CAPTURE_COUNT ((int64_t)(CAMERA_COMMAND_BASE << 31)) +#define CAMERA_COMMAND_CAPTURE_INTERVAL ((int64_t)(CAMERA_COMMAND_BASE << 32)) +#define CAMERA_COMMAND_FLASH_BRIGHTNESS ((int64_t)(CAMERA_COMMAND_BASE << 33)) +#define CAMERA_COMMAND_FOCUS_LEVEL ((int64_t)(CAMERA_COMMAND_BASE << 34)) +#define CAMERA_COMMAND_DEVICE_BUS ((int64_t)(CAMERA_COMMAND_BASE << 35)) +#define CAMERA_COMMAND_DEVICE_PORT ((int64_t)(CAMERA_COMMAND_BASE << 36)) +#define CAMERA_COMMAND_WHITE_BALANCE_TEMPERATURE ((int64_t)(CAMERA_COMMAND_BASE << 37)) +#define CAMERA_COMMAND_GAIN ((int64_t)(CAMERA_COMMAND_BASE << 38)) + + +typedef struct camera_batch_command_control { + /* flag for modified command */ + int64_t command_set_flag; + + /* value list */ + camera_white_balance_e white_balance; + int iso; + int contrast; + int saturation; + int hue; + int sharpness; + camera_effect_e effect; + camera_scene_mode_e scene_mode; + camera_exposure_mode_e exposure_mode; + int exposure; + camera_rotation_e rotation; + camera_flip_e flip; + camera_focus_mode_e focus_mode; + camera_focus_range_e focus_range; + camera_exposure_mode_e shot_mode; + int anti_shake; + camera_rectangle_s focus_area; + int digital_zoom; + int optical_zoom; + int recording_hint; + int wdr; + camera_fraction_s shutter_speed; + camera_flash_mode_e flash_mode; + camera_face_detection_e face_detection; + int bitrate; + int ptz_type; + int pan; + int tilt; + int brightness; + int gop_interval; + int capture_count; + int capture_interval; + int flash_brightness; + int focus_level; +} camera_batch_command_control_s; + +/** + * @brief The structure type of the format list. + * @since_tizen 6.5 + */ +typedef struct camera_pixel_format_list { + uint32_t count; + camera_pixel_format_e formats[CAMERA_PIXEL_FORMAT_MAX]; +} camera_format_list_s; + +/** + * @brief The structure type of the resolution list. + * @since_tizen 6.5 + */ +typedef struct camera_resolution_list { + uint32_t count; + camera_resolution_s resolutions[RESOLUTION_COUNT_MAX]; +} camera_resolution_list_s; + +/** + * @brief The structure type of the fps list. + * @since_tizen 6.5 + */ +typedef struct camera_fps_list { + uint32_t count; + int fps[FPS_COUNT_MAX]; +} camera_fps_list_s; + +/** + * @brief The structure type of the camera device information. + * @since_tizen 6.5 + */ +typedef struct camera_device_info { + uint32_t index; + char name[DEVICE_NAME_LENGTH_MAX]; + char node_path[DEVICE_NODE_PATH_LENGTH_MAX]; + camera_facing_direction_e facing_direction; + camera_format_list_s format_list; + camera_resolution_list_s preview_list; + camera_resolution_list_s capture_list; + camera_resolution_list_s video_list; + camera_fps_list_s preview_fps_list[RESOLUTION_COUNT_MAX]; + camera_fps_list_s video_fps_list[RESOLUTION_COUNT_MAX]; +} camera_device_info_s; + +/** + * @brief The structure type of the camera device information list. + * @since_tizen 6.5 + */ +typedef struct camera_device_info_list { + uint32_t count; + camera_device_info_s device_info[DEVICE_COUNT_MAX]; +} camera_device_info_list_s; + +/** + * @brief Enumeration for the camera message type. + * @since_tizen 6.5 + */ +typedef enum camera_message_type { + CAMERA_MESSAGE_TYPE_FOCUS_CHANGED, + CAMERA_MESSAGE_TYPE_CAPTURED, + CAMERA_MESSAGE_TYPE_HDR_PROGRESS, + CAMERA_MESSAGE_TYPE_ERROR, + CAMERA_MESSAGE_TYPE_NETWORK_STATE /* Since 8.0 */ +} camera_message_type_e; + +/** + * @brief The structure type of the camera message. + * @since_tizen 6.5 + */ +typedef struct camera_message { + camera_message_type_e type; + union { + camera_focus_state_e focus_state; + uint32_t hdr_progress; + camera_error_e error_code; + camera_network_state_e network_state; /* Since 8.0 */ + }; +} camera_message_s; + +/** + * @brief Callback function for notification from camera HAL. + * @since_tizen 6.5 + * @param[in] message The message from camera HAL + * @param[in] user_data The user data for callback + * @see hal_camera_add_message_callback() + * @see hal_camera_remove_message_callback() + */ +typedef int (*hal_camera_message_cb)(camera_message_s *message, void *user_data); + +/** + * @brief Callback function for captured preview frame from camera device. + * @since_tizen 6.5 + * @param[in] buffer The preview frame + * @param[in] meta The meta data for the preview frame + * @param[in] user_data The user data for callback + * @pre hal_camera_start_preview() will invoke this callback. + * @see hal_camera_start_preview() + * @see hal_camera_stop_preview() + */ +typedef int (*hal_camera_preview_frame_cb)(camera_buffer_s *buffer, camera_metadata_s *meta, void *user_data); + +/** + * @brief Callback function for extra preview frame from camera device. + * @since_tizen 6.5 + * @param[in] buffer The extra preview frame + * @param[in] meta The meta data for the extra preview frame + * @param[in] stream_id The id of extra preview stream + * @param[in] user_data The user data for callback + * @pre hal_camera_start_preview() will invoke this callback. + * @see hal_camera_start_preview() + * @see hal_camera_stop_preview() + */ +typedef int (*hal_camera_extra_preview_frame_cb)(camera_buffer_s *buffer, camera_metadata_s *meta, int stream_id, void *user_data); + +/** + * @brief Callback function for captured video buffer from camera device. + * @since_tizen 6.5 + * @param[in] buffer The video buffer + * @param[in] meta The meta data for the video frame + * @param[in] user_data The user data for callback + * @pre hal_camera_start_record() will invoke this callback. + * @see hal_camera_start_record() + * @see hal_camera_stop_record() + */ +typedef int (*hal_camera_video_frame_cb)(camera_buffer_s *buffer, camera_metadata_s *meta, void *user_data); + +/** + * @brief Callback function for captured still image from camera device. + * @since_tizen 6.5 + * @param[in] main The main image data + * @param[in] postview The image data of the postview (it could be @c NULL if the available data does not exist) + * @param[in] thumbnail The image data of the thumbnail (it could be @c NULL if the available data does not exist) + * @param[in] user_data The user data passed from the callback registration function + * @pre hal_camera_start_capture() will invoke this callback function. + * @see hal_camera_start_capture() + * @see hal_camera_stop_capture() + */ +typedef int (*hal_camera_capture_cb)(camera_buffer_s *main, camera_buffer_s *postview, camera_buffer_s *thumbnail, void *user_data); + + +/** + * @brief The structure type of the camera HAL functions. + * @since_tizen 6.5 + */ +typedef struct _hal_backend_media_camera_funcs { + int (*init)(void **camera_handle); + int (*deinit)(void *camera_handle); + int (*get_device_info_list)(camera_device_info_list_s *device_info_list); + int (*open_device)(void *camera_handle, int device_index); + int (*open_device_ext)(void *camera_handle, const char *device_name); + int (*close_device)(void *camera_handle); + int (*add_message_callback)(void *camera_handle, hal_camera_message_cb callback, void *user_data, uint32_t *cb_id); + int (*remove_message_callback)(void *camera_handle, uint32_t cb_id); + int (*set_preview_stream_format)(void *camera_handle, camera_format_s *format); + int (*get_preview_stream_format)(void *camera_handle, camera_format_s *format); + int (*set_user_buffer_fd)(void *camera_handle, int *fds, int number); + int (*start_preview)(void *camera_handle, hal_camera_preview_frame_cb callback, void *user_data); + int (*release_preview_buffer)(void *camera_handle, int buffer_index); + int (*stop_preview)(void *camera_handle); + int (*start_auto_focus)(void *camera_handle); + int (*stop_auto_focus)(void *camera_handle); + int (*start_capture)(void *camera_handle, hal_camera_capture_cb callback, void *user_data); + int (*stop_capture)(void *camera_handle); + int (*set_video_stream_format)(void *camera_handle, camera_format_s *format); + int (*get_video_stream_format)(void *camera_handle, camera_format_s *format); + int (*start_record)(void *camera_handle, hal_camera_video_frame_cb callback, void *user_data); + int (*release_video_buffer)(void *camera_handle, int buffer_index); + int (*stop_record)(void *camera_handle); + int (*set_command)(void *camera_handle, int64_t command, void *value); + int (*get_command)(void *camera_handle, int64_t command, void **value); + int (*set_batch_command)(void *camera_handle, camera_batch_command_control_s *batch_command, int64_t *error_command); + int (*set_extra_preview_frame_cb)(void *camera_handle, hal_camera_extra_preview_frame_cb callback, void *user_data); + int (*unset_extra_preview_frame_cb)(void *camera_handle); + int (*release_extra_preview_buffer)(void *camera_handle, int stream_id, int buffer_index); + int (*set_extra_preview_stream_format)(void *camera_handle, int stream_id, camera_format_s *format); + int (*get_extra_preview_stream_format)(void *camera_handle, int stream_id, camera_format_s *format); + int (*set_extra_preview_bitrate)(void *camera_handle, int stream_id, int bitrate); + int (*get_extra_preview_bitrate)(void *camera_handle, int stream_id, int *bitrate); + int (*set_extra_preview_gop_interval)(void *camera_handle, int stream_id, int interval); + int (*get_extra_preview_gop_interval)(void *camera_handle, int stream_id, int *interval); +} hal_backend_camera_funcs; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* __HAL_CAMERA_INTERFACE_1__ */ diff --git a/include/hal-camera-interface.h b/include/hal-camera-interface.h index 60dcfef..a321f54 100644 --- a/include/hal-camera-interface.h +++ b/include/hal-camera-interface.h @@ -19,679 +19,6 @@ #ifndef __HAL_CAMERA_INTERFACE__ #define __HAL_CAMERA_INTERFACE__ -#ifdef __cplusplus -extern "C" { -#endif +#include -/** - * @file hal-camera-interface.h - * @brief This file contains the Tizen camera HAL interface API, related structures and enumerations. - * @since_tizen 6.5 - */ - -#define BUFFER_PLANE_MAX 4 -#define DEVICE_COUNT_MAX 16 -#define RESOLUTION_COUNT_MAX 32 -#define FPS_COUNT_MAX 16 -#define DEVICE_NAME_LENGTH_MAX 16 -#define DEVICE_NODE_PATH_LENGTH_MAX 16 - -/** - * @addtogroup HAL_CAMERA_INTERFACE_MODULE - * @{ - */ - -/** - * @brief Enumeration for the camera error. - * @since_tizen 6.5 - */ -typedef enum camera_error { - CAMERA_ERROR_NONE = 0, - CAMERA_ERROR_INVALID_PARAMETER = (int32_t)0x80002001, - CAMERA_ERROR_INVALID_STATE = (int32_t)0x80002002, - CAMERA_ERROR_PERMISSION_DENIED = (int32_t)0x80002003, - CAMERA_ERROR_OUT_OF_MEMORY = (int32_t)0x80002004, - CAMERA_ERROR_DEVICE_OPEN = (int32_t)0x80002005, - CAMERA_ERROR_DEVICE_NOT_FOUND = (int32_t)0x80002006, - CAMERA_ERROR_DEVICE_UNAVAILABLE = (int32_t)0x80002007, - CAMERA_ERROR_DEVICE_NOT_SUPPORTED = (int32_t)0x80002008, - CAMERA_ERROR_DEVICE_READ = (int32_t)0x80002009, - CAMERA_ERROR_DEVICE_WRITE = (int32_t)0x8000200a, - CAMERA_ERROR_DEVICE_BUSY = (int32_t)0x8000200b, - CAMERA_ERROR_DEVICE_TIME_OUT = (int32_t)0x8000200c, - CAMERA_ERROR_DEVICE_ESD = (int32_t)0x8000200d, - CAMERA_ERROR_INTERNAL = (int32_t)0x8000200e, - - CAMERA_ERROR_NOT_IMPLEMENTED = (int32_t)0x80002ffe, - CAMERA_ERROR_UNKNOWN = (int32_t)0x80002fff -} camera_error_e; - -/** - * @brief Enumeration for the camera state. - * @since_tizen 6.5 - */ -typedef enum camera_state { - CAMERA_STATE_INITIALIZED, - CAMERA_STATE_OPENED, - CAMERA_STATE_PREVIEWING, - CAMERA_STATE_CAPTURING, - CAMERA_STATE_RECORDING, - CAMERA_STATE_RECORDING_SNAPSHOT -} camera_state_e; - -/** - * @brief Enumeration for the camera network state. - * @since_tizen 8.0 - */ -typedef enum camera_network_state { - CAMERA_NETWORK_STATE_PLAYING, - CAMERA_NETWORK_STATE_PAUSED -} camera_network_state_e; - -/** - * @brief The structure type of the resolution. - * @since_tizen 6.5 - */ -typedef struct camera_resolution { - uint32_t width; - uint32_t height; -} camera_resolution_s; - -/** - * @brief The structure type of the fraction. - * @since_tizen 6.5 - */ -typedef struct camera_fraction { - int numerator; - int denominator; -} camera_fraction_s; - -/** - * @brief The structure type of the rectangle. - * @since_tizen 6.5 - */ -typedef struct camera_rectangle { - int x; - int y; - uint32_t width; - uint32_t height; -} camera_rectangle_s; - -/** - * @brief Enumeration for the camera pixel format. - * @since_tizen 6.5 - */ -typedef enum camera_pixel_format { - /* YUV */ - CAMERA_PIXEL_FORMAT_NV12 = 0x0000, - CAMERA_PIXEL_FORMAT_NV21, - CAMERA_PIXEL_FORMAT_I420, - CAMERA_PIXEL_FORMAT_YV12, - CAMERA_PIXEL_FORMAT_YUYV, - CAMERA_PIXEL_FORMAT_UYVY, - - /* RGB */ - CAMERA_PIXEL_FORMAT_BGRA8888, - CAMERA_PIXEL_FORMAT_ARGB8888, - - /* ENCODED */ - CAMERA_PIXEL_FORMAT_JPEG, - CAMERA_PIXEL_FORMAT_H264, - CAMERA_PIXEL_FORMAT_MJPEG, - CAMERA_PIXEL_FORMAT_VP8, - CAMERA_PIXEL_FORMAT_VP9, - - /* DEPTH */ - CAMERA_PIXEL_FORMAT_DEPTH, - - /* MAX */ - CAMERA_PIXEL_FORMAT_MAX -} camera_pixel_format_e; - -/** - * @brief Enumeration for the focus state. - * @since_tizen 6.5 - */ -typedef enum camera_focus_state { - CAMERA_FOCUS_STATE_RELEASED, - CAMERA_FOCUS_STATE_ONGOING, - CAMERA_FOCUS_STATE_FOCUSED, - CAMERA_FOCUS_STATE_FAILED -} camera_focus_state_e; - -/** - * @brief Enumeration for the facing direction of camera device. - * @since_tizen 6.5 - */ -typedef enum camera_facing_direction { - CAMERA_FACING_DIRECTION_REAR, - CAMERA_FACING_DIRECTION_FRONT, - CAMERA_FACING_DIRECTION_EXTERNAL -} camera_facing_direction_e; - -/** - * @brief Enumeration for the camera rotation. - * @since_tizen 6.5 - */ -typedef enum camera_rotation { - CAMERA_ROTATION_0, - CAMERA_ROTATION_90, - CAMERA_ROTATION_180, - CAMERA_ROTATION_270 -} camera_rotation_e; - -/** - * @brief Enumeration for the auto exposure status. - * @since_tizen 7.0 - */ -typedef enum camera_status_auto_exposure { - CAMERA_STATUS_AUTO_EXPOSURE_NONE, - CAMERA_STATUS_AUTO_EXPOSURE_UNSTABLE, - CAMERA_STATUS_AUTO_EXPOSURE_STABLE -} camera_status_auto_exposure_e; - -/** - * @brief Enumeration for the auto white balance status. - * @since_tizen 7.0 - */ -typedef enum camera_status_auto_white_balance { - CAMERA_STATUS_AUTO_WHITE_BALANCE_NONE, - CAMERA_STATUS_AUTO_WHITE_BALANCE_UNSTABLE, - CAMERA_STATUS_AUTO_WHITE_BALANCE_STABLE -} camera_status_auto_white_balance_e; - -/** - * @brief Enumeration for the camera flip. - * @since_tizen 6.5 - */ -typedef enum camera_flip { - CAMERA_FLIP_NONE, - CAMERA_FLIP_HORIZONTAL, - CAMERA_FLIP_VERTICAL, - CAMERA_FLIP_BOTH -} camera_flip_e; - -/** - * @brief The structure type of the camera plane. - * @since_tizen 6.5 - */ -typedef struct camera_plane { - unsigned char *data; - uint32_t align_width; - uint32_t align_height; - uint32_t size; - uint32_t bytesused; /* The number of bytes occupied by data (Since 7.0) */ -} camera_plane_s; - -/** - * @brief The structure type of the camera buffer. - * @since_tizen 6.5 - */ -typedef struct camera_buffer { - int index; - camera_pixel_format_e format; - camera_resolution_s resolution; - uint32_t total_size; - uint32_t num_planes; - camera_plane_s planes[BUFFER_PLANE_MAX]; - uint32_t num_bos; - void *bos[BUFFER_PLANE_MAX]; -} camera_buffer_s; - -/** - * @brief The structure type of the camera metadata. - * @since_tizen 6.5 - */ -typedef struct camera_metadata { - int is_flashed; - camera_fraction_s focal_length; - camera_fraction_s aperture_f_number; - camera_fraction_s shutter_speed; - camera_fraction_s exposure_time; - camera_fraction_s brightness; - camera_resolution_s exif_image; - int iso; - int metering_mode; - int color_space; - int component_configuration; - int aperture_in_apex; - int is_delta_frame; /* Flag for encoded delta frame */ - camera_focus_state_e focus_state; - camera_facing_direction_e facing_direction; - camera_flip_e flip; - camera_rotation_e rotation; - camera_status_auto_exposure_e status_ae; - camera_status_auto_white_balance_e status_awb; -} camera_metadata_s; - -/** - * @brief The structure type of the camera format. - * @since_tizen 6.5 - */ -typedef struct camera_format { - camera_pixel_format_e stream_format; - camera_resolution_s stream_resolution; - uint32_t stream_fps; - camera_rotation_e stream_rotation; - camera_pixel_format_e capture_format; - camera_resolution_s capture_resolution; - uint32_t capture_quality; - uint32_t stream_bitrate; -} camera_format_s; - -/** - * @brief Enumeration for the focus mode. - * @since_tizen 6.5 - */ -typedef enum camera_focus_mode { - CAMERA_FOCUS_MODE_NONE, - CAMERA_FOCUS_MODE_PAN, - CAMERA_FOCUS_MODE_AUTO, - CAMERA_FOCUS_MODE_CONTINUOUS_AUTO -} camera_focus_mode_e; - -/** - * @brief Enumeration for the focus range. - * @since_tizen 6.5 - */ -typedef enum camera_focus_range { - CAMERA_FOCUS_RANGE_NONE, - CAMERA_FOCUS_RANGE_NORMAL, - CAMERA_FOCUS_RANGE_MACRO, - CAMERA_FOCUS_RANGE_FULL -} camera_focus_range_e; - -/** - * @brief Enumeration for the white balance. - * @since_tizen 6.5 - */ -typedef enum camera_white_balance { - CAMERA_WHITE_BALANCE_AUTO, /**< Automatic */ - CAMERA_WHITE_BALANCE_DAYLIGHT, /**< Daylight */ - CAMERA_WHITE_BALANCE_CLOUDY, /**< Cloudy */ - CAMERA_WHITE_BALANCE_FLUORESCENT, /**< Fluorescent */ - CAMERA_WHITE_BALANCE_INCANDESCENT, /**< Incandescent */ - CAMERA_WHITE_BALANCE_SHADE, /**< Shade */ - CAMERA_WHITE_BALANCE_HORIZON, /**< Horizon */ - CAMERA_WHITE_BALANCE_FLASH /**< Flash */ -} camera_white_balance_e; - -/** - * @brief Enumeration for the effect. - * @since_tizen 6.5 - */ -typedef enum camera_effect { - CAMERA_EFFECT_NONE, /**< None */ - CAMERA_EFFECT_MONO, /**< Mono */ - CAMERA_EFFECT_SEPIA, /**< Sepia */ - CAMERA_EFFECT_NEGATIVE, /**< Negative */ - CAMERA_EFFECT_RED, /**< Red */ - CAMERA_EFFECT_GREEN, /**< Green */ - CAMERA_EFFECT_BLUE, /**< Blue */ - CAMERA_EFFECT_AQUA, /**< Aqua */ - CAMERA_EFFECT_ANTIQUE, /**< Antique */ - CAMERA_EFFECT_WARM, /**< Warm */ - CAMERA_EFFECT_EMBOSS, /**< Emboss */ - CAMERA_EFFECT_SKETCH, /**< Sketch */ - CAMERA_EFFECT_SOLARIZATION, /**< Solarization */ - CAMERA_EFFECT_POSTERIZATION, /**< Posterization */ - CAMERA_EFFECT_CARTOON /**< Cartoon */ -} camera_effect_e; - -/** - * @brief Enumeration for the scene mode. - * @since_tizen 6.5 - */ -typedef enum camera_scene_mode { - CAMERA_SCENE_MODE_NORMAL, /**< Normal */ - CAMERA_SCENE_MODE_PORTRAIT, /**< Portrait */ - CAMERA_SCENE_MODE_LANDSCAPE, /**< Landscape */ - CAMERA_SCENE_MODE_SPORTS, /**< Sports */ - CAMERA_SCENE_MODE_PARTY_N_INDOOR, /**< Party & indoor */ - CAMERA_SCENE_MODE_BEACH_N_INDOOR, /**< Beach & indoor */ - CAMERA_SCENE_MODE_SUNSET, /**< Sunset */ - CAMERA_SCENE_MODE_DUSK_N_DAWN, /**< Dusk & dawn */ - CAMERA_SCENE_MODE_FALL_COLOR, /**< Fall */ - CAMERA_SCENE_MODE_NIGHT_SCENE, /**< Night scene */ - CAMERA_SCENE_MODE_FIREWORK, /**< Firework */ - CAMERA_SCENE_MODE_TEXT, /**< Text */ - CAMERA_SCENE_MODE_SHOW_WINDOW, /**< Show window */ - CAMERA_SCENE_MODE_CANDLE_LIGHT, /**< Candle light */ - CAMERA_SCENE_MODE_BACKLIGHT, /**< Backlight */ - CAMERA_SCENE_MODE_AQUA /**< Aqua */ -} camera_scene_mode_e; - -/** - * @brief Enumeration for the exposure mode. - * @since_tizen 6.5 - */ -typedef enum camera_exposure_mode { - CAMERA_EXPOSURE_MODE_OFF = 0, /**< Off */ - CAMERA_EXPOSURE_MODE_ALL, /**< All mode */ - CAMERA_EXPOSURE_MODE_CENTER, /**< Center mode */ - CAMERA_EXPOSURE_MODE_SPOT, /**< Spot mode */ - CAMERA_EXPOSURE_MODE_CUSTOM, /**< Custom mode */ - CAMERA_EXPOSURE_MODE_SHUTTER_PRIORITY, /**< Shutter priority mode */ - CAMERA_EXPOSURE_MODE_APERTURE_PRIORITY /**< Aperture priority mode */ -} camera_exposure_mode_e; - -/** - * @brief Enumeration for the shot mode. - * @since_tizen 6.5 - */ -typedef enum camera_shot_mode { - CAMERA_SHOT_MODE_NORMAL = 0, /**< Normal */ - CAMERA_SHOT_MODE_CONTINUOUS, /**< Continuous */ - CAMERA_SHOT_MODE_HDR, /**< HDR */ - CAMERA_SHOT_MODE_NIGHT /**< Night */ -} camera_shot_mode_e; - -/** - * @brief Enumeration for the flash mode. - * @since_tizen 6.5 - */ -typedef enum camera_flash_mode { - CAMERA_FLASH_MODE_OFF = 0, /**< Always off */ - CAMERA_FLASH_MODE_ON, /**< Always splashes */ - CAMERA_FLASH_MODE_AUTO, /**< Depending on intensity of light, strobe starts to flash */ - CAMERA_FLASH_MODE_REDEYE_REDUCTION, /**< Red eye reduction. Multiple flash before capturing */ - CAMERA_FLASH_MODE_SLOW_SYNC, /**< Slow sync curtain synchronization */ - CAMERA_FLASH_MODE_FRONT_CURTAIN, /**< Front curtain synchronization */ - CAMERA_FLASH_MODE_REAR_CURTAIN, /**< Rear curtain synchronization */ - CAMERA_FLASH_MODE_PERMANENT, /**< Keep turned on until turning off */ -} camera_flash_mode_e; - -/** - * @brief Enumeration for the face detection. - * @since_tizen 6.5 - */ -typedef enum camera_face_detection { - CAMERA_FACE_DETECTION_OFF = 0, /**< Face detection off */ - CAMERA_FACE_DETECTION_ON /**< Face detection on */ -} camera_face_detection_e; - -/** - * @brief Enumeration for the PTZ(Pan Tilt Zoom) type. - * @since_tizen 6.5 - */ -typedef enum camera_ptz_type { - CAMERA_PTZ_TYPE_MECHANICAL = 0, /**< Move the camera device physically */ - CAMERA_PTZ_TYPE_ELECTRONIC /**< Zoom digitally and move into portion of the image */ -} camera_ptz_type_e; - -/** - * @brief Definitions for the camera command. - * @since_tizen 6.5 - */ -#define CAMERA_COMMAND_BASE ((int64_t)1) -#define CAMERA_COMMAND_WHITE_BALANCE ((int64_t)(CAMERA_COMMAND_BASE << 1)) -#define CAMERA_COMMAND_ISO ((int64_t)(CAMERA_COMMAND_BASE << 2)) -#define CAMERA_COMMAND_CONTRAST ((int64_t)(CAMERA_COMMAND_BASE << 3)) -#define CAMERA_COMMAND_SATURATION ((int64_t)(CAMERA_COMMAND_BASE << 4)) -#define CAMERA_COMMAND_HUE ((int64_t)(CAMERA_COMMAND_BASE << 5)) -#define CAMERA_COMMAND_SHARPNESS ((int64_t)(CAMERA_COMMAND_BASE << 6)) -#define CAMERA_COMMAND_EFFECT ((int64_t)(CAMERA_COMMAND_BASE << 7)) -#define CAMERA_COMMAND_SCENE_MODE ((int64_t)(CAMERA_COMMAND_BASE << 8)) -#define CAMERA_COMMAND_EXPOSURE_MODE ((int64_t)(CAMERA_COMMAND_BASE << 9)) -#define CAMERA_COMMAND_EXPOSURE ((int64_t)(CAMERA_COMMAND_BASE << 10)) -#define CAMERA_COMMAND_ROTATION ((int64_t)(CAMERA_COMMAND_BASE << 11)) -#define CAMERA_COMMAND_FLIP ((int64_t)(CAMERA_COMMAND_BASE << 12)) -#define CAMERA_COMMAND_FOCUS_MODE ((int64_t)(CAMERA_COMMAND_BASE << 13)) -#define CAMERA_COMMAND_FOCUS_RANGE ((int64_t)(CAMERA_COMMAND_BASE << 14)) -#define CAMERA_COMMAND_SHOT_MODE ((int64_t)(CAMERA_COMMAND_BASE << 15)) -#define CAMERA_COMMAND_ANTI_SHAKE ((int64_t)(CAMERA_COMMAND_BASE << 16)) -#define CAMERA_COMMAND_FOCUS_AREA ((int64_t)(CAMERA_COMMAND_BASE << 17)) -#define CAMERA_COMMAND_DIGITAL_ZOOM ((int64_t)(CAMERA_COMMAND_BASE << 18)) -#define CAMERA_COMMAND_OPTICAL_ZOOM ((int64_t)(CAMERA_COMMAND_BASE << 19)) -#define CAMERA_COMMAND_RECORDING_HINT ((int64_t)(CAMERA_COMMAND_BASE << 20)) -#define CAMERA_COMMAND_WDR ((int64_t)(CAMERA_COMMAND_BASE << 21)) -#define CAMERA_COMMAND_SHUTTER_SPEED ((int64_t)(CAMERA_COMMAND_BASE << 22)) -#define CAMERA_COMMAND_FLASH_MODE ((int64_t)(CAMERA_COMMAND_BASE << 23)) -#define CAMERA_COMMAND_FACE_DETECTION ((int64_t)(CAMERA_COMMAND_BASE << 24)) -#define CAMERA_COMMAND_BITRATE ((int64_t)(CAMERA_COMMAND_BASE << 25)) -#define CAMERA_COMMAND_PTZ_TYPE ((int64_t)(CAMERA_COMMAND_BASE << 26)) -#define CAMERA_COMMAND_PAN ((int64_t)(CAMERA_COMMAND_BASE << 27)) -#define CAMERA_COMMAND_TILT ((int64_t)(CAMERA_COMMAND_BASE << 28)) -#define CAMERA_COMMAND_BRIGHTNESS ((int64_t)(CAMERA_COMMAND_BASE << 29)) -#define CAMERA_COMMAND_GOP_INTERVAL ((int64_t)(CAMERA_COMMAND_BASE << 30)) -#define CAMERA_COMMAND_CAPTURE_COUNT ((int64_t)(CAMERA_COMMAND_BASE << 31)) -#define CAMERA_COMMAND_CAPTURE_INTERVAL ((int64_t)(CAMERA_COMMAND_BASE << 32)) -#define CAMERA_COMMAND_FLASH_BRIGHTNESS ((int64_t)(CAMERA_COMMAND_BASE << 33)) -#define CAMERA_COMMAND_FOCUS_LEVEL ((int64_t)(CAMERA_COMMAND_BASE << 34)) -#define CAMERA_COMMAND_DEVICE_BUS ((int64_t)(CAMERA_COMMAND_BASE << 35)) -#define CAMERA_COMMAND_DEVICE_PORT ((int64_t)(CAMERA_COMMAND_BASE << 36)) -#define CAMERA_COMMAND_WHITE_BALANCE_TEMPERATURE ((int64_t)(CAMERA_COMMAND_BASE << 37)) -#define CAMERA_COMMAND_GAIN ((int64_t)(CAMERA_COMMAND_BASE << 38)) - - -typedef struct camera_batch_command_control { - /* flag for modified command */ - int64_t command_set_flag; - - /* value list */ - camera_white_balance_e white_balance; - int iso; - int contrast; - int saturation; - int hue; - int sharpness; - camera_effect_e effect; - camera_scene_mode_e scene_mode; - camera_exposure_mode_e exposure_mode; - int exposure; - camera_rotation_e rotation; - camera_flip_e flip; - camera_focus_mode_e focus_mode; - camera_focus_range_e focus_range; - camera_exposure_mode_e shot_mode; - int anti_shake; - camera_rectangle_s focus_area; - int digital_zoom; - int optical_zoom; - int recording_hint; - int wdr; - camera_fraction_s shutter_speed; - camera_flash_mode_e flash_mode; - camera_face_detection_e face_detection; - int bitrate; - int ptz_type; - int pan; - int tilt; - int brightness; - int gop_interval; - int capture_count; - int capture_interval; - int flash_brightness; - int focus_level; -} camera_batch_command_control_s; - -/** - * @brief The structure type of the format list. - * @since_tizen 6.5 - */ -typedef struct camera_pixel_format_list { - uint32_t count; - camera_pixel_format_e formats[CAMERA_PIXEL_FORMAT_MAX]; -} camera_format_list_s; - -/** - * @brief The structure type of the resolution list. - * @since_tizen 6.5 - */ -typedef struct camera_resolution_list { - uint32_t count; - camera_resolution_s resolutions[RESOLUTION_COUNT_MAX]; -} camera_resolution_list_s; - -/** - * @brief The structure type of the fps list. - * @since_tizen 6.5 - */ -typedef struct camera_fps_list { - uint32_t count; - int fps[FPS_COUNT_MAX]; -} camera_fps_list_s; - -/** - * @brief The structure type of the camera device information. - * @since_tizen 6.5 - */ -typedef struct camera_device_info { - uint32_t index; - char name[DEVICE_NAME_LENGTH_MAX]; - char node_path[DEVICE_NODE_PATH_LENGTH_MAX]; - camera_facing_direction_e facing_direction; - camera_format_list_s format_list; - camera_resolution_list_s preview_list; - camera_resolution_list_s capture_list; - camera_resolution_list_s video_list; - camera_fps_list_s preview_fps_list[RESOLUTION_COUNT_MAX]; - camera_fps_list_s video_fps_list[RESOLUTION_COUNT_MAX]; -} camera_device_info_s; - -/** - * @brief The structure type of the camera device information list. - * @since_tizen 6.5 - */ -typedef struct camera_device_info_list { - uint32_t count; - camera_device_info_s device_info[DEVICE_COUNT_MAX]; -} camera_device_info_list_s; - -/** - * @brief Enumeration for the camera message type. - * @since_tizen 6.5 - */ -typedef enum camera_message_type { - CAMERA_MESSAGE_TYPE_FOCUS_CHANGED, - CAMERA_MESSAGE_TYPE_CAPTURED, - CAMERA_MESSAGE_TYPE_HDR_PROGRESS, - CAMERA_MESSAGE_TYPE_ERROR, - CAMERA_MESSAGE_TYPE_NETWORK_STATE /* Since 8.0 */ -} camera_message_type_e; - -/** - * @brief The structure type of the camera message. - * @since_tizen 6.5 - */ -typedef struct camera_message { - camera_message_type_e type; - union { - camera_focus_state_e focus_state; - uint32_t hdr_progress; - camera_error_e error_code; - camera_network_state_e network_state; /* Since 8.0 */ - }; -} camera_message_s; - -/** - * @brief Callback function for notification from camera HAL. - * @since_tizen 6.5 - * @param[in] message The message from camera HAL - * @param[in] user_data The user data for callback - * @see hal_camera_add_message_callback() - * @see hal_camera_remove_message_callback() - */ -typedef int (*hal_camera_message_cb)(camera_message_s *message, void *user_data); - -/** - * @brief Callback function for captured preview frame from camera device. - * @since_tizen 6.5 - * @param[in] buffer The preview frame - * @param[in] meta The meta data for the preview frame - * @param[in] user_data The user data for callback - * @pre hal_camera_start_preview() will invoke this callback. - * @see hal_camera_start_preview() - * @see hal_camera_stop_preview() - */ -typedef int (*hal_camera_preview_frame_cb)(camera_buffer_s *buffer, camera_metadata_s *meta, void *user_data); - -/** - * @brief Callback function for extra preview frame from camera device. - * @since_tizen 6.5 - * @param[in] buffer The extra preview frame - * @param[in] meta The meta data for the extra preview frame - * @param[in] stream_id The id of extra preview stream - * @param[in] user_data The user data for callback - * @pre hal_camera_start_preview() will invoke this callback. - * @see hal_camera_start_preview() - * @see hal_camera_stop_preview() - */ -typedef int (*hal_camera_extra_preview_frame_cb)(camera_buffer_s *buffer, camera_metadata_s *meta, int stream_id, void *user_data); - -/** - * @brief Callback function for captured video buffer from camera device. - * @since_tizen 6.5 - * @param[in] buffer The video buffer - * @param[in] meta The meta data for the video frame - * @param[in] user_data The user data for callback - * @pre hal_camera_start_record() will invoke this callback. - * @see hal_camera_start_record() - * @see hal_camera_stop_record() - */ -typedef int (*hal_camera_video_frame_cb)(camera_buffer_s *buffer, camera_metadata_s *meta, void *user_data); - -/** - * @brief Callback function for captured still image from camera device. - * @since_tizen 6.5 - * @param[in] main The main image data - * @param[in] postview The image data of the postview (it could be @c NULL if the available data does not exist) - * @param[in] thumbnail The image data of the thumbnail (it could be @c NULL if the available data does not exist) - * @param[in] user_data The user data passed from the callback registration function - * @pre hal_camera_start_capture() will invoke this callback function. - * @see hal_camera_start_capture() - * @see hal_camera_stop_capture() - */ -typedef int (*hal_camera_capture_cb)(camera_buffer_s *main, camera_buffer_s *postview, camera_buffer_s *thumbnail, void *user_data); - - -/** - * @brief The structure type of the camera HAL functions. - * @since_tizen 6.5 - */ -typedef struct _hal_backend_media_camera_funcs { - int (*init)(void **camera_handle); - int (*deinit)(void *camera_handle); - int (*get_device_info_list)(camera_device_info_list_s *device_info_list); - int (*open_device)(void *camera_handle, int device_index); - int (*open_device_ext)(void *camera_handle, const char *device_name); - int (*close_device)(void *camera_handle); - int (*add_message_callback)(void *camera_handle, hal_camera_message_cb callback, void *user_data, uint32_t *cb_id); - int (*remove_message_callback)(void *camera_handle, uint32_t cb_id); - int (*set_preview_stream_format)(void *camera_handle, camera_format_s *format); - int (*get_preview_stream_format)(void *camera_handle, camera_format_s *format); - int (*set_user_buffer_fd)(void *camera_handle, int *fds, int number); - int (*start_preview)(void *camera_handle, hal_camera_preview_frame_cb callback, void *user_data); - int (*release_preview_buffer)(void *camera_handle, int buffer_index); - int (*stop_preview)(void *camera_handle); - int (*start_auto_focus)(void *camera_handle); - int (*stop_auto_focus)(void *camera_handle); - int (*start_capture)(void *camera_handle, hal_camera_capture_cb callback, void *user_data); - int (*stop_capture)(void *camera_handle); - int (*set_video_stream_format)(void *camera_handle, camera_format_s *format); - int (*get_video_stream_format)(void *camera_handle, camera_format_s *format); - int (*start_record)(void *camera_handle, hal_camera_video_frame_cb callback, void *user_data); - int (*release_video_buffer)(void *camera_handle, int buffer_index); - int (*stop_record)(void *camera_handle); - int (*set_command)(void *camera_handle, int64_t command, void *value); - int (*get_command)(void *camera_handle, int64_t command, void **value); - int (*set_batch_command)(void *camera_handle, camera_batch_command_control_s *batch_command, int64_t *error_command); - int (*set_extra_preview_frame_cb)(void *camera_handle, hal_camera_extra_preview_frame_cb callback, void *user_data); - int (*unset_extra_preview_frame_cb)(void *camera_handle); - int (*release_extra_preview_buffer)(void *camera_handle, int stream_id, int buffer_index); - int (*set_extra_preview_stream_format)(void *camera_handle, int stream_id, camera_format_s *format); - int (*get_extra_preview_stream_format)(void *camera_handle, int stream_id, camera_format_s *format); - int (*set_extra_preview_bitrate)(void *camera_handle, int stream_id, int bitrate); - int (*get_extra_preview_bitrate)(void *camera_handle, int stream_id, int *bitrate); - int (*set_extra_preview_gop_interval)(void *camera_handle, int stream_id, int interval); - int (*get_extra_preview_gop_interval)(void *camera_handle, int stream_id, int *interval); -} hal_backend_camera_funcs; - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif #endif /* __HAL_CAMERA_INTERFACE__ */