Add new dispatcher functions for new APIs 18/113118/2 accepted/tizen/common/20170309.174907 accepted/tizen/ivi/20170308.120223 accepted/tizen/mobile/20170308.120139 accepted/tizen/tv/20170308.120201 accepted/tizen/unified/20170310.080701 accepted/tizen/wearable/20170308.120212 submit/tizen/20170307.122057 submit/tizen_unified/20170310.011402
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 6 Feb 2017 07:01:42 +0000 (16:01 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 6 Feb 2017 07:44:27 +0000 (16:44 +0900)
New dispatcher functions are added for muxed stream callback

[Version] 0.2.35
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20170203.1]

Change-Id: I603d57bb0a61fc9f0ebcefc7925b8d047aaf6c54
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
legacy/include/legacy_recorder.h
legacy/include/legacy_recorder_private.h
legacy/src/legacy_recorder.c
muse/include/muse_recorder.h
muse/src/muse_recorder_dispatcher.c
packaging/mmsvc-recorder.spec

index 655859e..93d9f8d 100644 (file)
@@ -193,10 +193,10 @@ typedef enum {
  * @remarks After being called, recording data is discarded and not written in the recording file. Also the state of recorder is not changed.
  * @param[in] type The imitation type
  * @param[in] user_data The user data passed from the callback registration function
- * @pre You have to register a callback using recorder_set_recording_limit_reached_cb().
- * @see recorder_set_recording_status_cb()
- * @see recorder_set_recording_limit_reached_cb()
- * @see recorder_unset_recording_limit_reached_cb()
+ * @pre You have to register a callback using legacy_recorder_set_recording_limit_reached_cb().
+ * @see legacy_recorder_set_recording_status_cb()
+ * @see legacy_recorder_set_recording_limit_reached_cb()
+ * @see legacy_recorder_unset_recording_limit_reached_cb()
  */
 typedef void (*recorder_recording_limit_reached_cb)(recorder_recording_limit_type_e type, void *user_data);
 
@@ -207,10 +207,10 @@ typedef void (*recorder_recording_limit_reached_cb)(recorder_recording_limit_typ
  * @param[in] elapsed_time  The time of the recording (milliseconds)
  * @param[in] file_size     The size of the recording file (KB)
  * @param[in] user_data     The user data passed from the callback registration function
- * @pre recorder_start() will invoke this callback if you register it using recorder_set_recording_status_cb().
- * @see        recorder_set_recording_status_cb()
- * @see        recorder_unset_recording_status_cb()
- * @see        recorder_start()
+ * @pre legacy_recorder_start() will invoke this callback if you register it using legacy_recorder_set_recording_status_cb().
+ * @see        legacy_recorder_set_recording_status_cb()
+ * @see        legacy_recorder_unset_recording_status_cb()
+ * @see        legacy_recorder_start()
  */
 typedef void (*recorder_recording_status_cb)(unsigned long long elapsed_time, unsigned long long file_size, void *user_data);
 
@@ -221,14 +221,14 @@ typedef void (*recorder_recording_status_cb)(unsigned long long elapsed_time, un
  * @param[in] current  The current state of the recorder
  * @param[in] by_policy     @c true if the state is changed by policy, otherwise @c false if the state is not changed
  * @param[in] user_data        The user data passed from the callback registration function
- * @pre This function is required to register a callback using recorder_set_state_changed_cb().
- * @see        recorder_set_state_changed_cb()
- * @see        recorder_prepare()
- * @see        recorder_unprepare()
- * @see        recorder_start()
- * @see        recorder_pause()
- * @see        recorder_commit()
- * @see        recorder_cancel()
+ * @pre This function is required to register a callback using legacy_recorder_set_state_changed_cb().
+ * @see        legacy_recorder_set_state_changed_cb()
+ * @see        legacy_recorder_prepare()
+ * @see        legacy_recorder_unprepare()
+ * @see        legacy_recorder_start()
+ * @see        legacy_recorder_pause()
+ * @see        legacy_recorder_commit()
+ * @see        legacy_recorder_cancel()
  */
 typedef void (*recorder_state_changed_cb)(recorder_state_e previous, recorder_state_e current, bool by_policy, void *user_data);
 
@@ -239,7 +239,7 @@ typedef void (*recorder_state_changed_cb)(recorder_state_e previous, recorder_st
  * @param[in] previous      The previous state of the recorder
  * @param[in] current       The current state of the recorder
  * @param[in] user_data     The user data passed from the callback registration function
- * @see        recorder_set_interrupted_cb()
+ * @see        legacy_recorder_set_interrupted_cb()
  */
 typedef void (*recorder_interrupted_cb)(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data);
 
@@ -248,16 +248,29 @@ typedef void (*recorder_interrupted_cb)(recorder_policy_e policy, recorder_state
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks The callback function holds the same buffer that will be recorded. \n
  *          So if the user changes the buffer, the result file will contain the buffer.
- * @remarks The callback is called via internal thread of Frameworks, therefore do not invoke UI API, recorder_unprepare(), recorder_commit() and recorder_cancel() in callback.
+ * @remarks The callback is called via internal thread of Frameworks, therefore do not invoke UI API, legacy_recorder_unprepare(), legacy_recorder_commit() and legacy_recorder_cancel() in callback.
  * @param[in] stream The audio stream data
  * @param[in] size The size of the stream data
  * @param[in] format The audio format
  * @param[in] channel The number of the channel
  * @param[in] timestamp The timestamp of the stream buffer (in msec)
  * @param[in] user_data The user data passed from the callback registration function
- * @see recorder_set_audio_stream_cb()
+ * @see legacy_recorder_set_audio_stream_cb()
  */
-typedef void (*recorder_audio_stream_cb)(void* stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data);
+typedef void (*recorder_audio_stream_cb)(void *stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data);
+
+/**
+ * @brief Called when muxed stream data was being delivered just before storing in the recorded file.
+ * @since_tizen 4.0
+ * @remarks The callback function holds the same buffer that will be recorded, \n
+ *          but there is no effect on recorded file although user changes data in callback.
+ * @param[in] stream The muxed stream data
+ * @param[in] size The size of the stream data
+ * @param[in] offset The offset of the stream data
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see legacy_recorder_set_muxed_stream_cb()
+ */
+typedef void (*recorder_muxed_stream_cb)(void *stream, int size, unsigned long long offset, void *user_data);
 
 /**
  * @brief Called once for each supported video resolution.
@@ -267,7 +280,7 @@ typedef void (*recorder_audio_stream_cb)(void* stream, int size, audio_sample_ty
  * @param[in] user_data     The user data passed from the foreach function
  * @return    @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
  * @pre        recorder_foreach_supported_video_resolution() will invoke this callback.
- * @see        recorder_foreach_supported_video_resolution()
+ * @see        legacy_recorder_foreach_supported_video_resolution()
  */
 typedef bool (*recorder_supported_video_resolution_cb)(int width, int height, void *user_data);
 
@@ -283,9 +296,9 @@ typedef bool (*recorder_supported_video_resolution_cb)(int width, int height, vo
  * @param[in] error          The error code
  * @param[in] current_state  The current state of the recorder
  * @param[in] user_data      The user data passed from the callback registration function
- * @pre        This callback function is invoked if you register this callback using recorder_set_error_cb().
- * @see        recorder_set_error_cb()
- * @see        recorder_unset_error_cb()
+ * @pre        This callback function is invoked if you register this callback using legacy_recorder_set_error_cb().
+ * @see        legacy_recorder_set_error_cb()
+ * @see        legacy_recorder_unset_error_cb()
  */
 typedef void (*recorder_error_cb)(recorder_error_e error, recorder_state_e current_state, void *user_data);
 
@@ -304,8 +317,8 @@ typedef void (*recorder_error_cb)(recorder_error_e error, recorder_state_e curre
  * @param[in] format   The format of recording files
  * @param[in] user_data        The user data passed from the foreach function
  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre recorder_foreach_supported_file_format() will invoke this callback.
- * @see        recorder_foreach_supported_file_format()
+ * @pre legacy_recorder_foreach_supported_file_format() will invoke this callback.
+ * @see        legacy_recorder_foreach_supported_file_format()
  */
 typedef bool (*recorder_supported_file_format_cb)(recorder_file_format_e format, void *user_data);
 
@@ -315,8 +328,8 @@ typedef bool (*recorder_supported_file_format_cb)(recorder_file_format_e format,
  * @param[in] codec    The codec of audio encoder
  * @param[in] user_data        The user data passed from the foreach function
  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre recorder_foreach_supported_audio_encoder() will invoke this callback.
- * @see        recorder_foreach_supported_audio_encoder()
+ * @pre legacy_recorder_foreach_supported_audio_encoder() will invoke this callback.
+ * @see        legacy_recorder_foreach_supported_audio_encoder()
  */
 typedef bool (*recorder_supported_audio_encoder_cb)(recorder_audio_codec_e codec, void *user_data);
 
@@ -326,8 +339,8 @@ typedef bool (*recorder_supported_audio_encoder_cb)(recorder_audio_codec_e codec
  * @param[in] codec    The codec of video encoder
  * @param[in] user_data        The user data passed from the foreach function
  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre recorder_foreach_supported_video_encoder() will invoke this callback.
- * @see        recorder_foreach_supported_video_encoder()
+ * @pre legacy_recorder_foreach_supported_video_encoder() will invoke this callback.
+ * @see        legacy_recorder_foreach_supported_video_encoder()
  */
 typedef bool (*recorder_supported_video_encoder_cb)(recorder_video_codec_e codec, void *user_data);
 
@@ -345,7 +358,7 @@ typedef bool (*recorder_supported_video_encoder_cb)(recorder_video_codec_e codec
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @privlevel public
  * @privilege %http://tizen.org/privilege/recorder
- * @remarks You must release @a recorder using recorder_destroy(). \n
+ * @remarks You must release @a recorder using legacy_recorder_destroy(). \n
  * The @a camera handle also could be used for capturing images. \n
  * If the camera state was #CAMERA_STATE_CREATED, the preview format will be changed to the recommended preview format for recording.
  * @remarks The created recorder state will be different according to camera state : \n
@@ -362,9 +375,9 @@ typedef bool (*recorder_supported_video_encoder_cb)(recorder_video_codec_e codec
  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_create()
- * @see camera_stop_preview()
- * @see recorder_destroy()
+ * @see legacy_camera_create()
+ * @see legacy_camera_stop_preview()
+ * @see legacy_recorder_destroy()
  */
 int legacy_recorder_create_videorecorder(camera_h camera, recorder_h *recorder);
 
@@ -373,7 +386,7 @@ int legacy_recorder_create_videorecorder(camera_h camera, recorder_h *recorder);
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @privlevel public
  * @privilege %http://tizen.org/privilege/recorder
- * @remarks You must release @a recorder using recorder_destroy().
+ * @remarks You must release @a recorder using legacy_recorder_destroy().
  * @param[out]  recorder  A handle to the recorder
  * @return @c 0 on success, otherwise a negative error value
  * @retval #RECORDER_ERROR_NONE Successful
@@ -384,7 +397,7 @@ int legacy_recorder_create_videorecorder(camera_h camera, recorder_h *recorder);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @post The recorder state will be #RECORDER_STATE_CREATED.
- * @see recorder_destroy()
+ * @see legacy_recorder_destroy()
  */
 int legacy_recorder_create_audiorecorder(recorder_h *recorder);
 
@@ -406,8 +419,8 @@ int legacy_recorder_create_audiorecorder(recorder_h *recorder);
  * @pre  The recorder state should be #RECORDER_STATE_CREATED.
  * @post The recorder state will be #RECORDER_STATE_NONE.
  * @see        camera_destroy()
- * @see        recorder_create_videorecorder()
- * @see        recorder_create_audiorecorder()
+ * @see        legacy_recorder_create_videorecorder()
+ * @see        legacy_recorder_create_audiorecorder()
  */
 int legacy_recorder_destroy(recorder_h recorder);
 
@@ -430,12 +443,12 @@ int legacy_recorder_destroy(recorder_h recorder);
  * @pre  The recorder state should be #RECORDER_STATE_CREATED by legacy_recorder_create_videorecorder(), legacy_recorder_create_audiorecorder() or legacy_recorder_unprepare().
  * @post The recorder state will be #RECORDER_STATE_READY.
  * @post If recorder handle is created by legacy_recorder_create_videorecorder(), the camera state will be changed to #CAMERA_STATE_PREVIEW.
- * @see        recorder_create_videorecorder()
- * @see        recorder_create_audiorecorder()
- * @see        recorder_unprepare()
- * @see        recorder_set_audio_encoder()
- * @see        recorder_set_video_encoder()
- * @see        recorder_set_file_format()
+ * @see        legacy_recorder_create_videorecorder()
+ * @see        legacy_recorder_create_audiorecorder()
+ * @see        legacy_recorder_unprepare()
+ * @see        legacy_recorder_set_audio_encoder()
+ * @see        legacy_recorder_set_video_encoder()
+ * @see        legacy_recorder_set_file_format()
  */
 int legacy_recorder_prepare(recorder_h recorder);
 
@@ -455,9 +468,9 @@ int legacy_recorder_prepare(recorder_h recorder);
  * @pre  The recorder state should be #RECORDER_STATE_READY set by legacy_recorder_prepare(), legacy_recorder_cancel() or legacy_recorder_commit().
  * @post The recorder state will be #RECORDER_STATE_CREATED.
  * @post If the recorder handle is created by legacy_recorder_create_videorecorder(), camera state will be changed to #CAMERA_STATE_CREATED.
- * @see        recorder_prepare()
- * @see        recorder_cancel()
- * @see        recorder_commit()
+ * @see        legacy_recorder_prepare()
+ * @see        legacy_recorder_cancel()
+ * @see        legacy_recorder_commit()
  */
 int legacy_recorder_unprepare(recorder_h recorder);
 
@@ -484,14 +497,14 @@ int legacy_recorder_unprepare(recorder_h recorder);
  * @pre The recorder state must be #RECORDER_STATE_READY by legacy_recorder_prepare() or #RECORDER_STATE_PAUSED by legacy_recorder_pause(). \n
  *      The filename should be set by legacy_recorder_set_filename().
  * @post The recorder state will be #RECORDER_STATE_RECORDING.
- * @see        recorder_pause()
- * @see        recorder_commit()
- * @see        recorder_cancel()
- * @see        recorder_set_audio_encoder()
- * @see        recorder_set_filename()
- * @see        recorder_set_file_format()
- * @see        recorder_recording_status_cb()
- * @see        recorder_set_filename()
+ * @see        legacy_recorder_pause()
+ * @see        legacy_recorder_commit()
+ * @see        legacy_recorder_cancel()
+ * @see        legacy_recorder_set_audio_encoder()
+ * @see        legacy_recorder_set_filename()
+ * @see        legacy_recorder_set_file_format()
+ * @see        legacy_recorder_recording_status_cb()
+ * @see        legacy_recorder_set_filename()
  */
 int legacy_recorder_start(recorder_h recorder);
 
@@ -538,7 +551,7 @@ int legacy_recorder_pause(recorder_h recorder);
  * @see legacy_recorder_pause()
  * @see legacy_recorder_cancel()
  * @see legacy_recorder_set_filename()
- * @see        recorder_start()
+ * @see        legacy_recorder_start()
  */
 int legacy_recorder_commit(recorder_h recorder);
 
@@ -611,7 +624,7 @@ int legacy_recorder_get_audio_level(recorder_h recorder, double *dB);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see        recorder_get_filename()
+ * @see        legacy_recorder_get_filename()
  */
 int legacy_recorder_set_filename(recorder_h recorder, const char *path);
 
@@ -626,7 +639,7 @@ int legacy_recorder_set_filename(recorder_h recorder, const char *path);
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_set_filename()
+ * @see        legacy_recorder_set_filename()
  */
 int legacy_recorder_get_filename(recorder_h recorder, char **path);
 
@@ -732,7 +745,7 @@ int legacy_recorder_foreach_supported_file_format(recorder_h recorder,
 /**
  * @brief Sets the audio codec for encoding an audio stream.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks You can get available audio encoders by using recorder_foreach_supported_audio_encoder(). \n
+ * @remarks You can get available audio encoders by using legacy_recorder_foreach_supported_audio_encoder(). \n
  *          If set to #RECORDER_AUDIO_CODEC_DISABLE, the audio track is not created in recording files.\n
  *          Since 2.3.1, it could be returned #RECORDER_ERROR_INVALID_OPERATION \n
  *          when it's audio recorder and its state is #RECORDER_STATE_READY \n
@@ -747,7 +760,7 @@ int legacy_recorder_foreach_supported_file_format(recorder_h recorder,
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation (Since 2.3.1)
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see        recorder_get_audio_encoder()
+ * @see        legacy_recorder_get_audio_encoder()
  * @see legacy_recorder_foreach_supported_audio_encoder()
  */
 int legacy_recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e codec);
@@ -762,7 +775,7 @@ int legacy_recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_set_audio_encoder()
+ * @see        legacy_recorder_set_audio_encoder()
  * @see legacy_recorder_foreach_supported_audio_encoder()
  */
 int legacy_recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_e *codec);
@@ -790,9 +803,9 @@ int legacy_recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @post  legacy_recorder_supported_audio_encoder_cb() will be invoked.
- * @see        recorder_set_audio_encoder()
- * @see        recorder_get_audio_encoder()
- * @see        recorder_supported_audio_encoder_cb()
+ * @see        legacy_recorder_set_audio_encoder()
+ * @see        legacy_recorder_get_audio_encoder()
+ * @see        legacy_recorder_supported_audio_encoder_cb()
  */
 int legacy_recorder_foreach_supported_audio_encoder(recorder_h recorder,
        recorder_supported_audio_encoder_cb foreach_cb, const char* codec_type, int format, void *user_data);
@@ -820,9 +833,9 @@ int legacy_recorder_foreach_supported_audio_encoder(recorder_h recorder,
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre    The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see        recorder_start()
- * @see        recorder_get_video_resolution()
- * @see        recorder_foreach_supported_video_resolution()
+ * @see        legacy_recorder_start()
+ * @see        legacy_recorder_get_video_resolution()
+ * @see        legacy_recorder_foreach_supported_video_resolution()
  */
 int legacy_recorder_set_video_resolution(recorder_h recorder, int width, int height);
 
@@ -837,8 +850,8 @@ int legacy_recorder_set_video_resolution(recorder_h recorder, int width, int hei
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_set_video_resolution()
- * @see        recorder_foreach_supported_video_resolution()
+ * @see        legacy_recorder_set_video_resolution()
+ * @see        legacy_recorder_foreach_supported_video_resolution()
  */
 int legacy_recorder_get_video_resolution(recorder_h recorder, int *width, int *height);
 
@@ -863,9 +876,9 @@ int legacy_recorder_get_video_resolution(recorder_h recorder, int *width, int *h
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @post       This function invokes legacy_recorder_supported_video_resolution_cb() repeatedly to retrieve each supported video resolution.
- * @see        recorder_set_video_resolution()
- * @see        recorder_get_video_resolution()
- * @see        recorder_supported_video_resolution_cb()
+ * @see        legacy_recorder_set_video_resolution()
+ * @see        legacy_recorder_get_video_resolution()
+ * @see        legacy_recorder_supported_video_resolution_cb()
  */
 int legacy_recorder_foreach_supported_video_resolution(recorder_h recorder,
        recorder_supported_video_resolution_cb foreach_cb, void *user_data);
@@ -882,7 +895,7 @@ int legacy_recorder_foreach_supported_video_resolution(recorder_h recorder,
 /**
  * @brief Sets the video codec for encoding video stream.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks You can get available video encoders by using recorder_foreach_supported_video_encoder().
+ * @remarks You can get available video encoders by using legacy_recorder_foreach_supported_video_encoder().
  * @param[in] recorder The handle to the media recorder
  * @param[in] codec    The video codec
  * @return @c 0 on success, otherwise a negative error value
@@ -892,7 +905,7 @@ int legacy_recorder_foreach_supported_video_resolution(recorder_h recorder,
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see recorder_get_video_encoder()
+ * @see legacy_recorder_get_video_encoder()
  * @see legacy_recorder_foreach_supported_video_encoder()
  */
 int legacy_recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e codec);
@@ -937,7 +950,7 @@ int legacy_recorder_get_video_encoder(recorder_h recorder, recorder_video_codec_
  * @post  legacy_recorder_supported_video_encoder_cb() will be invoked.
  * @see legacy_recorder_set_video_encoder()
  * @see legacy_recorder_get_video_encoder()
- * @see        recorder_supported_video_encoder_cb()
+ * @see        legacy_recorder_supported_video_encoder_cb()
  */
 int legacy_recorder_foreach_supported_video_encoder(recorder_h recorder,
        recorder_supported_video_encoder_cb foreach_cb, const char* codec_type, int format, void *user_data);
@@ -992,8 +1005,8 @@ int legacy_recorder_unset_state_changed_cb(recorder_h recorder);
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_unset_interrupted_cb()
- * @see        recorder_interrupted_cb()
+ * @see        legacy_recorder_unset_interrupted_cb()
+ * @see        legacy_recorder_interrupted_cb()
  */
 int legacy_recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb callback, void *user_data);
 
@@ -1006,7 +1019,7 @@ int legacy_recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_set_interrupted_cb()
+ * @see        legacy_recorder_set_interrupted_cb()
  */
 int legacy_recorder_unset_interrupted_cb(recorder_h recorder);
 
@@ -1027,8 +1040,8 @@ int legacy_recorder_unset_interrupted_cb(recorder_h recorder);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre        The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
- * @see        recorder_unset_audio_stream_cb()
- * @see        recorder_audio_stream_cb()
+ * @see        legacy_recorder_unset_audio_stream_cb()
+ * @see        legacy_recorder_audio_stream_cb()
  */
 int legacy_recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stream_cb callback, void* user_data);
 
@@ -1046,6 +1059,39 @@ int legacy_recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stre
 int legacy_recorder_unset_audio_stream_cb(recorder_h recorder);
 
 /**
+ * @brief Registers a callback function to be called when muxed stream data is being delivered.
+ * @since_tizen 4.0
+ * @remarks This callback function holds the same buffer that will be recorded, \n
+ *          but, there is no effect on recorded file although an user changes the data in callback.
+ * @param[in] recorder    The handle to the recorder
+ * @param[in] callback    The callback function to register
+ * @param[in] user_data   The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @pre        The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
+ * @see        legacy_recorder_unset_muxed_stream_cb()
+ * @see        legacy_recorder_muxed_stream_cb()
+ */
+int legacy_recorder_set_muxed_stream_cb(recorder_h recorder, recorder_muxed_stream_cb callback, void* user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen 4.0
+ * @param[in]  recorder        The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @pre        The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
+ * @see     legacy_recorder_set_muxed_stream_cb()
+ */
+int legacy_recorder_unset_muxed_stream_cb(recorder_h recorder);
+
+/**
  * @brief Registers a callback function to be invoked when the recording information changes.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @param[in]  recorder   The handle to the media recorder
@@ -1057,8 +1103,8 @@ int legacy_recorder_unset_audio_stream_cb(recorder_h recorder);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @post  legacy_recorder_recording_status_cb() will be invoked.
- * @see        recorder_unset_recording_status_cb()
- * @see        recorder_recording_status_cb()
+ * @see        legacy_recorder_unset_recording_status_cb()
+ * @see        legacy_recorder_recording_status_cb()
  */
 int legacy_recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_status_cb callback, void *user_data);
 
@@ -1071,7 +1117,7 @@ int legacy_recorder_set_recording_status_cb(recorder_h recorder, recorder_record
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_set_recording_status_cb()
+ * @see        legacy_recorder_set_recording_status_cb()
  */
 int legacy_recorder_unset_recording_status_cb(recorder_h recorder);
 
@@ -1087,10 +1133,10 @@ int legacy_recorder_unset_recording_status_cb(recorder_h recorder);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @post  legacy_recorder_recording_limit_reached_cb() will be invoked.
- * @see        recorder_unset_recording_limit_reached_cb()
- * @see        recorder_attr_set_size_limit()
- * @see        recorder_attr_set_time_limit()
- * @see        recorder_recording_limit_reached_cb()
+ * @see        legacy_recorder_unset_recording_limit_reached_cb()
+ * @see        legacy_recorder_attr_set_size_limit()
+ * @see        legacy_recorder_attr_set_time_limit()
+ * @see        legacy_recorder_recording_limit_reached_cb()
  */
 int legacy_recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_recording_limit_reached_cb callback, void *user_data);
 
@@ -1103,7 +1149,7 @@ int legacy_recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_set_recording_limit_reached_cb()
+ * @see        legacy_recorder_set_recording_limit_reached_cb()
  */
 int legacy_recorder_unset_recording_limit_reached_cb(recorder_h recorder);
 
@@ -1125,8 +1171,8 @@ int legacy_recorder_unset_recording_limit_reached_cb(recorder_h recorder);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @post       This function will invoke legacy_recorder_error_cb() when an asynchronous operation error occur.
- * @see        recorder_unset_error_cb()
- * @see        recorder_error_cb()
+ * @see        legacy_recorder_unset_error_cb()
+ * @see        legacy_recorder_error_cb()
  */
 int legacy_recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback, void *user_data);
 
@@ -1140,7 +1186,7 @@ int legacy_recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback
  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_set_error_cb()
+ * @see        legacy_recorder_set_error_cb()
  */
 int legacy_recorder_unset_error_cb(recorder_h recorder);
 
@@ -1169,8 +1215,8 @@ int legacy_recorder_unset_error_cb(recorder_h recorder);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see        recorder_attr_get_size_limit()
- * @see        recorder_attr_set_time_limit()
+ * @see        legacy_recorder_attr_get_size_limit()
+ * @see        legacy_recorder_attr_set_time_limit()
  */
 int legacy_recorder_attr_set_size_limit(recorder_h recorder, int kbyte);
 
@@ -1185,8 +1231,8 @@ int legacy_recorder_attr_set_size_limit(recorder_h recorder, int kbyte);
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_size_limit()
- * @see        recorder_attr_get_time_limit()
+ * @see        legacy_recorder_attr_set_size_limit()
+ * @see        legacy_recorder_attr_get_time_limit()
  */
 int legacy_recorder_attr_get_size_limit(recorder_h recorder, int *kbyte);
 
@@ -1204,8 +1250,8 @@ int legacy_recorder_attr_get_size_limit(recorder_h recorder, int *kbyte);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see        recorder_attr_get_time_limit()
- * @see        recorder_attr_set_size_limit()
+ * @see        legacy_recorder_attr_get_time_limit()
+ * @see        legacy_recorder_attr_set_size_limit()
  */
 int legacy_recorder_attr_set_time_limit(recorder_h recorder, int second);
 
@@ -1221,8 +1267,8 @@ int legacy_recorder_attr_set_time_limit(recorder_h recorder, int second);
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_time_limit()
- * @see        recorder_attr_get_size_limit()
+ * @see        legacy_recorder_attr_set_time_limit()
+ * @see        legacy_recorder_attr_get_size_limit()
  */
 int legacy_recorder_attr_get_time_limit(recorder_h recorder, int *second);
 
@@ -1239,7 +1285,7 @@ int legacy_recorder_attr_get_time_limit(recorder_h recorder, int *second);
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
- * @see        recorder_attr_get_audio_device()
+ * @see        legacy_recorder_attr_get_audio_device()
  */
 int legacy_recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_device_e device);
 
@@ -1253,7 +1299,7 @@ int legacy_recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_de
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_audio_device()
+ * @see        legacy_recorder_attr_set_audio_device()
  */
 int legacy_recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e *device);
 
@@ -1270,7 +1316,7 @@ int legacy_recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_de
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
- * @see        recorder_attr_get_audio_samplerate()
+ * @see        legacy_recorder_attr_get_audio_samplerate()
  */
 int legacy_recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate);
 
@@ -1284,7 +1330,7 @@ int legacy_recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerat
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_audio_samplerate()
+ * @see        legacy_recorder_attr_set_audio_samplerate()
  */
 int legacy_recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate);
 
@@ -1300,7 +1346,7 @@ int legacy_recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplera
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see        recorder_attr_get_audio_encoder_bitrate()
+ * @see        legacy_recorder_attr_get_audio_encoder_bitrate()
  */
 int legacy_recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitrate);
 
@@ -1316,7 +1362,7 @@ int legacy_recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitr
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see        recorder_attr_get_video_encoder_bitrate()
+ * @see        legacy_recorder_attr_get_video_encoder_bitrate()
  */
 int legacy_recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitrate);
 
@@ -1330,7 +1376,7 @@ int legacy_recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitr
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_audio_encoder_bitrate()
+ * @see        legacy_recorder_attr_set_audio_encoder_bitrate()
  */
 int legacy_recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate);
 
@@ -1344,7 +1390,7 @@ int legacy_recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bit
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_audio_encoder_bitrate()
+ * @see        legacy_recorder_attr_set_audio_encoder_bitrate()
  */
 int legacy_recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate);
 
@@ -1358,7 +1404,7 @@ int legacy_recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bit
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_is_muted()
+ * @see        legacy_recorder_attr_is_muted()
  */
 int legacy_recorder_attr_set_mute(recorder_h recorder, bool enable);
 
@@ -1373,7 +1419,7 @@ int legacy_recorder_attr_set_mute(recorder_h recorder, bool enable);
  * @exception #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @exception #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @exception #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_mute()
+ * @see        legacy_recorder_attr_set_mute()
  */
 bool legacy_recorder_attr_is_muted(recorder_h recorder);
 
@@ -1394,7 +1440,7 @@ bool legacy_recorder_attr_is_muted(recorder_h recorder);
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
- * @see        recorder_attr_get_recording_motion_rate()
+ * @see        legacy_recorder_attr_get_recording_motion_rate()
  */
 int legacy_recorder_attr_set_recording_motion_rate(recorder_h recorder, double rate);
 
@@ -1414,7 +1460,7 @@ int legacy_recorder_attr_set_recording_motion_rate(recorder_h recorder, double r
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_recording_motion_rate()
+ * @see        legacy_recorder_attr_set_recording_motion_rate()
  */
 int legacy_recorder_attr_get_recording_motion_rate(recorder_h recorder, double *rate);
 
@@ -1433,7 +1479,7 @@ int legacy_recorder_attr_get_recording_motion_rate(recorder_h recorder, double *
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
- * @see        recorder_attr_get_audio_channel()
+ * @see        legacy_recorder_attr_get_audio_channel()
  */
 int legacy_recorder_attr_set_audio_channel(recorder_h recorder, int channel_count);
 
@@ -1447,7 +1493,7 @@ int legacy_recorder_attr_set_audio_channel(recorder_h recorder, int channel_coun
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_audio_channel()
+ * @see        legacy_recorder_attr_set_audio_channel()
  */
 int legacy_recorder_attr_get_audio_channel(recorder_h recorder, int *channel_count);
 
@@ -1462,9 +1508,9 @@ int legacy_recorder_attr_get_audio_channel(recorder_h recorder, int *channel_cou
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_get_orientation_tag()
+ * @see        legacy_recorder_attr_get_orientation_tag()
  */
-int legacy_recorder_attr_set_orientation_tag(recorder_h recorder,  recorder_rotation_e orientation);
+int legacy_recorder_attr_set_orientation_tag(recorder_h recorder, recorder_rotation_e orientation);
 
 /**
  * @brief Gets the video orientation in a video metadata tag.
@@ -1476,7 +1522,7 @@ int legacy_recorder_attr_set_orientation_tag(recorder_h recorder,  recorder_rota
  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
- * @see        recorder_attr_set_orientation_tag()
+ * @see        legacy_recorder_attr_set_orientation_tag()
  */
 int legacy_recorder_attr_get_orientation_tag(recorder_h recorder, recorder_rotation_e *orientation);
 
index eceacc7..cc1ca8e 100644 (file)
@@ -36,6 +36,7 @@ typedef enum {
        _RECORDER_EVENT_TYPE_RECORDING_STATUS,
        _RECORDER_EVENT_TYPE_INTERRUPTED,
        _RECORDER_EVENT_TYPE_AUDIO_STREAM,
+       _RECORDER_EVENT_TYPE_MUXED_STREAM,
        _RECORDER_EVENT_TYPE_ERROR,
        _RECORDER_EVENT_TYPE_NUM
 } _recorder_event_e;
index e11d359..2243a03 100644 (file)
@@ -49,6 +49,7 @@ int _camera_set_use(camera_h camera, bool used);
  */
 
 static int __mm_audio_stream_cb(MMCamcorderAudioStreamDataType *stream, void *user_param);
+static int __mm_muxed_stream_cb(MMCamcorderMuxedStreamDataType *stream, void *user_param);
 static int __mm_recorder_msg_cb(int message, void *param, void *user_data);
 
 
@@ -381,19 +382,48 @@ static int __mm_recorder_msg_cb(int message, void *param, void *user_data)
 
 static int __mm_audio_stream_cb(MMCamcorderAudioStreamDataType *stream, void *user_param)
 {
-       if (user_param == NULL || stream == NULL)
+       recorder_s *handle = NULL;
+       audio_sample_type_e format = AUDIO_SAMPLE_TYPE_U8;
+       int type = _RECORDER_EVENT_TYPE_AUDIO_STREAM;
+
+       if (!user_param || !stream) {
+               LOGE("NULL parameter %p %p", user_param, stream);
                return 0;
+       }
 
-       recorder_s *handle = (recorder_s *)user_param;
-       audio_sample_type_e format = AUDIO_SAMPLE_TYPE_U8;
+       handle = (recorder_s *)user_param;
 
        if (stream->format == MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE)
                format = AUDIO_SAMPLE_TYPE_S16_LE;
 
-       if (handle->user_cb[_RECORDER_EVENT_TYPE_AUDIO_STREAM]) {
-               ((recorder_audio_stream_cb)(handle->user_cb[_RECORDER_EVENT_TYPE_AUDIO_STREAM]))(stream->data, stream->length, format,
-                       stream->channel, stream->timestamp,
-                       handle->user_data[_RECORDER_EVENT_TYPE_AUDIO_STREAM]);
+       if (handle->user_cb[type]) {
+               ((recorder_audio_stream_cb)(handle->user_cb[type]))(stream->data, stream->length, format,
+                       stream->channel, stream->timestamp, handle->user_data[type]);
+       } else {
+               LOGW("audio_stream_cb is NULL");
+       }
+
+       return 1;
+}
+
+
+static int __mm_muxed_stream_cb(MMCamcorderMuxedStreamDataType *stream, void *user_param)
+{
+       recorder_s *handle = NULL;
+       int type = _RECORDER_EVENT_TYPE_MUXED_STREAM;
+
+       if (!user_param || !stream) {
+               LOGE("NULL parameter %p %p", user_param, stream);
+               return 0;
+       }
+
+       handle = (recorder_s *)user_param;
+
+       if (handle->user_cb[type]) {
+               ((recorder_muxed_stream_cb)(handle->user_cb[type]))(stream->data, stream->length,
+                       stream->offset, handle->user_data[type]);
+       } else {
+               LOGW("muxed_stream_cb is NULL");
        }
 
        return 1;
@@ -581,9 +611,9 @@ int legacy_recorder_create_videorecorder(camera_h camera, recorder_h *recorder)
                handle->camera_device_count = camera_device_count;
        }
 
-       legacy_camera_lock(handle->mm_source.camera, true);
+       legacy_camera_lock(camera, true);
        _camera_set_use(camera, true);
-       legacy_camera_lock(handle->mm_source.camera, false);
+       legacy_camera_lock(camera, false);
 
        if (handle->state == RECORDER_STATE_CREATED) {
                ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
@@ -1227,6 +1257,60 @@ int legacy_recorder_unset_audio_stream_cb(recorder_h recorder)
 }
 
 
+int legacy_recorder_set_muxed_stream_cb(recorder_h recorder, recorder_muxed_stream_cb callback, void* user_data)
+{
+       int ret = MM_ERROR_NONE;
+       recorder_s *handle = (recorder_s *)recorder;
+       recorder_state_e state = RECORDER_STATE_NONE;
+
+       if (!recorder || !callback) {
+               LOGE("Invalid parameter %p %p", recorder, callback);
+               return RECORDER_ERROR_INVALID_PARAMETER;
+       }
+
+       legacy_recorder_get_state(recorder, &state);
+       if (state > RECORDER_STATE_READY) {
+               LOGE("Invalid state %d", state);
+               return RECORDER_ERROR_INVALID_STATE;
+       }
+
+       ret = mm_camcorder_set_muxed_stream_callback(handle->mm_handle, __mm_muxed_stream_cb, handle);
+       if (ret == MM_ERROR_NONE) {
+               handle->user_cb[_RECORDER_EVENT_TYPE_MUXED_STREAM] = callback;
+               handle->user_data[_RECORDER_EVENT_TYPE_MUXED_STREAM] = user_data;
+       }
+
+       return __convert_recorder_error_code(__func__, ret);
+}
+
+
+int legacy_recorder_unset_muxed_stream_cb(recorder_h recorder)
+{
+       int ret = MM_ERROR_NONE;
+       recorder_s *handle = (recorder_s *)recorder;
+       recorder_state_e state = RECORDER_STATE_NONE;
+
+       if (recorder == NULL) {
+               LOGE("NULL pointer handle");
+               return RECORDER_ERROR_INVALID_PARAMETER;
+       }
+
+       legacy_recorder_get_state(recorder, &state);
+       if (state > RECORDER_STATE_READY) {
+               LOGE("Invalid state %d", state);
+               return RECORDER_ERROR_INVALID_STATE;
+       }
+
+       ret = mm_camcorder_set_muxed_stream_callback(handle->mm_handle, NULL, NULL);
+       if (ret == MM_ERROR_NONE) {
+               handle->user_cb[_RECORDER_EVENT_TYPE_MUXED_STREAM] = NULL;
+               handle->user_data[_RECORDER_EVENT_TYPE_MUXED_STREAM] = NULL;
+       }
+
+       return __convert_recorder_error_code(__func__, ret);
+}
+
+
 int legacy_recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback, void *user_data)
 {
        recorder_s *handle = (recorder_s *)recorder;
index 0787a6e..6006b12 100644 (file)
@@ -98,6 +98,8 @@ typedef enum {
        MUSE_RECORDER_API_RETURN_BUFFER,
        MUSE_RECORDER_API_SET_SOUND_STREAM_INFO,
        MUSE_RECORDER_API_GET_DEVICE_STATE,
+       MUSE_RECORDER_API_SET_MUXED_STREAM_CB,
+       MUSE_RECORDER_API_UNSET_MUXED_STREAM_CB, /* 65 */
        MUSE_RECORDER_API_MAX
 } muse_recorder_api_e;
 
@@ -119,6 +121,7 @@ typedef enum {
        MUSE_RECORDER_EVENT_TYPE_RECORDING_STATUS,
        MUSE_RECORDER_EVENT_TYPE_INTERRUPTED,
        MUSE_RECORDER_EVENT_TYPE_AUDIO_STREAM,
+       MUSE_RECORDER_EVENT_TYPE_MUXED_STREAM,
        MUSE_RECORDER_EVENT_TYPE_ERROR,
        MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_AUDIO_ENCODER,
        MUSE_RECORDER_EVENT_TYPE_FOREACH_SUPPORTED_FILE_FORMAT,
index 6e4bdbf..e1c6054 100644 (file)
@@ -324,6 +324,91 @@ void _recorder_disp_audio_stream_cb(void* stream, int size, audio_sample_type_e
        return;
 }
 
+void _recorder_disp_muxed_stream_cb(void* stream, int size, unsigned long long offset, void *user_data)
+{
+       muse_module_h module = (muse_module_h)user_data;
+       muse_recorder_handle_s *muse_recorder = NULL;
+       muse_recorder_export_data *export_data = NULL;
+       int tbm_key = 0;
+       tbm_bo bo = NULL;
+       tbm_bo_handle bo_handle = {.ptr = NULL};
+
+       if (!module || !stream) {
+               LOGE("NULL data %p, %p", module, stream);
+               return;
+       }
+
+       muse_recorder = (muse_recorder_handle_s *)muse_core_ipc_get_handle(module);
+       if (!muse_recorder) {
+               LOGE("NULL handle");
+               return;
+       }
+
+       export_data = g_new0(muse_recorder_export_data, 1);
+       if (export_data == NULL) {
+               LOGE("alloc export_data failed");
+               return;
+       }
+
+       /*LOGD("Enter");*/
+
+       /* make tbm bo */
+       bo = tbm_bo_alloc(muse_recorder->bufmgr, size, TBM_BO_DEFAULT);
+       if (!bo) {
+               LOGE("bo alloc failed : bufmgr %p, size %d", muse_recorder->bufmgr, size);
+               goto _MUXED_STREAM_CB_ERROR;
+       }
+
+       bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
+       if (!bo_handle.ptr) {
+               LOGE("bo map Error!");
+               goto _MUXED_STREAM_CB_ERROR;
+       }
+
+       memcpy(bo_handle.ptr, stream, size);
+
+       tbm_bo_unmap(bo);
+
+       tbm_key = tbm_bo_export(bo);
+       if (tbm_key == 0) {
+               LOGE("Create key_info ERROR!!");
+               goto _MUXED_STREAM_CB_ERROR;
+       }
+
+       /* set bo info */
+       export_data->key = tbm_key;
+       export_data->bo = bo;
+
+       /* add bo info to list */
+       g_mutex_lock(&muse_recorder->list_lock);
+       muse_recorder->data_list = g_list_append(muse_recorder->data_list, (gpointer)export_data);
+       g_mutex_unlock(&muse_recorder->list_lock);
+
+       /* send message */
+       muse_recorder_msg_event3(MUSE_RECORDER_CB_EVENT,
+               MUSE_RECORDER_EVENT_TYPE_MUXED_STREAM,
+               MUSE_RECORDER_EVENT_CLASS_THREAD_SUB,
+               module,
+               INT, size,
+               INT, tbm_key,
+               INT64, offset);
+
+       return;
+
+_MUXED_STREAM_CB_ERROR:
+       if (bo) {
+               tbm_bo_unref(bo);
+               bo = NULL;
+       }
+
+       if (export_data) {
+               g_free(export_data);
+               export_data = NULL;
+       }
+
+       return;
+}
+
 void _recorder_disp_foreach_supported_video_resolution_cb(int width, int height, void *user_data)
 {
        muse_module_h module = (muse_module_h)user_data;
@@ -1047,14 +1132,11 @@ int recorder_dispatcher_set_audio_stream_cb(muse_module_h module)
        if (muse_recorder == NULL) {
                LOGE("NULL handle");
                ret = RECORDER_ERROR_INVALID_OPERATION;
-               muse_recorder_msg_return(api, class, ret, module);
-               return MUSE_RECORDER_ERROR_NONE;
+       } else {
+               ret = legacy_recorder_set_audio_stream_cb(muse_recorder->recorder_handle,
+                       (recorder_audio_stream_cb)_recorder_disp_audio_stream_cb, (void *)module);
        }
 
-       ret = legacy_recorder_set_audio_stream_cb(muse_recorder->recorder_handle,
-               (recorder_audio_stream_cb)_recorder_disp_audio_stream_cb,
-               (void *)module);
-
        muse_recorder_msg_return(api, class, ret, module);
 
        return MUSE_RECORDER_ERROR_NONE;
@@ -1071,12 +1153,10 @@ int recorder_dispatcher_unset_audio_stream_cb(muse_module_h module)
        if (muse_recorder == NULL) {
                LOGE("NULL handle");
                ret = RECORDER_ERROR_INVALID_OPERATION;
-               muse_recorder_msg_return(api, class, ret, module);
-               return MUSE_RECORDER_ERROR_NONE;
+       } else {
+               ret = legacy_recorder_unset_audio_stream_cb(muse_recorder->recorder_handle);
        }
 
-       ret = legacy_recorder_unset_audio_stream_cb(muse_recorder->recorder_handle);
-
        muse_recorder_msg_return(api, class, ret, module);
 
        return MUSE_RECORDER_ERROR_NONE;
@@ -2124,6 +2204,49 @@ int recorder_dispatcher_get_device_state(muse_module_h module)
 }
 
 
+int recorder_dispatcher_set_muxed_stream_cb(muse_module_h module)
+{
+       int ret = RECORDER_ERROR_NONE;
+       muse_recorder_api_e api = MUSE_RECORDER_API_SET_MUXED_STREAM_CB;
+       muse_recorder_api_class_e class = MUSE_RECORDER_API_CLASS_IMMEDIATE;
+       muse_recorder_handle_s *muse_recorder = NULL;
+
+       muse_recorder = (muse_recorder_handle_s *)muse_core_ipc_get_handle(module);
+       if (!muse_recorder) {
+               LOGE("NULL handle");
+               ret = RECORDER_ERROR_INVALID_OPERATION;
+       } else {
+               ret = legacy_recorder_set_muxed_stream_cb(muse_recorder->recorder_handle,
+                       (recorder_muxed_stream_cb)_recorder_disp_muxed_stream_cb, (void *)module);
+       }
+
+       muse_recorder_msg_return(api, class, ret, module);
+
+       return MUSE_RECORDER_ERROR_NONE;
+}
+
+
+int recorder_dispatcher_unset_muxed_stream_cb(muse_module_h module)
+{
+       int ret = RECORDER_ERROR_NONE;
+       muse_recorder_api_e api = MUSE_RECORDER_API_UNSET_MUXED_STREAM_CB;
+       muse_recorder_api_class_e class = MUSE_RECORDER_API_CLASS_IMMEDIATE;
+       muse_recorder_handle_s *muse_recorder = NULL;
+
+       muse_recorder = (muse_recorder_handle_s *)muse_core_ipc_get_handle(module);
+       if (!muse_recorder) {
+               LOGE("NULL handle");
+               ret = RECORDER_ERROR_INVALID_OPERATION;
+       } else {
+               ret = legacy_recorder_unset_muxed_stream_cb(muse_recorder->recorder_handle);
+       }
+
+       muse_recorder_msg_return(api, class, ret, module);
+
+       return MUSE_RECORDER_ERROR_NONE;
+}
+
+
 int (*dispatcher[MUSE_RECORDER_API_MAX]) (muse_module_h module) = {
        recorder_dispatcher_create, /* MUSE_RECORDER_API_CREATE */
        recorder_dispatcher_destroy, /* MUSE_RECORDER_API_DESTROY */
@@ -2188,7 +2311,9 @@ int (*dispatcher[MUSE_RECORDER_API_MAX]) (muse_module_h module) = {
        recorder_dispatcher_attr_set_root_directory, /* MUSE_RECORDER_API_ATTR_SET_ROOT_DIRECTORY */
        recorder_dispatcher_return_buffer, /* MUSE_RECORDER_API_RETURN_BUFFER */
        recorder_dispatcher_set_sound_stream_info, /* MUSE_RECORDER_API_SET_SOUND_STREAM_INFO */
-       recorder_dispatcher_get_device_state /* MUSE_RECORDER_API_GET_DEVICE_STATE */
+       recorder_dispatcher_get_device_state, /* MUSE_RECORDER_API_GET_DEVICE_STATE */
+       recorder_dispatcher_set_muxed_stream_cb, /* MUSE_RECORDER_API_SET_MUXED_STREAM_CB */
+       recorder_dispatcher_unset_muxed_stream_cb /* MUSE_RECORDER_API_UNSET_MUXED_STREAM_CB */
 };
 
 
index f9c5941..5058a01 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-recorder
 Summary:    A Recorder module for muse server
-Version:    0.2.34
+Version:    0.2.35
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0