From: Eunhae Choi Date: Mon, 14 Nov 2016 05:42:13 +0000 (+0900) Subject: [v0.3.33] consider the lang code len X-Git-Tag: submit/tizen_3.0/20161115.060306~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=921cf828d139e3dbc84d5d1a821b84d605acb243;p=platform%2Fcore%2Fapi%2Fplayer.git [v0.3.33] consider the lang code len Change-Id: Ib52fda460d60716367cd3b4f2c586185549dc79d --- diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index ba22a3d..a728101 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.32 +Version: 0.3.33 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index 26a2a49..549d4a7 100644 --- a/src/player.c +++ b/src/player.c @@ -3917,16 +3917,19 @@ int player_get_track_language_code(player_h player, player_stream_type_e type, i muse_player_api_e api = MUSE_PLAYER_API_GET_TRACK_LANGUAGE_CODE; char *ret_buf = NULL; char code[MUSE_MSG_MAX_LENGTH] = { 0, }; - const int code_len = 2; + int code_len = 0; LOGD("ENTER"); player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, index); if (ret == PLAYER_ERROR_NONE) { - if (player_msg_get_string(code, ret_buf)) + bool recv_ret = TRUE; + player_msg_get1_string(ret_buf, code_len, INT, code, recv_ret); + if (recv_ret) *pcode = strndup(code, code_len); + else + ret = PLAYER_ERROR_INVALID_OPERATION; } - g_free(ret_buf); return ret; } diff --git a/test/player_test.c b/test/player_test.c index ba0d33f..010cf38 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -85,6 +85,7 @@ enum { CURRENT_STATUS_SWITCH_SUBTITLE, CURRENT_STATUS_NEXT_URI, CURRENT_STATUS_GAPLESS, + CURRENT_STATUS_GET_TRACK_INFO, }; #define MAX_HANDLE 20 @@ -1618,6 +1619,35 @@ static void switch_subtitle(int index) } } +static void get_track_info(int index) +{ + int count = 0, cur_index = 0; + int ret = 0; + char *lang_code = NULL; + + if (index != PLAYER_STREAM_TYPE_AUDIO && + index != PLAYER_STREAM_TYPE_TEXT) { + g_print("invalid stream type %d", index); + return; + } + + ret = player_get_track_count(g_player[0], index, &count); + if (ret != PLAYER_ERROR_NONE) + g_print("player_get_track_count fail!!!!\n"); + else if (count) { + int idx = 0; + player_get_current_track(g_player[0], index, &cur_index); + g_print("total track: %d, curr track: %d\n", count, cur_index); + + for (idx = 0; idx < count; idx++) { + player_get_track_language_code(g_player[0], index, idx, &lang_code); + g_print("track info = [%d] %s\n", idx, lang_code); + } + } else { + g_print("no track\n"); + } +} + static void capture_video() { if (player_capture_video(g_player[0], video_captured_cb, NULL) != PLAYER_ERROR_NONE) @@ -1828,6 +1858,8 @@ void _interpret_main_menu(char *cmd) get_next_uri(); } else if (strncmp(cmd, "sg", 2) == 0) { g_menu_state = CURRENT_STATUS_GAPLESS; + } else if (strncmp(cmd, "tl", 2) == 0) { + g_menu_state = CURRENT_STATUS_GET_TRACK_INFO; } else { g_print("unknown menu \n"); } @@ -1948,6 +1980,8 @@ static void displaymenu() g_print("*** input next uri.\n"); } else if (g_menu_state == CURRENT_STATUS_GAPLESS) { g_print("*** input gapless value.(0:disable, 1: enable) \n"); + } else if (g_menu_state == CURRENT_STATUS_GET_TRACK_INFO) { + g_print("*** input stream type.(1:audio, 3:text) \n"); } else { g_print("*** unknown status.\n"); quit_program(); @@ -2149,6 +2183,13 @@ static void interpret(char *cmd) reset_menu_state(); } break; + case CURRENT_STATUS_GET_TRACK_INFO: + { + int index = atoi(cmd); + get_track_info(index); + reset_menu_state(); + } + break; } g_timeout_add(100, timeout_menu_display, 0);