#include <malloc.h>
#include <string.h>
#include <unistd.h>
-#include <pthread.h>
#include <semaphore.h>
#include <mm_types.h>
#include <mm_attrs.h>
#include <mm_attrs_private.h>
#include <mm_message.h>
-#include <mm_ta.h>
-#include <sndfile.h>
+#include <mm_sound_focus.h>
#include <vconf.h>
+#include <gst/video/video-format.h>
+#include <ttrace.h>
+#include <errno.h>
+#include <restriction.h> /* device policy manager */
#include "mm_camcorder.h"
#include "mm_debug.h"
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+#include "mm_camcorder_resource.h"
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+
/* camcorder sub module */
#include "mm_camcorder_attribute.h"
#include "mm_camcorder_platform.h"
#include "mm_camcorder_configure.h"
#include "mm_camcorder_sound.h"
+#ifdef _MMCAMCORDER_RM_SUPPORT
+/* rm (resource manager)*/
+#include <rm_api.h>
+#endif /* _MMCAMCORDER_RM_SUPPORT */
+
#ifdef __cplusplus
extern "C" {
#endif
/*=======================================================================================
| MACRO DEFINITIONS |
========================================================================================*/
-#define _mmcam_dbg_verb(fmt, args...) mmf_debug(MMF_DEBUG_VERBOSE,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_log(fmt, args...) mmf_debug(MMF_DEBUG_LOG,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_warn(fmt, args...) mmf_debug(MMF_DEBUG_WARNING,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_err(fmt, args...) mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_crit(fmt, args...) mmf_debug(MMF_DEBUG_CRITICAL,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
+#define _mmcam_dbg_verb(fmt, args...) debug_verbose (" "fmt"\n", ##args);
+#define _mmcam_dbg_log(fmt, args...) debug_log (" "fmt"\n", ##args);
+#define _mmcam_dbg_warn(fmt, args...) debug_warning (" "fmt"\n", ##args);
+#define _mmcam_dbg_err(fmt, args...) debug_error (" "fmt"\n", ##args);
+#define _mmcam_dbg_crit(fmt, args...) debug_critical (" "fmt"\n", ##args);
/**
* Macro for checking validity and debugging
#endif
/* gstreamer element creation macro */
-#define _MMCAMCORDER_PIPELINE_MAKE(sub_context, eid, name /*char* */, err) \
- if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_PIPELINE_MAKE(sub_context, element, eid, name /*char* */, err) \
+ if (element[eid].gst != NULL) { \
_mmcam_dbg_err("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(element[eid].gst); \
} \
- sub_context->element[eid].id = eid; \
- sub_context->element[eid].gst = gst_pipeline_new(name); \
- if (sub_context->element[eid].gst == NULL) { \
+ element[eid].id = eid; \
+ element[eid].gst = gst_pipeline_new(name); \
+ if (element[eid].gst == NULL) { \
_mmcam_dbg_err("Pipeline creation fail. element_id=[%d], name=[%s]", eid, name); \
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
goto pipeline_creation_error; \
} else { \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
}
-#define _MMCAMCORDER_BIN_MAKE(sub_context, eid, name /*char* */, err) \
- if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_BIN_MAKE(sub_context, element, eid, name /*char* */, err) \
+ if (element[eid].gst != NULL) { \
_mmcam_dbg_err("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(element[eid].gst); \
} \
- sub_context->element[eid].id = eid; \
- sub_context->element[eid].gst = gst_bin_new(name); \
- if (sub_context->element[eid].gst == NULL) { \
+ element[eid].id = eid; \
+ element[eid].gst = gst_bin_new(name); \
+ if (element[eid].gst == NULL) { \
_mmcam_dbg_err("Bin creation fail. element_id=[%d], name=[%s]\n", eid, name); \
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
goto pipeline_creation_error; \
} else { \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
}
-#define _MMCAMCORDER_ELEMENT_MAKE(sub_context, eid, name /*char* */, nickname /*char* */, elist, err) \
- if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_ELEMENT_MAKE(sub_context, element, eid, name /*char* */, nickname /*char* */, elist, err) \
+ if (element[eid].gst != NULL) { \
_mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(element[eid].gst); \
} \
- sub_context->element[eid].gst = gst_element_factory_make(name, nickname); \
- if (sub_context->element[eid].gst == NULL) { \
+ traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:ELEMENT_MAKE:%s", name); \
+ element[eid].gst = gst_element_factory_make(name, nickname); \
+ traceEnd(TTRACE_TAG_CAMERA); \
+ if (element[eid].gst == NULL) { \
_mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
goto pipeline_creation_error; \
} else { \
_mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
- sub_context->element[eid].id = eid; \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ element[eid].id = eid; \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ err = MM_ERROR_NONE; \
+ } \
+ elist = g_list_append(elist, &(element[eid]));
+
+#define _MMCAMCORDER_ELEMENT_MAKE2(sub_context, element, eid, name /*char* */, nickname /*char* */, err) \
+ if (element[eid].gst != NULL) { \
+ _mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
+ gst_object_unref(element[eid].gst); \
+ } \
+ element[eid].gst = gst_element_factory_make(name, nickname); \
+ if (element[eid].gst == NULL) { \
+ _mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
+ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
+ } else { \
+ _mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
+ element[eid].id = eid; \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
err = MM_ERROR_NONE; \
} \
- elist = g_list_append(elist, &(sub_context->element[eid]));
-#define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, eid, name /*char* */, nickname /*char* */, elist) \
- if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, element, eid, name /*char* */, nickname /*char* */, elist) \
+ if (element[eid].gst != NULL) { \
_mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(element[eid].gst); \
} \
- sub_context->element[eid].gst = gst_element_factory_make(name, nickname); \
- if (sub_context->element[eid].gst == NULL) { \
+ element[eid].gst = gst_element_factory_make(name, nickname); \
+ if (element[eid].gst == NULL) { \
_mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s], but keep going...", eid, name); \
} else { \
_mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
- sub_context->element[eid].id = eid; \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
- elist = g_list_append(elist, &(sub_context->element[eid])); \
+ element[eid].id = eid; \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ elist = g_list_append(elist, &(element[eid])); \
}
#define _MMCAMCORDER_ENCODEBIN_ELMGET(sub_context, eid, name /*char* */, err) \
- if (sub_context->element[eid].gst != NULL) { \
+ if (sub_context->encode_element[eid].gst != NULL) { \
_mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(sub_context->encode_element[eid].gst); \
} \
- sub_context->element[eid].id = eid; \
- g_object_get(G_OBJECT(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sc->element[eid].gst), NULL); \
- if (sub_context->element[eid].gst == NULL) { \
- _mmcam_dbg_err("Element get fail. element_id=[%d], name=[%s]", eid, name); \
+ sub_context->encode_element[eid].id = eid; \
+ g_object_get(G_OBJECT(sub_context->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sub_context->encode_element[eid].gst), NULL); \
+ if (sub_context->encode_element[eid].gst == NULL) { \
+ _mmcam_dbg_err("Encode Element get fail. element_id=[%d], name=[%s]", eid, name); \
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
goto pipeline_creation_error; \
} else{ \
- gst_object_unref(sub_context->element[eid].gst); \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ gst_object_unref(sub_context->encode_element[eid].gst); \
+ g_object_weak_ref(G_OBJECT(sub_context->encode_element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
}
/* GStreamer element remove macro */
-#define _MMCAMCORDER_ELEMENT_REMOVE(sub_context, eid) \
- if (sub_context->element[eid].gst != NULL) { \
- gst_object_unref(sub_context->element[eid].gst); \
+#define _MMCAMCORDER_ELEMENT_REMOVE(element, eid) \
+ if (element[eid].gst != NULL) { \
+ gst_object_unref(element[eid].gst); \
}
#define _MM_GST_ELEMENT_LINK_MANY gst_element_link_many
#define _MM_GST_ELEMENT_LINK gst_element_link
+#define _MM_GST_ELEMENT_LINK_FILTERED gst_element_link_filtered
+#define _MM_GST_ELEMENT_UNLINK gst_element_unlink
#define _MM_GST_PAD_LINK gst_pad_link
-#define _MM_GST_PAD_LINK_UNREF( srcpad, sinkpad, err, if_fail_goto ) \
-{ \
- GstPadLinkReturn ret = _MM_GST_PAD_LINK( srcpad, sinkpad ); \
- gst_object_unref( srcpad ); srcpad = NULL; \
- gst_object_unref( sinkpad ); sinkpad = NULL; \
- if (ret != GST_PAD_LINK_OK) { \
- err = MM_ERROR_CAMCORDER_GST_LINK; \
- goto if_fail_goto; \
- } \
+#define _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, if_fail_goto)\
+{\
+ GstPadLinkReturn ret = GST_PAD_LINK_OK;\
+ if (srcpad == NULL || sinkpad == NULL) {\
+ if (srcpad == NULL) {\
+ _mmcam_dbg_err("srcpad is NULL");\
+ } else {\
+ gst_object_unref(srcpad);\
+ srcpad = NULL;\
+ }\
+ if (sinkpad == NULL) {\
+ _mmcam_dbg_err("sinkpad is NULL");\
+ } else {\
+ gst_object_unref(sinkpad);\
+ sinkpad = NULL;\
+ }\
+ err = MM_ERROR_CAMCORDER_GST_LINK;\
+ goto if_fail_goto;\
+ }\
+ ret = _MM_GST_PAD_LINK(srcpad, sinkpad);\
+ if (ret != GST_PAD_LINK_OK) {\
+ GstObject *src_parent = gst_pad_get_parent(srcpad);\
+ GstObject *sink_parent = gst_pad_get_parent(sinkpad);\
+ char *src_name = NULL;\
+ char *sink_name = NULL;\
+ g_object_get((GObject *)src_parent, "name", &src_name, NULL);\
+ g_object_get((GObject *)sink_parent, "name", &sink_name, NULL);\
+ _mmcam_dbg_err("src[%s] - sink[%s] link failed", src_name, sink_name);\
+ gst_object_unref(src_parent); src_parent = NULL;\
+ gst_object_unref(sink_parent); sink_parent = NULL;\
+ if (src_name) {\
+ free(src_name); src_name = NULL;\
+ }\
+ if (sink_name) {\
+ free(sink_name); sink_name = NULL;\
+ }\
+ gst_object_unref(srcpad); srcpad = NULL;\
+ gst_object_unref(sinkpad); sinkpad = NULL;\
+ err = MM_ERROR_CAMCORDER_GST_LINK;\
+ goto if_fail_goto;\
+ }\
+ gst_object_unref(srcpad); srcpad = NULL;\
+ gst_object_unref(sinkpad); sinkpad = NULL;\
}
#define _MM_GST_PAD_UNLINK_UNREF( srcpad, sinkpad) \
#define _MMCAMCORDER_STATE_SET_COUNT 3 /* checking interval */
#define _MMCAMCORDER_STATE_CHECK_TOTALTIME 5000000L /* total wating time for state change */
-#define _MMCAMCORDER_STATE_CHECK_INTERVAL 5000 /* checking interval */
+#define _MMCAMCORDER_STATE_CHECK_INTERVAL (50*1000) /* checking interval - 50ms*/
/**
* Default videosink type
*/
-#define _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE "VideosinkElementX"
+#define _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE "VideosinkElementOverlay"
/**
* Default recording motion rate
/**
* Functions related with LOCK and WAIT
*/
-#define _MMCAMCORDER_CAST_MTSAFE(handle) (((mmf_camcorder_t*)handle)->mtsafe)
-
-#define _MMCAMCORDER_GET_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).lock)
-#define _MMCAMCORDER_LOCK(handle) g_mutex_lock(_MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK(handle) g_mutex_trylock(_MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK(handle) g_mutex_unlock(_MMCAMCORDER_GET_LOCK(handle))
-
-#define _MMCAMCORDER_GET_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
-#define _MMCAMCORDER_WAIT(handle) g_cond_wait (_MMCAMCORDER_GET_COND(handle), _MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_TIMED_WAIT(handle, timeval) g_cond_timed_wait (_MMCAMCORDER_GET_COND(handle), _MMCAMCORDER_GET_LOCK(handle),timeval)
-
-#define _MMCAMCORDER_SIGNAL(handle) g_cond_signal (_MMCAMCORDER_GET_COND(handle));
-#define _MMCAMCORDER_BROADCAST(handle) g_cond_broadcast (_MMCAMCORDER_GET_COND(handle));
+#define _MMCAMCORDER_CAST_MTSAFE(handle) (((mmf_camcorder_t*)handle)->mtsafe)
+#define _MMCAMCORDER_LOCK_FUNC(mutex) g_mutex_lock(&mutex)
+#define _MMCAMCORDER_TRYLOCK_FUNC(mutex) g_mutex_trylock(&mutex)
+#define _MMCAMCORDER_UNLOCK_FUNC(mutex) g_mutex_unlock(&mutex)
+
+#define _MMCAMCORDER_GET_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).lock)
+#define _MMCAMCORDER_LOCK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_LOCK(handle))
+
+#define _MMCAMCORDER_GET_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
+#define _MMCAMCORDER_WAIT(handle) g_cond_wait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_WAIT_UNTIL(handle, end_time) g_cond_wait_until(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle), end_time)
+#define _MMCAMCORDER_SIGNAL(handle) g_cond_signal(&_MMCAMCORDER_GET_COND(handle));
+#define _MMCAMCORDER_BROADCAST(handle) g_cond_broadcast(&_MMCAMCORDER_GET_COND(handle));
/* for command */
-#define _MMCAMCORDER_GET_CMD_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
-#define _MMCAMCORDER_LOCK_CMD(handle) g_mutex_lock(_MMCAMCORDER_GET_CMD_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_CMD(handle) g_mutex_trylock(_MMCAMCORDER_GET_CMD_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_CMD(handle) g_mutex_unlock(_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_GET_CMD_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
+#define _MMCAMCORDER_GET_CMD_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_cond)
+#define _MMCAMCORDER_LOCK_CMD(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_CMD(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_CMD(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_CMD_WAIT(handle) g_cond_wait(&_MMCAMCORDER_GET_CMD_COND(handle), &_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_CMD_WAIT_UNTIL(handle, end_time) g_cond_wait_until(&_MMCAMCORDER_GET_CMD_COND(handle), &_MMCAMCORDER_GET_CMD_LOCK(handle), end_time)
+#define _MMCAMCORDER_CMD_SIGNAL(handle) g_cond_signal(&_MMCAMCORDER_GET_CMD_COND(handle));
+
+/* for ASM */
+#define _MMCAMCORDER_GET_ASM_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).asm_lock)
+#define _MMCAMCORDER_LOCK_ASM(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_ASM(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_ASM(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle))
/* for state change */
-#define _MMCAMCORDER_GET_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
-#define _MMCAMCORDER_LOCK_STATE(handle) g_mutex_lock(_MMCAMCORDER_GET_STATE_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_STATE(handle) g_mutex_trylock(_MMCAMCORDER_GET_STATE_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_STATE(handle) g_mutex_unlock(_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_GET_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
+#define _MMCAMCORDER_LOCK_STATE(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_STATE(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_STATE(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_STATE_LOCK(handle))
/* for gstreamer state change */
-#define _MMCAMCORDER_GET_GST_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_state_lock)
-#define _MMCAMCORDER_LOCK_GST_STATE(handle) g_mutex_lock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_GST_STATE(handle) g_mutex_trylock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_GST_STATE(handle) g_mutex_unlock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_GET_GST_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_state_lock)
+#define _MMCAMCORDER_LOCK_GST_STATE(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_GST_STATE(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_GST_STATE(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+
+#define _MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_encode_state_lock)
+#define _MMCAMCORDER_LOCK_GST_ENCODE_STATE(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_GST_ENCODE_STATE(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_GST_ENCODE_STATE(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
/* for setting/calling callback */
#define _MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).message_cb_lock)
-#define _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
#define _MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).vcapture_cb_lock)
-#define _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
#define _MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).vstream_cb_lock)
-#define _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_VSTREAM_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_VSTREAM_CALLBACK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
#define _MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).astream_cb_lock)
-#define _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
/**
* Caster of main handle (camcorder)
#define MM_CAMCORDER_MODE_NUM 3 /**< Number of mode type */
#define MM_CAMCORDER_COLOR_TONE_NUM 30 /**< Number of color-tone modes */
#define MM_CAMCORDER_WHITE_BALANCE_NUM 10 /**< Number of WhiteBalance modes*/
-#define MM_CAMCORDER_SCENE_MODE_NUM 15 /**< Number of program-modes */
+#define MM_CAMCORDER_SCENE_MODE_NUM 16 /**< Number of program-modes */
#define MM_CAMCORDER_FOCUS_MODE_NUM 6 /**< Number of focus mode*/
#define MM_CAMCORDER_AUTO_FOCUS_NUM 5 /**< Total count of auto focus type*/
#define MM_CAMCORDER_FOCUS_STATE_NUM 4 /**< Number of focus state */
#define MM_CAMCORDER_ISO_NUM 10 /**< Number of ISO */
#define MM_CAMCORDER_AUTO_EXPOSURE_NUM 9 /**< Number of Auto exposure type */
#define MM_CAMCORDER_WDR_NUM 3 /**< Number of wide dynamic range */
+#define MM_CAMCORDER_FLIP_NUM 4 /**< Number of Filp mode */
+#define MM_CAMCORDER_ROTATION_NUM 4 /**< Number of Rotation mode */
#define MM_CAMCORDER_AHS_NUM 4 /**< Number of anti-handshake */
#define MM_CAMCORDER_VIDEO_STABILIZATION_NUM 2 /**< Number of video stabilization */
#define MM_CAMCORDER_HDR_CAPTURE_NUM 3 /**< Number of HDR capture mode */
#define MM_CAMCORDER_STROBE_CONTROL_NUM 3 /**< Number of strobe control type */
#define MM_CAMCORDER_DETECT_MODE_NUM 2 /**< Number of detect mode type */
-
/*=======================================================================================
| ENUM DEFINITIONS |
========================================================================================*/
_MMCamcorder_MULTI_SHOT,
};
-/**
- * Enumerations for manual focus direction.
- * If focusing mode is not "MM_CAMCORDER_AF_MODE_MANUAL", this value will be ignored.
+/**
+ * Enumerations for manual focus direction.
+ * If focusing mode is not "MM_CAMCORDER_AF_MODE_MANUAL", this value will be ignored.
*/
enum MMCamcorderMfLensDir {
MM_CAMCORDER_MF_LENS_DIR_FORWARD = 1, /**< Focus direction to forward */
_MMCAMCORDER_MAIN_PIPE = 0x00,
/* Pipeline element of Video input */
- _MMCAMCORDER_VIDEOSRC_BIN,
_MMCAMCORDER_VIDEOSRC_SRC,
_MMCAMCORDER_VIDEOSRC_FILT,
- _MMCAMCORDER_VIDEOSRC_QUE,
+ _MMCAMCORDER_VIDEOSRC_CLS_QUE,
_MMCAMCORDER_VIDEOSRC_CLS,
- _MMCAMCORDER_VIDEOSRC_SCALE,
- _MMCAMCORDER_VIDEOSRC_VSFLT,
- _MMCAMCORDER_VIDEOSRC_TEE,
+ _MMCAMCORDER_VIDEOSRC_CLS_FILT,
+ _MMCAMCORDER_VIDEOSRC_QUE,
+ _MMCAMCORDER_VIDEOSRC_DECODE,
+
+ /* Pipeline element of Video output */
+ _MMCAMCORDER_VIDEOSINK_QUE,
+ _MMCAMCORDER_VIDEOSINK_CLS,
+ _MMCAMCORDER_VIDEOSINK_SINK,
+
+ _MMCAMCORDER_PIPELINE_ELEMENT_NUM,
+} _MMCAMCORDER_PREVIEW_PIPELINE_ELELMENT;
+
+/**
+ * Camcorder Pipeline's Element name.
+ * @note index of element.
+ */
+typedef enum {
+ _MMCAMCORDER_ENCODE_NONE = (-1),
+
+ /* Main Pipeline Element */
+ _MMCAMCORDER_ENCODE_MAIN_PIPE = 0x00,
/* Pipeline element of Audio input */
_MMCAMCORDER_AUDIOSRC_BIN,
_MMCAMCORDER_AUDIOSRC_SRC,
_MMCAMCORDER_AUDIOSRC_FILT,
- _MMCAMCORDER_AUDIOSRC_NS,
_MMCAMCORDER_AUDIOSRC_QUE,
_MMCAMCORDER_AUDIOSRC_CONV,
_MMCAMCORDER_AUDIOSRC_VOL,
- _MMCAMCORDER_AUDIOSRC_ENC,
-
- /* Pipeline element of Video output */
- _MMCAMCORDER_VIDEOSINK_BIN,
- _MMCAMCORDER_VIDEOSINK_QUE,
- _MMCAMCORDER_VIDEOSINK_SCALE,
- _MMCAMCORDER_VIDEOSINK_FILT,
- _MMCAMCORDER_VIDEOSINK_OVERLAY,
- _MMCAMCORDER_VIDEOSINK_CLS,
- _MMCAMCORDER_VIDEOSINK_ROTATE,
- _MMCAMCORDER_VIDEOSINK_SINK,
/* Pipeline element of Encodebin */
_MMCAMCORDER_ENCSINK_BIN,
+ _MMCAMCORDER_ENCSINK_SRC,
+ _MMCAMCORDER_ENCSINK_FILT,
_MMCAMCORDER_ENCSINK_ENCBIN,
_MMCAMCORDER_ENCSINK_AQUE,
_MMCAMCORDER_ENCSINK_CONV,
_MMCAMCORDER_ENCSINK_MUX,
_MMCAMCORDER_ENCSINK_SINK,
- /* Pipeline element of Stillshot output */
- _MMCAMCORDER_STILLSHOTSINK_BIN,
- _MMCAMCORDER_STILLSHOTSINK_QUE,
- _MMCAMCORDER_STILLSHOTSINK_TOGGLE,
- _MMCAMCORDER_STILLSHOTSINK_CLS,
- _MMCAMCORDER_STILLSHOTSINK_CROP,
- _MMCAMCORDER_STILLSHOTSINK_FILT,
- _MMCAMCORDER_STILLSHOTSINK_SCALE,
- _MMCAMCORDER_STILLSHOTSINK_FILT2,
- _MMCAMCORDER_STILLSHOTSINK_ENC,
- _MMCAMCORDER_STILLSHOTSINK_SINK,
-
- _MMCamcorder_PIPELINE_ELEMENT_NUM,
-} _MMCAMCORDER_PIPELINE_ELELMENT;
+ _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM,
+} _MMCAMCORDER_ENCODE_PIPELINE_ELELMENT;
-/**
- * Command type for Camcorder.
- */
typedef enum {
- _MMCAMCORDER_CMD_CREATE,
- _MMCAMCORDER_CMD_DESTROY,
- _MMCAMCORDER_CMD_REALIZE,
- _MMCAMCORDER_CMD_UNREALIZE,
- _MMCAMCORDER_CMD_START,
- _MMCAMCORDER_CMD_STOP,
- _MMCAMCORDER_CMD_CAPTURESTART,
- _MMCAMCORDER_CMD_CAPTURESTOP,
- _MMCAMCORDER_CMD_RECORD,
- _MMCAMCORDER_CMD_PAUSE,
- _MMCAMCORDER_CMD_COMMIT,
- _MMCAMCORDER_CMD_CANCEL,
- _MMCAMCORDER_CMD_QUIT,
-} _MMCamcorderCommandType;
+ _MMCAMCORDER_TASK_THREAD_STATE_NONE,
+ _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START,
+ _MMCAMCORDER_TASK_THREAD_STATE_SOUND_SOLO_PLAY_START,
+ _MMCAMCORDER_TASK_THREAD_STATE_ENCODE_PIPE_CREATE,
+ _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING,
+ _MMCAMCORDER_TASK_THREAD_STATE_EXIT,
+} _MMCamcorderTaskThreadState;
/**
* System state change cause
typedef enum {
_MMCAMCORDER_STATE_CHANGE_NORMAL = 0,
_MMCAMCORDER_STATE_CHANGE_BY_ASM,
+ _MMCAMCORDER_STATE_CHANGE_BY_RM,
+ _MMCAMCORDER_STATE_CHANGE_BY_DPM
} _MMCamcorderStateChange;
* MMCamcorder information for Multi-Thread Safe
*/
typedef struct {
- GMutex *lock; /**< Mutex (for general use) */
- GCond *cond; /**< Condition (for general use) */
- GMutex *cmd_lock; /**< Mutex (for command) */
- GMutex *state_lock; /**< Mutex (for state change) */
- GMutex *gst_state_lock; /**< Mutex (for state change) */
- GMutex *message_cb_lock; /**< Mutex (for message callback) */
- GMutex *vcapture_cb_lock; /**< Mutex (for video capture callback) */
- GMutex *vstream_cb_lock; /**< Mutex (for video stream callback) */
- GMutex *astream_cb_lock; /**< Mutex (for audio stream callback) */
+ GMutex lock; /**< Mutex (for general use) */
+ GCond cond; /**< Condition (for general use) */
+ GMutex cmd_lock; /**< Mutex (for command) */
+ GCond cmd_cond; /**< Condition (for command) */
+ GMutex asm_lock; /**< Mutex (for ASM) */
+ GMutex state_lock; /**< Mutex (for state change) */
+ GMutex gst_state_lock; /**< Mutex (for gst pipeline state change) */
+ GMutex gst_encode_state_lock; /**< Mutex (for gst encode pipeline state change) */
+ GMutex message_cb_lock; /**< Mutex (for message callback) */
+ GMutex vcapture_cb_lock; /**< Mutex (for video capture callback) */
+ GMutex vstream_cb_lock; /**< Mutex (for video stream callback) */
+ GMutex astream_cb_lock; /**< Mutex (for audio stream callback) */
} _MMCamcorderMTSafe;
/**
- * MMCamcorder information for command loop
- */
-typedef struct {
- pthread_t pCommandThread; /**< Command loop handle */
- GQueue *cmd_queue; /**< Queue for Command loop */
- sem_t sema; /**< Semaphore for Command loop */
-} _MMCamcorderCommand;
-
-/**
- * MMCamcorder command information
- */
-typedef struct {
- MMHandleType handle; /**< camcorder handle */
- _MMCamcorderCommandType type; /**< Type of command */
-} __MMCamcorderCmdInfo;
-
-/**
* MMCamcorder Sub Context
*/
typedef struct {
bool isMaxsizePausing; /**< Because of size limit, pipeline is paused. */
bool isMaxtimePausing; /**< Because of time limit, pipeline is paused. */
int element_num; /**< count of element */
+ int encode_element_num; /**< count of encode element */
int cam_stability_count; /**< camsensor stability count. the count of frame will drop */
GstClockTime pipeline_time; /**< current time of Gstreamer Pipeline */
GstClockTime pause_time; /**< amount of time while pipeline is in PAUSE state.*/
GstClockTime stillshot_time; /**< pipeline time of capturing moment*/
gboolean is_modified_rate; /**< whether recording motion rate is modified or not */
- gboolean error_occurs; /**< flag for error */
- int error_code; /**< error code for internal gstreamer error */
gboolean ferror_send; /**< file write/seek error **/
guint ferror_count; /**< file write/seek error count **/
GstClockTime previous_slot_time;
_MMCamcorderVideoInfo *info_video; /**< extra information for video recording */
_MMCamcorderAudioInfo *info_audio; /**< extra information for audio recording */
- _MMCamcorderGstElement *element; /**< array of Gstreamer element */
+ _MMCamcorderGstElement *element; /**< array of preview element */
+ _MMCamcorderGstElement *encode_element; /**< array of encode element */
_MMCamcorderKPIMeasure kpi; /**< information related with performance measurement */
type_element *VideosinkElement; /**< configure data of videosink element */
+ type_element *VideoconvertElement; /**< configure data of videoconvert element */
+ type_element *VideodecoderElementH264; /**< configure data of video decoder element for H.264 format */
gboolean SensorEncodedCapture; /**< whether camera sensor support encoded image capture */
gboolean internal_encode; /**< whether use internal encoding function */
} _MMCamcorderSubContext;
typedef struct mmf_camcorder {
/* information */
int type; /**< mmcamcorder_mode_type */
+ int device_type; /**< device type */
int state; /**< state of camcorder */
int target_state; /**< Target state that want to set. This is a flag that
* stands for async state changing. If this value differ from state,
mm_exif_info_t *exif_info; /**< EXIF */
GList *buffer_probes; /**< a list of buffer probe handle */
GList *event_probes; /**< a list of event probe handle */
- GList *data_probes; /**< a list of data probe handle */
GList *signals; /**< a list of signal handle */
+#ifdef _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK
GList *msg_data; /**< a list of msg data */
+#endif /* _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK */
camera_conf *conf_main; /**< Camera configure Main structure */
camera_conf *conf_ctrl; /**< Camera configure Control structure */
- int asm_handle_sh; /**< Audio session manager handle of share session */
- int asm_handle_ex; /**< Audio session manager handle of exclusive session */
+#ifdef _MMCAMCORDER_RM_SUPPORT
+ int rm_handle; /**< Resource manager handle */
+#endif /* _MMCAMCORDER_RM_SUPPORT */
guint pipeline_cb_event_id; /**< Event source ID of pipeline message callback */
+ guint encode_pipeline_cb_event_id; /**< Event source ID of encode pipeline message callback */
guint setting_event_id; /**< Event source ID of attributes setting to sensor */
SOUND_INFO snd_info; /**< Sound handle for multishot capture */
int (*command)(MMHandleType, int); /**< camcorder's command */
/* etc */
+ mm_cam_attr_construct_info *cam_attrs_const_info; /**< attribute info */
+ conf_info_table* conf_main_info_table[CONFIGURE_CATEGORY_MAIN_NUM]; /** configure info table - MAIN category */
+ conf_info_table* conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_NUM]; /** configure info table - CONTROL category */
+ int conf_main_category_size[CONFIGURE_CATEGORY_MAIN_NUM]; /** configure info table size - MAIN category */
+ int conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_NUM]; /** configure info table size - CONTROL category */
_MMCamcorderMTSafe mtsafe; /**< Thread safe */
- _MMCamcorderCommand cmd; /**< information for command loop */
- int sync_state_change; /**< Change framework state synchronously */
- int quick_device_close;
- int state_change_by_system; /**< MSL changes its state by itself because of system(ASM,MDM..) **/
- int asm_event_code; /**< event code of audio session manager */
- pthread_mutex_t sound_lock; /**< Capture sound mutex */
- pthread_cond_t sound_cond; /**< Capture sound cond */
+ int state_change_by_system; /**< MSL changes its state by itself because of system */
+ GMutex restart_preview_lock; /**< Capture sound mutex */
int use_zero_copy_format; /**< Whether use zero copy format for camera input */
+ int use_videoconvert; /**< Whether use videoconvert element for display */
+ int support_media_packet_preview_cb; /**< Whether support zero copy format for camera input */
int shutter_sound_policy; /**< shutter sound policy */
+ int brightness_default; /**< default value of brightness */
+ int brightness_step_denominator; /**< denominator of brightness bias step */
+ int support_zsl_capture; /**< support Zero Shutter Lag capture */
+ char *model_name; /**< model name from system info */
+ char *software_version; /**< software_version from system info */
+ int capture_sound_count; /**< count for capture sound */
+ char *root_directory; /**< Root directory for device */
+ int resolution_changed; /**< Flag for preview resolution change */
+ int sound_focus_register; /**< Use sound focus internally */
+ int sound_focus_id; /**< id for sound focus */
+ int sound_focus_watch_id; /**< id for sound focus watch */
+ int interrupt_code; /**< Interrupt code */
+ int acquired_focus; /**< Current acquired focus */
+ int session_type; /**< Session type */
+ int session_flags; /**< Session flags */
+ int recreate_decoder; /**< Flag of decoder element recreation for encoded preview format */
_MMCamcorderInfoConverting caminfo_convert[CAMINFO_CONVERT_NUM]; /**< converting structure of camera info */
_MMCamcorderEnumConvert enum_conv[ENUM_CONVERT_NUM]; /**< enum converting list that is modified by ini info */
- int reserved[4]; /**< reserved */
+ gboolean capture_in_recording; /**< Flag for capture while recording */
+
+ gboolean error_occurs; /**< flag for error */
+ int error_code; /**< error code for internal gstreamer error */
+
+ /* task thread */
+ GThread *task_thread; /**< thread for task */
+ GMutex task_thread_lock; /**< mutex for task thread */
+ GCond task_thread_cond; /**< cond for task thread */
+ _MMCamcorderTaskThreadState task_thread_state; /**< state of task thread */
+
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+ /* resource manager for H/W resources */
+ MMCamcorderResourceManager resource_manager;
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+
+ /* gdbus */
+ GDBusConnection *gdbus_conn; /**< gdbus connection */
+ _MMCamcorderGDbusCbInfo gdbus_info_sound; /**< Informations for the gbus cb of sound play */
+ _MMCamcorderGDbusCbInfo gdbus_info_solo_sound; /**< Informations for the gbus cb of solo sound play */
+
+ /* DPM(device policy manager) */
+ dpm_context_h dpm_context; /**< DPM context handle */
+ dpm_restriction_policy_h dpm_policy; /**< DPM restriction policy handle */
+ int dpm_camera_cb_id; /**< DPM camera policy changed callback id */
+
+#ifdef _MMCAMCORDER_RM_SUPPORT
+ rm_category_request_s request_resources;
+ rm_device_return_s returned_devices;
+#endif /* _MMCAMCORDER_RM_SUPPORT */
+ int reserved[4]; /**< reserved */
} mmf_camcorder_t;
/*=======================================================================================
int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info);
/**
- * This function destroys instance of camcorder.
+ * This function destroys instance of camcorder.
*
* @param[in] hcamcorder Specifies the camcorder handle
* @return This function returns zero on success, or negative value with error code.
void _mmcamcorder_set_state(MMHandleType handle, int state);
/**
- * This function gets asynchronous status of MSL Camcroder.
+ * This function gets asynchronous status of MSL Camcroder.
*
* @param[in] handle Handle of camcorder context.
* @param[in] target_state setting target_state value of camcorder.
int _mmcamcorder_get_async_state(MMHandleType handle);
/**
- * This function sets new target state of camcorder.
- *
- * @param[in] handle Handle of camcorder context.
- * @param[in] target_state setting target_state value of camcorder.
- * @return This function returns zero on success, or negative value with error code.
- * @remarks
- * @see _mmcamcorder_get_async_state(), _mmcamcorder_set_async_cancel()
- *
- */
-int _mmcamcorder_set_async_state(MMHandleType handle, int target_state);
-
-/**
- * This function sets new target state of camcorder.
- *
- * @param[in] handle Handle of camcorder context.
- * @return gboolean
- * @remarks
- * @see _mmcamcorder_set_async_cancel()
- *
- */
-gboolean _mmcamcorder_set_async_cancel(MMHandleType handle);
-
-/**
- * Check whether camcorder changes its state now.
- *
- * @param[in] handle Handle of camcorder context.
- * @return gboolean
- * @remarks
- * @see _mmcamcorder_set_async_state(), _mmcamcorder_set_async_cancel()
- *
- */
-gboolean _mmcamcorder_is_state_changing(MMHandleType handle);
-
-/**
* This function allocates structure of subsidiary attributes.
*
* @param[in] type Allocation type of camcorder context.
GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data);
/**
+ * This function is callback function of main pipeline.
+ * Once this function is registered with certain pipeline using gst_bus_set_sync_handler(),
+ * this callback will be called every time when there is upcomming message from pipeline.
+ * Basically, this function is used as sync error handling function, now.
+ *
+ * @param[in] bus pointer of buf that called this function.
+ * @param[in] message callback message from pipeline.
+ * @param[in] data user data.
+ * @return This function returns true on success, or false value with error
+ * @remarks
+ * @see __mmcamcorder_create_audiop_with_encodebin()
+ *
+ */
+GstBusSyncReply _mmcamcorder_audio_pipeline_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data);
+
+
+/**
* This function create main pipeline according to type.
*
* @param[in] handle Handle of camcorder context.
void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type);
/**
- * This function sets gstreamer element status.
+ * This function sets gstreamer element status.
* If the gstreamer fails to set status or returns asynchronous mode,
* this function waits for state changed until timeout expired.
*
int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstState target_state);
/**
- * This function sets gstreamer element status, asynchronously.
+ * This function sets gstreamer element status, asynchronously.
* Regardless of processing, it returns immediately.
*
* @param[in] pipeline Pointer of pipeline
* @param[in] target_state newly setting status
* @return This function returns zero on success, or negative value with error code.
* @remarks
- * @see
+ * @see
*
*/
int _mmcamcorder_gst_set_state_async(MMHandleType handle, GstElement *pipeline, GstState target_state);
int _mmcamcorder_video_current_framerate(MMHandleType handle);
int _mmcamcorder_video_average_framerate(MMHandleType handle);
-/* command */
-void _mmcamcorder_delete_command_info(__MMCamcorderCmdInfo *cmdinfo);
-int _mmcamcorder_create_command_loop(MMHandleType handle);
-int _mmcamcorder_destroy_command_loop(MMHandleType handle);
-int _mmcamcorder_append_command(MMHandleType handle, __MMCamcorderCmdInfo *info);
-int _mmcamcorder_append_simple_command(MMHandleType handle, _MMCamcorderCommandType type);
-void *_mmcamcorder_command_loop_thread(void *arg);
+/* sound focus related function */
+void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder);
+void _mmcamcorder_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
+ mm_sound_focus_state_e focus_state, const char *reason_for_change,
+ const char *additional_info, void *user_data);
+void _mmcamcorder_sound_focus_watch_cb(mm_sound_focus_type_e focus_type, mm_sound_focus_state_e focus_state,
+ const char *reason_for_change, const char *additional_info, void *user_data);
+
+/* device policy manager */
+void _mmcamcorder_dpm_camera_policy_changed_cb(const char *name, const char *value, void *user_data);
+
+/* For hand over the server's caps information to client */
+int _mmcamcorder_get_video_caps(MMHandleType handle, char **caps);
#ifdef __cplusplus
}