PLAYER_ERROR_NOT_SUPPORTED_FILE = PLAYER_ERROR_CLASS | 0x03 , /**< Not supported file format */
PLAYER_ERROR_INVALID_URI = PLAYER_ERROR_CLASS | 0x04 , /**< Invalid URI */
PLAYER_ERROR_SOUND_POLICY = PLAYER_ERROR_CLASS | 0x05 , /**< Sound policy error */
- PLAYER_ERROR_CONNECTION_FAILED = PLAYER_ERROR_CLASS | 0x06 /**< Streaming connection failed */
+ PLAYER_ERROR_CONNECTION_FAILED = PLAYER_ERROR_CLASS | 0x06, /**< Streaming connection failed */
+ PLAYER_ERROR_VIDEO_CAPTURE_FAILED = PLAYER_ERROR_CLASS | 0x07 /**< Video capture failure */
} player_error_e;
/**
*/
typedef enum
{
- PLAYER_INTERRUPTED_BY_OTHER_APP = 0, /**< Interrupted by another application*/
- PLAYER_INTERRUPTED_BY_CALL_START, /**< Interrupted by incoming call*/
- PLAYER_INTERRUPTED_BY_CALL_END, /**< Interrupted by call ending*/
+ PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed*/
+ PLAYER_INTERRUPTED_BY_OTHER_APP, /**< Interrupted by another application*/
+ PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by incoming call*/
PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphone*/
PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by resource conflict*/
- PLAYER_INTERRUPTED_BY_ALARM_START, /**< Interrupted by alarm starting*/
- PLAYER_INTERRUPTED_BY_ALARM_END, /**< Interrupted by alarm ending*/
+ PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by alarm starting*/
} player_interrupted_code_e;
/**
PLAYER_DISPLAY_ROTATION_90, /**< Display is rotated 90 degrees */
PLAYER_DISPLAY_ROTATION_180, /**< Display is rotated 180 degrees */
PLAYER_DISPLAY_ROTATION_270, /**< Display is rotated 270 degrees */
- PLAYER_DISPLAY_ROTATION_FLIP_HORZ, /**< flip display horizontally */
- PLAYER_DISPLAY_ROTATION_FLIP_VERT, /**< flip display vertically */
} player_display_rotation_e;
/**
* @}
*/
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumerations of audio output device type.
+ */
+typedef enum{
+ SOUND_DEVICE_OUT_SPEAKER = 0x01<<8, /**< Device builtin speaker */
+ SOUND_DEVICE_OUT_RECEIVER = 0x02<<8, /**< Device builtin receiver */
+ SOUND_DEVICE_OUT_WIRED_ACCESSORY = 0x04<<8, /**< Wired output devices such as headphone, headset, and so on. */
+ SOUND_DEVICE_OUT_BT_SCO = 0x08<<8, /**< Bluetooth SCO device */
+ SOUND_DEVICE_OUT_BT_A2DP = 0x10<<8, /**< Bluetooth A2DP device */
+} sound_device_out_e;
+
+/**
+ * @brief Enumerations of 3D effect
+ */
+typedef enum{
+ AUDIO_EFFECT_3D_WIDE =1, /**< Wide mode */
+ AUDIO_EFFECT_3D_DYNAMIC, /**< Dynamic mode */
+ AUDIO_EFFECT_3D_SURROUND, /**< Surround mode */
+} audio_effect_3d_e;
+
+/**
+ * @brief
+ * Enumerations of equalizer effect
+ */
+typedef enum{
+ AUDIO_EFFECT_EQ_ROCK =1, /**< Rock mode */
+ AUDIO_EFFECT_EQ_JAZZ, /**< Jazz mode*/
+ AUDIO_EFFECT_EQ_LIVE, /**< Live mode*/
+ AUDIO_EFFECT_EQ_CLASSIC, /**< Classic mode*/
+ AUDIO_EFFECT_EQ_FULL_BASS, /**< Bass mode*/
+ AUDIO_EFFECT_EQ_FULL_BASS_AND_TREBLE, /**< Bass and Treble mode*/
+ AUDIO_EFFECT_EQ_DANCE, /**< Dance mode*/
+ AUDIO_EFFECT_EQ_POP, /**< Pop mode*/
+ AUDIO_EFFECT_EQ_FULL_TREBLE, /**< Treble mode*/
+ AUDIO_EFFECT_EQ_CLUB, /**< Club mode*/
+ AUDIO_EFFECT_EQ_PARTY, /**< Party mode*/
+ AUDIO_EFFECT_EQ_LARGE_HALL, /**< Large Hall mode*/
+ AUDIO_EFFECT_EQ_SOFT, /**< Soft mode*/
+ AUDIO_EFFECT_EQ_SOFT_ROCK, /**< Soft Rock mode*/
+} audio_effect_equalizer_e;
+
+/**
+ * @brief
+ * Enumerations of reverberation effect
+ */
+typedef enum{
+ AUDIO_EFFECT_REVERB_JAZZ_CLUB =1, /**< Jazz club mode */
+ AUDIO_EFFECT_REVERB_CONCERT_HALL, /**< Concert Hall mode*/
+ AUDIO_EFFECT_REVERB_STADIUM, /**< Stadium mode*/
+} audio_effect_reverb_e;
+
+/**
+ * @brief
+ * Enumerations of extra effect
+ */
+typedef enum{
+ AUDIO_EFFECT_EX_BASE =1, /**< Bass Enhancement effect */
+ AUDIO_EFFECT_EX_MUSIC_CLARITY, /**< Music clarity effect*/
+ AUDIO_EFFECT_EX_SURROUND, /**< 5.1 channel surround sound effect*/
+ AUDIO_EFFECT_EX_SOUND_EXTERNAL, /**< Sound externalization effect*/
+} audio_effect_extra_e;
+
+/**
+ * @}
+ */
+
+
/**
* @addtogroup CAPI_MEDIA_PLAYER_MODULE
* @{
/**
* @brief Called when the media player is started.
+ * @details It will be invoked when player has reached the begin of stream
* @param[in] user_data The user data passed from the callback registration function
+ * @pre The player state should be #PLAYER_STATE_READY
* @pre player_start() will cause this callback if you register this callback using player_set_started_cb()
* @see player_start()
* @see player_set_started_cb()
/**
* @brief Called when the media player is completed.
+ * @details It will be invoked when player has reached to the end of the stream.
* @param[in] user_data The user data passed from the callback registration function
* @pre It will be invoked when playback completed if you register this callback using player_set_completed_cb()
* @see player_set_completed_cb()
/**
* @brief Called when the video is captured.
* @remarks The color space format of the captured image is #IMAGE_UTIL_COLORSPACE_RGB888.
- * @remarks @a data must be released with @c free() by you.
* @param[in] data The captured image buffer
* @param[in] width The width of captured image
* @param[in] height The height of captured image
*/
typedef void (*player_video_captured_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data);
+/**
+ * @brief Called when the video frame is decoded.
+ * @param[in] data The decoded video frame data
+ * @param[in] width The width of video frame
+ * @param[in] height The height of video frame
+ * @param[in] size The size of video frame
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see player_set_video_frame_decoded_cb()
+ * @see player_unset_video_frame_decoded_cb()
+ */
+typedef void (*player_video_frame_decoded_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data);
+
+/**
+ * @brief Called when the audio frame is decoded.
+ * @param[in] data The decoded audio frame data
+ * @param[in] size The size of audio frame
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see player_set_audio_frame_decoded_cb()
+ * @see player_unset_audio_frame_decoded_cb()
+ */
+typedef void (*player_audio_frame_decoded_cb)(unsigned char *data, unsigned int size, void *user_data);
+
/**
* @brief Creates a player handle for playing multimedia content.
* @remarks @a player must be released player_destroy() by you.
* @brief Starts or resumes playback, asynchronously.
*
* @details Plays current media content, or resumes play if paused.
- *
+ *
* @param[in] player The handle to media player
* @return 0 on success, otherwise a negative error value.
* @retval #PLAYER_ERROR_NONE Successful
* @pre Call player_prepare() before calling this function.
* @pre The player state must be #PLAYER_STATE_READY by player_prepare() or #PLAYER_STATE_PAUSED by player_pause().
* @post The player state will be #PLAYER_STATE_PLAYING.
- * @post It invokes player_started_cb() when playback starts, if you set a callback with player_set_started_cb().
+ * @post It invokes player_started_cb() when playback starts(not resume), if you set a callback with player_set_started_cb().
* @post It invokes player_completed_cb() when playback completes, if you set a callback with player_set_completed_cb().
* @see player_prepare()
* @see player_stop()
/**
* @brief Sets the video display.
+ * @remaks To get @a display to set, use #GET_DISPLAY().
* @param[in] player The handle to media player
* @param[in] type The display type
* @param[in] display The handle to display
*/
int player_set_display(player_h player, player_display_type_e type, player_display_h display);
+/**
+ * @brief Sets the playback rate
+ * @details The default value is 1.0.
+ * @remarks #PLAYER_ERROR_INVALID_OPERATION occured if streaming playbak.
+ * @remarks No operation is performed, if @a rate is 0.
+ * @remarks The sound is muted, when playback rate is under 0.0 and over 2.0.
+ * @param[in] player The handle to media player
+ * @param[in] rate The playback rate (-5.0x ~ 5.0x)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be #PLAYER_STATE_PLAYING by player_start().
+ */
+int player_set_playback_rate(player_h player, float rate);
+
/**
* @}
*/
*/
int player_get_x11_display_mode(player_h player, player_display_mode_e *mode);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets a audio effect output device.
+ * @remarks Both #SOUND_DEVICE_OUT_RECEIVER and #SOUND_DEVICE_OUT_BT_SCO output devices are not supported. It occurs #PLAYER_ERROR_INVALID_OPERATION.
+ * @param[in] player The handle to media player
+ * @param[in] output The output device to apply audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_output(player_h player, sound_device_out_e output);
+
+/**
+ * @brief Sets a 3D audio effect.
+ * @remarks Equalizer, 3D and reverberation effects can be used together
+ * @param[in] player The handle to media player
+ * @param[in] effect The 3D audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_3d(player_h player, audio_effect_3d_e effect);
+
+/**
+ * @brief Sets an equalizer audio effect.
+ * @remarks Equalizer, 3D and reverberation effects can be used together
+ * @param[in] player The handle to media player
+ * @param[in] effect The equalizer audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_equalizer(player_h player, audio_effect_equalizer_e effect);
+
+/**
+ * @brief Sets an reverberation audio effect.
+ * @remarks Equalizer, 3D and reverberation effects can be used together
+ * @param[in] player The handle to media player
+ * @param[in] effect The reverberation audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_reverb(player_h player, audio_effect_reverb_e effect);
+
+
+/**
+ * @brief Sets an extra(Bass Enhancement, AEQ, Music clarity, 5.1 SRS circle surround, Wow HD, and Sound externalization) audio effect.
+ * @remarks Previous applied other effects(equalizer, 3D, reverberation) should be ignored.
+ * @param[in] player The handle to media player
+ * @param[in] effect The extra audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_extra(player_h player, audio_effect_extra_e effect);
+
+/**
+ * @brief Clears all audio effects.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_set_audio_effect_3d()
+ * @see player_set_audio_effect_equalizer()
+ * @see player_set_audio_effect_reverb()
+ * @see player_set_audio_effect_extra()
+ */
+int player_clear_audio_effect(player_h player);
+
/**
* @}
*/
* @post It invokes player_video_captured_cb() when capture completes, if you set a callback.
* @see player_video_captured_cb()
*/
-int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data);
+int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data);
+
+/**
+ * @brief Sets the cookie for streaming playback.
+ * @param[in] player The handle to media player
+ * @param[in] cookie The cookie to set
+ * @param[in] size The size of cookie
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ */
+int player_set_streaming_cookie(player_h player, const char *cookie, int size);
/**
* @brief Registers a callback function to be invoked when the playback starts.
/**
- * @brief Registers a callback function to be invoked when the playback is interrupted.
+ * @brief Registers a callback function to be invoked when the playback is interrupted or interrupt completed.
* @param[in] player The handle to media player
* @param[in] callback The callback function to register
* @param[in] user_data The user data to be passed to the callback function
* @see player_subtitle_updated_cb()
* @see player_set_subtitle_path()
*/
-int player_set_subtilte_updated_cb(player_h player, player_subtitle_updated_cb callback, void *user_data);
+int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb callback, void *user_data);
/**
* @brief Unregisters the callback function.
* @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
* @see player_set_subtitle_updated_cb()
*/
-int player_unset_subtilte_updated_cb(player_h player);
+int player_unset_subtitle_updated_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when video frame is decoded.
+ * @param[in] player The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The player state must be either #PLAYER_STATE_IDLE by player_create() or #PLAYER_STATE_READY by player_prepare().
+ * @post player_video_frame_decoded_cb() will be invoked
+ * @see player_unset_video_frame_decoded_cb()
+ * @see player_video_frame_decoded_cb()
+ */
+int player_set_video_frame_decoded_cb(player_h player, player_video_frame_decoded_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_video_frame_decoded_cb()
+ */
+int player_unset_video_frame_decoded_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when audio frame is decoded.
+ * @param[in] player The handle to media player
+ * @param[in] start The start position to decode.
+ * @param[in] end The end position to decode.
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The player state must be either #PLAYER_STATE_IDLE by player_create() or #PLAYER_STATE_READY by player_prepare().
+ * @post player_audio_frame_decoded_cb() will be invoked
+ * @see player_unset_audio_frame_decoded_cb()
+ * @see player_audio_frame_decoded_cb()
+ */
+int player_set_audio_frame_decoded_cb(player_h player, int start, int end ,player_audio_frame_decoded_cb callback, void *user_data);
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_audio_frame_decoded_cb()
+ */
+int player_unset_audio_frame_decoded_cb(player_h player);
/**
* @}
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
-* limitations under the License.
+* limitations under the License.
*/
#include <stdio.h>
#include <string.h>
#include <mm.h>
#include <mm_player.h>
+#include <mm_player_sndeffect.h>
#include <mm_player_internal.h>
#include <mm_types.h>
#include <player.h>
ret = PLAYER_ERROR_SOUND_POLICY;
msg = "PLAYER_ERROR_SOUND_POLICY";
break;
- }
+ }
LOGE("[%s] %s(0x%08x) : core fw error(0x%x)",func_name,msg, ret, code);
return ret;
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s * handle = (player_s *) player;
+ player_s * handle = (player_s *) player;
handle->user_cb[type] = callback;
handle->user_data[type] = user_data;
LOGI("[%s] Event type : %d ",__FUNCTION__, type);
- return PLAYER_ERROR_NONE;
+ return PLAYER_ERROR_NONE;
}
static int __unset_callback(_player_event_e type, player_h player)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s * handle = (player_s *) player;
handle->user_cb[type] = NULL;
handle->user_data[type] = NULL;
LOGI("[%s] Event type : %d ",__FUNCTION__, type);
- return PLAYER_ERROR_NONE;
+ return PLAYER_ERROR_NONE;
}
static int __msg_callback(int message, void *param, void *user_data)
player_s * handle = (player_s*)user_data;
MMMessageParamType *msg = (MMMessageParamType*)param;
LOGI("[%s] Got message type : 0x%x" ,__FUNCTION__, message);
+ player_error_e err_code = PLAYER_ERROR_NONE;
switch(message)
{
- case MM_MESSAGE_ERROR: //0x01
- if( handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
- {
- ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(__convert_error_code(msg->code,(char*)__FUNCTION__),handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
- }
+ case MM_MESSAGE_ERROR: //0x01
+ err_code = __convert_error_code(msg->code,(char*)__FUNCTION__);
break;
case MM_MESSAGE_STATE_CHANGED: //0x03
handle->state = __convert_player_state(msg->state.current);
((player_paused_cb)handle->user_cb[_PLAYER_EVENT_TYPE_PAUSE])(handle->user_data[_PLAYER_EVENT_TYPE_PAUSE]);
}
break;
+ case MM_MESSAGE_READY_TO_RESUME: //0x05
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT] )
+ {
+ ((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(PLAYER_INTERRUPTED_COMPLETED,handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
+ }
+ break;
case MM_MESSAGE_BEGIN_OF_STREAM: //0x104
if( handle->user_cb[_PLAYER_EVENT_TYPE_BEGIN] )
{
case MM_MESSAGE_STATE_INTERRUPTED: //0x04
if( handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT] )
{
+ MMPlayerStateType currentStat = MM_PLAYER_STATE_PAUSED;
+ int ret = mm_player_get_state(handle->mm_handle, ¤tStat);
+ handle->state = (ret != MM_ERROR_NONE )? currentStat: __convert_player_state(currentStat);
((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(msg->code,handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
- }
- break;
+ }
+ break;
+ case MM_MESSAGE_CONNECTION_TIMEOUT: //0x102
+ LOGE("[%s] PLAYER_ERROR_CONNECTION_FAILED (0x%08x) : CONNECTION_TIMEOUT" ,__FUNCTION__, PLAYER_ERROR_CONNECTION_FAILED);
+ err_code = PLAYER_ERROR_CONNECTION_FAILED;
+ break;
case MM_MESSAGE_UPDATE_SUBTITLE: //0x109
if( handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE] )
{
((player_subtitle_updated_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE])(msg->subtitle.duration, (char*)msg->data,handle->user_data[_PLAYER_EVENT_TYPE_SUBTITLE]);
}
- break;
+ break;
+ case MM_MESSAGE_VIDEO_NOT_CAPTURED: //0x113
+ LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x)",__FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED);
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
+ {
+ ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(PLAYER_ERROR_VIDEO_CAPTURE_FAILED,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
+ }
+ break;
case MM_MESSAGE_VIDEO_CAPTURED: //0x110
if( handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] )
{
int w;
int h;
int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_VIDEO_WIDTH ,&w, MM_PLAYER_VIDEO_HEIGHT, &h, (char*)NULL);
- if(ret != MM_ERROR_NONE)
+ if(ret != MM_ERROR_NONE && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
+ {
+ LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x) : Failed to get video size on video captured (0x%x)" ,__FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED, ret);
+ err_code=PLAYER_ERROR_VIDEO_CAPTURE_FAILED;
+ }
+ else
{
- w=0;
- h=0;
- LOGI("[%s] Failed to get video size on video captured : 0x%x" ,__FUNCTION__, ret);
+ MMPlayerVideoCapture* capture = (MMPlayerVideoCapture *)msg->data;
+ ((player_video_captured_cb)handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE]);
+
+ if (capture->data)
+ {
+ g_free(capture->data);
+ capture->data = NULL;
+ }
}
- MMPlayerVideoCapture* capture = (MMPlayerVideoCapture *)msg->data;
- ((player_video_captured_cb)handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE]);
}
break;
+ case MM_MESSAGE_FILE_NOT_SUPPORTED: //0x10f
+ LOGE("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_SUPPORTED" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
+ err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+ break;
+ case MM_MESSAGE_FILE_NOT_FOUND: //0x110
+ LOGE("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_FOUND" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
+ err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+ break;
+ case MM_MESSAGE_DRM_NOT_AUTHORIZED: //0x111
+ LOGE("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : DRM_NOT_AUTHORIZED" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
+ err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+ break;
case MM_MESSAGE_UNKNOWN: //0x00
case MM_MESSAGE_WARNING: //0x02
- case MM_MESSAGE_READY_TO_RESUME: //0x05
case MM_MESSAGE_CONNECTING: //0x100
case MM_MESSAGE_CONNECTED: //0x101
- case MM_MESSAGE_CONNECTION_TIMEOUT: //0x102
case MM_MESSAGE_BLUETOOTH_ON: //0x106
case MM_MESSAGE_BLUETOOTH_OFF: //0x107
case MM_MESSAGE_RESUMED_BY_REW: //0x108
case MM_MESSAGE_RTP_SESSION_STATUS: //0x10c
case MM_MESSAGE_SENDER_STATE: //0x10d
case MM_MESSAGE_RECEIVER_STATE: //0x10e
- case MM_MESSAGE_FILE_NOT_SUPPORTED: //0x10f
- case MM_MESSAGE_FILE_NOT_FOUND: //0x110
- case MM_MESSAGE_DRM_NOT_AUTHORIZED: //0x111
- case MM_MESSAGE_VIDEO_NOT_CAPTURED: //0x113
case MM_MESSAGE_SEEK_COMPLETED: //0x114
default:
break;
}
-
+
+ if(err_code != PLAYER_ERROR_NONE && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])
+ {
+ ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(err_code,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
+ }
return 1;
}
+static bool __video_stream_callback(void *stream, int stream_size, void *user_data, int width, int height)
+{
+ player_s * handle = (player_s*)user_data;
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME] )
+ {
+ ((player_video_frame_decoded_cb)handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME])((unsigned char *)stream, width, height, stream_size, handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME]);
+ }
+ return TRUE;
+}
+
+static bool __audio_stream_callback(void *stream, int stream_size, void *user_data)
+{
+ player_s * handle = (player_s*)user_data;
+ if( handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] )
+ {
+ ((player_audio_frame_decoded_cb)handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME])((unsigned char *)stream, stream_size, handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME]);
+ }
+ return TRUE;
+}
+
+
/*
* Public Implementation
*/
{
PLAYER_INSTANCE_CHECK(player);
player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
int ret;
ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void*)handle);
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(uri);
player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
int ret = mm_player_set_attribute(handle->mm_handle, NULL,MM_PLAYER_CONTENT_URI , uri, strlen(uri), (char*)NULL);
if(ret != MM_ERROR_NONE)
return __convert_error_code(ret,(char*)__FUNCTION__);
}
else
- return PLAYER_ERROR_NONE;
+ return PLAYER_ERROR_NONE;
}
int player_get_state (player_h player, player_state_e *state)
{
PLAYER_INSTANCE_CHECK(player);
player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING);
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING);
int ret = mm_player_pause(handle->mm_handle);
if(ret != MM_ERROR_NONE)
{
PLAYER_INSTANCE_CHECK(player);
player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
handle->display_handle = display;
handle->display_type = type;
return PLAYER_ERROR_NONE;
}
+int player_set_playback_rate(player_h player, float rate)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(rate>=-5.0 && rate <= 5.0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING);
+
+ int ret = mm_player_set_play_speed(handle->mm_handle, rate);
+
+ switch (ret)
+ {
+ case MM_ERROR_NONE:
+ case MM_ERROR_PLAYER_NO_OP:
+ ret = PLAYER_ERROR_NONE;
+ break;
+ case MM_ERROR_NOT_SUPPORT_API:
+ case MM_ERROR_PLAYER_SEEK:
+ LOGE("[%s] %s(0x%08x)",__FUNCTION__, PLAYER_ERROR_INVALID_OPERATION,"PLAYER_ERROR_INVALID_OPERATION" );
+ ret = PLAYER_ERROR_INVALID_OPERATION;
+ break;
+ default:
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ return ret;
+}
+
int player_set_x11_display_rotation(player_h player, player_display_rotation_e rotation)
{
PLAYER_INSTANCE_CHECK(player);
}
}
+int player_set_audio_effect_output(player_h player, sound_device_out_e output)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ MMAudioFilterOutputMode _mode=MM_AUDIO_FILTER_OUTPUT_SPK;
+ switch(output)
+ {
+ case SOUND_DEVICE_OUT_SPEAKER:
+ _mode = MM_AUDIO_FILTER_OUTPUT_SPK;
+ break;
+ case SOUND_DEVICE_OUT_WIRED_ACCESSORY:
+ case SOUND_DEVICE_OUT_BT_A2DP:
+ _mode = MM_AUDIO_FILTER_OUTPUT_EAR;
+ break;
+ case SOUND_DEVICE_OUT_BT_SCO:
+ case SOUND_DEVICE_OUT_RECEIVER:
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION BT_SCO and RECEIVER doesn't supported( output : %d)" ,__FUNCTION__, output);
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ MMAudioFilterInfo filter;
+ memset(&filter, 0, sizeof(MMAudioFilterInfo));
+ filter.output_mode = _mode;
+ int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_audio_effect_3d(player_h player, audio_effect_3d_e effect)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ MMAudioFilterInfo filter;
+ memset(&filter, 0, sizeof(MMAudioFilterInfo));
+ filter.filter_type = MM_AUDIO_FILTER_3D;
+
+ switch(effect)
+ {
+ case AUDIO_EFFECT_3D_WIDE:
+ filter.sound_3d.mode = MM_3DSOUND_WIDE;
+ break;
+ case AUDIO_EFFECT_3D_DYNAMIC:
+ filter.sound_3d.mode = MM_3DSOUND_DYNAMIC;
+ break;
+ case AUDIO_EFFECT_3D_SURROUND:
+ filter.sound_3d.mode = MM_3DSOUND_SURROUND;
+ break;
+ }
+
+ int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_audio_effect_equalizer(player_h player, audio_effect_equalizer_e effect)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ MMAudioFilterInfo filter;
+ memset(&filter, 0, sizeof(MMAudioFilterInfo));
+ filter.filter_type = MM_AUDIO_FILTER_EQUALIZER;
+
+ switch(effect)
+ {
+ case AUDIO_EFFECT_EQ_ROCK:
+ filter.equalizer.mode = MM_EQ_ROCK;
+ break;
+ case AUDIO_EFFECT_EQ_JAZZ:
+ filter.equalizer.mode = MM_EQ_JAZZ;
+ break;
+ case AUDIO_EFFECT_EQ_LIVE:
+ filter.equalizer.mode = MM_EQ_LIVE;
+ break;
+ case AUDIO_EFFECT_EQ_CLASSIC:
+ filter.equalizer.mode = MM_EQ_CLASSIC;
+ break;
+ case AUDIO_EFFECT_EQ_FULL_BASS:
+ filter.equalizer.mode = MM_EQ_FULL_BASS;
+ break;
+ case AUDIO_EFFECT_EQ_FULL_BASS_AND_TREBLE:
+ filter.equalizer.mode = MM_EQ_FULL_BASS_AND_TREBLE;
+ break;
+ case AUDIO_EFFECT_EQ_DANCE:
+ filter.equalizer.mode = MM_EQ_DANCE;
+ break;
+ case AUDIO_EFFECT_EQ_POP:
+ filter.equalizer.mode = MM_EQ_POP;
+ break;
+ case AUDIO_EFFECT_EQ_FULL_TREBLE:
+ filter.equalizer.mode = MM_EQ_FULL_TREBLE;
+ break;
+ case AUDIO_EFFECT_EQ_CLUB:
+ filter.equalizer.mode = MM_EQ_CLUB;
+ break;
+ case AUDIO_EFFECT_EQ_PARTY:
+ filter.equalizer.mode = MM_EQ_PARTY;
+ break;
+ case AUDIO_EFFECT_EQ_LARGE_HALL:
+ filter.equalizer.mode = MM_EQ_LARGE_HALL;
+ break;
+ case AUDIO_EFFECT_EQ_SOFT:
+ filter.equalizer.mode = MM_EQ_SOFT;
+ break;
+ case AUDIO_EFFECT_EQ_SOFT_ROCK:
+ filter.equalizer.mode = MM_EQ_SOFT_ROCK;
+ break;
+ }
+
+ int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_audio_effect_reverb(player_h player, audio_effect_reverb_e effect)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ MMAudioFilterInfo filter;
+ memset(&filter, 0, sizeof(MMAudioFilterInfo));
+ filter.filter_type = MM_AUDIO_FILTER_REVERB;
+
+ switch(effect)
+ {
+ case AUDIO_EFFECT_REVERB_JAZZ_CLUB:
+ filter.reverb.mode = MM_REVERB_JAZZ_CLUB;
+ break;
+ case AUDIO_EFFECT_REVERB_CONCERT_HALL:
+ filter.reverb.mode = MM_REVERB_CONCERT_HALL;
+ break;
+ case AUDIO_EFFECT_REVERB_STADIUM:
+ filter.reverb.mode = MM_REVERB_STADIUM;
+ break;
+ }
+
+ int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_set_audio_effect_extra(player_h player, audio_effect_extra_e effect)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ MMAudioFilterInfo filter;
+ memset(&filter, 0, sizeof(MMAudioFilterInfo));
+
+ switch(effect)
+ {
+ case AUDIO_EFFECT_EX_BASE:
+ filter.filter_type = MM_AUDIO_FILTER_BE;
+ break;
+ case AUDIO_EFFECT_EX_MUSIC_CLARITY:
+ filter.filter_type = MM_AUDIO_FILTER_MC;
+ break;
+ case AUDIO_EFFECT_EX_SURROUND:
+ filter.filter_type = MM_AUDIO_FILTER_SRSCSHP;
+ break;
+ case AUDIO_EFFECT_EX_SOUND_EXTERNAL:
+ filter.filter_type = MM_AUDIO_FILTER_SOUND_EX;
+ break;
+ }
+
+ int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_clear_audio_effect(player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ MMAudioFilterInfo filter;
+ memset(&filter, 0, sizeof(MMAudioFilterInfo));
+ filter.filter_type = MM_AUDIO_FILTER_NONE;
+ int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
int player_get_video_size (player_h player, int *width, int *height)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(path);
player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
int ret = mm_player_set_attribute(handle->mm_handle, NULL,"subtitle_uri" , path, strlen(path),"subtitle_silent", 0, (char*)NULL);
if(ret != MM_ERROR_NONE)
}
}
+int player_set_streaming_cookie(player_h player, const char *cookie, int size)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(cookie);
+ PLAYER_CHECK_CONDITION(size>=0,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL,"streaming_cookie", cookie, size, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ return PLAYER_ERROR_NONE;
+}
+
int player_set_started_cb (player_h player, player_started_cb callback, void *user_data)
{
return __set_callback(_PLAYER_EVENT_TYPE_BEGIN,player,callback,user_data);
return __unset_callback(_PLAYER_EVENT_TYPE_BUFFERING,player);
}
-
-int player_set_subtilte_updated_cb(player_h player, player_subtitle_updated_cb callback, void* user_data )
+int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb callback, void* user_data )
{
return __set_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player,callback,user_data);
}
-int player_unset_subtilte_updated_cb (player_h player)
+int player_unset_subtitle_updated_cb (player_h player)
{
return __unset_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player);
}
+int player_set_video_frame_decoded_cb(player_h player, player_video_frame_decoded_cb callback, void *user_data)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+ player_s * handle = (player_s *) player;
+ if (handle->state != PLAYER_STATE_IDLE && handle->state != PLAYER_STATE_READY)
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+
+ handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = callback;
+ handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = user_data;
+ LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_VIDEO_FRAME);
+ int ret = mm_player_set_video_stream_callback(handle->mm_handle, __video_stream_callback, (void*)handle);
+ if(ret != MM_ERROR_NONE)
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_unset_video_frame_decoded_cb(player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = NULL;
+ handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = NULL;
+ LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_VIDEO_FRAME);
+ int ret = mm_player_set_video_stream_callback(handle->mm_handle, NULL, NULL);
+ if(ret != MM_ERROR_NONE)
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_set_audio_frame_decoded_cb(player_h player, int start, int end, player_audio_frame_decoded_cb callback, void *user_data)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+ PLAYER_CHECK_CONDITION(start>=0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+ PLAYER_CHECK_CONDITION(end>=1 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+ PLAYER_CHECK_CONDITION((end-start)>0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+ player_s * handle = (player_s *) player;
+ if (handle->state != PLAYER_STATE_IDLE && handle->state != PLAYER_STATE_READY)
+ {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+
+ handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = callback;
+ handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = user_data;
+ LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_AUDIO_FRAME);
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction",TRUE, "pcm_extraction_start_msec", start, "pcm_extraction_end_msec", end, NULL);
+ if(ret != MM_ERROR_NONE)
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+
+ ret = mm_player_set_audio_buffer_callback(handle->mm_handle, __audio_stream_callback, (void*)handle);
+ if(ret != MM_ERROR_NONE)
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ else
+ return PLAYER_ERROR_NONE;
+}
+
+int player_unset_audio_frame_decoded_cb(player_h player)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction",FALSE, NULL);
+ if(ret != MM_ERROR_NONE)
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+
+ handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = NULL;
+ handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = NULL;
+ LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_AUDIO_FRAME);
+
+ ret = mm_player_set_audio_buffer_callback(handle->mm_handle, NULL, NULL);
+ if(ret != MM_ERROR_NONE)
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ else
+ return PLAYER_ERROR_NONE;
+}