mediastreamer: add seek api 59/48859/5
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 1 Oct 2015 02:25:13 +0000 (11:25 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 7 Oct 2015 08:29:01 +0000 (17:29 +0900)
Change-Id: I544f009565ac0b447602fc4ef27f3d3885d26e6e

include/media_streamer.h [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index eb239fe..a5ac441
@@ -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;
 
 /**
@@ -442,6 +443,14 @@ typedef void (*media_streamer_sink_data_ready_cb)(media_streamer_node_h node,
 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.
@@ -759,6 +768,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