From 77defd45b9b67f7418f42cec1fcc783fbcb23ecb Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 8 Jan 2020 15:55:08 +0900 Subject: [PATCH] [camera] Add new pixel format and function - pixel format : CAMERA_PIXEL_FORMAT_MJPEG - function : camera_open_device_ext() : It could be used with device name instead of camera_open_device(). [Version] 0.0.28 [Profile] Common [Issue Type] New feature Change-Id: If5d3cfca132489b73ff5007309e475dad91a3fdb Signed-off-by: Jeongmo Yang --- include/camera/camera_hal_interface.h | 1 + include/camera/tizen-camera.h | 21 +++++++++++++++++++++ packaging/mm-hal-interface.spec | 2 +- src/camera/camera_hal_interface.c | 17 +++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/include/camera/camera_hal_interface.h b/include/camera/camera_hal_interface.h index 69a6c61..c60dc9d 100644 --- a/include/camera/camera_hal_interface.h +++ b/include/camera/camera_hal_interface.h @@ -33,6 +33,7 @@ int camera_hal_interface_init(camera_hal_interface **h); int camera_hal_interface_deinit(camera_hal_interface *h); int camera_hal_interface_get_device_info_list(camera_hal_interface *h, camera_device_info_list_t *device_info_list); int camera_hal_interface_open_device(camera_hal_interface *h, int device_index); +int camera_hal_interface_open_device_ext(camera_hal_interface *h, const char *device_name); int camera_hal_interface_close_device(camera_hal_interface *h); int camera_hal_interface_add_message_callback(camera_hal_interface *h, camera_message_cb callback, void *user_data, uint32_t *cb_id); int camera_hal_interface_remove_message_callback(camera_hal_interface *h, uint32_t cb_id); diff --git a/include/camera/tizen-camera.h b/include/camera/tizen-camera.h index 426f9bd..758296c 100644 --- a/include/camera/tizen-camera.h +++ b/include/camera/tizen-camera.h @@ -130,6 +130,7 @@ typedef enum camera_pixel_format { /* ENCODED */ CAMERA_PIXEL_FORMAT_JPEG, CAMERA_PIXEL_FORMAT_H264, + CAMERA_PIXEL_FORMAT_MJPEG, /* DEPTH */ CAMERA_PIXEL_FORMAT_DEPTH, @@ -572,6 +573,7 @@ typedef struct camera_interface { int (*deinit)(void *camera_handle); int (*get_device_info_list)(camera_device_info_list_t *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, camera_message_cb callback, void *user_data, uint32_t *cb_id); int (*remove_message_callback)(void *camera_handle, uint32_t cb_id); @@ -656,6 +658,25 @@ int camera_get_device_info_list(camera_device_info_list_t *device_info_list); int camera_open_device(void *camera_handle, int device_index); /** + * @brief Opens camera device with device name. + * @since_tizen 6.0 + * @param[in] camera_handle The handle to the camera HAL + * @param[in] device_name The device name of the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_DEVICE_NOT_FOUND Failed to find camera device + * @retval #CAMERA_ERROR_DEVICE_UNAVAILABLE The camera device is unavailable + * @pre The camera state must be set to #CAMERA_STATE_INITIALIZED. + * @post If it succeeds, the camera state will be #CAMERA_STATE_OPENED. + * @see camera_close_device() + */ +int camera_open_device_ext(void *camera_handle, const char *device_name); + +/** * @brief Closes camera device. * @since_tizen 3.0 * @param[in] camera_handle The handle to the camera HAL diff --git a/packaging/mm-hal-interface.spec b/packaging/mm-hal-interface.spec index 54a9c00..5204722 100755 --- a/packaging/mm-hal-interface.spec +++ b/packaging/mm-hal-interface.spec @@ -1,6 +1,6 @@ Name: mm-hal-interface Summary: Multimedia HAL Interface -Version: 0.0.27 +Version: 0.0.28 Release: 0 Group: Multimedia/Development License: Apache-2.0 diff --git a/src/camera/camera_hal_interface.c b/src/camera/camera_hal_interface.c index 882158a..decafe1 100644 --- a/src/camera/camera_hal_interface.c +++ b/src/camera/camera_hal_interface.c @@ -65,6 +65,7 @@ int camera_hal_interface_init(camera_hal_interface **h) tmp_h->intf.deinit = dlsym(tmp_h->dl_handle, "camera_deinit"); tmp_h->intf.get_device_info_list = dlsym(tmp_h->dl_handle, "camera_get_device_info_list"); tmp_h->intf.open_device = dlsym(tmp_h->dl_handle, "camera_open_device"); + tmp_h->intf.open_device_ext = dlsym(tmp_h->dl_handle, "camera_open_device_ext"); tmp_h->intf.close_device = dlsym(tmp_h->dl_handle, "camera_close_device"); tmp_h->intf.add_message_callback = dlsym(tmp_h->dl_handle, "camera_add_message_callback"); tmp_h->intf.remove_message_callback = dlsym(tmp_h->dl_handle, "camera_remove_message_callback"); @@ -186,6 +187,22 @@ int camera_hal_interface_open_device(camera_hal_interface *h, int device_index) } +int camera_hal_interface_open_device_ext(camera_hal_interface *h, const char *device_name) +{ + if (h == NULL) { + LOGE("NULL interface"); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if (!h->intf.open_device_ext) { + LOGE("camera_open_device_ext not implemented"); + return CAMERA_ERROR_NOT_IMPLEMENTED; + } + + return h->intf.open_device_ext(h->hal_handle, device_name); +} + + int camera_hal_interface_close_device(camera_hal_interface *h) { if (h == NULL) { -- 2.7.4