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_streamrecorder.h"
31 #include "mm_streamrecorder_internal.h"
32 #include "mm_streamrecorder_attribute.h"
34 /*===============================================================================
35 | FUNCTION DEFINITIONS |
36 ===============================================================================*/
37 /*-------------------------------------------------------------------------------
38 | GLOBAL FUNCTION DEFINITIONS: |
39 -------------------------------------------------------------------------------*/
40 int mm_streamrecorder_create(MMHandleType *streamrecorder)
42 int error = MM_ERROR_NONE;
44 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
46 _mmstreamrec_dbg_log("");
48 error = _mmstreamrecorder_create(streamrecorder);
50 _mmstreamrec_dbg_log("END");
56 int mm_streamrecorder_get_state(MMHandleType streamrecorder, MMStreamRecorderStateType *status)
58 int ret = MM_ERROR_NONE;
60 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
62 mmf_return_val_if_fail((void *)status, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
64 _mmstreamrec_dbg_err("");
66 *status = _mmstreamrecorder_get_state(streamrecorder);
72 int mm_streamrecorder_destroy(MMHandleType streamrecorder)
74 int error = MM_ERROR_NONE;
76 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
78 _mmstreamrec_dbg_log("");
80 error = _mmstreamrecorder_destroy(streamrecorder);
82 _mmstreamrec_dbg_log("END!!!");
87 int mm_streamrecorder_realize(MMHandleType streamrecorder)
89 int error = MM_ERROR_NONE;
91 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
93 _mmstreamrec_dbg_log("");
95 error = _mmstreamrecorder_realize(streamrecorder);
97 _mmstreamrec_dbg_log("END");
102 int mm_streamrecorder_pause(MMHandleType streamrecorder)
104 int error = MM_ERROR_NONE;
106 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
108 _mmstreamrec_dbg_err("");
110 error = _mmstreamrecorder_pause(streamrecorder);
112 _mmstreamrec_dbg_err("END");
118 int mm_streamrecorder_unrealize(MMHandleType streamrecorder)
120 int error = MM_ERROR_NONE;
122 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
124 _mmstreamrec_dbg_log("");
126 error = _mmstreamrecorder_unrealize(streamrecorder);
128 _mmstreamrec_dbg_log("END");
133 int mm_streamrecorder_record(MMHandleType streamrecorder)
135 int error = MM_ERROR_NONE;
137 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
139 _mmstreamrec_dbg_log("");
141 error = _mmstreamrecorder_record(streamrecorder);
143 _mmstreamrec_dbg_log("END");
148 int mm_streamrecorder_push_stream_buffer(MMHandleType streamrecorder, MMStreamRecorderStreamType streamtype, unsigned long long timestamp, void *buffer, int size)
150 int error = MM_ERROR_NONE;
152 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
154 _mmstreamrec_dbg_log("");
156 error = _mmstreamrecorder_push_stream_buffer(streamrecorder, streamtype, timestamp, buffer, size);
158 _mmstreamrec_dbg_log("END");
163 int mm_streamrecorder_push_video_packet(MMHandleType streamrecorder, media_packet_h packet, unsigned long long timestamp, void *buffer)
165 int error = MM_ERROR_NONE;
167 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
169 _mmstreamrec_dbg_log("");
171 error = _mmstreamrecorder_push_video_packet(streamrecorder, packet, timestamp, buffer);
173 _mmstreamrec_dbg_log("END");
179 int mm_streamrecorder_commit(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_commit(streamrecorder);
189 _mmstreamrec_dbg_log("END");
194 int mm_streamrecorder_cancel(MMHandleType streamrecorder)
196 int error = MM_ERROR_NONE;
198 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
200 _mmstreamrec_dbg_log("");
202 error = _mmstreamrecorder_cancel(streamrecorder);
204 _mmstreamrec_dbg_log("END");
209 int mm_streamrecorder_set_message_callback(MMHandleType streamrecorder, MMMessageCallback callback, void *user_data)
211 int error = MM_ERROR_NONE;
213 mmf_return_val_if_fail((void *)streamrecorder, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
215 error = _mmstreamrecorder_set_message_callback(streamrecorder, callback, user_data);
220 int mm_streamrecorder_get_attributes(MMHandleType streamrecorder, char **err_attr_name, const char *attribute_name, ...)
223 int ret = MM_ERROR_NONE;
225 return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
227 va_start(var_args, attribute_name);
228 ret = _mmstreamrecorder_get_attributes(streamrecorder, err_attr_name, attribute_name, var_args);
234 int mm_streamrecorder_set_attributes(MMHandleType streamrecorder, char **err_attr_name, const char *attribute_name, ...)
237 int ret = MM_ERROR_NONE;
239 return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
241 va_start(var_args, attribute_name);
242 ret = _mmstreamrecorder_set_attributes(streamrecorder, err_attr_name, attribute_name, var_args);
248 int mm_streamrecorder_get_attribute_info(MMHandleType streamrecorder, const char *attribute_name, MMStreamRecorderAttrsInfo * info)
250 return _mmstreamrecorder_get_attribute_info(streamrecorder, attribute_name, info);