4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyuntae Kim <ht1211.kim@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 /* ==============================================================================
24 ===============================================================================*/
30 #include <mm_attrs_private.h>
31 #include "mm_streamrecorder.h"
32 #include "mm_streamrecorder_internal.h"
33 #include "mm_streamrecorder_attribute.h"
35 /*===============================================================================
36 | FUNCTION DEFINITIONS |
37 ===============================================================================*/
38 /*-------------------------------------------------------------------------------
39 | GLOBAL FUNCTION DEFINITIONS: |
40 -------------------------------------------------------------------------------*/
41 int mm_streamrecorder_create(MMHandleType *streamrecorder)
43 int error = MM_ERROR_NONE;
45 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
47 _mmstreamrec_dbg_log("");
49 error = _mmstreamrecorder_create(streamrecorder);
51 _mmstreamrec_dbg_log("END");
57 int mm_streamrecorder_get_state(MMHandleType streamrecorder, MMStreamRecorderStateType *status)
59 int ret = MM_ERROR_NONE;
61 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
63 mmf_return_val_if_fail((void *)status, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
65 _mmstreamrec_dbg_err("");
67 *status = _mmstreamrecorder_get_state(streamrecorder);
73 int mm_streamrecorder_destroy(MMHandleType streamrecorder)
75 int error = MM_ERROR_NONE;
77 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
79 _mmstreamrec_dbg_log("");
81 error = _mmstreamrecorder_destroy(streamrecorder);
83 _mmstreamrec_dbg_log("END!!!");
88 int mm_streamrecorder_realize(MMHandleType streamrecorder)
90 int error = MM_ERROR_NONE;
92 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
94 _mmstreamrec_dbg_log("");
96 error = _mmstreamrecorder_realize(streamrecorder);
98 _mmstreamrec_dbg_log("END");
103 int mm_streamrecorder_pause(MMHandleType streamrecorder)
105 int error = MM_ERROR_NONE;
107 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
109 _mmstreamrec_dbg_err("");
111 error = _mmstreamrecorder_pause(streamrecorder);
113 _mmstreamrec_dbg_err("END");
119 int mm_streamrecorder_unrealize(MMHandleType streamrecorder)
121 int error = MM_ERROR_NONE;
123 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
125 _mmstreamrec_dbg_log("");
127 error = _mmstreamrecorder_unrealize(streamrecorder);
129 _mmstreamrec_dbg_log("END");
134 int mm_streamrecorder_record(MMHandleType streamrecorder)
136 int error = MM_ERROR_NONE;
138 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
140 _mmstreamrec_dbg_log("");
142 error = _mmstreamrecorder_record(streamrecorder);
144 _mmstreamrec_dbg_log("END");
149 int mm_streamrecorder_push_stream_buffer(MMHandleType streamrecorder, MMStreamRecorderStreamType streamtype, unsigned long timestamp, void *buffer, int size)
151 int error = MM_ERROR_NONE;
153 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
155 _mmstreamrec_dbg_log("");
157 error = _mmstreamrecorder_push_stream_buffer(streamrecorder, streamtype, timestamp, buffer, size);
159 _mmstreamrec_dbg_log("END");
164 int mm_streamrecorder_commit(MMHandleType streamrecorder)
166 int error = MM_ERROR_NONE;
168 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
170 _mmstreamrec_dbg_log("");
172 error = _mmstreamrecorder_commit(streamrecorder);
174 _mmstreamrec_dbg_log("END");
179 int mm_streamrecorder_cancel(MMHandleType streamrecorder)
181 int error = MM_ERROR_NONE;
183 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
185 _mmstreamrec_dbg_log("");
187 error = _mmstreamrecorder_cancel(streamrecorder);
189 _mmstreamrec_dbg_log("END");
194 int mm_streamrecorder_set_message_callback(MMHandleType streamrecorder, MMMessageCallback callback, void *user_data)
196 int error = MM_ERROR_NONE;
198 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
200 error = _mmstreamrecorder_set_message_callback(streamrecorder, callback, user_data);
205 int mm_streamrecorder_get_attributes(MMHandleType streamrecorder, char **err_attr_name, const char *attribute_name, ...)
208 int ret = MM_ERROR_NONE;
210 return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
212 va_start(var_args, attribute_name);
213 ret = _mmstreamrecorder_get_attributes(streamrecorder, err_attr_name, attribute_name, var_args);
219 int mm_streamrecorder_set_attributes(MMHandleType streamrecorder, char **err_attr_name, const char *attribute_name, ...)
222 int ret = MM_ERROR_NONE;
224 return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
226 va_start(var_args, attribute_name);
227 ret = _mmstreamrecorder_set_attributes(streamrecorder, err_attr_name, attribute_name, var_args);
233 int mm_streamrecorder_get_attribute_info(MMHandleType streamrecorder, const char *attribute_name, MMStreamRecorderAttrsInfo * info)
235 return _mmstreamrecorder_get_attribute_info(streamrecorder, attribute_name, info);