Release version 0.2.21
[platform/core/api/camera.git] / include / camera_private.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17
18
19
20
21 #ifndef __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
22 #define __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
23 #include <camera.h>
24 #include <muse_core.h>
25 #include <muse_camera.h>
26 #include <mm_camcorder.h>
27
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #define MAX_DETECTED_FACE 20
34
35 #define CAMERA_PARSE_STRING_SIZE 20
36
37 typedef enum {
38         _CAMERA_EVENT_TYPE_STATE_CHANGE,
39         _CAMERA_EVENT_TYPE_FOCUS_CHANGE,
40         _CAMERA_EVENT_TYPE_CAPTURE_COMPLETE,
41         _CAMERA_EVENT_TYPE_PREVIEW,
42         _CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW,
43         _CAMERA_EVENT_TYPE_CAPTURE,
44         _CAMERA_EVENT_TYPE_ERROR,
45         _CAMERA_EVENT_TYPE_HDR_PROGRESS,
46         _CAMERA_EVENT_TYPE_INTERRUPTED,
47         _CAMERA_EVENT_TYPE_FACE_DETECTION,
48         _CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR,
49         _CAMERA_EVENT_TYPE_NUM
50 }_camera_event_e;
51
52 typedef struct _camera_cb_data {
53         int event_type;
54         void *handle;
55 } camera_cb_data;
56
57 typedef struct _callback_cb_info {
58         GThread *msg_rcv_thread;
59         GThread *event_thread;
60         gint rcv_thread_running;
61         gint event_thread_running;
62         gint fd;
63         gint id;
64         gpointer user_cb[MUSE_CAMERA_EVENT_TYPE_NUM];
65         gpointer user_cb_completed[MUSE_CAMERA_EVENT_TYPE_NUM];
66         gpointer user_data[MUSE_CAMERA_EVENT_TYPE_NUM];
67         gchar recvMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
68         gchar recvApiMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
69         gchar recvEventMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
70         GCond *pCond;
71         GMutex *pMutex;
72         GCond event_cond;
73         GMutex event_mutex;
74         GList *idle_event_list;
75         GCond idle_event_cond;
76         GMutex idle_event_mutex;
77         gint *activating;
78         tbm_bufmgr bufmgr;
79         GQueue *event_queue;
80         gint prev_state;
81         media_format_h pkt_fmt;
82 } callback_cb_info_s;
83
84 typedef struct _camera_event_s {
85         callback_cb_info_s *cb_info;
86         gchar recvMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
87         muse_camera_event_e event;
88 } camera_event_s;
89
90 typedef struct _camera_idle_event_s {
91         callback_cb_info_s *cb_info;
92         gchar recvMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
93         muse_camera_event_e event;
94         GMutex event_mutex;
95 } camera_idle_event_s;
96
97 typedef struct _camera_cli_s {
98         intptr_t remote_handle;
99         MMHandleType client_handle;
100         intptr_t cli_display_handle;
101         callback_cb_info_s *cb_info;
102 #ifdef HAVE_WAYLAND
103         MMCamWaylandInfo *wl_info;
104 #endif /* #ifdef HAVE_WAYLAND */
105 } camera_cli_s;
106
107 typedef struct _camera_media_packet_data {
108         int tbm_key;
109         tbm_bo bo;
110         tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM];
111         int num_buffer_key;
112 } camera_media_packet_data;
113
114 typedef enum {
115         MUSE_CAMERA_CLIENT_SYNC_CB_HANDLER,
116         MUSE_CAMERA_CLIENT_USER_CALLBACK,
117         MUSE_CAMERA_CLIENT_MAX
118 } muse_cli_camera_api_e;
119
120 int _camera_get_mm_handle(camera_h camera , MMHandleType *handle);
121 int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data);
122 int __camera_start_continuous_focusing(camera_h camera);
123 int _camera_set_use(camera_h camera, bool used);
124 bool _camera_is_used(camera_h camera);
125 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format);
126 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype);
127 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data);
128 int __convert_camera_error_code(const char* func, int code);
129
130 #ifdef __cplusplus
131 }
132 #endif
133
134 #endif //__TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
135