{
CAMERA_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */
CAMERA_DISPLAY_TYPE_EVAS, /**< Evas object surface display */
+ CAMERA_DISPLAY_TYPE_REMOTE, /**< Remote surface for display */
CAMERA_DISPLAY_TYPE_NONE /**< This disposes off buffers */
} camera_display_type_e;
* @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE
* @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY.
* @param[in] camera The handle to the camera
- * @param[in] type The type of the display
- * @param[in] display_handle The handle of the created display
- *
- * @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_OPERATION Invalid operation
- * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
- * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create().
- * @post camera_set_mused_display() will be invoked.
- *
- * @see camera_set_mused_display()
- */
-int legacy_camera_set_mused_display(camera_h camera, camera_display_type_e type);
-
-/**
- * @brief Registers a callback function to be invoked when camera needs updated xid.
- * @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE
- * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY.
- * @param[in] camera The handle to the camera
* @param[in] caps The caps information of the server's video element
*
* @return @c 0 on success, otherwise a negative error value
int legacy_camera_get_video_caps(camera_h camera, char **caps);
/**
- * @brief Registers a callback function to be invoked when camera needs updated xid.
- * @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE
- * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY.
- * @param[in] camera The handle to the camera
- * @param[in] socket_path The socket file path for the display data ipc
- *
- * @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_OPERATION Invalid operation
- * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
- * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create().
- * @post camera_set_shm_socket_path_for_mused() will be invoked.
- *
- * @see camera_set_shm_socket_path_for_mused()
- */
-int legacy_camera_set_shm_socket_path_for_mused(camera_h camera, char *socket_path);
-
-/**
* @brief Set pid of client for sound focus API.
* @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE
* @param[in] camera The handle to the camera
Evas_Object *obj = NULL;
const char *object_type = NULL;
+ char *socket_path = NULL;
if (camera == NULL) {
LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
handle = (camera_s *)camera;
handle->display_type = type;
- if (type == CAMERA_DISPLAY_TYPE_NONE) {
- /* NULL surface */
- set_surface = MM_DISPLAY_SURFACE_NULL;
- handle->display_handle = 0;
+ LOGD("display type - %d, display handle - %p", type, display);
- LOGD("display type NONE");
- } else {
+ switch (type) {
+ case CAMERA_DISPLAY_TYPE_OVERLAY:
+ case CAMERA_DISPLAY_TYPE_EVAS:
obj = (Evas_Object *)display;
object_type = evas_object_type_get(obj);
if (object_type) {
LOGE("failed to get evas object type from %p", obj);
return CAMERA_ERROR_INVALID_PARAMETER;
}
+ break;
+ case CAMERA_DISPLAY_TYPE_REMOTE:
+ set_surface = MM_DISPLAY_SURFACE_REMOTE;
+ handle->display_handle = display;
+ break;
+ case CAMERA_DISPLAY_TYPE_NONE:
+ set_surface = MM_DISPLAY_SURFACE_NULL;
+ handle->display_handle = 0;
+ break;
+ default:
+ LOGE("unknown display type %d", type);
+ return CAMERA_ERROR_INVALID_PARAMETER;
}
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
- MMCAM_DISPLAY_SURFACE, set_surface,
- NULL);
+ MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
+ MMCAM_DISPLAY_SURFACE, set_surface,
+ NULL);
- if (ret == MM_ERROR_NONE && type != CAMERA_DISPLAY_TYPE_NONE) {
- ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *),
- NULL);
+ if (ret == MM_ERROR_NONE) {
+ if (type == CAMERA_DISPLAY_TYPE_REMOTE) {
+ socket_path = (char *)handle->display_handle;
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_DISPLAY_SHM_SOCKET_PATH, socket_path, strlen(socket_path),
+ NULL);
+ } else if (type != CAMERA_DISPLAY_TYPE_NONE) {
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *),
+ NULL);
+ }
}
return __convert_camera_error_code(__func__, ret);
#define LOG_TAG "TIZEN_N_CAMERA"
-int legacy_camera_set_mused_display(camera_h camera, camera_display_type_e type)
-{
- int ret = MM_ERROR_NONE;
- int set_surface = MM_DISPLAY_SURFACE_X;
- camera_s *handle = NULL;
-
- if (camera == NULL) {
- LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
-
- handle = (camera_s *)camera;
- handle->display_type = type;
-
- switch(type) {
- case CAMERA_DISPLAY_TYPE_OVERLAY:
- set_surface = MM_DISPLAY_SURFACE_X;
- LOGD("display type OVERLAY : set_surface : 0x%x", set_surface);
- break;
- case CAMERA_DISPLAY_TYPE_EVAS:
- set_surface = MM_DISPLAY_SURFACE_EVAS;
- break;
- case CAMERA_DISPLAY_TYPE_NONE:
- default:
- set_surface = MM_DISPLAY_SURFACE_NULL;
- break;
- }
-
- ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
- MMCAM_DISPLAY_SURFACE, set_surface,
- NULL);
-
- return __convert_camera_error_code(__func__, ret);
-}
-
int legacy_camera_get_video_caps(camera_h camera, char **caps)
{
int ret;
return CAMERA_ERROR_NONE;
}
-int legacy_camera_set_shm_socket_path_for_mused(camera_h camera, char *socket_path)
-{
- int ret;
- camera_s *handle = (camera_s *)camera;
-
- LOGE("var : %s", socket_path);
- ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
- MMCAM_DISPLAY_SHM_SOCKET_PATH, socket_path, strlen(socket_path),
- NULL);
-
- if (ret != MM_ERROR_NONE) {
- LOGE("error set shm socket path attribute 0x%x", ret);
- return __convert_camera_error_code(__func__, ret);
- }
-
- return CAMERA_ERROR_NONE;
-}
-
int legacy_camera_set_client_pid(camera_h camera, int pid)
{
int ret;
typedef enum {
MUSE_CAMERA_EVENT_CLASS_NORMAL,
MUSE_CAMERA_EVENT_CLASS_IMMEDIATE,
- MUSE_CAMERA_EVENT_CLASS_IDLE,
+ MUSE_CAMERA_EVENT_CLASS_MAIN_THREAD,
MUSE_CAMERA_EVENT_CLASS_NUM
} muse_camera_event_class_e;
do{ \
char *__sndMsg__; \
int __len__; \
- __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \
__len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \
if (__len__ <= 0) { \
LOGE("sending message failed"); \
muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE,
- MUSE_CAMERA_EVENT_CLASS_IDLE,
+ MUSE_CAMERA_EVENT_CLASS_MAIN_THREAD,
module,
INT, previous,
INT, current,
muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
MUSE_CAMERA_EVENT_TYPE_INTERRUPTED,
- MUSE_CAMERA_EVENT_CLASS_IDLE,
+ MUSE_CAMERA_EVENT_CLASS_MAIN_THREAD,
module,
INT, policy,
INT, previous,
muse_camera_msg_event(MUSE_CAMERA_CB_EVENT,
MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE,
- MUSE_CAMERA_EVENT_CLASS_IDLE,
+ MUSE_CAMERA_EVENT_CLASS_MAIN_THREAD,
module);
return;
}
/* send message */
muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION,
- MUSE_CAMERA_EVENT_CLASS_IDLE,
+ MUSE_CAMERA_EVENT_CLASS_MAIN_THREAD,
module,
INT, count,
INT, tbm_key);
muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE,
- MUSE_CAMERA_EVENT_CLASS_IDLE,
+ MUSE_CAMERA_EVENT_CLASS_MAIN_THREAD,
module,
INT, state);
muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
MUSE_CAMERA_EVENT_TYPE_ERROR,
- MUSE_CAMERA_EVENT_CLASS_IDLE,
+ MUSE_CAMERA_EVENT_CLASS_MAIN_THREAD,
module,
INT, error,
INT, current_state);
muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS,
- MUSE_CAMERA_EVENT_CLASS_IDLE,
+ MUSE_CAMERA_EVENT_CLASS_MAIN_THREAD,
module,
INT, percent);
return;
muse_camera_handle_s *muse_camera = NULL;
muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
char *caps = NULL;
+ camera_state_e prev_state = CAMERA_STATE_NONE;
muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
LOGD("handle : %p", muse_camera);
+ legacy_camera_get_state(muse_camera->camera_handle, &prev_state);
+
ret = legacy_camera_start_preview(muse_camera->camera_handle);
- if(ret == CAMERA_ERROR_NONE) {
+ if (ret != CAMERA_ERROR_NONE) {
+ LOGD("start preview failed 0x%x", ret);
+ muse_camera_msg_return(api, ret, module);
+ return MUSE_CAMERA_ERROR_NONE;
+ }
+
+ if (prev_state == CAMERA_STATE_CREATED) {
ret = legacy_camera_get_video_caps(muse_camera->camera_handle, &caps);
- if((ret == CAMERA_ERROR_NONE) && caps) {
+ if (ret == CAMERA_ERROR_NONE && caps) {
LOGD("caps : %s", caps);
- muse_camera_msg_return1(api, ret, module, STRING, caps);
+ muse_camera_msg_return2(api, ret, module, STRING, caps, INT, prev_state);
g_free(caps);
} else {
LOGD("Failed to get server's video caps. ret 0x%x, caps %p", ret, caps);
}
}
} else {
- LOGD("start preview failed 0x%x", ret);
- muse_camera_msg_return(api, ret, module);
- return ret;
+ LOGD("preview started after capture");
+ muse_camera_msg_return1(api, ret, module, INT, prev_state);
}
return MUSE_CAMERA_ERROR_NONE;
{
int ret = CAMERA_ERROR_NONE;
muse_camera_handle_s *muse_camera = NULL;
- int display_type;
- int display_surface;
muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
static guint stream_id = 0;
char socket_path[SOCKET_PATH_LENGTH] = {0,};
muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
- muse_camera_msg_get(display_type, muse_core_client_get_msg(module));
- muse_camera_msg_get(display_surface, muse_core_client_get_msg(module));
-
- LOGD("handle : 0x%x, display_type : %d", muse_camera, display_type);
+ LOGD("handle : 0x%x", muse_camera);
camera = muse_camera->camera_handle;
stream_id = muse_core_get_atomic_uint();
LOGD("socket_path : %s", socket_path);
- ret = legacy_camera_set_shm_socket_path_for_mused(camera, socket_path);
-
- ret |= legacy_camera_set_mused_display(muse_camera->camera_handle, (camera_display_type_e)display_type);
-
+ ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_REMOTE, (void *)socket_path);
if (ret != CAMERA_ERROR_NONE) {
muse_camera_msg_return(api, ret, module);
} else {
Name: mmsvc-camera
Summary: A Camera module for muse server
-Version: 0.2.10
+Version: 0.2.11
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0