[Release version 0.2.44] Remove client pipeline code and unnecessary dependency ...
[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
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #ifdef BUFFER_MAX_PLANE_NUM
33 #undef BUFFER_MAX_PLANE_NUM
34 #endif /* BUFFER_MAX_PLANE_NUM */
35
36 #define BUFFER_MAX_PLANE_NUM    4
37 #define CAMERA_PARSE_STRING_SIZE 20
38
39
40 typedef struct _camera_stream_data_s {
41         union {
42                 struct {
43                         unsigned char *yuv;
44                         unsigned int length_yuv;
45                 } yuv420, yuv422;
46                 struct {
47                         unsigned char *y;
48                         unsigned int length_y;
49                         unsigned char *uv;
50                         unsigned int length_uv;
51                 } yuv420sp;
52                 struct {
53                         unsigned char *y;
54                         unsigned int length_y;
55                         unsigned char *u;
56                         unsigned int length_u;
57                         unsigned char *v;
58                         unsigned int length_v;
59                 } yuv420p, yuv422p;
60                 struct {
61                         unsigned char *data;
62                         unsigned int length_data;
63                 } encoded;
64         } data;                         /**< pointer of captured stream */
65         int data_type;                  /**< data type */
66         unsigned int length_total;      /**< total length of stream buffer (in byte)*/
67         unsigned int num_planes;        /**< number of planes */
68         MMPixelFormatType format;       /**< image format */
69         int width;                      /**< width of video buffer */
70         int height;                     /**< height of video buffer */
71         unsigned int timestamp;         /**< timestamp of stream buffer (msec)*/
72         void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
73         void *internal_buffer;          /**< Internal buffer pointer */
74         int stride[BUFFER_MAX_PLANE_NUM];    /**< Stride of each plane */
75         int elevation[BUFFER_MAX_PLANE_NUM]; /**< Elevation of each plane */
76 } camera_stream_data_s;
77
78
79 typedef struct _camera_cb_info_s {
80         gint fd;
81         GThread *msg_recv_thread;
82         GThread *msg_handler_thread;
83         gint msg_recv_running;
84         gint msg_handler_running;
85         GCond msg_handler_cond;
86         GMutex msg_handler_mutex;
87         GQueue *msg_queue;
88         GList *idle_event_list;
89         GCond idle_event_cond;
90         GMutex idle_event_mutex;
91         gpointer user_cb[MUSE_CAMERA_EVENT_TYPE_NUM];
92         gpointer user_data[MUSE_CAMERA_EVENT_TYPE_NUM];
93         gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
94         GCond api_cond[MUSE_CAMERA_API_MAX];
95         GMutex api_mutex[MUSE_CAMERA_API_MAX];
96         gint *api_activating;
97         gint *api_ret;
98         tbm_bufmgr bufmgr;
99         media_format_h pkt_fmt;
100 } camera_cb_info_s;
101
102 typedef struct _camera_message_s {
103         gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
104         muse_camera_api_e api;
105 } camera_message_s;
106
107 typedef struct _camera_idle_event_s {
108         camera_cb_info_s *cb_info;
109         gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
110         muse_camera_event_e event;
111         GMutex event_mutex;
112 } camera_idle_event_s;
113
114 #ifdef HAVE_WAYLAND
115 typedef struct _camera_wl_info_s {
116         int parent_id;
117         int window_x;
118         int window_y;
119         int window_width;
120         int window_height;
121         void *evas_obj;
122 } camera_wl_info_s;
123 #endif /* HAVE_WAYLAND */
124
125 typedef struct _camera_cli_s {
126         intptr_t remote_handle;
127         intptr_t display_handle;
128         camera_cb_info_s *cb_info;
129 #ifdef HAVE_WAYLAND
130         camera_wl_info_s wl_info;
131 #endif /* HAVE_WAYLAND */
132 } camera_cli_s;
133
134 typedef struct _camera_media_packet_data {
135         int tbm_key;
136         tbm_bo bo;
137         tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM];
138         int num_buffer_key;
139 } camera_media_packet_data;
140
141
142 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format);
143 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype);
144 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data);
145
146 #ifdef __cplusplus
147 }
148 #endif
149
150 #endif /* __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__ */
151