Release version 0.2.14
[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 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define MAX_DETECTED_FACE 20
33
34 #define CAMERA_PARSE_STRING_SIZE 200
35
36 typedef enum {
37         _CAMERA_EVENT_TYPE_STATE_CHANGE,
38         _CAMERA_EVENT_TYPE_FOCUS_CHANGE,
39         _CAMERA_EVENT_TYPE_CAPTURE_COMPLETE,
40         _CAMERA_EVENT_TYPE_PREVIEW,
41         _CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW,
42         _CAMERA_EVENT_TYPE_CAPTURE,
43         _CAMERA_EVENT_TYPE_ERROR,
44         _CAMERA_EVENT_TYPE_HDR_PROGRESS,
45         _CAMERA_EVENT_TYPE_INTERRUPTED,
46         _CAMERA_EVENT_TYPE_FACE_DETECTION,
47         _CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR,
48         _CAMERA_EVENT_TYPE_NUM
49 }_camera_event_e;
50
51 typedef struct _camera_cb_data {
52         int event_type;
53         void *handle;
54 } camera_cb_data;
55
56 typedef struct _callback_cb_info {
57         GThread *msg_rcv_thread;
58         GThread *event_thread;
59         gint rcv_thread_running;
60         gint event_thread_running;
61         gint fd;
62         gint id;
63         gpointer user_cb[MUSE_CAMERA_EVENT_TYPE_NUM];
64         gpointer user_cb_completed[MUSE_CAMERA_EVENT_TYPE_NUM];
65         gpointer user_data[MUSE_CAMERA_EVENT_TYPE_NUM];
66         gchar recvMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
67         gchar recvApiMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
68         gchar recvEventMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
69         GCond *pCond;
70         GMutex *pMutex;
71         GCond event_cond;
72         GMutex event_mutex;
73         gint *activating;
74         tbm_bufmgr bufmgr;
75         GQueue *event_queue;
76 } callback_cb_info_s;
77
78 typedef struct _event_info_s {
79         gchar recvMsg[MUSE_CAMERA_MSG_MAX_LENGTH];
80         muse_camera_event_e event;
81 } event_info_s;
82
83 typedef struct _camera_cli_s {
84         intptr_t remote_handle;
85         MMHandleType client_handle;
86         intptr_t cli_display_handle;
87         callback_cb_info_s *cb_info;
88 #ifdef HAVE_WAYLAND
89         MMCamWaylandInfo *wl_info;
90 #endif /* #ifdef HAVE_WAYLAND */
91 } camera_cli_s;
92
93 typedef enum {
94         MUSE_CAMERA_CLIENT_SYNC_CB_HANDLER,
95         MUSE_CAMERA_CLIENT_USER_CALLBACK,
96         MUSE_CAMERA_CLIENT_MAX
97 } muse_cli_camera_api_e;
98
99 int _camera_get_mm_handle(camera_h camera , MMHandleType *handle);
100 int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data);
101 int __camera_start_continuous_focusing(camera_h camera);
102 int _camera_set_use(camera_h camera, bool used);
103 bool _camera_is_used(camera_h camera);
104 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format);
105 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype);
106 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data);
107 int __convert_camera_error_code(const char* func, int code);
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif //__TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
114