From b59b53347bd6b140e673624e61adb0f0fec40d07 Mon Sep 17 00:00:00 2001 From: Hyunil Park Date: Thu, 9 Jul 2015 11:11:54 +0900 Subject: [PATCH] Fix pcm extraction api for webaudio Change-Id: I33cdec9e257694869b6715b3f3f87679f83f5ce5 Signed-off-by: Hyunil Park --- include/mobile/player_internal.h | 17 +++++++++++++++++ include/wearable/player_internal.h | 18 +++++++++++++++++- test/player_test.c | 14 +++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/include/mobile/player_internal.h b/include/mobile/player_internal.h index 508981d..34d07c5 100755 --- a/include/mobile/player_internal.h +++ b/include/mobile/player_internal.h @@ -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); +/** * @} */ diff --git a/include/wearable/player_internal.h b/include/wearable/player_internal.h index 508981d..014ad4d 100644 --- a/include/wearable/player_internal.h +++ b/include/wearable/player_internal.h @@ -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); /** * @} diff --git a/test/player_test.c b/test/player_test.c index aff3639..1239ba0 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -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"); -- 2.7.4