[Release version 0.2.33] Add new enum for server connection error - RECORDER_ERROR_SE...
[platform/core/api/recorder.git] / include / recorder_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 #ifndef __TIZEN_MULTIMEDIA_RECORDER_PRIVATE_H__
20 #define __TIZEN_MULTIMEDIA_RECORDER_PRIVATE_H__
21 #include <camera.h>
22 #include <recorder.h>
23 #include <muse_core.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #define RECORDER_PARSE_STRING_SIZE 30
30 #define RECORDER_MSG_LENGTH_MAX    5120
31 #define RECORDER_CB_TIMEOUT        5
32
33 #define RECORDER_MSG_PARAM_SET(param, msg_type, set_value) { \
34         param.type = MUSE_TYPE_##msg_type; \
35         param.name = #set_value; \
36         param.value.value_##msg_type = set_value; \
37 }
38
39 enum {
40         _RECORDER_GET_INT_STATE = 0,
41         _RECORDER_GET_INT_VIDEO_RESOLUTION,
42         _RECORDER_GET_INT_FILE_FORMAT,
43         _RECORDER_GET_INT_AUDIO_ENCODER,
44         _RECORDER_GET_INT_VIDEO_ENCODER,
45         _RECORDER_GET_INT_SIZE_LIMIT,
46         _RECORDER_GET_INT_TIME_LIMIT,
47         _RECORDER_GET_INT_AUDIO_DEVICE,
48         _RECORDER_GET_INT_AUDIO_SAMPLERATE,
49         _RECORDER_GET_INT_AUDIO_ENCODER_BITRATE,
50         _RECORDER_GET_INT_VIDEO_ENCODER_BITRATE,
51         _RECORDER_GET_INT_AUDIO_CHANNEL,
52         _RECORDER_GET_INT_ORIENTATION_TAG,
53         _RECORDER_GET_INT_MAX
54 };
55
56 enum {
57         _RECORDER_GET_DOUBLE_AUDIO_LEVEL = 0,
58         _RECORDER_GET_DOUBLE_RECORDING_MOTION_RATE,
59         _RECORDER_GET_DOUBLE_MAX
60 };
61
62 typedef struct _recorder_cb_info_s {
63         gint fd;
64         gboolean is_server_connected;
65
66         GThread *msg_recv_thread;
67         GThread *msg_handler_thread;
68         gint msg_recv_running;
69         gint msg_handler_running;
70         GCond msg_handler_cond;
71         GMutex msg_handler_mutex;
72         GQueue *msg_queue;
73         GList *idle_event_list;
74         GCond idle_event_cond;
75         GMutex idle_event_mutex;
76         gpointer user_cb[MUSE_RECORDER_EVENT_TYPE_NUM];
77         gpointer user_data[MUSE_RECORDER_EVENT_TYPE_NUM];
78         gchar recv_msg[RECORDER_MSG_LENGTH_MAX];
79         GCond api_cond[MUSE_RECORDER_API_MAX];
80         GMutex api_mutex[MUSE_RECORDER_API_MAX];
81         gint *api_activating;
82         gint *api_ret;
83         tbm_bufmgr bufmgr;
84
85         /* get values */
86         char *get_filename;
87         gint get_int_value[_RECORDER_GET_INT_MAX];
88         gdouble get_double_value[_RECORDER_GET_DOUBLE_MAX];
89 } recorder_cb_info_s;
90
91 typedef struct _recorder_message_s {
92         gchar recv_msg[MUSE_RECORDER_MSG_MAX_LENGTH];
93         muse_recorder_api_e api;
94 } recorder_message_s;
95
96 typedef struct _recorder_idle_event_s {
97         recorder_cb_info_s *cb_info;
98         gchar recv_msg[MUSE_RECORDER_MSG_MAX_LENGTH];
99         muse_recorder_event_e event;
100         GMutex event_mutex;
101 } recorder_idle_event_s;
102
103 typedef struct _recorder_cli_s {
104         intptr_t remote_handle;
105         recorder_cb_info_s *cb_info;
106         camera_h camera;
107 } recorder_cli_s;
108
109 typedef struct _recorder_msg_param {
110         int type;
111         const char *name;
112         union {
113                 int value_INT;
114                 double value_DOUBLE;
115                 const char *value_STRING;
116         } value;
117 } recorder_msg_param;
118
119 typedef struct _camera_cli_s {
120         intptr_t remote_handle;
121         void *cb_info;
122 } camera_cli_s;
123
124 int __convert_recorder_error_code(const char *func, int code);
125
126 #ifdef __cplusplus
127 }
128 #endif
129
130 #endif /* __TIZEN_MULTIMEDIA_RECORDER_PRIVATE_H__ */
131
132