Udpate for force stop function
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder_internal.h
index 4da30a7..1dac082 100644 (file)
@@ -34,6 +34,8 @@
 #include <mm_attrs.h>
 #include <mm_attrs_private.h>
 #include <mm_message.h>
+#include <mm_session.h>
+#include <mm_session_private.h>
 #include <mm_sound_focus.h>
 #include <vconf.h>
 #include <gst/video/video-format.h>
@@ -411,6 +413,11 @@ extern "C" {
 #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))
 
+#define _MMCAMCORDER_GET_MSTREAM_CALLBACK_LOCK(handle)      (_MMCAMCORDER_CAST_MTSAFE(handle).mstream_cb_lock)
+#define _MMCAMCORDER_LOCK_MSTREAM_CALLBACK(handle)          _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_MSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_MSTREAM_CALLBACK(handle)       _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_MSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_MSTREAM_CALLBACK(handle)        _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_MSTREAM_CALLBACK_LOCK(handle))
+
 #ifdef _MMCAMCORDER_MURPHY_SUPPORT
 /* for resource conflict */
 #define _MMCAMCORDER_GET_RESOURCE_LOCK(handle)              (_MMCAMCORDER_CAST_MTSAFE(handle).resource_lock)
@@ -627,6 +634,7 @@ typedef struct {
        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 mstream_cb_lock;         /**< Mutex (for muxed stream callback) */
 #ifdef _MMCAMCORDER_MURPHY_SUPPORT
        GCond resource_cond;            /**< Condition (for resource check) */
        GMutex resource_lock;           /**< Mutex (for resource check) */
@@ -654,6 +662,7 @@ typedef struct {
        gboolean bencbin_capture;               /**< Use Encodebin for capturing */
        gboolean audio_disable;                 /**< whether audio is disabled or not when record */
        int videosrc_rotate;                    /**< rotate of videosrc */
+       unsigned long long muxed_stream_offset; /**< current offset for muxed stream data */
 
        /* For dropping video frame when start recording */
        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. */
@@ -684,9 +693,7 @@ typedef struct mmf_camcorder {
        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,
-                                                          * it means state is changing now asychronously. */
+       int old_state;          /**< old state of camcorder */
 
        /* handles */
        MMHandleType attributes;               /**< Attribute handle */
@@ -715,6 +722,8 @@ typedef struct mmf_camcorder {
        void *vstream_cb_param;                                 /**< Video stream callback parameter */
        mm_camcorder_audio_stream_callback astream_cb;          /**< Audio stream callback */
        void *astream_cb_param;                                 /**< Audio stream callback parameter */
+       mm_camcorder_muxed_stream_callback mstream_cb;          /**< Muxed stream callback */
+       void *mstream_cb_param;                                 /**< Muxed stream callback parameter */
        mm_camcorder_video_capture_callback vcapture_cb;        /**< Video capture callback */
        void *vcapture_cb_param;                                /**< Video capture callback parameter */
        int (*command)(MMHandleType, int);                      /**< camcorder's command */
@@ -743,6 +752,7 @@ typedef struct mmf_camcorder {
        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 */
+       unsigned int sound_focus_subscribe_id;                  /**< subscribe id for sound focus signal */
        int interrupt_code;                                     /**< Interrupt code */
        int acquired_focus;                                     /**< Current acquired focus */
        int session_type;                                       /**< Session type */
@@ -766,6 +776,7 @@ typedef struct mmf_camcorder {
 #ifdef _MMCAMCORDER_MURPHY_SUPPORT
        /* resource manager for H/W resources */
        MMCamcorderResourceManager resource_manager;
+       gboolean resource_release_cb_calling;
 #endif /* _MMCAMCORDER_MURPHY_SUPPORT */
 
        /* gdbus */
@@ -774,8 +785,7 @@ typedef struct mmf_camcorder {
        _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 */
+       device_policy_manager_h dpm_handle;                     /**< DPM handle */
        int dpm_camera_cb_id;                                   /**< DPM camera policy changed callback id */
 
        /* Storage */
@@ -1026,6 +1036,20 @@ int _mmcamcorder_set_audio_stream_callback(MMHandleType handle,
                                           void *user_data);
 
 /**
+ *     This function is to set callback for muxed stream.
+ *
+ *     @param[in]      hcamcorder      Specifies the camcorder handle
+ *     @param[in]      callback        Specifies the function pointer of callback function
+ *     @param[in]      user_data       Specifies the user poiner for passing to callback function
+ *
+ *     @return         This function returns zero on success, or negative value with error code.
+ *     @see            mmcamcorder_error_type
+ */
+int _mmcamcorder_set_muxed_stream_callback(MMHandleType handle,
+                                          mm_camcorder_muxed_stream_callback callback,
+                                          void *user_data);
+
+/**
  *     This function is to set callback for video capture.
  *
  *     @param[in]      hcamcorder      Specifies the camcorder  handle
@@ -1086,6 +1110,7 @@ int _mmcamcorder_display_init(void);
  *
  */
 int _mmcamcorder_get_state(MMHandleType handle);
+int _mmcamcorder_get_state2(MMHandleType handle, int *state, int *old_state);
 
 /**
  * This function sets new state of camcorder.
@@ -1100,18 +1125,6 @@ int _mmcamcorder_get_state(MMHandleType handle);
 void _mmcamcorder_set_state(MMHandleType handle, int state);
 
 /**
- * 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.
- * @return     This function returns asynchrnous state.
- * @remarks
- * @see                _mmcamcorder_set_async_state()
- *
- */
-int _mmcamcorder_get_async_state(MMHandleType handle);
-
-/**
  * This function allocates structure of subsidiary attributes.
  *
  * @param[in]  type            Allocation type of camcorder context.
@@ -1232,18 +1245,6 @@ void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type);
  */
 int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstState target_state);
 
-/**
- * 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
- *
- */
-int _mmcamcorder_gst_set_state_async(MMHandleType handle, GstElement *pipeline, GstState target_state);
 
 /* For xvimagesink */
 GstBusSyncReply __mmcamcorder_sync_callback(GstBus *bus, GstMessage *message, gulong data);
@@ -1257,18 +1258,20 @@ 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_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_system);
 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,
+       int option, const char *additional_info, void *user_data);
+void _mmcamcorder_sound_focus_watch_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_signal_callback(mm_sound_signal_name_t signal, int value, 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);
+/* Emit dbus signal */
+void _mmcamcorder_emit_signal(MMHandleType handle, const char *object_name,
+       const char *interface_name, const char *signal_name, int value);
 
 #ifdef __cplusplus
 }