add new internal api to set playback rate in streaming case 17/49917/1 accepted/tizen/common/20160108.084007 accepted/tizen/mobile/20151022.225956 accepted/tizen/tv/20151022.230009 accepted/tizen/wearable/20151022.230015 submit/tizen/20151022.073655 submit/tizen_common/20160104.190333
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 21 Oct 2015 12:45:03 +0000 (21:45 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 21 Oct 2015 12:46:13 +0000 (21:46 +0900)
Change-Id: I077c3045edeae8bb0f8c14824bdeb58629ee99c1

include/mobile/player_internal.h
include/wearable/player_internal.h
src/player.c
src/player_internal.c

index 244f46e..a80ee2f 100644 (file)
@@ -95,6 +95,23 @@ int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_
  * @see player_set_pcm_extraction_mode()
  */
 int player_set_pcm_spec(player_h player, const char *format, int samplerate, int channel);
+
+/**
+ * @brief Sets the playback rate include streaming mode.
+ * @since_tizen 3.0
+ * @details The default value is @c 1.0.
+ * @remarks No operation is performed, if @a rate is @c 0.
+ * @remarks The sound is muted, when playback rate is under @c 0.0 and over @c 2.0.
+ * @param[in]   player The handle to the media player
+ * @param[in]   rate The playback rate
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start().
+ * @pre The player state must be set to #PLAYER_STATE_READY by calling player_prepare() or set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause().
+ */
+int player_set_streaming_playback_rate(player_h player, float rate);
+
+
 /**
  * @}
  */
index 54fb92b..0aa99af 100644 (file)
@@ -76,6 +76,7 @@ typedef void (*player_audio_pcm_extraction_cb)(player_audio_raw_data_s *audio_ra
  * @post player_audio_pcm_extraction_cb() will be invoked.
  */
 int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data);
+
 /**
  * @brief Set pcm mode spec. Samplerate, channel is needed.
  * @since_tizen 2.4
@@ -95,6 +96,22 @@ int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_
 int player_set_pcm_spec(player_h player, const char *format, int samplerate, int channel);
 
 /**
+ * @brief Sets the playback rate include streaming mode.
+ * @since_tizen 3.0
+ * @details The default value is @c 1.0.
+ * @remarks No operation is performed, if @a rate is @c 0.
+ * @remarks The sound is muted, when playback rate is under @c 0.0 and over @c 2.0.
+ * @param[in]   player The handle to the media player
+ * @param[in]   rate The playback rate
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start().
+ * @pre The player state must be set to #PLAYER_STATE_READY by calling player_prepare() or set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause().
+ */
+int player_set_streaming_playback_rate(player_h player, float rate);
+
+
+/**
  * @}
  */
 
index ecfdd17..aa2f3ca 100644 (file)
@@ -2120,7 +2120,7 @@ int player_set_playback_rate(player_h player, float rate)
                return PLAYER_ERROR_INVALID_STATE;
        }
 
-       int ret = mm_player_set_play_speed(handle->mm_handle, rate);
+       int ret = mm_player_set_play_speed(handle->mm_handle, rate, FALSE);
 
        switch (ret)
        {
index bef6e82..ccd31de 100644 (file)
@@ -97,3 +97,36 @@ int player_set_pcm_spec(player_h player, const char *format, int samplerate, int
 
        return PLAYER_ERROR_NONE;
 }
+
+int player_set_streaming_playback_rate(player_h player, float rate)
+{
+       LOGI("[%s] rate : %0.1f", __FUNCTION__, rate);
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+
+       if (!__player_state_validate(handle, PLAYER_STATE_READY))
+       {
+               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
+
+       int ret = mm_player_set_play_speed(handle->mm_handle, rate, TRUE);
+
+       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] PLAYER_ERROR_INVALID_OPERATION(0x%08x) : seek error",__FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
+                       ret = PLAYER_ERROR_INVALID_OPERATION;
+                       break;
+               default:
+                       return __player_convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       return ret;
+}
+
+