#ifndef __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
-#define __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
+#define __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
+#include <glib.h>
#include <camera.h>
#include <muse_core.h>
#include <muse_camera.h>
-#include <mm_camcorder.h>
-
+#include <mm_display_interface.h>
#ifdef __cplusplus
extern "C" {
#endif
-#define CAMERA_PARSE_STRING_SIZE 20
+#ifdef BUFFER_MAX_PLANE_NUM
+#undef BUFFER_MAX_PLANE_NUM
+#endif /* BUFFER_MAX_PLANE_NUM */
+
+#define BUFFER_MAX_PLANE_NUM 4
+#define CAMERA_CB_TIMEOUT 4
+#define CAMERA_CB_NO_TIMEOUT 0
+
+#define CAMERA_MSG_PARAM_SET(param, msg_type, set_value) { \
+ param.type = MUSE_TYPE_##msg_type; \
+ param.name = #set_value; \
+ param.value.value_##msg_type = set_value; \
+}
+
+#define CAMERA_MSG_PARAM_SET_ARRAY(param, msg_type, set_value, size) { \
+ param.type = MUSE_TYPE_##msg_type; \
+ param.name = #set_value; \
+ param.value.value_##msg_type = set_value; \
+ param.value_size = size; \
+}
+
+#define PREVIEW_CB_TYPE_USER 0x0000000F
+#define PREVIEW_CB_TYPE_EVAS 0x000000F0
+
+#define CHECK_PREVIEW_CB(cb_info, cb_type) ((cb_info)->preview_cb_flag & cb_type)
+#define SET_PREVIEW_CB_TYPE(cb_info, cb_type) ((cb_info)->preview_cb_flag |= cb_type)
+#define UNSET_PREVIEW_CB_TYPE(cb_info, cb_type) ((cb_info)->preview_cb_flag &= ~cb_type)
+
+enum {
+ CAMERA_MESSAGE_HANDLER_TYPE_GENERAL,
+ CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB,
+ CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB
+};
+
+typedef struct _camera_stream_data_s {
+ union {
+ struct {
+ unsigned char *yuv;
+ unsigned int length_yuv;
+ } yuv420, yuv422;
+ struct {
+ unsigned char *y;
+ unsigned int length_y;
+ unsigned char *uv;
+ unsigned int length_uv;
+ } yuv420sp;
+ struct {
+ unsigned char *y;
+ unsigned int length_y;
+ unsigned char *u;
+ unsigned int length_u;
+ unsigned char *v;
+ unsigned int length_v;
+ } yuv420p, yuv422p;
+ struct {
+ unsigned char *data;
+ unsigned int length_data;
+ int is_delta_frame;
+ } encoded, depth, rgb;
+ } data; /**< pointer of captured stream */
+ int data_type; /**< data type */
+ unsigned int length_total; /**< total length of stream buffer (in byte)*/
+ unsigned int num_planes; /**< number of planes */
+ MMPixelFormatType format; /**< image format */
+ int width; /**< width of video buffer */
+ int height; /**< height of video buffer */
+ unsigned int timestamp; /**< timestamp of stream buffer (msec)*/
+ void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
+ void *internal_buffer; /**< Internal buffer pointer */
+ int stride[BUFFER_MAX_PLANE_NUM]; /**< Stride of each plane */
+ int elevation[BUFFER_MAX_PLANE_NUM]; /**< Elevation of each plane */
+} camera_stream_data_s;
+
+typedef struct _camera_msg_handler_info_s {
+ int type;
+ void *cb_info;
+ int running;
+ GCond cond;
+ GMutex mutex;
+ GQueue *queue;
+ GThread *thread;
+} camera_msg_handler_info_s;
typedef struct _camera_cb_info_s {
+ /* server connection */
gint fd;
+ GMutex fd_lock;
+ gboolean is_server_connected;
+
+ /* message receive thread */
GThread *msg_recv_thread;
- GThread *msg_handler_thread;
gint msg_recv_running;
- gint msg_handler_running;
- GCond msg_handler_cond;
- GMutex msg_handler_mutex;
- GQueue *msg_queue;
+ gchar recv_msg[MUSE_MSG_MAX_LENGTH + 1];
+ GCond api_cond[MUSE_CAMERA_API_MAX];
+ GMutex api_mutex[MUSE_CAMERA_API_MAX];
+ gint api_activating[MUSE_CAMERA_API_MAX];
+ gint api_waiting[MUSE_CAMERA_API_MAX];
+ gint api_ret[MUSE_CAMERA_API_MAX];
+
+ /* general message handler info */
+ camera_msg_handler_info_s msg_handler_info;
+
+ /* preview cb message handler info */
+ camera_msg_handler_info_s preview_cb_info;
+
+ /* capture cb message handler info */
+ camera_msg_handler_info_s capture_cb_info;
+
+ /* idle event */
GList *idle_event_list;
- GCond idle_event_cond;
- GMutex idle_event_mutex;
+
+ /* user callback */
gpointer user_cb[MUSE_CAMERA_EVENT_TYPE_NUM];
gpointer user_data[MUSE_CAMERA_EVENT_TYPE_NUM];
- gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
- GCond api_cond[MUSE_CAMERA_API_MAX];
- GMutex api_mutex[MUSE_CAMERA_API_MAX];
- gint *api_activating;
- gint *api_ret;
+ GMutex user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_NUM];
+
+ /* tbm */
tbm_bufmgr bufmgr;
- gint prev_state;
- gchar *caps;
+ gboolean user_buffer_supported;
+ tbm_bo bos[MUSE_NUM_FD];
+ tbm_fd fds[MUSE_NUM_FD];
+
+ /* media packet */
media_format_h pkt_fmt;
+ GMutex mp_data_mutex;
+
+ /* preview callback flag */
+ int preview_cb_flag;
+ camera_pixel_format_e preview_format;
+
+ /* display */
+ muse_camera_display_info_s dp_info;
+ mm_display_interface_h dp_interface;
+ gboolean run_evas_render;
+
+ /* get values */
+ gint get_int[MUSE_CAMERA_GET_INT_NUM];
+ gint get_int_pair[MUSE_CAMERA_GET_INT_PAIR_NUM][2];
+ gchar get_string[MUSE_CAMERA_GET_STRING_NUM][MUSE_CAMERA_MSG_MAX_LENGTH];
+ gdouble get_geotag[3];
+ gint get_display_roi_area[4];
} camera_cb_info_s;
typedef struct _camera_message_s {
- gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
+ gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH + 1];
muse_camera_api_e api;
+ muse_camera_event_e event;
+ muse_camera_event_class_e event_class;
+ int tfd[MUSE_NUM_FD];
} camera_message_s;
typedef struct _camera_idle_event_s {
camera_cb_info_s *cb_info;
- gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
+ gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH + 1];
muse_camera_event_e event;
- GMutex event_mutex;
+ int tfd[MUSE_NUM_FD];
} camera_idle_event_s;
typedef struct _camera_cli_s {
intptr_t remote_handle;
- MMHandleType client_handle;
- int display_type;
- intptr_t display_handle;
camera_cb_info_s *cb_info;
-#ifdef HAVE_WAYLAND
- MMCamWaylandInfo wl_info;
-#endif /* HAVE_WAYLAND */
} camera_cli_s;
typedef struct _camera_media_packet_data {
- int tbm_key;
+ int ret_fd;
+ tbm_fd fd;
+ tbm_fd data_fd;
+ tbm_fd buffer_fd[MUSE_NUM_FD];
tbm_bo bo;
tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM];
- int num_buffer_key;
+ int num_buffer_fd;
+ tbm_bo data_bo;
+ int ref_cnt;
} camera_media_packet_data;
+typedef struct _camera_msg_param {
+ int type;
+ const char *name;
+ union {
+ int value_INT;
+ const char *value_STRING;
+ void *value_ARRAY;
+ } value;
+ int value_size;
+} camera_msg_param;
+
+typedef struct _camera_cb_info {
+ int id;
+ void *callback;
+ void *user_data;
+} camera_cb_info;
+
int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format);
int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype);
int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data);
-int __convert_camera_error_code(const char *func, int code);
+int _camera_start_evas_rendering(camera_h camera);
+int _camera_stop_evas_rendering(camera_h camera, bool keep_screen);
+int _camera_independent_request(int api, int device_type, const char *key, int *value);
+
+typedef bool (*camera_supported_cb_param1)(int param, void *user_data);
+typedef bool (*camera_supported_cb_param2)(int param1, int param2, void *user_data);
#ifdef __cplusplus
}