* @param[in] type The type of target stream
* @param[in] index The index of track
* @param[out] code A language code in ISO 639-1. "und" will be returned if the language is undefined.
+ * @param[out] len length of language code.
* @return @c 0 on success,
* otherwise a negative error value
* @retval #PLAYER_ERROR_NONE Successful
* @retval #PLAYER_ERROR_NOT_SUPPORTD Not supported
* @pre The player state must be one of these: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
*/
-int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code);
+int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code, int *len);
/**
* @brief Gets the track count.
return PLAYER_ERROR_NONE;
}
-int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code)
+int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code, int *len)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(code);
+ PLAYER_NULL_ARG_CHECK(len);
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);
code_len = 3;
*code = strndup("und", code_len);
}
+ *len = code_len;
if (language_code)
free(language_code);
static void switch_subtitle(int index)
{
+ int len = 0;
char *lang_code = NULL;
+
if (legacy_player_select_track(g_player[0], PLAYER_STREAM_TYPE_TEXT, index) != PLAYER_ERROR_NONE)
g_print("legacy_player_select_track failed\n");
- if (legacy_player_get_track_language_code(g_player[0], PLAYER_STREAM_TYPE_TEXT, index, &lang_code) == PLAYER_ERROR_NONE) {
+ if (legacy_player_get_track_language_code(g_player[0], PLAYER_STREAM_TYPE_TEXT, index, &lang_code, &len) == PLAYER_ERROR_NONE) {
g_print("selected track code %s\n", lang_code);
free(lang_code);
}
ret = PLAYER_ERROR_PERMISSION_DENIED;
LOGE("security check failed %s", privilege);
} else {
- if (strncmp(privilege, INTERNET_PRIVILEGE_NAME, strlen(INTERNET_PRIVILEGE_NAME))) {
+ if (strncmp(privilege, INTERNET_PRIVILEGE_NAME, strlen(INTERNET_PRIVILEGE_NAME)) == 0) {
/*check internet feature*/
if (!_check_network_availability()) {
ret = PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
player_stream_type_e type = PLAYER_STREAM_TYPE_DEFAULT;
int index = 0;
char *code = NULL;
- const int code_len = 2;
+ int code_len = 0;
bool ret_val = TRUE;
player_msg_get2(muse_core_client_get_msg(module), type, INT, index, INT, ret_val);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module);
- ret = legacy_player_get_track_language_code(muse_player->player_handle, type, index, &code);
+ ret = legacy_player_get_track_language_code(muse_player->player_handle, type, index, &code, &code_len);
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
}
Name: mmsvc-player
Summary: A Media Player module for muse server
-Version: 0.2.34
+Version: 0.2.35
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0