mm_player_t *player = NULL;
int result = MM_ERROR_NONE;
mm_sound_device_flags_e flags = MM_SOUND_DEVICE_IO_DIRECTION_OUT_FLAG | MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG;
- MMSoundDeviceList_t device_list;
+ MMSoundDeviceList_t device_list = NULL;
MMSoundDevice_t device_h = NULL;
mm_sound_device_type_e device_type;
int i = 0;
/* get status if speaker is activated */
/* (1) get current device list */
- result = mm_sound_get_current_device_list(flags, &device_list);
-
- if (result) {
- LOGE("mm_sound_get_current_device_list() failed [%x]!!", result);
+ result = mm_sound_get_device_list(flags, &device_list);
+ if (result != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_device_list() failed [%x]!!", result);
MMPLAYER_FLEAVE();
return result;
}
/* (2) get device handle of device list */
result = mm_sound_get_next_device(device_list, &device_h);
-
- if (result) {
+ if (result != MM_ERROR_NONE) {
LOGE("mm_sound_get_next_device() failed [%x]!!", result);
- MMPLAYER_FLEAVE();
- return result;
+ goto EXIT;
}
/* (3) get device type */
result = mm_sound_get_device_type(device_h, &device_type);
-
- if (result) {
+ if (result != MM_ERROR_NONE) {
LOGE("mm_sound_get_device_type() failed [%x]!!", result);
- MMPLAYER_FLEAVE();
- return result;
+ goto EXIT;
}
if (effect_type == MM_AUDIO_EFFECT_TYPE_PRESET) {
player->ini.audio_effect_preset_earphone_only_list[i])
continue;
- if (!foreach_cb(effect_type, i, user_data))
- goto CALLBACK_ERROR;
+ if (!foreach_cb(effect_type, i, user_data)) {
+ LOGE("foreach callback returned error");
+ result = MM_ERROR_PLAYER_INTERNAL;
+ goto EXIT;
+ }
}
}
} else if (effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM) {
player->ini.audio_effect_custom_earphone_only_list[i]) {
continue;
}
- if (!foreach_cb(effect_type, i, user_data))
- goto CALLBACK_ERROR;
+ if (!foreach_cb(effect_type, i, user_data)) {
+ LOGE("foreach callback returned error");
+ result = MM_ERROR_PLAYER_INTERNAL;
+ goto EXIT;
+ }
}
}
} else {
result = MM_ERROR_INVALID_ARGUMENT;
}
- MMPLAYER_FLEAVE();
-
- return result;
+EXIT:
+ if (device_list)
+ mm_sound_free_device_list(device_list);
-CALLBACK_ERROR:
- LOGE("foreach callback returned error");
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_INTERNAL;
+ return result;
}
{
GstElement *audio_effect_element = NULL;
mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;
- MMSoundDeviceList_t device_list;
+ MMSoundDeviceList_t device_list = NULL;
MMSoundDevice_t device_h = NULL;
mm_sound_device_type_e device_type;
int output_type = 0;
audio_effect_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
/* (1) get current device list */
- result = mm_sound_get_current_device_list(flags, &device_list);
-
- if (result) {
- LOGE("mm_sound_get_current_device_list() failed [%x]!!", result);
+ result = mm_sound_get_device_list(flags, &device_list);
+ if (result != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_device_list() failed [%x]!!", result);
MMPLAYER_FLEAVE();
return result;
}
/* (2) get device handle of device list */
result = mm_sound_get_next_device(device_list, &device_h);
-
- if (result) {
+ if (result != MM_ERROR_NONE) {
LOGE("mm_sound_get_next_device() failed [%x]!!", result);
- MMPLAYER_FLEAVE();
- return result;
+ goto EXIT;
}
/* (3) get device type */
result = mm_sound_get_device_type(device_h, &device_type);
-
- if (result) {
+ if (result != MM_ERROR_NONE) {
LOGE("mm_sound_get_device_type() failed [%x]!!", result);
- MMPLAYER_FLEAVE();
- return result;
+ goto EXIT;
}
/* SPEAKER case */
if (MM_AUDIO_EFFECT_TYPE_SQUARE != effect_type) {
if (__mmplayer_is_earphone_only_effect_type(player, effect_type, effect)) {
LOGE("earphone is not equipped, this filter will not be applied");
- MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
+ result = MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
+ goto EXIT;
}
}
output_type = MM_AUDIO_EFFECT_OUTPUT_SPK;
/* set filter output mode */
g_object_set(audio_effect_element, "filter-output-mode", output_type, NULL);
+EXIT:
+ if (device_list)
+ mm_sound_free_device_list(device_list);
+
+ MMPLAYER_FLEAVE();
return result;
}
{
gboolean result = TRUE;
mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;
- MMSoundDeviceList_t device_list;
+ MMSoundDeviceList_t device_list = NULL;
MMSoundDevice_t device_h = NULL;
mm_sound_device_type_e device_type;
int ret = MM_ERROR_NONE;
/* get status if speaker is activated */
/* (1) get current device list */
- ret = mm_sound_get_current_device_list(flags, &device_list);
- if (ret) {
+ ret = mm_sound_get_device_list(flags, &device_list);
+ if (ret != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- LOGE("mm_sound_get_current_device_list() failed [%x]!!", ret);
+ LOGE("mm_sound_get_device_list() failed [%x]!!", ret);
return FALSE;
}
/* (2) get device handle of device list */
ret = mm_sound_get_next_device(device_list, &device_h);
-
- if (ret) {
+ if (ret != MM_ERROR_NONE) {
LOGE("mm_sound_get_next_device() failed [%x]!!", ret);
- MMPLAYER_FLEAVE();
- return FALSE;
+ goto EXIT;
}
/* (3) get device type */
ret = mm_sound_get_device_type(device_h, &device_type);
-
- if (ret) {
+ if (ret != MM_ERROR_NONE) {
LOGE("mm_sound_get_device_type() failed [%x]!!", ret);
- MMPLAYER_FLEAVE();
- return FALSE;
+ goto EXIT;
}
/* preset */
result = FALSE;
}
+EXIT:
+ if (device_list)
+ mm_sound_free_device_list(device_list);
MMPLAYER_FLEAVE();
-
return result;
}
buffer = gst_sample_get_buffer(sample);\
if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) {\
LOGD("failed to get image data from tag");\
+ gst_sample_unref(sample);\
return FALSE;\
} \
SECURE_LOGD("update album cover data : %p, size : %d\n", info.data, info.size);\
} \
} \
gst_buffer_unmap(buffer, &info);\
+ gst_sample_unref(sample);\
} \
} while (0)
if (util_check_valid_url(proxy))
g_object_set(G_OBJECT(element), "proxy", proxy, NULL);
/* parsing cookies */
- if ((cookie_list = util_get_cookie_list((const char*)cookies)))
+ if ((cookie_list = util_get_cookie_list((const char*)cookies))) {
g_object_set(G_OBJECT(element), "cookies", cookie_list, NULL);
+ g_strfreev (cookie_list);
+ }
if (user_agent)
g_object_set(G_OBJECT(element), "user-agent", user_agent, NULL);
ret = MM_ERROR_NONE;
}
}
- } else if ((path = strstr(uri, "http://"))) {
+ } else if ((path = strstr(uri, "http://")) || (path = strstr(uri, "https://"))) {
if (strlen(path)) {
+ gchar *tmp = NULL;
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
+ tmp = g_ascii_strdown(uri, strlen(uri));
- if (g_str_has_suffix(g_ascii_strdown(uri, strlen(uri)), ".ism/manifest") ||
- g_str_has_suffix(g_ascii_strdown(uri, strlen(uri)), ".isml/manifest"))
+ if (tmp && (g_str_has_suffix(tmp, ".ism/manifest") || g_str_has_suffix(tmp, ".isml/manifest")))
data->uri_type = MM_PLAYER_URI_TYPE_SS;
else
data->uri_type = MM_PLAYER_URI_TYPE_URL_HTTP;
ret = MM_ERROR_NONE;
- }
- } else if ((path = strstr(uri, "https://"))) {
- if (strlen(path)) {
- strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
-
- if (g_str_has_suffix(g_ascii_strdown(uri, strlen(uri)), ".ism/manifest") ||
- g_str_has_suffix(g_ascii_strdown(uri, strlen(uri)), ".isml/manifest"))
- data->uri_type = MM_PLAYER_URI_TYPE_SS;
-
- data->uri_type = MM_PLAYER_URI_TYPE_URL_HTTP;
-
- ret = MM_ERROR_NONE;
+ g_free(tmp);
}
} else if ((path = strstr(uri, "rtspu://"))) {
if (strlen(path)) {