Add new API for video encode decision callback
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder.h
index ea51fdc..0d9dda1 100644 (file)
@@ -1941,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                                                           |
@@ -2989,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.