From e149e868b190e66308f461539a4c6fa3407ac4a3 Mon Sep 17 00:00:00 2001 From: Eunhye Choi Date: Mon, 29 Jul 2019 18:22:19 +0900 Subject: [PATCH] [0.3.121] remove deprecated internal api - remove internal api to extract audio pcm which was replaced with public api by ACR-1410. Change-Id: Ia16bf5bca6aa9d9e0f805419fa5a038b01a3fda7 --- include/player_internal.h | 73 ---------------------------------------- include/player_private.h | 9 +++++ packaging/capi-media-player.spec | 2 +- src/player.c | 17 +++------- src/player_internal.c | 45 ------------------------- test/player_audio_test.c | 42 ----------------------- test/player_test.c | 44 +----------------------- 7 files changed, 16 insertions(+), 216 deletions(-) diff --git a/include/player_internal.h b/include/player_internal.h index d3ad1bd..e0d510b 100644 --- a/include/player_internal.h +++ b/include/player_internal.h @@ -56,32 +56,6 @@ typedef enum { } player_codec_type_e; /** - * @brief This file contains the media player API for custom features. - * @since_tizen 2.4 - */ -typedef struct { - void *data; /**< PCM data */ - int size; /**< Data Size */ - int channel; /**< Channel */ - int rate; /**< Samplerate */ - int depth; /**< Depth */ - bool little_endian; /**< Endianness */ - unsigned long long channel_mask; /**< channel_mask */ - media_format_mimetype_e pcm_format; -} player_audio_raw_data_s; - -/** - * @brief Information about packet. - * @since_tizen @if TV 3.0 @endif - */ -typedef struct { - guint32 len; - guint64 pts; - player_stream_type_e streamtype; -} player_submit_packet_t; - - -/** * @brief Video stream info in external demux case * @since_tizen @if TV 3.0 @endif */ @@ -128,17 +102,6 @@ typedef struct _audio_stream_info_s { unsigned int buffer_type; } player_audio_stream_info_s; - -/** - * @brief Called when the audio frame is decoded. - * @since_tizen 2.4 - * @param[in] audio_raw_frame The decoded audio frame data type - * @param[in] user_data The user data passed from the callback registration function - * @see player_set_audio_frame_decoded_cb() - * @see player_unset_audio_frame_decoded_cb() - */ -typedef void (*player_audio_pcm_extraction_cb)(player_audio_raw_data_s *audio_raw_frame, void *user_data); - /** * @brief Called when the buffer level drops below the min size or exceeds the max size. * @since_tizen 3.0 @@ -153,42 +116,6 @@ typedef void (*player_audio_pcm_extraction_cb)(player_audio_raw_data_s *audio_ra typedef void (*player_media_stream_buffer_status_cb_ex)(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data); /** - * @brief Registers a callback function to be invoked when audio frame is decoded. Audio only contents is possible. If included video, error happens. - * @since_tizen 2.4 - * @param[in] player The handle to the media player - * @param[in] sync Sync on the clock - * @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 #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 - * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare(). - * @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 - * @param[in] player The handle to the media player - * @param[in] format Audio format - * @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 - * @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, 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. diff --git a/include/player_private.h b/include/player_private.h index 6031c49..7c023be 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -201,6 +201,15 @@ typedef struct _player_cli_s { gboolean is_audio_only; } player_cli_s; +typedef struct { + void *data; /**< PCM data */ + int size; /**< Data Size */ + int channel; /**< Channel */ + int rate; /**< Samplerate */ + unsigned long long channel_mask; /**< channel_mask */ + media_format_mimetype_e pcm_format; +} player_audio_decoded_data_info_t; + /* player callback information */ #define CALLBACK_INFO(h) ((h)->cb_info) /* MSG Channel socket fd */ diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index 7e3fd95..cf87fa9 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,6 +1,6 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.120 +Version: 0.3.121 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index 0531923..f0eb024 100644 --- a/src/player.c +++ b/src/player.c @@ -1051,7 +1051,7 @@ static void __media_packet_audio_frame_cb_handler(callback_cb_info_s *cb_info, _ tbm_bo bo = NULL; tbm_bo_handle thandle; int key = INVALID_DEFAULT_VALUE; - player_audio_raw_data_s audio; /* DEPRECATED_PLAYER_INTERNAL_API */ + player_audio_decoded_data_info_t audio; media_packet_h pkt = NULL; media_format_h fmt = NULL; _media_pkt_audio_fin_data *fin_data = NULL; @@ -1078,8 +1078,8 @@ static void __media_packet_audio_frame_cb_handler(callback_cb_info_s *cb_info, _ goto EXIT; } - memcpy(&audio, thandle.ptr, sizeof(player_audio_raw_data_s)); - audio.data = thandle.ptr + sizeof(player_audio_raw_data_s); + memcpy(&audio, thandle.ptr, sizeof(player_audio_decoded_data_info_t)); + audio.data = thandle.ptr + sizeof(player_audio_decoded_data_info_t); tbm_bo_unmap(bo); /* LOGD("user callback data %p, size %d", audio.data, audio.size); */ @@ -1128,9 +1128,6 @@ static void __media_packet_audio_frame_cb_handler(callback_cb_info_s *cb_info, _ ((player_media_packet_audio_decoded_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME]) (pkt, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME]); - } else if (cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]) { /* DEPRECATED_PLAYER_INTERNAL_API, will be removed */ - ((player_audio_pcm_extraction_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]) - (&audio, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]); } else { LOGE("there is no registered cb"); goto EXIT; @@ -1309,7 +1306,6 @@ static void (*_user_callbacks[MUSE_PLAYER_EVENT_TYPE_NUM])(callback_cb_info_s *c __retrieve_buffer_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER */ #endif __disconnected_error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED */ - NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME, DEPRECATED_PLAYER_INTERNAL_API */ }; gboolean _player_event_job_function(void *user_data) @@ -1343,8 +1339,7 @@ gboolean _player_event_job_function(void *user_data) } g_mutex_unlock(&data->cb_info->event_queue.idle_ev_mutex); - if ((data->cb_info->user_cb[ev] || ev == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED || - (data->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME] && ev == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME)) && + if ((data->cb_info->user_cb[ev] || ev == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED) && (_user_callbacks[ev])) _user_callbacks[ev](data->cb_info, data->recv_data); else @@ -1623,9 +1618,7 @@ static bool _user_callback_handler(callback_cb_info_s *cb_info, muse_player_even /* LOGD("get event %d", event); */ if (event < MUSE_PLAYER_EVENT_TYPE_NUM) { - if ((cb_info->user_cb[event] && _user_callbacks[event]) || - (event == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME && /* DEPRECATED_PLAYER_INTERNAL_API */ - cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME] && _user_callbacks[event])){ + if (cb_info->user_cb[event] && _user_callbacks[event]){ _player_cb_data *data = NULL; data = g_new(_player_cb_data, 1); if (!data) { diff --git a/src/player_internal.c b/src/player_internal.c index 62061aa..4e37402 100644 --- a/src/player_internal.c +++ b/src/player_internal.c @@ -26,51 +26,6 @@ #include "player_msg.h" #include "player_internal.h" -/* DEPRECATED_PLAYER_INTERNAL_API */ -int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data) -{ - PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(callback); - int ret = PLAYER_ERROR_NONE; - muse_player_api_e api = MUSE_PLAYER_API_SET_PCM_EXTRACTION_MODE; - player_cli_s *pc = (player_cli_s *)player; - char *ret_buf = NULL; - muse_player_event_e event = MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME; - - LOGD("ENTER"); - - PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "sync", sync); - - if (ret == PLAYER_ERROR_NONE) { - pc->cb_info->user_cb[event] = callback; - pc->cb_info->user_data[event] = user_data; - LOGI("Event type : %d ", event); - } - - g_free(ret_buf); - return ret; -} - -/* DEPRECATED_PLAYER_INTERNAL_API */ -int player_set_pcm_spec(player_h player, const char *format, int samplerate, int channel) -{ - PLAYER_INSTANCE_CHECK(player); - int ret = PLAYER_ERROR_NONE; - muse_player_api_e api = MUSE_PLAYER_API_SET_PCM_SPEC; - player_cli_s *pc = (player_cli_s *)player; - char *ret_buf = NULL; - - LOGD("ENTER"); - - PLAYER_SEND_MSG(api, pc, ret_buf, ret, - MUSE_TYPE_STRING, "format", format, - MUSE_TYPE_INT, "samplerate", samplerate, - MUSE_TYPE_INT, "channel", channel); - - g_free(ret_buf); - return ret; -} - int player_set_streaming_playback_rate(player_h player, float rate) { PLAYER_INSTANCE_CHECK(player); diff --git a/test/player_audio_test.c b/test/player_audio_test.c index 1772b6e..ecf1481 100644 --- a/test/player_audio_test.c +++ b/test/player_audio_test.c @@ -148,23 +148,6 @@ static void prepared_cb(void *user_data) g_print("[Player_Audio_Test] prepared_cb!!!!\n"); } -static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s *audio_raw_frame, void *user_data) -{ - player_audio_raw_data_s *audio_raw = audio_raw_frame; - - if (!audio_raw) - return; - - g_print("[Player_Audio_Test] decoded_cb_ex! channel: %d channel_mask: %llu\n", audio_raw->channel, audio_raw->channel_mask); - -#if DUMP_OUTBUF - if (audio_raw->channel_mask == 1 && fp_out1) - fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out1); - else if (audio_raw->channel_mask == 2 && fp_out2) - fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out2); -#endif -} - static void buffering_cb(int percent, void *user_data) { g_print("[Player_Audio_Test] buffering_cb!!!! percent : %d\n", percent); @@ -765,25 +748,6 @@ static void get_duration() g_print(" ==> [Player_Audio_Test] Duration: [%d ] msec\n", duration); } -static void audio_frame_decoded_cb_ex(bool sync) -{ - int ret; -#if DUMP_OUTBUF - fp_out1 = fopen("/tmp/out1.pcm", "wb"); - fp_out2 = fopen("/tmp/out2.pcm", "wb"); - if (!fp_out1 || !fp_out2) { - g_print("File open error\n"); - return; - } -#endif - - ret = player_set_pcm_extraction_mode(g_player[0], sync, _audio_frame_decoded_cb_ex, &ret); - g_print(" ==> [Player_Audio_Test] player_set_audio_frame_decoded_cb_ex(sync:%d) ret:%d\n", sync, ret); - - ret = player_set_pcm_spec(g_player[0], "F32LE", 44100, 2); - g_print("[Player_Audio_Test] set_pcm_spec return: %d\n", ret); -} - static void get_stream_info() { int w = 0; @@ -1048,10 +1012,6 @@ void _interpret_main_menu(char *cmd) g_menu_state = CURRENT_STATUS_HANDLE_NUM; } else if (strncmp(cmd, "tr", 2) == 0) { g_menu_state = CURRENT_STATUS_PLAYBACK_RATE; - } else if (strncmp(cmd, "X3", 2) == 0) { - audio_frame_decoded_cb_ex(TRUE); - } else if (strncmp(cmd, "X4", 2) == 0) { - audio_frame_decoded_cb_ex(FALSE); } else if (strncmp(cmd, "su", 2) == 0) { g_menu_state = CURRENT_STATUS_NEXT_URI; } else if (strncmp(cmd, "gu", 2) == 0) { @@ -1115,8 +1075,6 @@ void display_sub_basic() g_print("[next uri] su. set next uri. \t"); g_print("gu. get next uri. \t"); g_print("sg. set gapless. \n"); - g_print("[audio_frame_decoded_cb_ex] X3. set audio_cb with sync\t"); - g_print("X4. set audio_cb with async \n"); g_print("[etc] sp. Set Progressive Download\t"); g_print("gp. Get Progressive Download status\t"); g_print("mp. memory playback\n"); diff --git a/test/player_test.c b/test/player_test.c index 6e03943..460a7f7 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -598,23 +598,6 @@ static void prepared_cb(void *user_data) g_print("[Player_Test] prepared_cb!!!!\n"); } -static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s *audio_raw_frame, void *user_data) -{ - player_audio_raw_data_s *audio_raw = audio_raw_frame; - - if (!audio_raw) - return; - - g_print("[Player_Test] decoded_cb_ex! channel: %d channel_mask: %llu\n", audio_raw->channel, audio_raw->channel_mask); - -#if DUMP_OUTBUF - if (audio_raw->channel_mask == 1 && fp_out1) - fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out1); - else if (audio_raw->channel_mask == 2 && fp_out2) - fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out2); -#endif -} - static void buffering_cb(int percent, void *user_data) { g_print("[Player_Test] buffering_cb!!!! percent : %d\n", percent); @@ -1537,25 +1520,6 @@ static void get_codec_type(void) g_print(" ==> [Player_Test] Video Codec type: [%d][ret 0x%X]\n", vtype, ret); } -static void audio_frame_decoded_cb_ex(bool sync) -{ - int ret; -#if DUMP_OUTBUF - fp_out1 = fopen("/tmp/out1.pcm", "wb"); - fp_out2 = fopen("/tmp/out2.pcm", "wb"); - if (!fp_out1 || !fp_out2) { - g_print("File open error\n"); - return; - } -#endif - - ret = player_set_pcm_extraction_mode(g_player[0], sync, _audio_frame_decoded_cb_ex, &ret); - g_print(" ==> [Player_Test] player_set_audio_frame_decoded_cb_ex(sync:%d) ret:%d\n", sync, ret); - - ret = player_set_pcm_spec(g_player[0], "F32LE", 44100, 2); - g_print("[Player_Test] set_pcm_spec return: %d\n", ret); -} - static void get_stream_info() { int w = 0; @@ -2416,10 +2380,6 @@ void _interpret_main_menu(char *cmd) g_menu_state = CURRENT_STATUS_HANDLE_NUM; } else if (strncmp(cmd, "tr", 2) == 0) { g_menu_state = CURRENT_STATUS_PLAYBACK_RATE; - } else if (strncmp(cmd, "X3", 2) == 0) { - audio_frame_decoded_cb_ex(TRUE); - } else if (strncmp(cmd, "X4", 2) == 0) { - audio_frame_decoded_cb_ex(FALSE); } else if (strncmp(cmd, "X5", 2) == 0) { g_menu_state = CURRENT_STATUS_EXPORT_PCM_OPTION; } else if (strncmp(cmd, "ep", 2) == 0) { @@ -2539,9 +2499,7 @@ void display_sub_basic() g_print("[next uri] su. set next uri. \t"); g_print("gu. get next uri. \t"); g_print("sg. set gapless. \n"); - g_print("[audio_frame_decoded_cb_ex] X3. set audio_cb with sync\t"); - g_print("X4. set audio_cb with async\t"); - g_print("X5. set audio decoded cb with option\n"); + g_print("[audio_frame_decoded_cb] X5. set audio decoded cb\n"); g_print("[video_frame_decoded_cb] ep. enable tbm surface pool\n"); g_print("[buffering] bf. set new buffering size\n"); g_print("[Video 360] si. check spherical info\t"); -- 2.7.4