Clean up the Makefiles, Add some descriptions
[platform/core/multimedia/mmsvc-recorder.git] / muse / include / muse_recorder.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 #ifndef __MUSE_RECORDER_H__
18 #define __MUSE_RECORDER_H__
19
20 #ifdef _cplusplus
21 extern "C" {
22 #endif
23
24 /**
25   * @file muse_recorder.h
26   * @brief This file contains the muse recorder API for framework, related structures and enumerations.
27   */
28
29 #include "tbm_bufmgr.h"
30 #include <stdbool.h>
31 #include <stdio.h>
32
33 /**
34  * @brief Enumeration for the muse recorder apis.
35  */
36 typedef enum {
37         MUSE_RECORDER_API_CREATE, //0
38         MUSE_RECORDER_API_DESTROY,
39         MUSE_RECORDER_API_GET_STATE,
40         MUSE_RECORDER_API_PREPARE,
41         MUSE_RECORDER_API_UNPREPARE,
42         MUSE_RECORDER_API_START, //5
43         MUSE_RECORDER_API_PAUSE,
44         MUSE_RECORDER_API_COMMIT,
45         MUSE_RECORDER_API_CANCEL,
46         MUSE_RECORDER_API_SET_VIDEO_RESOLUTION,
47         MUSE_RECORDER_API_GET_VIDEO_RESOLUTION, //10
48         MUSE_RECORDER_API_FOREACH_SUPPORTED_VIDEO_RESOLUTION,
49         MUSE_RECORDER_API_GET_AUDIO_LEVEL,
50         MUSE_RECORDER_API_SET_FILENAME,
51         MUSE_RECORDER_API_GET_FILENAME,
52         MUSE_RECORDER_API_SET_FILE_FORMAT, //15
53         MUSE_RECORDER_API_GET_FILE_FORMAT,
54         MUSE_RECORDER_API_SET_STATE_CHANGED_CB,
55         MUSE_RECORDER_API_UNSET_STATE_CHANGED_CB,
56         MUSE_RECORDER_API_SET_INTERRUPTED_CB,
57         MUSE_RECORDER_API_UNSET_INTERRUPTED_CB, //20
58         MUSE_RECORDER_API_SET_AUDIO_STREAM_CB,
59         MUSE_RECORDER_API_UNSET_AUDIO_STREAM_CB,
60         MUSE_RECORDER_API_SET_ERROR_CB,
61         MUSE_RECORDER_API_UNSET_ERROR_CB,
62         MUSE_RECORDER_API_SET_RECORDING_STATUS_CB, //25
63         MUSE_RECORDER_API_UNSET_RECORDING_STATUS_CB,
64         MUSE_RECORDER_API_SET_RECORDING_LIMIT_REACHED_CB,
65         MUSE_RECORDER_API_UNSET_RECORDING_LIMIT_REACHED_CB,
66         MUSE_RECORDER_API_FOREACH_SUPPORTED_FILE_FORMAT,
67         MUSE_RECORDER_API_ATTR_SET_SIZE_LIMIT, //30
68         MUSE_RECORDER_API_ATTR_SET_TIME_LIMIT,
69         MUSE_RECORDER_API_ATTR_SET_AUDIO_DEVICE,
70         MUSE_RECORDER_API_SET_AUDIO_ENCODER,
71         MUSE_RECORDER_API_GET_AUDIO_ENCODER,
72         MUSE_RECORDER_API_SET_VIDEO_ENCODER, //35
73         MUSE_RECORDER_API_GET_VIDEO_ENCODER,
74         MUSE_RECORDER_API_ATTR_SET_AUDIO_SAMPLERATE,
75         MUSE_RECORDER_API_ATTR_SET_AUDIO_ENCODER_BITRATE,
76         MUSE_RECORDER_API_ATTR_SET_VIDEO_ENCODER_BITRATE,
77         MUSE_RECORDER_API_ATTR_GET_SIZE_LIMIT, //40
78         MUSE_RECORDER_API_ATTR_GET_TIME_LIMIT,
79         MUSE_RECORDER_API_ATTR_GET_AUDIO_DEVICE,
80         MUSE_RECORDER_API_ATTR_GET_AUDIO_SAMPLERATE,
81         MUSE_RECORDER_API_ATTR_GET_AUDIO_ENCODER_BITRATE,
82         MUSE_RECORDER_API_ATTR_GET_VIDEO_ENCODER_BITRATE, //45
83         MUSE_RECORDER_API_FOREACH_SUPPORTED_AUDIO_ENCODER,
84         MUSE_RECORDER_API_FOREACH_SUPPORTED_VIDEO_ENCODER,
85         MUSE_RECORDER_API_ATTR_SET_MUTE,
86         MUSE_RECORDER_API_ATTR_IS_MUTED,
87         MUSE_RECORDER_API_ATTR_SET_RECORDING_MOTION_RATE, //50
88         MUSE_RECORDER_API_ATTR_GET_RECORDING_MOTION_RATE,
89         MUSE_RECORDER_API_ATTR_SET_AUDIO_CHANNEL,
90         MUSE_RECORDER_API_ATTR_GET_AUDIO_CHANNEL,
91         MUSE_RECORDER_API_ATTR_SET_ORIENTATION_TAG,
92         MUSE_RECORDER_API_ATTR_GET_ORIENTATION_TAG, //55
93         MUSE_RECORDER_API_MAX //56
94 } muse_recorder_api_e;
95
96 /**
97  * @brief Enumeration for the muse recorder events.
98  */
99 typedef enum {
100         MUSE_RECORDER_EVENT_TYPE_STATE_CHANGE,
101         MUSE_RECORDER_EVENT_TYPE_RECORDING_LIMITED,
102         MUSE_RECORDER_EVENT_TYPE_RECORDING_STATUS,
103         MUSE_RECORDER_EVENT_TYPE_INTERRUPTED,
104         MUSE_RECORDER_EVENT_TYPE_AUDIO_STREAM,
105         MUSE_RECORDER_EVENT_TYPE_ERROR,
106         MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_AUDIO_ENCODER,
107         MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_FILE_FORMAT,
108         MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_VIDEO_ENCODER,
109         MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_VIDEO_RESOLUTION,
110         MUSE_RECORDER_EVENT_TYPE_NUM
111 }muse_recorder_event_e;
112
113 /**
114  * @brief The structure type for muse camera errors.
115  */
116 typedef enum {
117         MUSE_RECORDER_ERROR_INVALID = -1,
118         MUSE_RECORDER_ERROR_NONE = 1,
119 } muse_recorder_error_e;
120
121 /**
122  * @brief The structure type for muse recorder type.
123  */
124 typedef enum {
125         MUSE_RECORDER_TYPE_AUDIO = 0,
126         MUSE_RECORDER_TYPE_VIDEO
127 }muse_recorder_type_e;
128
129 /**
130  * @brief The structure type for muse recorder source type.
131  */
132 typedef enum {
133         MUSE_RECORDER_SOURCE_TYPE_UNKNOWN,
134         MUSE_RECORDER_SOURCE_TYPE_CAMERA,
135 }muse_recorder_source_type_e;
136
137 /**
138  * @brief The structure type for data transport for the muse recorder.
139  */
140 typedef struct {
141         int data_size;
142         int tbm_key;
143         tbm_bo bo;
144         tbm_bo_handle bo_handle;
145         tbm_bufmgr bufmgr;
146 } muse_recorder_transport_info_s;
147
148 /**
149  * @brief The structure type for the userdata, registering into the daemon core.
150  */
151 typedef struct {
152         tbm_bufmgr bufmgr;
153 } muse_recorder_info_s;
154
155 /**
156  * @brief Definition for the callback event id.
157  */
158 #define MUSE_RECORDER_CB_EVENT  MUSE_RECORDER_API_MAX + 1
159
160 /**
161  * @brief Definition for the max message length.
162  */
163 #define MUSE_RECORDER_MSG_MAX_LENGTH            256
164
165 /**
166  * @brief Definition for the wait time of the ipc callback.
167  */
168 #define CALLBACK_TIME_OUT 3
169
170 /*
171  * @brief Makes the tbm buffer object, and set to the muse recorder structure.
172  * @param[out] transport_info The allocated structure, tbm bo will be set in here.
173  * @return TRUE on success, otherwise a FALSE value
174  */
175 bool muse_recorder_ipc_make_tbm(muse_recorder_transport_info_s *transport_info);
176
177 /**
178  * @brief Exports the tbm buffer object, another process can import this bo.
179  * @param[in] transport_info Using transport_info.bo to export.
180  * @return TBM gem name on success, otherwise a negative error value
181  */
182 int muse_recorder_ipc_export_tbm(muse_recorder_transport_info_s transport_info);
183
184 /**
185  * @brief Initialize the tbm buffer manager, mainly at the client side.
186  * @param[out] transport_info The allocated structure, tbm bufmgr will be set in here.
187  * @return TRUE on success, otherwise a FALSE value
188  */
189 bool muse_recorder_ipc_init_tbm(muse_recorder_transport_info_s *transport_info);
190
191 /**
192  * @brief Imports the tbm buffer object.
193  * @param[out] transport_info Set the transport_info.bo.
194  * @return TRUE on success, otherwise a FALSE value
195  */
196 int muse_recorder_ipc_import_tbm(muse_recorder_transport_info_s *transport_info);
197
198 /**
199  * @brief Unreference the tbm buffer object.
200  * @param[in] transport_info Using the transport_info.bo.
201  * @return TRUE on success, otherwise a FALSE value
202  */
203 void muse_recorder_ipc_unref_tbm(muse_recorder_transport_info_s *transport_info);
204
205 #ifdef __cplusplus
206 }
207 #endif
208 #endif                          /* __MM_MEDIA_PLAYER2_H__ */