Fix pcm extraction api for webaudio 09/43409/2
authorHyunil Park <hyunil46.park@samsung.com>
Thu, 9 Jul 2015 02:11:54 +0000 (11:11 +0900)
committerHeechul Jeon <heechul.jeon@samsung.com>
Thu, 9 Jul 2015 05:57:50 +0000 (22:57 -0700)
Change-Id: I33cdec9e257694869b6715b3f3f87679f83f5ce5
Signed-off-by: Hyunil Park <hyunil46.park@samsung.com>
include/mobile/player_internal.h
include/wearable/player_internal.h
test/player_test.c

index 508981d..34d07c5 100755 (executable)
@@ -79,6 +79,23 @@ typedef void (*player_audio_pcm_extraction_cb)(player_audio_raw_data_s *audio_ra
 int player_set_pcm_extraction_mode(player_h player, bool sync, const char *format, player_audio_pcm_extraction_cb callback, void *user_data);
 
 /**
+ * @brief Set pcm mode spec. Samplerate, channel is needed.
+ * @since_tizen 2.4
+ * @param[in] player    The handle to the media player
+ * @param[in] samplerate Samplerate
+ * @param[in] channel Channel
+ * @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_NOT_SUPPORTD Not supported
+ * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
+ * @see player_set_pcm_extraction_mode()
+ */
+int player_set_pcm_spec(player_h player, int samplerate, int channel);
+/**
  * @}
  */
 
index 508981d..014ad4d 100644 (file)
@@ -74,9 +74,25 @@ typedef void (*player_audio_pcm_extraction_cb)(player_audio_raw_data_s *audio_ra
  * @retval #PLAYER_ERROR_NOT_SUPPORTD Not supported
  * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
  * @post player_audio_pcm_extraction_cb() will be invoked.
- * @see player_unset_audio_frame_decoded_cb_ex()
  */
 int player_set_pcm_extraction_mode(player_h player, bool sync, const char *format, player_audio_pcm_extraction_cb callback, void *user_data);
+/**
+ * @brief Set pcm mode spec. Samplerate, channel is needed.
+ * @since_tizen 2.4
+ * @param[in] player    The handle to the media player
+ * @param[in] samplerate Samplerate
+ * @param[in] channel Channel
+ * @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_NOT_SUPPORTD Not supported
+ * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
+ * @see player_set_pcm_extraction_mode()
+ */
+int player_set_pcm_spec(player_h player, int samplerate, int channel);
 
 /**
  * @}
index aff3639..1239ba0 100644 (file)
@@ -5,7 +5,7 @@
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
-* http://www.apache.org/licenses/LICENSE-2.0
+* http://www.apache.org/licenses/LICENSE-2.0void set_pcm_spec
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
@@ -1071,6 +1071,14 @@ static void audio_frame_decoded_cb_ex()
        g_print("                                                            ==> [Player_Test] player_set_audio_frame_decoded_cb_ex return: %d\n", ret);
 }
 
+static void set_pcm_spec()
+{
+       int ret;
+
+       ret = player_set_pcm_spec(g_player[0], 44100, 2);
+       g_print("[Player_Test] set_pcm_spec return: %d\n", ret);
+}
+
 static void get_stream_info()
 {
        int w = 0;
@@ -1734,6 +1742,10 @@ void _interpret_main_menu(char *cmd)
                {
                        audio_frame_decoded_cb_ex();
                }
+               else if(strncmp(cmd, "X4", 2) == 0)
+               {
+                       set_pcm_spec();
+               }
                else
                {
                        g_print("unknown menu \n");