#include <mm_attrs.h>
#include <mm_attrs_private.h>
#include <mm_message.h>
+#include <mm_sound_focus.h>
#include <sndfile.h>
#include <vconf.h>
#include <gst/video/video-format.h>
} \
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; \
+ } \
+
#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); \
#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)\
#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_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) pthread_cond_wait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_TIMED_WAIT(handle, timeout) pthread_cond_timedwait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle), &timeout)
+#define _MMCAMCORDER_SIGNAL(handle) pthread_cond_signal(&_MMCAMCORDER_GET_COND(handle));
+#define _MMCAMCORDER_BROADCAST(handle) pthread_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) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_CMD_LOCK(handle))
/* Pipeline element of Video output */
_MMCAMCORDER_VIDEOSINK_QUE,
- _MMCAMCORDER_VIDEOSINK_CLS,
_MMCAMCORDER_VIDEOSINK_SINK,
_MMCAMCORDER_PIPELINE_ELEMENT_NUM,
typedef enum {
_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;
*/
typedef struct {
pthread_mutex_t lock; /**< Mutex (for general use) */
+ pthread_cond_t cond; /**< Condition (for general use) */
pthread_mutex_t cmd_lock; /**< Mutex (for command) */
pthread_mutex_t asm_lock; /**< Mutex (for ASM) */
pthread_mutex_t state_lock; /**< Mutex (for state change) */
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;
GList *buffer_probes; /**< a list of buffer probe handle */
GList *event_probes; /**< a list of event 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 */
guint pipeline_cb_event_id; /**< Event source ID of pipeline message callback */
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 acquired_focus; /**< Current acquired focus */
+ int session_type; /**< Session type */
+ int session_flags; /**< Session flags */
_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 */
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 */
pthread_t task_thread; /**< thread for task */
pthread_mutex_t task_thread_lock; /**< mutex for task thread */
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.
int _mmcamcorder_video_current_framerate(MMHandleType handle);
int _mmcamcorder_video_average_framerate(MMHandleType handle);
+/* 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);
+
+/* For hand over the server's caps informations to client */
+int _mmcamcorder_get_video_caps(MMHandleType handle, char **caps);
+
#ifdef __cplusplus
}
#endif