#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_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
#define _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, if_fail_goto)\
{\
- GstPadLinkReturn ret = _MM_GST_PAD_LINK(srcpad, sinkpad);\
+ 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);\
/**
* Default videosink type
*/
-#define _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE "VideosinkElementX"
+#define _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE "VideosinkElementOverlay"
/**
* Default recording motion rate
#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, timeout) g_cond_wait_until(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle), &end_time)
+#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_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_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))
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+/* for resource conflict */
+#define _MMCAMCORDER_GET_RESOURCE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).resource_lock)
+#define _MMCAMCORDER_GET_RESOURCE_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).resource_cond)
+#define _MMCAMCORDER_LOCK_RESOURCE(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_RESOURCE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_RESOURCE(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_RESOURCE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_RESOURCE(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_RESOURCE_LOCK(handle))
+#define _MMCAMCORDER_RESOURCE_WAIT(handle) g_cond_wait(&_MMCAMCORDER_GET_RESOURCE_COND(handle), &_MMCAMCORDER_GET_RESOURCE_LOCK(handle))
+#define _MMCAMCORDER_RESOURCE_WAIT_UNTIL(handle, end_time) g_cond_wait_until(&_MMCAMCORDER_GET_RESOURCE_COND(handle), &_MMCAMCORDER_GET_RESOURCE_LOCK(handle), end_time)
+#define _MMCAMCORDER_RESOURCE_SIGNAL(handle) g_cond_signal(&_MMCAMCORDER_GET_RESOURCE_COND(handle));
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+
/**
* Caster of main handle (camcorder)
*/
/* Pipeline element of Video output */
_MMCAMCORDER_VIDEOSINK_QUE,
+ _MMCAMCORDER_VIDEOSINK_CLS,
_MMCAMCORDER_VIDEOSINK_SINK,
_MMCAMCORDER_PIPELINE_ELEMENT_NUM,
_MMCAMCORDER_STATE_CHANGE_NORMAL = 0,
_MMCAMCORDER_STATE_CHANGE_BY_ASM,
_MMCAMCORDER_STATE_CHANGE_BY_RM,
+ _MMCAMCORDER_STATE_CHANGE_BY_DPM
} _MMCamcorderStateChange;
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 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) */
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+ GCond resource_cond; /**< Condition (for resource check) */
+ GMutex resource_lock; /**< Mutex (for resource check) */
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
} _MMCamcorderMTSafe;
/**
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;
#endif /* _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK */
camera_conf *conf_main; /**< Camera configure Main structure */
camera_conf *conf_ctrl; /**< Camera configure Control structure */
+#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 */
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 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 */
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;
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 */
+/* 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