[Release version 0.2.36] Fix bug - media packet preview callback is not invoked,...
[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 CAMERA_PARSE_STRING_SIZE 20
34
35 typedef struct _camera_cb_info_s {
36         gint fd;
37         GThread *msg_recv_thread;
38         GThread *msg_handler_thread;
39         gint msg_recv_running;
40         gint msg_handler_running;
41         GCond msg_handler_cond;
42         GMutex msg_handler_mutex;
43         GQueue *msg_queue;
44         GList *idle_event_list;
45         GCond idle_event_cond;
46         GMutex idle_event_mutex;
47         gpointer user_cb[MUSE_CAMERA_EVENT_TYPE_NUM];
48         gpointer user_data[MUSE_CAMERA_EVENT_TYPE_NUM];
49         gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
50         GCond api_cond[MUSE_CAMERA_API_MAX];
51         GMutex api_mutex[MUSE_CAMERA_API_MAX];
52         gint *api_activating;
53         gint *api_ret;
54         tbm_bufmgr bufmgr;
55         gint prev_state;
56         gchar *caps;
57         media_format_h pkt_fmt;
58 } camera_cb_info_s;
59
60 typedef struct _camera_message_s {
61         gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
62         muse_camera_api_e api;
63 } camera_message_s;
64
65 typedef struct _camera_idle_event_s {
66         camera_cb_info_s *cb_info;
67         gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
68         muse_camera_event_e event;
69         GMutex event_mutex;
70 } camera_idle_event_s;
71
72 typedef struct _camera_cli_s {
73         intptr_t remote_handle;
74         MMHandleType client_handle;
75         intptr_t display_handle;
76         camera_cb_info_s *cb_info;
77 #ifdef HAVE_WAYLAND
78         MMCamWaylandInfo *wl_info;
79 #endif /* #ifdef HAVE_WAYLAND */
80 } camera_cli_s;
81
82 typedef struct _camera_media_packet_data {
83         int tbm_key;
84         tbm_bo bo;
85         tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM];
86         int num_buffer_key;
87 } camera_media_packet_data;
88
89
90 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format);
91 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype);
92 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data);
93 int __convert_camera_error_code(const char* func, int code);
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif /* __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__ */
100