[libmm-streamrecorder] initial code for new feature of streamrecorder
[platform/core/multimedia/libmm-streamrecorder.git] / src / include / mm_streamrecorder_recorder.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_RECORDER_H__
23 #define __MM_STREAMRECORDER_RECORDER_H__
24
25 /*=======================================================================================
26 | INCLUDE FILES                                                                         |
27 ========================================================================================*/
28 #include <mm_types.h>
29 #include "mm_streamrecorder_gstdispatch.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /*=======================================================================================
36 | GLOBAL DEFINITIONS AND DECLARATIONS FOR STREAMCORDER                                  |
37 ========================================================================================*/
38
39 /*=======================================================================================
40 | MACRO DEFINITIONS                                                                     |
41 ========================================================================================*/
42
43 /*=======================================================================================
44 | ENUM DEFINITIONS                                                                      |
45 ========================================================================================*/
46
47 /*=======================================================================================
48 | STRUCTURE DEFINITIONS                                                                 |
49 ========================================================================================*/
50
51 /*=======================================================================================
52 | CONSTANT DEFINITIONS                                                                  |
53 ========================================================================================*/
54
55 /*=======================================================================================
56 | STATIC VARIABLES                                                                      |
57 ========================================================================================*/
58
59 /*=======================================================================================
60 | EXTERN GLOBAL VARIABLE                                                                |
61 ========================================================================================*/
62
63 /*=======================================================================================
64 | GLOBAL FUNCTION PROTOTYPES                                                            |
65 ========================================================================================*/
66
67 /**
68  * This function create main pipeline according to type.
69  *
70  * @param[in]   handle          Handle of streamrecorder context.
71  * @param[in]   type            Allocation type of streamrecorder context.
72  * @return      This function returns zero on success, or negative value with error code.
73  * @remarks
74  * @see         _mmstreamrecorder_destroy_pipeline()
75  *
76  */
77 int _mmstreamrecorder_create_pipeline(MMHandleType handle);
78
79 /**
80  * This function release all element of main pipeline according to type.
81  *
82  * @param[in]   handle          Handle of streamrecorder context.
83  * @param[in]   type            Allocation type of streamrecorder context.
84  * @return      void
85  * @remarks
86  * @see         _mmstreamrecorder_create_pipeline()
87  *
88  */
89 void _mmstreamrecorder_destroy_pipeline(MMHandleType handle);
90
91 /**
92  * This function creates recorder pipeline.
93  * When application creates initial pipeline, there are only bins for preview.
94  * If application wants to record, recorder pipeline should be created.
95  *
96  * @param[in]   handle          Handle of streamrecorder context.
97  * @return      This function returns MM_ERROR_NONE on success, or the other values on error.
98  * @remarks
99  */
100 int _mmstreamrecorder_create_recorder_pipeline(MMHandleType handle);
101
102 /**
103  * This function creates bin of audio source.
104  * Basically, main pipeline of streamrecorder is composed of several bin(a bundle
105  *  of elements). Each bin operates its own function. This bin has a roll
106  * inputting audio data from audio source(such as mike).
107  *
108  * @param[in]   handle          Handle of streamrecorder context.
109  * @return      This function returns MM_ERROR_NONE on success, or the other values on error.
110  * @remarks
111  */
112 int _mmstreamrecorder_create_audiosrc_bin(MMHandleType handle);
113
114 int _mmstreamrecorder_destroy_audiosrc_bin(MMHandleType handle);
115
116 /**
117  * This function creates outputsink bin.
118  *
119  * @param[in]   handle          Handle of streamrecorder context.
120  * @param[in]   profile         profile of encodesinkbin.
121  * @return      This function returns MM_ERROR_NONE on success, or the other values on error.
122  * @remarks
123  */
124 int _mmstreamrecorder_create_encodesink_bin(MMHandleType handle, MMStreamRecorderEncodebinProfile profile);
125
126 int _mmstreamrecorder_destroy_encodesink_bin(MMHandleType handle);
127
128 /**
129  * This function handles EOS(end of stream) when commit video recording.
130  *
131  * @param[in]   handle          Handle of streamrecorder context.
132  * @return      This function returns TRUE on success, or FALSE on failure.
133  * @remarks
134  * @see         _mmstreamrecorder_set_functions()
135  */
136 int _mmstreamrecorder_video_handle_eos(MMHandleType handle);
137
138 int _mmstreamrecorder_destroy_recorder_pipeline(MMHandleType handle);
139
140 // COMMAND
141 int _mmstreamrecorder_video_command(MMHandleType handle, int command);
142
143 /**
144  * This function creates audio pipeline for audio recording.
145  *
146  * @param[in]   handle          Handle of streamrecorder.
147  * @return      This function returns MM_ERROR_NONE on success, or others on failure.
148  * @remarks
149  * @see         _mmstreamrecorder_destroy_audio_pipeline()
150  *
151  */
152 int _mmstreamrecorder_create_audio_pipeline(MMHandleType handle);
153
154 /**
155  * This function destroy audio pipeline.
156  *
157  * @param[in]   handle          Handle of streamrecorder.
158  * @return      void
159  * @remarks
160  * @see         _mmstreamrecorder_destroy_pipeline()
161  *
162  */
163 void _mmstreamrecorder_destroy_audio_pipeline(MMHandleType handle);
164
165 /**
166  * This function runs command for audio recording.
167  *
168  * @param[in]   handle          Handle of streamrecorder.
169  * @param[in]   command         audio recording command.
170  * @return      This function returns MM_ERROR_NONE on success, or others on failure.
171  * @remarks
172  * @see
173  *
174  */
175 int _mmstreamrecorder_audio_command(MMHandleType handle, int command);
176
177 /**
178  * This function handles EOS(end of stream) when audio recording is finished.
179  *
180  * @param[in]   handle          Handle of streamrecorder.
181  * @return      This function returns TRUE on success, or FALSE on failure.
182  * @remarks
183  * @see
184  *
185  */
186 int _mmstreamrecorder_audio_handle_eos(MMHandleType handle);
187
188 int _mmstreamrecorder_create_audiop_with_encodebin(MMHandleType handle);
189
190 int _mmstreamrecorder_push_videostream_buffer(MMHandleType handle, unsigned long timestamp, GstBuffer *buffer, int size);
191 int _mmstreamrecorder_push_audiostream_buffer(MMHandleType handle, unsigned long timestamp, GstBuffer *buffer, int size);
192
193 #ifdef __cplusplus
194 }
195 #endif
196
197 #endif /* __MM_STREAMRECORDER_RECORDER_H__ */