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>
38 #include <mm_sound_focus.h>
40 #include <gst/video/video-format.h>
43 #include "mm_camcorder.h"
45 #include "mm_camcorder_resource.h"
47 /* camcorder sub module */
48 #include "mm_camcorder_attribute.h"
49 #include "mm_camcorder_platform.h"
50 #include "mm_camcorder_stillshot.h"
51 #include "mm_camcorder_videorec.h"
52 #include "mm_camcorder_audiorec.h"
53 #include "mm_camcorder_gstcommon.h"
54 #include "mm_camcorder_exifinfo.h"
55 #include "mm_camcorder_util.h"
56 #include "mm_camcorder_configure.h"
57 #include "mm_camcorder_sound.h"
63 /*=======================================================================================
65 ========================================================================================*/
66 #define _mmcam_dbg_verb(fmt, args...) debug_verbose (" "fmt"\n", ##args);
67 #define _mmcam_dbg_log(fmt, args...) debug_log (" "fmt"\n", ##args);
68 #define _mmcam_dbg_warn(fmt, args...) debug_warning (" "fmt"\n", ##args);
69 #define _mmcam_dbg_err(fmt, args...) debug_error (" "fmt"\n", ##args);
70 #define _mmcam_dbg_crit(fmt, args...) debug_critical (" "fmt"\n", ##args);
73 * Macro for checking validity and debugging
75 #define mmf_return_if_fail( expr ) \
79 _mmcam_dbg_err( "failed [%s]", #expr); \
84 * Macro for checking validity and debugging
86 #define mmf_return_val_if_fail( expr, val ) \
90 _mmcam_dbg_err("failed [%s]", #expr); \
96 * Macro for getting array size
98 #define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
101 /* gstreamer element creation macro */
102 #define _MMCAMCORDER_PIPELINE_MAKE(sub_context, element, eid, name /*char* */, err) \
103 if (element[eid].gst != NULL) { \
104 _mmcam_dbg_err("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \
105 gst_object_unref(element[eid].gst); \
107 element[eid].id = eid; \
108 element[eid].gst = gst_pipeline_new(name); \
109 if (element[eid].gst == NULL) { \
110 _mmcam_dbg_err("Pipeline creation fail. element_id=[%d], name=[%s]", eid, name); \
111 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
112 goto pipeline_creation_error; \
114 g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
117 #define _MMCAMCORDER_BIN_MAKE(sub_context, element, eid, name /*char* */, err) \
118 if (element[eid].gst != NULL) { \
119 _mmcam_dbg_err("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \
120 gst_object_unref(element[eid].gst); \
122 element[eid].id = eid; \
123 element[eid].gst = gst_bin_new(name); \
124 if (element[eid].gst == NULL) { \
125 _mmcam_dbg_err("Bin creation fail. element_id=[%d], name=[%s]\n", eid, name); \
126 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
127 goto pipeline_creation_error; \
129 g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
132 #define _MMCAMCORDER_ELEMENT_MAKE(sub_context, element, eid, name /*char* */, nickname /*char* */, elist, err) \
133 if (element[eid].gst != NULL) { \
134 _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
135 gst_object_unref(element[eid].gst); \
137 traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:ELEMENT_MAKE:%s", name); \
138 element[eid].gst = gst_element_factory_make(name, nickname); \
139 traceEnd(TTRACE_TAG_CAMERA); \
140 if (element[eid].gst == NULL) { \
141 _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
142 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
143 goto pipeline_creation_error; \
145 _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
146 element[eid].id = eid; \
147 g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
148 err = MM_ERROR_NONE; \
150 elist = g_list_append(elist, &(element[eid]));
152 #define _MMCAMCORDER_ELEMENT_MAKE2(sub_context, element, eid, name /*char* */, nickname /*char* */, err) \
153 if (element[eid].gst != NULL) { \
154 _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
155 gst_object_unref(element[eid].gst); \
157 element[eid].gst = gst_element_factory_make(name, nickname); \
158 if (element[eid].gst == NULL) { \
159 _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
160 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
162 _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
163 element[eid].id = eid; \
164 g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
165 err = MM_ERROR_NONE; \
168 #define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, element, eid, name /*char* */, nickname /*char* */, elist) \
169 if (element[eid].gst != NULL) { \
170 _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
171 gst_object_unref(element[eid].gst); \
173 element[eid].gst = gst_element_factory_make(name, nickname); \
174 if (element[eid].gst == NULL) { \
175 _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s], but keep going...", eid, name); \
177 _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
178 element[eid].id = eid; \
179 g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
180 elist = g_list_append(elist, &(element[eid])); \
183 #define _MMCAMCORDER_ENCODEBIN_ELMGET(sub_context, eid, name /*char* */, err) \
184 if (sub_context->encode_element[eid].gst != NULL) { \
185 _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
186 gst_object_unref(sub_context->encode_element[eid].gst); \
188 sub_context->encode_element[eid].id = eid; \
189 g_object_get(G_OBJECT(sub_context->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sub_context->encode_element[eid].gst), NULL); \
190 if (sub_context->encode_element[eid].gst == NULL) { \
191 _mmcam_dbg_err("Encode Element get fail. element_id=[%d], name=[%s]", eid, name); \
192 err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
193 goto pipeline_creation_error; \
195 gst_object_unref(sub_context->encode_element[eid].gst); \
196 g_object_weak_ref(G_OBJECT(sub_context->encode_element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
199 /* GStreamer element remove macro */
200 #define _MMCAMCORDER_ELEMENT_REMOVE(element, eid) \
201 if (element[eid].gst != NULL) { \
202 gst_object_unref(element[eid].gst); \
205 #define _MM_GST_ELEMENT_LINK_MANY gst_element_link_many
206 #define _MM_GST_ELEMENT_LINK gst_element_link
207 #define _MM_GST_ELEMENT_LINK_FILTERED gst_element_link_filtered
208 #define _MM_GST_ELEMENT_UNLINK gst_element_unlink
209 #define _MM_GST_PAD_LINK gst_pad_link
211 #define _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, if_fail_goto)\
213 GstPadLinkReturn ret = _MM_GST_PAD_LINK(srcpad, sinkpad);\
214 if (ret != GST_PAD_LINK_OK) {\
215 GstObject *src_parent = gst_pad_get_parent(srcpad);\
216 GstObject *sink_parent = gst_pad_get_parent(sinkpad);\
217 char *src_name = NULL;\
218 char *sink_name = NULL;\
219 g_object_get((GObject *)src_parent, "name", &src_name, NULL);\
220 g_object_get((GObject *)sink_parent, "name", &sink_name, NULL);\
221 _mmcam_dbg_err("src[%s] - sink[%s] link failed", src_name, sink_name);\
222 gst_object_unref(src_parent); src_parent = NULL;\
223 gst_object_unref(sink_parent); sink_parent = NULL;\
225 free(src_name); src_name = NULL;\
228 free(sink_name); sink_name = NULL;\
230 gst_object_unref(srcpad); srcpad = NULL;\
231 gst_object_unref(sinkpad); sinkpad = NULL;\
232 err = MM_ERROR_CAMCORDER_GST_LINK;\
235 gst_object_unref(srcpad); srcpad = NULL;\
236 gst_object_unref(sinkpad); sinkpad = NULL;\
239 #define _MM_GST_PAD_UNLINK_UNREF( srcpad, sinkpad) \
240 if (srcpad && sinkpad) { \
241 gst_pad_unlink(srcpad, sinkpad); \
243 _mmcam_dbg_warn("some pad(srcpad:%p,sinkpad:%p) is NULL", srcpad, sinkpad); \
246 gst_object_unref(srcpad); srcpad = NULL; \
249 gst_object_unref(sinkpad); sinkpad = NULL; \
252 #define _MMCAMCORDER_STATE_SET_COUNT 3 /* checking interval */
253 #define _MMCAMCORDER_STATE_CHECK_TOTALTIME 5000000L /* total wating time for state change */
254 #define _MMCAMCORDER_STATE_CHECK_INTERVAL (50*1000) /* checking interval - 50ms*/
257 * Default videosink type
259 #define _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE "VideosinkElementX"
262 * Default recording motion rate
264 #define _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE 1.0
267 * Total level count of manual focus */
268 #define _MMFCAMCORDER_FOCUS_TOTAL_LEVEL 8
271 * File name length limit
273 #define _MMCamcorder_FILENAME_LEN (512)
276 * Minimum integer value
278 #define _MMCAMCORDER_MIN_INT (INT_MIN)
281 * Maximum integer value
283 #define _MMCAMCORDER_MAX_INT (INT_MAX)
286 * Minimum double value
288 #define _MMCAMCORDER_MIN_DOUBLE (DBL_MIN)
291 * Maximum integer value
293 #define _MMCAMCORDER_MAX_DOUBLE (DBL_MAX)
296 * Audio timestamp margin (msec)
298 #define _MMCAMCORDER_AUDIO_TIME_MARGIN (300)
301 * Functions related with LOCK and WAIT
303 #define _MMCAMCORDER_CAST_MTSAFE(handle) (((mmf_camcorder_t*)handle)->mtsafe)
304 #define _MMCAMCORDER_LOCK_FUNC(mutex) pthread_mutex_lock(&mutex)
305 #define _MMCAMCORDER_TRYLOCK_FUNC(mutex) (!pthread_mutex_trylock(&mutex))
306 #define _MMCAMCORDER_UNLOCK_FUNC(mutex) pthread_mutex_unlock(&mutex)
308 #define _MMCAMCORDER_GET_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).lock)
309 #define _MMCAMCORDER_LOCK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_LOCK(handle))
310 #define _MMCAMCORDER_TRYLOCK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_LOCK(handle))
311 #define _MMCAMCORDER_UNLOCK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_LOCK(handle))
313 #define _MMCAMCORDER_GET_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
314 #define _MMCAMCORDER_WAIT(handle) pthread_cond_wait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle))
315 #define _MMCAMCORDER_TIMED_WAIT(handle, timeout) pthread_cond_timedwait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle), &timeout)
316 #define _MMCAMCORDER_SIGNAL(handle) pthread_cond_signal(&_MMCAMCORDER_GET_COND(handle));
317 #define _MMCAMCORDER_BROADCAST(handle) pthread_cond_broadcast(&_MMCAMCORDER_GET_COND(handle));
320 #define _MMCAMCORDER_GET_CMD_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
321 #define _MMCAMCORDER_LOCK_CMD(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
322 #define _MMCAMCORDER_TRYLOCK_CMD(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
323 #define _MMCAMCORDER_UNLOCK_CMD(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
326 #define _MMCAMCORDER_GET_ASM_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).asm_lock)
327 #define _MMCAMCORDER_LOCK_ASM(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
328 #define _MMCAMCORDER_TRYLOCK_ASM(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
329 #define _MMCAMCORDER_UNLOCK_ASM(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
331 /* for state change */
332 #define _MMCAMCORDER_GET_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
333 #define _MMCAMCORDER_LOCK_STATE(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_STATE_LOCK(handle))
334 #define _MMCAMCORDER_TRYLOCK_STATE(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_STATE_LOCK(handle))
335 #define _MMCAMCORDER_UNLOCK_STATE(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_STATE_LOCK(handle))
337 /* for gstreamer state change */
338 #define _MMCAMCORDER_GET_GST_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_state_lock)
339 #define _MMCAMCORDER_LOCK_GST_STATE(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
340 #define _MMCAMCORDER_TRYLOCK_GST_STATE(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
341 #define _MMCAMCORDER_UNLOCK_GST_STATE(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
343 #define _MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_encode_state_lock)
344 #define _MMCAMCORDER_LOCK_GST_ENCODE_STATE(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
345 #define _MMCAMCORDER_TRYLOCK_GST_ENCODE_STATE(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
346 #define _MMCAMCORDER_UNLOCK_GST_ENCODE_STATE(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
348 /* for setting/calling callback */
349 #define _MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).message_cb_lock)
350 #define _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
351 #define _MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
352 #define _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
354 #define _MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).vcapture_cb_lock)
355 #define _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
356 #define _MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
357 #define _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
359 #define _MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).vstream_cb_lock)
360 #define _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
361 #define _MMCAMCORDER_TRYLOCK_VSTREAM_CALLBACK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
362 #define _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
364 #define _MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).astream_cb_lock)
365 #define _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
366 #define _MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
367 #define _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
370 * Caster of main handle (camcorder)
372 #define MMF_CAMCORDER(h) (mmf_camcorder_t *)(h)
375 * Caster of subcontext
377 #define MMF_CAMCORDER_SUBCONTEXT(h) (((mmf_camcorder_t *)(h))->sub_context)
379 /* LOCAL CONSTANT DEFINITIONS */
381 * Total Numbers of Attribute values.
382 * If you increase any enum of attribute values, you also have to increase this.
384 #define MM_CAMCORDER_MODE_NUM 3 /**< Number of mode type */
385 #define MM_CAMCORDER_COLOR_TONE_NUM 30 /**< Number of color-tone modes */
386 #define MM_CAMCORDER_WHITE_BALANCE_NUM 10 /**< Number of WhiteBalance modes*/
387 #define MM_CAMCORDER_SCENE_MODE_NUM 16 /**< Number of program-modes */
388 #define MM_CAMCORDER_FOCUS_MODE_NUM 6 /**< Number of focus mode*/
389 #define MM_CAMCORDER_AUTO_FOCUS_NUM 5 /**< Total count of auto focus type*/
390 #define MM_CAMCORDER_FOCUS_STATE_NUM 4 /**< Number of focus state */
391 #define MM_CAMCORDER_ISO_NUM 10 /**< Number of ISO */
392 #define MM_CAMCORDER_AUTO_EXPOSURE_NUM 9 /**< Number of Auto exposure type */
393 #define MM_CAMCORDER_WDR_NUM 3 /**< Number of wide dynamic range */
394 #define MM_CAMCORDER_FLIP_NUM 4 /**< Number of Filp mode */
395 #define MM_CAMCORDER_ROTATION_NUM 4 /**< Number of Rotation mode */
396 #define MM_CAMCORDER_AHS_NUM 4 /**< Number of anti-handshake */
397 #define MM_CAMCORDER_VIDEO_STABILIZATION_NUM 2 /**< Number of video stabilization */
398 #define MM_CAMCORDER_HDR_CAPTURE_NUM 3 /**< Number of HDR capture mode */
399 #define MM_CAMCORDER_GEOMETRY_METHOD_NUM 5 /**< Number of geometry method */
400 #define MM_CAMCORDER_TAG_ORT_NUM 8 /**< Number of tag orientation */
401 #define MM_CAMCORDER_STROBE_MODE_NUM 8 /**< Number of strobe mode type */
402 #define MM_CAMCORDER_STROBE_CONTROL_NUM 3 /**< Number of strobe control type */
403 #define MM_CAMCORDER_DETECT_MODE_NUM 2 /**< Number of detect mode type */
405 /*=======================================================================================
407 ========================================================================================*/
409 * Command for Camcorder.
412 /* Command for Video/Audio recording */
413 _MMCamcorder_CMD_RECORD,
414 _MMCamcorder_CMD_PAUSE,
415 _MMCamcorder_CMD_CANCEL,
416 _MMCamcorder_CMD_COMMIT,
418 /* Command for Image capture */
419 _MMCamcorder_CMD_CAPTURE,
421 /* Command for Preview(Video/Image only effective) */
422 _MMCamcorder_CMD_PREVIEW_START,
423 _MMCamcorder_CMD_PREVIEW_STOP,
430 _MMCamcorder_SINGLE_SHOT,
431 _MMCamcorder_MULTI_SHOT,
435 * Enumerations for manual focus direction.
436 * If focusing mode is not "MM_CAMCORDER_AF_MODE_MANUAL", this value will be ignored.
438 enum MMCamcorderMfLensDir {
439 MM_CAMCORDER_MF_LENS_DIR_FORWARD = 1, /**< Focus direction to forward */
440 MM_CAMCORDER_MF_LENS_DIR_BACKWARD, /**< Focus direction to backward */
441 MM_CAMCORDER_MF_LENS_DIR_NUM, /**< Total number of the directions */
445 * Camcorder Pipeline's Element name.
446 * @note index of element.
449 _MMCAMCORDER_NONE = (-1),
451 /* Main Pipeline Element */
452 _MMCAMCORDER_MAIN_PIPE = 0x00,
454 /* Pipeline element of Video input */
455 _MMCAMCORDER_VIDEOSRC_SRC,
456 _MMCAMCORDER_VIDEOSRC_FILT,
457 _MMCAMCORDER_VIDEOSRC_CLS_QUE,
458 _MMCAMCORDER_VIDEOSRC_CLS,
459 _MMCAMCORDER_VIDEOSRC_CLS_FILT,
460 _MMCAMCORDER_VIDEOSRC_QUE,
461 _MMCAMCORDER_VIDEOSRC_DECODE,
463 /* Pipeline element of Video output */
464 _MMCAMCORDER_VIDEOSINK_QUE,
465 _MMCAMCORDER_VIDEOSINK_SINK,
467 _MMCAMCORDER_PIPELINE_ELEMENT_NUM,
468 } _MMCAMCORDER_PREVIEW_PIPELINE_ELELMENT;
471 * Camcorder Pipeline's Element name.
472 * @note index of element.
475 _MMCAMCORDER_ENCODE_NONE = (-1),
477 /* Main Pipeline Element */
478 _MMCAMCORDER_ENCODE_MAIN_PIPE = 0x00,
480 /* Pipeline element of Audio input */
481 _MMCAMCORDER_AUDIOSRC_BIN,
482 _MMCAMCORDER_AUDIOSRC_SRC,
483 _MMCAMCORDER_AUDIOSRC_FILT,
484 _MMCAMCORDER_AUDIOSRC_QUE,
485 _MMCAMCORDER_AUDIOSRC_CONV,
486 _MMCAMCORDER_AUDIOSRC_VOL,
488 /* Pipeline element of Encodebin */
489 _MMCAMCORDER_ENCSINK_BIN,
490 _MMCAMCORDER_ENCSINK_SRC,
491 _MMCAMCORDER_ENCSINK_FILT,
492 _MMCAMCORDER_ENCSINK_ENCBIN,
493 _MMCAMCORDER_ENCSINK_AQUE,
494 _MMCAMCORDER_ENCSINK_CONV,
495 _MMCAMCORDER_ENCSINK_AENC,
496 _MMCAMCORDER_ENCSINK_AENC_QUE,
497 _MMCAMCORDER_ENCSINK_VQUE,
498 _MMCAMCORDER_ENCSINK_VCONV,
499 _MMCAMCORDER_ENCSINK_VENC,
500 _MMCAMCORDER_ENCSINK_VENC_QUE,
501 _MMCAMCORDER_ENCSINK_ITOG,
502 _MMCAMCORDER_ENCSINK_ICROP,
503 _MMCAMCORDER_ENCSINK_ISCALE,
504 _MMCAMCORDER_ENCSINK_IFILT,
505 _MMCAMCORDER_ENCSINK_IQUE,
506 _MMCAMCORDER_ENCSINK_IENC,
507 _MMCAMCORDER_ENCSINK_MUX,
508 _MMCAMCORDER_ENCSINK_SINK,
510 _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM,
511 } _MMCAMCORDER_ENCODE_PIPELINE_ELELMENT;
514 _MMCAMCORDER_TASK_THREAD_STATE_NONE,
515 _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START,
516 _MMCAMCORDER_TASK_THREAD_STATE_SOUND_SOLO_PLAY_START,
517 _MMCAMCORDER_TASK_THREAD_STATE_ENCODE_PIPE_CREATE,
518 _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING,
519 _MMCAMCORDER_TASK_THREAD_STATE_EXIT,
520 } _MMCamcorderTaskThreadState;
523 * System state change cause
526 _MMCAMCORDER_STATE_CHANGE_NORMAL = 0,
527 _MMCAMCORDER_STATE_CHANGE_BY_ASM,
528 _MMCAMCORDER_STATE_CHANGE_BY_RM,
529 } _MMCamcorderStateChange;
532 /*=======================================================================================
533 | STRUCTURE DEFINITIONS |
534 ========================================================================================*/
536 * MMCamcorder Gstreamer Element
539 unsigned int id; /**< Gstreamer piplinem element name */
540 GstElement *gst; /**< Gstreamer element */
541 } _MMCamcorderGstElement;
544 * MMCamcorder information for KPI measurement
547 int current_fps; /**< current fps of this second */
548 int average_fps; /**< average fps */
549 unsigned int video_framecount; /**< total number of video frame */
550 unsigned int last_framecount; /**< total number of video frame in last measurement */
551 struct timeval init_video_time; /**< time when start to measure */
552 struct timeval last_video_time; /**< last measurement time */
553 } _MMCamcorderKPIMeasure;
556 * MMCamcorder information for Multi-Thread Safe
559 pthread_mutex_t lock; /**< Mutex (for general use) */
560 pthread_cond_t cond; /**< Condition (for general use) */
561 pthread_mutex_t cmd_lock; /**< Mutex (for command) */
562 pthread_mutex_t asm_lock; /**< Mutex (for ASM) */
563 pthread_mutex_t state_lock; /**< Mutex (for state change) */
564 pthread_mutex_t gst_state_lock; /**< Mutex (for gst pipeline state change) */
565 pthread_mutex_t gst_encode_state_lock; /**< Mutex (for gst encode pipeline state change) */
566 pthread_mutex_t message_cb_lock; /**< Mutex (for message callback) */
567 pthread_mutex_t vcapture_cb_lock; /**< Mutex (for video capture callback) */
568 pthread_mutex_t vstream_cb_lock; /**< Mutex (for video stream callback) */
569 pthread_mutex_t astream_cb_lock; /**< Mutex (for audio stream callback) */
570 } _MMCamcorderMTSafe;
573 * MMCamcorder Sub Context
576 bool isMaxsizePausing; /**< Because of size limit, pipeline is paused. */
577 bool isMaxtimePausing; /**< Because of time limit, pipeline is paused. */
578 int element_num; /**< count of element */
579 int encode_element_num; /**< count of encode element */
580 int cam_stability_count; /**< camsensor stability count. the count of frame will drop */
581 GstClockTime pipeline_time; /**< current time of Gstreamer Pipeline */
582 GstClockTime pause_time; /**< amount of time while pipeline is in PAUSE state.*/
583 GstClockTime stillshot_time; /**< pipeline time of capturing moment*/
584 gboolean is_modified_rate; /**< whether recording motion rate is modified or not */
585 gboolean ferror_send; /**< file write/seek error **/
586 guint ferror_count; /**< file write/seek error count **/
587 GstClockTime previous_slot_time;
588 int display_interval; /**< This value is set as 'GST_SECOND / display FPS' */
589 gboolean bget_eos; /**< Whether getting EOS */
590 gboolean bencbin_capture; /**< Use Encodebin for capturing */
591 gboolean audio_disable; /**< whether audio is disabled or not when record */
592 int videosrc_rotate; /**< rotate of videosrc */
594 /* For dropping video frame when start recording */
595 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. */
596 int pass_first_vframe; /**< When this value is bigger than zero, MSL won't drop video frame though "drop_vframe" is bigger then zero. */
598 /* INI information */
599 unsigned int fourcc; /**< Get fourcc value of camera INI file */
600 _MMCamcorderImageInfo *info_image; /**< extra information for image capture */
601 _MMCamcorderVideoInfo *info_video; /**< extra information for video recording */
602 _MMCamcorderAudioInfo *info_audio; /**< extra information for audio recording */
604 _MMCamcorderGstElement *element; /**< array of preview element */
605 _MMCamcorderGstElement *encode_element; /**< array of encode element */
606 _MMCamcorderKPIMeasure kpi; /**< information related with performance measurement */
608 type_element *VideosinkElement; /**< configure data of videosink element */
609 type_element *VideoconvertElement; /**< configure data of videoconvert element */
610 gboolean SensorEncodedCapture; /**< whether camera sensor support encoded image capture */
611 gboolean internal_encode; /**< whether use internal encoding function */
612 } _MMCamcorderSubContext;
615 * _MMCamcorderContext
617 typedef struct mmf_camcorder {
619 int type; /**< mmcamcorder_mode_type */
620 int device_type; /**< device type */
621 int state; /**< state of camcorder */
622 int target_state; /**< Target state that want to set. This is a flag that
623 * stands for async state changing. If this value differ from state,
624 * it means state is changing now asychronously. */
627 MMHandleType attributes; /**< Attribute handle */
628 _MMCamcorderSubContext *sub_context; /**< sub context */
629 mm_exif_info_t *exif_info; /**< EXIF */
630 GList *buffer_probes; /**< a list of buffer probe handle */
631 GList *event_probes; /**< a list of event probe handle */
632 GList *signals; /**< a list of signal handle */
633 #ifdef _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK
634 GList *msg_data; /**< a list of msg data */
635 #endif /* _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK */
636 camera_conf *conf_main; /**< Camera configure Main structure */
637 camera_conf *conf_ctrl; /**< Camera configure Control structure */
638 guint pipeline_cb_event_id; /**< Event source ID of pipeline message callback */
639 guint encode_pipeline_cb_event_id; /**< Event source ID of encode pipeline message callback */
640 guint setting_event_id; /**< Event source ID of attributes setting to sensor */
641 SOUND_INFO snd_info; /**< Sound handle for multishot capture */
643 /* callback handlers */
644 MMMessageCallback msg_cb; /**< message callback */
645 void *msg_cb_param; /**< message callback parameter */
646 mm_camcorder_video_stream_callback vstream_cb; /**< Video stream callback */
647 void *vstream_cb_param; /**< Video stream callback parameter */
648 mm_camcorder_audio_stream_callback astream_cb; /**< Audio stream callback */
649 void *astream_cb_param; /**< Audio stream callback parameter */
650 mm_camcorder_video_capture_callback vcapture_cb; /**< Video capture callback */
651 void *vcapture_cb_param; /**< Video capture callback parameter */
652 int (*command)(MMHandleType, int); /**< camcorder's command */
655 mm_cam_attr_construct_info *cam_attrs_const_info; /**< attribute info */
656 conf_info_table* conf_main_info_table[CONFIGURE_CATEGORY_MAIN_NUM]; /** configure info table - MAIN category */
657 conf_info_table* conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_NUM]; /** configure info table - CONTROL category */
658 int conf_main_category_size[CONFIGURE_CATEGORY_MAIN_NUM]; /** configure info table size - MAIN category */
659 int conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_NUM]; /** configure info table size - CONTROL category */
660 _MMCamcorderMTSafe mtsafe; /**< Thread safe */
661 int state_change_by_system; /**< MSL changes its state by itself because of system */
662 pthread_mutex_t sound_lock; /**< Capture sound mutex */
663 pthread_cond_t sound_cond; /**< Capture sound cond */
664 pthread_mutex_t restart_preview_lock; /**< Capture sound mutex */
665 int use_zero_copy_format; /**< Whether use zero copy format for camera input */
666 int support_media_packet_preview_cb; /**< Whether support zero copy format for camera input */
667 int shutter_sound_policy; /**< shutter sound policy */
668 int brightness_default; /**< default value of brightness */
669 int brightness_step_denominator; /**< denominator of brightness bias step */
670 int support_zsl_capture; /**< support Zero Shutter Lag capture */
671 char *model_name; /**< model name from system info */
672 char *software_version; /**< software_version from system info */
673 int capture_sound_count; /**< count for capture sound */
674 char *root_directory; /**< Root directory for device */
675 int resolution_changed; /**< Flag for preview resolution change */
676 int sound_focus_register; /**< Use sound focus internally */
677 int sound_focus_id; /**< id for sound focus */
678 int sound_focus_watch_id; /**< id for sound focus watch */
679 int interrupt_code; /**< Interrupt code */
680 int acquired_focus; /**< Current acquired focus */
681 int session_type; /**< Session type */
682 int session_flags; /**< Session flags */
684 _MMCamcorderInfoConverting caminfo_convert[CAMINFO_CONVERT_NUM]; /**< converting structure of camera info */
685 _MMCamcorderEnumConvert enum_conv[ENUM_CONVERT_NUM]; /**< enum converting list that is modified by ini info */
687 gboolean capture_in_recording; /**< Flag for capture while recording */
689 gboolean error_occurs; /**< flag for error */
690 int error_code; /**< error code for internal gstreamer error */
693 pthread_t task_thread; /**< thread for task */
694 pthread_mutex_t task_thread_lock; /**< mutex for task thread */
695 pthread_cond_t task_thread_cond; /**< cond for task thread */
696 _MMCamcorderTaskThreadState task_thread_state; /**< state of task thread */
698 /* resource manager for H/W resources */
699 MMCamcorderResourceManager resource_manager;
701 int reserved[4]; /**< reserved */
704 /*=======================================================================================
705 | EXTERN GLOBAL VARIABLE |
706 ========================================================================================*/
708 /*=======================================================================================
709 | GLOBAL FUNCTION PROTOTYPES |
710 ========================================================================================*/
712 * This function creates camcorder for capturing still image and recording.
714 * @param[out] handle Specifies the camcorder handle
715 * @param[in] info Preset information of camcorder
716 * @return This function returns zero on success, or negative value with error code.
717 * @remarks When this function calls successfully, camcorder handle will be filled with a @n
718 * valid value and the state of the camcorder will become MM_CAMCORDER_STATE_NULL.@n
719 * Note that it's not ready to working camcorder. @n
720 * You should call mmcamcorder_realize before starting camcorder.
721 * @see _mmcamcorder_create
723 int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info);
726 * This function destroys instance of camcorder.
728 * @param[in] hcamcorder Specifies the camcorder handle
729 * @return This function returns zero on success, or negative value with error code.
730 * @see _mmcamcorder_create
732 int _mmcamcorder_destroy(MMHandleType hcamcorder);
735 * This function allocates memory for camcorder.
737 * @param[in] hcamcorder Specifies the camcorder handle
738 * @return This function returns zero on success, or negative value with error code.
739 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_NULL @n
740 * and the state of the camcorder will become MM_CAMCORDER_STATE_READY. @n
741 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
742 * @see _mmcamcorder_unrealize
743 * @pre MM_CAMCORDER_STATE_NULL
744 * @post MM_CAMCORDER_STATE_READY
746 int _mmcamcorder_realize(MMHandleType hcamcorder);
749 * This function free allocated memory for camcorder.
751 * @param[in] hcamcorder Specifies the camcorder handle
752 * @return This function returns zero on success, or negative value with error code.
753 * @remarks This function release all resources which are allocated for the camcorder engine.@n
754 * This function can be called successfully when current state is MM_CAMCORDER_STATE_READY and @n
755 * the state of the camcorder will become MM_CAMCORDER_STATE_NULL. @n
756 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
757 * @see _mmcamcorder_realize
758 * @pre MM_CAMCORDER_STATE_READY
759 * @post MM_CAMCORDER_STATE_NULL
761 int _mmcamcorder_unrealize(MMHandleType hcamcorder);
764 * This function is to start previewing.
766 * @param[in] hcamcorder Specifies the camcorder handle
767 * @return This function returns zero on success, or negative value with error code.
768 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_READY and @n
769 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
770 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
771 * @see _mmcamcorder_stop
773 int _mmcamcorder_start(MMHandleType hcamcorder);
776 * This function is to stop previewing.
778 * @param[in] hcamcorder Specifies the camcorder handle
779 * @return This function returns zero on success, or negative value with error code.
780 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_PREPARE and @n
781 * the state of the camcorder will become MM_CAMCORDER_STATE_READY.@n
782 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
783 * @see _mmcamcorder_start
785 int _mmcamcorder_stop(MMHandleType hcamcorder);
788 * This function to start capturing of still images.
790 * @param[in] hcamcorder Specifies the camcorder handle.
791 * @return This function returns zero on success, or negative value with error code.
792 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_PREPARE and @n
793 * the state of the camcorder will become MM_CAMCORDER_STATE_CAPTURING. @n
794 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
795 * @see _mmcamcorder_capture_stop
797 int _mmcamcorder_capture_start(MMHandleType hcamcorder);
800 * This function is to stop capturing still images.
802 * @param[in] hcamcorder Specifies the camcorder handle
803 * @return This function returns zero on success, or negative value with error code.
804 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_CAPTURING and @n
805 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
806 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
807 * @see _mmcamcorder_capture_start
809 int _mmcamcorder_capture_stop(MMHandleType hcamcorder);
812 * This function is to start video and audio recording.
814 * @param[in] hcamcorder Specifies the camcorder handle
815 * @return This function returns zero on success, or negative value with error code.
816 * @remarks This function can be called successfully when current state is @n
817 * MM_CAMCORDER_STATE_PREPARE or MM_CAMCORDER_STATE_PAUSED and @n
818 * the state of the camcorder will become MM_CAMCORDER_STATE_RECORDING.@n
819 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
820 * @see _mmcamcorder_pause
822 int _mmcamcorder_record(MMHandleType hcamcorder);
825 * This function is to pause video and audio recording
827 * @param[in] hcamcorder Specifies the camcorder handle
828 * @return This function returns zero on success, or negative value with error code.
829 * @remarks This function can be called successfully when current state is MM_CAMCORDER_STATE_RECORDING and @n
830 * the state of the camcorder will become MM_CAMCORDER_STATE_PAUSED.@n
831 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.@n
832 * @see _mmcamcorder_record
834 int _mmcamcorder_pause(MMHandleType hcamcorder);
837 * This function is to stop video and audio recording and save results.
839 * @param[in] hcamcorder Specifies the camcorder handle
840 * @return This function returns zero on success, or negative value with error code.
841 * @remarks This function can be called successfully when current state is @n
842 * MM_CAMCORDER_STATE_PAUSED or MM_CAMCORDER_STATE_RECORDING and @n
843 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
844 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION
845 * @see _mmcamcorder_cancel
847 int _mmcamcorder_commit(MMHandleType hcamcorder);
850 * This function is to stop video and audio recording and do not save results.
852 * @param[in] hcamcorder Specifies the camcorder handle
853 * @return This function returns zero on success, or negative value with error code.
854 * @remarks This function can be called successfully when current state is @n
855 * MM_CAMCORDER_STATE_PAUSED or MM_CAMCORDER_STATE_RECORDING and @n
856 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
857 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
858 * @see _mmcamcorder_commit
860 int _mmcamcorder_cancel(MMHandleType hcamcorder);
863 * This function calls after commiting action finished asynchronously.
864 * In this function, remaining process , such as state change, happens.
866 * @param[in] hcamcorder Specifies the camcorder handle
867 * @return This function returns zero on success, or negative value with error code.
868 * @remarks This function can be called successfully when current state is @n
869 * MM_CAMCORDER_STATE_PAUSED or MM_CAMCORDER_STATE_RECORDING and @n
870 * the state of the camcorder will become MM_CAMCORDER_STATE_PREPARE. @n
871 * Otherwise, this function will return MM_ERROR_CAMCORDER_INVALID_CONDITION.
872 * @see _mmcamcorder_commit
874 int _mmcamcorder_commit_async_end(MMHandleType hcamcorder);
877 * This function is to set callback for receiving messages from camcorder.
879 * @param[in] hcamcorder Specifies the camcorder handle
880 * @param[in] callback Specifies the function pointer of callback function
881 * @param[in] user_data Specifies the user poiner for passing to callback function
883 * @return This function returns zero on success, or negative value with error code.
884 * @remarks typedef bool (*mm_message_callback) (int msg, mm_messageType *param, void *user_param);@n
899 * } mm_message_type; @n
901 * If a message value for mm_message_callback is MM_MESSAGE_STATE_CHANGED, @n
902 * state value in mm_message_type will be a mmcamcorder_state_type enum value;@n
904 * If a message value for mm_message_callback is MM_MESSAGE_ERROR, @n
905 * the code value in mm_message_type will be a mmplayer_error_type enum value;
907 * @see mm_message_type, mmcamcorder_state_type, mmcamcorder_error_type
909 int _mmcamcorder_set_message_callback(MMHandleType hcamcorder,
910 MMMessageCallback callback,
914 * This function is to set callback for video stream.
916 * @param[in] hcamcorder Specifies the camcorder handle
917 * @param[in] callback Specifies the function pointer of callback function
918 * @param[in] user_data Specifies the user poiner for passing to callback function
920 * @return This function returns zero on success, or negative value with error code.
921 * @see mmcamcorder_error_type
923 int _mmcamcorder_set_video_stream_callback(MMHandleType hcamcorder,
924 mm_camcorder_video_stream_callback callback,
928 * This function is to set callback for audio stream.
930 * @param[in] hcamcorder Specifies the camcorder handle
931 * @param[in] callback Specifies the function pointer of callback function
932 * @param[in] user_data Specifies the user poiner for passing to callback function
934 * @return This function returns zero on success, or negative value with error code.
935 * @see mmcamcorder_error_type
937 int _mmcamcorder_set_audio_stream_callback(MMHandleType handle,
938 mm_camcorder_audio_stream_callback callback,
942 * This function is to set callback for video capture.
944 * @param[in] hcamcorder Specifies the camcorder handle
945 * @param[in] callback Specifies the function pointer of callback function
946 * @param[in] user_data Specifies the user poiner for passing to callback function
948 * @return This function returns zero on success, or negative value with error code.
949 * @see mmcamcorder_error_type
951 int _mmcamcorder_set_video_capture_callback(MMHandleType hcamcorder,
952 mm_camcorder_video_capture_callback callback,
956 * This function returns current state of camcorder, or negative value with error code.
958 * @param[in] hcamcorder Specifies the camcorder handle.
959 * @return This function returns current state of camcorder, or negative value with error code.
960 * @see mmcamcorder_state_type
962 int _mmcamcorder_get_current_state(MMHandleType hcamcorder);
964 int _mmcamcorder_init_focusing(MMHandleType handle);
965 int _mmcamcorder_adjust_focus(MMHandleType handle, int direction);
966 int _mmcamcorder_adjust_manual_focus(MMHandleType handle, int direction);
967 int _mmcamcorder_adjust_auto_focus(MMHandleType handle);
968 int _mmcamcorder_stop_focusing(MMHandleType handle);
971 * This function gets current state of camcorder.
974 * @return This function returns state of current camcorder context
976 * @see _mmcamcorder_set_state()
979 int _mmcamcorder_streamer_init(void);
982 * This function gets current state of camcorder.
985 * @return This function returns state of current camcorder context
987 * @see _mmcamcorder_set_state()
990 int _mmcamcorder_display_init(void);
993 * This function gets current state of camcorder.
995 * @param[in] handle Handle of camcorder context.
996 * @return This function returns state of current camcorder context
998 * @see _mmcamcorder_set_state()
1001 int _mmcamcorder_get_state(MMHandleType handle);
1004 * This function sets new state of camcorder.
1006 * @param[in] handle Handle of camcorder context.
1007 * @param[in] state setting state value of camcorder.
1010 * @see _mmcamcorder_get_state()
1013 void _mmcamcorder_set_state(MMHandleType handle, int state);
1016 * This function gets asynchronous status of MSL Camcroder.
1018 * @param[in] handle Handle of camcorder context.
1019 * @param[in] target_state setting target_state value of camcorder.
1020 * @return This function returns asynchrnous state.
1022 * @see _mmcamcorder_set_async_state()
1025 int _mmcamcorder_get_async_state(MMHandleType handle);
1028 * This function allocates structure of subsidiary attributes.
1030 * @param[in] type Allocation type of camcorder context.
1031 * @return This function returns structure pointer on success, NULL value on failure.
1033 * @see _mmcamcorder_dealloc_subcontext()
1036 _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type);
1039 * This function releases structure of subsidiary attributes.
1041 * @param[in] sc Handle of camcorder subcontext.
1044 * @see _mmcamcorder_alloc_subcontext()
1047 void _mmcamcorder_dealloc_subcontext(_MMCamcorderSubContext *sc);
1050 * This function sets command function according to the type.
1052 * @param[in] handle Handle of camcorder context.
1053 * @param[in] type Allocation type of camcorder context.
1054 * @return This function returns MM_ERROR_NONE on success, or other values with error code.
1056 * @see __mmcamcorder_video_command(), __mmcamcorder_audio_command(), __mmcamcorder_image_command()
1059 int _mmcamcorder_set_functions(MMHandleType handle, int type);
1062 * This function is callback function of main pipeline.
1063 * Once this function is registered with certain pipeline using gst_bus_add_watch(),
1064 * this callback will be called every time when there is upcomming message from pipeline.
1065 * Basically, this function is used as error handling function, now.
1067 * @param[in] bus pointer of buf that called this function.
1068 * @param[in] message callback message from pipeline.
1069 * @param[in] data user data.
1070 * @return This function returns true on success, or false value with error
1072 * @see __mmcamcorder_create_preview_pipeline()
1075 gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpointer data);
1078 * This function is callback function of main pipeline.
1079 * Once this function is registered with certain pipeline using gst_bus_set_sync_handler(),
1080 * this callback will be called every time when there is upcomming message from pipeline.
1081 * Basically, this function is used as sync error handling function, now.
1083 * @param[in] bus pointer of buf that called this function.
1084 * @param[in] message callback message from pipeline.
1085 * @param[in] data user data.
1086 * @return This function returns true on success, or false value with error
1088 * @see __mmcamcorder_create_preview_pipeline()
1091 GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data);
1094 * This function is callback function of main pipeline.
1095 * Once this function is registered with certain pipeline using gst_bus_set_sync_handler(),
1096 * this callback will be called every time when there is upcomming message from pipeline.
1097 * Basically, this function is used as sync error handling function, now.
1099 * @param[in] bus pointer of buf that called this function.
1100 * @param[in] message callback message from pipeline.
1101 * @param[in] data user data.
1102 * @return This function returns true on success, or false value with error
1104 * @see __mmcamcorder_create_audiop_with_encodebin()
1107 GstBusSyncReply _mmcamcorder_audio_pipeline_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data);
1111 * This function create main pipeline according to type.
1113 * @param[in] handle Handle of camcorder context.
1114 * @param[in] type Allocation type of camcorder context.
1115 * @return This function returns zero on success, or negative value with error code.
1117 * @see _mmcamcorder_destroy_pipeline()
1120 int _mmcamcorder_create_pipeline(MMHandleType handle, int type);
1123 * This function release all element of main pipeline according to type.
1125 * @param[in] handle Handle of camcorder context.
1126 * @param[in] type Allocation type of camcorder context.
1129 * @see _mmcamcorder_create_pipeline()
1132 void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type);
1135 * This function sets gstreamer element status.
1136 * If the gstreamer fails to set status or returns asynchronous mode,
1137 * this function waits for state changed until timeout expired.
1139 * @param[in] pipeline Pointer of pipeline
1140 * @param[in] target_state newly setting status
1141 * @return This function returns zero on success, or negative value with error code.
1146 int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstState target_state);
1149 * This function sets gstreamer element status, asynchronously.
1150 * Regardless of processing, it returns immediately.
1152 * @param[in] pipeline Pointer of pipeline
1153 * @param[in] target_state newly setting status
1154 * @return This function returns zero on success, or negative value with error code.
1159 int _mmcamcorder_gst_set_state_async(MMHandleType handle, GstElement *pipeline, GstState target_state);
1161 /* For xvimagesink */
1162 GstBusSyncReply __mmcamcorder_sync_callback(GstBus *bus, GstMessage *message, gulong data);
1164 /* For querying capabilities */
1165 int _mmcamcorder_read_vidsrc_info(int videodevidx, camera_conf **configure_info);
1167 /* for performance check */
1168 void _mmcamcorder_video_current_framerate_init(MMHandleType handle);
1169 int _mmcamcorder_video_current_framerate(MMHandleType handle);
1170 int _mmcamcorder_video_average_framerate(MMHandleType handle);
1172 /* sound focus related function */
1173 void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder);
1174 void _mmcamcorder_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
1175 mm_sound_focus_state_e focus_state, const char *reason_for_change,
1176 const char *additional_info, void *user_data);
1177 void _mmcamcorder_sound_focus_watch_cb(mm_sound_focus_type_e focus_type, mm_sound_focus_state_e focus_state,
1178 const char *reason_for_change, const char *additional_info, void *user_data);
1180 /* For hand over the server's caps informations to client */
1181 int _mmcamcorder_get_video_caps(MMHandleType handle, char **caps);
1187 #endif /* __MM_CAMCORDER_INTERNAL_H__ */