PLAYER_CONTENT_INFO_YEAR, /**< Year */
} player_content_info_e;
+/**
+ * @brief Default callback type
+ */
+typedef void (*legacy_player_default_callback)(muse_player_event_e type, void *user_data);
+
/**
* @brief Called when the subtitle is updated.
- * @since_tizen 2.3
- * @param[in] duration The duration of the updated subtitle
- * @param[in] text The text of the updated subtitle
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_set_subtitle_updated_cb()
- * @see legacy_player_unset_subtitle_updated_cb()
*/
typedef void (*player_subtitle_updated_cb)(unsigned long duration, char *text, void *user_data);
/**
* @brief Called when the media player is prepared.
- * @since_tizen 2.3
- * @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 legacy_player_prepare_async() will cause this callback.
- * @post The player state will be #PLAYER_STATE_READY.
* @see legacy_player_prepare_async()
*/
typedef void (*legacy_player_prepared_cb)(void *user_data);
-/**
- * @brief Called when the media player is completed.
- * @since_tizen 2.3
- * @details It will be invoked when player has reached the end of the stream.
- * @param[in] user_data The user data passed from the callback registration function
- * @pre It will be invoked when the playback is completed if you register this callback using legacy_player_set_completed_cb().
- * @see legacy_player_set_completed_cb()
- * @see legacy_player_unset_completed_cb()
- */
-typedef void (*player_completed_cb)(void *user_data);
-
-/**
- * @brief Called when the seek operation is completed.
- * @since_tizen 2.3
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_set_play_position()
- */
-typedef void (*player_seek_completed_cb)(void *user_data);
-
-/**
- * @brief Called when the media player is interrupted.
- * @since_tizen 2.3
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_set_interrupted_cb()
- * @see legacy_player_unset_interrupted_cb()
- */
-typedef void (*player_interrupted_cb)(void *user_data);
-
/**
* @brief Called when an error occurs in the media player.
- * @details Following error codes can be delivered.
- * #PLAYER_ERROR_INVALID_OPERATION
- * #PLAYER_ERROR_INVALID_STATE
- * #PLAYER_ERROR_INVALID_URI
- * #PLAYER_ERROR_CONNECTION_FAILED
- * #PLAYER_ERROR_DRM_NOT_PERMITTED
- * #PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE
- * #PLAYER_ERROR_NOT_SUPPORTED_FILE
- * #PLAYER_ERROR_SEEK_FAILED
- * #PLAYER_ERROR_SERVICE_DISCONNECTED
- * @since_tizen 2.3
- * @param[in] error_code The error code
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_set_error_cb()
- * @see legacy_player_unset_error_cb()
*/
typedef void (*player_error_cb)(int error_code, void *user_data);
/**
* @brief Called when the buffering percentage of the media playback is updated.
- * @since_tizen 2.3
- * @details If the buffer is full, it will return 100%.
- * @param[in] percent The percentage of buffering completed (0~100)
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_set_buffering_cb()
- * @see legacy_player_unset_buffering_cb()
*/
typedef void (*player_buffering_cb)(int percent, void *user_data);
/**
* @brief Called when the video is captured.
- * @since_tizen 2.3
- * @remarks The color space format of the captured image is IMAGE_UTIL_COLORSPACE_RGB888.
- * @param[in] data The captured image buffer
- * @param[in] width The width of the captured image
- * @param[in] height The height of the captured image
- * @param[in] size The size of the captured image
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_capture_video()
*/
typedef void (*player_video_captured_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data);
/**
* @brief Called to register for notifications about delivering video data when each video frame is decoded.
- * @param[in] video_data video decoded data
- * @param[in] user_data The user data passed from the callback registration function
*/
typedef bool (*legacy_player_media_packet_video_decoded_cb)(void *video_data, void *user_data);
/**
* @brief Called to register for notifications about delivering audio data when audio frame is decoded.
- * @param[in] audio_data audio decoded data
- * @param[in] user_data The user data passed from the callback registration function
*/
typedef bool (*legacy_player_media_packet_audio_decoded_cb)(void *audio_data, void *user_data);
/**
* @brief Called when the buffer level drops below the threshold of max size or no free space in buffer.
- * @since_tizen 2.4
- * @remarks This API is used for media stream playback only.
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_set_media_stream_buffer_status_cb()
- * @see legacy_player_set_media_stream_buffer_max_size()
- * @see legacy_player_set_media_stream_buffer_min_threshold()
*/
-typedef void (*player_media_stream_buffer_status_cb)(player_media_stream_buffer_status_e status, void *user_data);
+typedef void (*player_media_stream_buffer_status_cb)(muse_player_event_e type, player_media_stream_buffer_status_e status, void *user_data);
/**
* @brief Called to notify the next push-buffer offset when seeking is occurred.
- * @since_tizen 2.4
- * @remarks This API is used for media stream playback only.
- * @details The next push-buffer should produce buffers from the new offset.
- * @param[in] offset The new byte position to seek
- * @param[in] user_data The user data passed from the callback registration function
*/
-typedef void (*player_media_stream_seek_cb)(unsigned long long offset, void *user_data);
+typedef void (*player_media_stream_seek_cb)(muse_player_event_e type, unsigned long long offset, void *user_data);
/**
* @brief Called to notify the video stream changed.
- * @since_tizen 2.4
- * @details The video stream changing is detected just before rendering operation.
- * @param[in] width The width of the captured image
- * @param[in] height The height of the captured image
- * @param[in] fps The frame per second of the video \n
- * It can be @c 0 if there is no video stream information.
- * @param[in] bit_rate The video bit rate [Hz] \n
- * It can be an invalid value if there is no video stream information.
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_set_video_stream_changed_cb()
*/
typedef void (*player_video_stream_changed_cb)(int width, int height, int fps, int bit_rate, void *user_data);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-/**
- * @brief Called when the buffer needs to be released for gapless.
- * @since_tizen 4.0
- * @details It will be invoked when the player is under the construction for gapless.
- * @param[in] user_data The user data passed from the callback registration function
- * @pre It will be invoked when the playback is completed if you register this callback using legacy_player_set_completed_cb().
- * @see legacy_player_set_retrieve_buffer_cb()
- * @see legacy_player_unset_retrieve_buffer_cb()
- */
-typedef void (*player_retrieve_buffer_cb)(void *user_data);
-#endif
-
/**
* @brief Creates a player handle for playing multimedia content.
* @since_tizen 2.3
*/
int legacy_player_unprepare(legacy_player_h player);
+/**
+ * @brief Set and Unset the legacy player callback
+ */
+int legacy_player_set_callback(legacy_player_h player, muse_player_event_e type, void *callback, void *user_data);
+int legacy_player_unset_callback(legacy_player_h player, muse_player_event_e type);
+
/**
* @brief Sets the data source (file-path, HTTP or RSTP URI) to use.
*
/**
* @brief Starts or resumes playback.
- * @since_tizen 2.3
- * @remarks Sound can be mixed with other sounds if you don't control the stream focus in sound-manager module since 3.0.\n
- * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
- * @details Plays current media content, or resumes play if paused.
- *
- * @param[in] player The handle to the media player
- * @return @c 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
- * @retval #PLAYER_ERROR_CONNECTION_FAILED Network connection failed
- * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
- * @pre legacy_player_prepare() must be called before calling this function.
- * @pre The player state must be set to #PLAYER_STATE_READY by calling legacy_player_prepare() or set to #PLAYER_STATE_PAUSED by calling legacy_player_pause().
- * @post The player state will be #PLAYER_STATE_PLAYING.
- * @post It invokes legacy_player_completed_cb() when playback completes, if you set a callback with legacy_player_set_completed_cb().
- * @see legacy_player_prepare()
- * @see legacy_player_prepare_async()
- * @see legacy_player_stop()
- * @see legacy_player_pause()
- * @see legacy_player_set_completed_cb()
- * @see legacy_player_completed_cb()
*/
int legacy_player_start(legacy_player_h player);
* @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
* @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
* @pre The player state must be one of these: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
- * @post It invokes legacy_player_seek_completed_cb() when seek operation completes, if you set a callback.
* @see legacy_player_get_play_position()
*/
-int legacy_player_set_play_position(legacy_player_h player, int64_t nanoseconds, bool accurate, player_seek_completed_cb callback, void *user_data);
+int legacy_player_set_play_position(legacy_player_h player, int64_t nanoseconds, bool accurate, void *callback, void *user_data);
/**
* @brief Gets the current position in milliseconds.
int legacy_player_release_video_stream_bo(legacy_player_h player, void *bo);
-/**
- * @brief Registers a media packet video callback function to be called once per frame.
- * @remarks This function should be called before preparing. \n
- * A registered callback is called on the internal thread of the player. \n
- * A video frame can be retrieved using a registered callback.\n
- * The callback function holds the same buffer that will be drawn on the display device.\n
- * @param[in] player The handle to the media player
- * @param[in] callback The callback function to be registered
- * @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 #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
- * @pre The player's state should be #PLAYER_STATE_IDLE. And, #PLAYER_DISPLAY_TYPE_NONE should be set by calling legacy_player_set_display().
- */
-int legacy_player_set_media_packet_video_frame_decoded_cb(legacy_player_h player, legacy_player_media_packet_video_decoded_cb callback, void *user_data);
-
/**
* @brief Pushes elementary stream to decode audio or video
* @since_tizen 2.4
*/
int legacy_player_set_media_stream_info(legacy_player_h player, player_stream_type_e type, media_format_h format);
-/**
- * @brief Registers a callback function to be invoked when buffer underrun or overflow is occurred.
- * @since_tizen 2.4
- * @remarks This API is used for media stream playback only.
- * @param[in] player The handle to the media player
- * @param[in] type The type of target stream
- * @param[in] callback The buffer status 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 #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling legacy_player_create() or legacy_player_unprepare().
- * @post legacy_player_media_stream_buffer_status_cb() will be invoked.
- * @see legacy_player_unset_media_stream_buffer_status_cb()
- * @see legacy_player_media_stream_buffer_status_cb()
- */
-int legacy_player_set_media_stream_buffer_status_cb(legacy_player_h player, player_stream_type_e type, player_media_stream_buffer_status_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the buffer status callback function.
- * @since_tizen 2.4
- * @remarks This API is used for media stream playback only.
- * @param[in] player The handle to the media player
- * @param[in] type The type of target stream
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see legacy_player_set_media_stream_buffer_status_cb()
- */
-int legacy_player_unset_media_stream_buffer_status_cb(legacy_player_h player, player_stream_type_e type);
-
-/**
- * @brief Registers a callback function to be invoked when seeking is occurred.
- * @since_tizen 2.4
- * @remarks This API is used for media stream playback only.
- * @param[in] player The handle to the media player
- * @param[in] type The type of target stream
- * @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 #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling legacy_player_create() or legacy_player_unprepare().
- * @post legacy_player_media_stream_seek_cb() will be invoked.
- * @see legacy_player_unset_media_stream_seek_cb()
- * @see legacy_player_media_stream_seek_cb()
- */
-int legacy_player_set_media_stream_seek_cb(legacy_player_h player, player_stream_type_e type, player_media_stream_seek_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the seek callback function.
- * @since_tizen 2.4
- * @param[in] player The handle to the media player
- * @param[in] type The type of target stream
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see legacy_player_set_media_stream_seek_cb()
- */
-int legacy_player_unset_media_stream_seek_cb(legacy_player_h player, player_stream_type_e type);
-
/**
* @brief Sets the max size bytes of buffer.
* @since_tizen 2.4
*/
int legacy_player_get_streaming_download_progress(legacy_player_h player, int *start, int *end);
-/**
- * @brief Registers a callback function to be invoked when the playback is finished.
- * @since_tizen 2.3
- * @param[in] player The handle to the 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 @c 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
- * @post legacy_player_completed_cb() will be invoked.
- * @see legacy_player_unset_completed_cb()
- * @see legacy_player_completed_cb()
- * @see legacy_player_start()
- */
-int legacy_player_set_completed_cb(legacy_player_h player, player_completed_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function.
- * @since_tizen 2.3
- * @param[in] player The handle to the media player
- * @return @c 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 legacy_player_set_completed_cb()
- */
-int legacy_player_unset_completed_cb(legacy_player_h player);
-
-/**
- * @brief Registers a callback function to be invoked when the playback is interrupted or the interrupt is completed.
- * @since_tizen 2.3
- * @param[in] player The handle to the 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 @c 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
- * @post player_interrupted_cb() will be invoked.
- * @see legacy_player_unset_interrupted_cb()
- * @see legacy_player_interrupted_cb()
- */
-int legacy_player_set_interrupted_cb(legacy_player_h player, player_interrupted_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function.
- * @since_tizen 2.3
- * @param[in] player The handle to the media player
- * @return @c 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 legacy_player_set_interrupted_cb()
- */
-int legacy_player_unset_interrupted_cb(legacy_player_h player);
-
-/**
- * @brief Registers a callback function to be invoked when an error occurs.
- * @since_tizen 2.3
- * @param[in] player The handle to the 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 @c 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
- * @post legacy_player_error_cb() will be invoked.
- * @see legacy_player_unset_error_cb()
- * @see legacy_player_error_cb()
- */
-int legacy_player_set_error_cb(legacy_player_h player, player_error_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function.
- * @since_tizen 2.3
- * @param[in] player The handle to the media player
- * @return @c 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 legacy_player_set_error_cb()
- */
-int legacy_player_unset_error_cb(legacy_player_h player);
-
-/**
- * @brief Registers a callback function to be invoked when there is a change in the buffering status of a media stream.
- * @since_tizen 2.3
- * @remarks The media resource should be streamed over the network.
- * @param[in] player The handle to the 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 @c 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_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
- * @post legacy_player_buffering_cb() will be invoked.
- * @see legacy_player_unset_buffering_cb()
- * @see legacy_player_set_uri()
- * @see legacy_player_buffering_cb()
- */
-int legacy_player_set_buffering_cb(legacy_player_h player, player_buffering_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function.
- * @since_tizen 2.3
- * @param[in] player The handle to the media player
- * @return @c 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 legacy_player_set_buffering_cb()
- */
-int legacy_player_unset_buffering_cb(legacy_player_h player);
-
/**
* @brief Sets the playback rate.
* @since_tizen 2.3
*/
int legacy_player_set_subtitle_path(legacy_player_h player, const char *path);
-/**
- * @brief Registers a callback function to be invoked when a subtitle updates.
- * @since_tizen 2.3
- * @param[in] player The handle to the 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 @c 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 subtitle must be set by calling legacy_player_set_subtitle_path().
- * @post legacy_player_subtitle_updated_cb() will be invoked.
- * @see legacy_player_unset_subtitle_updated_cb()
- * @see legacy_player_subtitle_updated_cb()
- * @see legacy_player_set_subtitle_path()
- */
-int legacy_player_set_subtitle_updated_cb(legacy_player_h player, player_subtitle_updated_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function.
- * @since_tizen 2.3
- * @param[in] player The handle to the media player
- * @return @c 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 legacy_player_set_subtitle_updated_cb()
- */
-int legacy_player_unset_subtitle_updated_cb(legacy_player_h player);
-
/**
* @brief Sets the seek position for the subtitle.
* @since_tizen 2.3.1
*/
int legacy_player_set_subtitle_position_offset(legacy_player_h player, int millisecond);
-/**
- * @brief Registers a callback function to be invoked when video stream is changed.
- * @since_tizen 2.4
- * @remarks The stream changing is detected just before rendering operation.
- * @param[in] player The handle to the media player
- * @param[in] callback The stream changed 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 #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling legacy_player_create() or legacy_player_unprepare().
- * @post legacy_player_video_stream_changed_cb() will be invoked.
- * @see legacy_player_unset_video_stream_changed_cb()
- * @see legacy_player_video_stream_changed_cb()
- */
-int legacy_player_set_video_stream_changed_cb(legacy_player_h player, player_video_stream_changed_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the video stream changed callback function.
- * @since_tizen 2.4
- * @param[in] player The handle to the media player
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see legacy_player_set_video_stream_changed_cb()
- */
-int legacy_player_unset_video_stream_changed_cb(legacy_player_h player);
-
/**
* @brief Gets current track index.
* @since_tizen 2.4
*/
int legacy_player_select_track(legacy_player_h player, player_stream_type_e type, int index);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-/**
- * @brief Registers a callback function that is to be invoked when the buffer needs to be released for gapless.
- * @since_tizen 4.0
- * @param[in] player The handle to the 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 @c 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
- * @post player_retrieve_buffer_cb() will be invoked.
- * @see legacy_player_unset_retrieve_buffer_cb()
- */
-int legacy_player_set_retrieve_buffer_cb(legacy_player_h player, player_retrieve_buffer_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function.
- * @since_tizen 4.0
- * @param[in] player The handle to the media player
- * @return @c 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 legacy_player_set_retrieve_buffer_cb()
- */
-int legacy_player_unset_retrieve_buffer_cb(legacy_player_h player);
-#endif
-
/**
* @brief Manage the external storage state
* @since_tizen 3.0
*/
int legacy_player_get_max_adaptive_variant_limit(legacy_player_h player, int *bandwidth, int *width, int *height);
-/**
- * @brief Checks user callback lock
- * @since_tizen 3.0
- * @param[in] type The event type of player
- * @return @c 1 on success, 0 on failure
- */
-bool _check_enabled_user_cb_lock(int event_id);
-
/**
* @brief Sets the audio only mode.
* @since_tizen 4.0
/**
* @brief Called when the buffer level drops below the min size or exceeds the max size.
- * @since_tizen 3.0
- * @remarks This API is used for media stream playback only.
- * @param[in] status The buffer status
- * @param[in] bytes The current buffer level bytes
- * @param[in] user_data The user data passed from the callback registration function
- * @see legacy_player_set_media_stream_buffer_status_cb_ex()
- * @see legacy_player_set_media_stream_buffer_max_size()
- * @see legacy_player_set_media_stream_buffer_min_threshold()
*/
-typedef void (*player_media_stream_buffer_status_cb_ex)(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data);
+typedef void (*player_media_stream_buffer_status_cb_ex)(muse_player_event_e type,
+ player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data);
/**
* @brief Registers a callback function to be invoked when audio frame is decoded. Audio only contents is possible. If included video, error happens.
* @pre The player state must be #PLAYER_STATE_IDLE by legacy_player_create() or legacy_player_unprepare().
* @post legacy_player_media_packet_audio_decoded_cb() will be invoked.
*/
-int legacy_player_set_pcm_extraction_mode(legacy_player_h player, bool sync, legacy_player_media_packet_audio_decoded_cb callback, void *user_data);
+int legacy_player_set_pcm_extraction_mode(legacy_player_h player, bool sync,
+ legacy_player_media_packet_audio_decoded_cb callback, void *user_data);
/**
* @brief Set pcm mode spec. Samplerate, channel is needed.
*/
int legacy_player_set_streaming_playback_rate(legacy_player_h player, float rate);
-/**
- * @brief Registers a callback function to be invoked when buffer underrun or overflow is occurred.
- * @since_tizen 3.0
- * @remarks This API is used for media stream playback only.
- * @param[in] player The handle to the media player
- * @param[in] type The type of target stream
- * @param[in] callback The buffer status 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 #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling legacy_player_create() or legacy_player_unprepare().
- * @post player_media_stream_buffer_status_cb_ex() will be invoked.
- * @see legacy_player_unset_media_stream_buffer_status_cb_ex()
- * @see player_media_stream_buffer_status_cb_ex()
- */
-int legacy_player_set_media_stream_buffer_status_cb_ex(legacy_player_h player, player_stream_type_e type, player_media_stream_buffer_status_cb_ex callback, void *user_data);
-
-/**
- * @brief Unregisters the buffer status callback function.
- * @since_tizen 3.0
- * @remarks This API is used for media stream playback only.
- * @param[in] player The handle to the media player
- * @param[in] type The type of target stream
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see legacy_player_set_media_stream_buffer_status_cb()
- */
-int legacy_player_unset_media_stream_buffer_status_cb_ex(legacy_player_h player, player_stream_type_e type);
-
/**
* @brief Sets DRC(dynamic resolution change) information of media stream data.
* @since_tizen 3.0
PLAYER_CHECK_CONDITION(arg >= min, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); \
} while (0)
-/* user_cb_lock */
-#define LEGACY_PLAYER_USER_CB_LOCK(x_handle, type) \
- do { \
- if (_check_enabled_user_cb_lock(type)) \
- g_mutex_lock(&((legacy_player_t *)x_handle)->user_cb_lock[type]); \
- } while (0)
-
-#define LEGACY_PLAYER_USER_CB_UNLOCK(x_handle, type) \
- do { \
- if (_check_enabled_user_cb_lock(type)) \
- g_mutex_unlock(&((legacy_player_t *)x_handle)->user_cb_lock[type]); \
- } while (0)
-
-
#ifdef TIZEN_TTRACE
#include <ttrace.h>
#define PLAYER_TRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_VIDEO, NAME)
mmplayer_audio_extract_opt_e pcm_extract_opt;
} legacy_player_t;
+typedef struct {
+ muse_player_event_e type;
+ player_state_e state;
+} legacy_player_callback_pre_state_t;
+
int __player_convert_error_code(int code, char *func_name);
bool __player_state_validate(legacy_player_t *handle, player_state_e threshold);
} \
} while (0)
+/* user_cb_lock */
+#define LEGACY_PLAYER_USER_CB_LOCK(x_handle, type) \
+ do { \
+ if (__check_enabled_user_cb_lock(type)) \
+ g_mutex_lock(&((legacy_player_t *)x_handle)->user_cb_lock[type]); \
+ } while (0)
+
+#define LEGACY_PLAYER_USER_CB_UNLOCK(x_handle, type) \
+ do { \
+ if (__check_enabled_user_cb_lock(type)) \
+ g_mutex_unlock(&((legacy_player_t *)x_handle)->user_cb_lock[type]); \
+ } while (0)
+
/*
* Internal Implementation
*/
return true;
}
-static int __set_callback(muse_player_event_e type, legacy_player_h player, void *callback, void *user_data)
-{
- legacy_player_t *handle = (legacy_player_t *)player;
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(callback);
-
- handle->user_cb[type] = callback;
- handle->user_data[type] = user_data;
- LOGI("Event type : %d ", type);
- return PLAYER_ERROR_NONE;
-}
-
-static int __unset_callback(muse_player_event_e type, legacy_player_h player)
-{
- legacy_player_t *handle = (legacy_player_t *)player;
- PLAYER_INSTANCE_CHECK(player);
- handle->user_cb[type] = NULL;
- handle->user_data[type] = NULL;
- LOGI("Event type : %d ", type);
- return PLAYER_ERROR_NONE;
-}
-
-static int
-__set_buffer_export_callback(legacy_player_t *handle)
-{
- int ret = MM_ERROR_NONE;
-
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME])
- ret = mm_player_set_video_decoded_callback(handle->mm_handle,
- (mm_player_video_decoded_callback)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME], handle->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]);
-
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME])
- ret = mm_player_set_audio_decoded_callback(handle->mm_handle, handle->pcm_extract_opt,
- (mm_player_audio_decoded_callback)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME], handle->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME]);
-
- return ret;
-}
-
static player_state_e __convert_player_state(mmplayer_state_e state)
{
if (state == MM_PLAYER_STATE_NONE)
return state + 1;
}
+static bool __check_enabled_user_cb_lock(int type)
+{
+ switch (type) {
+ case MUSE_PLAYER_EVENT_TYPE_PREPARE: /* fall through */
+ case MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO: /* fall through */
+ case MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO: /* fall through */
+ return true;
+ default:
+ return false;
+ }
+}
+
static void __buffer_status_callback(legacy_player_t *handle, MMMessageParamType *msg)
{
muse_player_event_e event_type;
LEGACY_PLAYER_USER_CB_LOCK(handle, event_type);
if (handle->user_cb[event_type]) {
LOGD("event type %d, status %d", event_type, buffer_status);
- ((player_media_stream_buffer_status_cb)handle->user_cb[event_type])(buffer_status, handle->user_data[event_type]);
+ ((player_media_stream_buffer_status_cb)handle->user_cb[event_type]) \
+ (event_type, buffer_status, handle->user_data[event_type]);
LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type);
return;
}
LEGACY_PLAYER_USER_CB_LOCK(handle, event_type_internal);
if (handle->user_cb[event_type_internal]) {
LOGD("event type %d, status %d, bytes %llu", event_type_internal, buffer_status, buffer_bytes);
- ((player_media_stream_buffer_status_cb_ex)handle->user_cb[event_type_internal])(buffer_status, buffer_bytes, handle->user_data[event_type_internal]);
+ ((player_media_stream_buffer_status_cb_ex)handle->user_cb[event_type_internal]) \
+ (event_type_internal, buffer_status, buffer_bytes, handle->user_data[event_type_internal]);
}
LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type_internal);
+
}
+
static void __video_stream_changed_callback(legacy_player_t *handle)
{
int ret = MM_ERROR_NONE;
return;
}
+static void __default_callback(legacy_player_t *handle, muse_player_event_e type)
+{
+ LOGD("type %d", type);
+
+ LEGACY_PLAYER_USER_CB_LOCK(handle, type);
+ if (handle->user_cb[type])
+ ((legacy_player_default_callback)handle->user_cb[type])(type, handle->user_data[type]);
+ LEGACY_PLAYER_USER_CB_UNLOCK(handle, type);
+}
+
static int __msg_callback(int message, void *param, void *user_data)
{
legacy_player_t *handle = (legacy_player_t *)user_data;
LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
break;
case MM_MESSAGE_STATE_CHANGED: /* 0x03 */
- LOGI("STATE CHANGED INTERNALLY - from : %d, to : %d (CAPI State : %d)", msg->state.previous, msg->state.current, handle->state);
+ LOGI("state chagned from: %d, to: %d (CAPI State: %d)", msg->state.previous, msg->state.current, handle->state);
if (msg->state.previous == MM_PLAYER_STATE_READY && msg->state.current == MM_PLAYER_STATE_PAUSED) {
LEGACY_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
LOGI("Ready to streaming information (BOS) [current state : %d]", handle->state);
break;
case MM_MESSAGE_END_OF_STREAM: /* 0x105 */
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE]) {
- LOGD("Playback is completed.");
- ((player_completed_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_COMPLETE]);
- }
+ LOGD("Playback is completed.");
+ __default_callback(handle, MUSE_PLAYER_EVENT_TYPE_COMPLETE);
break;
#ifdef TIZEN_FEATURE_EVAS_RENDERER
case MM_MESSAGE_GAPLESS_CONSTRUCTION: /* 0x105 */
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER])
- ((player_retrieve_buffer_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]);
+ LOGD("Retrieve exported buffers.");
+ __default_callback(handle, MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER);
break;
#endif
case MM_MESSAGE_BUFFERING: /* 0x103 */
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING])
- ((player_buffering_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING])(msg->connection.buffering, handle->user_data[MUSE_PLAYER_EVENT_TYPE_BUFFERING]);
+ ((player_buffering_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING]) \
+ (msg->connection.buffering, handle->user_data[MUSE_PLAYER_EVENT_TYPE_BUFFERING]);
break;
case MM_MESSAGE_STATE_INTERRUPTED: /* 0x04 */
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]) {
- if (msg->union_type == MM_MSG_UNION_STATE) {
- LOGW("received mm state msg prev:%d, curr:%d", msg->state.previous, msg->state.current);
- handle->state = __convert_player_state(msg->state.current);
- LOGW("player state is changed to %d by resource conflict", handle->state);
- }
- ((player_interrupted_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]);
+ if (msg->union_type == MM_MSG_UNION_STATE) {
+ LOGW("received mm state msg prev:%d, curr:%d", msg->state.previous, msg->state.current);
+ handle->state = __convert_player_state(msg->state.current);
+ LOGW("player state is changed to %d by resource conflict", handle->state);
}
+
+ LOGD("Interrupted");
+ __default_callback(handle, MUSE_PLAYER_EVENT_TYPE_INTERRUPT);
break;
case MM_MESSAGE_CONNECTION_TIMEOUT: /* 0x102 */
LOGE("PLAYER_ERROR_CONNECTION_FAILED : CONNECTION_TIMEOUT");
break;
case MM_MESSAGE_UPDATE_SUBTITLE: /* 0x109 */
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SUBTITLE])
- ((player_subtitle_updated_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SUBTITLE])(msg->subtitle.duration, (char *)msg->data, handle->user_data[MUSE_PLAYER_EVENT_TYPE_SUBTITLE]);
+ ((player_subtitle_updated_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SUBTITLE]) \
+ (msg->subtitle.duration, (char *)msg->data, handle->user_data[MUSE_PLAYER_EVENT_TYPE_SUBTITLE]);
break;
case MM_MESSAGE_VIDEO_NOT_CAPTURED: /* 0x113 */
LOGE("PLAYER_ERROR_VIDEO_CAPTURE_FAILED");
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])
- ((player_error_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])(PLAYER_ERROR_VIDEO_CAPTURE_FAILED, handle->user_data[MUSE_PLAYER_EVENT_TYPE_ERROR]);
+ ((player_error_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR]) \
+ (PLAYER_ERROR_VIDEO_CAPTURE_FAILED, handle->user_data[MUSE_PLAYER_EVENT_TYPE_ERROR]);
break;
case MM_MESSAGE_VIDEO_CAPTURED: /* 0x110 */
{
capture->orientation, capture->width, capture->height, capture->size);
/* call application callback */
- ((player_video_captured_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE])
- (capture->data, capture->width, capture->height, capture->size, handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]);
+ ((player_video_captured_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, \
+ capture->width, capture->height, capture->size, handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]);
}
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
LOGW("Failed to set display_visible '1' (0x%x)", ret);
}
}
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) {
- LOGD("Seek is completed");
- ((player_seek_completed_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK]);
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
- }
+
+ LOGD("Seek is completed");
+ __default_callback(handle, MUSE_PLAYER_EVENT_TYPE_SEEK);
+ handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
+ handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
break;
case MM_MESSAGE_PLAY_POSITION:
LOGI("MM_MESSAGE_PLAY_POSITION (%"PRId64" ns)", msg->time.elapsed);
event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK;
if (handle->user_cb[event_type])
- ((player_media_stream_seek_cb)handle->user_cb[event_type])(msg->seek_data.offset, handle->user_data[event_type]);
+ ((player_media_stream_seek_cb)handle->user_cb[event_type])(event_type, msg->seek_data.offset, handle->user_data[event_type]);
break;
}
}
}
-bool _check_enabled_user_cb_lock(int type)
+static int __check_callback_precondition(legacy_player_t *handle, muse_player_event_e type)
{
- switch (type) {
- case MUSE_PLAYER_EVENT_TYPE_PREPARE: /* fall through */
- case MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO: /* fall through */
- case MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO: /* fall through */
- return true;
- default:
- return false;
+ int i = 0;
+ int size = 0;
+ legacy_player_callback_pre_state_t callback_pre_state[] = {
+ {MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME, PLAYER_STATE_IDLE},
+ {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS, PLAYER_STATE_IDLE},
+ {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS, PLAYER_STATE_IDLE},
+ {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO, PLAYER_STATE_IDLE},
+ {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO, PLAYER_STATE_IDLE},
+ {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK, PLAYER_STATE_IDLE},
+ {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK, PLAYER_STATE_IDLE},
+ {MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, PLAYER_STATE_IDLE},
+ };
+
+ size = sizeof(callback_pre_state)/sizeof(legacy_player_callback_pre_state_t);
+
+ /* check pre-state */
+ for (; i < size; i++) {
+ if (type == callback_pre_state[i].type) {
+ PLAYER_STATE_CHECK(handle, callback_pre_state[i].state);
+ break;
+ }
}
+
+ return PLAYER_ERROR_NONE;
+}
+
+static int
+__set_buffer_export_callback(legacy_player_t *handle)
+{
+ int ret = MM_ERROR_NONE;
+ muse_player_event_e video_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME;
+ muse_player_event_e audio_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME;
+
+ if (handle->user_cb[video_type])
+ ret = mm_player_set_video_decoded_callback(handle->mm_handle,
+ (mm_player_video_decoded_callback)handle->user_cb[video_type],
+ handle->user_data[video_type]);
+
+ if (handle->user_cb[audio_type])
+ ret = mm_player_set_audio_decoded_callback(handle->mm_handle, handle->pcm_extract_opt,
+ (mm_player_audio_decoded_callback)handle->user_cb[audio_type],
+ handle->user_data[audio_type]);
+
+ return ret;
}
/*
handle->is_media_stream = false;
for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
- if (_check_enabled_user_cb_lock(type))
+ if (__check_enabled_user_cb_lock(type))
g_mutex_init(&handle->user_cb_lock[type]);
}
__player_update_state(handle, PLAYER_INTERNAL_STATE_NONE);
for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
- if (_check_enabled_user_cb_lock(type))
+ if (__check_enabled_user_cb_lock(type))
g_mutex_clear(&handle->user_cb_lock[type]);
}
return PLAYER_ERROR_NONE;
}
-int legacy_player_set_play_position(legacy_player_h player, int64_t nanoseconds, bool accurate, player_seek_completed_cb callback, void *user_data)
+int legacy_player_set_play_position(legacy_player_h player, int64_t nanoseconds, bool accurate, void *callback, void *user_data)
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
return PLAYER_ERROR_NONE;
}
-int legacy_player_set_completed_cb(legacy_player_h player, player_completed_cb callback, void *user_data)
-{
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_COMPLETE, player, callback, user_data);
-}
-
-int legacy_player_unset_completed_cb(legacy_player_h player)
-{
- return __unset_callback(MUSE_PLAYER_EVENT_TYPE_COMPLETE, player);
-}
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-int legacy_player_set_retrieve_buffer_cb(legacy_player_h player, player_retrieve_buffer_cb callback, void *user_data)
-{
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER, player, callback, user_data);
-}
-
-int legacy_player_unset_retrieve_buffer_cb(legacy_player_h player)
-{
- return __unset_callback(MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER, player);
-}
-#endif
-
-int legacy_player_set_interrupted_cb(legacy_player_h player, player_interrupted_cb callback, void *user_data)
-{
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_INTERRUPT, player, callback, user_data);
-}
-
-int legacy_player_unset_interrupted_cb(legacy_player_h player)
-{
- return __unset_callback(MUSE_PLAYER_EVENT_TYPE_INTERRUPT, player);
-}
-
-int legacy_player_set_error_cb(legacy_player_h player, player_error_cb callback, void *user_data)
-{
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_ERROR, player, callback, user_data);
-}
-
-int legacy_player_unset_error_cb(legacy_player_h player)
-{
- return __unset_callback(MUSE_PLAYER_EVENT_TYPE_ERROR, player);
-}
-
-int legacy_player_set_buffering_cb(legacy_player_h player, player_buffering_cb callback, void *user_data)
-{
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_BUFFERING, player, callback, user_data);
-}
-
-int legacy_player_unset_buffering_cb(legacy_player_h player)
-{
- return __unset_callback(MUSE_PLAYER_EVENT_TYPE_BUFFERING, player);
-}
-
-int legacy_player_set_subtitle_updated_cb(legacy_player_h player, player_subtitle_updated_cb callback, void *user_data)
-{
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_SUBTITLE, player, callback, user_data);
-}
-
-int legacy_player_unset_subtitle_updated_cb(legacy_player_h player)
-{
- return __unset_callback(MUSE_PLAYER_EVENT_TYPE_SUBTITLE, player);
-}
-
-int legacy_player_release_video_stream_bo(legacy_player_h player, void *bo)
-{
- legacy_player_t *handle = (legacy_player_t *)player;
- PLAYER_INSTANCE_CHECK(player);
-
- LOGD("ENTER %p %p", player, bo);
-
- mm_player_release_video_stream_bo(handle->mm_handle, bo);
-
- LOGD("LEAVE");
-
- return PLAYER_ERROR_NONE;
-}
-
-int legacy_player_set_media_packet_video_frame_decoded_cb(legacy_player_h player, legacy_player_media_packet_video_decoded_cb callback, void *user_data)
+int legacy_player_set_callback(legacy_player_h player, muse_player_event_e type, void *callback, void *user_data)
{
+ int ret = PLAYER_ERROR_NONE;
legacy_player_t *handle = (legacy_player_t *)player;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
-
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = callback;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = user_data;
- return PLAYER_ERROR_NONE;
-}
+ ret = __check_callback_precondition(handle, type);
+ if (ret != PLAYER_ERROR_NONE) {
+ LOGE("precondition failure, type %d", type);
+ return ret;
+ }
-int legacy_player_set_video_stream_changed_cb(legacy_player_h player, player_video_stream_changed_cb callback, void *user_data)
-{
- legacy_player_t *handle = (legacy_player_t *)player;
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(callback);
- PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
+ LEGACY_PLAYER_USER_CB_LOCK(player, type);
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player, callback, user_data);
-}
+ LOGD("event type : %d ", type);
-int legacy_player_unset_video_stream_changed_cb(legacy_player_h player)
-{
- PLAYER_INSTANCE_CHECK(player);
+ handle->user_cb[type] = callback;
+ handle->user_data[type] = user_data;
- __unset_callback(MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player);
+ LEGACY_PLAYER_USER_CB_UNLOCK(player, type);
return PLAYER_ERROR_NONE;
}
-int legacy_player_set_media_stream_buffer_status_cb(legacy_player_h player, player_stream_type_e type, player_media_stream_buffer_status_cb callback, void *user_data)
+int legacy_player_unset_callback(legacy_player_h player, muse_player_event_e type)
{
legacy_player_t *handle = (legacy_player_t *)player;
PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(callback);
- PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- /* the type can be expaned with default and text. */
- if ((type != PLAYER_STREAM_TYPE_VIDEO) && (type != PLAYER_STREAM_TYPE_AUDIO)) {
- LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", type);
- return PLAYER_ERROR_INVALID_PARAMETER;
- }
+ LOGD("event type : %d ", type);
- if (type == PLAYER_STREAM_TYPE_VIDEO)
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS, player, callback, user_data);
- else
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS, player, callback, user_data);
-}
+ LEGACY_PLAYER_USER_CB_LOCK(player, type);
-int legacy_player_unset_media_stream_buffer_status_cb(legacy_player_h player, player_stream_type_e type)
-{
- PLAYER_INSTANCE_CHECK(player);
+ handle->user_cb[type] = NULL;
+ handle->user_data[type] = NULL;
- if (type == PLAYER_STREAM_TYPE_VIDEO)
- __unset_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS, player);
- else if (type == PLAYER_STREAM_TYPE_AUDIO)
- __unset_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS, player);
- else
- return PLAYER_ERROR_INVALID_PARAMETER;
+ LEGACY_PLAYER_USER_CB_UNLOCK(player, type);
return PLAYER_ERROR_NONE;
}
-int legacy_player_set_media_stream_seek_cb(legacy_player_h player, player_stream_type_e type, player_media_stream_seek_cb callback, void *user_data)
+int legacy_player_release_video_stream_bo(legacy_player_h player, void *bo)
{
legacy_player_t *handle = (legacy_player_t *)player;
PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(callback);
- PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
-
- /* the type can be expaned with default and text. */
- if ((type != PLAYER_STREAM_TYPE_VIDEO) && (type != PLAYER_STREAM_TYPE_AUDIO)) {
- LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", type);
- return PLAYER_ERROR_INVALID_PARAMETER;
- }
- if (type == PLAYER_STREAM_TYPE_VIDEO)
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK, player, callback, user_data);
-
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK, player, callback, user_data);
-}
+ LOGD("ENTER %p %p", player, bo);
-int legacy_player_unset_media_stream_seek_cb(legacy_player_h player, player_stream_type_e type)
-{
- PLAYER_INSTANCE_CHECK(player);
+ mm_player_release_video_stream_bo(handle->mm_handle, bo);
- if (type == PLAYER_STREAM_TYPE_VIDEO)
- __unset_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK, player);
- else if (type == PLAYER_STREAM_TYPE_AUDIO)
- __unset_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK, player);
- else
- return PLAYER_ERROR_INVALID_PARAMETER;
+ LOGD("LEAVE");
return PLAYER_ERROR_NONE;
}
return ret;
}
-int legacy_player_set_media_stream_buffer_status_cb_ex(legacy_player_h player, player_stream_type_e type, player_media_stream_buffer_status_cb_ex callback, void *user_data)
-{
- legacy_player_t *handle = (legacy_player_t *)player;
- muse_player_event_e event_type;
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(callback);
-
- if (handle->state != PLAYER_STATE_IDLE) {
- LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
- return PLAYER_ERROR_INVALID_STATE;
- }
- /* the type can be expaned with default and text. */
- if ((type != PLAYER_STREAM_TYPE_VIDEO) && (type != PLAYER_STREAM_TYPE_AUDIO)) {
- LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", type);
- return PLAYER_ERROR_INVALID_PARAMETER;
- }
-
- if (type == PLAYER_STREAM_TYPE_VIDEO)
- event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
- else
- event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
-
- LEGACY_PLAYER_USER_CB_LOCK(handle, event_type);
-
- handle->user_cb[event_type] = callback;
- handle->user_data[event_type] = user_data;
-
- LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type);
-
- LOGI("Event type : %d ", type);
- return PLAYER_ERROR_NONE;
-}
-
-int legacy_player_unset_media_stream_buffer_status_cb_ex(legacy_player_h player, player_stream_type_e type)
-{
- legacy_player_t *handle = (legacy_player_t *)player;
- muse_player_event_e event_type;
- PLAYER_INSTANCE_CHECK(player);
-
- if (type == PLAYER_STREAM_TYPE_VIDEO)
- event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
- else if (type == PLAYER_STREAM_TYPE_AUDIO)
- event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
- else
- return PLAYER_ERROR_INVALID_PARAMETER;
-
- LEGACY_PLAYER_USER_CB_LOCK(handle, event_type);
-
- handle->user_cb[event_type] = NULL;
- handle->user_data[event_type] = NULL;
-
- LEGACY_PLAYER_USER_CB_UNLOCK(handle, event_type);
-
- LOGI("Event type : %d ", type);
-
- return PLAYER_ERROR_NONE;
-}
-
int legacy_player_set_media_stream_dynamic_resolution(legacy_player_h player, bool drc)
{
legacy_player_t *handle = (legacy_player_t *)player;
PLAYER_SEND_EVENT_MSG(api, ev, module);
}
-static void __player_callback(muse_player_event_e ev, muse_module_h module)
-{
- muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
-
- LOGD("ENTER event: %d", ev);
-
- PLAYER_SEND_EVENT_MSG(api, ev, module);
-}
-
-static void _seek_complate_cb(void *user_data)
-{
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_SEEK;
- __player_callback(ev, (muse_module_h)user_data);
-}
-
-static void _completed_cb(void *user_data)
-{
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_COMPLETE;
- __player_callback(ev, (muse_module_h)user_data);
-}
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-static void _retrieve_buffer_cb(void *user_data)
-{
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER;
- __player_callback(ev, (muse_module_h)user_data);
-}
-#endif
-
-static void _set_completed_cb(legacy_player_h player, void *module, bool set)
-{
- if (set)
- legacy_player_set_completed_cb(player, _completed_cb, module);
- else
- legacy_player_unset_completed_cb(player);
-}
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-static void _set_retrieve_buffer_cb(legacy_player_h player, void *module, bool set)
-{
- if (set)
- legacy_player_set_retrieve_buffer_cb(player, _retrieve_buffer_cb, module);
- else
- legacy_player_unset_retrieve_buffer_cb(player);
-}
-#endif
-
static void _capture_video_cb(unsigned char *data, int width, int height, unsigned int size, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
return PLAYER_ERROR_NONE;
}
-static bool __video_decoded_callback(void *video_data, void *user_data)
+
+static bool __mplayer_video_decoded_callback(void *video_data, void *user_data)
{
int ret = 0;
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
return ret_val;
}
-static void _video_stream_changed_cb(int width, int height, int fps, int bit_rate, void *user_data)
+static void __mplayer_video_stream_changed_cb(int width, int height, int fps, int bit_rate, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED;
MUSE_TYPE_INT, "fps", fps, MUSE_TYPE_INT, "bit_rate", bit_rate);
}
-static void _media_stream_audio_buffer_status_cb(player_media_stream_buffer_status_e status, void *user_data)
+static void __mplayer_media_stream_buffer_status_cb(muse_player_event_e ev,
+ player_media_stream_buffer_status_e status, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS;
muse_module_h module = (muse_module_h)user_data;
PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "status", (int)status);
}
-static void _media_stream_video_buffer_status_cb(player_media_stream_buffer_status_e status, void *user_data)
-{
- muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
- muse_module_h module = (muse_module_h)user_data;
-
- PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "status", (int)status);
-}
-
-static void _media_stream_audio_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
-{
- muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
- muse_module_h module = (muse_module_h)user_data;
-
- PLAYER_SEND_EVENT_MSG(api, ev, module,
- MUSE_TYPE_INT, "status", (int)status, MUSE_TYPE_INT64, "bytes", (INT64)bytes);
-}
-
-static void _media_stream_video_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
+static void __mplayer_media_stream_buffer_status_cb_ex(muse_player_event_e ev,
+ player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
muse_module_h module = (muse_module_h)user_data;
PLAYER_SEND_EVENT_MSG(api, ev, module,
MUSE_TYPE_INT, "status", (int)status, MUSE_TYPE_INT64, "bytes", (INT64)bytes);
}
-static void _media_stream_audio_seek_cb(unsigned long long offset, void *user_data)
+static void __mplayer_media_stream_seek_cb(muse_player_event_e ev, unsigned long long offset, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK;
muse_module_h module = (muse_module_h)user_data;
PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT64, "offset", (INT64)offset);
}
-static void _media_stream_video_seek_cb(unsigned long long offset, void *user_data)
+static void __mplayer_default_callback(muse_player_event_e ev, muse_module_h module)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK;
- muse_module_h module = (muse_module_h)user_data;
- PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT64, "offset", (INT64)offset);
-}
-
-static void _interrupted_cb(void *user_data)
-{
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_INTERRUPT;
- __player_callback(ev, (muse_module_h)user_data);
-}
+ LOGD("ENTER event: %d", ev);
-static void _set_interrupted_cb(legacy_player_h player, void *module, bool set)
-{
- if (set)
- legacy_player_set_interrupted_cb(player, _interrupted_cb, module);
- else
- legacy_player_unset_interrupted_cb(player);
+ PLAYER_SEND_EVENT_MSG(api, ev, module);
}
-static void _error_cb(int code, void *user_data)
+static void __mplayer_error_cb(int code, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_ERROR;
PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "code", code);
}
-static void _set_error_cb(legacy_player_h player, void *module, bool set)
-{
- if (set)
- legacy_player_set_error_cb(player, _error_cb, module);
- else
- legacy_player_unset_error_cb(player);
-}
-
-static void _subtitle_updated_cb(unsigned long duration, char *text, void *user_data)
+static void __mplayer_subtitle_updated_cb(unsigned long duration, char *text, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_SUBTITLE;
MUSE_TYPE_INT, "duration", (int)duration, MUSE_TYPE_STRING, "text", (const char *)text);
}
-static void _set_subtitle_cb(legacy_player_h player, void *module, bool set)
-{
- if (set)
- legacy_player_set_subtitle_updated_cb(player, _subtitle_updated_cb, module);
- else
- legacy_player_unset_subtitle_updated_cb(player);
-}
-
-static void _buffering_cb(int percent, void *user_data)
+static void __mplayer_buffering_cb(int percent, void *user_data)
{
muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_BUFFERING;
}
-static void _set_buffering_cb(legacy_player_h player, void *module, bool set)
-{
- if (set)
- legacy_player_set_buffering_cb(player, _buffering_cb, module);
- else
- legacy_player_unset_buffering_cb(player);
-}
-
-static void _set_media_packet_video_frame_cb(legacy_player_h player, void *data, bool set)
-{
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- muse_module_h module = (muse_module_h)data;
- muse_player_handle_t *muse_player = NULL;
- muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
-
- if (set) {
- muse_player->export_video_data = true;
- ret = legacy_player_set_media_packet_video_frame_decoded_cb(player, __video_decoded_callback, module);
- } else {
- muse_player->export_video_data = false;
- LOGD("video data will not be exported.");
- }
-
- PLAYER_RETURN_MSG(api, ret, module);
-}
-
-static void _set_video_stream_changed_cb(legacy_player_h player, void *data, bool set)
-{
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- muse_module_h module = (muse_module_h)data;
-
- if (set)
- ret = legacy_player_set_video_stream_changed_cb(player, _video_stream_changed_cb, module);
- else
- ret = legacy_player_unset_video_stream_changed_cb(player);
-
- PLAYER_RETURN_MSG(api, ret, module);
-}
-
-static void _set_media_stream_audio_seek_cb(legacy_player_h player, void *data, bool set)
-{
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- muse_module_h module = (muse_module_h)data;
-
- if (set)
- ret = legacy_player_set_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_AUDIO, _media_stream_audio_seek_cb, module);
- else
- ret = legacy_player_unset_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_AUDIO);
-
- PLAYER_RETURN_MSG(api, ret, module);
-}
-
-static void _set_media_stream_video_seek_cb(legacy_player_h player, void *data, bool set)
+static void __mplayer_set_enable_data_export(legacy_player_h player, void *data, bool set)
{
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- muse_module_h module = (muse_module_h)data;
-
- if (set)
- ret = legacy_player_set_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_VIDEO, _media_stream_video_seek_cb, module);
- else
- ret = legacy_player_unset_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_VIDEO);
-
- PLAYER_RETURN_MSG(api, ret, module);
-}
-
-static void _set_media_stream_audio_buffer_cb(legacy_player_h player, void *data, bool set)
-{
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- muse_module_h module = (muse_module_h)data;
-
- if (set)
- ret = legacy_player_set_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_AUDIO, _media_stream_audio_buffer_status_cb, module);
- else
- ret = legacy_player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_AUDIO);
-
- PLAYER_RETURN_MSG(api, ret, module);
-}
-
-static void _set_media_stream_video_buffer_cb(legacy_player_h player, void *data, bool set)
-{
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
muse_module_h module = (muse_module_h)data;
+ muse_player_handle_t *muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
+
+ muse_player->export_video_data = set;
+}
+
+static void *__mplayer_callback_function[MUSE_PLAYER_EVENT_TYPE_NUM] = {
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_PREPARE */
+ __mplayer_default_callback, /* MUSE_PLAYER_EVENT_TYPE_COMPLETE */
+ __mplayer_default_callback, /* MUSE_PLAYER_EVENT_TYPE_INTERRUPT */
+ __mplayer_error_cb, /* MUSE_PLAYER_EVENT_TYPE_ERROR */
+ __mplayer_buffering_cb, /* MUSE_PLAYER_EVENT_TYPE_BUFFERING */
+ __mplayer_subtitle_updated_cb, /* MUSE_PLAYER_EVENT_TYPE_SUBTITLE */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_CAPTURE */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_SEEK */
+ __mplayer_video_decoded_callback, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_MISSED_PLUGIN */
+#ifdef _PLAYER_FOR_PRODUCT
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_IMAGE_BUFFER */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_SELECTED_SUBTITLE_LANGUAGE */
+#endif
+ __mplayer_media_stream_buffer_status_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS */
+ __mplayer_media_stream_buffer_status_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS */
+ __mplayer_media_stream_buffer_status_cb_ex, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO */
+ __mplayer_media_stream_buffer_status_cb_ex, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO */
+ __mplayer_media_stream_seek_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK */
+ __mplayer_media_stream_seek_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED */
+ __mplayer_video_stream_changed_cb, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED */
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+ __mplayer_default_callback, /* MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER */
+#endif
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED */
+ NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME, DEPRECATED_PLAYER_INTERNAL_API */
+};
- if (set)
- ret = legacy_player_set_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO, _media_stream_video_buffer_status_cb, module);
- else
- ret = legacy_player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO);
-
- PLAYER_RETURN_MSG(api, ret, module);
-}
-
-static void _set_media_stream_audio_buffer_cb_ex(legacy_player_h player, void *data, bool set)
+static int __mplayer_set_callback_func(legacy_player_h player, muse_player_event_e type, bool set, void *user_data)
{
int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- muse_module_h module = (muse_module_h)data;
- if (set)
- ret = legacy_player_set_media_stream_buffer_status_cb_ex(player, PLAYER_STREAM_TYPE_AUDIO, _media_stream_audio_buffer_status_cb_ex, module);
- else
- ret = legacy_player_unset_media_stream_buffer_status_cb_ex(player, PLAYER_STREAM_TYPE_AUDIO);
+ LOGD("set callback type %d, set %d", type, set);
- PLAYER_RETURN_MSG(api, ret, module);
-}
+ if (!__mplayer_callback_function[type]) {
+ LOGE("there is no mplayer callback");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
-static void _set_media_stream_video_buffer_cb_ex(legacy_player_h player, void *data, bool set)
-{
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- muse_module_h module = (muse_module_h)data;
+ if (type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME)
+ __mplayer_set_enable_data_export(player, user_data, set);
if (set)
- ret = legacy_player_set_media_stream_buffer_status_cb_ex(player, PLAYER_STREAM_TYPE_VIDEO, _media_stream_video_buffer_status_cb_ex, module);
+ ret = legacy_player_set_callback(player, type, __mplayer_callback_function[type], user_data);
else
- ret = legacy_player_unset_media_stream_buffer_status_cb_ex(player, PLAYER_STREAM_TYPE_VIDEO);
+ ret = legacy_player_unset_callback(player, type);
- PLAYER_RETURN_MSG(api, ret, module);
+ return ret;
}
-static void (*set_callback_func[MUSE_PLAYER_EVENT_TYPE_NUM])(legacy_player_h player, void *user_data, bool set) = {
- NULL, /* MUSE_PLAYER_EVENT_TYPE_PREPARE */
- _set_completed_cb, /* MUSE_PLAYER_EVENT_TYPE_COMPLETE */
- _set_interrupted_cb, /* MUSE_PLAYER_EVENT_TYPE_INTERRUPT */
- _set_error_cb, /* MUSE_PLAYER_EVENT_TYPE_ERROR */
- _set_buffering_cb, /* MUSE_PLAYER_EVENT_TYPE_BUFFERING */
- _set_subtitle_cb, /* MUSE_PLAYER_EVENT_TYPE_SUBTITLE */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_CAPTURE */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_SEEK */
- _set_media_packet_video_frame_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_MISSED_PLUGIN */
-#ifdef _PLAYER_FOR_PRODUCT
- NULL, /* MUSE_PLAYER_EVENT_TYPE_IMAGE_BUFFER */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_SELECTED_SUBTITLE_LANGUAGE */
-#endif
- _set_media_stream_video_buffer_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS */
- _set_media_stream_audio_buffer_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS */
- _set_media_stream_video_buffer_cb_ex, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO */
- _set_media_stream_audio_buffer_cb_ex, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO */
- _set_media_stream_video_seek_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK */
- _set_media_stream_audio_seek_cb, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED */
- _set_video_stream_changed_cb, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED */
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- _set_retrieve_buffer_cb, /* MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER */
-#endif
- NULL, /* MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME, DEPRECATED_PLAYER_INTERNAL_API */
-};
-
static int _push_media_stream(muse_player_handle_t *muse_player, player_push_media_msg_type *push_media, char *buf)
{
int ret = MEDIA_FORMAT_ERROR_NONE;
INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
- ret = legacy_player_set_play_position(muse_player->player_handle, pos, accurate, _seek_complate_cb, module);
+ ret = legacy_player_set_play_position(muse_player->player_handle, pos, accurate, __mplayer_default_callback, module);
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
}
MUSE_TYPE_INT, "set", (void *)&set,
INVALID_MUSE_TYPE_VALUE);
- if (ret_val) {
- muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
- if (type < MUSE_PLAYER_EVENT_TYPE_NUM && set_callback_func[type] != NULL)
- set_callback_func[type] (muse_player->player_handle, module, set);
- } else {
+ if (!ret_val) {
+ LOGE("failed to get param value");
ret = PLAYER_ERROR_INVALID_OPERATION;
- PLAYER_RETURN_MSG(MUSE_PLAYER_API_SET_CALLBACK, ret, module);
+ goto EXIT;
+ }
+
+ if (type >= MUSE_PLAYER_EVENT_TYPE_NUM) {
+ LOGE("invalid type value %d", type);
+ ret = PLAYER_ERROR_INVALID_PARAMETER;
+ goto EXIT;
}
+ muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
+ ret = __mplayer_set_callback_func(muse_player->player_handle, type, set, module);
+ if (ret != PLAYER_ERROR_NONE) {
+ LOGE("failed to set callback type %d", type);
+ /* goto EXIT; */
+ }
+
+EXIT:
+ PLAYER_RETURN_MSG(MUSE_PLAYER_API_SET_CALLBACK, ret, module);
return ret;
}
Name: mmsvc-player
Summary: A Media Player module for muse server
-Version: 0.2.112
+Version: 0.2.113
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0