1e0e6ec04a9273674a11365d9c78d632e281f149
[platform/core/multimedia/libmm-streamrecorder.git] / src / include / mm_streamrecorder_internal.h
1 /*
2  * libmm-streamrecorder
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyuntae Kim <ht1211.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __MM_STREAMRECORDER_INTERNAL_H__
23 #define __MM_STREAMRECORDER_INTERNAL_H__
24
25 /*=======================================================================================
26 | INCLUDE FILES                                                                         |
27 ========================================================================================*/
28 #include <malloc.h>
29 #include <string.h>
30 #include <unistd.h>
31 #include <pthread.h>
32 #include <semaphore.h>
33
34 #include <mm_types.h>
35 #include <mm_attrs.h>
36 #include <mm_attrs_private.h>
37 #include <mm_message.h>
38
39 #include "mm_streamrecorder.h"
40 #include <gst/gst.h>
41
42 /* streamrecorder sub module */
43 #include "mm_streamrecorder_util.h"
44 #include "mm_streamrecorder_video.h"
45 #include "mm_streamrecorder_audio.h"
46 #include "mm_streamrecorder_fileinfo.h"
47 #include "mm_streamrecorder_gstcommon.h"
48 #include "mm_streamrecorder_ini.h"
49 #include "mm_streamrecorder_buffer_manager.h"
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55 /*=======================================================================================
56 | MACRO DEFINITIONS                                                                     |
57 ========================================================================================*/
58
59 #ifndef ARRAY_SIZE
60 /**
61  *      Macro for getting array size
62  */
63 #define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
64 #endif
65
66 #define _MMSTREAMRECORDER_STATE_SET_COUNT               3       /* checking interval */
67 #define _MMSTREAMRECORDER_STATE_CHECK_INTERVAL  1000    //5000      /* checking interval */
68
69 /**
70  *      Functions related with LOCK and WAIT
71  */
72 #define _MMSTREAMRECORDER_CAST_MTSAFE(handle)                           (((mmf_streamrecorder_t*)handle)->mtsafe)
73 #define _MMSTREAMRECORDER_LOCK_FUNC(mutex)                              pthread_mutex_lock(&mutex)
74 #define _MMSTREAMRECORDER_TRYLOCK_FUNC(mutex)                   (!pthread_mutex_trylock(&mutex))
75 #define _MMSTREAMRECORDER_UNLOCK_FUNC(mutex)                            pthread_mutex_unlock(&mutex)
76
77 #define _MMSTREAMRECORDER_GET_LOCK(handle)                                      (_MMSTREAMRECORDER_CAST_MTSAFE(handle).lock)
78 #define _MMSTREAMRECORDER_LOCK(handle)                                          _MMSTREAMRECORDER_LOCK_FUNC(_MMSTREAMRECORDER_GET_LOCK(handle))
79 #define _MMSTREAMRECORDER_TRYLOCK(handle)                                       _MMSTREAMRECORDER_TRYLOCK_FUNC(_MMSTREAMRECORDER_GET_LOCK(handle))
80 #define _MMSTREAMRECORDER_UNLOCK(handle)                                        _MMSTREAMRECORDER_UNLOCK_FUNC(_MMSTREAMRECORDER_GET_LOCK(handle))
81
82 #define _MMSTREAMRECORDER_GET_COND(handle)                                      (_MMSTREAMRECORDER_CAST_MTSAFE(handle).cond)
83 #define _MMSTREAMRECORDER_WAIT(handle)                                          pthread_cond_wait(&_MMSTREAMRECORDER_GET_COND(handle), _MMSTREAMRECORDER_GET_LOCK(handle))
84 #define _MMSTREAMRECORDER_TIMED_WAIT(handle, timeout)           pthread_cond_timedwait(&_MMSTREAMRECORDER_GET_COND(handle), _MMSTREAMRECORDER_GET_LOCK(handle),&timeout)
85
86 /* for command */
87 #define _MMSTREAMRECORDER_GET_CMD_LOCK(handle)                                  (_MMSTREAMRECORDER_CAST_MTSAFE(handle).cmd_lock)
88 #define _MMSTREAMRECORDER_LOCK_CMD(handle)                                              _MMSTREAMRECORDER_LOCK_FUNC(_MMSTREAMRECORDER_GET_CMD_LOCK(handle))
89 #define _MMSTREAMRECORDER_TRYLOCK_CMD(handle)                                   _MMSTREAMRECORDER_TRYLOCK_FUNC(_MMSTREAMRECORDER_GET_CMD_LOCK(handle))
90 #define _MMSTREAMRECORDER_UNLOCK_CMD(handle)                                            _MMSTREAMRECORDER_UNLOCK_FUNC(_MMSTREAMRECORDER_GET_CMD_LOCK(handle))
91
92 /* for state change */
93 #define _MMSTREAMRECORDER_GET_STATE_LOCK(handle)                                        (_MMSTREAMRECORDER_CAST_MTSAFE(handle).state_lock)
94 #define _MMSTREAMRECORDER_LOCK_STATE(handle)                                            _MMSTREAMRECORDER_LOCK_FUNC(_MMSTREAMRECORDER_GET_STATE_LOCK(handle))
95 #define _MMSTREAMRECORDER_TRYLOCK_STATE(handle)                                 _MMSTREAMRECORDER_TRYLOCK_FUNC(_MMSTREAMRECORDER_GET_STATE_LOCK(handle))
96 #define _MMSTREAMRECORDER_UNLOCK_STATE(handle)                                          _MMSTREAMRECORDER_UNLOCK_FUNC(_MMSTREAMRECORDER_GET_STATE_LOCK(handle))
97
98 /* for gstreamer state change */
99 #define _MMSTREAMRECORDER_GET_GST_STATE_LOCK(handle)                                    (_MMSTREAMRECORDER_CAST_MTSAFE(handle).gst_state_lock)
100 #define _MMSTREAMRECORDER_LOCK_GST_STATE(handle)                                                _MMSTREAMRECORDER_LOCK_FUNC(_MMSTREAMRECORDER_GET_GST_STATE_LOCK(handle))
101 #define _MMSTREAMRECORDER_TRYLOCK_GST_STATE(handle)                                     _MMSTREAMRECORDER_TRYLOCK_FUNC(_MMSTREAMRECORDER_GET_GST_STATE_LOCK(handle))
102 #define _MMSTREAMRECORDER_UNLOCK_GST_STATE(handle)                                              _MMSTREAMRECORDER_UNLOCK_FUNC(_MMSTREAMRECORDER_GET_GST_STATE_LOCK(handle))
103
104 /* for setting/calling callback */
105 #define _MMSTREAMRECORDER_GET_MESSAGE_CALLBACK_LOCK(handle)      (_MMSTREAMRECORDER_CAST_MTSAFE(handle).message_cb_lock)
106 #define _MMSTREAMRECORDER_LOCK_MESSAGE_CALLBACK(handle)          _MMSTREAMRECORDER_LOCK_FUNC(_MMSTREAMRECORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
107 #define _MMSTREAMRECORDER_TRYLOCK_MESSAGE_CALLBACK(handle)       _MMSTREAMRECORDER_TRYLOCK_FUNC(_MMSTREAMRECORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
108 #define _MMSTREAMRECORDER_UNLOCK_MESSAGE_CALLBACK(handle)        _MMSTREAMRECORDER_UNLOCK_FUNC(_MMSTREAMRECORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
109
110 /**
111  * Caster of main handle (streamrecorder)
112  */
113 #define MMF_STREAMRECORDER(h) (mmf_streamrecorder_t *)(h)
114
115 /**
116  * Caster of subcontext
117  */
118 #define MMF_STREAMRECORDER_SUBCONTEXT(h) (((mmf_streamrecorder_t *)(h))->sub_context)
119
120 /* LOCAL CONSTANT DEFINITIONS */
121
122 /*=======================================================================================
123 | ENUM DEFINITIONS                                                                      |
124 ========================================================================================*/
125
126 /**
127  * streamrecorder Pipeline's Element name.
128  * @note index of element.
129  */
130 typedef enum {
131         _MMSTREAMRECORDER_ENCODE_NONE = (-1),
132
133         /* Main Pipeline Element */
134         _MMSTREAMRECORDER_ENCODE_MAIN_PIPE = 0x00,
135
136         /* Pipeline element of Audio input */
137         _MMSTREAMRECORDER_AUDIOSRC_BIN,
138         _MMSTREAMRECORDER_AUDIOSRC_SRC, /* appsrc */
139         _MMSTREAMRECORDER_AUDIOSRC_FILT,
140
141         /* Pipeline element of Encodebin */
142         _MMSTREAMRECORDER_ENCSINK_BIN,
143         _MMSTREAMRECORDER_ENCSINK_SRC,  /* video appsrc */
144         _MMSTREAMRECORDER_ENCSINK_FILT,
145         _MMSTREAMRECORDER_ENCSINK_ENCBIN,
146         _MMSTREAMRECORDER_ENCSINK_AQUE,
147         _MMSTREAMRECORDER_ENCSINK_CONV,
148         _MMSTREAMRECORDER_ENCSINK_AENC,
149         _MMSTREAMRECORDER_ENCSINK_AENC_QUE,
150         _MMSTREAMRECORDER_ENCSINK_VQUE,
151         _MMSTREAMRECORDER_ENCSINK_VCONV,
152         _MMSTREAMRECORDER_ENCSINK_VENC,
153         _MMSTREAMRECORDER_ENCSINK_VENC_QUE,
154         _MMSTREAMRECORDER_ENCSINK_PARSER,
155         _MMSTREAMRECORDER_ENCSINK_ITOG,
156         _MMSTREAMRECORDER_ENCSINK_ICROP,
157         _MMSTREAMRECORDER_ENCSINK_ISCALE,
158         _MMSTREAMRECORDER_ENCSINK_IFILT,
159         _MMSTREAMRECORDER_ENCSINK_IQUE,
160         _MMSTREAMRECORDER_ENCSINK_IENC,
161         _MMSTREAMRECORDER_ENCSINK_MUX,
162         _MMSTREAMRECORDER_ENCSINK_SINK,
163
164         _MMSTREAMRECORDER_ENCODE_PIPELINE_ELEMENT_NUM,
165 } _MMSTREAMRECORDER_ENCODE_PIPELINE_ELELMENT;
166
167 /**
168  * Command type for streamrecorder.
169  */
170
171 typedef enum {
172         _MM_STREAMRECORDER_CMD_CREATE,
173         _MM_STREAMRECORDER_CMD_DESTROY,
174         _MM_STREAMRECORDER_CMD_REALIZE,
175         _MM_STREAMRECORDER_CMD_UNREALIZE,
176         _MM_STREAMRECORDER_CMD_START,
177         _MM_STREAMRECORDER_CMD_STOP,
178         _MM_STREAMRECORDER_CMD_RECORD,
179         _MM_STREAMRECORDER_CMD_PAUSE,
180         _MM_STREAMRECORDER_CMD_COMMIT,
181         _MM_STREAMRECORDER_CMD_CANCEL,
182         _MM_STREAMRECORDER_CMD_QUIT,
183 } _MMstreamrecorderCommandType;
184
185 /**
186  * System state change cause
187  */
188 typedef enum {
189         _MMSTREAMRECORDER_STATE_CHANGE_NORMAL = 0,
190 } _MMstreamrecorderStateChange;
191
192
193 /*=======================================================================================
194 | STRUCTURE DEFINITIONS                                                                 |
195 ========================================================================================*/
196
197 /**
198  * MMstreamrecorder information for Multi-Thread Safe
199  */
200 typedef struct {
201         pthread_mutex_t lock;           /**< Mutex (for general use) */
202         pthread_cond_t cond;            /**< Condition (for general use) */
203         pthread_mutex_t cmd_lock;       /**< Mutex (for command) */
204         pthread_mutex_t state_lock;     /**< Mutex (for state change) */
205         pthread_mutex_t gst_state_lock; /**< Mutex (for state change) */
206         pthread_mutex_t message_cb_lock;/**< Mutex (for message callback) */
207 } _MMStreamRecorderMTSafe;
208
209 /**
210  * MMstreamrecorder information for command loop
211  */
212
213 /**
214  * MMstreamrecorder Sub Context
215  */
216 typedef struct {
217         bool isMaxsizePausing;                          /**< Because of size limit, pipeline is paused. */
218         bool isMaxtimePausing;                          /**< Because of time limit, pipeline is paused. */
219         int encode_element_num;                         /**< count of encode element */
220         GstClockTime pipeline_time;                     /**< current time of Gstreamer Pipeline */
221         GstClockTime pause_time;                        /**< amount of time while pipeline is in PAUSE state.*/
222         gboolean error_occurs;                          /**< flag for error */
223         int error_code;                                         /**< error code for internal gstreamer error */
224         gboolean ferror_send;                           /**< file write/seek error **/
225         guint ferror_count;                                     /**< file write/seek error count **/
226         gboolean bget_eos;                                      /**< Whether getting EOS */
227         gboolean video_enable;                          /**< whether video is disabled or not when record */
228         gboolean audio_enable;                          /**< whether audio is disabled or not when record */
229
230         /* INI information */
231         unsigned int fourcc;                            /**< Get fourcc value */
232         _MMStreamRecorderVideoInfo *info_video;  /**< extra information for video recording */
233         _MMStreamRecorderAudioInfo *info_audio;  /**< extra information for audio recording */
234         _MMStreamRecorderFileInfo *info_file;  /**< extra information for audio recording */
235         _MMStreamRecorderGstElement *encode_element;
236                                                                                          /**< array of encode element */
237
238 //  type_element *VideosinkElement;         /**< configure data of videosink element */
239 } _MMStreamRecorderSubContext;
240
241 /**
242   * _MMstreamrecorderContext
243   */
244 typedef struct mmf_streamrecorder {
245         /* information */
246         //  int type;               /**< mmstreamrecorder_mode_type */
247         int state;              /**< state of streamrecorder */
248         //  int target_state;       /**< Target state that want to set. This is a flag that
249         //                             * stands for async state changing. If this value differ from state,
250         //                             * it means state is changing now asychronously. */
251
252         /* handles */
253         MMHandleType attributes;                           /**< Attribute handle */
254         _MMStreamRecorderSubContext *sub_context;       /**< sub context */
255         GList *buffer_probes;                              /**< a list of buffer probe handle */
256         GList *event_probes;                               /**< a list of event probe handle */
257         GList *data_probes;                                        /**< a list of data probe handle */
258         GList *signals;                                            /**< a list of signal handle */
259         GList *msg_data;                                           /**< a list of msg data */
260         guint pipeline_cb_event_id;                        /**< Event source ID of pipeline message callback */
261         guint encode_pipeline_cb_event_id;         /**< Event source ID of encode pipeline message callback */
262
263         /* callback handlers */
264         MMMessageCallback msg_cb;                                                               /**< message callback */
265         void *msg_cb_param;                                                                             /**< message callback parameter */
266         int (*command) (MMHandleType, int);                                             /**< streamrecorder's command */
267
268         /* etc */
269         _MMStreamRecorderMTSafe mtsafe;                                                          /**< Thread safe */
270         mm_streamrecorder_ini_t ini;
271
272         int reserved[4];                        /**< reserved */
273 } mmf_streamrecorder_t;
274
275 /*=======================================================================================
276 | EXTERN GLOBAL VARIABLE                                                                |
277 ========================================================================================*/
278
279 /*=======================================================================================
280 | GLOBAL FUNCTION PROTOTYPES                                                            |
281 ========================================================================================*/
282 /**
283  *      This function creates streamrecorder for capturing still image and recording.
284  *
285  *      @param[out]     handle          Specifies the streamrecorder  handle
286  *      @param[in]      info            Preset information of streamrecorder
287  *      @return         This function returns zero on success, or negative value with error code.
288  *      @remarks        When this function calls successfully, streamrecorder  handle will be filled with a @n
289  *                      valid value and the state of  the streamrecorder  will become MM_streamrecorder_STATE_NULL.@n
290  *                      Note that  it's not ready to working streamrecorder. @n
291  *                      You should call mmstreamrecorder_realize before starting streamrecorder.
292  *      @see            _mmstreamrecorder_create
293  */
294 int _mmstreamrecorder_create(MMHandleType *handle);
295
296 /**
297 *  This function gets the current state of streamreccorder.
298 *  mm_streamrecorderr is working on the base of its state. An user should check the state of mm_streamrecorder before calling its functions.
299 *  If the handle is avaiable, user can retrieve the value.
300 *
301 *  @param[in]  streamrecorder   A handle of streamrecorder.
302 *  @param[out] state       On return, it contains current state of streamrecorder.
303 *  @return     This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.
304 *          Please refer 'mm_error.h' to know the exact meaning of the error.
305 *  @see        MMStreamRecorderStateType
306 *  @pre        None
307 *  @post       None
308 *  @remarks    None
309 */
310
311 MMStreamRecorderStateType _mmstreamrecorder_get_state(MMHandleType handle);
312
313 /**
314  *      This function destroys instance of streamrecorder.
315  *
316  *      @param[in]      hstreamrecorder Specifies the streamrecorder  handle
317  *      @return         This function returns zero on success, or negative value with error code.
318  *      @see            _mmstreamrecorder_create
319  */
320 int _mmstreamrecorder_destroy(MMHandleType handle);
321
322 /**
323  *      This function allocates memory for streamrecorder.
324  *
325  *      @param[in]      hstreamrecorder Specifies the streamrecorder  handle
326  *      @return         This function returns zero on success, or negative value with error code.
327  *      @remarks        This function can  be called successfully when current state is MM_streamrecorder_STATE_NULL @n
328  *                      and  the state of the streamrecorder  will become MM_streamrecorder_STATE_READY. @n
329  *                      Otherwise, this function will return MM_ERROR_streamrecorder_INVALID_CONDITION.
330  *      @see            _mmstreamrecorder_unrealize
331  *      @pre            MM_streamrecorder_STATE_NULL
332  *      @post           MM_streamrecorder_STATE_READY
333  */
334 int _mmstreamrecorder_realize(MMHandleType hstreamrecorder);
335
336 /**
337  *      This function free allocated memory for streamrecorder.
338  *
339  *      @param[in]      hstreamrecorder Specifies the streamrecorder  handle
340  *      @return         This function returns zero on success, or negative value with error code.
341  *      @remarks        This function release all resources which are allocated for the streamrecorder engine.@n
342  *                      This function can  be called successfully when current state is MM_streamrecorder_STATE_READY and  @n
343  *                      the state of the streamrecorder  will become MM_streamrecorder_STATE_NULL. @n
344  *                      Otherwise, this function will return MM_ERROR_streamrecorder_INVALID_CONDITION.
345  *      @see            _mmstreamrecorder_realize
346  *      @pre            MM_streamrecorder_STATE_READY
347  *      @post           MM_streamrecorder_STATE_NULL
348  */
349 int _mmstreamrecorder_unrealize(MMHandleType hstreamrecorder);
350
351 /**
352  *      This function is to start previewing.
353  *
354  *      @param[in]      hstreamrecorder Specifies the streamrecorder  handle
355  *      @return         This function returns zero on success, or negative value with error code.
356  *      @remarks        This function can  be called successfully when current state is MM_streamrecorder_STATE_READY and  @n
357  *                      the state of the streamrecorder  will become MM_streamrecorder_STATE_PREPARE. @n
358  *                      Otherwise, this function will return MM_ERROR_streamrecorder_INVALID_CONDITION.
359  *      @see            _mmstreamrecorder_stop
360  */
361 int _mmstreamrecorder_record(MMHandleType hstreamrecorder);
362
363 int _mmstreamrecorder_push_stream_buffer(MMHandleType handle, MMStreamRecorderStreamType streamtype, unsigned long timestamp, void *buffer, int size);
364
365 /**
366  *      This function is to pause video and audio recording
367  *
368  *      @param[in]      hstreamrecorder Specifies the streamrecorder  handle
369  *      @return         This function returns zero on success, or negative value with error code.
370  *      @remarks        This function can  be called successfully when current state is MM_streamrecorder_STATE_RECORDING and  @n
371  *                      the  state of the streamrecorder  will become MM_streamrecorder_STATE_PAUSED.@n
372  *                      Otherwise, this function will return MM_ERROR_streamrecorder_INVALID_CONDITION.@n
373  *      @see            _mmstreamrecorder_record
374  */
375 int _mmstreamrecorder_pause(MMHandleType hstreamrecorder);
376
377 /**
378  *      This function is to stop video and audio  recording and  save results.
379  *
380  *      @param[in]      hstreamrecorder Specifies the streamrecorder  handle
381  *      @return         This function returns zero on success, or negative value with error code.
382  *      @remarks        This function can  be called successfully when current state is @n
383  *                      MM_streamrecorder_STATE_PAUSED or MM_streamrecorder_STATE_RECORDING and  @n
384  *                      the state of the streamrecorder  will become MM_streamrecorder_STATE_PREPARE. @n
385  *                      Otherwise, this function will return MM_ERROR_streamrecorder_INVALID_CONDITION
386  *      @see            _mmstreamrecorder_cancel
387  */
388 int _mmstreamrecorder_commit(MMHandleType hstreamrecorder);
389
390 /**
391  *      This function is to stop video and audio recording and do not save results.
392  *
393  *      @param[in]      hstreamrecorder Specifies the streamrecorder  handle
394  *      @return         This function returns zero on success, or negative value with error code.
395  *      @remarks        This function can  be called successfully when current state is @n
396  *                      MM_streamrecorder_STATE_PAUSED or MM_streamrecorder_STATE_RECORDING and  @n
397  *                      the state of the streamrecorder  will become MM_streamrecorder_STATE_PREPARE. @n
398  *                      Otherwise, this function will return MM_ERROR_streamrecorder_INVALID_CONDITION.
399  *      @see            _mmstreamrecorder_commit
400  */
401 int _mmstreamrecorder_cancel(MMHandleType hstreamrecorder);
402
403 /**
404  *      This function is to set callback for receiving messages from streamrecorder.
405  *
406  *      @param[in]      hstreamrecorder Specifies the streamrecorder  handle
407  *      @param[in]      callback        Specifies the function pointer of callback function
408  *      @param[in]      user_data       Specifies the user poiner for passing to callback function
409  *
410  *      @return         This function returns zero on success, or negative value with error code.
411  *      @remarks        typedef bool (*mm_message_callback) (int msg, mm_messageType *param, void *user_param);@n
412  *              @n
413  *              typedef union                           @n
414  *              {                                                       @n
415  *                      int code;                               @n
416  *                      struct                                  @n
417  *                      {                                               @n
418  *                              int total;                      @n
419  *                              int elapsed;            @n
420  *                      } time;                                 @n
421  *                      struct                                  @n
422  *                      {                                               @n
423  *                              int previous;           @n
424  *                              int current;                    @n
425  *                      } state;                                        @n
426  *              } mm_message_type;      @n
427  *                                                                      @n
428  *              If a  message value for mm_message_callback is MM_MESSAGE_STATE_CHANGED, @n
429  *              state value in mm_message_type  will be a mmstreamrecorder_state_type enum value;@n
430  *              @n
431  *              If  a message value for mm_message_callback is MM_MESSAGE_ERROR,  @n
432  *              the code value in mm_message_type will be a mmplayer_error_type enum value;
433  *
434  *      @see            mm_message_type,  mmstreamrecorder_state_type,  mmstreamrecorder_error_type
435  */
436 int _mmstreamrecorder_set_message_callback(MMHandleType hstreamrecorder, MMMessageCallback callback, void *user_data);
437
438 /**
439  * This function allocates structure of subsidiary attributes.
440  *
441  * @param[in]   type            Allocation type of streamrecorder context.
442  * @return      This function returns structure pointer on success, NULL value on failure.
443  * @remarks
444  * @see         _mmstreamrecorder_dealloc_subcontext()
445  *
446  */
447 int _mmstreamrecorder_alloc_subcontext(MMHandleType handle);
448
449 int _mmstreamrecorder_alloc_subcontext_videoinfo(MMHandleType handle);
450
451 int _mmstreamrecorder_alloc_subcontext_audioinfo(MMHandleType handle);
452
453 int _mmstreamrecorder_alloc_subcontext_fileinfo(MMHandleType handle);
454
455 /**
456  * This function releases structure of subsidiary attributes.
457  *
458  * @param[in]   sc              Handle of streamrecorder subcontext.
459  * @return      void
460  * @remarks
461  * @see         _mmstreamrecorder_alloc_subcontext()
462  *
463  */
464 void _mmstreamrecorder_dealloc_subcontext(MMHandleType handle);
465
466 /**
467  * This function sets command function according to the type.
468  *
469  * @param[in]   handle          Handle of streamrecorder context.
470  * @param[in]   type            Allocation type of streamrecorder context.
471  * @return      This function returns MM_ERROR_NONE on success, or other values with error code.
472  * @remarks
473  * @see         __mmstreamrecorder_video_command(), __mmstreamrecorder_audio_command(), __mmstreamrecorder_image_command()
474  *
475  */
476 void _mmstreamrecorder_set_functions(MMHandleType handle);
477
478 void _mmstreamrecorder_unset_functions(MMHandleType handle);
479
480 #ifdef __cplusplus
481 }
482 #endif
483 #endif                                                  /* __MM_streamrecorder_INTERNAL_H__ */