4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jeongmo Yang <jm80.yang@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 #ifndef __MM_CAMCORDER_INTERNAL_H__
23 #define __MM_CAMCORDER_INTERNAL_H__
25 /*=======================================================================================
27 ========================================================================================*/
32 #include <semaphore.h>
36 #include <mm_attrs_private.h>
37 #include <mm_message.h>
42 #include "mm_camcorder.h"
45 /* camcorder sub module */
46 #include "mm_camcorder_attribute.h"
47 #include "mm_camcorder_platform.h"
48 #include "mm_camcorder_stillshot.h"
49 #include "mm_camcorder_videorec.h"
50 #include "mm_camcorder_audiorec.h"
51 #include "mm_camcorder_gstcommon.h"
52 #include "mm_camcorder_exifinfo.h"
53 #include "mm_camcorder_util.h"
54 #include "mm_camcorder_configure.h"
55 #include "mm_camcorder_sound.h"
61 /*=======================================================================================
63 ========================================================================================*/
64 #define _mmcam_dbg_verb(fmt, args...) mmf_debug(MMF_DEBUG_VERBOSE,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
65 #define _mmcam_dbg_log(fmt, args...) mmf_debug(MMF_DEBUG_LOG,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
66 #define _mmcam_dbg_warn(fmt, args...) mmf_debug(MMF_DEBUG_WARNING,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
67 #define _mmcam_dbg_err(fmt, args...) mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
68 #define _mmcam_dbg_crit(fmt, args...) mmf_debug(MMF_DEBUG_CRITICAL,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
71 * Macro for checking validity and debugging
73 #define mmf_return_if_fail( expr ) \
77 _mmcam_dbg_err( "failed [%s]", #expr); \
82 * Macro for checking validity and debugging
84 #define mmf_return_val_if_fail( expr, val ) \
88 _mmcam_dbg_err("failed [%s]", #expr); \
94 * Macro for getting array size
96 #define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
99 /* gstreamer element creation macro */
100 #define _MMCAMCORDER_PIPELINE_MAKE(sub_context, eid, name /*char* */, err) \
101 if (sub_context->element[eid].gst != NULL) { \
102 _mmcam_dbg_err("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \
103 gst_object_unref(sub_context->element[eid].gst); \
105 sub_context->element[eid].id = eid; \
106 sub_context->element[eid].gst = gst_pipeline_new(name); \
107 if (sub_context->element[eid].gst == NULL) { \
108 _mmcam_dbg_err("Pipeline creation fail. element_id=[%d], name=[%s]", eid, name); \
109 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
110 goto pipeline_creation_error; \
112 g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
115 #define _MMCAMCORDER_BIN_MAKE(sub_context, eid, name /*char* */, err) \
116 if (sub_context->element[eid].gst != NULL) { \
117 _mmcam_dbg_err("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \
118 gst_object_unref(sub_context->element[eid].gst); \
120 sub_context->element[eid].id = eid; \
121 sub_context->element[eid].gst = gst_bin_new(name); \
122 if (sub_context->element[eid].gst == NULL) { \
123 _mmcam_dbg_err("Bin creation fail. element_id=[%d], name=[%s]\n", eid, name); \
124 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
125 goto pipeline_creation_error; \
127 g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
130 #define _MMCAMCORDER_ELEMENT_MAKE(sub_context, eid, name /*char* */, nickname /*char* */, elist, err) \
131 if (sub_context->element[eid].gst != NULL) { \
132 _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
133 gst_object_unref(sub_context->element[eid].gst); \
135 sub_context->element[eid].gst = gst_element_factory_make(name, nickname); \
136 if (sub_context->element[eid].gst == NULL) { \
137 _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
138 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
139 goto pipeline_creation_error; \
141 _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
142 sub_context->element[eid].id = eid; \
143 g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
144 err = MM_ERROR_NONE; \
146 elist = g_list_append(elist, &(sub_context->element[eid]));
148 #define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, eid, name /*char* */, nickname /*char* */, elist) \
149 if (sub_context->element[eid].gst != NULL) { \
150 _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
151 gst_object_unref(sub_context->element[eid].gst); \
153 sub_context->element[eid].gst = gst_element_factory_make(name, nickname); \
154 if (sub_context->element[eid].gst == NULL) { \
155 _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s], but keep going...", eid, name); \
157 _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
158 sub_context->element[eid].id = eid; \
159 g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
160 elist = g_list_append(elist, &(sub_context->element[eid])); \
163 #define _MMCAMCORDER_ENCODEBIN_ELMGET(sub_context, eid, name /*char* */, err) \
164 if (sub_context->element[eid].gst != NULL) { \
165 _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
166 gst_object_unref(sub_context->element[eid].gst); \
168 sub_context->element[eid].id = eid; \
169 g_object_get(G_OBJECT(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sc->element[eid].gst), NULL); \
170 if (sub_context->element[eid].gst == NULL) { \
171 _mmcam_dbg_err("Element get fail. element_id=[%d], name=[%s]", eid, name); \
172 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
173 goto pipeline_creation_error; \
175 gst_object_unref(sub_context->element[eid].gst); \
176 g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
179 /* GStreamer element remove macro */
180 #define _MMCAMCORDER_ELEMENT_REMOVE(sub_context, eid) \
181 if (sub_context->element[eid].gst != NULL) { \
182 gst_object_unref(sub_context->element[eid].gst); \
185 #define _MM_GST_ELEMENT_LINK_MANY gst_element_link_many
186 #define _MM_GST_ELEMENT_LINK gst_element_link
187 #define _MM_GST_PAD_LINK gst_pad_link
189 #define _MM_GST_PAD_LINK_UNREF( srcpad, sinkpad, err, if_fail_goto ) \
191 GstPadLinkReturn ret = _MM_GST_PAD_LINK( srcpad, sinkpad ); \
192 gst_object_unref( srcpad ); srcpad = NULL; \
193 gst_object_unref( sinkpad ); sinkpad = NULL; \
194 if (ret != GST_PAD_LINK_OK) { \
195 err = MM_ERROR_CAMCORDER_GST_LINK; \
200 #define _MM_GST_PAD_UNLINK_UNREF( srcpad, sinkpad) \
201 if (srcpad && sinkpad) { \
202 gst_pad_unlink(srcpad, sinkpad); \
204 _mmcam_dbg_warn("some pad(srcpad:%p,sinkpad:%p) is NULL", srcpad, sinkpad); \
207 gst_object_unref(srcpad); srcpad = NULL; \
210 gst_object_unref(sinkpad); sinkpad = NULL; \
213 #define _MMCAMCORDER_STATE_SET_COUNT 3 /* checking interval */
214 #define _MMCAMCORDER_STATE_CHECK_TOTALTIME 5000000L /* total wating time for state change */
215 #define _MMCAMCORDER_STATE_CHECK_INTERVAL 5000 /* checking interval */
218 * Default videosink type
220 #define _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE "VideosinkElementX"
223 * Default recording motion rate
225 #define _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE 1.0
228 * Total level count of manual focus */
229 #define _MMFCAMCORDER_FOCUS_TOTAL_LEVEL 8
232 * File name length limit
234 #define _MMCamcorder_FILENAME_LEN (512)
237 * Minimum integer value
239 #define _MMCAMCORDER_MIN_INT (INT_MIN)
242 * Maximum integer value
244 #define _MMCAMCORDER_MAX_INT (INT_MAX)
247 * Minimum double value
249 #define _MMCAMCORDER_MIN_DOUBLE (DBL_MIN)
252 * Maximum integer value
254 #define _MMCAMCORDER_MAX_DOUBLE (DBL_MAX)
257 * Audio timestamp margin (msec)
259 #define _MMCAMCORDER_AUDIO_TIME_MARGIN (300)
262 * Functions related with LOCK and WAIT
264 #define _MMCAMCORDER_CAST_MTSAFE(handle) (((mmf_camcorder_t*)handle)->mtsafe)
266 #define _MMCAMCORDER_GET_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).lock)
267 #define _MMCAMCORDER_LOCK(handle) g_mutex_lock(_MMCAMCORDER_GET_LOCK(handle))
268 #define _MMCAMCORDER_TRYLOCK(handle) g_mutex_trylock(_MMCAMCORDER_GET_LOCK(handle))
269 #define _MMCAMCORDER_UNLOCK(handle) g_mutex_unlock(_MMCAMCORDER_GET_LOCK(handle))
271 #define _MMCAMCORDER_GET_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
272 #define _MMCAMCORDER_WAIT(handle) g_cond_wait (_MMCAMCORDER_GET_COND(handle), _MMCAMCORDER_GET_LOCK(handle))
273 #define _MMCAMCORDER_TIMED_WAIT(handle, timeval) g_cond_timed_wait (_MMCAMCORDER_GET_COND(handle), _MMCAMCORDER_GET_LOCK(handle),timeval)
275 #define _MMCAMCORDER_SIGNAL(handle) g_cond_signal (_MMCAMCORDER_GET_COND(handle));
276 #define _MMCAMCORDER_BROADCAST(handle) g_cond_broadcast (_MMCAMCORDER_GET_COND(handle));
279 #define _MMCAMCORDER_GET_CMD_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
280 #define _MMCAMCORDER_LOCK_CMD(handle) g_mutex_lock(_MMCAMCORDER_GET_CMD_LOCK(handle))
281 #define _MMCAMCORDER_TRYLOCK_CMD(handle) g_mutex_trylock(_MMCAMCORDER_GET_CMD_LOCK(handle))
282 #define _MMCAMCORDER_UNLOCK_CMD(handle) g_mutex_unlock(_MMCAMCORDER_GET_CMD_LOCK(handle))
284 /* for state change */
285 #define _MMCAMCORDER_GET_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
286 #define _MMCAMCORDER_LOCK_STATE(handle) g_mutex_lock(_MMCAMCORDER_GET_STATE_LOCK(handle))
287 #define _MMCAMCORDER_TRYLOCK_STATE(handle) g_mutex_trylock(_MMCAMCORDER_GET_STATE_LOCK(handle))
288 #define _MMCAMCORDER_UNLOCK_STATE(handle) g_mutex_unlock(_MMCAMCORDER_GET_STATE_LOCK(handle))
290 /* for gstreamer state change */
291 #define _MMCAMCORDER_GET_GST_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_state_lock)
292 #define _MMCAMCORDER_LOCK_GST_STATE(handle) g_mutex_lock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
293 #define _MMCAMCORDER_TRYLOCK_GST_STATE(handle) g_mutex_trylock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
294 #define _MMCAMCORDER_UNLOCK_GST_STATE(handle) g_mutex_unlock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
296 /* for setting/calling callback */
297 #define _MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).message_cb_lock)
298 #define _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
299 #define _MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
300 #define _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
302 #define _MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).vcapture_cb_lock)
303 #define _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
304 #define _MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
305 #define _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
307 #define _MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).vstream_cb_lock)
308 #define _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
309 #define _MMCAMCORDER_TRYLOCK_VSTREAM_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
310 #define _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
312 #define _MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).astream_cb_lock)
313 #define _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
314 #define _MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
315 #define _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
318 * Caster of main handle (camcorder)
320 #define MMF_CAMCORDER(h) (mmf_camcorder_t *)(h)
323 * Caster of subcontext
325 #define MMF_CAMCORDER_SUBCONTEXT(h) (((mmf_camcorder_t *)(h))->sub_context)
327 /* LOCAL CONSTANT DEFINITIONS */
329 * Total Numbers of Attribute values.
330 * If you increase any enum of attribute values, you also have to increase this.
332 #define MM_CAMCORDER_MODE_NUM 3 /**< Number of mode type */
333 #define MM_CAMCORDER_COLOR_TONE_NUM 30 /**< Number of color-tone modes */
334 #define MM_CAMCORDER_WHITE_BALANCE_NUM 10 /**< Number of WhiteBalance modes*/
335 #define MM_CAMCORDER_SCENE_MODE_NUM 15 /**< Number of program-modes */
336 #define MM_CAMCORDER_FOCUS_MODE_NUM 6 /**< Number of focus mode*/
337 #define MM_CAMCORDER_AUTO_FOCUS_NUM 5 /**< Total count of auto focus type*/
338 #define MM_CAMCORDER_FOCUS_STATE_NUM 4 /**< Number of focus state */
339 #define MM_CAMCORDER_ISO_NUM 10 /**< Number of ISO */
340 #define MM_CAMCORDER_AUTO_EXPOSURE_NUM 9 /**< Number of Auto exposure type */
341 #define MM_CAMCORDER_WDR_NUM 3 /**< Number of wide dynamic range */
342 #define MM_CAMCORDER_AHS_NUM 4 /**< Number of anti-handshake */
343 #define MM_CAMCORDER_VIDEO_STABILIZATION_NUM 2 /**< Number of video stabilization */
344 #define MM_CAMCORDER_HDR_CAPTURE_NUM 3 /**< Number of HDR capture mode */
345 #define MM_CAMCORDER_GEOMETRY_METHOD_NUM 5 /**< Number of geometry method */
346 #define MM_CAMCORDER_TAG_ORT_NUM 8 /**< Number of tag orientation */
347 #define MM_CAMCORDER_STROBE_MODE_NUM 8 /**< Number of strobe mode type */
348 #define MM_CAMCORDER_STROBE_CONTROL_NUM 3 /**< Number of strobe control type */
349 #define MM_CAMCORDER_DETECT_MODE_NUM 2 /**< Number of detect mode type */
352 /*=======================================================================================
354 ========================================================================================*/
356 * Command for Camcorder.
359 /* Command for Video/Audio recording */
360 _MMCamcorder_CMD_RECORD,
361 _MMCamcorder_CMD_PAUSE,
362 _MMCamcorder_CMD_CANCEL,
363 _MMCamcorder_CMD_COMMIT,
365 /* Command for Image capture */
366 _MMCamcorder_CMD_CAPTURE,
368 /* Command for Preview(Video/Image only effective) */
369 _MMCamcorder_CMD_PREVIEW_START,
370 _MMCamcorder_CMD_PREVIEW_STOP,
377 _MMCamcorder_SINGLE_SHOT,
378 _MMCamcorder_MULTI_SHOT,
382 * Enumerations for manual focus direction.
383 * If focusing mode is not "MM_CAMCORDER_AF_MODE_MANUAL", this value will be ignored.
385 enum MMCamcorderMfLensDir {
386 MM_CAMCORDER_MF_LENS_DIR_FORWARD = 1, /**< Focus direction to forward */
387 MM_CAMCORDER_MF_LENS_DIR_BACKWARD, /**< Focus direction to backward */
388 MM_CAMCORDER_MF_LENS_DIR_NUM, /**< Total number of the directions */
392 * Camcorder Pipeline's Element name.
393 * @note index of element.
396 _MMCAMCORDER_NONE = (-1),
398 /* Main Pipeline Element */
399 _MMCAMCORDER_MAIN_PIPE = 0x00,
401 /* Pipeline element of Video input */
402 _MMCAMCORDER_VIDEOSRC_BIN,
403 _MMCAMCORDER_VIDEOSRC_SRC,
404 _MMCAMCORDER_VIDEOSRC_FILT,
405 _MMCAMCORDER_VIDEOSRC_QUE,
406 _MMCAMCORDER_VIDEOSRC_CLS,
407 _MMCAMCORDER_VIDEOSRC_SCALE,
408 _MMCAMCORDER_VIDEOSRC_VSFLT,
409 _MMCAMCORDER_VIDEOSRC_TEE,
411 /* Pipeline element of Audio input */
412 _MMCAMCORDER_AUDIOSRC_BIN,
413 _MMCAMCORDER_AUDIOSRC_SRC,
414 _MMCAMCORDER_AUDIOSRC_FILT,
415 _MMCAMCORDER_AUDIOSRC_NS,
416 _MMCAMCORDER_AUDIOSRC_QUE,
417 _MMCAMCORDER_AUDIOSRC_CONV,
418 _MMCAMCORDER_AUDIOSRC_VOL,
419 _MMCAMCORDER_AUDIOSRC_ENC,
421 /* Pipeline element of Video output */
422 _MMCAMCORDER_VIDEOSINK_BIN,
423 _MMCAMCORDER_VIDEOSINK_QUE,
424 _MMCAMCORDER_VIDEOSINK_SCALE,
425 _MMCAMCORDER_VIDEOSINK_FILT,
426 _MMCAMCORDER_VIDEOSINK_OVERLAY,
427 _MMCAMCORDER_VIDEOSINK_CLS,
428 _MMCAMCORDER_VIDEOSINK_ROTATE,
429 _MMCAMCORDER_VIDEOSINK_SINK,
431 /* Pipeline element of Encodebin */
432 _MMCAMCORDER_ENCSINK_BIN,
433 _MMCAMCORDER_ENCSINK_ENCBIN,
434 _MMCAMCORDER_ENCSINK_AQUE,
435 _MMCAMCORDER_ENCSINK_CONV,
436 _MMCAMCORDER_ENCSINK_AENC,
437 _MMCAMCORDER_ENCSINK_AENC_QUE,
438 _MMCAMCORDER_ENCSINK_VQUE,
439 _MMCAMCORDER_ENCSINK_VCONV,
440 _MMCAMCORDER_ENCSINK_VENC,
441 _MMCAMCORDER_ENCSINK_VENC_QUE,
442 _MMCAMCORDER_ENCSINK_ITOG,
443 _MMCAMCORDER_ENCSINK_ICROP,
444 _MMCAMCORDER_ENCSINK_ISCALE,
445 _MMCAMCORDER_ENCSINK_IFILT,
446 _MMCAMCORDER_ENCSINK_IQUE,
447 _MMCAMCORDER_ENCSINK_IENC,
448 _MMCAMCORDER_ENCSINK_MUX,
449 _MMCAMCORDER_ENCSINK_SINK,
451 /* Pipeline element of Stillshot output */
452 _MMCAMCORDER_STILLSHOTSINK_BIN,
453 _MMCAMCORDER_STILLSHOTSINK_QUE,
454 _MMCAMCORDER_STILLSHOTSINK_TOGGLE,
455 _MMCAMCORDER_STILLSHOTSINK_CLS,
456 _MMCAMCORDER_STILLSHOTSINK_CROP,
457 _MMCAMCORDER_STILLSHOTSINK_FILT,
458 _MMCAMCORDER_STILLSHOTSINK_SCALE,
459 _MMCAMCORDER_STILLSHOTSINK_FILT2,
460 _MMCAMCORDER_STILLSHOTSINK_ENC,
461 _MMCAMCORDER_STILLSHOTSINK_SINK,
463 _MMCamcorder_PIPELINE_ELEMENT_NUM,
464 } _MMCAMCORDER_PIPELINE_ELELMENT;
467 * Command type for Camcorder.
470 _MMCAMCORDER_CMD_CREATE,
471 _MMCAMCORDER_CMD_DESTROY,
472 _MMCAMCORDER_CMD_REALIZE,
473 _MMCAMCORDER_CMD_UNREALIZE,
474 _MMCAMCORDER_CMD_START,
475 _MMCAMCORDER_CMD_STOP,
476 _MMCAMCORDER_CMD_CAPTURESTART,
477 _MMCAMCORDER_CMD_CAPTURESTOP,
478 _MMCAMCORDER_CMD_RECORD,
479 _MMCAMCORDER_CMD_PAUSE,
480 _MMCAMCORDER_CMD_COMMIT,
481 _MMCAMCORDER_CMD_CANCEL,
482 _MMCAMCORDER_CMD_QUIT,
483 } _MMCamcorderCommandType;
486 * System state change cause
489 _MMCAMCORDER_STATE_CHANGE_NORMAL = 0,
490 _MMCAMCORDER_STATE_CHANGE_BY_ASM,
491 } _MMCamcorderStateChange;
494 /*=======================================================================================
495 | STRUCTURE DEFINITIONS |
496 ========================================================================================*/
498 * MMCamcorder Gstreamer Element
501 unsigned int id; /**< Gstreamer piplinem element name */
502 GstElement *gst; /**< Gstreamer element */
503 } _MMCamcorderGstElement;
506 * MMCamcorder information for KPI measurement
509 int current_fps; /**< current fps of this second */
510 int average_fps; /**< average fps */
511 unsigned int video_framecount; /**< total number of video frame */
512 unsigned int last_framecount; /**< total number of video frame in last measurement */
513 struct timeval init_video_time; /**< time when start to measure */
514 struct timeval last_video_time; /**< last measurement time */
515 } _MMCamcorderKPIMeasure;
518 * MMCamcorder information for Multi-Thread Safe
521 GMutex *lock; /**< Mutex (for general use) */
522 GCond *cond; /**< Condition (for general use) */
523 GMutex *cmd_lock; /**< Mutex (for command) */
524 GMutex *state_lock; /**< Mutex (for state change) */
525 GMutex *gst_state_lock; /**< Mutex (for state change) */
526 GMutex *message_cb_lock; /**< Mutex (for message callback) */
527 GMutex *vcapture_cb_lock; /**< Mutex (for video capture callback) */
528 GMutex *vstream_cb_lock; /**< Mutex (for video stream callback) */
529 GMutex *astream_cb_lock; /**< Mutex (for audio stream callback) */
530 } _MMCamcorderMTSafe;
533 * MMCamcorder information for command loop
536 pthread_t pCommandThread; /**< Command loop handle */
537 GQueue *cmd_queue; /**< Queue for Command loop */
538 sem_t sema; /**< Semaphore for Command loop */
539 } _MMCamcorderCommand;
542 * MMCamcorder command information
545 MMHandleType handle; /**< camcorder handle */
546 _MMCamcorderCommandType type; /**< Type of command */
547 } __MMCamcorderCmdInfo;
550 * MMCamcorder Sub Context
553 bool isMaxsizePausing; /**< Because of size limit, pipeline is paused. */
554 bool isMaxtimePausing; /**< Because of time limit, pipeline is paused. */
555 int element_num; /**< count of element */
556 int cam_stability_count; /**< camsensor stability count. the count of frame will drop */
557 GstClockTime pipeline_time; /**< current time of Gstreamer Pipeline */
558 GstClockTime pause_time; /**< amount of time while pipeline is in PAUSE state.*/
559 GstClockTime stillshot_time; /**< pipeline time of capturing moment*/
560 gboolean is_modified_rate; /**< whether recording motion rate is modified or not */
561 gboolean error_occurs; /**< flag for error */
562 int error_code; /**< error code for internal gstreamer error */
563 gboolean ferror_send; /**< file write/seek error **/
564 guint ferror_count; /**< file write/seek error count **/
565 GstClockTime previous_slot_time;
566 int display_interval; /**< This value is set as 'GST_SECOND / display FPS' */
567 gboolean bget_eos; /**< Whether getting EOS */
568 gboolean bencbin_capture; /**< Use Encodebin for capturing */
569 gboolean audio_disable; /**< whether audio is disabled or not when record */
570 int videosrc_rotate; /**< rotate of videosrc */
572 /* For dropping video frame when start recording */
573 int drop_vframe; /**< When this value is bigger than zero and pass_first_vframe is zero, MSL will drop video frame though cam_stability count is bigger then zero. */
574 int pass_first_vframe; /**< When this value is bigger than zero, MSL won't drop video frame though "drop_vframe" is bigger then zero. */
576 /* INI information */
577 unsigned int fourcc; /**< Get fourcc value of camera INI file */
578 _MMCamcorderImageInfo *info_image; /**< extra information for image capture */
579 _MMCamcorderVideoInfo *info_video; /**< extra information for video recording */
580 _MMCamcorderAudioInfo *info_audio; /**< extra information for audio recording */
582 _MMCamcorderGstElement *element; /**< array of Gstreamer element */
583 _MMCamcorderKPIMeasure kpi; /**< information related with performance measurement */
585 type_element *VideosinkElement; /**< configure data of videosink element */
586 gboolean SensorEncodedCapture; /**< whether camera sensor support encoded image capture */
587 gboolean internal_encode; /**< whether use internal encoding function */
588 } _MMCamcorderSubContext;
591 * _MMCamcorderContext
593 typedef struct mmf_camcorder {
595 int type; /**< mmcamcorder_mode_type */
596 int state; /**< state of camcorder */
597 int target_state; /**< Target state that want to set. This is a flag that
598 * stands for async state changing. If this value differ from state,
599 * it means state is changing now asychronously. */
602 MMHandleType attributes; /**< Attribute handle */
603 _MMCamcorderSubContext *sub_context; /**< sub context */
604 mm_exif_info_t *exif_info; /**< EXIF */
605 GList *buffer_probes; /**< a list of buffer probe handle */
606 GList *event_probes; /**< a list of event probe handle */
607 GList *data_probes; /**< a list of data probe handle */
608 GList *signals; /**< a list of signal handle */
609 GList *msg_data; /**< a list of msg data */
610 camera_conf *conf_main; /**< Camera configure Main structure */
611 camera_conf *conf_ctrl; /**< Camera configure Control structure */
612 int asm_handle_sh; /**< Audio session manager handle of share session */
613 int asm_handle_ex; /**< Audio session manager handle of exclusive session */
614 guint pipeline_cb_event_id; /**< Event source ID of pipeline message callback */
615 guint setting_event_id; /**< Event source ID of attributes setting to sensor */
616 SOUND_INFO snd_info; /**< Sound handle for multishot capture */
618 /* callback handlers */
619 MMMessageCallback msg_cb; /**< message callback */
620 void *msg_cb_param; /**< message callback parameter */
621 mm_camcorder_video_stream_callback vstream_cb; /**< Video stream callback */
622 void *vstream_cb_param; /**< Video stream callback parameter */
623 mm_camcorder_audio_stream_callback astream_cb; /**< Audio stream callback */
624 void *astream_cb_param; /**< Audio stream callback parameter */
625 mm_camcorder_video_capture_callback vcapture_cb; /**< Video capture callback */
626 void *vcapture_cb_param; /**< Video capture callback parameter */
627 int (*command)(MMHandleType, int); /**< camcorder's command */
630 _MMCamcorderMTSafe mtsafe; /**< Thread safe */
631 _MMCamcorderCommand cmd; /**< information for command loop */
632 int sync_state_change; /**< Change framework state synchronously */
633 int quick_device_close;
634 int state_change_by_system; /**< MSL changes its state by itself because of system(ASM,MDM..) **/
635 int asm_event_code; /**< event code of audio session manager */
636 pthread_mutex_t sound_lock; /**< Capture sound mutex */
637 pthread_cond_t sound_cond; /**< Capture sound cond */
638 int use_zero_copy_format; /**< Whether use zero copy format for camera input */
639 int shutter_sound_policy; /**< shutter sound policy */
641 _MMCamcorderInfoConverting caminfo_convert[CAMINFO_CONVERT_NUM]; /**< converting structure of camera info */
642 _MMCamcorderEnumConvert enum_conv[ENUM_CONVERT_NUM]; /**< enum converting list that is modified by ini info */
644 int reserved[4]; /**< reserved */
647 /*=======================================================================================
648 | EXTERN GLOBAL VARIABLE |
649 ========================================================================================*/
651 /*=======================================================================================
652 | GLOBAL FUNCTION PROTOTYPES |
653 ========================================================================================*/
655 * This function creates camcorder for capturing still image and recording.
657 * @param[out] handle Specifies the camcorder handle
658 * @param[in] info Preset information of camcorder
659 * @return This function returns zero on success, or negative value with error code.
660 * @remarks When this function calls successfully, camcorder handle will be filled with a @n
661 * valid value and the state of the camcorder will become MM_CAMCORDER_STATE_NULL.@n
662 * Note that it's not ready to working camcorder. @n
663 * You should call mmcamcorder_realize before starting camcorder.
664 * @see _mmcamcorder_create
666 int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info);
669 * This function destroys instance of camcorder.
671 * @param[in] hcamcorder Specifies the camcorder handle
672 * @return This function returns zero on success, or negative value with error code.
673 * @see _mmcamcorder_create
675 int _mmcamcorder_destroy(MMHandleType hcamcorder);
678 * This function allocates memory for camcorder.
680 * @param[in] hcamcorder Specifies the camcorder handle
681 * @return This function returns zero on success, or negative value with error code.
682 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_NULL @n
683 * and the state of the camcorder will become MM_CAMCORDER_STATE_READY. @n
684 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
685 * @see _mmcamcorder_unrealize
686 * @pre MM_CAMCORDER_STATE_NULL
687 * @post MM_CAMCORDER_STATE_READY
689 int _mmcamcorder_realize(MMHandleType hcamcorder);
692 * This function free allocated memory for camcorder.
694 * @param[in] hcamcorder Specifies the camcorder handle
695 * @return This function returns zero on success, or negative value with error code.
696 * @remarks This function release all resources which are allocated for the camcorder engine.@n
697 * This function can be called successfully when current state is MM_CAMCORDER_STATE_READY and @n
698 * the state of the camcorder will become MM_CAMCORDER_STATE_NULL. @n
699 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
700 * @see _mmcamcorder_realize
701 * @pre MM_CAMCORDER_STATE_READY
702 * @post MM_CAMCORDER_STATE_NULL
704 int _mmcamcorder_unrealize(MMHandleType hcamcorder);
707 * This function is to start previewing.
709 * @param[in] hcamcorder Specifies the camcorder handle
710 * @return This function returns zero on success, or negative value with error code.
711 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_READY and @n
712 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
713 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
714 * @see _mmcamcorder_stop
716 int _mmcamcorder_start(MMHandleType hcamcorder);
719 * This function is to stop previewing.
721 * @param[in] hcamcorder Specifies the camcorder handle
722 * @return This function returns zero on success, or negative value with error code.
723 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_PREPARE and @n
724 * the state of the camcorder will become MM_CAMCORDER_STATE_READY.@n
725 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
726 * @see _mmcamcorder_start
728 int _mmcamcorder_stop(MMHandleType hcamcorder);
731 * This function to start capturing of still images.
733 * @param[in] hcamcorder Specifies the camcorder handle.
734 * @return This function returns zero on success, or negative value with error code.
735 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_PREPARE and @n
736 * the state of the camcorder will become MM_CAMCORDER_STATE_CAPTURING. @n
737 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
738 * @see _mmcamcorder_capture_stop
740 int _mmcamcorder_capture_start(MMHandleType hcamcorder);
743 * This function is to stop capturing still images.
745 * @param[in] hcamcorder Specifies the camcorder handle
746 * @return This function returns zero on success, or negative value with error code.
747 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_CAPTURING and @n
748 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
749 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
750 * @see _mmcamcorder_capture_start
752 int _mmcamcorder_capture_stop(MMHandleType hcamcorder);
755 * This function is to start video and audio recording.
757 * @param[in] hcamcorder Specifies the camcorder handle
758 * @return This function returns zero on success, or negative value with error code.
759 * @remarks This function can be called successfully when current state is @n
760 * MM_CAMCORDER_STATE_PREPARE or MM_CAMCORDER_STATE_PAUSED and @n
761 * the state of the camcorder will become MM_CAMCORDER_STATE_RECORDING.@n
762 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
763 * @see _mmcamcorder_pause
765 int _mmcamcorder_record(MMHandleType hcamcorder);
768 * This function is to pause video and audio recording
770 * @param[in] hcamcorder Specifies the camcorder handle
771 * @return This function returns zero on success, or negative value with error code.
772 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_RECORDING and @n
773 * the state of the camcorder will become MM_CAMCORDER_STATE_PAUSED.@n
774 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.@n
775 * @see _mmcamcorder_record
777 int _mmcamcorder_pause(MMHandleType hcamcorder);
780 * This function is to stop video and audio recording and save results.
782 * @param[in] hcamcorder Specifies the camcorder handle
783 * @return This function returns zero on success, or negative value with error code.
784 * @remarks This function can be called successfully when current state is @n
785 * MM_CAMCORDER_STATE_PAUSED or MM_CAMCORDER_STATE_RECORDING and @n
786 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
787 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION
788 * @see _mmcamcorder_cancel
790 int _mmcamcorder_commit(MMHandleType hcamcorder);
793 * This function is to stop video and audio recording and do not save results.
795 * @param[in] hcamcorder Specifies the camcorder handle
796 * @return This function returns zero on success, or negative value with error code.
797 * @remarks This function can be called successfully when current state is @n
798 * MM_CAMCORDER_STATE_PAUSED or MM_CAMCORDER_STATE_RECORDING and @n
799 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
800 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
801 * @see _mmcamcorder_commit
803 int _mmcamcorder_cancel(MMHandleType hcamcorder);
806 * This function calls after commiting action finished asynchronously.
807 * In this function, remaining process , such as state change, happens.
809 * @param[in] hcamcorder Specifies the camcorder handle
810 * @return This function returns zero on success, or negative value with error code.
811 * @remarks This function can be called successfully when current state is @n
812 * MM_CAMCORDER_STATE_PAUSED or MM_CAMCORDER_STATE_RECORDING and @n
813 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
814 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
815 * @see _mmcamcorder_commit
817 int _mmcamcorder_commit_async_end(MMHandleType hcamcorder);
820 * This function is to set callback for receiving messages from camcorder.
822 * @param[in] hcamcorder Specifies the camcorder handle
823 * @param[in] callback Specifies the function pointer of callback function
824 * @param[in] user_data Specifies the user poiner for passing to callback function
826 * @return This function returns zero on success, or negative value with error code.
827 * @remarks typedef bool (*mm_message_callback) (int msg, mm_messageType *param, void *user_param);@n
842 * } mm_message_type; @n
844 * If a message value for mm_message_callback is MM_MESSAGE_STATE_CHANGED, @n
845 * state value in mm_message_type will be a mmcamcorder_state_type enum value;@n
847 * If a message value for mm_message_callback is MM_MESSAGE_ERROR, @n
848 * the code value in mm_message_type will be a mmplayer_error_type enum value;
850 * @see mm_message_type, mmcamcorder_state_type, mmcamcorder_error_type
852 int _mmcamcorder_set_message_callback(MMHandleType hcamcorder,
853 MMMessageCallback callback,
857 * This function is to set callback for video stream.
859 * @param[in] hcamcorder Specifies the camcorder handle
860 * @param[in] callback Specifies the function pointer of callback function
861 * @param[in] user_data Specifies the user poiner for passing to callback function
863 * @return This function returns zero on success, or negative value with error code.
864 * @see mmcamcorder_error_type
866 int _mmcamcorder_set_video_stream_callback(MMHandleType hcamcorder,
867 mm_camcorder_video_stream_callback callback,
871 * This function is to set callback for audio stream.
873 * @param[in] hcamcorder Specifies the camcorder handle
874 * @param[in] callback Specifies the function pointer of callback function
875 * @param[in] user_data Specifies the user poiner for passing to callback function
877 * @return This function returns zero on success, or negative value with error code.
878 * @see mmcamcorder_error_type
880 int _mmcamcorder_set_audio_stream_callback(MMHandleType handle,
881 mm_camcorder_audio_stream_callback callback,
885 * This function is to set callback for video capture.
887 * @param[in] hcamcorder Specifies the camcorder handle
888 * @param[in] callback Specifies the function pointer of callback function
889 * @param[in] user_data Specifies the user poiner for passing to callback function
891 * @return This function returns zero on success, or negative value with error code.
892 * @see mmcamcorder_error_type
894 int _mmcamcorder_set_video_capture_callback(MMHandleType hcamcorder,
895 mm_camcorder_video_capture_callback callback,
899 * This function returns current state of camcorder, or negative value with error code.
901 * @param[in] hcamcorder Specifies the camcorder handle.
902 * @return This function returns current state of camcorder, or negative value with error code.
903 * @see mmcamcorder_state_type
905 int _mmcamcorder_get_current_state(MMHandleType hcamcorder);
907 int _mmcamcorder_init_focusing(MMHandleType handle);
908 int _mmcamcorder_adjust_focus(MMHandleType handle, int direction);
909 int _mmcamcorder_adjust_manual_focus(MMHandleType handle, int direction);
910 int _mmcamcorder_adjust_auto_focus(MMHandleType handle);
911 int _mmcamcorder_stop_focusing(MMHandleType handle);
914 * This function gets current state of camcorder.
917 * @return This function returns state of current camcorder context
919 * @see _mmcamcorder_set_state()
922 int _mmcamcorder_streamer_init(void);
925 * This function gets current state of camcorder.
928 * @return This function returns state of current camcorder context
930 * @see _mmcamcorder_set_state()
933 int _mmcamcorder_display_init(void);
936 * This function gets current state of camcorder.
938 * @param[in] handle Handle of camcorder context.
939 * @return This function returns state of current camcorder context
941 * @see _mmcamcorder_set_state()
944 int _mmcamcorder_get_state(MMHandleType handle);
947 * This function sets new state of camcorder.
949 * @param[in] handle Handle of camcorder context.
950 * @param[in] state setting state value of camcorder.
953 * @see _mmcamcorder_get_state()
956 void _mmcamcorder_set_state(MMHandleType handle, int state);
959 * This function gets asynchronous status of MSL Camcroder.
961 * @param[in] handle Handle of camcorder context.
962 * @param[in] target_state setting target_state value of camcorder.
963 * @return This function returns asynchrnous state.
965 * @see _mmcamcorder_set_async_state()
968 int _mmcamcorder_get_async_state(MMHandleType handle);
971 * This function sets new target state of camcorder.
973 * @param[in] handle Handle of camcorder context.
974 * @param[in] target_state setting target_state value of camcorder.
975 * @return This function returns zero on success, or negative value with error code.
977 * @see _mmcamcorder_get_async_state(), _mmcamcorder_set_async_cancel()
980 int _mmcamcorder_set_async_state(MMHandleType handle, int target_state);
983 * This function sets new target state of camcorder.
985 * @param[in] handle Handle of camcorder context.
988 * @see _mmcamcorder_set_async_cancel()
991 gboolean _mmcamcorder_set_async_cancel(MMHandleType handle);
994 * Check whether camcorder changes its state now.
996 * @param[in] handle Handle of camcorder context.
999 * @see _mmcamcorder_set_async_state(), _mmcamcorder_set_async_cancel()
1002 gboolean _mmcamcorder_is_state_changing(MMHandleType handle);
1005 * This function allocates structure of subsidiary attributes.
1007 * @param[in] type Allocation type of camcorder context.
1008 * @return This function returns structure pointer on success, NULL value on failure.
1010 * @see _mmcamcorder_dealloc_subcontext()
1013 _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type);
1016 * This function releases structure of subsidiary attributes.
1018 * @param[in] sc Handle of camcorder subcontext.
1021 * @see _mmcamcorder_alloc_subcontext()
1024 void _mmcamcorder_dealloc_subcontext(_MMCamcorderSubContext *sc);
1027 * This function sets command function according to the type.
1029 * @param[in] handle Handle of camcorder context.
1030 * @param[in] type Allocation type of camcorder context.
1031 * @return This function returns MM_ERROR_NONE on success, or other values with error code.
1033 * @see __mmcamcorder_video_command(), __mmcamcorder_audio_command(), __mmcamcorder_image_command()
1036 int _mmcamcorder_set_functions(MMHandleType handle, int type);
1039 * This function is callback function of main pipeline.
1040 * Once this function is registered with certain pipeline using gst_bus_add_watch(),
1041 * this callback will be called every time when there is upcomming message from pipeline.
1042 * Basically, this function is used as error handling function, now.
1044 * @param[in] bus pointer of buf that called this function.
1045 * @param[in] message callback message from pipeline.
1046 * @param[in] data user data.
1047 * @return This function returns true on success, or false value with error
1049 * @see __mmcamcorder_create_preview_pipeline()
1052 gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpointer data);
1055 * This function is callback function of main pipeline.
1056 * Once this function is registered with certain pipeline using gst_bus_set_sync_handler(),
1057 * this callback will be called every time when there is upcomming message from pipeline.
1058 * Basically, this function is used as sync error handling function, now.
1060 * @param[in] bus pointer of buf that called this function.
1061 * @param[in] message callback message from pipeline.
1062 * @param[in] data user data.
1063 * @return This function returns true on success, or false value with error
1065 * @see __mmcamcorder_create_preview_pipeline()
1068 GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data);
1071 * This function create main pipeline according to type.
1073 * @param[in] handle Handle of camcorder context.
1074 * @param[in] type Allocation type of camcorder context.
1075 * @return This function returns zero on success, or negative value with error code.
1077 * @see _mmcamcorder_destroy_pipeline()
1080 int _mmcamcorder_create_pipeline(MMHandleType handle, int type);
1083 * This function release all element of main pipeline according to type.
1085 * @param[in] handle Handle of camcorder context.
1086 * @param[in] type Allocation type of camcorder context.
1089 * @see _mmcamcorder_create_pipeline()
1092 void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type);
1095 * This function sets gstreamer element status.
1096 * If the gstreamer fails to set status or returns asynchronous mode,
1097 * this function waits for state changed until timeout expired.
1099 * @param[in] pipeline Pointer of pipeline
1100 * @param[in] target_state newly setting status
1101 * @return This function returns zero on success, or negative value with error code.
1106 int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstState target_state);
1109 * This function sets gstreamer element status, asynchronously.
1110 * Regardless of processing, it returns immediately.
1112 * @param[in] pipeline Pointer of pipeline
1113 * @param[in] target_state newly setting status
1114 * @return This function returns zero on success, or negative value with error code.
1119 int _mmcamcorder_gst_set_state_async(MMHandleType handle, GstElement *pipeline, GstState target_state);
1121 /* For xvimagesink */
1122 GstBusSyncReply __mmcamcorder_sync_callback(GstBus *bus, GstMessage *message, gulong data);
1124 /* For querying capabilities */
1125 int _mmcamcorder_read_vidsrc_info(int videodevidx, camera_conf **configure_info);
1127 /* for performance check */
1128 void _mmcamcorder_video_current_framerate_init(MMHandleType handle);
1129 int _mmcamcorder_video_current_framerate(MMHandleType handle);
1130 int _mmcamcorder_video_average_framerate(MMHandleType handle);
1133 void _mmcamcorder_delete_command_info(__MMCamcorderCmdInfo *cmdinfo);
1134 int _mmcamcorder_create_command_loop(MMHandleType handle);
1135 int _mmcamcorder_destroy_command_loop(MMHandleType handle);
1136 int _mmcamcorder_append_command(MMHandleType handle, __MMCamcorderCmdInfo *info);
1137 int _mmcamcorder_append_simple_command(MMHandleType handle, _MMCamcorderCommandType type);
1138 void *_mmcamcorder_command_loop_thread(void *arg);
1144 #endif /* __MM_CAMCORDER_INTERNAL_H__ */