From 1df83a00b88ad92d517a298980cc560bcac941f4 Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Thu, 1 Oct 2015 11:25:13 +0900 Subject: [PATCH] mediastreamer: add seek api Change-Id: I544f009565ac0b447602fc4ef27f3d3885d26e6e --- include/media_streamer.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) mode change 100755 => 100644 include/media_streamer.h diff --git a/include/media_streamer.h b/include/media_streamer.h old mode 100755 new mode 100644 index eb239fe..a5ac441 --- a/include/media_streamer.h +++ b/include/media_streamer.h @@ -151,6 +151,7 @@ typedef enum { MEDIA_STREAMER_ERROR_INVALID_STATE = TIZEN_ERROR_MEDIA_STREAMER | 0x01, /**< Invalid state */ MEDIA_STREAMER_ERROR_CONNECTION_FAILED = TIZEN_ERROR_MEDIA_STREAMER | 0x02, /**< Connection failed */ MEDIA_STREAMER_ERROR_RESOURCE_CONFLICT = TIZEN_ERROR_MEDIA_STREAMER | 0x03, /**< Resource conflict */ + MEDIA_STREAMER_ERROR_SEEK_FAILED = TIZEN_ERROR_MEDIA_STREAMER | 0x04, /**< Seek operation failure */ } media_streamer_error_e; /** @@ -443,6 +444,14 @@ typedef void (*media_streamer_sink_eos_cb)(media_streamer_node_h node, void *user_data); /** + * @brief Called when the seek operation is completed. + * @since_tizen 3.0 + * @param [in] user_data The user data passed from the callback registration function + * @see media_streamer_set_play_position() + */ +typedef void (*media_streamer_position_changed_cb)(void *user_data); + +/** * @brief Registers a error callback function to be invoked when an error occurs. * @details Following error codes can be delivered by error callback. * #MEDIA_STREAMER_ERROR_INVALID_OPERATION, @@ -760,6 +769,47 @@ int media_streamer_stop(media_streamer_h streamer); int media_streamer_destroy(media_streamer_h streamer); /** + * @brief Changes playback position to the defined time value, asynchronously. + * @since_tizen 3.0 + * @param [in] streamer Media streamer handle + * @param [in] time Time in millisecond + * @param [in] accurate If @c true, it will seek to the accurate position, but this might be considerably slower for some formats, + * otherwise @c false, it will seek to the nearest keyframe. + * @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 #MEDIA_STREAMER_ERROR_NONE Successful + * @retval #MEDIA_STREAMER_ERROR_INVALID_STATE Invalid state + * @retval #MEDIA_STREAMER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MEDIA_STREAMER_ERROR_INVALID_OPERATION Invalid operation + * @retval #MEDIA_STREAMER_ERROR_SEEK_FAILED Seek operation failure + * @pre The media streamer state must be one of these: #MEDIA_STREAMER_STATE_READY, #MEDIA_STREAMER_STATE_PAUSED, or #MEDIA_STREAMER_STATE_PLAYING. + * @post It invokes media_streamer_set_play_position() when seek operation completes, if you set a callback. + * @see media_streamer_get_play_position() + */ +int media_streamer_set_play_position(media_streamer_h streamer, + int time, + bool accurate, + media_streamer_position_changed_cb callback, + void *user_data); +/** + * @brief Gets the current position in milliseconds. + * @since_tizen 3.0 + * @param [in] streamer Media streamer handle + * @param [out] time The current position in milliseconds + * @return @c 0 on success, + * otherwise a negative error value + * @retval #MEDIA_STREAMER_ERROR_NONE Successful + * @retval #MEDIA_STREAMER_ERROR_INVALID_STATE Invalid state + * @retval #MEDIA_STREAMER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MEDIA_STREAMER_ERROR_INVALID_OPERATION Invalid operation + * @pre The media streamer state must be one of these: #MEDIA_STREAMER_STATE_READY, #MEDIA_STREAMER_STATE_PAUSED, or #MEDIA_STREAMER_STATE_PLAYING. + * @see media_streamer_set_play_position() + */ +int media_streamer_get_play_position(media_streamer_h streamer, int *time); + +/** * @brief Gets media streamer state. * @since_tizen 3.0 * @param [in] streamer Media streamer handle -- 2.7.4