2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #ifndef __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
22 #define __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
25 #include <muse_core.h>
26 #include <muse_camera.h>
27 #include <mm_display_interface.h>
33 #ifdef BUFFER_MAX_PLANE_NUM
34 #undef BUFFER_MAX_PLANE_NUM
35 #endif /* BUFFER_MAX_PLANE_NUM */
37 #define BUFFER_MAX_PLANE_NUM 4
38 #define CAMERA_CB_TIMEOUT 4
39 #define CAMERA_CB_NO_TIMEOUT 0
41 #define CAMERA_MSG_PARAM_SET(param, msg_type, set_value) { \
42 param.type = MUSE_TYPE_##msg_type; \
43 param.name = #set_value; \
44 param.value.value_##msg_type = set_value; \
47 #define PREVIEW_CB_TYPE_USER 0x0000000F
48 #define PREVIEW_CB_TYPE_EVAS 0x000000F0
50 #define CHECK_PREVIEW_CB(cb_info, cb_type) ((cb_info)->preview_cb_flag & cb_type)
51 #define SET_PREVIEW_CB_TYPE(cb_info, cb_type) ((cb_info)->preview_cb_flag |= cb_type)
52 #define UNSET_PREVIEW_CB_TYPE(cb_info, cb_type) ((cb_info)->preview_cb_flag &= ~cb_type)
55 CAMERA_MESSAGE_HANDLER_TYPE_GENERAL,
56 CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB,
57 CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB
60 typedef struct _camera_stream_data_s {
64 unsigned int length_yuv;
68 unsigned int length_y;
70 unsigned int length_uv;
74 unsigned int length_y;
76 unsigned int length_u;
78 unsigned int length_v;
82 unsigned int length_data;
84 } data; /**< pointer of captured stream */
85 int data_type; /**< data type */
86 unsigned int length_total; /**< total length of stream buffer (in byte)*/
87 unsigned int num_planes; /**< number of planes */
88 MMPixelFormatType format; /**< image format */
89 int width; /**< width of video buffer */
90 int height; /**< height of video buffer */
91 unsigned int timestamp; /**< timestamp of stream buffer (msec)*/
92 void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
93 void *internal_buffer; /**< Internal buffer pointer */
94 int stride[BUFFER_MAX_PLANE_NUM]; /**< Stride of each plane */
95 int elevation[BUFFER_MAX_PLANE_NUM]; /**< Elevation of each plane */
96 } camera_stream_data_s;
98 typedef struct _camera_msg_handler_info_s {
106 } camera_msg_handler_info_s;
108 typedef struct _camera_cb_info_s {
109 /* server connection */
112 gboolean is_server_connected;
114 /* message receive thread */
115 GThread *msg_recv_thread;
116 gint msg_recv_running;
117 gchar recv_msg[MUSE_MSG_MAX_LENGTH + 1];
118 GCond api_cond[MUSE_CAMERA_API_MAX];
119 GMutex api_mutex[MUSE_CAMERA_API_MAX];
120 gint api_activating[MUSE_CAMERA_API_MAX];
121 gint api_waiting[MUSE_CAMERA_API_MAX];
122 gint api_ret[MUSE_CAMERA_API_MAX];
124 /* general message handler info */
125 camera_msg_handler_info_s msg_handler_info;
127 /* preview cb message handler info */
128 camera_msg_handler_info_s preview_cb_info;
130 /* capture cb message handler info */
131 camera_msg_handler_info_s capture_cb_info;
134 GList *idle_event_list;
135 GCond idle_event_cond;
136 GMutex idle_event_mutex;
139 gpointer user_cb[MUSE_CAMERA_EVENT_TYPE_NUM];
140 gpointer user_data[MUSE_CAMERA_EVENT_TYPE_NUM];
141 GMutex user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_NUM];
150 media_format_h pkt_fmt;
151 GMutex mp_data_mutex;
153 /* preview callback flag */
155 camera_pixel_format_e preview_format;
158 camera_display_type_e dp_type;
159 mm_display_interface_h dp_interface;
160 gboolean run_evas_render;
163 gint get_int[MUSE_CAMERA_GET_INT_NUM];
164 gint get_int_pair[MUSE_CAMERA_GET_INT_PAIR_NUM][2];
165 gchar get_string[MUSE_CAMERA_GET_STRING_NUM][MUSE_CAMERA_MSG_MAX_LENGTH];
166 gdouble get_geotag[3];
167 gint get_display_roi_area[4];
170 typedef struct _camera_message_s {
171 gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH + 1];
172 muse_camera_api_e api;
173 muse_camera_event_e event;
174 muse_camera_event_class_e event_class;
177 typedef struct _camera_idle_event_s {
178 camera_cb_info_s *cb_info;
179 gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH + 1];
180 muse_camera_event_e event;
182 } camera_idle_event_s;
184 typedef struct _camera_wl_info_s {
192 typedef struct _camera_cli_s {
193 intptr_t remote_handle;
194 camera_cb_info_s *cb_info;
197 typedef struct _camera_media_packet_data {
200 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM];
204 } camera_media_packet_data;
206 typedef struct _camera_msg_param {
211 const char *value_STRING;
215 typedef struct _camera_cb_info {
222 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format);
223 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype);
224 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data);
225 int _camera_start_evas_rendering(camera_h camera);
226 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen);
227 int _camera_independent_request(int api, int device_type, const char *key, int *value);
229 typedef bool (*camera_supported_cb_param1)(int param, void *user_data);
230 typedef bool (*camera_supported_cb_param2)(int param1, int param2, void *user_data);
236 #endif /* __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__ */