Add new API for video encode decision callback
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder.h
index 9ca12b0..0d9dda1 100644 (file)
@@ -1228,6 +1228,16 @@ extern "C" {
 #define MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB   "support-media-packet-preview-cb"
 
 /**
+* Support user buffer for zero copy
+*/
+#define MMCAM_SUPPORT_USER_BUFFER               "support-user-buffer"
+
+/**
+* Buffer fd from user
+*/
+#define MMCAM_USER_BUFFER_FD                    "user-buffer-fd"
+
+/**
  * Enable to write tags for recorded file
  */
 #define MMCAM_RECORDER_TAG_ENABLE               "recorder-tag-enable"
@@ -1238,9 +1248,9 @@ extern "C" {
 #define MMCAM_DISPLAY_SOCKET_PATH               "display-socket-path"
 
 /**
- * PID for sound focus
+ * Client PID
  */
-#define MMCAM_PID_FOR_SOUND_FOCUS               "pid-for-sound-focus"
+#define MMCAM_CLIENT_PID                        "client-pid"
 
 /**
  * Root directory of application
@@ -1681,7 +1691,9 @@ typedef enum {
        MM_CAM_STREAM_DATA_YUV420SP,            /**< YUV420 SemiPlannar type - 2 planes */
        MM_CAM_STREAM_DATA_YUV420P,             /**< YUV420 Plannar type - 3 planes */
        MM_CAM_STREAM_DATA_YUV422P,             /**< YUV422 Plannar type - 3 planes */
-       MM_CAM_STREAM_DATA_ENCODED              /**< Encoded data type - 1 plane */
+       MM_CAM_STREAM_DATA_ENCODED,             /**< Encoded data type - 1 plane */
+       MM_CAM_STREAM_DATA_DEPTH,               /**< Depth data type - 1 plane */
+       MM_CAM_STREAM_DATA_RGB                  /**< RGB data type - 1 plane */
 } MMCamStreamData;
 
 
@@ -1783,7 +1795,8 @@ typedef struct {
                struct {
                        unsigned char *data;
                        unsigned int length_data;
-               } encoded;
+                       int is_delta_frame;
+               } encoded, depth, rgb;
        } data;                         /**< pointer of captured stream */
        MMCamStreamData data_type;      /**< data type */
        unsigned int length_total;      /**< total length of stream buffer (in byte)*/
@@ -1858,6 +1871,14 @@ typedef struct _MMCamFaceDetectInfo {
        MMCamFaceInfo *face_info;               /**< face information, this should be freed after use it. */
 } MMCamFaceDetectInfo;
 
+/**
+ * Window information
+ */
+typedef struct _MMCamWindowInfo {
+       int surface_id;
+       MMRectType rect;
+} MMCamWindowInfo;
+
 
 /*=======================================================================================
 | TYPE DEFINITIONS                                                                     |
@@ -1920,6 +1941,17 @@ typedef gboolean (*mm_camcorder_muxed_stream_callback)(MMCamcorderMuxedStreamDat
  */
 typedef gboolean (*mm_camcorder_video_capture_callback)(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_param);
 
+/**
+ *     Function definition for video encode decision callback.
+ *  Like '#mm_camcorder_video_stream_callback', you can't call mm_camcorder_stop() while you are hanging this function.
+ *
+ *     @param[in]      stream                  Reference pointer to video stream data
+ *     @param[in]      user_param              User parameter which is received from user when callback function was set
+ *     @return         This function returns true on encoding, or false on drop frame.
+ *     @remarks                This function is issued in the context of gstreamer (video sink or internal of camerasrc thread).
+ */
+typedef gboolean (*mm_camcorder_video_encode_decision_callback)(MMCamcorderVideoStreamDataType *stream, void *user_param);
+
 
 /*=======================================================================================
 | GLOBAL FUNCTION PROTOTYPES                                                           |
@@ -2223,8 +2255,6 @@ int mm_camcorder_realize(MMHandleType camcorder);
  *  Most important resource that is released here is gstreamer pipeline of mm_camcorder.
  *  Because most of resources, such as camera device, video display device, and audio I/O device, are operating on the gstreamer pipeline,
  *  this function should be called to release its resources.
- *  Moreover, mm_camcorder is controlled by audio session manager. If an user doesn't call this function when he want to release mm_camcorder,
- *  other multimedia frameworks may face session problem. For more detail information, please refer mm_session module.
  *
  *     @param[in]      camcorder       A handle of camcorder.
  *     @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
@@ -2970,6 +3000,25 @@ int mm_camcorder_set_muxed_stream_callback(MMHandleType camcorder, mm_camcorder_
 
 
 /**
+ *    mm_camcorder_set_video_encode_decision_callback:\n
+ *  Set callback for user defined video encode decision callback function.
+ *  Users can retrieve video frame using registered callback,
+ *  and decide to encoding video frame by return value of function.
+ *
+ *     @param[in]      camcorder       A handle of camcorder.
+ *     @param[in]      callback        Function pointer of callback function.
+ *     @param[in]      user_data       User parameter for passing to callback function.
+ *     @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
+ *                     Please refer 'mm_error.h' to know the exact meaning of the error.
+ *     @see            mm_camcorder_video_encode_decision_callback
+ *     @pre            None
+ *     @post           None
+ *     @remarks        registered 'callback' is called on internal thread of camcorder. Regardless of the status of main loop, this function will be called.
+ */
+int mm_camcorder_set_video_encode_decision_callback(MMHandleType camcorder, mm_camcorder_video_encode_decision_callback callback, void *user_data);
+
+
+/**
  *    mm_camcorder_get_state:\n
  *  Get the current state of camcorder.
  *  mm_camcorder is working on the base of its state. An user should check the state of mm_camcorder before calling its functions.