summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAMJEONGYOON <just.nam@samsung.com>2016-08-17 11:20:03 +0900
committerNAMJEONGYOON <just.nam@samsung.com>2016-08-18 12:39:57 +0900
commit6e74ca5b0d088a5031e853f924d603dba41058db (patch)
tree36eba66c38643cfd9bba3d119a0d20ec4fdf70eb
parent76d23e41142acc2d2bb5db200f2e93f2833ad465 (diff)
downloadlibmm-player-6e74ca5b0d088a5031e853f924d603dba41058db.tar.gz
libmm-player-6e74ca5b0d088a5031e853f924d603dba41058db.tar.bz2
libmm-player-6e74ca5b0d088a5031e853f924d603dba41058db.zip
Change-Id: I5f4c5564ef3c5abc4dc0459f31f2f9d42907f9c4
-rw-r--r--packaging/libmm-player.spec2
-rw-r--r--src/mm_player_priv.c5968
2 files changed, 2118 insertions, 3852 deletions
diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec
index e811b53..5060a27 100644
--- a/packaging/libmm-player.spec
+++ b/packaging/libmm-player.spec
@@ -1,6 +1,6 @@
Name: libmm-player
Summary: Multimedia Framework Player Library
-Version: 0.5.94
+Version: 0.5.95
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c
index 15a4927..b7b9734 100644
--- a/src/mm_player_priv.c
+++ b/src/mm_player_priv.c
@@ -144,7 +144,7 @@ static void __mmplayer_gst_element_added(GstElement* bin, GstElement* element, g
static GstElement * __mmplayer_create_decodebin(mm_player_t* player);
static gboolean __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstCaps *caps);
-static void __mmplayer_typefind_have_type( GstElement *tf, guint probability, GstCaps *caps, gpointer data);
+static void __mmplayer_typefind_have_type(GstElement *tf, guint probability, GstCaps *caps, gpointer data);
static gboolean __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps);
static void __mmplayer_pipeline_complete(GstElement *decodebin, gpointer data);
static gboolean __mmplayer_is_midi_type(gchar* str_caps);
@@ -183,12 +183,12 @@ static GstPadProbeReturn __mmplayer_subtitle_adjust_position_probe(GstPad *pad,
static int __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int index);
static gboolean __mmplayer_check_subtitle(mm_player_t* player);
-static gboolean __mmplayer_handle_streaming_error (mm_player_t* player, GstMessage * message);
+static gboolean __mmplayer_handle_streaming_error(mm_player_t* player, GstMessage * message);
static void __mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms);
static void __mmplayer_cancel_eos_timer(mm_player_t* player);
static gboolean __mmplayer_eos_timer_cb(gpointer u_data);
-static gboolean __mmplayer_link_decoder(mm_player_t* player,GstPad *srcpad);
-static gboolean __mmplayer_link_sink(mm_player_t* player,GstPad *srcpad);
+static gboolean __mmplayer_link_decoder(mm_player_t* player, GstPad *srcpad);
+static gboolean __mmplayer_link_sink(mm_player_t* player, GstPad *srcpad);
static int __mmplayer_handle_missed_plugin(mm_player_t* player);
static int __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_class, const gchar* mime);
static gboolean __mmplayer_configure_audio_callback(mm_player_t* player);
@@ -237,7 +237,7 @@ static void __mmplayer_set_unlinked_mime_type(mm_player_t* player, GstCaps *caps
static gboolean __is_ms_buff_src(mm_player_t* player);
static gboolean __has_suffix(mm_player_t * player, const gchar * suffix);
-static int __mmplayer_realize_streaming_ext(mm_player_t* player);
+static int __mmplayer_realize_streaming_ext(mm_player_t* player);
static int __mmplayer_unrealize_streaming_ext(mm_player_t *player);
static int __mmplayer_start_streaming_ext(mm_player_t *player);
static int __mmplayer_destroy_streaming_ext(mm_player_t* player);
@@ -265,7 +265,7 @@ static void __gst_appsrc_enough_video_data(GstElement *element, gpointer user_d
static gboolean __gst_seek_audio_data(GstElement * appsrc, guint64 position, gpointer user_data);
static gboolean __gst_seek_video_data(GstElement * appsrc, guint64 position, gpointer user_data);
static gboolean __gst_seek_subtitle_data(GstElement * appsrc, guint64 position, gpointer user_data);
-static void __mmplayer_gst_caps_notify_cb(GstPad * pad, GParamSpec * unused, gpointer data);
+static void __mmplayer_gst_caps_notify_cb(GstPad * pad, GParamSpec * unused, gpointer data);
static void __mmplayer_audio_stream_clear_buffer(mm_player_t* player, gboolean send_all);
static void __mmplayer_audio_stream_send_data(mm_player_t* player, mm_player_audio_stream_buff_t *a_buffer);
@@ -279,31 +279,28 @@ static void __mmplayer_audio_stream_send_data(mm_player_t* player, mm_player_au
static void
print_tag(const GstTagList * list, const gchar * tag, gpointer unused)
{
- gint i, count;
+ gint i, count;
- count = gst_tag_list_get_tag_size(list, tag);
+ count = gst_tag_list_get_tag_size(list, tag);
- LOGD("count = %d", count);
+ LOGD("count = %d", count);
- for (i = 0; i < count; i++) {
- gchar *str;
+ for (i = 0; i < count; i++) {
+ gchar *str;
- if (gst_tag_get_type(tag) == G_TYPE_STRING) {
- if (!gst_tag_list_get_string_index(list, tag, i, &str))
- g_assert_not_reached();
- } else {
- str =
- g_strdup_value_contents(gst_tag_list_get_value_index(list, tag, i));
- }
+ if (gst_tag_get_type(tag) == G_TYPE_STRING) {
+ if (!gst_tag_list_get_string_index(list, tag, i, &str))
+ g_assert_not_reached();
+ } else
+ str = g_strdup_value_contents(gst_tag_list_get_value_index(list, tag, i));
- if (i == 0) {
- g_print(" %15s: %s\n", gst_tag_get_nick(tag), str);
- } else {
- g_print(" : %s\n", str);
- }
+ if (i == 0)
+ g_print(" %15s: %s\n", gst_tag_get_nick(tag), str);
+ else
+ g_print(" : %s\n", str);
- g_free(str);
- }
+ g_free(str);
+ }
}
#endif
@@ -331,30 +328,26 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
/* check player state here */
if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED &&
- MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING)
- {
+ MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING) {
/* give warning now only */
LOGW("be careful. content attributes may not available in this state ");
}
/* get content attribute first */
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute");
return FALSE;
}
/* get update flag */
- if (flag & ATTR_MISSING_ONLY)
- {
+ if (flag & ATTR_MISSING_ONLY) {
missing_only = TRUE;
LOGD("updating missed attr only");
}
- if (flag & ATTR_ALL)
- {
+ if (flag & ATTR_ALL) {
all = TRUE;
has_duration = FALSE;
has_video_attrs = FALSE;
@@ -364,19 +357,16 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
LOGD("updating all attrs");
}
- if (missing_only && all)
- {
+ if (missing_only && all) {
LOGW("cannot use ATTR_MISSING_ONLY and ATTR_ALL. ignoring ATTR_MISSING_ONLY flag!");
missing_only = FALSE;
}
- if ((flag & ATTR_DURATION) || (!has_duration && missing_only) || all)
- {
+ if ((flag & ATTR_DURATION) || (!has_duration && missing_only) || all) {
LOGD("try to update duration");
has_duration = FALSE;
- if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec))
- {
+ if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec)) {
player->duration = dur_nsec;
LOGW("duration : %lld msec", GST_TIME_AS_MSECONDS(dur_nsec));
}
@@ -386,21 +376,17 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
mm_attrs_set_int_by_name(attrs, "streaming_type", stream_service_type);
/* check duration is OK */
- if (dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING(player))
- {
+ if (dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING(player)) {
/* FIXIT : find another way to get duration here. */
LOGE("finally it's failed to get duration from pipeline. progressbar will not work correctely!");
- }
- else
- {
+ } else {
/*update duration */
mm_attrs_set_int_by_name(attrs, "content_duration", GST_TIME_AS_MSECONDS(dur_nsec));
has_duration = TRUE;
}
}
- if ((flag & ATTR_AUDIO) || (!has_audio_attrs && missing_only) || all)
- {
+ if ((flag & ATTR_AUDIO) || (!has_audio_attrs && missing_only) || all) {
/* update audio params
NOTE : We need original audio params and it can be only obtained from src pad of audio
decoder. Below code only valid when we are not using 'resampler' just before
@@ -410,8 +396,7 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
has_audio_attrs = FALSE;
if (player->pipeline->audiobin &&
- player->pipeline->audiobin[MMPLAYER_A_SINK].gst)
- {
+ player->pipeline->audiobin[MMPLAYER_A_SINK].gst) {
GstCaps *caps_a = NULL;
GstPad* pad = NULL;
gint samplerate = 0, channels = 0;
@@ -419,12 +404,10 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
pad = gst_element_get_static_pad(
player->pipeline->audiobin[MMPLAYER_A_CONV].gst, "sink");
- if (pad)
- {
+ if (pad) {
caps_a = gst_pad_get_current_caps(pad);
- if (caps_a)
- {
+ if (caps_a) {
p = gst_caps_get_structure(caps_a, 0);
mm_attrs_get_int_by_name(attrs, "content_audio_samplerate", &samplerate);
@@ -441,48 +424,37 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
caps_a = NULL;
has_audio_attrs = TRUE;
- }
- else
- {
+ } else
LOGW("not ready to get audio caps");
- }
gst_object_unref(pad);
- }
- else
- {
+ } else
LOGW("failed to get pad from audiosink");
- }
}
}
- if ((flag & ATTR_VIDEO) || (!has_video_attrs && missing_only) || all)
- {
+ if ((flag & ATTR_VIDEO) || (!has_video_attrs && missing_only) || all) {
LOGD("try to update video attrs");
has_video_attrs = FALSE;
if (player->pipeline->videobin &&
- player->pipeline->videobin[MMPLAYER_V_SINK].gst)
- {
+ player->pipeline->videobin[MMPLAYER_V_SINK].gst) {
GstCaps *caps_v = NULL;
GstPad* pad = NULL;
gint tmpNu, tmpDe;
gint width, height;
pad = gst_element_get_static_pad(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sink");
- if (pad)
- {
+ if (pad) {
caps_v = gst_pad_get_current_caps(pad);
/* Use v_stream_caps, if fail to get video_sink sink pad*/
- if (!caps_v && player->v_stream_caps)
- {
+ if (!caps_v && player->v_stream_caps) {
caps_v = player->v_stream_caps;
gst_caps_ref(caps_v);
}
- if (caps_v)
- {
+ if (caps_v) {
p = gst_caps_get_structure(caps_v, 0);
gst_structure_get_int(p, "width", &width);
mm_attrs_set_int_by_name(attrs, "content_video_width", width);
@@ -497,55 +469,39 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
gst_caps_unref(caps_v);
caps_v = NULL;
- if (tmpDe > 0)
- {
+ if (tmpDe > 0) {
mm_attrs_set_int_by_name(attrs, "content_video_fps", tmpNu / tmpDe);
SECURE_LOGD("fps : %d", tmpNu / tmpDe);
}
has_video_attrs = TRUE;
- }
- else
- {
+ } else
LOGD("no negitiated caps from videosink");
- }
gst_object_unref(pad);
pad = NULL;
- }
- else
- {
+ } else
LOGD("no videosink sink pad");
- }
}
}
- if ((flag & ATTR_BITRATE) || (!has_bitrate && missing_only) || all)
- {
+ if ((flag & ATTR_BITRATE) || (!has_bitrate && missing_only) || all) {
has_bitrate = FALSE;
/* FIXIT : please make it clear the dependancy with duration/codec/uritype */
- if (player->duration)
- {
+ if (player->duration) {
guint64 data_size = 0;
- if (!MMPLAYER_IS_STREAMING(player) && (player->can_support_codec & FOUND_PLUGIN_VIDEO))
- {
+ if (!MMPLAYER_IS_STREAMING(player) && (player->can_support_codec & FOUND_PLUGIN_VIDEO)) {
mm_attrs_get_string_by_name(attrs, "profile_uri", &path);
if (stat(path, &sb) == 0)
- {
data_size = (guint64)sb.st_size;
- }
- }
- else if (MMPLAYER_IS_HTTP_STREAMING(player))
- {
+ } else if (MMPLAYER_IS_HTTP_STREAMING(player))
data_size = player->http_content_size;
- }
LOGD("try to update bitrate : data_size = %lld", data_size);
- if (data_size)
- {
+ if (data_size) {
guint64 bitrate = 0;
guint64 msec_dur = 0;
@@ -557,10 +513,8 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
has_bitrate = TRUE;
}
- if (MMPLAYER_IS_RTSP_STREAMING(player))
- {
- if (player->total_bitrate)
- {
+ if (MMPLAYER_IS_RTSP_STREAMING(player)) {
+ if (player->total_bitrate) {
mm_attrs_set_int_by_name(attrs, "content_video_bitrate", player->total_bitrate);
has_bitrate = TRUE;
}
@@ -569,8 +523,7 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
}
/* validate all */
- if ( mmf_attrs_commit(attrs))
- {
+ if (mmf_attrs_commit(attrs)) {
LOGE("failed to update attributes\n");
return FALSE;
}
@@ -597,24 +550,21 @@ static gboolean __mmplayer_get_stream_service_type(mm_player_t* player)
return STREAMING_SERVICE_NONE;
if (MMPLAYER_IS_HTTP_STREAMING(player))
- {
streaming_type = (player->duration == 0) ?
STREAMING_SERVICE_LIVE : STREAMING_SERVICE_VOD;
- }
- switch (streaming_type)
- {
- case STREAMING_SERVICE_LIVE:
- LOGD("it's live streaming");
+ switch (streaming_type) {
+ case STREAMING_SERVICE_LIVE:
+ LOGD("it's live streaming");
break;
- case STREAMING_SERVICE_VOD:
- LOGD("it's vod streaming");
+ case STREAMING_SERVICE_VOD:
+ LOGD("it's vod streaming");
break;
- case STREAMING_SERVICE_NONE:
- LOGE("should not get here");
+ case STREAMING_SERVICE_NONE:
+ LOGE("should not get here");
break;
- default:
- LOGE("should not get here");
+ default:
+ LOGE("should not get here");
}
player->streaming_type = streaming_type;
@@ -639,8 +589,7 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if (MMPLAYER_CURRENT_STATE(player) == state)
- {
+ if (MMPLAYER_CURRENT_STATE(player) == state) {
LOGW("already same state(%s)\n", MMPLAYER_STATE_GET_NAME(state));
MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE;
return ret;
@@ -665,16 +614,13 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
interrupted_by_focus = player->sound_focus.by_asm_cb;
interrupted_by_resource = player->resource_manager.by_rm_cb;
- switch (MMPLAYER_CURRENT_STATE(player))
- {
- case MM_PLAYER_STATE_NULL:
- case MM_PLAYER_STATE_READY:
+ switch (MMPLAYER_CURRENT_STATE(player)) {
+ case MM_PLAYER_STATE_NULL:
+ case MM_PLAYER_STATE_READY:
{
- if (player->cmd == MMPLAYER_COMMAND_STOP)
- {
+ if (player->cmd == MMPLAYER_COMMAND_STOP) {
sound_result = _mmplayer_sound_release_focus(&player->sound_focus);
- if (sound_result != MM_ERROR_NONE)
- {
+ if (sound_result != MM_ERROR_NONE) {
LOGE("failed to release sound focus\n");
return MM_ERROR_POLICY_INTERNAL;
}
@@ -682,10 +628,9 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
}
break;
- case MM_PLAYER_STATE_PAUSED:
+ case MM_PLAYER_STATE_PAUSED:
{
- if (!player->sent_bos)
- {
+ if (!player->sent_bos) {
int found = 0;
#define MMPLAYER_MAX_SOUND_PRIORITY 3
@@ -693,11 +638,9 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
_mmplayer_update_content_attrs(player, ATTR_ALL);
/* set max sound priority to keep own sound and not to mute other's one */
mm_attrs_get_int_by_name(player->attrs, "content_video_found", &found);
- if (found)
- {
+ if (found) {
mm_attrs_get_int_by_name(player->attrs, "content_audio_found", &found);
- if (found)
- {
+ if (found) {
LOGD("set max audio priority");
g_object_set(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "priority", MMPLAYER_MAX_SOUND_PRIORITY, NULL);
}
@@ -707,16 +650,12 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
/* add audio callback probe if condition is satisfied */
if (!player->audio_cb_probe_id && player->set_mode.pcm_extraction && !player->audio_stream_render_cb_ex)
- {
__mmplayer_configure_audio_callback(player);
/* FIXIT : handle return value */
- }
- if (!MMPLAYER_IS_STREAMING(player) || (player->streamer && !player->streamer->is_buffering))
- {
+ if (!MMPLAYER_IS_STREAMING(player) || (player->streamer && !player->streamer->is_buffering)) {
sound_result = _mmplayer_sound_release_focus(&player->sound_focus);
- if (sound_result != MM_ERROR_NONE)
- {
+ if (sound_result != MM_ERROR_NONE) {
LOGE("failed to release sound focus\n");
return MM_ERROR_POLICY_INTERNAL;
}
@@ -724,29 +663,23 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
}
break;
- case MM_PLAYER_STATE_PLAYING:
+ case MM_PLAYER_STATE_PLAYING:
{
/* try to get content metadata */
- if (!player->sent_bos)
- {
+ if (!player->sent_bos) {
/* NOTE : giving ATTR_MISSING_ONLY may have dependency with
* c-api since c-api doesn't use _start() anymore. It may not work propery with
* legacy mmfw-player api */
_mmplayer_update_content_attrs(player, ATTR_MISSING_ONLY);
}
- if ((player->cmd == MMPLAYER_COMMAND_START) || (player->cmd == MMPLAYER_COMMAND_RESUME))
- {
+ if ((player->cmd == MMPLAYER_COMMAND_START) || (player->cmd == MMPLAYER_COMMAND_RESUME)) {
if (!player->sent_bos)
- {
__mmplayer_handle_missed_plugin(player);
- }
sound_result = _mmplayer_sound_acquire_focus(&player->sound_focus);
- if (sound_result != MM_ERROR_NONE)
- {
+ if (sound_result != MM_ERROR_NONE) {
// FIXME : need to check history
- if (player->pipeline->videobin)
- {
+ if (player->pipeline->videobin) {
MMMessageParamType msg = {0, };
LOGE("failed to go ahead because of video conflict\n");
@@ -756,9 +689,7 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
_mmplayer_unrealize((MMHandleType)player);
- }
- else
- {
+ } else {
LOGE("failed to play by sound focus error : 0x%X\n", sound_result);
_mmplayer_pause((MMHandleType)player);
return sound_result;
@@ -768,15 +699,13 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
}
}
- if (player->resumed_by_rewind && player->playback_rate < 0.0)
- {
+ if (player->resumed_by_rewind && player->playback_rate < 0.0) {
/* initialize because auto resume is done well. */
player->resumed_by_rewind = FALSE;
player->playback_rate = 1.0;
}
- if (!player->sent_bos)
- {
+ if (!player->sent_bos) {
/* check audio codec field is set or not
* we can get it from typefinder or codec's caps.
*/
@@ -787,25 +716,15 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
* Because, parser don't make related TAG.
* So, if it's not set yet, fill it with found data.
*/
- if (!audio_codec)
- {
+ if (!audio_codec) {
if (g_strrstr(player->type, "audio/midi"))
- {
audio_codec = g_strdup("MIDI");
-
- }
else if (g_strrstr(player->type, "audio/x-amr"))
- {
audio_codec = g_strdup("AMR");
- }
else if (g_strrstr(player->type, "audio/mpeg") && !g_strrstr(player->type, "mpegversion= (int)1"))
- {
audio_codec = g_strdup("AAC");
- }
else
- {
audio_codec = g_strdup("unknown");
- }
mm_attrs_set_string_by_name(player->attrs, "content_audio_codec", audio_codec);
MMPLAYER_FREEIF(audio_codec);
@@ -818,16 +737,15 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
}
break;
- case MM_PLAYER_STATE_NONE:
- default:
- LOGW("invalid target state, there is nothing to do.\n");
- break;
+ case MM_PLAYER_STATE_NONE:
+ default:
+ LOGW("invalid target state, there is nothing to do.\n");
+ break;
}
/* post message to application */
- if (MMPLAYER_TARGET_STATE(player) == state)
- {
+ if (MMPLAYER_TARGET_STATE(player) == state) {
/* fill the message with state of player */
msg.state.previous = MMPLAYER_PREV_STATE(player);
msg.state.current = MMPLAYER_CURRENT_STATE(player);
@@ -835,30 +753,22 @@ __mmplayer_set_state(mm_player_t* player, int state) // @
LOGD("player reach the target state (%s)", MMPLAYER_STATE_GET_NAME(MMPLAYER_TARGET_STATE(player)));
/* state changed by focus or resource callback */
- if (interrupted_by_focus || interrupted_by_resource)
- {
+ if (interrupted_by_focus || interrupted_by_resource) {
msg.union_type = MM_MSG_UNION_CODE;
if (interrupted_by_focus)
msg.code = player->sound_focus.focus_changed_msg; /* FIXME: player.c convert function have to be modified. */
else if (interrupted_by_resource)
msg.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
- }
- /* state changed by usecase */
- else
- {
+ } else /* state changed by usecase */
MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_CHANGED, &msg);
- }
- }
- else
- {
+ } else {
LOGD("intermediate state, do nothing.\n");
MMPLAYER_PRINT_STATE(player);
return ret;
}
- if (post_bos)
- {
+ if (post_bos) {
MMPLAYER_POST_MSG(player, MM_MESSAGE_BEGIN_OF_STREAM, NULL);
player->sent_bos = TRUE;
}
@@ -874,17 +784,14 @@ static gpointer __mmplayer_next_play_thread(gpointer data)
MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
g_mutex_lock(&player->next_play_thread_mutex);
- while (!player->next_play_thread_exit)
- {
+ while (!player->next_play_thread_exit) {
LOGD("next play thread started. waiting for signal.\n");
g_cond_wait(&player->next_play_thread_cond, &player->next_play_thread_mutex);
LOGD("reconfigure pipeline for gapless play.\n");
- if (player->next_play_thread_exit)
- {
- if (player->gapless.reconfigure)
- {
+ if (player->next_play_thread_exit) {
+ if (player->gapless.reconfigure) {
player->gapless.reconfigure = false;
MMPLAYER_PLAYBACK_UNLOCK(player);
}
@@ -917,13 +824,11 @@ static gpointer __mmplayer_repeat_thread(gpointer data)
MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
g_mutex_lock(&player->repeat_thread_mutex);
- while (!player->repeat_thread_exit)
- {
+ while (!player->repeat_thread_exit) {
LOGD("repeat thread started. waiting for signal.\n");
g_cond_wait(&player->repeat_thread_cond, &player->repeat_thread_mutex);
- if (player->repeat_thread_exit)
- {
+ if (player->repeat_thread_exit) {
LOGD("exiting repeat thread\n");
break;
}
@@ -934,20 +839,15 @@ static gpointer __mmplayer_repeat_thread(gpointer data)
attrs = MMPLAYER_GET_ATTRS(player);
- if (mm_attrs_get_int_by_name(attrs, "profile_play_count", &count) != MM_ERROR_NONE)
- {
+ if (mm_attrs_get_int_by_name(attrs, "profile_play_count", &count) != MM_ERROR_NONE) {
LOGE("can not get play count\n");
break;
}
- if (player->section_repeat)
- {
+ if (player->section_repeat) {
ret_value = _mmplayer_activate_section_repeat((MMHandleType)player, player->section_repeat_start, player->section_repeat_end);
- }
- else
- {
- if (player->playback_rate < 0.0)
- {
+ } else {
+ if (player->playback_rate < 0.0) {
player->resumed_by_rewind = TRUE;
_mmplayer_set_mute((MMHandleType)player, 0);
MMPLAYER_POST_MSG(player, MM_MESSAGE_RESUMED_BY_REW, NULL);
@@ -961,15 +861,13 @@ static gpointer __mmplayer_repeat_thread(gpointer data)
player->sent_bos = FALSE;
}
- if (!ret_value)
- {
+ if (!ret_value) {
LOGE("failed to set position to zero for rewind\n");
continue;
}
/* decrease play count */
- if (count > 1)
- {
+ if (count > 1) {
/* we successeded to rewind. update play count and then wait for next EOS */
count--;
@@ -977,9 +875,7 @@ static gpointer __mmplayer_repeat_thread(gpointer data)
/* commit attribute */
if (mmf_attrs_commit(attrs))
- {
LOGE("failed to commit attribute\n");
- }
}
/* unlock */
@@ -1004,27 +900,20 @@ __mmplayer_update_buffer_setting(mm_player_t *player, GstMessage *buffering_msg)
__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &pos_msec); // update last_position
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("fail to get attributes.\n");
return;
}
- if (!MMPLAYER_IS_STREAMING(player) && (player->can_support_codec & FOUND_PLUGIN_VIDEO))
- {
+ if (!MMPLAYER_IS_STREAMING(player) && (player->can_support_codec & FOUND_PLUGIN_VIDEO)) {
mm_attrs_get_string_by_name(attrs, "profile_uri", &path);
if (stat(path, &sb) == 0)
- {
data_size = (guint64)sb.st_size;
- }
- }
- else if (MMPLAYER_IS_HTTP_STREAMING(player))
- {
+ } else if (MMPLAYER_IS_HTTP_STREAMING(player))
data_size = player->http_content_size;
- }
- __mm_player_streaming_buffering( player->streamer,
+ __mm_player_streaming_buffering(player->streamer,
buffering_msg,
data_size,
player->last_position,
@@ -1044,8 +933,7 @@ __mmplayer_handle_buffering_message(mm_player_t* player)
MMPlayerStateType target_state = MM_PLAYER_STATE_NONE;
MMPlayerStateType pending_state = MM_PLAYER_STATE_NONE;
- if (!player || !player->streamer || (MMPLAYER_IS_LIVE_STREAMING(player) && MMPLAYER_IS_RTSP_STREAMING(player)))
- {
+ if (!player || !player->streamer || (MMPLAYER_IS_LIVE_STREAMING(player) && MMPLAYER_IS_RTSP_STREAMING(player))) {
LOGW("do nothing for buffering msg\n");
ret = MM_ERROR_PLAYER_INVALID_STATE;
goto exit;
@@ -1063,110 +951,86 @@ __mmplayer_handle_buffering_message(mm_player_t* player)
MMPLAYER_STATE_GET_NAME(target_state),
player->streamer->is_buffering);
- if (!player->streamer->is_buffering)
- {
+ if (!player->streamer->is_buffering) {
/* NOTE : if buffering has done, player has to go to target state. */
- switch (target_state)
- {
- case MM_PLAYER_STATE_PAUSED :
+ switch (target_state) {
+ case MM_PLAYER_STATE_PAUSED:
{
- switch (pending_state)
- {
- case MM_PLAYER_STATE_PLAYING:
- {
- __gst_pause(player, TRUE);
- }
+ switch (pending_state) {
+ case MM_PLAYER_STATE_PLAYING:
+ __gst_pause(player, TRUE);
break;
- case MM_PLAYER_STATE_PAUSED:
- {
- LOGD("player is already going to paused state, there is nothing to do.\n");
- }
+ case MM_PLAYER_STATE_PAUSED:
+ LOGD("player is already going to paused state, there is nothing to do.\n");
break;
- case MM_PLAYER_STATE_NONE:
- case MM_PLAYER_STATE_NULL:
- case MM_PLAYER_STATE_READY:
- default :
- {
- LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
- }
- break;
+ case MM_PLAYER_STATE_NONE:
+ case MM_PLAYER_STATE_NULL:
+ case MM_PLAYER_STATE_READY:
+ default:
+ LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
+ break;
}
}
break;
- case MM_PLAYER_STATE_PLAYING :
+ case MM_PLAYER_STATE_PLAYING:
{
- switch (pending_state)
- {
- case MM_PLAYER_STATE_NONE:
+ switch (pending_state) {
+ case MM_PLAYER_STATE_NONE:
{
if (current_state != MM_PLAYER_STATE_PLAYING)
__gst_resume(player, TRUE);
}
break;
- case MM_PLAYER_STATE_PAUSED:
- {
- /* NOTE: It should be worked as asynchronously.
- * Because, buffering can be completed during autoplugging when pipeline would try to go playing state directly.
- */
- __gst_resume(player, TRUE);
- }
+ case MM_PLAYER_STATE_PAUSED:
+ /* NOTE: It should be worked as asynchronously.
+ * Because, buffering can be completed during autoplugging when pipeline would try to go playing state directly.
+ */
+ __gst_resume(player, TRUE);
break;
- case MM_PLAYER_STATE_PLAYING:
- {
- LOGD("player is already going to playing state, there is nothing to do.\n");
- }
+ case MM_PLAYER_STATE_PLAYING:
+ LOGD("player is already going to playing state, there is nothing to do.\n");
break;
- case MM_PLAYER_STATE_NULL:
- case MM_PLAYER_STATE_READY:
- default :
- {
- LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
- }
- break;
+ case MM_PLAYER_STATE_NULL:
+ case MM_PLAYER_STATE_READY:
+ default:
+ LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
+ break;
}
}
break;
- case MM_PLAYER_STATE_NULL :
- case MM_PLAYER_STATE_READY :
- case MM_PLAYER_STATE_NONE :
- default:
- {
- LOGW("invalid target state [%s].\n", MMPLAYER_STATE_GET_NAME(target_state));
- }
- break;
+ case MM_PLAYER_STATE_NULL:
+ case MM_PLAYER_STATE_READY:
+ case MM_PLAYER_STATE_NONE:
+ default:
+ LOGW("invalid target state [%s].\n", MMPLAYER_STATE_GET_NAME(target_state));
+ break;
}
- }
- else
- {
+ } else {
/* NOTE : during the buffering, pause the player for stopping pipeline clock.
* it's for stopping the pipeline clock to prevent dropping the data in sink element.
*/
- switch (pending_state)
- {
- case MM_PLAYER_STATE_NONE:
+ switch (pending_state) {
+ case MM_PLAYER_STATE_NONE:
{
- if (current_state != MM_PLAYER_STATE_PAUSED)
- {
+ if (current_state != MM_PLAYER_STATE_PAUSED) {
LOGD("set pause state during buffering\n");
__gst_pause(player, TRUE);
// to cover the weak-signal environment.
- if (MMPLAYER_IS_RTSP_STREAMING(player))
- {
+ if (MMPLAYER_IS_RTSP_STREAMING(player)) {
unsigned long position = 0;
gint64 pos_msec = 0;
LOGD("[RTSP] seek to the buffering start point\n");
- if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position))
- {
+ if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position)) {
LOGE("failed to get position\n");
break;
}
@@ -1182,24 +1046,18 @@ __mmplayer_handle_buffering_message(mm_player_t* player)
}
break;
- case MM_PLAYER_STATE_PLAYING:
- {
- __gst_pause(player, TRUE);
- }
+ case MM_PLAYER_STATE_PLAYING:
+ __gst_pause(player, TRUE);
break;
- case MM_PLAYER_STATE_PAUSED:
- {
- }
+ case MM_PLAYER_STATE_PAUSED:
break;
- case MM_PLAYER_STATE_NULL:
- case MM_PLAYER_STATE_READY:
- default :
- {
- LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
- }
- break;
+ case MM_PLAYER_STATE_NULL:
+ case MM_PLAYER_STATE_READY:
+ default:
+ LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
+ break;
}
}
@@ -1221,19 +1079,15 @@ __mmplayer_drop_subtitle(mm_player_t* player, gboolean is_drop)
textbin = player->pipeline->textbin;
- if (is_drop)
- {
+ if (is_drop) {
LOGD("Drop subtitle text after getting EOS\n");
g_object_set(textbin[MMPLAYER_T_FAKE_SINK].gst, "async", FALSE, NULL);
g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)1.0, NULL);
player->is_subtitle_force_drop = TRUE;
- }
- else
- {
- if (player->is_subtitle_force_drop == TRUE)
- {
+ } else {
+ if (player->is_subtitle_force_drop == TRUE) {
LOGD("Enable subtitle data path without drop\n");
g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)0.0, NULL);
@@ -1256,13 +1110,12 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
MMPLAYER_RETURN_VAL_IF_FAIL(msg && GST_IS_MESSAGE(msg), FALSE);
- switch (GST_MESSAGE_TYPE(msg))
- {
- case GST_MESSAGE_UNKNOWN:
- LOGD("unknown message received\n");
+ switch (GST_MESSAGE_TYPE(msg)) {
+ case GST_MESSAGE_UNKNOWN:
+ LOGD("unknown message received\n");
break;
- case GST_MESSAGE_EOS:
+ case GST_MESSAGE_EOS:
{
MMHandleType attrs = 0;
gint count = 0;
@@ -1271,19 +1124,16 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
/* NOTE : EOS event is comming multiple time. watch out it */
/* check state. we only process EOS when pipeline state goes to PLAYING */
- if (!(player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME))
- {
+ if (!(player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME)) {
LOGD("EOS received on non-playing state. ignoring it\n");
break;
}
- if (player->pipeline)
- {
+ if (player->pipeline) {
if (player->pipeline->textbin)
__mmplayer_drop_subtitle(player, TRUE);
- if ((player->audio_stream_cb) && (player->set_mode.pcm_extraction) && (!player->audio_stream_render_cb_ex))
- {
+ if ((player->audio_stream_cb) && (player->set_mode.pcm_extraction) && (!player->audio_stream_render_cb_ex)) {
GstPad *pad = NULL;
pad = gst_element_get_static_pad(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "sink");
@@ -1299,16 +1149,14 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
}
- if ((player->audio_stream_render_cb_ex) && (!player->audio_stream_sink_sync)) {
+ if ((player->audio_stream_render_cb_ex) && (!player->audio_stream_sink_sync))
__mmplayer_audio_stream_clear_buffer(player, TRUE);
- }
/* rewind if repeat count is greater then zero */
/* get play count */
attrs = MMPLAYER_GET_ATTRS(player);
- if (attrs)
- {
+ if (attrs) {
gboolean smooth_repeat = FALSE;
mm_attrs_get_int_by_name(attrs, "profile_play_count", &count);
@@ -1318,28 +1166,20 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
LOGD("remaining play count: %d, playback rate: %f\n", count, player->playback_rate);
- if (count > 1 || count == -1 || player->playback_rate < 0.0) /* default value is 1 */
- {
- if (smooth_repeat)
- {
+ if (count > 1 || count == -1 || player->playback_rate < 0.0) /* default value is 1 */ {
+ if (smooth_repeat) {
LOGD("smooth repeat enabled. seeking operation will be excuted in new thread\n");
g_cond_signal(&player->repeat_thread_cond);
break;
- }
- else
- {
+ } else {
gint ret_value = 0;
- if (player->section_repeat)
- {
+ if (player->section_repeat) {
ret_value = _mmplayer_activate_section_repeat((MMHandleType)player, player->section_repeat_start, player->section_repeat_end);
- }
- else
- {
- if (player->playback_rate < 0.0)
- {
+ } else {
+ if (player->playback_rate < 0.0) {
player->resumed_by_rewind = TRUE;
_mmplayer_set_mute((MMHandleType)player, 0);
MMPLAYER_POST_MSG(player, MM_MESSAGE_RESUMED_BY_REW, NULL);
@@ -1352,9 +1192,7 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
if (MM_ERROR_NONE != ret_value)
- {
LOGE("failed to set position to zero for rewind\n");
- }
/* not posting eos when repeating */
break;
@@ -1373,7 +1211,7 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
break;
- case GST_MESSAGE_ERROR:
+ case GST_MESSAGE_ERROR:
{
GError *error = NULL;
gchar* debug = NULL;
@@ -1384,8 +1222,7 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
/* get error code */
gst_message_parse_error(msg, &error, &debug);
- if (gst_structure_has_name(gst_message_get_structure(msg), "streaming_error"))
- {
+ if (gst_structure_has_name(gst_message_get_structure(msg), "streaming_error")) {
/* Note : the streaming error from the streaming source is handled
* using __mmplayer_handle_streaming_error.
*/
@@ -1393,32 +1230,25 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
/* dump state of all element */
__mmplayer_dump_pipeline_state(player);
- }
- else
- {
+ } else {
/* traslate gst error code to msl error code. then post it
* to application if needed
*/
__mmplayer_handle_gst_error(player, msg, error);
if (debug)
- {
LOGE("error debug : %s", debug);
- }
-
}
if (MMPLAYER_IS_HTTP_PD(player))
- {
_mmplayer_unrealize_pd_downloader((MMHandleType)player);
- }
MMPLAYER_FREEIF(debug);
g_error_free(error);
}
break;
- case GST_MESSAGE_WARNING:
+ case GST_MESSAGE_WARNING:
{
char* debug = NULL;
GError* error = NULL;
@@ -1435,17 +1265,15 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
break;
- case GST_MESSAGE_TAG:
+ case GST_MESSAGE_TAG:
{
LOGD("GST_MESSAGE_TAG\n");
if (!__mmplayer_gst_extract_tag_from_msg(player, msg))
- {
LOGW("failed to extract tags from gstmessage\n");
- }
}
break;
- case GST_MESSAGE_BUFFERING:
+ case GST_MESSAGE_BUFFERING:
{
MMMessageParamType msg_param = {0, };
@@ -1460,14 +1288,12 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
/* ignore the prev buffering message */
- if ((player->streamer) && (player->streamer->is_buffering == FALSE) && (player->streamer->is_buffering_done == TRUE))
- {
+ if ((player->streamer) && (player->streamer->is_buffering == FALSE) && (player->streamer->is_buffering_done == TRUE)) {
gint buffer_percent = 0;
gst_message_parse_buffering(msg, &buffer_percent);
- if (buffer_percent == MAX_BUFFER_PERCENT)
- {
+ if (buffer_percent == MAX_BUFFER_PERCENT) {
LOGD("Ignored all the previous buffering msg!(got %d%%)\n", buffer_percent);
player->streamer->is_buffering_done = FALSE;
}
@@ -1479,23 +1305,16 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
__mmplayer_update_buffer_setting(player, msg);
if (__mmplayer_handle_buffering_message(player) == MM_ERROR_NONE) {
-
msg_param.connection.buffering = player->streamer->buffering_percent;
MMPLAYER_POST_MSG(player, MM_MESSAGE_BUFFERING, &msg_param);
if (MMPLAYER_IS_RTSP_STREAMING(player) &&
- (player->streamer->buffering_percent >= MAX_BUFFER_PERCENT))
- {
- if (player->doing_seek)
- {
- if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED)
- {
+ (player->streamer->buffering_percent >= MAX_BUFFER_PERCENT)) {
+ if (player->doing_seek) {
+ if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED) {
player->doing_seek = FALSE;
MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
- }
- else if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PLAYING)
- {
+ } else if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PLAYING)
async_done = TRUE;
- }
}
}
}
@@ -1503,7 +1322,7 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
break;
- case GST_MESSAGE_STATE_CHANGED:
+ case GST_MESSAGE_STATE_CHANGED:
{
MMPlayerGstElement *mainbin;
const GValue *voldstate, *vnewstate, *vpending;
@@ -1511,8 +1330,7 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
GstState newstate = GST_STATE_NULL;
GstState pending = GST_STATE_NULL;
- if (!(player->pipeline && player->pipeline->mainbin))
- {
+ if (!(player->pipeline && player->pipeline->mainbin)) {
LOGE("player pipeline handle is null");
break;
}
@@ -1544,69 +1362,60 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
gst_element_state_get_name((GstState)newstate),
gst_element_state_get_name((GstState)pending));
- if (oldstate == newstate)
- {
+ if (oldstate == newstate) {
LOGD("pipeline reports state transition to old state");
break;
}
- switch (newstate)
- {
- case GST_STATE_VOID_PENDING:
+ switch (newstate) {
+ case GST_STATE_VOID_PENDING:
break;
- case GST_STATE_NULL:
+ case GST_STATE_NULL:
break;
- case GST_STATE_READY:
+ case GST_STATE_READY:
break;
- case GST_STATE_PAUSED:
+ case GST_STATE_PAUSED:
{
gboolean prepare_async = FALSE;
if (!player->audio_cb_probe_id && player->set_mode.pcm_extraction && !player->audio_stream_render_cb_ex)
__mmplayer_configure_audio_callback(player);
- if (!player->sent_bos && oldstate == GST_STATE_READY) // managed prepare async case
- {
+ if (!player->sent_bos && oldstate == GST_STATE_READY) {
+ // managed prepare async case
mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &prepare_async);
LOGD("checking prepare mode for async transition - %d", prepare_async);
}
- if (MMPLAYER_IS_STREAMING(player) || MMPLAYER_IS_MS_BUFF_SRC(player) || prepare_async)
- {
+ if (MMPLAYER_IS_STREAMING(player) || MMPLAYER_IS_MS_BUFF_SRC(player) || prepare_async) {
MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PAUSED);
if (MMPLAYER_IS_STREAMING(player) && (player->streamer))
- {
__mm_player_streaming_set_content_bitrate(player->streamer,
player->total_maximum_bitrate, player->total_bitrate);
- }
}
}
break;
- case GST_STATE_PLAYING:
+ case GST_STATE_PLAYING:
{
- if (MMPLAYER_IS_STREAMING(player)) // managed prepare async case when buffering is completed
- {
+ if (MMPLAYER_IS_STREAMING(player)) {
+ // managed prepare async case when buffering is completed
// pending state should be reset oyherwise, it's still playing even though it's resumed after bufferging.
if ((MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING) ||
(MMPLAYER_PENDING_STATE(player) == MM_PLAYER_STATE_PLAYING))
- {
MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
- }
}
- if (player->gapless.stream_changed)
- {
+ if (player->gapless.stream_changed) {
_mmplayer_update_content_attrs(player, ATTR_ALL);
player->gapless.stream_changed = FALSE;
}
- if (player->doing_seek && async_done)
- {
+ if (player->doing_seek && async_done) {
player->doing_seek = FALSE;
async_done = FALSE;
MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
@@ -1614,13 +1423,13 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
break;
- default:
+ default:
break;
}
}
break;
- case GST_MESSAGE_CLOCK_LOST:
+ case GST_MESSAGE_CLOCK_LOST:
{
GstClock *clock = NULL;
gboolean need_new_clock = FALSE;
@@ -1629,13 +1438,9 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
LOGD("GST_MESSAGE_CLOCK_LOST : %s\n", (clock ? GST_OBJECT_NAME(clock) : "NULL"));
if (!player->videodec_linked)
- {
need_new_clock = TRUE;
- }
else if (!player->ini.use_system_clock)
- {
need_new_clock = TRUE;
- }
if (need_new_clock) {
LOGD("Provide clock is TRUE, do pause->resume\n");
@@ -1645,7 +1450,7 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
break;
- case GST_MESSAGE_NEW_CLOCK:
+ case GST_MESSAGE_NEW_CLOCK:
{
GstClock *clock = NULL;
gst_message_parse_new_clock(msg, &clock);
@@ -1653,15 +1458,14 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
break;
- case GST_MESSAGE_ELEMENT:
+ case GST_MESSAGE_ELEMENT:
{
const gchar *structure_name;
gint count = 0;
MMHandleType attrs = 0;
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute");
ret = FALSE;
break;
@@ -1674,8 +1478,7 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
if (!structure_name)
break;
- if (!strcmp(structure_name, "prepare-decode-buffers"))
- {
+ if (!strcmp(structure_name, "prepare-decode-buffers")) {
gint num_buffers = 0;
gint extra_num_buffers = 0;
@@ -1691,43 +1494,35 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
break;
}
- if (!strcmp(structure_name, "Language_list"))
- {
+ if (!strcmp(structure_name, "Language_list")) {
const GValue *lang_list = NULL;
lang_list = gst_structure_get_value(gst_message_get_structure(msg), "lang_list");
- if (lang_list != NULL)
- {
+ if (lang_list != NULL) {
count = g_list_length((GList *)g_value_get_pointer(lang_list));
if (count > 1)
- LOGD("Total audio tracks(from parser) = %d \n",count);
+ LOGD("Total audio tracks(from parser) = %d \n", count);
}
}
- if (!strcmp(structure_name, "Ext_Sub_Language_List"))
- {
+ if (!strcmp(structure_name, "Ext_Sub_Language_List")) {
const GValue *lang_list = NULL;
MMPlayerLangStruct *temp = NULL;
lang_list = gst_structure_get_value(gst_message_get_structure(msg), "lang_list");
- if (lang_list != NULL)
- {
+ if (lang_list != NULL) {
count = g_list_length((GList *)g_value_get_pointer(lang_list));
- if (count)
- {
+ if (count) {
player->subtitle_language_list = (GList *)g_value_get_pointer(lang_list);
mm_attrs_set_int_by_name(attrs, "content_text_track_num", (gint)count);
if (mmf_attrs_commit(attrs))
LOGE("failed to commit.\n");
LOGD("Total subtitle tracks = %d \n", count);
}
- while (count)
- {
+ while (count) {
temp = g_list_nth_data(player->subtitle_language_list, count - 1);
if (temp)
- {
LOGD("value of lang_key is %s and lang_code is %s",
temp->language_key, temp->language_code);
- }
count--;
}
}
@@ -1742,25 +1537,21 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
break;
- case GST_MESSAGE_DURATION_CHANGED:
+ case GST_MESSAGE_DURATION_CHANGED:
{
LOGD("GST_MESSAGE_DURATION_CHANGED\n");
ret = __mmplayer_gst_handle_duration(player, msg);
if (!ret)
- {
LOGW("failed to update duration");
- }
}
break;
- case GST_MESSAGE_ASYNC_START:
- {
+ case GST_MESSAGE_ASYNC_START:
LOGD("GST_MESSAGE_ASYNC_START : %s\n", GST_ELEMENT_NAME(GST_MESSAGE_SRC(msg)));
- }
break;
- case GST_MESSAGE_ASYNC_DONE:
+ case GST_MESSAGE_ASYNC_DONE:
{
LOGD("GST_MESSAGE_ASYNC_DONE : %s\n", GST_ELEMENT_NAME(GST_MESSAGE_SRC(msg)));
@@ -1768,39 +1559,30 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
if (msg->src != (GstObject *)player->pipeline->mainbin[MMPLAYER_M_PIPE].gst)
break;
- if (player->doing_seek)
- {
- if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED)
- {
+ if (player->doing_seek) {
+ if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED) {
player->doing_seek = FALSE;
MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
- }
- else if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PLAYING)
- {
+ } else if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PLAYING) {
if ((MMPLAYER_IS_HTTP_STREAMING(player)) &&
(player->streamer) &&
(player->streamer->streaming_buffer_type == BUFFER_TYPE_MUXED) &&
- (player->streamer->is_buffering == FALSE))
- {
+ (player->streamer->is_buffering == FALSE)) {
GstQuery *query = NULL;
gboolean busy = FALSE;
gint percent = 0;
- if (player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer)
- {
+ if (player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer) {
query = gst_query_new_buffering(GST_FORMAT_PERCENT);
if (gst_element_query(player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer, query))
- {
gst_query_parse_buffering_percent(query, &busy, &percent);
- }
gst_query_unref(query);
LOGD("buffered percent(%s): %d\n",
GST_ELEMENT_NAME(player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer), percent);
}
- if (percent >= 100)
- {
+ if (percent >= 100) {
player->streamer->is_buffering = FALSE;
__mmplayer_handle_buffering_message(player);
}
@@ -1812,25 +1594,25 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
}
break;
- #if 0 /* delete unnecessary logs */
- case GST_MESSAGE_REQUEST_STATE: LOGD("GST_MESSAGE_REQUEST_STATE\n"); break;
- case GST_MESSAGE_STEP_START: LOGD("GST_MESSAGE_STEP_START\n"); break;
- case GST_MESSAGE_QOS: LOGD("GST_MESSAGE_QOS\n"); break;
- case GST_MESSAGE_PROGRESS: LOGD("GST_MESSAGE_PROGRESS\n"); break;
- case GST_MESSAGE_ANY: LOGD("GST_MESSAGE_ANY\n"); break;
- case GST_MESSAGE_INFO: LOGD("GST_MESSAGE_STATE_DIRTY\n"); break;
- case GST_MESSAGE_STATE_DIRTY: LOGD("GST_MESSAGE_STATE_DIRTY\n"); break;
- case GST_MESSAGE_STEP_DONE: LOGD("GST_MESSAGE_STEP_DONE\n"); break;
- case GST_MESSAGE_CLOCK_PROVIDE: LOGD("GST_MESSAGE_CLOCK_PROVIDE\n"); break;
- case GST_MESSAGE_STRUCTURE_CHANGE: LOGD("GST_MESSAGE_STRUCTURE_CHANGE\n"); break;
- case GST_MESSAGE_STREAM_STATUS: LOGD("GST_MESSAGE_STREAM_STATUS\n"); break;
- case GST_MESSAGE_APPLICATION: LOGD("GST_MESSAGE_APPLICATION\n"); break;
- case GST_MESSAGE_SEGMENT_START: LOGD("GST_MESSAGE_SEGMENT_START\n"); break;
- case GST_MESSAGE_SEGMENT_DONE: LOGD("GST_MESSAGE_SEGMENT_DONE\n"); break;
- case GST_MESSAGE_LATENCY: LOGD("GST_MESSAGE_LATENCY\n"); break;
- #endif
+ #if 0 /* delete unnecessary logs */
+ case GST_MESSAGE_REQUEST_STATE: LOGD("GST_MESSAGE_REQUEST_STATE\n"); break;
+ case GST_MESSAGE_STEP_START: LOGD("GST_MESSAGE_STEP_START\n"); break;
+ case GST_MESSAGE_QOS: LOGD("GST_MESSAGE_QOS\n"); break;
+ case GST_MESSAGE_PROGRESS: LOGD("GST_MESSAGE_PROGRESS\n"); break;
+ case GST_MESSAGE_ANY: LOGD("GST_MESSAGE_ANY\n"); break;
+ case GST_MESSAGE_INFO: LOGD("GST_MESSAGE_STATE_DIRTY\n"); break;
+ case GST_MESSAGE_STATE_DIRTY: LOGD("GST_MESSAGE_STATE_DIRTY\n"); break;
+ case GST_MESSAGE_STEP_DONE: LOGD("GST_MESSAGE_STEP_DONE\n"); break;
+ case GST_MESSAGE_CLOCK_PROVIDE: LOGD("GST_MESSAGE_CLOCK_PROVIDE\n"); break;
+ case GST_MESSAGE_STRUCTURE_CHANGE: LOGD("GST_MESSAGE_STRUCTURE_CHANGE\n"); break;
+ case GST_MESSAGE_STREAM_STATUS: LOGD("GST_MESSAGE_STREAM_STATUS\n"); break;
+ case GST_MESSAGE_APPLICATION: LOGD("GST_MESSAGE_APPLICATION\n"); break;
+ case GST_MESSAGE_SEGMENT_START: LOGD("GST_MESSAGE_SEGMENT_START\n"); break;
+ case GST_MESSAGE_SEGMENT_DONE: LOGD("GST_MESSAGE_SEGMENT_DONE\n"); break;
+ case GST_MESSAGE_LATENCY: LOGD("GST_MESSAGE_LATENCY\n"); break;
+ #endif
- default:
+ default:
break;
}
@@ -1853,21 +1635,16 @@ __mmplayer_gst_handle_duration(mm_player_t* player, GstMessage* msg)
MMPLAYER_RETURN_VAL_IF_FAIL(msg, FALSE);
if ((MMPLAYER_IS_HTTP_STREAMING(player)) &&
- (msg->src) && (msg->src == (GstObject *)player->pipeline->mainbin[MMPLAYER_M_SRC].gst))
- {
+ (msg->src) && (msg->src == (GstObject *)player->pipeline->mainbin[MMPLAYER_M_SRC].gst)) {
LOGD("msg src : [%s]", GST_ELEMENT_NAME(GST_ELEMENT_CAST(msg->src)));
- if (gst_element_query_duration(GST_ELEMENT_CAST(msg->src), GST_FORMAT_BYTES, &bytes))
- {
+ if (gst_element_query_duration(GST_ELEMENT_CAST(msg->src), GST_FORMAT_BYTES, &bytes)) {
LOGD("data total size of http content: %lld", bytes);
- player->http_content_size = (bytes > 0)?(bytes):(0);
+ player->http_content_size = (bytes > 0) ? (bytes) : (0);
}
- }
- else
- {
+ } else
/* handling audio clip which has vbr. means duration is keep changing */
_mmplayer_update_content_attrs(player, ATTR_DURATION);
- }
MMPLAYER_FLEAVE();
@@ -1881,115 +1658,95 @@ __mmplayer_gst_extract_tag_from_msg(mm_player_t* player, GstMessage* msg) // @
/* macro for better code readability */
#define MMPLAYER_UPDATE_TAG_STRING(gsttag, attribute, playertag) \
-if (gst_tag_list_get_string(tag_list, gsttag, &string)) \
-{\
- if (string != NULL)\
- {\
+if (gst_tag_list_get_string(tag_list, gsttag, &string)) {\
+ if (string != NULL) {\
SECURE_LOGD("update tag string : %s\n", string); \
mm_attrs_set_string_by_name(attribute, playertag, string); \
g_free(string);\
string = NULL;\
- }\
+ } \
}
#define MMPLAYER_UPDATE_TAG_IMAGE(gsttag, attribute, playertag) \
GstSample *sample = NULL;\
-if (gst_tag_list_get_sample_index(tag_list, gsttag, index, &sample))\
-{\
+if (gst_tag_list_get_sample_index(tag_list, gsttag, index, &sample)) {\
GstMapInfo info = GST_MAP_INFO_INIT;\
buffer = gst_sample_get_buffer(sample);\
- if (!gst_buffer_map(buffer, &info, GST_MAP_READ)){\
+ if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) {\
LOGD("failed to get image data from tag");\
return FALSE;\
- }\
+ } \
SECURE_LOGD("update album cover data : %p, size : %d\n", info.data, info.size);\
- MMPLAYER_FREEIF(player->album_art); \
- player->album_art = (gchar *)g_malloc(info.size); \
- if (player->album_art) \
- { \
- memcpy(player->album_art, info.data, info.size); \
- mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, info.size); \
- if (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) \
- { \
- msg_param.data = (void *)player->album_art; \
- msg_param.size = info.size; \
- MMPLAYER_POST_MSG(player, MM_MESSAGE_IMAGE_BUFFER, &msg_param); \
- SECURE_LOGD("post message image buffer data : %p, size : %d\n", info.data, info.size); \
+ MMPLAYER_FREEIF(player->album_art);\
+ player->album_art = (gchar *)g_malloc(info.size);\
+ if (player->album_art) {\
+ memcpy(player->album_art, info.data, info.size);\
+ mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, info.size);\
+ if (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) {\
+ msg_param.data = (void *)player->album_art;\
+ msg_param.size = info.size;\
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_IMAGE_BUFFER, &msg_param);\
+ SECURE_LOGD("post message image buffer data : %p, size : %d\n", info.data, info.size);\
} \
} \
- gst_buffer_unmap(buffer, &info); \
+ gst_buffer_unmap(buffer, &info);\
}
#define MMPLAYER_UPDATE_TAG_UINT(gsttag, attribute, playertag) \
-if (gst_tag_list_get_uint(tag_list, gsttag, &v_uint))\
-{\
- if (v_uint)\
- {\
- if (!strncmp(gsttag, GST_TAG_BITRATE, strlen(GST_TAG_BITRATE))) \
- {\
+if (gst_tag_list_get_uint(tag_list, gsttag, &v_uint)) {\
+ if (v_uint) {\
+ if (!strncmp(gsttag, GST_TAG_BITRATE, strlen(GST_TAG_BITRATE))) {\
if (player->updated_bitrate_count == 0) \
mm_attrs_set_int_by_name(attribute, "content_audio_bitrate", v_uint); \
- if (player->updated_bitrate_count<MM_PLAYER_STREAM_COUNT_MAX) \
- {\
+ if (player->updated_bitrate_count < MM_PLAYER_STREAM_COUNT_MAX) {\
player->bitrate[player->updated_bitrate_count] = v_uint;\
player->total_bitrate += player->bitrate[player->updated_maximum_bitrate_count]; \
player->updated_bitrate_count++; \
mm_attrs_set_int_by_name(attribute, playertag, player->total_bitrate);\
SECURE_LOGD("update bitrate %d[bps] of stream #%d.\n", v_uint, player->updated_bitrate_count);\
- }\
- }\
- else if (!strncmp(gsttag, GST_TAG_MAXIMUM_BITRATE, strlen(GST_TAG_MAXIMUM_BITRATE))) \
- {\
- if (player->updated_maximum_bitrate_count<MM_PLAYER_STREAM_COUNT_MAX) \
- {\
+ } \
+ } \
+ else if (!strncmp(gsttag, GST_TAG_MAXIMUM_BITRATE, strlen(GST_TAG_MAXIMUM_BITRATE))) {\
+ if (player->updated_maximum_bitrate_count < MM_PLAYER_STREAM_COUNT_MAX) {\
player->maximum_bitrate[player->updated_maximum_bitrate_count] = v_uint;\
player->total_maximum_bitrate += player->maximum_bitrate[player->updated_maximum_bitrate_count]; \
player->updated_maximum_bitrate_count++; \
mm_attrs_set_int_by_name(attribute, playertag, player->total_maximum_bitrate); \
SECURE_LOGD("update maximum bitrate %d[bps] of stream #%d\n", v_uint, player->updated_maximum_bitrate_count);\
- }\
- }\
- else\
- {\
+ } \
+ } else\
mm_attrs_set_int_by_name(attribute, playertag, v_uint); \
- }\
v_uint = 0;\
- }\
+ } \
}
#define MMPLAYER_UPDATE_TAG_DATE(gsttag, attribute, playertag) \
-if (gst_tag_list_get_date(tag_list, gsttag, &date))\
-{\
- if (date != NULL)\
- {\
+if (gst_tag_list_get_date(tag_list, gsttag, &date)) {\
+ if (date != NULL) {\
string = g_strdup_printf("%d", g_date_get_year(date));\
mm_attrs_set_string_by_name(attribute, playertag, string);\
SECURE_LOGD("metainfo year : %s\n", string);\
MMPLAYER_FREEIF(string);\
g_date_free(date);\
- }\
+ } \
}
#define MMPLAYER_UPDATE_TAG_UINT64(gsttag, attribute, playertag) \
-if (gst_tag_list_get_uint64(tag_list, gsttag, &v_uint64))\
-{\
- if (v_uint64)\
- {\
+if (gst_tag_list_get_uint64(tag_list, gsttag, &v_uint64)) {\
+ if (v_uint64) {\
/* FIXIT : don't know how to store date */\
g_assert(1);\
v_uint64 = 0;\
- }\
+ } \
}
#define MMPLAYER_UPDATE_TAG_DOUBLE(gsttag, attribute, playertag) \
-if (gst_tag_list_get_double(tag_list, gsttag, &v_double))\
-{\
- if (v_double)\
- {\
+if (gst_tag_list_get_double(tag_list, gsttag, &v_double)) {\
+ if (v_double) {\
/* FIXIT : don't know how to store date */\
g_assert(1);\
v_double = 0;\
- }\
+ } \
}
/* function start */
@@ -2091,20 +1848,17 @@ __mmplayer_gst_rtp_no_more_pads(GstElement *element, gpointer data) // @
* [3] typefinding has happend in audio but audiosink is created already before no-more-pad signal
* and the video will be dumped via filesink.
*/
- if (player->num_dynamic_pad == 0)
- {
+ if (player->num_dynamic_pad == 0) {
LOGD("it seems pad caps is directely used for autoplugging. removing fakesink now\n");
if (!__mmplayer_gst_remove_fakesink(player,
&player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK]))
- {
/* NOTE : __mmplayer_pipeline_complete() can be called several time. because
* signaling mechanism(pad-added, no-more-pad, new-decoded-pad) from various
* source element are not same. To overcome this situation, this function will called
* several places and several times. Therefore, this is not an error case.
*/
return;
- }
}
/* create dot before error-return. for debugging */
@@ -2130,14 +1884,11 @@ __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink
g_mutex_lock(&player->fsink_lock);
if (!fakesink->gst)
- {
goto ERROR;
- }
/* get parent of fakesink */
parent = (GstElement*)gst_object_get_parent((GstObject*)fakesink->gst);
- if (!parent)
- {
+ if (!parent) {
LOGD("fakesink already removed\n");
goto ERROR;
}
@@ -2148,16 +1899,12 @@ __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink
* so no need to wait for completion of state transiton
*/
if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(fakesink->gst, GST_STATE_NULL))
- {
LOGE("fakesink state change failure!\n");
-
/* FIXIT : should I return here? or try to proceed to next? */
/* return FALSE; */
- }
/* remove fakesink from it's parent */
- if (!gst_bin_remove(GST_BIN(parent), fakesink->gst))
- {
+ if (!gst_bin_remove(GST_BIN(parent), fakesink->gst)) {
LOGE("failed to remove fakesink\n");
gst_object_unref(parent);
@@ -2176,9 +1923,7 @@ __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink
ERROR:
if (fakesink->gst)
- {
gst_element_set_locked_state(fakesink->gst, FALSE);
- }
g_mutex_unlock(&player->fsink_lock);
return FALSE;
@@ -2199,7 +1944,7 @@ __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(element && pad);
- MMPLAYER_RETURN_IF_FAIL( player &&
+ MMPLAYER_RETURN_IF_FAIL(player &&
player->pipeline &&
player->pipeline->mainbin);
@@ -2219,28 +1964,23 @@ __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
str = gst_caps_get_structure(caps, 0);
- if (!str)
- {
+ if (!str) {
LOGE("cannot get structure from caps.\n");
goto ERROR;
}
name = gst_structure_get_name(str);
- if (!name)
- {
+ if (!name) {
LOGE("cannot get mimetype from structure.\n");
goto ERROR;
}
- if (strstr(name, "video"))
- {
+ if (strstr(name, "video")) {
gint stype = 0;
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype);
- if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE)
- {
- if (player->v_stream_caps)
- {
+ if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE) {
+ if (player->v_stream_caps) {
gst_caps_unref(player->v_stream_caps);
player->v_stream_caps = NULL;
}
@@ -2254,15 +1994,13 @@ __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
/* clear previous result*/
player->have_dynamic_pad = FALSE;
- if (!__mmplayer_try_to_plug_decodebin(player, pad, caps))
- {
+ if (!__mmplayer_try_to_plug_decodebin(player, pad, caps)) {
LOGE("failed to autoplug for caps");
goto ERROR;
}
/* check if there's dynamic pad*/
- if (player->have_dynamic_pad)
- {
+ if (player->have_dynamic_pad) {
LOGE("using pad caps assums there's no dynamic pad !\n");
goto ERROR;
}
@@ -2273,31 +2011,27 @@ __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
NEW_ELEMENT:
/* excute new_element if created*/
- if (new_element)
- {
+ if (new_element) {
LOGD("adding new element to pipeline\n");
/* set state to READY before add to bin */
MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
/* add new element to the pipeline */
- if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
- {
+ if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element)) {
LOGE("failed to add autoplug element to bin\n");
goto ERROR;
}
/* get pad from element */
sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
- if (!sinkpad)
- {
+ if (!sinkpad) {
LOGE("failed to get sinkpad from autoplug element\n");
goto ERROR;
}
/* link it */
- if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) {
LOGE("failed to link autoplug element\n");
goto ERROR;
}
@@ -2338,139 +2072,130 @@ ERROR:
static void
__mmplayer_gst_wfd_dynamic_pad(GstElement *element, GstPad *pad, gpointer data) // @
{
- GstPad *sinkpad = NULL;
- GstCaps* caps = NULL;
- GstElement* new_element = NULL;
- enum MainElementID element_id = MMPLAYER_M_NUM;
-
- mm_player_t* player = (mm_player_t*) data;
-
- MMPLAYER_FENTER();
-
- MMPLAYER_RETURN_IF_FAIL(element && pad);
- MMPLAYER_RETURN_IF_FAIL( player &&
- player->pipeline &&
- player->pipeline->mainbin);
-
- LOGD("stream count inc : %d\n", player->num_dynamic_pad);
-
- {
- LOGD("using pad caps to autopluging instead of doing typefind\n");
- caps = gst_pad_query_caps(pad);
- MMPLAYER_CHECK_NULL(caps);
- /* clear previous result*/
- player->have_dynamic_pad = FALSE;
- new_element = gst_element_factory_make("rtpmp2tdepay", "wfd_rtp_depay");
- if (!new_element)
- {
- LOGE("failed to create wfd rtp depay element\n");
- goto ERROR;
- }
- MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
- /* add new element to the pipeline */
- if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
- {
- LOGD("failed to add autoplug element to bin\n");
- goto ERROR;
- }
- /* get pad from element */
- sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
- if (!sinkpad)
- {
- LOGD("failed to get sinkpad from autoplug element\n");
- goto ERROR;
- }
- /* link it */
- if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
- {
- LOGD("failed to link autoplug element\n");
- goto ERROR;
- }
- gst_object_unref(sinkpad);
- sinkpad = NULL;
- pad = gst_element_get_static_pad(GST_ELEMENT(new_element), "src");
- caps = gst_pad_query_caps(pad);
- MMPLAYER_CHECK_NULL(caps);
- MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING);
- /* create typefind */
- new_element = gst_element_factory_make("typefind", NULL);
- if (!new_element)
- {
- LOGD("failed to create typefind\n");
- goto ERROR;
- }
-
- MMPLAYER_SIGNAL_CONNECT( player,
- G_OBJECT(new_element),
- MM_PLAYER_SIGNAL_TYPE_AUTOPLUG,
- "have-type",
- G_CALLBACK(__mmplayer_typefind_have_type),
- (gpointer)player);
-
- player->have_dynamic_pad = FALSE;
- }
-
- /* excute new_element if created*/
- if (new_element)
- {
- LOGD("adding new element to pipeline\n");
-
- /* set state to READY before add to bin */
- MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
-
- /* add new element to the pipeline */
- if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
- {
- LOGD("failed to add autoplug element to bin\n");
- goto ERROR;
- }
-
- /* get pad from element */
- sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
- if (!sinkpad)
- {
- LOGD("failed to get sinkpad from autoplug element\n");
- goto ERROR;
- }
-
- /* link it */
- if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
- {
- LOGD("failed to link autoplug element\n");
- goto ERROR;
- }
-
- gst_object_unref(sinkpad);
- sinkpad = NULL;
-
- /* run. setting PLAYING here since streamming source is live source */
- MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING);
- }
-
- /* store handle to futher manipulation */
- player->pipeline->mainbin[element_id].id = element_id;
- player->pipeline->mainbin[element_id].gst = new_element;
-
- MMPLAYER_FLEAVE();
-
- return;
+ GstPad *sinkpad = NULL;
+ GstCaps* caps = NULL;
+ GstElement* new_element = NULL;
+ enum MainElementID element_id = MMPLAYER_M_NUM;
+
+ mm_player_t* player = (mm_player_t*) data;
+
+ MMPLAYER_FENTER();
+
+ MMPLAYER_RETURN_IF_FAIL(element && pad);
+ MMPLAYER_RETURN_IF_FAIL(player &&
+ player->pipeline &&
+ player->pipeline->mainbin);
+
+ LOGD("stream count inc : %d\n", player->num_dynamic_pad);
+
+ {
+ LOGD("using pad caps to autopluging instead of doing typefind\n");
+ caps = gst_pad_query_caps(pad);
+ MMPLAYER_CHECK_NULL(caps);
+ /* clear previous result*/
+ player->have_dynamic_pad = FALSE;
+ new_element = gst_element_factory_make("rtpmp2tdepay", "wfd_rtp_depay");
+ if (!new_element) {
+ LOGE("failed to create wfd rtp depay element\n");
+ goto ERROR;
+ }
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
+ /* add new element to the pipeline */
+ if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element)) {
+ LOGD("failed to add autoplug element to bin\n");
+ goto ERROR;
+ }
+ /* get pad from element */
+ sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
+ if (!sinkpad) {
+ LOGD("failed to get sinkpad from autoplug element\n");
+ goto ERROR;
+ }
+ /* link it */
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) {
+ LOGD("failed to link autoplug element\n");
+ goto ERROR;
+ }
+ gst_object_unref(sinkpad);
+ sinkpad = NULL;
+ pad = gst_element_get_static_pad(GST_ELEMENT(new_element), "src");
+ caps = gst_pad_query_caps(pad);
+ MMPLAYER_CHECK_NULL(caps);
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING);
+ /* create typefind */
+ new_element = gst_element_factory_make("typefind", NULL);
+ if (!new_element) {
+ LOGD("failed to create typefind\n");
+ goto ERROR;
+ }
+
+ MMPLAYER_SIGNAL_CONNECT(player,
+ G_OBJECT(new_element),
+ MM_PLAYER_SIGNAL_TYPE_AUTOPLUG,
+ "have-type",
+ G_CALLBACK(__mmplayer_typefind_have_type),
+ (gpointer)player);
+
+ player->have_dynamic_pad = FALSE;
+ }
+
+ /* excute new_element if created*/
+ if (new_element) {
+ LOGD("adding new element to pipeline\n");
+
+ /* set state to READY before add to bin */
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
+
+ /* add new element to the pipeline */
+ if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element)) {
+ LOGD("failed to add autoplug element to bin\n");
+ goto ERROR;
+ }
+
+ /* get pad from element */
+ sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
+ if (!sinkpad) {
+ LOGD("failed to get sinkpad from autoplug element\n");
+ goto ERROR;
+ }
+
+ /* link it */
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) {
+ LOGD("failed to link autoplug element\n");
+ goto ERROR;
+ }
+
+ gst_object_unref(sinkpad);
+ sinkpad = NULL;
+
+ /* run. setting PLAYING here since streamming source is live source */
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING);
+ }
+
+ /* store handle to futher manipulation */
+ player->pipeline->mainbin[element_id].id = element_id;
+ player->pipeline->mainbin[element_id].gst = new_element;
+
+ MMPLAYER_FLEAVE();
+
+ return;
STATE_CHANGE_FAILED:
ERROR:
- /* FIXIT : take care if new_element has already added to pipeline */
- if (new_element)
- gst_object_unref(GST_OBJECT(new_element));
+ /* FIXIT : take care if new_element has already added to pipeline */
+ if (new_element)
+ gst_object_unref(GST_OBJECT(new_element));
- if (sinkpad)
- gst_object_unref(GST_OBJECT(sinkpad));
+ if (sinkpad)
+ gst_object_unref(GST_OBJECT(sinkpad));
- if (caps)
- gst_object_unref(GST_OBJECT(caps));
+ if (caps)
+ gst_object_unref(GST_OBJECT(caps));
- /* FIXIT : how to inform this error to MSL ????? */
- /* FIXIT : I think we'd better to use g_idle_add() to destroy pipeline and
- * then post an error to application
- */
+ /* FIXIT : how to inform this error to MSL ????? */
+ /* FIXIT : I think we'd better to use g_idle_add() to destroy pipeline and
+ * then post an error to application
+ */
}
#endif
@@ -2528,7 +2253,7 @@ __mmplayer_gst_selector_event_probe(GstPad * pad, GstPadProbeInfo * info, gpoint
LOGD("stream type is %d", stream_type);
switch (GST_EVENT_TYPE(event)) {
- case GST_EVENT_STREAM_START:
+ case GST_EVENT_STREAM_START:
{
gint64 stop_running_time = 0;
gint64 position_running_time = 0;
@@ -2537,27 +2262,21 @@ __mmplayer_gst_selector_event_probe(GstPad * pad, GstPadProbeInfo * info, gpoint
LOGD("[%d] GST_EVENT_STREAM_START", stream_type);
- for (idx=MM_PLAYER_TRACK_TYPE_AUDIO;idx<MM_PLAYER_TRACK_TYPE_TEXT;idx++)
- {
+ for (idx = MM_PLAYER_TRACK_TYPE_AUDIO; idx < MM_PLAYER_TRACK_TYPE_TEXT; idx++) {
if ((player->gapless.update_segment[idx] == TRUE) ||
- !(player->selector[idx].event_probe_id))
- {
+ !(player->selector[idx].event_probe_id)) {
LOGW("[%d] skip", idx);
continue;
}
if (player->gapless.segment[idx].stop != -1)
- {
stop_running_time =
gst_segment_to_running_time(&player->gapless.segment[idx],
GST_FORMAT_TIME, player->gapless.segment[idx].stop);
- }
else
- {
stop_running_time =
gst_segment_to_running_time(&player->gapless.segment[idx],
GST_FORMAT_TIME, player->gapless.segment[idx].duration);
- }
position_running_time =
gst_segment_to_running_time(&player->gapless.segment[idx],
@@ -2585,22 +2304,22 @@ __mmplayer_gst_selector_event_probe(GstPad * pad, GstPadProbeInfo * info, gpoint
player->gapless.start_time[stream_type] += position;
break;
}
- case GST_EVENT_FLUSH_STOP:
+ case GST_EVENT_FLUSH_STOP:
{
LOGD("[%d] GST_EVENT_FLUSH_STOP", stream_type);
gst_segment_init(&player->gapless.segment[stream_type], GST_FORMAT_UNDEFINED);
player->gapless.start_time[stream_type] = 0;
break;
}
- case GST_EVENT_SEGMENT: {
+ case GST_EVENT_SEGMENT:
+ {
GstSegment segment;
GstEvent *tmpev;
LOGD("[%d] GST_EVENT_SEGMENT", stream_type);
gst_event_copy_segment(event, &segment);
- if (segment.format == GST_FORMAT_TIME)
- {
+ if (segment.format == GST_FORMAT_TIME) {
LOGD("segment base:%" GST_TIME_FORMAT ", offset:%" GST_TIME_FORMAT
", start:%" GST_TIME_FORMAT ", stop: %" GST_TIME_FORMAT
", time: %" GST_TIME_FORMAT ", pos: %" GST_TIME_FORMAT ", dur: %" GST_TIME_FORMAT,
@@ -2626,7 +2345,7 @@ __mmplayer_gst_selector_event_probe(GstPad * pad, GstPadProbeInfo * info, gpoint
}
break;
}
- default:
+ default:
break;
}
@@ -2665,22 +2384,19 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
/* get mimetype from caps */
caps = gst_pad_query_caps(pad, NULL);
- if (!caps)
- {
+ if (!caps) {
LOGE("cannot get caps from pad.\n");
goto ERROR;
}
str = gst_caps_get_structure(caps, 0);
- if (!str)
- {
+ if (!str) {
LOGE("cannot get structure from caps.\n");
goto ERROR;
}
name = gst_structure_get_name(str);
- if (!name)
- {
+ if (!name) {
LOGE("cannot get mimetype from structure.\n");
goto ERROR;
}
@@ -2688,25 +2404,20 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
//LOGD("detected mimetype : %s\n", name);
- if (strstr(name, "video"))
- {
+ if (strstr(name, "video")) {
gint stype = 0;
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype);
/* don't make video because of not required, and not support multiple track */
- if (stype == MM_DISPLAY_SURFACE_NULL)
- {
+ if (stype == MM_DISPLAY_SURFACE_NULL) {
LOGD("no video sink by null surface");
MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state)
- == MM_ERROR_NONE)
- {
+ == MM_ERROR_NONE) {
/* acquire resources for video playing */
- if (resource_state == RESOURCE_STATE_PREPARED)
- {
+ if (resource_state == RESOURCE_STATE_PREPARED) {
if (_mmplayer_resource_manager_acquire(&player->resource_manager)
- != MM_ERROR_NONE)
- {
+ != MM_ERROR_NONE) {
LOGE("could not acquire resources for video playing\n");
_mmplayer_resource_manager_unprepare(&player->resource_manager);
goto ERROR;
@@ -2716,13 +2427,11 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
gchar *caps_str = gst_caps_to_string(caps);
if (strstr(caps_str, "ST12") || strstr(caps_str, "SN12"))
- {
player->set_mode.video_zc = TRUE;
- }
+
MMPLAYER_FREEIF(caps_str);
- if (player->v_stream_caps)
- {
+ if (player->v_stream_caps) {
gst_caps_unref(player->v_stream_caps);
player->v_stream_caps = NULL;
}
@@ -2731,8 +2440,7 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
/* fake sink */
fakesink = gst_element_factory_make("fakesink", NULL);
- if (fakesink == NULL)
- {
+ if (fakesink == NULL) {
LOGE("ERROR : fakesink create error\n");
goto ERROR;
}
@@ -2750,8 +2458,7 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
// link
sinkpad = gst_element_get_static_pad(fakesink, "sink");
- if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
LOGW("failed to link fakesink\n");
gst_object_unref(GST_OBJECT(fakesink));
goto ERROR;
@@ -2785,8 +2492,7 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
goto DONE;
}
- if (MMPLAYER_IS_MS_BUFF_SRC(player))
- {
+ if (MMPLAYER_IS_MS_BUFF_SRC(player)) {
__mmplayer_gst_decode_callback(elem, pad, player);
return;
}
@@ -2794,16 +2500,12 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
LOGD("video selector \n");
elemId = MMPLAYER_M_V_INPUT_SELECTOR;
stream_type = MM_PLAYER_TRACK_TYPE_VIDEO;
- }
- else
- {
- if (strstr(name, "audio"))
- {
+ } else {
+ if (strstr(name, "audio")) {
gint samplerate = 0;
gint channels = 0;
- if (MMPLAYER_IS_MS_BUFF_SRC(player))
- {
+ if (MMPLAYER_IS_MS_BUFF_SRC(player)) {
__mmplayer_gst_decode_callback(elem, pad, player);
return;
}
@@ -2816,21 +2518,19 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
gst_structure_get_int(str, "channels", &channels);
if ((channels > 0 && samplerate == 0)) {//exclude audio decoding
- /* fake sink */
- fakesink = gst_element_factory_make("fakesink", NULL);
- if (fakesink == NULL)
- {
- LOGE("ERROR : fakesink create error\n");
- goto ERROR;
- }
+ /* fake sink */
+ fakesink = gst_element_factory_make("fakesink", NULL);
+ if (fakesink == NULL) {
+ LOGE("ERROR : fakesink create error\n");
+ goto ERROR;
+ }
gst_bin_add(GST_BIN(pipeline), fakesink);
/* link */
sinkpad = gst_element_get_static_pad(fakesink, "sink");
- if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
LOGW("failed to link fakesink\n");
gst_object_unref(GST_OBJECT(fakesink));
goto ERROR;
@@ -2842,27 +2542,21 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
goto DONE;
}
- }
- else if (strstr(name, "text"))
- {
+ } else if (strstr(name, "text")) {
LOGD("text selector \n");
elemId = MMPLAYER_M_T_INPUT_SELECTOR;
stream_type = MM_PLAYER_TRACK_TYPE_TEXT;
- }
- else
- {
+ } else {
LOGE("wrong elem id \n");
goto ERROR;
}
}
selector = player->pipeline->mainbin[elemId].gst;
- if (selector == NULL)
- {
+ if (selector == NULL) {
selector = gst_element_factory_make("input-selector", NULL);
LOGD("Creating input-selector\n");
- if (selector == NULL)
- {
+ if (selector == NULL) {
LOGE("ERROR : input-selector create error\n");
goto ERROR;
}
@@ -2893,15 +2587,13 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
LOGD("got pad %s:%s from selector", GST_DEBUG_PAD_NAME(sinkpad));
- if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
LOGW("failed to link selector\n");
gst_object_unref(GST_OBJECT(selector));
goto ERROR;
}
- if (first_track)
- {
+ if (first_track) {
LOGD("this is first track --> active track \n");
g_object_set(selector, "active-pad", sinkpad, NULL);
}
@@ -2913,18 +2605,14 @@ DONE:
ERROR:
if (caps)
- {
gst_caps_unref(caps);
- }
- if (sinkpad)
- {
+ if (sinkpad) {
gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
@@ -2940,8 +2628,7 @@ static void __mmplayer_handle_text_decode_path(mm_player_t* player, GstElement*
// [link] input-selector :: textbin
srcpad = gst_element_get_static_pad(text_selector, "src");
- if (!srcpad)
- {
+ if (!srcpad) {
LOGE("failed to get srcpad from selector\n");
return;
}
@@ -2950,8 +2637,7 @@ static void __mmplayer_handle_text_decode_path(mm_player_t* player, GstElement*
active_index = player->selector[MM_PLAYER_TRACK_TYPE_TEXT].active_pad_index;
if ((active_index != DEFAULT_TRACK) &&
- (__mmplayer_change_selector_pad(player, MM_PLAYER_TRACK_TYPE_TEXT, active_index) != MM_ERROR_NONE))
- {
+ (__mmplayer_change_selector_pad(player, MM_PLAYER_TRACK_TYPE_TEXT, active_index) != MM_ERROR_NONE)) {
LOGW("failed to change text track\n");
player->selector[MM_PLAYER_TRACK_TYPE_TEXT].active_pad_index = DEFAULT_TRACK;
}
@@ -2960,8 +2646,7 @@ static void __mmplayer_handle_text_decode_path(mm_player_t* player, GstElement*
__mmplayer_gst_decode_callback(text_selector, srcpad, player);
LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
- if (player->selector[MM_PLAYER_TRACK_TYPE_TEXT].block_id)
- {
+ if (player->selector[MM_PLAYER_TRACK_TYPE_TEXT].block_id) {
gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_TEXT].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_TEXT].block_id = 0;
}
@@ -2972,19 +2657,14 @@ static void __mmplayer_handle_text_decode_path(mm_player_t* player, GstElement*
player->has_closed_caption = TRUE;
attrs = MMPLAYER_GET_ATTRS(player);
- if (attrs)
- {
+ if (attrs) {
mm_attrs_set_int_by_name(attrs, "content_text_track_num", (gint)player->selector[MM_PLAYER_TRACK_TYPE_TEXT].total_track_num);
if (mmf_attrs_commit(attrs))
LOGE("failed to commit.\n");
- }
- else
- {
+ } else
LOGE("cannot get content attribute");
- }
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
@@ -3007,8 +2687,7 @@ int _mmplayer_gst_set_audio_channel(MMHandleType hplayer, MMPlayerAudioChannel c
LOGD("Change Audio mode to %d\n", ch_idx);
player->use_deinterleave = TRUE;
- if ((!player->pipeline) || (!player->pipeline->mainbin))
- {
+ if ((!player->pipeline) || (!player->pipeline->mainbin)) {
LOGD("pre setting : %d\n", ch_idx);
player->audio_mode.active_pad_index = ch_idx;
@@ -3017,10 +2696,8 @@ int _mmplayer_gst_set_audio_channel(MMHandleType hplayer, MMPlayerAudioChannel c
mainbin = player->pipeline->mainbin;
- if (mainbin[MMPLAYER_M_A_SELECTOR].gst == NULL)
- {
- if (player->max_audio_channels < 2)
- {
+ if (mainbin[MMPLAYER_M_A_SELECTOR].gst == NULL) {
+ if (player->max_audio_channels < 2) {
LOGD("mono channel track only\n");
return result;
}
@@ -3031,22 +2708,19 @@ int _mmplayer_gst_set_audio_channel(MMHandleType hplayer, MMPlayerAudioChannel c
LOGD("total_ch_num : %d\n", player->audio_mode.total_track_num);
- if (player->audio_mode.total_track_num < 2)
- {
+ if (player->audio_mode.total_track_num < 2) {
LOGW("there is no another audio path\n");
return result; /* keep playing */
}
- if ((ch_idx < 0) || (ch_idx >= player->audio_mode.total_track_num))
- {
+ if ((ch_idx < 0) || (ch_idx >= player->audio_mode.total_track_num)) {
LOGW("Not a proper ch_idx : %d \n", ch_idx);
return result; /* keep playing */
}
/*To get the new pad from the selector*/
change_pad_name = g_strdup_printf("sink%d", ch_idx);
- if (change_pad_name == NULL)
- {
+ if (change_pad_name == NULL) {
LOGW("Pad does not exists\n");
goto ERROR; /* keep playing */
}
@@ -3055,10 +2729,8 @@ int _mmplayer_gst_set_audio_channel(MMHandleType hplayer, MMPlayerAudioChannel c
sinkpad = gst_element_get_static_pad(mainbin[MMPLAYER_M_A_SELECTOR].gst, change_pad_name);
if (sinkpad == NULL)
- {
//result = MM_ERROR_PLAYER_INTERNAL;
goto ERROR; /* keep playing */
- }
LOGD("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
g_object_set(mainbin[MMPLAYER_M_A_SELECTOR].gst, "active-pad", sinkpad, NULL);
@@ -3091,7 +2763,7 @@ __mmplayer_gst_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpointer da
GstPad* srcpad = NULL;
GstPad* sinkpad = NULL;
- gchar* caps_str= NULL;
+ gchar* caps_str = NULL;
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
@@ -3100,8 +2772,7 @@ __mmplayer_gst_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpointer da
LOGD("deinterleave new caps : %s\n", caps_str);
MMPLAYER_FREEIF(caps_str);
- if ((queue = __mmplayer_element_create_and_link(player, pad, "queue")) == NULL)
- {
+ if ((queue = __mmplayer_element_create_and_link(player, pad, "queue")) == NULL) {
LOGE("ERROR : queue create error\n");
goto ERROR;
}
@@ -3114,8 +2785,7 @@ __mmplayer_gst_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpointer da
selector = player->pipeline->mainbin[MMPLAYER_M_A_SELECTOR].gst;
- if (!selector)
- {
+ if (!selector) {
LOGE("there is no audio channel selector.\n");
goto ERROR;
}
@@ -3125,8 +2795,7 @@ __mmplayer_gst_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpointer da
LOGD("link(%s:%s - %s:%s)\n", GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
- if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) {
LOGW("failed to link deinterleave - selector\n");
goto ERROR;
}
@@ -3136,14 +2805,12 @@ __mmplayer_gst_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpointer da
ERROR:
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
- if (sinkpad)
- {
+ if (sinkpad) {
gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
@@ -3168,25 +2835,21 @@ __mmplayer_gst_deinterleave_no_more_pads(GstElement *elem, gpointer data)
selector = player->pipeline->mainbin[MMPLAYER_M_A_SELECTOR].gst;
- if (!selector)
- {
+ if (!selector) {
LOGE("there is no audio channel selector.\n");
goto ERROR;
}
active_index = player->audio_mode.active_pad_index;
- if (active_index != default_audio_ch)
- {
+ if (active_index != default_audio_ch) {
gint audio_ch = default_audio_ch;
/*To get the new pad from the selector*/
change_pad_name = g_strdup_printf("sink%d", active_index);
- if (change_pad_name != NULL)
- {
+ if (change_pad_name != NULL) {
sinkpad = gst_element_get_static_pad(selector, change_pad_name);
- if (sinkpad != NULL)
- {
+ if (sinkpad != NULL) {
LOGD("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
g_object_set(selector, "active-pad", sinkpad, NULL);
@@ -3244,8 +2907,7 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
mainbin = player->pipeline->mainbin;
/* tee */
- if ((tee = __mmplayer_element_create_and_link(player, pad, "tee")) == NULL)
- {
+ if ((tee = __mmplayer_element_create_and_link(player, pad, "tee")) == NULL) {
LOGE("ERROR : tee create error\n");
goto ERROR;
}
@@ -3257,8 +2919,7 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
/* queue */
srcpad = gst_element_get_request_pad(tee, "src_%u");
- if ((stereo_queue = __mmplayer_element_create_and_link(player, srcpad, "queue")) == NULL)
- {
+ if ((stereo_queue = __mmplayer_element_create_and_link(player, srcpad, "queue")) == NULL) {
LOGE("ERROR : stereo queue create error\n");
goto ERROR;
}
@@ -3272,16 +2933,14 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
player->pipeline->mainbin[MMPLAYER_M_A_Q1].id = MMPLAYER_M_A_Q1;
player->pipeline->mainbin[MMPLAYER_M_A_Q1].gst = stereo_queue;
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
srcpad = gst_element_get_request_pad(tee, "src_%u");
- if ((mono_queue = __mmplayer_element_create_and_link(player, srcpad, "queue")) == NULL)
- {
+ if ((mono_queue = __mmplayer_element_create_and_link(player, srcpad, "queue")) == NULL) {
LOGE("ERROR : mono queue create error\n");
goto ERROR;
}
@@ -3300,8 +2959,7 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
/* audioconvert */
srcpad = gst_element_get_static_pad(mono_queue, "src");
- if ((conv = __mmplayer_element_create_and_link(player, srcpad, "audioconvert")) == NULL)
- {
+ if ((conv = __mmplayer_element_create_and_link(player, srcpad, "audioconvert")) == NULL) {
LOGE("ERROR : audioconvert create error\n");
goto ERROR;
}
@@ -3310,15 +2968,13 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
player->pipeline->mainbin[MMPLAYER_M_A_CONV].gst = conv;
/* caps filter */
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
srcpad = gst_element_get_static_pad(conv, "src");
- if ((filter = __mmplayer_element_create_and_link(player, srcpad, "capsfilter")) == NULL)
- {
+ if ((filter = __mmplayer_element_create_and_link(player, srcpad, "capsfilter")) == NULL) {
LOGE("ERROR : capsfilter create error\n");
goto ERROR;
}
@@ -3338,15 +2994,13 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
gst_element_set_state(filter, GST_STATE_PAUSED);
/* deinterleave */
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
srcpad = gst_element_get_static_pad(filter, "src");
- if ((deinterleave = __mmplayer_element_create_and_link(player, srcpad, "deinterleave")) == NULL)
- {
+ if ((deinterleave = __mmplayer_element_create_and_link(player, srcpad, "deinterleave")) == NULL) {
LOGE("ERROR : deinterleave create error\n");
goto ERROR;
}
@@ -3364,8 +3018,7 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
/* selector */
selector = gst_element_factory_make("input-selector", "audio-channel-selector");
- if (selector == NULL)
- {
+ if (selector == NULL) {
LOGE("ERROR : audio-selector create error\n");
goto ERROR;
}
@@ -3383,8 +3036,7 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
gst_pad_add_probe(selector_srcpad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
__mmplayer_gst_selector_blocked, NULL, NULL);
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
@@ -3392,8 +3044,7 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
srcpad = gst_element_get_static_pad(stereo_queue, "src");
sinkpad = gst_element_get_request_pad(selector, "sink_%u");
- if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) {
LOGW("failed to link queue_stereo - selector\n");
goto ERROR;
}
@@ -3409,26 +3060,22 @@ __mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer d
ERROR:
LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(selector_srcpad));
- if (block_id != 0)
- {
+ if (block_id != 0) {
gst_pad_remove_probe(selector_srcpad, block_id);
block_id = 0;
}
- if (sinkpad)
- {
+ if (sinkpad) {
gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
- if (selector_srcpad)
- {
+ if (selector_srcpad) {
gst_object_unref(GST_OBJECT(selector_srcpad));
selector_srcpad = NULL;
}
@@ -3454,12 +3101,10 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
LOGD("no-more-pad signal handling\n");
if ((player->cmd == MMPLAYER_COMMAND_DESTROY) ||
- (player->cmd == MMPLAYER_COMMAND_UNREALIZE))
- {
+ (player->cmd == MMPLAYER_COMMAND_UNREALIZE)) {
LOGW("no need to go more");
- if (player->gapless.reconfigure)
- {
+ if (player->gapless.reconfigure) {
player->gapless.reconfigure = FALSE;
MMPLAYER_PLAYBACK_UNLOCK(player);
}
@@ -3470,12 +3115,10 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
if ((!MMPLAYER_IS_HTTP_PD(player)) &&
(MMPLAYER_IS_HTTP_STREAMING(player)) &&
(!player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst) &&
- (player->pipeline->mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst))
- {
+ (player->pipeline->mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)) {
#define ESTIMATED_BUFFER_UNIT (1*1024*1024)
- if (NULL == player->streamer)
- {
+ if (NULL == player->streamer) {
LOGW("invalid state for buffering");
goto ERROR;
}
@@ -3486,7 +3129,7 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
buffer_bytes = MAX(buffer_bytes, player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffering_bytes);
LOGD("[Decodebin2] set use-buffering on Q2(pre buffer time: %d sec, buffer size : %d)\n", (gint)init_buffering_time, buffer_bytes);
- init_buffering_time = (init_buffering_time != 0)?(init_buffering_time):(player->ini.http_buffering_time);
+ init_buffering_time = (init_buffering_time != 0) ? (init_buffering_time) : (player->ini.http_buffering_time);
if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
LOGE("fail to get duration.\n");
@@ -3502,18 +3145,16 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
player->ini.http_buffering_limit, // high percent
MUXED_BUFFER_TYPE_MEM_QUEUE,
NULL,
- ((dur_bytes>0)?((guint64)dur_bytes):0));
+ ((dur_bytes > 0) ? ((guint64)dur_bytes) : 0));
}
video_selector = player->pipeline->mainbin[MMPLAYER_M_V_INPUT_SELECTOR].gst;
audio_selector = player->pipeline->mainbin[MMPLAYER_M_A_INPUT_SELECTOR].gst;
text_selector = player->pipeline->mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst;
- if (video_selector)
- {
+ if (video_selector) {
// [link] input-selector :: videobin
srcpad = gst_element_get_static_pad(video_selector, "src");
- if (!srcpad)
- {
+ if (!srcpad) {
LOGE("failed to get srcpad from video selector\n");
goto ERROR;
}
@@ -3525,27 +3166,23 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
__mmplayer_gst_decode_callback(video_selector, srcpad, player);
LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
- if (player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id)
- {
+ if (player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id) {
gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id = 0;
}
}
- if (audio_selector)
- {
+ if (audio_selector) {
active_index = player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].active_pad_index;
if ((active_index != DEFAULT_TRACK) &&
- (__mmplayer_change_selector_pad(player, MM_PLAYER_TRACK_TYPE_AUDIO, active_index) != MM_ERROR_NONE))
- {
+ (__mmplayer_change_selector_pad(player, MM_PLAYER_TRACK_TYPE_AUDIO, active_index) != MM_ERROR_NONE)) {
LOGW("failed to change audio track\n");
player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].active_pad_index = DEFAULT_TRACK;
}
// [link] input-selector :: audiobin
srcpad = gst_element_get_static_pad(audio_selector, "src");
- if (!srcpad)
- {
+ if (!srcpad) {
LOGE("failed to get srcpad from selector\n");
goto ERROR;
}
@@ -3554,24 +3191,19 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
if (!text_selector)
player->no_more_pad = TRUE;
- if ((player->use_deinterleave == TRUE) && (player->max_audio_channels >= 2))
- {
+ if ((player->use_deinterleave == TRUE) && (player->max_audio_channels >= 2)) {
LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
- if (player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id)
- {
+ if (player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id) {
gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id = 0;
}
__mmplayer_gst_build_deinterleave_path(audio_selector, srcpad, player);
- }
- else
- {
+ } else {
__mmplayer_gst_decode_callback(audio_selector, srcpad, player);
LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
- if (player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id)
- {
+ if (player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id) {
gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id = 0;
}
@@ -3580,21 +3212,14 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
LOGD("Total audio tracks = %d \n", player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].total_track_num);
attrs = MMPLAYER_GET_ATTRS(player);
- if (attrs)
- {
+ if (attrs) {
mm_attrs_set_int_by_name(attrs, "content_audio_track_num", (gint)player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].total_track_num);
if (mmf_attrs_commit(attrs))
LOGE("failed to commit.\n");
- }
- else
- {
+ } else
LOGE("cannot get content attribute");
- }
- }
- else
- {
- if ((player->pipeline->audiobin) && (player->pipeline->audiobin[MMPLAYER_A_BIN].gst))
- {
+ } else {
+ if ((player->pipeline->audiobin) && (player->pipeline->audiobin[MMPLAYER_A_BIN].gst)) {
LOGD("There is no audio track : remove audiobin");
__mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN);
@@ -3605,30 +3230,23 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
}
if (player->num_dynamic_pad == 0)
- {
__mmplayer_pipeline_complete(NULL, player);
- }
}
- if (!MMPLAYER_IS_MS_BUFF_SRC(player))
- {
+ if (!MMPLAYER_IS_MS_BUFF_SRC(player)) {
if (text_selector)
- {
__mmplayer_handle_text_decode_path(player, text_selector);
- }
}
MMPLAYER_FLEAVE();
ERROR:
- if (srcpad)
- {
+ if (srcpad) {
gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
- if (player->gapless.reconfigure)
- {
+ if (player->gapless.reconfigure) {
player->gapless.reconfigure = FALSE;
MMPLAYER_PLAYBACK_UNLOCK(player);
}
@@ -3659,52 +3277,43 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
pipeline = player->pipeline->mainbin[MMPLAYER_M_PIPE].gst;
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute\n");
goto ERROR;
}
/* get mimetype from caps */
caps = gst_pad_query_caps(pad, NULL);
- if (!caps)
- {
+ if (!caps) {
LOGE("cannot get caps from pad.\n");
goto ERROR;
}
caps_str = gst_caps_to_string(caps);
str = gst_caps_get_structure(caps, 0);
- if (!str)
- {
+ if (!str) {
LOGE("cannot get structure from caps.\n");
goto ERROR;
}
name = gst_structure_get_name(str);
- if (!name)
- {
+ if (!name) {
LOGE("cannot get mimetype from structure.\n");
goto ERROR;
}
//LOGD("detected mimetype : %s\n", name);
- if (strstr(name, "audio"))
- {
- if (player->pipeline->audiobin == NULL)
- {
- if (MM_ERROR_NONE != __mmplayer_gst_create_audio_pipeline(player))
- {
+ if (strstr(name, "audio")) {
+ if (player->pipeline->audiobin == NULL) {
+ if (MM_ERROR_NONE != __mmplayer_gst_create_audio_pipeline(player)) {
LOGE("failed to create audiobin. continuing without audio\n");
goto ERROR;
}
sinkbin = player->pipeline->audiobin[MMPLAYER_A_BIN].gst;
LOGD("creating audiosink bin success\n");
- }
- else
- {
+ } else {
reusing = TRUE;
sinkbin = player->pipeline->audiobin[MMPLAYER_A_BIN].gst;
LOGD("reusing audiobin\n");
@@ -3717,21 +3326,15 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
player->audiosink_linked = 1;
sinkpad = gst_element_get_static_pad(GST_ELEMENT(sinkbin), "sink");
- if (!sinkpad)
- {
+ if (!sinkpad) {
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
}
- }
- else if (strstr(name, "video"))
- {
+ } else if (strstr(name, "video")) {
if (strstr(caps_str, "ST12") || strstr(caps_str, "SN12"))
- {
player->set_mode.video_zc = TRUE;
- }
- if (player->pipeline->videobin == NULL)
- {
+ if (player->pipeline->videobin == NULL) {
/* NOTE : not make videobin because application dose not want to play it even though file has video stream. */
/* get video surface type */
int surface_type = 0;
@@ -3743,16 +3346,12 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
goto ERROR;
}
- if (surface_type == MM_DISPLAY_SURFACE_OVERLAY)
- {
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE)
- {
+ if (surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE) {
/* prepare resource manager for video overlay */
- if (resource_state >= RESOURCE_STATE_INITIALIZED)
- {
+ if (resource_state >= RESOURCE_STATE_INITIALIZED) {
if (_mmplayer_resource_manager_prepare(&player->resource_manager, RESOURCE_TYPE_VIDEO_OVERLAY)
- != MM_ERROR_NONE)
- {
+ != MM_ERROR_NONE) {
LOGE("could not prepare for video_overlay resource\n");
goto ERROR;
}
@@ -3761,14 +3360,11 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
}
if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state)
- == MM_ERROR_NONE)
- {
+ == MM_ERROR_NONE) {
/* acquire resources for video playing */
- if (resource_state == RESOURCE_STATE_PREPARED)
- {
+ if (resource_state == RESOURCE_STATE_PREPARED) {
if (_mmplayer_resource_manager_acquire(&player->resource_manager)
- != MM_ERROR_NONE)
- {
+ != MM_ERROR_NONE) {
LOGE("could not acquire resources for video playing\n");
_mmplayer_resource_manager_unprepare(&player->resource_manager);
goto ERROR;
@@ -3776,17 +3372,14 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
}
}
- if (MM_ERROR_NONE != __mmplayer_gst_create_video_pipeline(player, caps, surface_type))
- {
+ if (MM_ERROR_NONE != __mmplayer_gst_create_video_pipeline(player, caps, surface_type)) {
LOGE("failed to create videobin. continuing without video\n");
goto ERROR;
}
sinkbin = player->pipeline->videobin[MMPLAYER_V_BIN].gst;
LOGD("creating videosink bin success\n");
- }
- else
- {
+ } else {
reusing = TRUE;
sinkbin = player->pipeline->videobin[MMPLAYER_V_BIN].gst;
LOGD("re-using videobin\n");
@@ -3798,25 +3391,21 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
player->videosink_linked = 1;
/* NOTE : intermediate code before doing H/W subtitle compositon */
- if (player->use_textoverlay && player->play_subtitle)
- {
+ if (player->use_textoverlay && player->play_subtitle) {
LOGD("using textoverlay for external subtitle");
/* check text bin has created well */
- if (player->pipeline && player->pipeline->textbin)
- {
+ if (player->pipeline && player->pipeline->textbin) {
/* get sinkpad from textoverlay */
sinkpad = gst_element_get_static_pad(
GST_ELEMENT(player->pipeline->textbin[MMPLAYER_T_BIN].gst),
"video_sink");
- if (!sinkpad)
- {
+ if (!sinkpad) {
LOGE("failed to get sink pad from textoverlay");
goto ERROR;
}
/* link new pad with textoverlay first */
- if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) {
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
}
@@ -3828,34 +3417,26 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
pad = gst_element_get_static_pad(
GST_ELEMENT(player->pipeline->textbin[MMPLAYER_T_BIN].gst),
"src");
- if (!pad)
- {
+ if (!pad) {
LOGE("failed to get sink pad from textoverlay");
goto ERROR;
}
- }
- else
- {
+ } else {
LOGE("should not reach here.");
goto ERROR;
}
}
sinkpad = gst_element_get_static_pad(GST_ELEMENT(sinkbin), "sink");
- if (!sinkpad)
- {
+ if (!sinkpad) {
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
}
- }
- else if (strstr(name, "text"))
- {
- if (player->pipeline->textbin == NULL)
- {
+ } else if (strstr(name, "text")) {
+ if (player->pipeline->textbin == NULL) {
MMPlayerGstElement* mainbin = NULL;
- if (MM_ERROR_NONE != __mmplayer_gst_create_text_pipeline(player))
- {
+ if (MM_ERROR_NONE != __mmplayer_gst_create_text_pipeline(player)) {
LOGE("failed to create textbin. continuing without text\n");
goto ERROR;
}
@@ -3870,55 +3451,44 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
LOGI("player->textsink_linked set to 1\n");
sinkpad = gst_element_get_static_pad(GST_ELEMENT(sinkbin), "text_sink");
- if (!sinkpad)
- {
+ if (!sinkpad) {
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
}
mainbin = player->pipeline->mainbin;
- if (!mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst)
- {
- /* input selector */
- text_selector = gst_element_factory_make("input-selector", "subtitle_inselector");
- if (!text_selector)
- {
- LOGE("failed to create subtitle input selector element\n");
- goto ERROR;
- }
- g_object_set(text_selector, "sync-streams", TRUE, NULL);
-
- mainbin[MMPLAYER_M_T_INPUT_SELECTOR].id = MMPLAYER_M_T_INPUT_SELECTOR;
- mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst = text_selector;
-
- /* warm up */
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(text_selector, GST_STATE_READY))
- {
- LOGE("failed to set state(READY) to sinkbin\n");
- goto ERROR;
- }
-
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), text_selector))
- {
- LOGW("failed to add subtitle input selector\n");
- goto ERROR;
- }
-
- LOGD("created element input-selector");
+ if (!mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst) {
+ /* input selector */
+ text_selector = gst_element_factory_make("input-selector", "subtitle_inselector");
+ if (!text_selector) {
+ LOGE("failed to create subtitle input selector element\n");
+ goto ERROR;
+ }
+ g_object_set(text_selector, "sync-streams", TRUE, NULL);
- }
- else
- {
- LOGD("already having subtitle input selector");
- text_selector = mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst;
- }
- }
+ mainbin[MMPLAYER_M_T_INPUT_SELECTOR].id = MMPLAYER_M_T_INPUT_SELECTOR;
+ mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst = text_selector;
- else
- {
- if (!player->textsink_linked)
- {
+ /* warm up */
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(text_selector, GST_STATE_READY)) {
+ LOGE("failed to set state(READY) to sinkbin\n");
+ goto ERROR;
+ }
+
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), text_selector)) {
+ LOGW("failed to add subtitle input selector\n");
+ goto ERROR;
+ }
+
+ LOGD("created element input-selector");
+
+ } else {
+ LOGD("already having subtitle input selector");
+ text_selector = mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst;
+ }
+ } else {
+ if (!player->textsink_linked) {
LOGD("re-using textbin\n");
reusing = TRUE;
@@ -3926,62 +3496,48 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
player->textsink_linked = 1;
LOGI("player->textsink_linked set to 1\n");
- }
- else
- {
+ } else
LOGD("ignoring internal subtutle since external subtitle is available");
- }
}
- }
- else
- {
+ } else {
LOGW("unknown type of elementary stream!ignoring it...\n");
goto ERROR;
}
- if (sinkbin)
- {
- if (!reusing)
- {
+ if (sinkbin) {
+ if (!reusing) {
/* warm up */
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkbin, GST_STATE_READY))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkbin, GST_STATE_READY)) {
LOGE("failed to set state(READY) to sinkbin\n");
goto ERROR;
}
/* Added for multi audio support to avoid adding audio bin again*/
/* add */
- if (FALSE == gst_bin_add(GST_BIN(pipeline), sinkbin))
- {
+ if (FALSE == gst_bin_add(GST_BIN(pipeline), sinkbin)) {
LOGE("failed to add sinkbin to pipeline\n");
goto ERROR;
}
}
/* link */
- if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) {
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
}
- if (!reusing)
- {
+ if (!reusing) {
/* run */
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkbin, GST_STATE_PAUSED))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkbin, GST_STATE_PAUSED)) {
LOGE("failed to set state(PAUSED) to sinkbin\n");
goto ERROR;
}
- if (text_selector)
- {
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(text_selector, GST_STATE_PAUSED))
- {
- LOGE("failed to set state(PAUSED) to sinkbin\n");
- goto ERROR;
- }
+ if (text_selector) {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(text_selector, GST_STATE_PAUSED)) {
+ LOGE("failed to set state(PAUSED) to sinkbin\n");
+ goto ERROR;
+ }
}
}
@@ -3992,9 +3548,9 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
LOGD("linking sink bin success\n");
/* FIXIT : we cannot hold callback for 'no-more-pad' signal because signal was emitted in
- * streaming task. if the task blocked, then buffer will not flow to the next element
- *(autoplugging element). so this is special hack for streaming. please try to remove it
- */
+ * streaming task. if the task blocked, then buffer will not flow to the next element
+ *(autoplugging element). so this is special hack for streaming. please try to remove it
+ */
/* dec stream count. we can remove fakesink if it's zero */
if (player->num_dynamic_pad)
player->num_dynamic_pad--;
@@ -4002,15 +3558,11 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) //
LOGD("no more pads: %d stream count dec : %d(num of dynamic pad)\n", player->no_more_pad, player->num_dynamic_pad);
if ((player->no_more_pad) && (player->num_dynamic_pad == 0))
- {
__mmplayer_pipeline_complete(NULL, player);
- }
/* FIXIT : please leave a note why this code is needed */
if (MMPLAYER_IS_WFD_STREAMING(player))
- {
player->no_more_pad = TRUE;
- }
ERROR:
@@ -4023,10 +3575,8 @@ ERROR:
gst_object_unref(GST_OBJECT(sinkpad));
/* flusing out new attributes */
- if ( mmf_attrs_commit(attrs))
- {
+ if (mmf_attrs_commit(attrs))
LOGE("failed to comit attributes\n");
- }
return;
}
@@ -4043,35 +3593,25 @@ __mmplayer_get_property_value_for_rotation(mm_player_t* player, int rotation_ang
MMPLAYER_RETURN_VAL_IF_FAIL(rotation_angle >= 0, FALSE);
if (rotation_angle >= 360)
- {
dest_angle = rotation_angle - 360;
- }
/* chech if supported or not */
- if (dest_angle % 90)
- {
+ if (dest_angle % 90) {
LOGD("not supported rotation angle = %d", rotation_angle);
return FALSE;
}
/*
- * xvimagesink only (A)
+ * xvimagesink only (A)
* custom_convert - no xv(e.g. memsink, evasimagesink (B)
* videoflip - avsysmemsink(C)
*/
- if (player->set_mode.video_zc)
- {
+ if (player->set_mode.video_zc) {
if (player->pipeline->videobin[MMPLAYER_V_CONV].gst) // B
- {
rotation_type = ROTATION_USING_CUSTOM;
- }
else // A
- {
rotation_type = ROTATION_USING_SINK;
- }
- }
- else
- {
+ } else {
int surface_type = 0;
rotation_type = ROTATION_USING_FLIP;
@@ -4080,81 +3620,71 @@ __mmplayer_get_property_value_for_rotation(mm_player_t* player, int rotation_ang
if ((surface_type == MM_DISPLAY_SURFACE_OVERLAY) ||
(surface_type == MM_DISPLAY_SURFACE_EVAS && !strcmp(player->ini.videosink_element_evas, "evaspixmapsink")))
- {
rotation_type = ROTATION_USING_SINK;
- }
else
- {
rotation_type = ROTATION_USING_FLIP; //C
- }
LOGD("using %d type for rotation", rotation_type);
}
/* get property value for setting */
- switch (rotation_type)
- {
- case ROTATION_USING_SINK: // xvimagesink, pixmap
- {
- switch (dest_angle)
- {
- case 0:
- break;
- case 90:
- pro_value = 3; // clockwise 90
- break;
- case 180:
- pro_value = 2;
- break;
- case 270:
- pro_value = 1; // counter-clockwise 90
- break;
- }
+ switch (rotation_type) {
+ case ROTATION_USING_SINK: // xvimagesink, pixmap
+ {
+ switch (dest_angle) {
+ case 0:
+ break;
+ case 90:
+ pro_value = 3; // clockwise 90
+ break;
+ case 180:
+ pro_value = 2;
+ break;
+ case 270:
+ pro_value = 1; // counter-clockwise 90
+ break;
}
- break;
- case ROTATION_USING_CUSTOM:
- {
- gchar *ename = NULL;
- ename = GST_OBJECT_NAME(gst_element_get_factory(player->pipeline->videobin[MMPLAYER_V_CONV].gst));
+ }
+ break;
+ case ROTATION_USING_CUSTOM:
+ {
+ gchar *ename = NULL;
+ ename = GST_OBJECT_NAME(gst_element_get_factory(player->pipeline->videobin[MMPLAYER_V_CONV].gst));
- if (g_strrstr(ename, "fimcconvert"))
- {
- switch (dest_angle)
- {
- case 0:
- break;
- case 90:
- pro_value = 90; // clockwise 90
- break;
- case 180:
- pro_value = 180;
- break;
- case 270:
- pro_value = 270; // counter-clockwise 90
- break;
- }
+ if (g_strrstr(ename, "fimcconvert")) {
+ switch (dest_angle) {
+ case 0:
+ break;
+ case 90:
+ pro_value = 90; // clockwise 90
+ break;
+ case 180:
+ pro_value = 180;
+ break;
+ case 270:
+ pro_value = 270; // counter-clockwise 90
+ break;
}
}
- break;
- case ROTATION_USING_FLIP: // videoflip
- {
- switch (dest_angle)
- {
-
- case 0:
- break;
- case 90:
- pro_value = 1; // clockwise 90
- break;
- case 180:
- pro_value = 2;
- break;
- case 270:
- pro_value = 3; // counter-clockwise 90
- break;
- }
- }
- break;
+ }
+ break;
+ case ROTATION_USING_FLIP: // videoflip
+ {
+ switch (dest_angle) {
+ case 0:
+ break;
+ case 90:
+ pro_value = 1; // clockwise 90
+ break;
+ case 180:
+ pro_value = 2;
+ break;
+ case 270:
+ pro_value = 3; // counter-clockwise 90
+ break;
+ }
+ }
+ break;
}
LOGD("setting rotation property value : %d, used rotation type : %d", pro_value, rotation_type);
@@ -4257,8 +3787,7 @@ __mmplayer_video_param_set_render_rectangle(mm_player_t* player)
mm_attrs_get_data_by_name(attrs, "display_overlay", &handle);
- if (handle)
- {
+ if (handle) {
/*It should be set after setting window*/
mm_attrs_get_int_by_name(attrs, "wl_window_render_x", &wl_window_x);
mm_attrs_get_int_by_name(attrs, "wl_window_render_y", &wl_window_y);
@@ -4295,16 +3824,16 @@ __mmplayer_video_param_set_display_overlay(mm_player_t* player)
mm_attrs_get_data_by_name(attrs, "display_overlay", &handle);
mm_attrs_get_int_by_name(attrs, "use_wl_surface", &use_wl_surface);
- if (handle && !use_wl_surface) { /* default is using wl_surface_id */
+ if (handle && !use_wl_surface) {
+ /* default is using wl_surface_id */
unsigned int wl_surface_id = 0;
wl_surface_id = *(int*)handle;
LOGD("set video param : wl_surface_id %d %p", wl_surface_id, *(int*)handle);
gst_video_overlay_set_wl_window_wl_surface_id(
GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
*(int*)handle);
- }
- else if (handle && use_wl_surface) /* use wl_surface for legacy_player_test */
- {
+ } else if (handle && use_wl_surface) {
+ /* use wl_surface for legacy_player_test */
mm_attrs_get_data_by_name(attrs, "wl_display", &wl_display);
if (wl_display)
context = gst_wayland_display_handle_context_new(wl_display);
@@ -4316,12 +3845,9 @@ __mmplayer_video_param_set_display_overlay(mm_player_t* player)
gst_video_overlay_set_window_handle(
GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
wl_surface);
- }
- else
- {
+ } else
/* FIXIT : is it error case? */
LOGW("still we don't have a window handle on player attribute. create it's own surface.");
- }
}
@@ -4335,38 +3861,25 @@ __mmplayer_update_wayland_videosink_video_param(mm_player_t* player, char *param
if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return MM_ERROR_PLAYER_NOT_INITIALIZED;
- if (strcmp(player->ini.videosink_element_overlay, "waylandsink"))
- {
+ if (strcmp(player->ini.videosink_element_overlay, "waylandsink")) {
LOGE("can not find waylandsink");
return MM_ERROR_PLAYER_INTERNAL;
}
LOGD("param_name : %s", param_name);
if (!g_strcmp0(param_name, "update_all_param"))
- {
update_all_param = TRUE;
- }
if (update_all_param || !g_strcmp0(param_name, "display_overlay"))
- {
__mmplayer_video_param_set_display_overlay(player);
- }
if (update_all_param || !g_strcmp0(param_name, "wl_window_render_x") || !g_strcmp0(param_name, "display_overlay"))
- {
__mmplayer_video_param_set_render_rectangle(player);
- }
if (update_all_param || !g_strcmp0(param_name, "display_method"))
- {
__mmplayer_video_param_set_display_method(player);
- }
if (update_all_param || !g_strcmp0(param_name, "display_visible"))
- {
__mmplayer_video_param_set_display_visible(player);
- }
if (update_all_param || !g_strcmp0(param_name, "display_rotation"))
- {
__mmplayer_video_param_set_display_rotation(player);
- }
return MM_ERROR_NONE;
}
@@ -4400,13 +3913,10 @@ __mmplayer_update_evas_videosink_video_param(mm_player_t* player)
mm_attrs_get_int_by_name(attrs, "display_method", &display_method);
/* if evasimagesink */
- if (!strcmp(player->ini.videosink_element_evas,"evasimagesink"))
- {
- if (object)
- {
+ if (!strcmp(player->ini.videosink_element_evas, "evasimagesink")) {
+ if (object) {
/* if it is evasimagesink, we are not supporting rotation */
- if (user_angle != 0)
- {
+ if (user_angle != 0) {
mm_attrs_set_int_by_name(attrs, "display_rotation", MM_DISPLAY_ROTATION_NONE);
if (mmf_attrs_commit(attrs)) /* return -1 if error */
LOGE("failed to commit\n");
@@ -4423,17 +3933,14 @@ __mmplayer_update_evas_videosink_video_param(mm_player_t* player)
LOGD("set video param : method %d", display_method);
LOGD("set video param : evas-object %x, visible %d", object, visible);
LOGD("set video param : evas-object %x, rotate %d", object, rotation_value);
- }
- else
- {
+ } else {
LOGE("no evas object");
return MM_ERROR_PLAYER_INTERNAL;
}
/* if evasimagesink using converter */
- if (player->set_mode.video_zc && player->pipeline->videobin[MMPLAYER_V_CONV].gst)
- {
+ if (player->set_mode.video_zc && player->pipeline->videobin[MMPLAYER_V_CONV].gst) {
int width = 0;
int height = 0;
int no_scaling = !scaling;
@@ -4445,25 +3952,18 @@ __mmplayer_update_evas_videosink_video_param(mm_player_t* player)
g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "src-rand-idx", TRUE, NULL);
g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "dst-buffer-num", 5, NULL);
- if (no_scaling)
- {
+ if (no_scaling) {
/* no-scaling order to fimcconvert, original width, height size of media src will be passed to sink plugin */
g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst,
"dst-width", 0, /* setting 0, output video width will be media src's width */
"dst-height", 0, /* setting 0, output video height will be media src's height */
NULL);
- }
- else
- {
+ } else {
/* scaling order to fimcconvert */
if (width)
- {
g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "dst-width", width, NULL);
- }
if (height)
- {
g_object_set(player->pipeline->videobin[MMPLAYER_V_CONV].gst, "dst-height", height, NULL);
- }
LOGD("set video param : video frame scaling down to width(%d) height(%d)", width, height);
}
LOGD("set video param : display_evas_do_scaling %d", scaling);
@@ -4486,8 +3986,7 @@ _mmplayer_update_video_param(mm_player_t* player, char *param_name) // @
return MM_ERROR_PLAYER_NOT_INITIALIZED;
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -4498,28 +3997,27 @@ _mmplayer_update_video_param(mm_player_t* player, char *param_name) // @
LOGD("check display surface type attribute: %d", surface_type);
/* configuring display */
- switch (surface_type)
- {
- case MM_DISPLAY_SURFACE_OVERLAY:
+ switch (surface_type) {
+ case MM_DISPLAY_SURFACE_OVERLAY:
{
ret = __mmplayer_update_wayland_videosink_video_param(player, param_name);
if (ret != MM_ERROR_NONE)
return ret;
}
break;
- case MM_DISPLAY_SURFACE_EVAS:
+ case MM_DISPLAY_SURFACE_EVAS:
{
ret = __mmplayer_update_evas_videosink_video_param(player);
if (ret != MM_ERROR_NONE)
return ret;
}
break;
- case MM_DISPLAY_SURFACE_NULL:
+ case MM_DISPLAY_SURFACE_NULL:
{
/* do nothing */
}
break;
- case MM_DISPLAY_SURFACE_REMOTE:
+ case MM_DISPLAY_SURFACE_REMOTE:
{
/* do nothing */
}
@@ -4546,30 +4044,24 @@ __mmplayer_gst_element_link_bucket(GList* element_bucket) // @
prv_element = (MMPlayerGstElement*)bucket->data;
bucket = bucket->next;
- for (; bucket; bucket = bucket->next)
- {
+ for (; bucket; bucket = bucket->next) {
element = (MMPlayerGstElement*)bucket->data;
- if (element && element->gst)
- {
+ if (element && element->gst) {
/* If next element is audio appsrc then make a separate audio pipeline */
- if (!strcmp(GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),"audio_appsrc") ||
- !strcmp(GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),"subtitle_appsrc"))
- {
+ if (!strcmp(GST_ELEMENT_NAME(GST_ELEMENT(element->gst)), "audio_appsrc") ||
+ !strcmp(GST_ELEMENT_NAME(GST_ELEMENT(element->gst)), "subtitle_appsrc")) {
prv_element = element;
continue;
}
if (prv_element && prv_element->gst) {
- if (GST_ELEMENT_LINK(GST_ELEMENT(prv_element->gst), GST_ELEMENT(element->gst)))
- {
+ if (GST_ELEMENT_LINK(GST_ELEMENT(prv_element->gst), GST_ELEMENT(element->gst))) {
LOGD("linking [%s] to [%s] success\n",
GST_ELEMENT_NAME(GST_ELEMENT(prv_element->gst)),
GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
- successful_link_count ++;
- }
- else
- {
+ successful_link_count++;
+ } else {
LOGD("linking [%s] to [%s] failed\n",
GST_ELEMENT_NAME(GST_ELEMENT(prv_element->gst)),
GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
@@ -4598,20 +4090,17 @@ __mmplayer_gst_element_add_bucket_to_bin(GstBin* bin, GList* element_bucket) //
MMPLAYER_RETURN_VAL_IF_FAIL(element_bucket, 0);
MMPLAYER_RETURN_VAL_IF_FAIL(bin, 0);
- for (; bucket; bucket = bucket->next)
- {
+ for (; bucket; bucket = bucket->next) {
element = (MMPlayerGstElement*)bucket->data;
- if (element && element->gst)
- {
- if (!gst_bin_add(bin, GST_ELEMENT(element->gst)))
- {
+ if (element && element->gst) {
+ if (!gst_bin_add(bin, GST_ELEMENT(element->gst))) {
LOGD("__mmplayer_gst_element_link_bucket : Adding element [%s] to bin [%s] failed\n",
GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
GST_ELEMENT_NAME(GST_ELEMENT(bin)));
return 0;
}
- successful_add_count ++;
+ successful_add_count++;
}
}
@@ -4635,48 +4124,34 @@ static void __mmplayer_gst_caps_notify_cb(GstPad * pad, GParamSpec * unused, gpo
caps = gst_pad_get_current_caps(pad);
if (!caps)
- {
return;
- }
str = gst_caps_get_structure(caps, 0);
if (!str)
- {
goto ERROR;
- }
name = gst_structure_get_name(str);
if (!name)
- {
goto ERROR;
- }
LOGD("name = %s\n", name);
- if (strstr(name, "audio"))
- {
+ if (strstr(name, "audio")) {
_mmplayer_update_content_attrs(player, ATTR_AUDIO);
- if (player->audio_stream_changed_cb)
- {
+ if (player->audio_stream_changed_cb) {
LOGE("call the audio stream changed cb\n");
player->audio_stream_changed_cb(player->audio_stream_changed_cb_user_param);
}
- }
- else if (strstr(name, "video"))
- {
+ } else if (strstr(name, "video")) {
_mmplayer_update_content_attrs(player, ATTR_VIDEO);
- if (player->video_stream_changed_cb)
- {
+ if (player->video_stream_changed_cb) {
LOGE("call the video stream changed cb\n");
player->video_stream_changed_cb(player->video_stream_changed_cb_user_param);
}
- }
- else
- {
+ } else
goto ERROR;
- }
ERROR:
@@ -4701,49 +4176,40 @@ ERROR:
#define MMPLAYER_CREATEONLY_ELEMENT(x_bin, x_id, x_factory, x_name) \
x_bin[x_id].id = x_id;\
x_bin[x_id].gst = gst_element_factory_make(x_factory, x_name);\
-if (!x_bin[x_id].gst)\
-{\
+if (!x_bin[x_id].gst) {\
LOGE("failed to create %s \n", x_factory);\
goto ERROR;\
-}\
+} \
#define MMPLAYER_CREATE_ELEMENT_ADD_BIN(x_bin, x_id, x_factory, x_name, y_bin, x_player) \
x_bin[x_id].id = x_id;\
x_bin[x_id].gst = gst_element_factory_make(x_factory, x_name);\
-if (!x_bin[x_id].gst)\
-{\
+if (!x_bin[x_id].gst) {\
LOGE("failed to create %s \n", x_factory);\
goto ERROR;\
-}\
-else\
-{\
+} else {\
if (x_player->ini.set_dump_element_flag)\
__mmplayer_add_dump_buffer_probe(x_player, x_bin[x_id].gst);\
-}\
-if (!gst_bin_add(GST_BIN(y_bin), GST_ELEMENT(x_bin[x_id].gst)))\
-{\
+} \
+if (!gst_bin_add(GST_BIN(y_bin), GST_ELEMENT(x_bin[x_id].gst))) { \
LOGD("__mmplayer_gst_element_link_bucket : Adding element [%s] to bin [%s] failed\n",\
GST_ELEMENT_NAME(GST_ELEMENT(x_bin[x_id].gst)),\
GST_ELEMENT_NAME(GST_ELEMENT(y_bin)));\
goto ERROR;\
-}\
+} \
/* macro for code readability. just for sinkbin-creation functions */
#define MMPLAYER_CREATE_ELEMENT(x_bin, x_id, x_factory, x_name, x_add_bucket, x_player) \
-do \
-{ \
+do {\
x_bin[x_id].id = x_id;\
x_bin[x_id].gst = gst_element_factory_make(x_factory, x_name);\
- if (!x_bin[x_id].gst)\
- {\
+ if (!x_bin[x_id].gst) {\
LOGE("failed to create %s \n", x_factory);\
goto ERROR;\
- }\
- else\
- {\
+ } else {\
if (x_player->ini.set_dump_element_flag)\
__mmplayer_add_dump_buffer_probe(x_player, x_bin[x_id].gst);\
- }\
+ } \
if (x_add_bucket)\
element_bucket = g_list_append(element_bucket, &x_bin[x_id]);\
} while (0);
@@ -4842,7 +4308,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
LOGD("[%lld] total: %d, data: %d, buffer: %d", channel_mask, tmp->data_size, a_size, tmp->buff_size);
if (tmp->data_size + a_size < tmp->buff_size) {
- memcpy(tmp->pcm_data+tmp->data_size, a_data, a_size);
+ memcpy(tmp->pcm_data + tmp->data_size, a_data, a_size);
tmp->data_size += a_size;
} else {
/* send data to client */
@@ -4885,7 +4351,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
if (!player->audio_stream_sink_sync) {
/* If sync is FALSE, use buffer list to reduce the IPC. */
- a_buffer->buff_size = (a_size>player->ini.pcm_buffer_size)?(a_size):(player->ini.pcm_buffer_size);
+ a_buffer->buff_size = (a_size > player->ini.pcm_buffer_size) ? (a_size) : (player->ini.pcm_buffer_size);
a_buffer->pcm_data = g_malloc(a_buffer->buff_size);
if (a_buffer->pcm_data == NULL) {
LOGE("failed to alloc data.");
@@ -4919,31 +4385,27 @@ __mmplayer_gst_audio_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpoin
MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
queue = gst_element_factory_make("queue", NULL);
- if (queue == NULL)
- {
+ if (queue == NULL) {
LOGD("fail make queue\n");
goto ERROR;
}
sink = gst_element_factory_make("fakesink", NULL);
- if (sink == NULL)
- {
+ if (sink == NULL) {
LOGD("fail make fakesink\n");
goto ERROR;
}
gst_bin_add_many(GST_BIN(audiobin[MMPLAYER_A_BIN].gst), queue, sink, NULL);
- if (!gst_element_link_pads_full(queue, "src", sink, "sink", GST_PAD_LINK_CHECK_NOTHING))
- {
+ if (!gst_element_link_pads_full(queue, "src", sink, "sink", GST_PAD_LINK_CHECK_NOTHING)) {
LOGW("failed to link queue & sink\n");
goto ERROR;
}
sinkpad = gst_element_get_static_pad(queue, "sink");
- if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
LOGW("failed to link [%s:%s] to queue\n", GST_DEBUG_PAD_NAME(pad));
goto ERROR;
}
@@ -4969,18 +4431,15 @@ __mmplayer_gst_audio_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpoin
ERROR:
LOGE("__mmplayer_gst_audio_deinterleave_pad_added ERROR\n");
- if (queue)
- {
+ if (queue) {
gst_object_unref(GST_OBJECT(queue));
queue = NULL;
}
- if (sink)
- {
+ if (sink) {
gst_object_unref(GST_OBJECT(sink));
sink = NULL;
}
- if (sinkpad)
- {
+ if (sinkpad) {
gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
@@ -5006,12 +4465,9 @@ void __mmplayer_gst_set_audiosink_property(mm_player_t* player, MMHandleType att
mm_attrs_get_int_by_name(attrs, "sound_stream_index", &stream_id);
mm_attrs_get_string_by_name(attrs, "sound_stream_type", &stream_type);
- if (!stream_type)
- {
+ if (!stream_type) {
LOGE("stream_type is null.\n");
- }
- else
- {
+ } else {
snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d", stream_type, stream_id);
props = gst_structure_from_string(stream_props, NULL);
g_object_set(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "stream-properties", props, NULL);
@@ -5020,24 +4476,21 @@ void __mmplayer_gst_set_audiosink_property(mm_player_t* player, MMHandleType att
mm_attrs_get_int_by_name(attrs, "sound_latency_mode", &latency_mode);
- switch (latency_mode)
- {
- case AUDIO_LATENCY_MODE_LOW:
- latency = g_strndup("low", 3);
- break;
- case AUDIO_LATENCY_MODE_MID:
- latency = g_strndup("mid", 3);
- break;
- case AUDIO_LATENCY_MODE_HIGH:
- latency = g_strndup("high", 4);
- break;
+ switch (latency_mode) {
+ case AUDIO_LATENCY_MODE_LOW:
+ latency = g_strndup("low", 3);
+ break;
+ case AUDIO_LATENCY_MODE_MID:
+ latency = g_strndup("mid", 3);
+ break;
+ case AUDIO_LATENCY_MODE_HIGH:
+ latency = g_strndup("high", 4);
+ break;
};
#if 0 //need to check
if (player->sound_focus.user_route_policy != 0)
- {
route_path = player->sound_focus.user_route_policy;
- }
g_object_set(player->pipeline->audiobin[MMPLAYER_A_SINK].gst,
"latency", latency_mode,
@@ -5070,7 +4523,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
GstPad *ghostpad = NULL;
GList* element_bucket = NULL;
gboolean link_audio_sink_now = TRUE;
- int i =0;
+ int i = 0;
MMPLAYER_FENTER();
@@ -5078,8 +4531,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
/* alloc handles */
audiobin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_A_NUM);
- if (!audiobin)
- {
+ if (!audiobin) {
LOGE("failed to allocate memory for audiobin\n");
return MM_ERROR_PLAYER_NO_FREE_SPACE;
}
@@ -5089,8 +4541,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
/* create bin */
audiobin[MMPLAYER_A_BIN].id = MMPLAYER_A_BIN;
audiobin[MMPLAYER_A_BIN].gst = gst_bin_new("audiobin");
- if (!audiobin[MMPLAYER_A_BIN].gst)
- {
+ if (!audiobin[MMPLAYER_A_BIN].gst) {
LOGE("failed to create audiobin\n");
goto ERROR;
}
@@ -5109,10 +4560,9 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
/* resampler */
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_RESAMPLER, player->ini.audioresampler_element, "audio resampler", TRUE, player);
- if (player->set_mode.pcm_extraction) // pcm extraction only and no sound output
- {
- if (player->audio_stream_render_cb_ex)
- {
+ if (player->set_mode.pcm_extraction) {
+ // pcm extraction only and no sound output
+ if (player->audio_stream_render_cb_ex) {
char *caps_str = NULL;
GstCaps* caps = NULL;
gchar *format = NULL;
@@ -5146,9 +4596,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
(audiobin[MMPLAYER_A_DEINTERLEAVE].gst),
MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(__mmplayer_gst_audio_deinterleave_pad_added), player);
- }
- else
- {
+ } else {
int dst_samplerate = 0;
int dst_channels = 0;
int dst_depth = 0;
@@ -5185,9 +4633,8 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
/* set sync */
g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "sync", FALSE, NULL);
}
- }
- else // normal playback
- {
+ } else {
+ // normal playback
//GstCaps* caps = NULL;
gint channels = 0;
@@ -5195,8 +4642,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_VOL, "volume", "volume", TRUE, player);
g_object_set(G_OBJECT(audiobin[MMPLAYER_A_VOL].gst), "volume", player->sound.volume, NULL);
- if (player->sound.mute)
- {
+ if (player->sound.mute) {
LOGD("mute enabled\n");
g_object_set(G_OBJECT(audiobin[MMPLAYER_A_VOL].gst), "mute", player->sound.mute, NULL);
}
@@ -5214,15 +4660,12 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
#endif
/* chech if multi-chennels */
- if (player->pipeline->mainbin && player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst)
- {
+ if (player->pipeline->mainbin && player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst) {
GstPad *srcpad = NULL;
GstCaps *caps = NULL;
- if ((srcpad = gst_element_get_static_pad(player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst, "src")))
- {
- if ((caps = gst_pad_query_caps(srcpad, NULL)))
- {
+ if ((srcpad = gst_element_get_static_pad(player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst, "src"))) {
+ if ((caps = gst_pad_query_caps(srcpad, NULL))) {
//MMPLAYER_LOG_GST_CAPS_TYPE(caps);
GstStructure *str = gst_caps_get_structure(caps, 0);
if (str)
@@ -5236,32 +4679,24 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
/* audio effect element. if audio effect is enabled */
if ((strcmp(player->ini.audioeffect_element, ""))
&& (channels <= 2)
- && (player->ini.use_audio_effect_preset || player->ini.use_audio_effect_custom))
- {
+ && (player->ini.use_audio_effect_preset || player->ini.use_audio_effect_custom)) {
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_FILTER, player->ini.audioeffect_element, "audio effect filter", TRUE, player);
LOGD("audio effect config. bypass = %d, effect type = %d", player->bypass_audio_effect, player->audio_effect_info.effect_type);
if ((!player->bypass_audio_effect)
- && (player->ini.use_audio_effect_preset || player->ini.use_audio_effect_custom))
- {
- if (MM_AUDIO_EFFECT_TYPE_CUSTOM == player->audio_effect_info.effect_type)
- {
+ && (player->ini.use_audio_effect_preset || player->ini.use_audio_effect_custom)) {
+ if (MM_AUDIO_EFFECT_TYPE_CUSTOM == player->audio_effect_info.effect_type) {
if (!_mmplayer_audio_effect_custom_apply(player))
- {
LOGI("apply audio effect(custom) setting success\n");
- }
}
}
if ((strcmp(player->ini.audioeffect_element_custom, ""))
&& (player->set_mode.rich_audio))
- {
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_FILTER_SEC, player->ini.audioeffect_element_custom, "audio effect filter custom", TRUE, player);
- }
}
- if (!MMPLAYER_IS_RTSP_STREAMING(player))
- {
+ if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
if (player->set_mode.rich_audio && channels <= 2)
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_VSP, "audiovsp", "x-speed", TRUE, player);
}
@@ -5270,11 +4705,10 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_SINK, player->ini.audiosink_element, "audiosink", link_audio_sink_now, player);
/* qos on */
- g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "qos", TRUE, NULL); /* qos on */
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "qos", TRUE, NULL); /* qos on */
g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "slave-method", GST_AUDIO_BASE_SINK_SLAVE_NONE, NULL);
- if (player->videodec_linked && player->ini.use_system_clock)
- {
+ if (player->videodec_linked && player->ini.use_system_clock) {
LOGD("system clock will be used.\n");
g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "provide-clock", FALSE, NULL);
}
@@ -5283,8 +4717,7 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
__mmplayer_gst_set_audiosink_property(player, attrs);
}
- if (audiobin[MMPLAYER_A_SINK].gst)
- {
+ if (audiobin[MMPLAYER_A_SINK].gst) {
GstPad *sink_pad = NULL;
sink_pad = gst_element_get_static_pad(audiobin[MMPLAYER_A_SINK].gst, "sink");
MMPLAYER_SIGNAL_CONNECT(player, sink_pad, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN,
@@ -5296,44 +4729,38 @@ __mmplayer_gst_create_audio_pipeline(mm_player_t* player)
/* adding created elements to bin */
LOGD("adding created elements to bin\n");
- if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(audiobin[MMPLAYER_A_BIN].gst), element_bucket))
- {
+ if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(audiobin[MMPLAYER_A_BIN].gst), element_bucket)) {
LOGE("failed to add elements\n");
goto ERROR;
}
/* linking elements in the bucket by added order. */
LOGD("Linking elements in the bucket by added order.\n");
- if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
- {
+ if (__mmplayer_gst_element_link_bucket(element_bucket) == -1) {
LOGE("failed to link elements\n");
goto ERROR;
}
/* get first element's sinkpad for creating ghostpad */
first_element = (MMPlayerGstElement *)element_bucket->data;
- if (!first_element)
- {
+ if (!first_element) {
LOGE("failed to get first elem\n");
goto ERROR;
}
pad = gst_element_get_static_pad(GST_ELEMENT(first_element->gst), "sink");
- if (!pad)
- {
+ if (!pad) {
LOGE("failed to get pad from first element of audiobin\n");
goto ERROR;
}
ghostpad = gst_ghost_pad_new("sink", pad);
- if (!ghostpad)
- {
+ if (!ghostpad) {
LOGE("failed to create ghostpad\n");
goto ERROR;
}
- if (FALSE == gst_element_add_pad(audiobin[MMPLAYER_A_BIN].gst, ghostpad))
- {
+ if (FALSE == gst_element_add_pad(audiobin[MMPLAYER_A_BIN].gst, ghostpad)) {
LOGE("failed to add ghostpad to audiobin\n");
goto ERROR;
}
@@ -5362,30 +4789,23 @@ ERROR:
g_list_free(element_bucket);
/* release element which are not added to bin */
- for (i = 1; i < MMPLAYER_A_NUM; i++) /* NOTE : skip bin */
- {
- if (audiobin[i].gst)
- {
+ for (i = 1; i < MMPLAYER_A_NUM; i++) {
+ /* NOTE : skip bin */
+ if (audiobin[i].gst) {
GstObject* parent = NULL;
parent = gst_element_get_parent(audiobin[i].gst);
- if (!parent)
- {
+ if (!parent) {
gst_object_unref(GST_OBJECT(audiobin[i].gst));
audiobin[i].gst = NULL;
- }
- else
- {
+ } else
gst_object_unref(GST_OBJECT(parent));
- }
}
}
/* release audiobin with it's childs */
if (audiobin[MMPLAYER_A_BIN].gst)
- {
gst_object_unref(GST_OBJECT(audiobin[MMPLAYER_A_BIN].gst));
- }
MMPLAYER_FREEIF(audiobin);
@@ -5411,7 +4831,7 @@ __mmplayer_audio_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_dat
static guint32 _mmplayer_convert_fourcc_string_to_value(const gchar* format_name)
{
- return format_name[0] | (format_name[1] << 8) | (format_name[2] << 16) | (format_name[3] << 24);
+ return format_name[0] | (format_name[1] << 8) | (format_name[2] << 16) | (format_name[3] << 24);
}
int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo)
@@ -5424,7 +4844,7 @@ int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo)
g_mutex_lock(&player->video_bo_mutex);
if (player->video_bo_list) {
- for (l=g_list_first(player->video_bo_list);l;l=g_list_next(l)) {
+ for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) {
mm_player_video_bo_info_t* tmp = (mm_player_video_bo_info_t *)l->data;
if (tmp && tmp->bo == bo) {
tmp->using = FALSE;
@@ -5455,7 +4875,7 @@ __mmplayer_video_stream_destroy_bo_list(mm_player_t* player)
g_mutex_lock(&player->video_bo_mutex);
if (player->video_bo_list) {
LOGD("destroy video_bo_list : %d", g_list_length(player->video_bo_list));
- for (l=g_list_first(player->video_bo_list);l;l=g_list_next(l)) {
+ for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) {
mm_player_video_bo_info_t* tmp = (mm_player_video_bo_info_t *)l->data;
if (tmp) {
if (tmp->bo)
@@ -5502,7 +4922,7 @@ __mmplayer_video_stream_get_bo(mm_player_t* player, int size)
LOGD("bo list exist(len: %d)", idx);
}
- for (; idx<player->ini.num_of_video_bo ; idx++) {
+ for (; idx < player->ini.num_of_video_bo; idx++) {
mm_player_video_bo_info_t* bo_info = g_new(mm_player_video_bo_info_t, 1);
if (!bo_info) {
LOGE("Fail to alloc bo_info.");
@@ -5533,7 +4953,7 @@ __mmplayer_video_stream_get_bo(mm_player_t* player, int size)
while (TRUE) {
/* get bo from list*/
- for (l=g_list_first(player->video_bo_list);l;l=g_list_next(l)){
+ for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) {
mm_player_video_bo_info_t* tmp = (mm_player_video_bo_info_t *)l->data;
if (tmp && (tmp->using == FALSE)) {
LOGD("found bo %p to use", tmp->bo);
@@ -5608,16 +5028,15 @@ __mmplayer_video_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
gst_structure_get_int(structure, "width", & (stream.width));
gst_structure_get_int(structure, "height", & (stream.height));
string_format = gst_structure_get_string(structure, "format");
- if (string_format) {
+ if (string_format)
fourcc = _mmplayer_convert_fourcc_string_to_value(string_format);
- }
stream.format = util_get_pixtype(fourcc);
gst_caps_unref(caps);
caps = NULL;
/*
LOGD("Call video steramCb, data[%p], Width[%d],Height[%d], Format[%d]",
- GST_BUFFER_DATA(buffer), stream.width, stream.height, stream.format);
+ GST_BUFFER_DATA(buffer), stream.width, stream.height, stream.format);
*/
if (stream.width == 0 || stream.height == 0 || stream.format == MM_PIXEL_FORMAT_INVALID) {
@@ -5696,15 +5115,13 @@ __mmplayer_video_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
tbm_bo_unmap(stream.bo[0]);
}
- if (player->video_stream_cb) {
+ if (player->video_stream_cb)
player->video_stream_cb(&stream, player->video_stream_cb_user_param);
- }
- if (metaBlock) {
+ if (metaBlock)
gst_memory_unmap(metaBlock, &mapinfo);
- } else {
+ else
gst_memory_unmap(dataBlock, &mapinfo);
- }
return;
}
@@ -5722,26 +5139,18 @@ __mmplayer_gst_create_video_filters(mm_player_t* player, GList** bucket)
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", (int *)&surface_type);
- if (player->set_mode.video_zc) /* ST12 or SN12 , if player use omx, evasimagesink doesn't use videoconvert */
- {
+ if (player->set_mode.video_zc) {
+ /* ST12 or SN12 , if player use omx, evasimagesink doesn't use videoconvert */
if ((surface_type == MM_DISPLAY_SURFACE_EVAS) && (!strcmp(player->ini.videosink_element_evas, "evasimagesink")))
- {
video_csc = player->ini.videoconverter_element;
- }
else
- {
video_csc = ""; /* Videosinks don't use videoconvert except evasimagesink which use normal video formats */
- }
- }
- else /* sw codec, if player use libav, waylandsink need videoconvert to render shm wl-buffer which support RGB only */
- {
+ } else {
+ /* sw codec, if player use libav, waylandsink need videoconvert to render shm wl-buffer which support RGB only */
if ((surface_type == MM_DISPLAY_SURFACE_OVERLAY) && (!strncmp(player->ini.videosink_element_overlay, "waylandsink", strlen(player->ini.videosink_element_overlay))))
- {
video_csc = "videoconvert";
- }
}
- if (video_csc && (strcmp(video_csc, "")))
- {
+ if (video_csc && (strcmp(video_csc, ""))) {
MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_CONV, video_csc, "video converter", TRUE, player);
LOGD("using video converter: %s", video_csc);
}
@@ -5769,7 +5178,7 @@ ERROR:
* This function is to create video pipeline.
*
* @param player [in] handle of player
- * caps [in] src caps of decoder
+ * caps [in] src caps of decoder
* surface_type [in] surface type for video rendering
*
* @return This function returns zero on success.
@@ -5800,15 +5209,12 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl
/* alloc handles */
videobin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_V_NUM);
if (!videobin)
- {
return MM_ERROR_PLAYER_NO_FREE_SPACE;
- }
player->pipeline->videobin = videobin;
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -5816,8 +5222,7 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl
/* create bin */
videobin[MMPLAYER_V_BIN].id = MMPLAYER_V_BIN;
videobin[MMPLAYER_V_BIN].gst = gst_bin_new("videobin");
- if (!videobin[MMPLAYER_V_BIN].gst)
- {
+ if (!videobin[MMPLAYER_V_BIN].gst) {
LOGE("failed to create videobin");
goto ERROR;
}
@@ -5828,35 +5233,34 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl
}
/* set video sink */
- switch (surface_type)
- {
- case MM_DISPLAY_SURFACE_OVERLAY:
- if (strlen(player->ini.videosink_element_overlay) > 0)
- videosink_element = player->ini.videosink_element_overlay;
- else
- goto ERROR;
- break;
- case MM_DISPLAY_SURFACE_EVAS:
- if (strlen(player->ini.videosink_element_evas) > 0)
- videosink_element = player->ini.videosink_element_evas;
- else
- goto ERROR;
- break;
- case MM_DISPLAY_SURFACE_NULL:
- if (strlen(player->ini.videosink_element_fake) > 0)
- videosink_element = player->ini.videosink_element_fake;
- else
- goto ERROR;
- break;
- case MM_DISPLAY_SURFACE_REMOTE:
- if (strlen(player->ini.videosink_element_fake) > 0)
- videosink_element = player->ini.videosink_element_fake;
- else
- goto ERROR;
- break;
- default:
- LOGE("unidentified surface type");
+ switch (surface_type) {
+ case MM_DISPLAY_SURFACE_OVERLAY:
+ if (strlen(player->ini.videosink_element_overlay) > 0)
+ videosink_element = player->ini.videosink_element_overlay;
+ else
goto ERROR;
+ break;
+ case MM_DISPLAY_SURFACE_EVAS:
+ if (strlen(player->ini.videosink_element_evas) > 0)
+ videosink_element = player->ini.videosink_element_evas;
+ else
+ goto ERROR;
+ break;
+ case MM_DISPLAY_SURFACE_NULL:
+ if (strlen(player->ini.videosink_element_fake) > 0)
+ videosink_element = player->ini.videosink_element_fake;
+ else
+ goto ERROR;
+ break;
+ case MM_DISPLAY_SURFACE_REMOTE:
+ if (strlen(player->ini.videosink_element_fake) > 0)
+ videosink_element = player->ini.videosink_element_fake;
+ else
+ goto ERROR;
+ break;
+ default:
+ LOGE("unidentified surface type");
+ goto ERROR;
}
LOGD("selected videosink name: %s", videosink_element);
@@ -5864,95 +5268,83 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl
/* additional setting for sink plug-in */
switch (surface_type) {
- case MM_DISPLAY_SURFACE_OVERLAY:
- {
- bool use_tbm = player->set_mode.video_zc;
- if (!use_tbm)
- {
- LOGD("selected videosink name: %s", videosink_element);
+ case MM_DISPLAY_SURFACE_OVERLAY:
+ {
+ bool use_tbm = player->set_mode.video_zc;
+ if (!use_tbm) {
+ LOGD("selected videosink name: %s", videosink_element);
- /* support shard memory with S/W codec on HawkP */
- if (strncmp(videosink_element, "waylandsink", strlen(videosink_element)) == 0)
- {
- g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst,
- "use-tbm", use_tbm, NULL);
- }
+ /* support shard memory with S/W codec on HawkP */
+ if (strncmp(videosink_element, "waylandsink", strlen(videosink_element)) == 0) {
+ g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst,
+ "use-tbm", use_tbm, NULL);
}
- else
- {
- if (attrs)
- {
- int gapless = 0;
+ } else {
+ if (attrs) {
+ int gapless = 0;
- mm_attrs_get_int_by_name(attrs, "gapless_mode", &gapless);
+ mm_attrs_get_int_by_name(attrs, "gapless_mode", &gapless);
- if (gapless > 0) {
- LOGD("disable last-sample");
- g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
- }
+ if (gapless > 0) {
+ LOGD("disable last-sample");
+ g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
}
}
- break;
- }
- case MM_DISPLAY_SURFACE_REMOTE:
- {
- if (player->set_mode.media_packet_video_stream) {
- LOGE("add data probe at videosink");
- g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
- "sync", TRUE, "signal-handoffs", TRUE, NULL);
+ }
+ break;
+ }
+ case MM_DISPLAY_SURFACE_REMOTE:
+ {
+ if (player->set_mode.media_packet_video_stream) {
+ LOGE("add data probe at videosink");
+ g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
+ "sync", TRUE, "signal-handoffs", TRUE, NULL);
- MMPLAYER_SIGNAL_CONNECT(player,
- G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
- MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
- "handoff",
- G_CALLBACK(__mmplayer_video_stream_decoded_render_cb),
- (gpointer)player);
+ MMPLAYER_SIGNAL_CONNECT(player,
+ G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
+ MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
+ "handoff",
+ G_CALLBACK(__mmplayer_video_stream_decoded_render_cb),
+ (gpointer)player);
- MMPLAYER_SIGNAL_CONNECT(player,
- G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
- MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
- "preroll-handoff",
- G_CALLBACK(__mmplayer_video_stream_decoded_preroll_cb),
- (gpointer)player);
- }
- break;
+ MMPLAYER_SIGNAL_CONNECT(player,
+ G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
+ MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
+ "preroll-handoff",
+ G_CALLBACK(__mmplayer_video_stream_decoded_preroll_cb),
+ (gpointer)player);
}
- default:
- break;
+ break;
+ }
+ default:
+ break;
}
if (_mmplayer_update_video_param(player, "update_all_param") != MM_ERROR_NONE)
goto ERROR;
- if (videobin[MMPLAYER_V_SINK].gst)
- {
+ if (videobin[MMPLAYER_V_SINK].gst) {
GstPad *sink_pad = NULL;
sink_pad = gst_element_get_static_pad(videobin[MMPLAYER_V_SINK].gst, "sink");
- if (sink_pad)
- {
+ if (sink_pad) {
MMPLAYER_SIGNAL_CONNECT(player, sink_pad, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
"notify::caps", G_CALLBACK(__mmplayer_gst_caps_notify_cb), player);
gst_object_unref(GST_OBJECT(sink_pad));
- }
- else
- {
+ } else
LOGW("failed to get sink pad from videosink\n");
- }
}
/* store it as it's sink element */
__mmplayer_add_sink(player, videobin[MMPLAYER_V_SINK].gst);
/* adding created elements to bin */
- if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(videobin[MMPLAYER_V_BIN].gst), element_bucket))
- {
+ if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(videobin[MMPLAYER_V_BIN].gst), element_bucket)) {
LOGE("failed to add elements\n");
goto ERROR;
}
/* Linking elements in the bucket by added order */
- if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
- {
+ if (__mmplayer_gst_element_link_bucket(element_bucket) == -1) {
LOGE("failed to link elements\n");
goto ERROR;
}
@@ -5960,23 +5352,20 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl
/* get first element's sinkpad for creating ghostpad */
if (element_bucket)
first_element = (MMPlayerGstElement *)element_bucket->data;
- if (!first_element)
- {
+ if (!first_element) {
LOGE("failed to get first element from bucket\n");
goto ERROR;
}
pad = gst_element_get_static_pad(GST_ELEMENT(first_element->gst), "sink");
- if (!pad)
- {
+ if (!pad) {
LOGE("failed to get pad from first element\n");
goto ERROR;
}
/* create ghostpad */
player->ghost_pad_for_videobin = gst_ghost_pad_new("sink", pad);
- if (FALSE == gst_element_add_pad(videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin))
- {
+ if (FALSE == gst_element_add_pad(videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin)) {
LOGE("failed to add ghostpad to videobin\n");
goto ERROR;
}
@@ -6002,9 +5391,7 @@ ERROR:
/* release videobin with it's childs */
if (videobin[MMPLAYER_V_BIN].gst)
- {
gst_object_unref(GST_OBJECT(videobin[MMPLAYER_V_BIN].gst));
- }
MMPLAYER_FREEIF(videobin);
@@ -6037,16 +5424,14 @@ static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "sync", TRUE, NULL);
g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "signal-handoffs", TRUE, NULL);
- if (!player->play_subtitle)
- {
+ if (!player->play_subtitle) {
LOGD("add textbin sink as sink element of whole pipeline.\n");
__mmplayer_add_sink(player, GST_ELEMENT(textbin[MMPLAYER_T_FAKE_SINK].gst));
}
/* adding created elements to bin */
LOGD("adding created elements to bin\n");
- if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(textbin[MMPLAYER_T_BIN].gst), element_bucket))
- {
+ if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(textbin[MMPLAYER_T_BIN].gst), element_bucket)) {
LOGE("failed to add elements\n");
goto ERROR;
}
@@ -6057,8 +5442,7 @@ static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
/* linking elements in the bucket by added order. */
LOGD("Linking elements in the bucket by added order.\n");
- if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
- {
+ if (__mmplayer_gst_element_link_bucket(element_bucket) == -1) {
LOGE("failed to link elements\n");
goto ERROR;
}
@@ -6066,14 +5450,12 @@ static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
/* done. free allocated variables */
g_list_free(element_bucket);
- if (textbin[MMPLAYER_T_QUEUE].gst)
- {
+ if (textbin[MMPLAYER_T_QUEUE].gst) {
GstPad *pad = NULL;
GstPad *ghostpad = NULL;
pad = gst_element_get_static_pad(GST_ELEMENT(textbin[MMPLAYER_T_QUEUE].gst), "sink");
- if (!pad)
- {
+ if (!pad) {
LOGE("failed to get video pad of textbin\n");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -6081,14 +5463,12 @@ static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
ghostpad = gst_ghost_pad_new("text_sink", pad);
gst_object_unref(pad);
- if (!ghostpad)
- {
+ if (!ghostpad) {
LOGE("failed to create ghostpad of textbin\n");
goto ERROR;
}
- if (!gst_element_add_pad(textbin[MMPLAYER_T_BIN].gst, ghostpad))
- {
+ if (!gst_element_add_pad(textbin[MMPLAYER_T_BIN].gst, ghostpad)) {
LOGE("failed to add ghostpad to textbin\n");
goto ERROR;
}
@@ -6114,8 +5494,7 @@ static int __mmplayer_gst_create_text_pipeline(mm_player_t* player)
/* alloc handles */
textbin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_T_NUM);
- if (!textbin)
- {
+ if (!textbin) {
LOGE("failed to allocate memory for textbin\n");
return MM_ERROR_PLAYER_NO_FREE_SPACE;
}
@@ -6123,8 +5502,7 @@ static int __mmplayer_gst_create_text_pipeline(mm_player_t* player)
/* create bin */
textbin[MMPLAYER_T_BIN].id = MMPLAYER_T_BIN;
textbin[MMPLAYER_T_BIN].gst = gst_bin_new("textbin");
- if (!textbin[MMPLAYER_T_BIN].gst)
- {
+ if (!textbin[MMPLAYER_T_BIN].gst) {
LOGE("failed to create textbin\n");
goto ERROR;
}
@@ -6133,8 +5511,7 @@ static int __mmplayer_gst_create_text_pipeline(mm_player_t* player)
player->pipeline->textbin = textbin;
/* fakesink */
- if (player->use_textoverlay)
- {
+ if (player->use_textoverlay) {
LOGD("use textoverlay for displaying \n");
MMPLAYER_CREATE_ELEMENT_ADD_BIN(textbin, MMPLAYER_T_QUEUE, "queue", "text_t_queue", textbin[MMPLAYER_T_BIN].gst, player);
@@ -6145,48 +5522,41 @@ static int __mmplayer_gst_create_text_pipeline(mm_player_t* player)
MMPLAYER_CREATE_ELEMENT_ADD_BIN(textbin, MMPLAYER_T_OVERLAY, "textoverlay", "text_overlay", textbin[MMPLAYER_T_BIN].gst, player);
- if (!gst_element_link_pads(textbin[MMPLAYER_T_VIDEO_QUEUE].gst, "src", textbin[MMPLAYER_T_VIDEO_CONVERTER].gst, "sink"))
- {
+ if (!gst_element_link_pads(textbin[MMPLAYER_T_VIDEO_QUEUE].gst, "src", textbin[MMPLAYER_T_VIDEO_CONVERTER].gst, "sink")) {
LOGE("failed to link queue and converter\n");
goto ERROR;
}
- if (!gst_element_link_pads(textbin[MMPLAYER_T_VIDEO_CONVERTER].gst, "src", textbin[MMPLAYER_T_OVERLAY].gst, "video_sink"))
- {
+ if (!gst_element_link_pads(textbin[MMPLAYER_T_VIDEO_CONVERTER].gst, "src", textbin[MMPLAYER_T_OVERLAY].gst, "video_sink")) {
LOGE("failed to link queue and textoverlay\n");
goto ERROR;
}
- if (!gst_element_link_pads(textbin[MMPLAYER_T_QUEUE].gst, "src", textbin[MMPLAYER_T_OVERLAY].gst, "text_sink"))
- {
+ if (!gst_element_link_pads(textbin[MMPLAYER_T_QUEUE].gst, "src", textbin[MMPLAYER_T_OVERLAY].gst, "text_sink")) {
LOGE("failed to link queue and textoverlay\n");
goto ERROR;
}
- }
- else
- {
+ } else {
int surface_type = 0;
LOGD("use subtitle message for displaying \n");
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type);
- switch (surface_type)
- {
- case MM_DISPLAY_SURFACE_OVERLAY:
- case MM_DISPLAY_SURFACE_EVAS:
- case MM_DISPLAY_SURFACE_GL:
- case MM_DISPLAY_SURFACE_NULL:
- case MM_DISPLAY_SURFACE_REMOTE:
- if (__mmplayer_gst_create_plain_text_elements(player) != MM_ERROR_NONE)
- {
- LOGE("failed to make plain text elements\n");
- goto ERROR;
- }
- break;
+ switch (surface_type) {
+ case MM_DISPLAY_SURFACE_OVERLAY:
+ case MM_DISPLAY_SURFACE_EVAS:
+ case MM_DISPLAY_SURFACE_GL:
+ case MM_DISPLAY_SURFACE_NULL:
+ case MM_DISPLAY_SURFACE_REMOTE:
+ if (__mmplayer_gst_create_plain_text_elements(player) != MM_ERROR_NONE) {
+ LOGE("failed to make plain text elements\n");
+ goto ERROR;
+ }
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -6201,30 +5571,23 @@ ERROR:
g_list_free(element_bucket);
/* release element which are not added to bin */
- for (i = 1; i < MMPLAYER_T_NUM; i++) /* NOTE : skip bin */
- {
- if (textbin[i].gst)
- {
+ for (i = 1; i < MMPLAYER_T_NUM; i++) {
+ /* NOTE : skip bin */
+ if (textbin[i].gst) {
GstObject* parent = NULL;
parent = gst_element_get_parent(textbin[i].gst);
- if (!parent)
- {
+ if (!parent) {
gst_object_unref(GST_OBJECT(textbin[i].gst));
textbin[i].gst = NULL;
- }
- else
- {
+ } else
gst_object_unref(GST_OBJECT(parent));
- }
}
}
/* release textbin with it's childs */
if (textbin[MMPLAYER_T_BIN].gst)
- {
gst_object_unref(GST_OBJECT(textbin[MMPLAYER_T_BIN].gst));
- }
MMPLAYER_FREEIF(textbin);
@@ -6241,7 +5604,7 @@ __mmplayer_gst_create_subtitle_src(mm_player_t* player)
MMHandleType attrs = 0;
GstElement *subsrc = NULL;
GstElement *subparse = NULL;
- gchar *subtitle_uri =NULL;
+ gchar *subtitle_uri = NULL;
const gchar *charset = NULL;
GstPad *pad = NULL;
@@ -6253,15 +5616,13 @@ __mmplayer_gst_create_subtitle_src(mm_player_t* player)
mainbin = player->pipeline->mainbin;
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute\n");
return MM_ERROR_PLAYER_INTERNAL;
}
mm_attrs_get_string_by_name(attrs, "subtitle_uri", &subtitle_uri);
- if (!subtitle_uri || strlen(subtitle_uri) < 1)
- {
+ if (!subtitle_uri || strlen(subtitle_uri) < 1) {
LOGE("subtitle uri is not proper filepath.\n");
return MM_ERROR_PLAYER_INVALID_URI;
}
@@ -6270,8 +5631,7 @@ __mmplayer_gst_create_subtitle_src(mm_player_t* player)
/* create the subtitle source */
subsrc = gst_element_factory_make("filesrc", "subtitle_source");
- if (!subsrc)
- {
+ if (!subsrc) {
LOGE("failed to create filesrc element\n");
goto ERROR;
}
@@ -6280,23 +5640,20 @@ __mmplayer_gst_create_subtitle_src(mm_player_t* player)
mainbin[MMPLAYER_M_SUBSRC].id = MMPLAYER_M_SUBSRC;
mainbin[MMPLAYER_M_SUBSRC].gst = subsrc;
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), subsrc))
- {
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), subsrc)) {
LOGW("failed to add queue\n");
goto ERROR;
}
/* subparse */
subparse = gst_element_factory_make("subparse", "subtitle_parser");
- if (!subparse)
- {
+ if (!subparse) {
LOGE("failed to create subparse element\n");
goto ERROR;
}
charset = util_get_charset(subtitle_uri);
- if (charset)
- {
+ if (charset) {
LOGD("detected charset is %s\n", charset);
g_object_set(G_OBJECT(subparse), "subtitle-encoding", charset, NULL);
}
@@ -6304,14 +5661,12 @@ __mmplayer_gst_create_subtitle_src(mm_player_t* player)
mainbin[MMPLAYER_M_SUBPARSE].id = MMPLAYER_M_SUBPARSE;
mainbin[MMPLAYER_M_SUBPARSE].gst = subparse;
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), subparse))
- {
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), subparse)) {
LOGW("failed to add subparse\n");
goto ERROR;
}
- if (!gst_element_link_pads(subsrc, "src", subparse, "sink"))
- {
+ if (!gst_element_link_pads(subsrc, "src", subparse, "sink")) {
LOGW("failed to link subsrc and subparse\n");
goto ERROR;
}
@@ -6321,16 +5676,13 @@ __mmplayer_gst_create_subtitle_src(mm_player_t* player)
LOGD("play subtitle using subtitle file\n");
- if (player->pipeline->textbin == NULL)
- {
- if (MM_ERROR_NONE != __mmplayer_gst_create_text_pipeline(player))
- {
+ if (player->pipeline->textbin == NULL) {
+ if (MM_ERROR_NONE != __mmplayer_gst_create_text_pipeline(player)) {
LOGE("failed to create textbin. continuing without text\n");
goto ERROR;
}
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), GST_ELEMENT(player->pipeline->textbin[MMPLAYER_T_BIN].gst)))
- {
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), GST_ELEMENT(player->pipeline->textbin[MMPLAYER_T_BIN].gst))) {
LOGW("failed to add textbin\n");
goto ERROR;
}
@@ -6340,23 +5692,19 @@ __mmplayer_gst_create_subtitle_src(mm_player_t* player)
player->textsink_linked = 1;
player->external_text_idx = 0;
LOGI("player->textsink_linked set to 1\n");
- }
- else
- {
+ } else {
LOGD("text bin has been created. reuse it.");
player->external_text_idx = 1;
}
- if (!gst_element_link_pads(subparse, "src", player->pipeline->textbin[MMPLAYER_T_BIN].gst, "text_sink"))
- {
+ if (!gst_element_link_pads(subparse, "src", player->pipeline->textbin[MMPLAYER_T_BIN].gst, "text_sink")) {
LOGW("failed to link subparse and textbin\n");
goto ERROR;
}
pad = gst_element_get_static_pad(player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst, "sink");
- if (!pad)
- {
+ if (!pad) {
LOGE("failed to get sink pad from textsink to probe data");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -6365,7 +5713,7 @@ __mmplayer_gst_create_subtitle_src(mm_player_t* player)
__mmplayer_subtitle_adjust_position_probe, player, NULL);
gst_object_unref(pad);
- pad=NULL;
+ pad = NULL;
/* create dot. for debugging */
MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-with-subtitle");
@@ -6399,14 +5747,12 @@ __mmplayer_update_subtitle(GstElement* object, GstBuffer *buffer, GstPad *pad, g
text_size = mapinfo.size;
duration = GST_BUFFER_DURATION(buffer);
- if (player->set_mode.subtitle_off)
- {
+ if (player->set_mode.subtitle_off) {
LOGD("subtitle is OFF.\n");
return TRUE;
}
- if (!text || (text_size == 0))
- {
+ if (!text || (text_size == 0)) {
LOGD("There is no subtitle to be displayed.\n");
return TRUE;
}
@@ -6435,14 +5781,12 @@ __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gp
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if (player->set_mode.subtitle_off)
- {
+ if (player->set_mode.subtitle_off) {
LOGD("subtitle is OFF.\n");
return TRUE;
}
- if (player->adjust_subtitle_pos == 0)
- {
+ if (player->adjust_subtitle_pos == 0) {
LOGD("nothing to do");
return TRUE;
}
@@ -6450,8 +5794,7 @@ __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gp
cur_timestamp = GST_BUFFER_TIMESTAMP(buffer);
adjusted_timestamp = (gint64) cur_timestamp +((gint64) player->adjust_subtitle_pos * G_GINT64_CONSTANT(1000000));
- if (adjusted_timestamp < 0)
- {
+ if (adjusted_timestamp < 0) {
LOGD("adjusted_timestamp under zero");
MMPLAYER_FLEAVE();
return FALSE;
@@ -6464,7 +5807,7 @@ __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gp
return GST_PAD_PROBE_OK;
}
-static int __gst_adjust_subtitle_position(mm_player_t* player, int format, int position)
+static int __gst_adjust_subtitle_position(mm_player_t* player, int format, int position)
{
MMPLAYER_FENTER();
@@ -6472,16 +5815,14 @@ static int __gst_adjust_subtitle_position(mm_player_t* player, int format, int
MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_RETURN_VAL_IF_FAIL(player->play_subtitle, MM_ERROR_NOT_SUPPORT_API);
- if (position == 0)
- {
+ if (position == 0) {
LOGD("nothing to do\n");
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
}
- switch (format)
- {
- case MM_PLAYER_POS_FORMAT_TIME:
+ switch (format) {
+ case MM_PLAYER_POS_FORMAT_TIME:
{
/* check current postion */
player->adjust_subtitle_pos = position;
@@ -6490,7 +5831,7 @@ static int __gst_adjust_subtitle_position(mm_player_t* player, int format, int
}
break;
- default:
+ default:
{
LOGW("invalid format.\n");
MMPLAYER_FLEAVE();
@@ -6510,31 +5851,26 @@ static int __gst_adjust_video_position(mm_player_t* player, int offset)
/* check player and videobin are created */
MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (!player->pipeline->videobin ||
- !player->pipeline->videobin[MMPLAYER_V_SINK].gst)
- {
+ !player->pipeline->videobin[MMPLAYER_V_SINK].gst) {
LOGD("no video pipeline or sink is there");
return MM_ERROR_PLAYER_INVALID_STATE ;
}
- if (offset == 0)
- {
+ if (offset == 0) {
LOGD("nothing to do\n");
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
}
- if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, (unsigned long*)&current_pos) != MM_ERROR_NONE)
- {
+ if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, (unsigned long*)&current_pos) != MM_ERROR_NONE) {
LOGD("failed to get current position");
return MM_ERROR_PLAYER_INTERNAL;
}
- if ((current_pos - offset) < GST_TIME_AS_MSECONDS(player->duration))
- {
+ if ((current_pos - offset) < GST_TIME_AS_MSECONDS(player->duration)) {
LOGD("enter video delay is valid");
- }
- else {
+ } else {
LOGD("enter video delay is crossing content boundary");
return MM_ERROR_INVALID_ARGUMENT ;
}
- g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst),"ts-offset", ((gint64) offset * G_GINT64_CONSTANT(1000000)),NULL);
+ g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "ts-offset", ((gint64) offset * G_GINT64_CONSTANT(1000000)), NULL);
LOGD("video delay has been done");
MMPLAYER_FLEAVE();
@@ -6555,17 +5891,14 @@ __gst_appsrc_feed_data_mem(GstElement *element, guint size, gpointer user_data)
buffer = gst_buffer_new();
- if (buf->offset >= buf->len)
- {
+ if (buf->offset >= buf->len) {
LOGD("call eos appsrc\n");
g_signal_emit_by_name(appsrc, "end-of-stream", &ret);
return;
}
if (buf->len - buf->offset < size)
- {
len = buf->len - buf->offset + buf->offset;
- }
gst_buffer_insert_memory(buffer, -1, gst_memory_new_wrapped(0, (guint8 *)(buf->buf + buf->offset), len, 0, len, (guint8*)(buf->buf + buf->offset), g_free));
GST_BUFFER_OFFSET(buffer) = (guint64)buf->offset;
@@ -6586,7 +5919,7 @@ __gst_appsrc_seek_data_mem(GstElement *element, guint64 size, gpointer user_data
buf->offset = (int)size;
- return TRUE;
+ return TRUE;
}
static void
@@ -6594,7 +5927,7 @@ __gst_appsrc_feed_data(GstElement *element, guint size, gpointer user_data) // @
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_DEFAULT;
- guint64 current_level_bytes=0;
+ guint64 current_level_bytes = 0;
MMPLAYER_RETURN_IF_FAIL(player);
LOGI("app-src: feed data\n");
@@ -6626,7 +5959,7 @@ __gst_appsrc_enough_data(GstElement *element, gpointer user_data) // @
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_DEFAULT;
- guint64 current_level_bytes=0;
+ guint64 current_level_bytes = 0;
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
@@ -6644,8 +5977,8 @@ int
_mmplayer_push_buffer(MMHandleType hplayer, unsigned char *buf, int size) // @
{
mm_player_t* player = (mm_player_t*)hplayer;
- GstBuffer *buffer = NULL;
- GstFlowReturn gst_ret = GST_FLOW_OK;
+ GstBuffer *buffer = NULL;
+ GstFlowReturn gst_ret = GST_FLOW_OK;
int ret = MM_ERROR_NONE;
// gint len = size;
@@ -6660,10 +5993,8 @@ _mmplayer_push_buffer(MMHandleType hplayer, unsigned char *buf, int size) // @
/* NOTE : we should check and create pipeline again if not created as we destroy
* whole pipeline when stopping in streamming playback
*/
- if (!player->pipeline)
- {
- if (MM_ERROR_NONE != __gst_realize(player))
- {
+ if (!player->pipeline) {
+ if (MM_ERROR_NONE != __gst_realize(player)) {
LOGE("failed to realize before starting. only in streamming\n");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -6671,16 +6002,14 @@ _mmplayer_push_buffer(MMHandleType hplayer, unsigned char *buf, int size) // @
LOGI("app-src: pushing data\n");
- if (buf == NULL)
- {
+ if (buf == NULL) {
LOGE("buf is null\n");
return MM_ERROR_NONE;
}
buffer = gst_buffer_new();
- if (size <= 0)
- {
+ if (size <= 0) {
LOGD("call eos appsrc\n");
g_signal_emit_by_name(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "end-of-stream", &gst_ret);
return MM_ERROR_NONE;
@@ -6702,61 +6031,56 @@ __mmplayer_bus_sync_callback(GstBus * bus, GstMessage * message, gpointer data)
mm_player_t *player = (mm_player_t *)data;
GstBusSyncReply reply = GST_BUS_DROP;
- if (!(player->pipeline && player->pipeline->mainbin))
- {
+ if (!(player->pipeline && player->pipeline->mainbin)) {
LOGE("player pipeline handle is null");
return GST_BUS_PASS;
}
- if (!__mmplayer_check_useful_message(player, message))
- {
+ if (!__mmplayer_check_useful_message(player, message)) {
gst_message_unref(message);
return GST_BUS_DROP;
}
- switch (GST_MESSAGE_TYPE(message))
- {
- case GST_MESSAGE_STATE_CHANGED:
- /* post directly for fast launch */
- if (player->sync_handler) {
- __mmplayer_gst_callback(NULL, message, player);
- reply = GST_BUS_DROP;
- }
- else {
- reply = GST_BUS_PASS;
- }
- break;
- case GST_MESSAGE_TAG:
- __mmplayer_gst_extract_tag_from_msg(player, message);
+ switch (GST_MESSAGE_TYPE(message)) {
+ case GST_MESSAGE_STATE_CHANGED:
+ /* post directly for fast launch */
+ if (player->sync_handler) {
+ __mmplayer_gst_callback(NULL, message, player);
+ reply = GST_BUS_DROP;
+ } else
+ reply = GST_BUS_PASS;
+ break;
+ case GST_MESSAGE_TAG:
+ __mmplayer_gst_extract_tag_from_msg(player, message);
- #if 0 // debug
- {
- GstTagList *tags = NULL;
+ #if 0 // debug
+ {
+ GstTagList *tags = NULL;
- gst_message_parse_tag(message, &tags);
- if (tags) {
- LOGE("TAGS received from element \"%s\".\n",
- GST_STR_NULL(GST_ELEMENT_NAME(GST_MESSAGE_SRC(message))));
+ gst_message_parse_tag(message, &tags);
+ if (tags) {
+ LOGE("TAGS received from element \"%s\".\n",
+ GST_STR_NULL(GST_ELEMENT_NAME(GST_MESSAGE_SRC(message))));
- gst_tag_list_foreach(tags, print_tag, NULL);
- gst_tag_list_free(tags);
- tags = NULL;
- }
- break;
+ gst_tag_list_foreach(tags, print_tag, NULL);
+ gst_tag_list_free(tags);
+ tags = NULL;
}
- #endif
break;
+ }
+ #endif
+ break;
- case GST_MESSAGE_DURATION_CHANGED:
- __mmplayer_gst_handle_duration(player, message);
- break;
- case GST_MESSAGE_ASYNC_DONE:
- /* NOTE:Don't call gst_callback directly
- * because previous frame can be showed even though this message is received for seek.
- */
- default:
- reply = GST_BUS_PASS;
- break;
+ case GST_MESSAGE_DURATION_CHANGED:
+ __mmplayer_gst_handle_duration(player, message);
+ break;
+ case GST_MESSAGE_ASYNC_DONE:
+ /* NOTE:Don't call gst_callback directly
+ * because previous frame can be showed even though this message is received for seek.
+ */
+ default:
+ reply = GST_BUS_PASS;
+ break;
}
if (reply == GST_BUS_DROP)
@@ -6790,8 +6114,7 @@ __mmplayer_gst_create_decoder(mm_player_t *player,
/* create decodebin */
decodebin = gst_element_factory_make("decodebin", name);
- if (!decodebin)
- {
+ if (!decodebin) {
LOGE("error : fail to create decodebin for %d decoder\n", track);
ret = FALSE;
goto ERROR;
@@ -6810,16 +6133,14 @@ __mmplayer_gst_create_decoder(mm_player_t *player,
MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "element-added",
G_CALLBACK(__mmplayer_gst_element_added), player);
- if (!gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), decodebin))
- {
+ if (!gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), decodebin)) {
LOGE("failed to add new decodebin\n");
ret = FALSE;
goto ERROR;
}
dec_caps = gst_pad_query_caps(srcpad, NULL);
- if (dec_caps)
- {
+ if (dec_caps) {
//LOGD("got pad %s:%s , dec_caps %" GST_PTR_FORMAT, GST_DEBUG_PAD_NAME(srcpad), dec_caps);
g_object_set(G_OBJECT(decodebin), "sink-caps", dec_caps, NULL);
gst_caps_unref(dec_caps);
@@ -6830,22 +6151,18 @@ __mmplayer_gst_create_decoder(mm_player_t *player,
sinkpad = gst_element_get_static_pad(decodebin, "sink");
- if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) {
LOGW("failed to link [%s:%s] to decoder\n", GST_DEBUG_PAD_NAME(srcpad));
gst_object_unref(GST_OBJECT(decodebin));
}
if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(decodebin))
- {
LOGE("failed to sync second level decodebin state with parent\n");
- }
LOGD("Total num of %d tracks = %d \n", track, player->selector[track].total_track_num);
ERROR:
- if (sinkpad)
- {
+ if (sinkpad) {
gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
@@ -6887,15 +6204,13 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
/* get profile attribute */
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute\n");
goto INIT_ERROR;
}
/* create pipeline handles */
- if (player->pipeline)
- {
+ if (player->pipeline) {
LOGW("pipeline should be released before create new one\n");
goto INIT_ERROR;
}
@@ -6917,8 +6232,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
/* create pipeline */
mainbin[MMPLAYER_M_PIPE].id = MMPLAYER_M_PIPE;
mainbin[MMPLAYER_M_PIPE].gst = gst_pipeline_new("player");
- if (!mainbin[MMPLAYER_M_PIPE].gst)
- {
+ if (!mainbin[MMPLAYER_M_PIPE].gst) {
LOGE("failed to create pipeline\n");
goto INIT_ERROR;
}
@@ -6931,18 +6245,16 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
_mmplayer_track_initialize(player);
/* create source element */
- switch (player->profile.uri_type)
- {
- /* rtsp streamming */
- case MM_PLAYER_URI_TYPE_URL_RTSP:
+ switch (player->profile.uri_type) {
+ /* rtsp streamming */
+ case MM_PLAYER_URI_TYPE_URL_RTSP:
{
gint network_bandwidth;
gchar *user_agent, *wap_profile;
element = gst_element_factory_make("rtspsrc", "rtsp source");
- if (!element)
- {
+ if (!element) {
LOGE("failed to create streaming source element\n");
break;
}
@@ -6953,7 +6265,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
/* get attribute */
mm_attrs_get_string_by_name(attrs, "streaming_user_agent", &user_agent);
- mm_attrs_get_string_by_name(attrs,"streaming_wap_profile", &wap_profile);
+ mm_attrs_get_string_by_name(attrs, "streaming_wap_profile", &wap_profile);
mm_attrs_get_int_by_name(attrs, "streaming_network_bandwidth", &network_bandwidth);
SECURE_LOGD("user_agent : %s\n", user_agent);
@@ -6975,8 +6287,8 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
}
break;
- /* http streaming*/
- case MM_PLAYER_URI_TYPE_URL_HTTP:
+ /* http streaming*/
+ case MM_PLAYER_URI_TYPE_URL_HTTP:
{
gchar *user_agent, *proxy, *cookies, **cookie_list;
gint http_timeout = DEFAULT_HTTP_TIMEOUT;
@@ -6990,11 +6302,9 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
LOGD("http playback, PD mode : %d\n", player->pd_mode);
- if (!MMPLAYER_IS_HTTP_PD(player))
- {
+ if (!MMPLAYER_IS_HTTP_PD(player)) {
element = gst_element_factory_make(player->ini.httpsrc_element, "http_streaming_source");
- if (!element)
- {
+ if (!element) {
LOGE("failed to create http streaming source element[%s].\n", player->ini.httpsrc_element);
break;
}
@@ -7007,8 +6317,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
mm_attrs_get_int_by_name(attrs, "streaming_timeout", &http_timeout);
if ((http_timeout == DEFAULT_HTTP_TIMEOUT) &&
- (player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT))
- {
+ (player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT)) {
LOGD("get timeout from ini\n");
http_timeout = player->ini.http_timeout;
}
@@ -7035,16 +6344,12 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
g_object_set(G_OBJECT(element), "user-agent", user_agent, NULL);
if (MMPLAYER_URL_HAS_DASH_SUFFIX(player))
- {
LOGW("it's dash. and it's still experimental feature.");
- }
- }
- else // progressive download
- {
+ } else {
+ // progressive download
gchar* location = NULL;
- if (player->pd_mode == MM_PLAYER_PD_MODE_URI)
- {
+ if (player->pd_mode == MM_PLAYER_PD_MODE_URI) {
gchar *path = NULL;
mm_attrs_get_string_by_name(attrs, "pd_location", &path);
@@ -7053,20 +6358,16 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
LOGD("PD Location : %s\n", path);
- if (path)
- {
+ if (path) {
player->pd_file_save_path = g_strdup(path);
- }
- else
- {
+ } else {
LOGE("can't find pd location so, it should be set \n");
break;
}
}
element = gst_element_factory_make("pdpushsrc", "PD pushsrc");
- if (!element)
- {
+ if (!element) {
LOGE("failed to create PD push source element[%s].\n", "pdpushsrc");
break;
}
@@ -7084,16 +6385,15 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
}
break;
- /* file source */
- case MM_PLAYER_URI_TYPE_FILE:
+ /* file source */
+ case MM_PLAYER_URI_TYPE_FILE:
{
LOGD("using filesrc for 'file://' handler.\n");
element = gst_element_factory_make("filesrc", "source");
- if (!element)
- {
+ if (!element) {
LOGE("failed to create filesrc\n");
break;
}
@@ -7103,12 +6403,11 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
}
break;
- case MM_PLAYER_URI_TYPE_SS:
+ case MM_PLAYER_URI_TYPE_SS:
{
gint http_timeout = DEFAULT_HTTP_TIMEOUT;
element = gst_element_factory_make("souphttpsrc", "http streaming source");
- if (!element)
- {
+ if (!element) {
LOGE("failed to create http streaming source element[%s]", player->ini.httpsrc_element);
break;
}
@@ -7116,8 +6415,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
mm_attrs_get_int_by_name(attrs, "streaming_timeout", &http_timeout);
if ((http_timeout == DEFAULT_HTTP_TIMEOUT) &&
- (player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT))
- {
+ (player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT)) {
LOGD("get timeout from ini\n");
http_timeout = player->ini.http_timeout;
}
@@ -7128,16 +6426,15 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
}
break;
- /* appsrc */
- case MM_PLAYER_URI_TYPE_BUFF:
+ /* appsrc */
+ case MM_PLAYER_URI_TYPE_BUFF:
{
guint64 stream_type = GST_APP_STREAM_TYPE_STREAM;
LOGD("mem src is selected\n");
element = gst_element_factory_make("appsrc", "buff-source");
- if (!element)
- {
+ if (!element) {
LOGE("failed to create appsrc element\n");
break;
}
@@ -7154,45 +6451,36 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
G_CALLBACK(__gst_appsrc_enough_data), player);
}
break;
- case MM_PLAYER_URI_TYPE_MS_BUFF:
+ case MM_PLAYER_URI_TYPE_MS_BUFF:
{
LOGD("MS buff src is selected\n");
- if (player->v_stream_caps)
- {
+ if (player->v_stream_caps) {
element = gst_element_factory_make("appsrc", "video_appsrc");
- if (!element)
- {
+ if (!element) {
LOGF("failed to create video app source element[appsrc].\n");
break;
}
- if (player->a_stream_caps)
- {
+ if (player->a_stream_caps) {
elem_src_audio = gst_element_factory_make("appsrc", "audio_appsrc");
- if (!elem_src_audio)
- {
+ if (!elem_src_audio) {
LOGF("failed to create audio app source element[appsrc].\n");
break;
}
}
- }
- else if (player->a_stream_caps)
- {
+ } else if (player->a_stream_caps) {
/* no video, only audio pipeline*/
element = gst_element_factory_make("appsrc", "audio_appsrc");
- if (!element)
- {
+ if (!element) {
LOGF("failed to create audio app source element[appsrc].\n");
break;
}
}
- if (player->s_stream_caps)
- {
+ if (player->s_stream_caps) {
elem_src_subtitle = gst_element_factory_make("appsrc", "subtitle_appsrc");
- if (!elem_src_subtitle)
- {
+ if (!elem_src_subtitle) {
LOGF("failed to create subtitle app source element[appsrc].\n");
break;
}
@@ -7201,8 +6489,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
LOGD("setting app sources properties.\n");
LOGD("location : %s\n", player->profile.uri);
- if (player->v_stream_caps && element)
- {
+ if (player->v_stream_caps && element) {
g_object_set(G_OBJECT(element), "format", GST_FORMAT_TIME,
"blocksize", (guint)1048576, /* size of many video frames are larger than default blocksize as 4096 */
"caps", player->v_stream_caps, NULL);
@@ -7217,8 +6504,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
G_CALLBACK(__gst_seek_video_data), player);
- if (player->a_stream_caps && elem_src_audio)
- {
+ if (player->a_stream_caps && elem_src_audio) {
g_object_set(G_OBJECT(elem_src_audio), "format", GST_FORMAT_TIME,
"caps", player->a_stream_caps, NULL);
@@ -7232,9 +6518,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
MMPLAYER_SIGNAL_CONNECT(player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
G_CALLBACK(__gst_seek_audio_data), player);
}
- }
- else if (player->a_stream_caps && element)
- {
+ } else if (player->a_stream_caps && element) {
g_object_set(G_OBJECT(element), "format", GST_FORMAT_TIME,
"caps", player->a_stream_caps, NULL);
@@ -7249,8 +6533,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
G_CALLBACK(__gst_seek_audio_data), player);
}
- if (player->s_stream_caps && elem_src_subtitle)
- {
+ if (player->s_stream_caps && elem_src_subtitle) {
g_object_set(G_OBJECT(elem_src_subtitle), "format", GST_FORMAT_TIME,
"caps", player->s_stream_caps, NULL);
@@ -7265,23 +6548,19 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
G_CALLBACK(__gst_seek_subtitle_data), player);
}
- if (player->v_stream_caps && element)
- {
+ if (player->v_stream_caps && element) {
MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_video_data), player);
MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
G_CALLBACK(__gst_appsrc_enough_video_data), player);
- if (player->a_stream_caps && elem_src_audio)
- {
+ if (player->a_stream_caps && elem_src_audio) {
MMPLAYER_SIGNAL_CONNECT(player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_audio_data), player);
MMPLAYER_SIGNAL_CONNECT(player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
G_CALLBACK(__gst_appsrc_enough_audio_data), player);
}
- }
- else if (player->a_stream_caps && element)
- {
+ } else if (player->a_stream_caps && element) {
MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_audio_data), player);
MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
@@ -7289,10 +6568,8 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
}
if (player->s_stream_caps && elem_src_subtitle)
- {
MMPLAYER_SIGNAL_CONNECT(player, elem_src_subtitle, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_subtitle_data), player);
- }
need_state_holder = FALSE;
@@ -7301,16 +6578,15 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
LOGE("failed to commit\n");
}
break;
- /* appsrc */
- case MM_PLAYER_URI_TYPE_MEM:
+ /* appsrc */
+ case MM_PLAYER_URI_TYPE_MEM:
{
guint64 stream_type = GST_APP_STREAM_TYPE_RANDOM_ACCESS;
LOGD("mem src is selected\n");
element = gst_element_factory_make("appsrc", "mem-source");
- if (!element)
- {
+ if (!element) {
LOGE("failed to create appsrc element\n");
break;
}
@@ -7325,20 +6601,19 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
G_CALLBACK(__gst_appsrc_feed_data_mem), &player->mem_buf);
}
break;
- case MM_PLAYER_URI_TYPE_URL:
+ case MM_PLAYER_URI_TYPE_URL:
break;
- case MM_PLAYER_URI_TYPE_TEMP:
+ case MM_PLAYER_URI_TYPE_TEMP:
break;
- case MM_PLAYER_URI_TYPE_NONE:
- default:
+ case MM_PLAYER_URI_TYPE_NONE:
+ default:
break;
}
/* check source element is OK */
- if (!element)
- {
+ if (!element) {
LOGE("no source element was created.\n");
goto INIT_ERROR;
}
@@ -7348,20 +6623,17 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
mainbin[MMPLAYER_M_SRC].gst = element;
element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_SRC]);
- if ((MMPLAYER_IS_STREAMING(player)) && (player->streamer == NULL))
- {
+ if ((MMPLAYER_IS_STREAMING(player)) && (player->streamer == NULL)) {
player->streamer = __mm_player_streaming_create();
__mm_player_streaming_initialize(player->streamer);
}
- if (MMPLAYER_IS_HTTP_PD(player))
- {
+ if (MMPLAYER_IS_HTTP_PD(player)) {
gdouble pre_buffering_time = (gdouble)player->streamer->buffering_req.initial_second;
LOGD("Picked queue2 element(pre buffer : %d sec)....\n", pre_buffering_time);
element = gst_element_factory_make("queue2", "queue2");
- if (!element)
- {
+ if (!element) {
LOGE("failed to create http streaming buffer element\n");
goto INIT_ERROR;
}
@@ -7371,7 +6643,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst = element;
element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_MUXED_S_BUFFER]);
- pre_buffering_time = (pre_buffering_time > 0)?(pre_buffering_time):(player->ini.http_buffering_time);
+ pre_buffering_time = (pre_buffering_time > 0) ? (pre_buffering_time) : (player->ini.http_buffering_time);
__mm_player_streaming_set_queue2(player->streamer,
element,
@@ -7384,13 +6656,10 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
NULL,
0);
}
- if (MMPLAYER_IS_MS_BUFF_SRC(player))
- {
- if (player->v_stream_caps)
- {
+ if (MMPLAYER_IS_MS_BUFF_SRC(player)) {
+ if (player->v_stream_caps) {
es_video_queue = gst_element_factory_make("queue2", "video_queue");
- if (!es_video_queue)
- {
+ if (!es_video_queue) {
LOGE("create es_video_queue for es player failed\n");
goto INIT_ERROR;
}
@@ -7400,15 +6669,13 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_V_BUFFER]);
/* Adding audio appsrc to bucket */
- if (player->a_stream_caps && elem_src_audio)
- {
+ if (player->a_stream_caps && elem_src_audio) {
mainbin[MMPLAYER_M_2ND_SRC].id = MMPLAYER_M_2ND_SRC;
mainbin[MMPLAYER_M_2ND_SRC].gst = elem_src_audio;
element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_2ND_SRC]);
es_audio_queue = gst_element_factory_make("queue2", "audio_queue");
- if (!es_audio_queue)
- {
+ if (!es_audio_queue) {
LOGE("create es_audio_queue for es player failed\n");
goto INIT_ERROR;
}
@@ -7418,13 +6685,10 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
mainbin[MMPLAYER_M_A_BUFFER].gst = es_audio_queue;
element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_A_BUFFER]);
}
- }
- /* Only audio stream, no video */
- else if (player->a_stream_caps)
- {
+ } else if (player->a_stream_caps) {
+ /* Only audio stream, no video */
es_audio_queue = gst_element_factory_make("queue2", "audio_queue");
- if (!es_audio_queue)
- {
+ if (!es_audio_queue) {
LOGE("create es_audio_queue for es player failed\n");
goto INIT_ERROR;
}
@@ -7433,15 +6697,13 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_A_BUFFER]);
}
- if (player->s_stream_caps && elem_src_subtitle)
- {
+ if (player->s_stream_caps && elem_src_subtitle) {
mainbin[MMPLAYER_M_SUBSRC].id = MMPLAYER_M_SUBSRC;
mainbin[MMPLAYER_M_SUBSRC].gst = elem_src_subtitle;
element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_SUBSRC]);
es_subtitle_queue = gst_element_factory_make("queue2", "subtitle_queue");
- if (!es_subtitle_queue)
- {
+ if (!es_subtitle_queue) {
LOGE("create es_subtitle_queue for es player failed\n");
goto INIT_ERROR;
}
@@ -7454,21 +6716,17 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
/* create autoplugging element if src element is not a rtsp src */
if ((player->profile.uri_type != MM_PLAYER_URI_TYPE_URL_RTSP) &&
(player->profile.uri_type != MM_PLAYER_URI_TYPE_URL_WFD) &&
- (player->profile.uri_type != MM_PLAYER_URI_TYPE_MS_BUFF))
- {
+ (player->profile.uri_type != MM_PLAYER_URI_TYPE_MS_BUFF)) {
element = NULL;
enum MainElementID elemId = MMPLAYER_M_NUM;
if ((player->use_decodebin) &&
((MMPLAYER_IS_HTTP_PD(player)) ||
- (!MMPLAYER_IS_HTTP_STREAMING(player))))
- {
+ (!MMPLAYER_IS_HTTP_STREAMING(player)))) {
elemId = MMPLAYER_M_AUTOPLUG;
element = __mmplayer_create_decodebin(player);
need_state_holder = FALSE;
- }
- else
- {
+ } else {
elemId = MMPLAYER_M_TYPEFIND;
element = gst_element_factory_make("typefind", "typefinder");
MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "have-type",
@@ -7477,8 +6735,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
/* check autoplug element is OK */
- if (!element)
- {
+ if (!element) {
LOGE("can not create element(%d)\n", elemId);
goto INIT_ERROR;
}
@@ -7490,30 +6747,26 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
}
/* add elements to pipeline */
- if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element_bucket))
- {
+ if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element_bucket)) {
LOGE("Failed to add elements to pipeline\n");
goto INIT_ERROR;
}
/* linking elements in the bucket by added order. */
- if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
- {
+ if (__mmplayer_gst_element_link_bucket(element_bucket) == -1) {
LOGE("Failed to link some elements\n");
goto INIT_ERROR;
}
/* create fakesink element for keeping the pipeline state PAUSED. if needed */
- if (need_state_holder)
- {
+ if (need_state_holder) {
/* create */
mainbin[MMPLAYER_M_SRC_FAKESINK].id = MMPLAYER_M_SRC_FAKESINK;
mainbin[MMPLAYER_M_SRC_FAKESINK].gst = gst_element_factory_make("fakesink", "state-holder");
- if (!mainbin[MMPLAYER_M_SRC_FAKESINK].gst)
- {
+ if (!mainbin[MMPLAYER_M_SRC_FAKESINK].gst) {
LOGE("fakesink element could not be created\n");
goto INIT_ERROR;
}
@@ -7524,8 +6777,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
/* add */
if (FALSE == gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst),
- mainbin[MMPLAYER_M_SRC_FAKESINK].gst))
- {
+ mainbin[MMPLAYER_M_SRC_FAKESINK].gst)) {
LOGE("failed to add fakesink to bin\n");
goto INIT_ERROR;
}
@@ -7534,15 +6786,12 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
/* now we have completed mainbin. take it */
player->pipeline->mainbin = mainbin;
- if (MMPLAYER_IS_MS_BUFF_SRC(player))
- {
+ if (MMPLAYER_IS_MS_BUFF_SRC(player)) {
GstPad *srcpad = NULL;
- if (mainbin[MMPLAYER_M_V_BUFFER].gst)
- {
+ if (mainbin[MMPLAYER_M_V_BUFFER].gst) {
srcpad = gst_element_get_static_pad(mainbin[MMPLAYER_M_V_BUFFER].gst, "src");
- if (srcpad)
- {
+ if (srcpad) {
__mmplayer_gst_create_decoder(player,
MM_PLAYER_TRACK_TYPE_VIDEO,
srcpad,
@@ -7554,11 +6803,9 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
}
}
- if ((player->a_stream_caps) && (mainbin[MMPLAYER_M_A_BUFFER].gst))
- {
+ if ((player->a_stream_caps) && (mainbin[MMPLAYER_M_A_BUFFER].gst)) {
srcpad = gst_element_get_static_pad(mainbin[MMPLAYER_M_A_BUFFER].gst, "src");
- if (srcpad)
- {
+ if (srcpad) {
__mmplayer_gst_create_decoder(player,
MM_PLAYER_TRACK_TYPE_AUDIO,
srcpad,
@@ -7571,15 +6818,12 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
} // else error
if (mainbin[MMPLAYER_M_S_BUFFER].gst)
- {
__mmplayer_try_to_plug_decodebin(player, gst_element_get_static_pad(mainbin[MMPLAYER_M_S_BUFFER].gst, "src"), player->s_stream_caps);
- }
}
/* connect bus callback */
bus = gst_pipeline_get_bus(GST_PIPELINE(mainbin[MMPLAYER_M_PIPE].gst));
- if (!bus)
- {
+ if (!bus) {
LOGE("cannot get bus from pipeline.\n");
goto INIT_ERROR;
}
@@ -7588,16 +6832,14 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
player->context.thread_default = g_main_context_get_thread_default();
- if (NULL == player->context.thread_default)
- {
+ if (NULL == player->context.thread_default) {
player->context.thread_default = g_main_context_default();
LOGD("thread-default context is the global default context");
}
LOGW("bus watcher thread context = %p, watcher : %d", player->context.thread_default, player->bus_watcher);
/* Note : check whether subtitle atrribute uri is set. If uri is set, then try to play subtitle file */
- if (__mmplayer_check_subtitle(player))
- {
+ if (__mmplayer_check_subtitle(player)) {
if (MM_ERROR_NONE != __mmplayer_gst_create_subtitle_src(player))
LOGE("fail to create subtitle src\n");
}
@@ -7618,33 +6860,25 @@ INIT_ERROR:
__mmplayer_gst_destroy_pipeline(player);
g_list_free(element_bucket);
- if (mainbin)
- {
+ if (mainbin) {
/* release element which are not added to bin */
- for (i = 1; i < MMPLAYER_M_NUM; i++) /* NOTE : skip pipeline */
- {
- if (mainbin[i].gst)
- {
+ for (i = 1; i < MMPLAYER_M_NUM; i++) {
+ /* NOTE : skip pipeline */
+ if (mainbin[i].gst) {
GstObject* parent = NULL;
parent = gst_element_get_parent(mainbin[i].gst);
- if (!parent)
- {
+ if (!parent) {
gst_object_unref(GST_OBJECT(mainbin[i].gst));
mainbin[i].gst = NULL;
- }
- else
- {
+ } else
gst_object_unref(GST_OBJECT(parent));
- }
}
}
/* release pipeline with it's childs */
if (mainbin[MMPLAYER_M_PIPE].gst)
- {
gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_PIPE].gst));
- }
MMPLAYER_FREEIF(mainbin);
}
@@ -7692,8 +6926,7 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player) // @
player->video_hub_download_mode = 0;
__mmplayer_reset_gapless_state(player);
- if (player->streamer)
- {
+ if (player->streamer) {
__mm_player_streaming_deinitialize(player->streamer);
__mm_player_streaming_destroy(player->streamer);
player->streamer = NULL;
@@ -7708,8 +6941,7 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player) // @
__mmplayer_cancel_eos_timer(player);
/* cleanup gst stuffs */
- if (player->pipeline)
- {
+ if (player->pipeline) {
MMPlayerGstElement* mainbin = player->pipeline->mainbin;
GstTagList* tag_list = player->pipeline->tag_list;
@@ -7721,8 +6953,7 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player) // @
__mmplayer_remove_g_source_from_context(player->context.thread_default, player->bus_watcher);
player->bus_watcher = 0;
- if (mainbin)
- {
+ if (mainbin) {
MMPlayerGstElement* audiobin = player->pipeline->audiobin;
MMPlayerGstElement* videobin = player->pipeline->videobin;
MMPlayerGstElement* textbin = player->pipeline->textbin;
@@ -7732,8 +6963,7 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player) // @
timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
ret = __mmplayer_gst_set_state(player, mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_NULL, FALSE, timeout);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("fail to change state to NULL\n");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -7763,19 +6993,16 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player) // @
}
MMPLAYER_FREEIF(player->album_art);
- if (player->v_stream_caps)
- {
+ if (player->v_stream_caps) {
gst_caps_unref(player->v_stream_caps);
player->v_stream_caps = NULL;
}
- if (player->a_stream_caps)
- {
+ if (player->a_stream_caps) {
gst_caps_unref(player->a_stream_caps);
player->a_stream_caps = NULL;
}
- if (player->s_stream_caps)
- {
+ if (player->s_stream_caps) {
gst_caps_unref(player->s_stream_caps);
player->s_stream_caps = NULL;
}
@@ -7809,8 +7036,7 @@ static int __gst_realize(mm_player_t* player) // @
MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_READY;
ret = __mmplayer_gst_create_pipeline(player);
- if (ret)
- {
+ if (ret) {
LOGE("failed to create pipeline\n");
return ret;
}
@@ -7821,16 +7047,12 @@ static int __gst_realize(mm_player_t* player) // @
ret = __mmplayer_gst_set_state(player,
player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_READY, FALSE, timeout);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
/* return error if failed to set state */
LOGE("failed to set READY state");
return ret;
- }
- else
- {
+ } else
MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_READY);
- }
/* create dot before error-return. for debugging */
MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-realize");
@@ -7856,8 +7078,7 @@ static int __gst_unrealize(mm_player_t* player) // @
/* destroy pipeline */
ret = __mmplayer_gst_destroy_pipeline(player);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to destory pipeline\n");
return ret;
}
@@ -7882,8 +7103,7 @@ static int __gst_pending_seek(mm_player_t* player)
MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (!player->pending_seek.is_pending)
- {
+ if (!player->pending_seek.is_pending) {
LOGD("pending seek is not reserved. nothing to do.\n");
return ret;
}
@@ -7891,8 +7111,7 @@ static int __gst_pending_seek(mm_player_t* player)
/* check player state if player could pending seek or not. */
current_state = MMPLAYER_CURRENT_STATE(player);
- if (current_state != MM_PLAYER_STATE_PAUSED && current_state != MM_PLAYER_STATE_PLAYING )
- {
+ if (current_state != MM_PLAYER_STATE_PAUSED && current_state != MM_PLAYER_STATE_PLAYING) {
LOGW("try to pending seek in %s state, try next time. \n",
MMPLAYER_STATE_GET_NAME(current_state));
return ret;
@@ -7928,35 +7147,27 @@ static int __gst_start(mm_player_t* player) // @
/* NOTE : if SetPosition was called before Start. do it now */
/* streaming doesn't support it. so it should be always sync */
/* !!create one more api to check if there is pending seek rather than checking variables */
- if ((player->pending_seek.is_pending || sound_extraction) && !MMPLAYER_IS_STREAMING(player))
- {
+ if ((player->pending_seek.is_pending || sound_extraction) && !MMPLAYER_IS_STREAMING(player)) {
MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PAUSED;
ret = __gst_pause(player, FALSE);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to set state to PAUSED for pending seek\n");
return ret;
}
MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PLAYING;
- if (sound_extraction)
- {
+ if (sound_extraction) {
LOGD("setting pcm extraction\n");
ret = __mmplayer_set_pcm_extraction(player);
- if (MM_ERROR_NONE != ret)
- {
+ if (MM_ERROR_NONE != ret) {
LOGW("failed to set pcm extraction\n");
return ret;
}
- }
- else
- {
+ } else {
if (MM_ERROR_NONE != __gst_pending_seek(player))
- {
LOGW("failed to seek pending postion. starting from the begin of content.\n");
- }
}
}
@@ -7966,19 +7177,14 @@ static int __gst_start(mm_player_t* player) // @
/* set pipeline state to PLAYING */
if (player->es_player_push_mode)
- {
async = TRUE;
- }
/* set pipeline state to PLAYING */
ret = __mmplayer_gst_set_state(player,
player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
- if (ret == MM_ERROR_NONE)
- {
+ if (ret == MM_ERROR_NONE) {
MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
- }
- else
- {
+ } else {
LOGE("failed to set state to PLAYING");
return ret;
}
@@ -8042,8 +7248,7 @@ static int __gst_stop(mm_player_t* player) // @
MMPLAYER_PRINT_STATE(player);
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute\n");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -8058,24 +7263,18 @@ static int __gst_stop(mm_player_t* player) // @
timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
if (player->profile.uri_type == MM_PLAYER_URI_TYPE_BUFF ||
- player->profile.uri_type == MM_PLAYER_URI_TYPE_HLS)
- {
+ player->profile.uri_type == MM_PLAYER_URI_TYPE_HLS) {
state = GST_STATE_READY;
- }
- else
- {
+ } else {
state = GST_STATE_PAUSED;
if (!MMPLAYER_IS_STREAMING(player) ||
- (player->streaming_type == STREAMING_SERVICE_VOD && player->videodec_linked)) {
+ (player->streaming_type == STREAMING_SERVICE_VOD && player->videodec_linked))
rewind = TRUE;
- }
}
if (player->es_player_push_mode)
- {
async = TRUE;
- }
/* set gst state */
ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, state, async, timeout);
@@ -8084,19 +7283,16 @@ static int __gst_stop(mm_player_t* player) // @
__mmplayer_undo_sound_fadedown(player);
/* return if set_state has failed */
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to set state.\n");
return ret;
}
/* rewind */
- if (rewind)
- {
+ if (rewind) {
if (!__gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0,
- GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
- {
+ GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) {
LOGW("failed to rewind\n");
ret = MM_ERROR_PLAYER_SEEK;
}
@@ -8106,18 +7302,13 @@ static int __gst_stop(mm_player_t* player) // @
player->sent_bos = FALSE;
if (player->es_player_push_mode) //for cloudgame
- {
timeout = 0;
- }
/* wait for seek to complete */
change_ret = gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, NULL, NULL, timeout * GST_SECOND);
- if (change_ret == GST_STATE_CHANGE_SUCCESS || change_ret == GST_STATE_CHANGE_NO_PREROLL)
- {
+ if (change_ret == GST_STATE_CHANGE_SUCCESS || change_ret == GST_STATE_CHANGE_NO_PREROLL) {
MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_READY);
- }
- else
- {
+ } else {
LOGE("fail to stop player.\n");
ret = MM_ERROR_PLAYER_INTERNAL;
__mmplayer_dump_pipeline_state(player);
@@ -8152,10 +7343,8 @@ int __gst_pause(mm_player_t* player, gboolean async) // @
player->ignore_asyncdone = FALSE;
- if (FALSE == async)
- {
- if (ret != MM_ERROR_NONE)
- {
+ if (FALSE == async) {
+ if (ret != MM_ERROR_NONE) {
GstMessage *msg = NULL;
GTimer *timer = NULL;
gdouble MAX_TIMEOUT_SEC = 3;
@@ -8168,46 +7357,32 @@ int __gst_pause(mm_player_t* player, gboolean async) // @
GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
gboolean got_msg = FALSE;
/* check if gst error posted or not */
- do
- {
- msg = gst_bus_timed_pop(bus, GST_SECOND /2);
- if (msg)
- {
- if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR)
- {
+ do {
+ msg = gst_bus_timed_pop(bus, GST_SECOND / 2);
+ if (msg) {
+ if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR) {
GError *error = NULL;
/* parse error code */
gst_message_parse_error(msg, &error, NULL);
- if (gst_structure_has_name(gst_message_get_structure(msg), "streaming_error"))
- {
+ if (gst_structure_has_name(gst_message_get_structure(msg), "streaming_error")) {
/* Note : the streaming error from the streaming source is handled
* using __mmplayer_handle_streaming_error.
*/
__mmplayer_handle_streaming_error(player, msg);
- }
- else if (error)
- {
+ } else if (error) {
LOGE("paring error posted from bus, domain : %s, code : %d", g_quark_to_string(error->domain), error->code);
if (error->domain == GST_STREAM_ERROR)
- {
ret = __gst_handle_stream_error(player, error, msg);
- }
else if (error->domain == GST_RESOURCE_ERROR)
- {
ret = __gst_handle_resource_error(player, error->code);
- }
else if (error->domain == GST_LIBRARY_ERROR)
- {
ret = __gst_handle_library_error(player, error->code);
- }
else if (error->domain == GST_CORE_ERROR)
- {
ret = __gst_handle_core_error(player, error->code);
- }
}
got_msg = TRUE;
@@ -8222,17 +7397,12 @@ int __gst_pause(mm_player_t* player, gboolean async) // @
g_timer_destroy(timer);
return ret;
- }
- else if (!player->video_stream_cb && (!player->pipeline->videobin) && (!player->pipeline->audiobin))
- {
+ } else if (!player->video_stream_cb && (!player->pipeline->videobin) && (!player->pipeline->audiobin)) {
if (MMPLAYER_IS_RTSP_STREAMING(player))
return ret;
return MM_ERROR_PLAYER_CODEC_NOT_FOUND;
- }
- else if (ret== MM_ERROR_NONE)
- {
+ } else if (ret == MM_ERROR_NONE)
MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PAUSED);
- }
}
/* generate dot file before returning error */
@@ -8268,15 +7438,11 @@ int __gst_resume(mm_player_t* player, gboolean async) // @
ret = __mmplayer_gst_set_state(player,
player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, timeout);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to set state to PLAYING\n");
return ret;
- }
- else
- {
- if (async == FALSE)
- {
+ } else {
+ if (async == FALSE) {
// MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
LOGD("update state machine to %d\n", MM_PLAYER_STATE_PLAYING);
ret = __mmplayer_set_state(player, MM_PLAYER_STATE_PLAYING);
@@ -8309,27 +7475,20 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo
&& MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED)
goto PENDING;
- if (!MMPLAYER_IS_MS_BUFF_SRC(player))
- {
+ if (!MMPLAYER_IS_MS_BUFF_SRC(player)) {
/* check duration */
/* NOTE : duration cannot be zero except live streaming.
- * Since some element could have some timing problemn with quering duration, try again.
+ * Since some element could have some timing problemn with quering duration, try again.
*/
- if (!player->duration)
- {
+ if (!player->duration) {
if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec))
- {
goto SEEK_ERROR;
- }
player->duration = dur_nsec;
}
- if (player->duration)
- {
+ if (player->duration) {
dur_msec = GST_TIME_AS_MSECONDS(player->duration);
- }
- else
- {
+ } else {
LOGE("could not get the duration. fail to seek.\n");
goto SEEK_ERROR;
}
@@ -8338,99 +7497,86 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo
mm_attrs_get_int_by_name(player->attrs, "accurate_seek", &accurated);
if (accurated)
- {
seek_flags |= GST_SEEK_FLAG_ACCURATE;
- }
else
- {
seek_flags |= GST_SEEK_FLAG_KEY_UNIT;
- }
/* do seek */
- switch (format)
+ switch (format) {
+ case MM_PLAYER_POS_FORMAT_TIME:
{
- case MM_PLAYER_POS_FORMAT_TIME:
- {
- if (!MMPLAYER_IS_MS_BUFF_SRC(player))
- {
- /* check position is valid or not */
- if (position > dur_msec)
- goto INVALID_ARGS;
+ if (!MMPLAYER_IS_MS_BUFF_SRC(player)) {
+ /* check position is valid or not */
+ if (position > dur_msec)
+ goto INVALID_ARGS;
- LOGD("seeking to(%lu) msec, duration is %d msec\n", position, dur_msec);
+ LOGD("seeking to(%lu) msec, duration is %d msec\n", position, dur_msec);
- if (player->doing_seek)
- {
- LOGD("not completed seek");
- return MM_ERROR_PLAYER_DOING_SEEK;
- }
+ if (player->doing_seek) {
+ LOGD("not completed seek");
+ return MM_ERROR_PLAYER_DOING_SEEK;
}
+ }
- if (!internal_called)
- player->doing_seek = TRUE;
+ if (!internal_called)
+ player->doing_seek = TRUE;
- pos_nsec = position * G_GINT64_CONSTANT(1000000);
+ pos_nsec = position * G_GINT64_CONSTANT(1000000);
- if ((MMPLAYER_IS_HTTP_STREAMING(player)) && (!player->videodec_linked))
- {
- gint64 cur_time = 0;
-
- /* get current position */
- gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &cur_time);
-
- /* flush */
- GstEvent *event = gst_event_new_seek(1.0,
- GST_FORMAT_TIME,
- (GstSeekFlags)GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_SET, cur_time,
- GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- if (event) {
- __gst_send_event_to_sink(player, event);
- }
+ if ((MMPLAYER_IS_HTTP_STREAMING(player)) && (!player->videodec_linked)) {
+ gint64 cur_time = 0;
- __gst_pause(player, FALSE);
- }
+ /* get current position */
+ gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &cur_time);
- ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
- GST_FORMAT_TIME, seek_flags,
- GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- if (!ret )
- {
- LOGE("failed to set position. dur[%lu] pos[%lu] pos_msec[%llu]\n", dur_msec, position, pos_nsec);
- goto SEEK_ERROR;
- }
- }
- break;
+ /* flush */
+ GstEvent *event = gst_event_new_seek(1.0,
+ GST_FORMAT_TIME,
+ (GstSeekFlags)GST_SEEK_FLAG_FLUSH,
+ GST_SEEK_TYPE_SET, cur_time,
+ GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ if (event)
+ __gst_send_event_to_sink(player, event);
- case MM_PLAYER_POS_FORMAT_PERCENT:
- {
- LOGD("seeking to(%lu)%% \n", position);
+ __gst_pause(player, FALSE);
+ }
- if (player->doing_seek)
- {
- LOGD("not completed seek");
- return MM_ERROR_PLAYER_DOING_SEEK;
- }
+ ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
+ GST_FORMAT_TIME, seek_flags,
+ GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ if (!ret) {
+ LOGE("failed to set position. dur[%lu] pos[%lu] pos_msec[%llu]\n", dur_msec, position, pos_nsec);
+ goto SEEK_ERROR;
+ }
+ }
+ break;
- if (!internal_called)
- player->doing_seek = TRUE;
+ case MM_PLAYER_POS_FORMAT_PERCENT:
+ {
+ LOGD("seeking to(%lu)%% \n", position);
- /* FIXIT : why don't we use 'GST_FORMAT_PERCENT' */
- pos_nsec = (gint64)((position * player->duration) / 100);
- ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
- GST_FORMAT_TIME, seek_flags,
- GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- if (!ret )
- {
- LOGE("failed to set position. dur[%lud] pos[%lud] pos_msec[%"G_GUINT64_FORMAT"]\n", dur_msec, position, pos_nsec);
- goto SEEK_ERROR;
- }
+ if (player->doing_seek) {
+ LOGD("not completed seek");
+ return MM_ERROR_PLAYER_DOING_SEEK;
}
- break;
- default:
- goto INVALID_ARGS;
+ if (!internal_called)
+ player->doing_seek = TRUE;
+
+ /* FIXIT : why don't we use 'GST_FORMAT_PERCENT' */
+ pos_nsec = (gint64)((position * player->duration) / 100);
+ ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
+ GST_FORMAT_TIME, seek_flags,
+ GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ if (!ret) {
+ LOGE("failed to set position. dur[%lud] pos[%lud] pos_msec[%"G_GUINT64_FORMAT"]\n", dur_msec, position, pos_nsec);
+ goto SEEK_ERROR;
+ }
+ }
+ break;
+ default:
+ goto INVALID_ARGS;
}
/* NOTE : store last seeking point to overcome some bad operation
@@ -8482,18 +7628,15 @@ __gst_get_position(mm_player_t* player, int format, unsigned long* position) //
* please refer to below comments in details
*/
if (current_state != MM_PLAYER_STATE_PAUSED)
- {
ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec);
- }
/* NOTE : get last point to overcome some bad operation of some elements
*(returning zero when getting current position in paused state
* and when failed to get postion during seeking
*/
if ((current_state == MM_PLAYER_STATE_PAUSED)
- || (!ret))
+ || (!ret)) {
//|| (player->last_position != 0 && pos_msec == 0))
- {
LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_msec), ret, current_state);
if (player->playback_rate < 0.0)
@@ -8508,59 +7651,51 @@ __gst_get_position(mm_player_t* player, int format, unsigned long* position) //
LOGD("returning last point : %"GST_TIME_FORMAT, GST_TIME_ARGS(pos_msec));
- }
- else
- {
- if (player->duration > 0 && pos_msec > player->duration) {
+ } else {
+ if (player->duration > 0 && pos_msec > player->duration)
pos_msec = player->duration;
- }
if (player->sound_focus.keep_last_pos) {
LOGD("return last pos as stop by asm, %"GST_TIME_FORMAT, GST_TIME_ARGS(player->last_position));
pos_msec = player->last_position;
- }
- else {
+ } else
player->last_position = pos_msec;
- }
}
switch (format) {
- case MM_PLAYER_POS_FORMAT_TIME:
- *position = GST_TIME_AS_MSECONDS(pos_msec);
- break;
+ case MM_PLAYER_POS_FORMAT_TIME:
+ *position = GST_TIME_AS_MSECONDS(pos_msec);
+ break;
- case MM_PLAYER_POS_FORMAT_PERCENT:
- {
- gint64 dur = 0;
- gint64 pos = 0;
+ case MM_PLAYER_POS_FORMAT_PERCENT:
+ {
+ gint64 dur = 0;
+ gint64 pos = 0;
- dur = player->duration / GST_SECOND;
- if (dur <= 0)
- {
- LOGD("duration is [%d], so returning position 0\n",dur);
- *position = 0;
- }
- else
- {
- pos = pos_msec / GST_SECOND;
- *position = pos * 100 / dur;
- }
- break;
+ dur = player->duration / GST_SECOND;
+ if (dur <= 0) {
+ LOGD("duration is [%d], so returning position 0\n", dur);
+ *position = 0;
+ } else {
+ pos = pos_msec / GST_SECOND;
+ *position = pos * 100 / dur;
}
- default:
- return MM_ERROR_PLAYER_INTERNAL;
+ break;
+ }
+ default:
+ return MM_ERROR_PLAYER_INTERNAL;
}
return MM_ERROR_NONE;
}
-static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned long* start_pos, unsigned long* stop_pos)
+static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned long* start_pos, unsigned long* stop_pos)
{
#define STREAMING_IS_FINISHED 0
#define BUFFERING_MAX_PER 100
#define DEFAULT_PER_VALUE -1
-#define CHECK_PERCENT_VALUE(a,min,max)(((a)>(min))?(((a)<(max))?(a):(max)):(min))
+#define CHECK_PERCENT_VALUE(a, min, max)(((a) > (min)) ? (((a) < (max)) ? (a) : (max)) : (min))
MMPlayerGstElement *mainbin = NULL;
gint start_per = DEFAULT_PER_VALUE, stop_per = DEFAULT_PER_VALUE;
@@ -8581,27 +7716,23 @@ static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned
*start_pos = 0;
*stop_pos = 0;
- if (!MMPLAYER_IS_HTTP_STREAMING(player))
- {
+ if (!MMPLAYER_IS_HTTP_STREAMING(player)) {
/* and rtsp is not ready yet. */
LOGW("it's only used for http streaming case.\n");
return MM_ERROR_PLAYER_NO_OP;
}
- if (format != MM_PLAYER_POS_FORMAT_PERCENT)
- {
+ if (format != MM_PLAYER_POS_FORMAT_PERCENT) {
LOGW("Time format is not supported yet.\n");
return MM_ERROR_INVALID_ARGUMENT;
}
- if (content_size_time <= 0 || content_size_bytes <= 0)
- {
+ if (content_size_time <= 0 || content_size_bytes <= 0) {
LOGW("there is no content size.");
return MM_ERROR_NONE;
}
- if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position) != MM_ERROR_NONE)
- {
+ if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position) != MM_ERROR_NONE) {
LOGW("fail to get current position.");
return MM_ERROR_NONE;
}
@@ -8612,15 +7743,13 @@ static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned
mainbin = player->pipeline->mainbin;
start_per = ceil(100 *(position*GST_MSECOND) / content_size_time);
- if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)
- {
+ if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) {
GstQuery *query = NULL;
gint byte_in_rate = 0, byte_out_rate = 0;
gint64 estimated_total = 0;
query = gst_query_new_buffering(GST_FORMAT_BYTES);
- if (!query || !gst_element_query(mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst, query))
- {
+ if (!query || !gst_element_query(mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst, query)) {
LOGW("fail to get buffering query from queue2");
if (query)
gst_query_unref(query);
@@ -8630,52 +7759,42 @@ static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned
gst_query_parse_buffering_stats(query, &mode, &byte_in_rate, &byte_out_rate, NULL);
LOGD("mode %d, in_rate %d, out_rate %d", mode, byte_in_rate, byte_out_rate);
- if (mode == GST_BUFFERING_STREAM) /* using only queue in case of push mode(ts / mp3) */
- {
+ if (mode == GST_BUFFERING_STREAM) {
+ /* using only queue in case of push mode(ts / mp3) */
if (gst_element_query_position(mainbin[MMPLAYER_M_SRC].gst,
- GST_FORMAT_BYTES, &buffered_total))
- {
+ GST_FORMAT_BYTES, &buffered_total)) {
LOGD("buffered_total %"G_GINT64_FORMAT, buffered_total);
stop_per = 100 * buffered_total / content_size_bytes;
}
- }
- else /* GST_BUFFERING_TIMESHIFT or GST_BUFFERING_DOWNLOAD */
- {
+ } else {
+ /* GST_BUFFERING_TIMESHIFT or GST_BUFFERING_DOWNLOAD */
guint idx = 0;
guint num_of_ranges = 0;
gint64 start_byte = 0, stop_byte = 0;
gst_query_parse_buffering_range(query, NULL, NULL, NULL, &estimated_total);
- if (estimated_total != STREAMING_IS_FINISHED)
- {
+ if (estimated_total != STREAMING_IS_FINISHED) {
/* buffered size info from queue2 */
num_of_ranges = gst_query_get_n_buffering_ranges(query);
- for (idx=0 ; idx<num_of_ranges ; idx++)
- {
+ for (idx = 0; idx < num_of_ranges; idx++) {
gst_query_parse_nth_buffering_range(query, idx, &start_byte, &stop_byte);
LOGD("range %d, %"G_GINT64_FORMAT" ~ %"G_GUINT64_FORMAT, idx, start_byte, stop_byte);
buffered_total += (stop_byte - start_byte);
}
- }
- else
- {
+ } else
stop_per = BUFFERING_MAX_PER;
- }
}
gst_query_unref(query);
}
- if (stop_per == DEFAULT_PER_VALUE)
- {
+ if (stop_per == DEFAULT_PER_VALUE) {
guint dur_sec = (guint)(content_size_time/GST_SECOND);
- if (dur_sec > 0)
- {
+ if (dur_sec > 0) {
guint avg_byterate = (guint)(content_size_bytes/dur_sec);
/* buffered size info from multiqueue */
- if (mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst)
- {
+ if (mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst) {
guint curr_size_bytes = 0;
g_object_get(G_OBJECT(mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst),
"curr-size-bytes", &curr_size_bytes, NULL);
@@ -8709,8 +7828,7 @@ __gst_set_message_callback(mm_player_t* player, MMMessageCallback callback, gpoi
{
MMPLAYER_FENTER();
- if (!player)
- {
+ if (!player) {
LOGW("set_message_callback is called with invalid player handle\n");
return MM_ERROR_PLAYER_NOT_INITIALIZED;
}
@@ -8738,80 +7856,61 @@ static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParse
memset(data, 0, sizeof(MMPlayerParseProfile));
- if ((path = strstr(uri, "es_buff://")))
- {
- if (strlen(path))
- {
+ if ((path = strstr(uri, "es_buff://"))) {
+ if (strlen(path)) {
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
data->uri_type = MM_PLAYER_URI_TYPE_MS_BUFF;
ret = MM_ERROR_NONE;
}
- }
- else if ((path = strstr(uri, "buff://")))
- {
+ } else if ((path = strstr(uri, "buff://"))) {
data->uri_type = MM_PLAYER_URI_TYPE_BUFF;
ret = MM_ERROR_NONE;
- }
- else if ((path = strstr(uri, "rtsp://")))
- {
+ } else if ((path = strstr(uri, "rtsp://"))) {
if (strlen(path)) {
if ((path = strstr(uri, "/wfd1.0/"))) {
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
data->uri_type = MM_PLAYER_URI_TYPE_URL_WFD;
ret = MM_ERROR_NONE;
LOGD("uri is actually a wfd client path. giving it to wfdrtspsrc\n");
- }
- else {
+ } else {
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
data->uri_type = MM_PLAYER_URI_TYPE_URL_RTSP;
ret = MM_ERROR_NONE;
}
}
- }
- else if ((path = strstr(uri, "http://")))
- {
+ } else if ((path = strstr(uri, "http://"))) {
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;
- }
else
- data->uri_type = MM_PLAYER_URI_TYPE_URL_HTTP;
+ data->uri_type = MM_PLAYER_URI_TYPE_URL_HTTP;
ret = MM_ERROR_NONE;
}
- }
- else if ((path = strstr(uri, "https://")))
- {
+ } 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;
}
- }
- else if ((path = strstr(uri, "rtspu://")))
- {
+ } else if ((path = strstr(uri, "rtspu://"))) {
if (strlen(path)) {
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
data->uri_type = MM_PLAYER_URI_TYPE_URL_RTSP;
ret = MM_ERROR_NONE;
}
- }
- else if ((path = strstr(uri, "rtspr://")))
- {
+ } else if ((path = strstr(uri, "rtspr://"))) {
strncpy(data->uri, path, MM_MAX_URL_LEN-1);
- char *separater =strstr(path, "*");
+ char *separater = strstr(path, "*");
if (separater) {
int urgent_len = 0;
@@ -8824,17 +7923,13 @@ static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParse
ret = MM_ERROR_NONE;
}
}
- }
- else if ((path = strstr(uri, "mms://")))
- {
+ } else if ((path = strstr(uri, "mms://"))) {
if (strlen(path)) {
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
data->uri_type = MM_PLAYER_URI_TYPE_URL_MMS;
ret = MM_ERROR_NONE;
}
- }
- else if ((path = strstr(uri, "mem://")))
- {
+ } else if ((path = strstr(uri, "mem://"))) {
if (strlen(path)) {
int mem_size = 0;
char *buffer = NULL;
@@ -8873,18 +7968,15 @@ static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParse
}
}
- LOGD("ext: %s, mem_size: %d, mmap(param): %p\n", ext, mem_size, param);
- if (mem_size && param)
- {
+ LOGD("ext: %s, mem_size: %d, mmap(param): %p\n", ext, mem_size, param);
+ if (mem_size && param) {
data->mem = param;
data->mem_size = mem_size;
data->uri_type = MM_PLAYER_URI_TYPE_MEM;
ret = MM_ERROR_NONE;
}
}
- }
- else
- {
+ } else {
gchar *location = NULL;
GError *err = NULL;
@@ -8906,33 +7998,24 @@ static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParse
LOGD("path from uri: %s", location);
}
- path = (location != NULL)?(location):((char*)uri);
+ path = (location != NULL) ? (location) : ((char*)uri);
int file_stat = MM_ERROR_NONE;
file_stat = util_exist_file_path(path);
/* if no protocol prefix exist. check file existence and then give file:// as it's prefix */
- if (file_stat == MM_ERROR_NONE)
- {
+ if (file_stat == MM_ERROR_NONE) {
g_snprintf(data->uri, MM_MAX_URL_LEN, "file://%s", path);
- if (util_is_sdp_file(path))
- {
+ if (util_is_sdp_file(path)) {
LOGD("uri is actually a file but it's sdp file. giving it to rtspsrc\n");
data->uri_type = MM_PLAYER_URI_TYPE_URL_RTSP;
- }
- else
- {
+ } else
data->uri_type = MM_PLAYER_URI_TYPE_FILE;
- }
ret = MM_ERROR_NONE;
- }
- else if (file_stat == MM_ERROR_PLAYER_PERMISSION_DENIED)
- {
+ } else if (file_stat == MM_ERROR_PLAYER_PERMISSION_DENIED) {
data->uri_type = MM_PLAYER_URI_TYPE_NO_PERMISSION;
- }
- else
- {
+ } else {
LOGE("invalid uri, could not play..\n");
data->uri_type = MM_PLAYER_URI_TYPE_NONE;
}
@@ -8941,11 +8024,10 @@ static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParse
}
exit:
- if (data->uri_type == MM_PLAYER_URI_TYPE_NONE) {
+ if (data->uri_type == MM_PLAYER_URI_TYPE_NONE)
ret = MM_ERROR_PLAYER_FILE_NOT_FOUND;
- } else if (data->uri_type == MM_PLAYER_URI_TYPE_NO_PERMISSION){
+ else if (data->uri_type == MM_PLAYER_URI_TYPE_NO_PERMISSION)
ret = MM_ERROR_PLAYER_PERMISSION_DENIED;
- }
/* dump parse result */
SECURE_LOGW("incomming uri : %s\n", uri);
@@ -8967,8 +8049,7 @@ gboolean _asm_postmsg(gpointer *data)
LOGW("get notified");
if ((player->cmd == MMPLAYER_COMMAND_DESTROY) ||
- (player->cmd == MMPLAYER_COMMAND_UNREALIZE))
- {
+ (player->cmd == MMPLAYER_COMMAND_UNREALIZE)) {
LOGW("dispatched");
return FALSE;
}
@@ -8993,19 +8074,13 @@ gboolean _asm_lazy_pause(gpointer *data)
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PLAYING)
- {
+ if (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PLAYING) {
LOGD("Ready to proceed lazy pause\n");
ret = _mmplayer_pause((MMHandleType)player);
if (MM_ERROR_NONE != ret)
- {
LOGE("MMPlayer pause failed in ASM callback lazy pause\n");
- }
- }
- else
- {
+ } else
LOGD("Invalid state to proceed lazy pause\n");
- }
/* unset mute */
if (player->pipeline && player->pipeline->audiobin)
@@ -9021,21 +8096,18 @@ gboolean _asm_lazy_pause(gpointer *data)
gboolean
__mmplayer_can_do_interrupt(mm_player_t *player)
{
- if (!player || !player->pipeline || !player->attrs)
- {
+ if (!player || !player->pipeline || !player->attrs) {
LOGW("not initialized");
goto FAILED;
}
- if ((player->sound_focus.exit_cb) || (player->set_mode.pcm_extraction))
- {
+ if ((player->sound_focus.exit_cb) || (player->set_mode.pcm_extraction)) {
LOGW("leave from asm cb right now, %d, %d", player->sound_focus.exit_cb, player->set_mode.pcm_extraction);
goto FAILED;
}
/* check if seeking */
- if (player->doing_seek)
- {
+ if (player->doing_seek) {
MMMessageParamType msg_param;
memset(&msg_param, 0, sizeof(MMMessageParamType));
msg_param.code = MM_ERROR_PLAYER_SEEK;
@@ -9045,13 +8117,11 @@ __mmplayer_can_do_interrupt(mm_player_t *player)
}
/* check other thread */
- if (!g_mutex_trylock(&player->cmd_lock))
- {
+ if (!g_mutex_trylock(&player->cmd_lock)) {
LOGW("locked already, cmd state : %d", player->cmd);
/* check application command */
- if (player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME)
- {
+ if (player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME) {
LOGW("playing.. should wait cmd lock then, will be interrupted");
/* lock will be released at mrp_resource_release_cb() */
@@ -9060,9 +8130,7 @@ __mmplayer_can_do_interrupt(mm_player_t *player)
}
LOGW("nothing to do");
goto FAILED;
- }
- else
- {
+ } else {
LOGW("can interrupt immediately");
goto INTERRUPT;
}
@@ -9091,10 +8159,10 @@ __mmplayer_convert_sound_focus_state(gboolean acquire, const char *reason_for_ch
focus_msg = MM_PLAYER_FOCUS_CHANGED_BY_EMERGENCY;
} else if (strstr(reason_for_change, "call-voice") ||
- strstr(reason_for_change, "call-video") ||
- strstr(reason_for_change, "voip") ||
- strstr(reason_for_change, "ringtone-voip") ||
- strstr(reason_for_change, "ringtone-call")) {
+ strstr(reason_for_change, "call-video") ||
+ strstr(reason_for_change, "voip") ||
+ strstr(reason_for_change, "ringtone-voip") ||
+ strstr(reason_for_change, "ringtone-call")) {
focus_msg = MM_PLAYER_FOCUS_CHANGED_BY_CALL;
} else if (strstr(reason_for_change, "media") ||
@@ -9112,10 +8180,8 @@ __mmplayer_convert_sound_focus_state(gboolean acquire, const char *reason_for_ch
}
if (acquire && (focus_msg != MM_PLAYER_FOCUS_CHANGED_BY_MEDIA))
- {
/* can acqurie */
focus_msg = MM_PLAYER_FOCUS_CHANGED_COMPLETED;
- }
LOGD("converted from reason(%s) to msg(%d)", reason_for_change, focus_msg);
*msg = focus_msg;
@@ -9134,88 +8200,67 @@ void __mmplayer_sound_focus_watch_callback(int id, mm_sound_focus_type_e focus_t
LOGW("focus watch notified");
- if (!__mmplayer_can_do_interrupt(player))
- {
+ if (!__mmplayer_can_do_interrupt(player)) {
LOGW("no need to interrupt, so leave");
goto EXIT_WITHOUT_UNLOCK;
}
- if (player->sound_focus.session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE)
- {
+ if (player->sound_focus.session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
LOGW("flags is UNINTERRUPTIBLE. do nothing.");
goto EXIT;
}
LOGW("watch: state: %d, focus_type : %d, reason_for_change : %s",
- focus_state, focus_type, (reason_for_change?reason_for_change:"N/A"));
+ focus_state, focus_type, (reason_for_change ? reason_for_change : "N/A"));
player->sound_focus.cb_pending = TRUE;
player->sound_focus.by_asm_cb = TRUE;
- if (focus_state == FOCUS_IS_ACQUIRED)
- {
+ if (focus_state == FOCUS_IS_ACQUIRED) {
LOGW("watch: FOCUS_IS_ACQUIRED");
if (MM_ERROR_NONE == __mmplayer_convert_sound_focus_state(FALSE, reason_for_change, &msg))
- {
player->sound_focus.focus_changed_msg = (int)msg;
- }
if (strstr(reason_for_change, "call") ||
strstr(reason_for_change, "voip") || /* FIXME: to check */
strstr(reason_for_change, "alarm") ||
- strstr(reason_for_change, "media"))
- {
- if (!MMPLAYER_IS_RTSP_STREAMING(player))
- {
+ strstr(reason_for_change, "media")) {
+ if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
// hold 0.7 second to excute "fadedown mute" effect
LOGW("do fade down->pause->undo fade down");
__mmplayer_do_sound_fadedown(player, MM_PLAYER_FADEOUT_TIME_DEFAULT);
result = _mmplayer_pause((MMHandleType)player);
- if (result != MM_ERROR_NONE)
- {
+ if (result != MM_ERROR_NONE) {
LOGW("fail to set Pause state by asm");
goto EXIT;
}
__mmplayer_undo_sound_fadedown(player);
- }
- else
- {
+ } else
/* rtsp should connect again in specific network becasue tcp session can't be kept any more */
_mmplayer_unrealize((MMHandleType)player);
- }
- }
- else
- {
+ } else {
LOGW("pause immediately");
result = _mmplayer_pause((MMHandleType)player);
- if (result != MM_ERROR_NONE)
- {
+ if (result != MM_ERROR_NONE) {
LOGW("fail to set Pause state by asm");
goto EXIT;
}
}
- }
- else if (focus_state == FOCUS_IS_RELEASED)
- {
+ } else if (focus_state == FOCUS_IS_RELEASED) {
LOGW("FOCUS_IS_RELEASED: Got msg from asm to resume");
player->sound_focus.antishock = TRUE;
player->sound_focus.by_asm_cb = FALSE;
if (MM_ERROR_NONE == __mmplayer_convert_sound_focus_state(TRUE, reason_for_change, &msg))
- {
player->sound_focus.focus_changed_msg = (int)msg;
- }
//ASM server is single thread daemon. So use g_idle_add() to post resume msg
player->resume_event_id = g_idle_add((GSourceFunc)_asm_postmsg, (gpointer)player);
goto DONE;
- }
- else
- {
+ } else
LOGW("unknown focus state %d", focus_state);
- }
DONE:
player->sound_focus.by_asm_cb = FALSE;
@@ -9242,96 +8287,73 @@ __mmplayer_sound_focus_callback(int id, mm_sound_focus_type_e focus_type, mm_sou
LOGW("get focus notified");
- if (!__mmplayer_can_do_interrupt(player))
- {
+ if (!__mmplayer_can_do_interrupt(player)) {
LOGW("no need to interrupt, so leave");
goto EXIT_WITHOUT_UNLOCK;
}
- if (player->sound_focus.session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE)
- {
+ if (player->sound_focus.session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
LOGW("flags is UNINTERRUPTIBLE. do nothing.");
goto EXIT;
}
LOGW("state: %d, focus_type : %d, reason_for_change : %s",
- focus_state, focus_type, (reason_for_change?reason_for_change:"N/A"));
+ focus_state, focus_type, (reason_for_change ? reason_for_change : "N/A"));
player->sound_focus.cb_pending = TRUE;
player->sound_focus.by_asm_cb = TRUE;
// player->sound_focus.event_src = event_src;
- if (focus_state == FOCUS_IS_RELEASED)
- {
+ if (focus_state == FOCUS_IS_RELEASED) {
LOGW("FOCUS_IS_RELEASED");
if (MM_ERROR_NONE == __mmplayer_convert_sound_focus_state(FALSE, reason_for_change, &msg))
- {
player->sound_focus.focus_changed_msg = (int)msg;
- }
if (strstr(reason_for_change, "call") ||
strstr(reason_for_change, "voip") || /* FIXME: to check */
strstr(reason_for_change, "alarm") ||
- strstr(reason_for_change, "media"))
- {
- if (!MMPLAYER_IS_RTSP_STREAMING(player))
- {
+ strstr(reason_for_change, "media")) {
+ if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
//hold 0.7 second to excute "fadedown mute" effect
LOGW("do fade down->pause->undo fade down");
__mmplayer_do_sound_fadedown(player, MM_PLAYER_FADEOUT_TIME_DEFAULT);
result = _mmplayer_pause((MMHandleType)player);
- if (result != MM_ERROR_NONE)
- {
+ if (result != MM_ERROR_NONE) {
LOGW("fail to set Pause state by asm");
goto EXIT;
}
__mmplayer_undo_sound_fadedown(player);
- }
- else
- {
+ } else
/* rtsp should connect again in specific network becasue tcp session can't be kept any more */
_mmplayer_unrealize((MMHandleType)player);
- }
- }
- else
- {
+ } else {
LOGW("pause immediately");
result = _mmplayer_pause((MMHandleType)player);
- if (result != MM_ERROR_NONE)
- {
+ if (result != MM_ERROR_NONE) {
LOGW("fail to set Pause state by asm");
goto EXIT;
}
}
- }
- else if (focus_state == FOCUS_IS_ACQUIRED)
- {
+ } else if (focus_state == FOCUS_IS_ACQUIRED) {
LOGW("FOCUS_IS_ACQUIRED: Got msg from asm to resume");
player->sound_focus.antishock = TRUE;
player->sound_focus.by_asm_cb = FALSE;
if (MM_ERROR_NONE == __mmplayer_convert_sound_focus_state(TRUE, reason_for_change, &msg))
- {
player->sound_focus.focus_changed_msg = (int)msg;
- }
//ASM server is single thread daemon. So use g_idle_add() to post resume msg
player->resume_event_id = g_idle_add((GSourceFunc)_asm_postmsg, (gpointer)player);
goto DONE;
- }
- else
- {
+ } else
LOGW("unknown focus state %d", focus_state);
- }
DONE:
if (!lazy_pause)
- {
player->sound_focus.by_asm_cb = FALSE;
- }
player->sound_focus.cb_pending = FALSE;
EXIT:
@@ -9367,15 +8389,13 @@ _mmplayer_create_player(MMHandleType handle) // @
/* construct attributes */
player->attrs = _mmplayer_construct_attribute(handle);
- if (!player->attrs)
- {
+ if (!player->attrs) {
LOGE("Failed to construct attributes\n");
return ret;
}
/* initialize gstreamer with configured parameter */
- if (!__mmplayer_init_gstreamer(player))
- {
+ if (!__mmplayer_init_gstreamer(player)) {
LOGE("Initializing gstreamer failed\n");
_mmplayer_deconstruct_attribute(handle);
return ret;
@@ -9397,8 +8417,7 @@ _mmplayer_create_player(MMHandleType handle) // @
/* create repeat thread */
player->repeat_thread =
g_thread_try_new("repeat_thread", __mmplayer_repeat_thread, (gpointer)player, NULL);
- if (!player->repeat_thread)
- {
+ if (!player->repeat_thread) {
LOGE("failed to create repeat_thread(%s)");
g_mutex_clear(&player->repeat_thread_mutex);
g_cond_clear(&player->repeat_thread_cond);
@@ -9415,8 +8434,7 @@ _mmplayer_create_player(MMHandleType handle) // @
/* create next play thread */
player->next_play_thread =
g_thread_try_new("next_play_thread", __mmplayer_next_play_thread, (gpointer)player, NULL);
- if (!player->next_play_thread)
- {
+ if (!player->next_play_thread) {
LOGE("failed to create next play thread");
ret = MM_ERROR_PLAYER_RESOURCE_LIMIT;
g_mutex_clear(&player->next_play_thread_mutex);
@@ -9425,21 +8443,18 @@ _mmplayer_create_player(MMHandleType handle) // @
}
ret = _mmplayer_initialize_video_capture(player);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to initialize video capture\n");
goto ERROR;
}
/* initialize resource manager */
- if (MM_ERROR_NONE != _mmplayer_resource_manager_init(&player->resource_manager, player))
- {
+ if (MM_ERROR_NONE != _mmplayer_resource_manager_init(&player->resource_manager, player)) {
LOGE("failed to initialize resource manager\n");
goto ERROR;
}
- if (MMPLAYER_IS_HTTP_PD(player))
- {
+ if (MMPLAYER_IS_HTTP_PD(player)) {
player->pd_downloader = NULL;
player->pd_file_save_path = NULL;
}
@@ -9467,13 +8482,9 @@ _mmplayer_create_player(MMHandleType handle) // @
player->video_num_buffers = DEFAULT_NUM_OF_V_OUT_BUFFER;
player->video_extra_num_buffers = DEFAULT_NUM_OF_V_OUT_BUFFER;
if (player->ini.dump_element_keyword[0][0] == '\0')
- {
- player->ini.set_dump_element_flag= FALSE;
- }
+ player->ini.set_dump_element_flag = FALSE;
else
- {
player->ini.set_dump_element_flag = TRUE;
- }
/* set player state to null */
MMPLAYER_STATE_CHANGE_TIMEOUT(player) = player->ini.localplayback_state_change_timeout;
@@ -9486,8 +8497,7 @@ ERROR:
g_mutex_clear(&player->fsink_lock);
/* free thread */
- if (player->repeat_thread)
- {
+ if (player->repeat_thread) {
player->repeat_thread_exit = TRUE;
g_cond_signal(&player->repeat_thread_cond);
@@ -9499,8 +8509,7 @@ ERROR:
}
/* free next play thread */
- if (player->next_play_thread)
- {
+ if (player->next_play_thread) {
player->next_play_thread_exit = TRUE;
g_cond_signal(&player->next_play_thread_cond);
@@ -9524,15 +8533,14 @@ __mmplayer_init_gstreamer(mm_player_t* player) // @
{
static gboolean initialized = FALSE;
static const int max_argc = 50;
- gint* argc = NULL;
+ gint* argc = NULL;
gchar** argv = NULL;
gchar** argv2 = NULL;
GError *err = NULL;
int i = 0;
int arg_count = 0;
- if (initialized)
- {
+ if (initialized) {
LOGD("gstreamer already initialized.\n");
return TRUE;
}
@@ -9553,10 +8561,9 @@ __mmplayer_init_gstreamer(mm_player_t* player) // @
argv[0] = g_strdup("mmplayer");
/* add gst_param */
- for (i = 0; i < 5; i++) /* FIXIT : num of param is now fixed to 5. make it dynamic */
- {
- if (strlen(player->ini.gst_param[i]) > 0)
- {
+ for (i = 0; i < 5; i++) {
+ /* FIXIT : num of param is now fixed to 5. make it dynamic */
+ if (strlen(player->ini.gst_param[i]) > 0) {
argv[*argc] = g_strdup(player->ini.gst_param[i]);
(*argc)++;
}
@@ -9567,15 +8574,13 @@ __mmplayer_init_gstreamer(mm_player_t* player) // @
(*argc)++;
/* check disable registry scan */
- if (player->ini.skip_rescan)
- {
+ if (player->ini.skip_rescan) {
argv[*argc] = g_strdup("--gst-disable-registry-update");
(*argc)++;
}
/* check disable segtrap */
- if (player->ini.disable_segtrap)
- {
+ if (player->ini.disable_segtrap) {
argv[*argc] = g_strdup("--gst-disable-segtrap");
(*argc)++;
}
@@ -9584,27 +8589,22 @@ __mmplayer_init_gstreamer(mm_player_t* player) // @
LOGD("argc : %d\n", *argc);
arg_count = *argc;
- for (i = 0; i < arg_count; i++)
- {
+ for (i = 0; i < arg_count; i++) {
argv2[i] = argv[i];
LOGD("argv[%d] : %s\n", i, argv2[i]);
}
/* initializing gstreamer */
- if (!gst_init_check(argc, &argv, &err))
- {
+ if (!gst_init_check(argc, &argv, &err)) {
LOGE("Could not initialize GStreamer: %s\n", err ? err->message : "unknown error occurred");
if (err)
- {
g_error_free(err);
- }
goto ERROR;
}
/* release */
- for (i = 0; i < arg_count; i++)
- {
+ for (i = 0; i < arg_count; i++) {
//LOGD("release - argv[%d] : %s\n", i, argv2[i]);
MMPLAYER_FREEIF(argv2[i]);
}
@@ -9621,8 +8621,7 @@ __mmplayer_init_gstreamer(mm_player_t* player) // @
ERROR:
/* release */
- for (i = 0; i < arg_count; i++)
- {
+ for (i = 0; i < arg_count; i++) {
LOGD("free[%d] : %s\n", i, argv2[i]);
MMPLAYER_FREEIF(argv2[i]);
}
@@ -9639,14 +8638,12 @@ __mmplayer_destroy_streaming_ext(mm_player_t* player)
{
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (player->pd_downloader)
- {
+ if (player->pd_downloader) {
_mmplayer_unrealize_pd_downloader((MMHandleType)player);
MMPLAYER_FREEIF(player->pd_downloader);
}
- if (MMPLAYER_IS_HTTP_PD(player))
- {
+ if (MMPLAYER_IS_HTTP_PD(player)) {
_mmplayer_destroy_pd_downloader((MMHandleType)player);
MMPLAYER_FREEIF(player->pd_file_save_path);
}
@@ -9670,8 +8667,7 @@ _mmplayer_destroy(MMHandleType handle) // @
__mmplayer_destroy_streaming_ext(player);
/* release repeat thread */
- if (player->repeat_thread)
- {
+ if (player->repeat_thread) {
player->repeat_thread_exit = TRUE;
g_cond_signal(&player->repeat_thread_cond);
@@ -9683,8 +8679,7 @@ _mmplayer_destroy(MMHandleType handle) // @
}
/* release next play thread */
- if (player->next_play_thread)
- {
+ if (player->next_play_thread) {
player->next_play_thread_exit = TRUE;
g_cond_signal(&player->next_play_thread_cond);
@@ -9698,8 +8693,7 @@ _mmplayer_destroy(MMHandleType handle) // @
_mmplayer_release_video_capture(player);
/* flush any pending asm_cb */
- if (player->sound_focus.cb_pending)
- {
+ if (player->sound_focus.cb_pending) {
/* set a flag for make sure asm_cb to be returned immediately */
LOGW("asm cb has pending state");
player->sound_focus.exit_cb = TRUE;
@@ -9712,45 +8706,36 @@ _mmplayer_destroy(MMHandleType handle) // @
/* withdraw asm */
if (MM_ERROR_NONE != _mmplayer_sound_unregister(&player->sound_focus))
- {
LOGE("failed to deregister asm server\n");
- }
/* de-initialize resource manager */
if (MM_ERROR_NONE != _mmplayer_resource_manager_deinit(&player->resource_manager))
- {
LOGE("failed to deinitialize resource manager\n");
- }
#ifdef USE_LAZY_PAUSE
- if (player->lazy_pause_event_id)
- {
+ if (player->lazy_pause_event_id) {
__mmplayer_remove_g_source_from_context(player->context.global_default, player->lazy_pause_event_id);
player->lazy_pause_event_id = 0;
}
#endif
- if (player->resume_event_id)
- {
+ if (player->resume_event_id) {
g_source_remove(player->resume_event_id);
player->resume_event_id = 0;
}
- if (player->resumable_cancel_id)
- {
+ if (player->resumable_cancel_id) {
g_source_remove(player->resumable_cancel_id);
player->resumable_cancel_id = 0;
}
/* release pipeline */
- if (MM_ERROR_NONE != __mmplayer_gst_destroy_pipeline(player))
- {
+ if (MM_ERROR_NONE != __mmplayer_gst_destroy_pipeline(player)) {
LOGE("failed to destory pipeline\n");
return MM_ERROR_PLAYER_INTERNAL;
}
- if (player->is_external_subtitle_present && player->subtitle_language_list)
- {
+ if (player->is_external_subtitle_present && player->subtitle_language_list) {
g_list_free(player->subtitle_language_list);
player->subtitle_language_list = NULL;
}
@@ -9787,21 +8772,18 @@ __mmplayer_realize_streaming_ext(mm_player_t* player)
MMPLAYER_FENTER();
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (MMPLAYER_IS_HTTP_PD(player))
- {
+ if (MMPLAYER_IS_HTTP_PD(player)) {
gboolean bret = FALSE;
player->pd_downloader = _mmplayer_create_pd_downloader();
- if (!player->pd_downloader)
- {
+ if (!player->pd_downloader) {
LOGE("Unable to create PD Downloader...");
ret = MM_ERROR_PLAYER_NO_FREE_SPACE;
}
bret = _mmplayer_realize_pd_downloader((MMHandleType)player, player->profile.uri, player->pd_file_save_path, player->pipeline->mainbin[MMPLAYER_M_SRC].gst);
- if (FALSE == bret)
- {
+ if (FALSE == bret) {
LOGE("Unable to create PD Downloader...");
ret = MM_ERROR_PLAYER_NOT_INITIALIZED;
}
@@ -9819,8 +8801,7 @@ _mmplayer_sound_register_with_pid(MMHandleType hplayer, int pid) // @
int ret = MM_ERROR_NONE;
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("fail to get attributes.\n");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -9831,9 +8812,7 @@ _mmplayer_sound_register_with_pid(MMHandleType hplayer, int pid) // @
if (MM_ERROR_NONE != _mmplayer_sound_register(&player->sound_focus,
(mm_sound_focus_changed_cb)__mmplayer_sound_focus_callback,
(mm_sound_focus_changed_watch_cb)__mmplayer_sound_focus_watch_callback,
- (void*)player))
-
- {
+ (void*)player)) {
/* NOTE : we are dealing it as an error since we cannot expect it's behavior */
LOGE("failed to register asm server\n");
return MM_ERROR_POLICY_INTERNAL;
@@ -9863,7 +8842,7 @@ int
_mmplayer_realize(MMHandleType hplayer) // @
{
mm_player_t* player = (mm_player_t*)hplayer;
- char *uri =NULL;
+ char *uri = NULL;
void *param = NULL;
gboolean update_registry = FALSE;
MMHandleType attrs = 0;
@@ -9878,47 +8857,37 @@ _mmplayer_realize(MMHandleType hplayer) // @
MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_REALIZE);
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("fail to get attributes.\n");
return MM_ERROR_PLAYER_INTERNAL;
}
mm_attrs_get_string_by_name(attrs, "profile_uri", &uri);
mm_attrs_get_data_by_name(attrs, "profile_user_param", &param);
- if (player->profile.uri_type == MM_PLAYER_URI_TYPE_NONE)
- {
+ if (player->profile.uri_type == MM_PLAYER_URI_TYPE_NONE) {
ret = __mmfplayer_parse_profile((const char*)uri, param, &player->profile);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to parse profile\n");
return ret;
}
}
/* FIXIT : we can use thouse in player->profile directly */
- if (player->profile.uri_type == MM_PLAYER_URI_TYPE_MEM)
- {
+ if (player->profile.uri_type == MM_PLAYER_URI_TYPE_MEM) {
player->mem_buf.buf = (char *)player->profile.mem;
player->mem_buf.len = player->profile.mem_size;
player->mem_buf.offset = 0;
}
- if (uri && (strstr(uri, "es_buff://")))
- {
+ if (uri && (strstr(uri, "es_buff://"))) {
if (strstr(uri, "es_buff://push_mode"))
- {
player->es_player_push_mode = TRUE;
- }
else
- {
player->es_player_push_mode = FALSE;
- }
}
- if (player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_MMS)
- {
+ if (player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_MMS) {
LOGW("mms protocol is not supported format.\n");
return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
}
@@ -9941,8 +8910,7 @@ _mmplayer_realize(MMHandleType hplayer) // @
/* registry should be updated for downloadable codec */
mm_attrs_get_int_by_name(attrs, "profile_update_registry", &update_registry);
- if (update_registry)
- {
+ if (update_registry) {
LOGD("updating registry...\n");
gst_update_registry();
@@ -9954,13 +8922,9 @@ _mmplayer_realize(MMHandleType hplayer) // @
/* realize pipeline */
ret = __gst_realize(player);
if (ret != MM_ERROR_NONE)
- {
LOGE("fail to realize the player.\n");
- }
else
- {
ret = __mmplayer_realize_streaming_ext(player);
- }
MMPLAYER_FLEAVE();
@@ -9974,8 +8938,7 @@ __mmplayer_unrealize_streaming_ext(mm_player_t *player)
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* destroy can called at anytime */
- if (player->pd_downloader && MMPLAYER_IS_HTTP_PD(player))
- {
+ if (player->pd_downloader && MMPLAYER_IS_HTTP_PD(player)) {
_mmplayer_unrealize_pd_downloader((MMHandleType)player);
MMPLAYER_FREEIF(player->pd_downloader);
}
@@ -10004,42 +8967,28 @@ _mmplayer_unrealize(MMHandleType hplayer)
ret = __gst_unrealize(player);
/* set asm stop if success */
- if (MM_ERROR_NONE == ret)
- {
+ if (MM_ERROR_NONE == ret) {
ret = _mmplayer_sound_release_focus(&player->sound_focus);
if (ret != MM_ERROR_NONE)
- {
LOGE("failed to release sound focus, ret(0x%x)\n", ret);
- }
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE)
- {
- if (resource_state >= RESOURCE_STATE_ACQUIRED)
- {
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (resource_state >= RESOURCE_STATE_ACQUIRED) {
ret = _mmplayer_resource_manager_release(&player->resource_manager);
if (ret != MM_ERROR_NONE)
- {
LOGE("failed to release resource, ret(0x%x)\n", ret);
- }
}
}
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE)
- {
- if (resource_state == RESOURCE_STATE_PREPARED)
- {
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (resource_state == RESOURCE_STATE_PREPARED) {
ret = _mmplayer_resource_manager_unprepare(&player->resource_manager);
if (ret != MM_ERROR_NONE)
- {
LOGE("failed to unprepare resource, ret(0x%x)\n", ret);
- }
}
}
- }
- else
- {
+ } else
LOGE("failed and don't change asm state to stop");
- }
MMPLAYER_FLEAVE();
@@ -10084,8 +9033,7 @@ _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume) // @
volume.level[MM_VOLUME_CHANNEL_LEFT], volume.level[MM_VOLUME_CHANNEL_RIGHT]);
/* invalid factor range or not */
- for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
- {
+ for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++) {
if (volume.level[i] < MM_VOLUME_FACTOR_MIN || volume.level[i] > MM_VOLUME_FACTOR_MAX) {
LOGE("Invalid factor!(valid factor:0~1.0)\n");
return MM_ERROR_INVALID_ARGUMENT;
@@ -10100,8 +9048,7 @@ _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume) // @
player->sound.volume = volume.level[MM_VOLUME_CHANNEL_LEFT];
/* check pipeline handle */
- if (!player->pipeline || !player->pipeline->audiobin)
- {
+ if (!player->pipeline || !player->pipeline->audiobin) {
LOGD("audiobin is not created yet\n");
LOGD("but, current stored volume will be set when it's created.\n");
@@ -10115,8 +9062,7 @@ _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume) // @
/* setting volume to volume element */
vol_element = player->pipeline->audiobin[MMPLAYER_A_VOL].gst;
- if (vol_element)
- {
+ if (vol_element) {
LOGD("volume is set [%f]\n", player->sound.volume);
g_object_set(vol_element, "volume", player->sound.volume, NULL);
}
@@ -10160,8 +9106,7 @@ _mmplayer_set_mute(MMHandleType hplayer, int mute) // @
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* mute value shoud 0 or 1 */
- if (mute != 0 && mute != 1)
- {
+ if (mute != 0 && mute != 1) {
LOGE("bad mute value\n");
/* FIXIT : definitly, we need _BAD_PARAM error code */
@@ -10171,8 +9116,7 @@ _mmplayer_set_mute(MMHandleType hplayer, int mute) // @
player->sound.mute = mute;
/* just hold mute value if pipeline is not ready */
- if (!player->pipeline || !player->pipeline->audiobin)
- {
+ if (!player->pipeline || !player->pipeline->audiobin) {
LOGD("pipeline is not ready. holding mute value\n");
return MM_ERROR_NONE;
}
@@ -10180,15 +9124,11 @@ _mmplayer_set_mute(MMHandleType hplayer, int mute) // @
vol_element = player->pipeline->audiobin[MMPLAYER_A_SINK].gst;
/* NOTE : volume will only created when the bt is enabled */
- if (vol_element)
- {
+ if (vol_element) {
LOGD("mute : %d\n", mute);
g_object_set(vol_element, "mute", mute, NULL);
- }
- else
- {
+ } else
LOGD("volume elemnet is not created. using volume in audiosink\n");
- }
MMPLAYER_FLEAVE();
@@ -10206,8 +9146,7 @@ _mmplayer_get_mute(MMHandleType hplayer, int* pmute) // @
MMPLAYER_RETURN_VAL_IF_FAIL(pmute, MM_ERROR_INVALID_ARGUMENT);
/* just hold mute value if pipeline is not ready */
- if (!player->pipeline || !player->pipeline->audiobin)
- {
+ if (!player->pipeline || !player->pipeline->audiobin) {
LOGD("pipeline is not ready. returning stored value\n");
*pmute = player->sound.mute;
return MM_ERROR_NONE;
@@ -10287,7 +9226,7 @@ _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callba
if (callback && !player->bufmgr)
player->bufmgr = tbm_bufmgr_init(-1);
- player->set_mode.media_packet_video_stream = (callback)?TRUE:FALSE;
+ player->set_mode.media_packet_video_stream = (callback) ? TRUE : FALSE;
player->video_stream_cb = callback;
player->video_stream_cb_user_param = user_param;
@@ -10331,14 +9270,12 @@ _mmplayer_set_prepare_buffering_time(MMHandleType hplayer, int second)
LOGD("pre buffer size : %d sec\n", second);
- if (second <= 0)
- {
+ if (second <= 0) {
LOGE("bad size value\n");
return MM_ERROR_INVALID_ARGUMENT;
}
- if (player->streamer == NULL)
- {
+ if (player->streamer == NULL) {
player->streamer = __mm_player_streaming_create();
__mm_player_streaming_initialize(player->streamer);
}
@@ -10366,8 +9303,7 @@ _mmplayer_set_runtime_buffering_mode(MMHandleType hplayer, MMPlayerBufferingMode
((mode == MM_PLAYER_BUFFERING_MODE_FIXED) && (second <= 0)))
return MM_ERROR_INVALID_ARGUMENT;
- if (player->streamer == NULL)
- {
+ if (player->streamer == NULL) {
player->streamer = __mm_player_streaming_create();
__mm_player_streaming_initialize(player->streamer);
}
@@ -10392,24 +9328,19 @@ __mmplayer_start_streaming_ext(mm_player_t *player)
MMPLAYER_FENTER();
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (MMPLAYER_IS_HTTP_PD(player))
- {
- if (!player->pd_downloader)
- {
+ if (MMPLAYER_IS_HTTP_PD(player)) {
+ if (!player->pd_downloader) {
ret = __mmplayer_realize_streaming_ext(player);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to realize streaming ext\n");
return ret;
}
}
- if (player->pd_downloader && player->pd_mode == MM_PLAYER_PD_MODE_URI)
- {
+ if (player->pd_downloader && player->pd_mode == MM_PLAYER_PD_MODE_URI) {
ret = _mmplayer_start_pd_downloader((MMHandleType)player);
- if (!ret)
- {
+ if (!ret) {
LOGE("ERROR while starting PD...\n");
return MM_ERROR_PLAYER_NOT_INITIALIZED;
}
@@ -10435,8 +9366,7 @@ _mmplayer_start(MMHandleType hplayer) // @
MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_START);
ret = _mmplayer_sound_acquire_focus(&player->sound_focus);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to acquire sound focus.\n");
return ret;
}
@@ -10444,11 +9374,9 @@ _mmplayer_start(MMHandleType hplayer) // @
/* NOTE : we should check and create pipeline again if not created as we destroy
* whole pipeline when stopping in streamming playback
*/
- if (!player->pipeline)
- {
+ if (!player->pipeline) {
ret = __gst_realize(player);
- if (MM_ERROR_NONE != ret)
- {
+ if (MM_ERROR_NONE != ret) {
LOGE("failed to realize before starting. only in streamming\n");
/* unlock */
return ret;
@@ -10457,16 +9385,12 @@ _mmplayer_start(MMHandleType hplayer) // @
ret = __mmplayer_start_streaming_ext(player);
if (ret != MM_ERROR_NONE)
- {
LOGE("failed to start streaming ext \n");
- }
/* start pipeline */
ret = __gst_start(player);
if (ret != MM_ERROR_NONE)
- {
LOGE("failed to start player.\n");
- }
MMPLAYER_FLEAVE();
@@ -10493,8 +9417,7 @@ __mmplayer_handle_missed_plugin(mm_player_t* player)
LOGD("not_supported_codec = 0x%02x, can_support_codec = 0x%02x\n",
player->not_supported_codec, player->can_support_codec);
- if (player->not_found_demuxer)
- {
+ if (player->not_found_demuxer) {
msg_param.code = MM_ERROR_PLAYER_CODEC_NOT_FOUND;
msg_param.data = g_strdup_printf("%s", player->unlinked_demuxer_mime);
@@ -10504,32 +9427,25 @@ __mmplayer_handle_missed_plugin(mm_player_t* player)
return MM_ERROR_NONE;
}
- if (player->not_supported_codec)
- {
- if (player->can_support_codec) // There is one codec to play
- {
+ if (player->not_supported_codec) {
+ if (player->can_support_codec) {
+ // There is one codec to play
post_msg_direct = TRUE;
- }
- else
- {
+ } else {
if (player->pipeline->audiobin) // Some content has only PCM data in container.
post_msg_direct = TRUE;
}
- if (post_msg_direct)
- {
+ if (post_msg_direct) {
MMMessageParamType msg_param;
memset(&msg_param, 0, sizeof(MMMessageParamType));
- if (player->not_supported_codec == MISSING_PLUGIN_AUDIO)
- {
+ if (player->not_supported_codec == MISSING_PLUGIN_AUDIO) {
LOGW("not found AUDIO codec, posting error code to application.\n");
msg_param.code = MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
msg_param.data = g_strdup_printf("%s", player->unlinked_audio_mime);
- }
- else if (player->not_supported_codec == MISSING_PLUGIN_VIDEO)
- {
+ } else if (player->not_supported_codec == MISSING_PLUGIN_VIDEO) {
LOGW("not found VIDEO codec, posting error code to application.\n");
msg_param.code = MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
@@ -10541,18 +9457,14 @@ __mmplayer_handle_missed_plugin(mm_player_t* player)
MMPLAYER_FREEIF(msg_param.data);
return MM_ERROR_NONE;
- }
- else // no any supported codec case
- {
+ } else {
+ // no any supported codec case
LOGW("not found any codec, posting error code to application.\n");
- if (player->not_supported_codec == MISSING_PLUGIN_AUDIO)
- {
+ if (player->not_supported_codec == MISSING_PLUGIN_AUDIO) {
msg_param.code = MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
msg_param.data = g_strdup_printf("%s", player->unlinked_audio_mime);
- }
- else
- {
+ } else {
msg_param.code = MM_ERROR_PLAYER_CODEC_NOT_FOUND;
msg_param.data = g_strdup_printf("%s, %s", player->unlinked_video_mime, player->unlinked_audio_mime);
}
@@ -10575,8 +9487,7 @@ static void __mmplayer_check_pipeline(mm_player_t* player)
gint timeout = 0;
int ret = MM_ERROR_NONE;
- if (player->gapless.reconfigure)
- {
+ if (player->gapless.reconfigure) {
LOGW("pipeline is under construction.\n");
MMPLAYER_PLAYBACK_LOCK(player);
@@ -10588,9 +9499,7 @@ static void __mmplayer_check_pipeline(mm_player_t* player)
ret = gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &element_state, &element_pending_state, timeout * GST_SECOND);
if (ret == GST_STATE_CHANGE_FAILURE)
- {
LOGE("failed to change pipeline state within %d sec\n", timeout);
- }
}
}
@@ -10624,9 +9533,7 @@ _mmplayer_stop(MMHandleType hplayer) // @
ret = __gst_stop(player);
if (ret != MM_ERROR_NONE)
- {
LOGE("failed to stop player.\n");
- }
MMPLAYER_FLEAVE();
@@ -10651,9 +9558,8 @@ _mmplayer_pause(MMHandleType hplayer) // @
/* check pipline building state */
__mmplayer_check_pipeline(player);
- switch (MMPLAYER_CURRENT_STATE(player))
- {
- case MM_PLAYER_STATE_READY:
+ switch (MMPLAYER_CURRENT_STATE(player)) {
+ case MM_PLAYER_STATE_READY:
{
/* check prepare async or not.
* In the case of streaming playback, it's recommned to avoid blocking wait.
@@ -10663,7 +9569,7 @@ _mmplayer_pause(MMHandleType hplayer) // @
}
break;
- case MM_PLAYER_STATE_PLAYING:
+ case MM_PLAYER_STATE_PLAYING:
{
/* NOTE : store current point to overcome some bad operation
*(returning zero when getting current position in paused state) of some
@@ -10686,16 +9592,11 @@ _mmplayer_pause(MMHandleType hplayer) // @
ret = __gst_pause(player, async);
if (ret != MM_ERROR_NONE)
- {
LOGE("failed to pause player. ret : 0x%x\n", ret);
- }
- if (MMPLAYER_PREV_STATE(player) == MM_PLAYER_STATE_READY && MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PAUSED)
- {
+ if (MMPLAYER_PREV_STATE(player) == MM_PLAYER_STATE_READY && MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PAUSED) {
if (MM_ERROR_NONE != _mmplayer_update_video_param(player, "display_rotation"))
- {
LOGE("failed to update display_rotation");
- }
}
MMPLAYER_FLEAVE();
@@ -10715,8 +9616,7 @@ _mmplayer_resume(MMHandleType hplayer)
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
ret = _mmplayer_sound_acquire_focus(&player->sound_focus);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("failed to acquire sound focus.\n");
return ret;
}
@@ -10727,9 +9627,7 @@ _mmplayer_resume(MMHandleType hplayer)
ret = __gst_resume(player, async);
if (ret != MM_ERROR_NONE)
- {
LOGE("failed to resume player.\n");
- }
MMPLAYER_FLEAVE();
@@ -10746,8 +9644,7 @@ __mmplayer_set_play_count(mm_player_t* player, gint count)
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("fail to get attributes.\n");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -10788,8 +9685,7 @@ _mmplayer_activate_section_repeat(MMHandleType hplayer, unsigned long start, uns
GST_FORMAT_TIME,
(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, start_pos,
- GST_SEEK_TYPE_SET, end_pos)))
- {
+ GST_SEEK_TYPE_SET, end_pos))) {
LOGE("failed to activate section repeat\n");
return MM_ERROR_PLAYER_SEEK;
@@ -10826,28 +9722,24 @@ __mmplayer_set_pcm_extraction(mm_player_t* player)
LOGD("pcm extraction required position is from [%d] to [%d](msec)\n", required_start, required_end);
- if (required_start == 0 && required_end == 0)
- {
+ if (required_start == 0 && required_end == 0) {
LOGD("extracting entire stream");
return MM_ERROR_NONE;
- }
- else if (required_start < 0 || required_start > required_end || required_end < 0)
- {
+ } else if (required_start < 0 || required_start > required_end || required_end < 0) {
LOGD("invalid range for pcm extraction");
return MM_ERROR_INVALID_ARGUMENT;
}
/* get duration */
ret = gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec);
- if (!ret)
- {
+ if (!ret) {
LOGE("failed to get duration");
return MM_ERROR_PLAYER_INTERNAL;
}
dur_msec = GST_TIME_AS_MSECONDS(dur_nsec);
- if (dur_msec < required_end) // FIXME
- {
+ if (dur_msec < required_end) {
+ // FIXME
LOGD("invalid end pos for pcm extraction");
return MM_ERROR_INVALID_ARGUMENT;
}
@@ -10860,8 +9752,7 @@ __mmplayer_set_pcm_extraction(mm_player_t* player)
GST_FORMAT_TIME,
(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, start_nsec,
- GST_SEEK_TYPE_SET, end_nsec)))
- {
+ GST_SEEK_TYPE_SET, end_nsec))) {
LOGE("failed to seek for pcm extraction\n");
return MM_ERROR_PLAYER_SEEK;
@@ -10896,8 +9787,7 @@ _mmplayer_deactivate_section_repeat(MMHandleType hplayer)
GST_FORMAT_TIME,
(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, cur_pos,
- GST_SEEK_TYPE_SET, player->duration)))
- {
+ GST_SEEK_TYPE_SET, player->duration))) {
LOGE("failed to deactivate section repeat\n");
return MM_ERROR_PLAYER_SEEK;
@@ -10923,8 +9813,7 @@ _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
MMPLAYER_RETURN_VAL_IF_FAIL(streaming || !MMPLAYER_IS_STREAMING(player), MM_ERROR_NOT_SUPPORT_API);
/* The sound of video is not supported under 0.0 and over 2.0. */
- if (rate >= TRICK_PLAY_MUTE_THRESHOLD_MAX || rate < TRICK_PLAY_MUTE_THRESHOLD_MIN)
- {
+ if (rate >= TRICK_PLAY_MUTE_THRESHOLD_MAX || rate < TRICK_PLAY_MUTE_THRESHOLD_MIN) {
if (player->can_support_codec & FOUND_PLUGIN_VIDEO)
mute = TRUE;
}
@@ -10946,21 +9835,16 @@ _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_msec), ret, current_state);
if ((current_state == MM_PLAYER_STATE_PAUSED)
- || (!ret))
- //|| (player->last_position != 0 && pos_msec == 0))
- {
+ || (!ret) /*|| (player->last_position != 0 && pos_msec == 0)*/) {
LOGW("returning last point : %lld\n", player->last_position);
pos_msec = player->last_position;
}
- if (rate >= 0)
- {
+ if (rate >= 0) {
start = pos_msec;
stop = GST_CLOCK_TIME_NONE;
- }
- else
- {
+ } else {
start = GST_CLOCK_TIME_NONE;
stop = pos_msec;
}
@@ -10969,9 +9853,8 @@ _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
GST_FORMAT_TIME,
(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, start,
- GST_SEEK_TYPE_SET, stop)))
- {
- LOGE("failed to set speed playback\n");
+ GST_SEEK_TYPE_SET, stop))) {
+ LOGE("failed to set speed playback\n");
return MM_ERROR_PLAYER_SEEK;
}
@@ -11070,10 +9953,8 @@ __mmplayer_is_midi_type(gchar* str_caps)
(g_strrstr(str_caps, "audio/x-imelody")) ||
(g_strrstr(str_caps, "audio/mobile-xmf")) ||
(g_strrstr(str_caps, "audio/xmf")) ||
- (g_strrstr(str_caps, "audio/mxmf")))
- {
+ (g_strrstr(str_caps, "audio/mxmf"))) {
LOGD("midi\n");
-
return TRUE;
}
@@ -11085,9 +9966,7 @@ __mmplayer_is_only_mp3_type(gchar *str_caps)
{
if (g_strrstr(str_caps, "application/x-id3") ||
(g_strrstr(str_caps, "audio/mpeg") && g_strrstr(str_caps, "mpegversion= (int)1")))
- {
return TRUE;
- }
return FALSE;
}
@@ -11119,25 +9998,19 @@ __mmplayer_update_content_type_info(mm_player_t* player)
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player && player->type);
- if (__mmplayer_is_midi_type(player->type))
- {
+ if (__mmplayer_is_midi_type(player->type)) {
player->bypass_audio_effect = TRUE;
- }
- else if (g_strrstr(player->type, "application/x-hls"))
- {
+ } else if (g_strrstr(player->type, "application/x-hls")) {
/* If it can't know exact type when it parses uri because of redirection case,
* it will be fixed by typefinder or when doing autoplugging.
*/
player->profile.uri_type = MM_PLAYER_URI_TYPE_HLS;
- if (player->streamer)
- {
+ if (player->streamer) {
player->streamer->is_adaptive_streaming = TRUE;
player->streamer->buffering_req.mode = MM_PLAYER_BUFFERING_MODE_FIXED;
player->streamer->buffering_req.runtime_second = 5;
}
- }
- else if (g_strrstr(player->type, "application/dash+xml"))
- {
+ } else if (g_strrstr(player->type, "application/dash+xml")) {
player->profile.uri_type = MM_PLAYER_URI_TYPE_DASH;
}
@@ -11145,7 +10018,7 @@ __mmplayer_update_content_type_info(mm_player_t* player)
}
static void
-__mmplayer_typefind_have_type( GstElement *tf, guint probability, // @
+__mmplayer_typefind_have_type(GstElement *tf, guint probability, // @
GstCaps *caps, gpointer data)
{
mm_player_t* player = (mm_player_t*)data;
@@ -11163,12 +10036,10 @@ GstCaps *caps, gpointer data)
if ((!MMPLAYER_IS_WFD_STREAMING(player)) &&
(!MMPLAYER_IS_RTSP_STREAMING(player)) &&
- (g_strrstr(player->type, "audio/x-raw-int")))
- {
+ (g_strrstr(player->type, "audio/x-raw-int"))) {
LOGE("not support media format\n");
- if (player->msg_posted == FALSE)
- {
+ if (player->msg_posted == FALSE) {
MMMessageParamType msg_param;
memset(&msg_param, 0, sizeof(MMMessageParamType));
@@ -11184,54 +10055,41 @@ GstCaps *caps, gpointer data)
__mmplayer_update_content_type_info(player);
pad = gst_element_get_static_pad(tf, "src");
- if (!pad)
- {
+ if (!pad) {
LOGE("fail to get typefind src pad.\n");
return;
}
- if (player->use_decodebin)
- {
- if (!__mmplayer_try_to_plug_decodebin(player, pad, caps))
- {
+ if (player->use_decodebin) {
+ if (!__mmplayer_try_to_plug_decodebin(player, pad, caps)) {
gboolean async = FALSE;
LOGE("failed to autoplug %s\n", player->type);
mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
if (async && player->msg_posted == FALSE)
- {
__mmplayer_handle_missed_plugin(player);
- }
goto DONE;
}
- }
- else
- {
+ } else {
/* try to plug */
- if (!__mmplayer_try_to_plug(player, pad, caps))
- {
+ if (!__mmplayer_try_to_plug(player, pad, caps)) {
gboolean async = FALSE;
LOGE("failed to autoplug %s\n", player->type);
mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
if (async && player->msg_posted == FALSE)
- {
__mmplayer_handle_missed_plugin(player);
- }
goto DONE;
}
/* finish autopluging if no dynamic pad waiting */
- if ((!player->have_dynamic_pad) && (!player->has_many_types))
- {
+ if ((!player->have_dynamic_pad) && (!player->has_many_types)) {
if (!MMPLAYER_IS_RTSP_STREAMING(player))
- {
__mmplayer_pipeline_complete(NULL, (gpointer)player);
- }
}
}
@@ -11253,8 +10111,7 @@ __mmplayer_create_decodebin(mm_player_t* player)
/* create decodebin */
decodebin = gst_element_factory_make("decodebin", NULL);
- if (!decodebin)
- {
+ if (!decodebin) {
LOGE("fail to create decodebin\n");
goto ERROR;
}
@@ -11304,7 +10161,7 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
GstElement* decodebin = NULL;
GstElement* queue2 = NULL;
GstPad* sinkpad = NULL;
- GstPad* qsrcpad= NULL;
+ GstPad* qsrcpad = NULL;
gchar *caps_str = NULL;
gint64 dur_bytes = 0L;
@@ -11317,25 +10174,19 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
mainbin = player->pipeline->mainbin;
if ((!MMPLAYER_IS_HTTP_PD(player)) &&
- (MMPLAYER_IS_HTTP_STREAMING(player)))
- {
+ (MMPLAYER_IS_HTTP_STREAMING(player))) {
LOGD("creating http streaming buffering queue(queue2)\n");
- if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)
- {
+ if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) {
LOGE("MMPLAYER_M_MUXED_S_BUFFER is not null\n");
- }
- else
- {
+ } else {
queue2 = gst_element_factory_make("queue2", "queue2");
- if (!queue2)
- {
+ if (!queue2) {
LOGE("failed to create buffering queue element\n");
goto ERROR;
}
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue2))
- {
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue2)) {
LOGE("failed to add buffering queue\n");
goto ERROR;
}
@@ -11343,8 +10194,7 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
sinkpad = gst_element_get_static_pad(queue2, "sink");
qsrcpad = gst_element_get_static_pad(queue2, "src");
- if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) {
LOGE("failed to link buffering queue\n");
goto ERROR;
}
@@ -11369,9 +10219,8 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
/* NOTE : we cannot get any duration info from ts container in case of streaming */
// if (!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux"))
- if (!g_strrstr(player->type, "video/mpegts"))
- {
- max_buffer_size_bytes = (type == MUXED_BUFFER_TYPE_FILE)?(player->ini.http_max_size_bytes):(5*1024*1024);
+ if (!g_strrstr(player->type, "video/mpegts")) {
+ max_buffer_size_bytes = (type == MUXED_BUFFER_TYPE_FILE) ? (player->ini.http_max_size_bytes) : (5*1024*1024);
LOGD("max_buffer_size_bytes = %d\n", max_buffer_size_bytes);
__mm_player_streaming_set_queue2(player->streamer,
@@ -11386,8 +10235,7 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
(guint64)dur_bytes);
}
- if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(queue2))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(queue2)) {
LOGE("failed to sync queue2 state with parent\n");
goto ERROR;
}
@@ -11404,14 +10252,12 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
/* create decodebin */
decodebin = __mmplayer_create_decodebin(player);
- if (!decodebin)
- {
+ if (!decodebin) {
LOGE("can not create autoplug element\n");
goto ERROR;
}
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin))
- {
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin)) {
LOGE("failed to add decodebin\n");
goto ERROR;
}
@@ -11423,8 +10269,7 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
sinkpad = gst_element_get_static_pad(decodebin, "sink");
- if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) {
LOGE("failed to link decodebin\n");
goto ERROR;
}
@@ -11438,11 +10283,10 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
* in case of hls, it does not need to have big buffer *
* because it is kind of adaptive streaming. */
if (((!MMPLAYER_IS_HTTP_PD(player)) &&
- (MMPLAYER_IS_HTTP_STREAMING(player))) || MMPLAYER_IS_DASH_STREAMING(player))
- {
+ (MMPLAYER_IS_HTTP_STREAMING(player))) || MMPLAYER_IS_DASH_STREAMING(player)) {
guint max_size_bytes = MAX_DECODEBIN_BUFFER_BYTES;
guint64 max_size_time = MAX_DECODEBIN_BUFFER_TIME;
- init_buffering_time = (init_buffering_time != 0)?(init_buffering_time):(player->ini.http_buffering_time);
+ init_buffering_time = (init_buffering_time != 0) ? (init_buffering_time) : (player->ini.http_buffering_time);
if (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) {
max_size_bytes = MAX_DECODEBIN_ADAPTIVE_BUFFER_BYTES;
@@ -11457,8 +10301,7 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC
"max-size-buffers", 0, NULL); // disable or automatic
}
- if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(decodebin))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(decodebin)) {
LOGE("failed to sync decodebin state with parent\n");
goto ERROR;
}
@@ -11474,8 +10317,7 @@ ERROR:
if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
- if (queue2)
- {
+ if (queue2) {
/* NOTE : Trying to dispose element queue0, but it is in READY instead of the NULL state.
* You need to explicitly set elements to the NULL state before
* dropping the final reference, to allow them to clean up.
@@ -11490,8 +10332,7 @@ ERROR:
queue2 = NULL;
}
- if (decodebin)
- {
+ if (decodebin) {
/* NOTE : Trying to dispose element queue0, but it is in READY instead of the NULL state.
* You need to explicitly set elements to the NULL state before
* dropping the final reference, to allow them to clean up.
@@ -11530,12 +10371,11 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
mainbin = player->pipeline->mainbin;
- mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
+ mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
/* return if we got raw output */
if (g_str_has_prefix(mime, "video/x-raw") || g_str_has_prefix(mime, "audio/x-raw")
- || g_str_has_prefix(mime, "text/plain") ||g_str_has_prefix(mime, "text/x-pango-markup"))
- {
+ || g_str_has_prefix(mime, "text/plain") || g_str_has_prefix(mime, "text/x-pango-markup")) {
element = (GstElement*)gst_pad_get_parent(pad);
/* NOTE : When no decoder has added during autoplugging. like a simple wave playback.
@@ -11552,27 +10392,23 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
/* add queue if needed */
if ((g_strrstr(klass, "Demux") || g_strrstr(klass, "Depayloader")
- || g_strrstr(klass, "Parse")) && !g_str_has_prefix(mime, "text"))
- {
+ || g_strrstr(klass, "Parse")) && !g_str_has_prefix(mime, "text")) {
LOGD("adding raw queue\n");
queue = gst_element_factory_make("queue", NULL);
- if (!queue)
- {
+ if (!queue) {
LOGW("failed to create queue\n");
goto ERROR;
}
/* warmup */
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY)) {
LOGW("failed to set state READY to queue\n");
goto ERROR;
}
/* add to pipeline */
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue))
- {
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue)) {
LOGW("failed to add queue\n");
goto ERROR;
}
@@ -11580,8 +10416,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
/* link queue */
queue_pad = gst_element_get_static_pad(queue, "sink");
- if (GST_PAD_LINK_OK != gst_pad_link(pad, queue_pad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, queue_pad)) {
LOGW("failed to link queue\n");
goto ERROR;
}
@@ -11589,16 +10424,14 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
queue_pad = NULL;
/* running */
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED)) {
LOGW("failed to set state PAUSED to queue\n");
goto ERROR;
}
/* replace given pad to queue:src */
pad = gst_element_get_static_pad(queue, "src");
- if (!pad)
- {
+ if (!pad) {
LOGW("failed to get pad from queue\n");
goto ERROR;
}
@@ -11607,7 +10440,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
/* check if player can do start continually */
MMPLAYER_CHECK_CMD_IF_EXIT(player);
- if (__mmplayer_link_sink(player,pad))
+ if (__mmplayer_link_sink(player, pad))
__mmplayer_gst_decode_callback(element, pad, player);
gst_object_unref(GST_OBJECT(element));
@@ -11617,8 +10450,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
}
item = player->factories;
- for (; item != NULL ; item = item->next)
- {
+ for (; item != NULL; item = item->next) {
GstElementFactory *factory = GST_ELEMENT_FACTORY(item->data);
const GList *pads;
gint idx = 0;
@@ -11626,11 +10458,9 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
skip = FALSE;
/* filtering exclude keyword */
- for (idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++)
- {
+ for (idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++) {
if (g_strrstr(GST_OBJECT_NAME(factory),
- player->ini.exclude_element_keyword[idx]))
- {
+ player->ini.exclude_element_keyword[idx])) {
LOGW("skipping [%s] by exculde keyword [%s]\n",
GST_OBJECT_NAME(factory),
player->ini.exclude_element_keyword[idx]);
@@ -11640,8 +10470,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
}
}
- if (MMPLAYER_IS_RTSP_STREAMING(player) && g_strrstr(GST_OBJECT_NAME(factory), "omx_mpeg4dec"))
- {
+ if (MMPLAYER_IS_RTSP_STREAMING(player) && g_strrstr(GST_OBJECT_NAME(factory), "omx_mpeg4dec")) {
// omx decoder can not support mpeg4video data partitioned
// rtsp streaming didn't know mpeg4video data partitioned format
// so, if rtsp playback, player will skip omx_mpeg4dec.
@@ -11663,16 +10492,14 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
/* NOTE : msl don't need to use image plugins.
* So, those plugins should be skipped for error handling.
*/
- if (g_strrstr(klass, "Codec/Decoder/Image"))
- {
+ if (g_strrstr(klass, "Codec/Decoder/Image")) {
LOGD("skipping [%s] by not required\n", GST_OBJECT_NAME(factory));
continue;
}
/* check pad compatability */
for (pads = gst_element_factory_get_static_pad_templates(factory);
- pads != NULL; pads=pads->next)
- {
+ pads != NULL; pads = pads->next) {
GstStaticPadTemplate *temp1 = pads->data;
GstCaps* static_caps = NULL;
@@ -11680,23 +10507,18 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
|| temp1->presence != GST_PAD_ALWAYS)
continue;
+ /* using existing caps */
if (GST_IS_CAPS(&temp1->static_caps.caps))
- {
- /* using existing caps */
static_caps = gst_caps_ref(temp1->static_caps.caps);
- }
+ /* create one */
else
- {
- /* create one */
static_caps = gst_caps_from_string(temp1->static_caps.string);
- }
res = gst_caps_intersect((GstCaps*)caps, static_caps);
gst_caps_unref(static_caps);
static_caps = NULL;
- if (res && !gst_caps_is_empty(res))
- {
+ if (res && !gst_caps_is_empty(res)) {
GstElement *new_element;
GList *elements = player->parsers;
char *name_template = g_strdup(temp1->name_template);
@@ -11704,11 +10526,9 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
gst_caps_unref(res);
/* check ALP Codec can be used or not */
- if ((g_strrstr(klass, "Codec/Decoder/Audio")))
- {
+ if ((g_strrstr(klass, "Codec/Decoder/Audio"))) {
/* consider mp3 audio only */
- if (!MMPLAYER_IS_STREAMING(player) && __mmplayer_is_only_mp3_type(player->type))
- {
+ if (!MMPLAYER_IS_STREAMING(player) && __mmplayer_is_only_mp3_type(player->type)) {
/* try to use ALP decoder first instead of selected decoder */
GstElement *element = NULL;
GstElementFactory * element_facory;
@@ -11720,34 +10540,28 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
mm_attrs_get_string_by_name(player->attrs, "profile_uri", &path);
if (stat(path, &sb) == 0)
- {
data_size = (guint64)sb.st_size;
- }
LOGD("file size : %u", data_size);
- if (data_size > MIN_THRESHOLD_SIZE)
- {
+ if (data_size > MIN_THRESHOLD_SIZE) {
LOGD("checking if ALP can be used or not");
element = gst_element_factory_make("omx_mp3dec", "omx mp3 decoder");
- if (element)
- {
+ if (element) {
/* check availability because multi-instance is not supported */
GstStateChangeReturn ret = gst_element_set_state(element, GST_STATE_READY);
- if (ret != GST_STATE_CHANGE_SUCCESS) // use just selected decoder
- {
+ if (ret != GST_STATE_CHANGE_SUCCESS) {
+ // use just selected decoder
gst_object_unref(element);
- }
- else if (ret == GST_STATE_CHANGE_SUCCESS) // replace facotry to use omx
- {
+ } else if (ret == GST_STATE_CHANGE_SUCCESS) {
+ // replace facotry to use omx
/* clean */
gst_element_set_state(element, GST_STATE_NULL);
gst_object_unref(element);
element_facory = gst_element_factory_find("omx_mp3dec");
/* replace, otherwise use selected thing instead */
- if (element_facory)
- {
+ if (element_facory) {
factory = element_facory;
name_to_plug = GST_OBJECT_NAME(factory);
}
@@ -11755,16 +10569,11 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
}
}
}
- }
- else if ((g_strrstr(klass, "Codec/Decoder/Video")))
- {
- if (g_strrstr(GST_OBJECT_NAME(factory), "omx_"))
- {
+ } else if ((g_strrstr(klass, "Codec/Decoder/Video"))) {
+ if (g_strrstr(GST_OBJECT_NAME(factory), "omx_")) {
char *env = getenv("MM_PLAYER_HW_CODEC_DISABLE");
- if (env != NULL)
- {
- if (strncasecmp(env, "yes", 3) == 0)
- {
+ if (env != NULL) {
+ if (strncasecmp(env, "yes", 3) == 0) {
LOGD("skipping [%s] by disabled\n", name_to_plug);
MMPLAYER_FREEIF(name_template);
continue;
@@ -11776,8 +10585,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
LOGD("found %s to plug\n", name_to_plug);
new_element = gst_element_factory_create(GST_ELEMENT_FACTORY(factory), NULL);
- if (!new_element)
- {
+ if (!new_element) {
LOGE("failed to create element [%s]. continue with next.\n",
GST_OBJECT_NAME(factory));
@@ -11789,23 +10597,19 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
/* check and skip it if it was already used. Otherwise, it can be an infinite loop
* because parser can accept its own output as input.
*/
- if (g_strrstr(klass, "Parser"))
- {
+ if (g_strrstr(klass, "Parser")) {
gchar *selected = NULL;
- for (; elements; elements = g_list_next(elements))
- {
+ for (; elements; elements = g_list_next(elements)) {
gchar *element_name = elements->data;
- if (g_strrstr(element_name, name_to_plug))
- {
+ if (g_strrstr(element_name, name_to_plug)) {
LOGD("but, %s already linked, so skipping it\n", name_to_plug);
skip = TRUE;
}
}
- if (skip)
- {
+ if (skip) {
MMPLAYER_FREEIF(name_template);
continue;
}
@@ -11815,8 +10619,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
}
/* store specific handles for futher control */
- if (g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse"))
- {
+ if (g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse")) {
/* FIXIT : first value will be overwritten if there's more
* than 1 demuxer/parser
*/
@@ -11825,35 +10628,26 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
mainbin[MMPLAYER_M_DEMUX].gst = new_element;
/*Added for multi audio support */
- if (g_strrstr(klass, "Demux"))
- {
+ if (g_strrstr(klass, "Demux")) {
mainbin[MMPLAYER_M_DEMUX_EX].id = MMPLAYER_M_DEMUX_EX;
mainbin[MMPLAYER_M_DEMUX_EX].gst = new_element;
/* NOTE : workaround for bug in mpegtsdemux since doesn't emit
no-more-pad signal. this may cause wrong content attributes at PAUSED state
this code should be removed after mpegtsdemux is fixed */
- if (g_strrstr(GST_OBJECT_NAME(factory), "mpegtsdemux"))
- {
+ if (g_strrstr(GST_OBJECT_NAME(factory), "mpegtsdemux")) {
LOGW("force no-more-pad to TRUE since mpegtsdemux os not giving no-more-pad signal. content attributes may wrong");
player->no_more_pad = TRUE;
}
}
if (g_strrstr(name_to_plug, "asfdemux")) // to support trust-zone only
- {
- g_object_set(mainbin[MMPLAYER_M_DEMUX_EX].gst, "file-location", player->profile.uri,NULL);
- }
- }
- else if (g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player,pad))
- {
- if (mainbin[MMPLAYER_M_DEC1].gst == NULL)
- {
+ g_object_set(mainbin[MMPLAYER_M_DEMUX_EX].gst, "file-location", player->profile.uri, NULL);
+ } else if (g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player, pad)) {
+ if (mainbin[MMPLAYER_M_DEC1].gst == NULL) {
LOGD("plugged element is decoder. take it[MMPLAYER_M_DEC1]\n");
mainbin[MMPLAYER_M_DEC1].id = MMPLAYER_M_DEC1;
mainbin[MMPLAYER_M_DEC1].gst = new_element;
- }
- else if (mainbin[MMPLAYER_M_DEC2].gst == NULL)
- {
+ } else if (mainbin[MMPLAYER_M_DEC2].gst == NULL) {
LOGD("plugged element is decoder. take it[MMPLAYER_M_DEC2]\n");
mainbin[MMPLAYER_M_DEC2].id = MMPLAYER_M_DEC2;
mainbin[MMPLAYER_M_DEC2].gst = new_element;
@@ -11863,8 +10657,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
* before returning result of play start. And, missing plugin should be
* updated here for multi track files.
*/
- if (g_str_has_prefix(mime, "video"))
- {
+ if (g_str_has_prefix(mime, "video")) {
GstPad *src_pad = NULL;
GstPadTemplate *pad_templ = NULL;
GstCaps *caps = NULL;
@@ -11883,9 +10676,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
/* clean */
MMPLAYER_FREEIF(caps_str);
gst_object_unref(src_pad);
- }
- else if (g_str_has_prefix(mime, "audio"))
- {
+ } else if (g_str_has_prefix(mime, "audio")) {
LOGD("found AUDIO decoder\n");
player->not_supported_codec &= MISSING_PLUGIN_VIDEO;
player->can_support_codec |= FOUND_PLUGIN_AUDIO;
@@ -11893,11 +10684,10 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
}
if (!__mmplayer_close_link(player, pad, new_element,
- name_template,gst_element_factory_get_static_pad_templates(factory)))
- {
+ name_template, gst_element_factory_get_static_pad_templates(factory))) {
MMPLAYER_FREEIF(name_template);
if (player->keep_detecting_vcodec)
- continue;
+ continue;
/* Link is failed even though a supportable codec is found. */
__mmplayer_check_not_supported_codec(player, klass, mime);
@@ -11951,10 +10741,8 @@ __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_c
* Some motion jpeg clips can have playable audio track.
* So, msl have to play audio after displaying popup written video format not supported.
*/
- if (!(player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst))
- {
- if (!(player->can_support_codec | player->videodec_linked | player->audiodec_linked))
- {
+ if (!(player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst)) {
+ if (!(player->can_support_codec | player->videodec_linked | player->audiodec_linked)) {
LOGD("not found demuxer\n");
player->not_found_demuxer = TRUE;
player->unlinked_demuxer_mime = g_strdup_printf("%s", mime);
@@ -11963,32 +10751,22 @@ __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_c
}
}
- if (!g_strrstr(factory_class, "Demuxer"))
- {
- if ((g_str_has_prefix(mime, "video")) || (g_str_has_prefix(mime, "image")))
- {
+ if (!g_strrstr(factory_class, "Demuxer")) {
+ if ((g_str_has_prefix(mime, "video")) || (g_str_has_prefix(mime, "image"))) {
LOGD("can support codec=%d, vdec_linked=%d, adec_linked=%d\n",
player->can_support_codec, player->videodec_linked, player->audiodec_linked);
/* check that clip have multi tracks or not */
- if ((player->can_support_codec & FOUND_PLUGIN_VIDEO) && (player->videodec_linked))
- {
+ if ((player->can_support_codec & FOUND_PLUGIN_VIDEO) && (player->videodec_linked)) {
LOGD("video plugin is already linked\n");
- }
- else
- {
+ } else {
LOGW("add VIDEO to missing plugin\n");
player->not_supported_codec |= MISSING_PLUGIN_VIDEO;
}
- }
- else if (g_str_has_prefix(mime, "audio"))
- {
- if ((player->can_support_codec & FOUND_PLUGIN_AUDIO) && (player->audiodec_linked))
- {
+ } else if (g_str_has_prefix(mime, "audio")) {
+ if ((player->can_support_codec & FOUND_PLUGIN_AUDIO) && (player->audiodec_linked)) {
LOGD("audio plugin is already linked\n");
- }
- else
- {
+ } else {
LOGW("add AUDIO to missing plugin\n");
player->not_supported_codec |= MISSING_PLUGIN_AUDIO;
}
@@ -12005,7 +10783,7 @@ DONE:
static void
__mmplayer_pipeline_complete(GstElement *decodebin, gpointer data)
{
- mm_player_t* player = (mm_player_t*)data;
+ mm_player_t* player = (mm_player_t*)data;
MMPLAYER_FENTER();
@@ -12013,8 +10791,7 @@ __mmplayer_pipeline_complete(GstElement *decodebin, gpointer data)
/* remove fakesink. */
if (!__mmplayer_gst_remove_fakesink(player,
- &player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK]))
- {
+ &player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK])) {
/* NOTE : __mmplayer_pipeline_complete() can be called several time. because
* signaling mechanism(pad-added, no-more-pad, new-decoded-pad) from various
* source element are not same. To overcome this situation, this function will called
@@ -12028,9 +10805,7 @@ __mmplayer_pipeline_complete(GstElement *decodebin, gpointer data)
if ((player->ini.async_start) &&
(player->msg_posted == FALSE) &&
(player->cmd >= MMPLAYER_COMMAND_START))
- {
__mmplayer_handle_missed_plugin(player);
- }
MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-complete");
}
@@ -12052,15 +10827,13 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
LOGD("checking for gapless play");
- if (player->pipeline->textbin)
- {
+ if (player->pipeline->textbin) {
LOGE("subtitle path is enabled. gapless play is not supported.\n");
goto ERROR;
}
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("fail to get attributes.\n");
goto ERROR;
}
@@ -12069,34 +10842,26 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
#ifdef TIZEN_TV
/* gapless playback is not supported in case of video at TV profile. */
- if (video)
- {
+ if (video) {
LOGW("not support video gapless playback");
goto ERROR;
}
#endif
- if (mm_attrs_get_int_by_name(attrs, "pd_mode", &mode) == MM_ERROR_NONE)
- {
- if (mode == TRUE)
- {
+ if (mm_attrs_get_int_by_name(attrs, "pd_mode", &mode) == MM_ERROR_NONE) {
+ if (mode == TRUE) {
LOGW("pd mode\n");
goto ERROR;
}
}
if (mm_attrs_get_int_by_name(attrs, "profile_play_count", &count) != MM_ERROR_NONE)
- {
LOGE("can not get play count\n");
- }
if (mm_attrs_get_int_by_name(attrs, "gapless_mode", &gapless) != MM_ERROR_NONE)
- {
LOGE("can not get gapless mode\n");
- }
- if (video && !gapless)
- {
+ if (video && !gapless) {
LOGW("not enabled video gapless playback");
goto ERROR;
}
@@ -12104,8 +10869,7 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
if ((count == -1 || count > 1)) /* enable gapless when looping or repeat */
gapless = 1;
- if (!gapless)
- {
+ if (!gapless) {
LOGW("gapless is disabled\n"); /* FIXME: playlist(without gapless) is not implemented. */
goto ERROR;
}
@@ -12114,16 +10878,13 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
LOGD("repeat count = %d, num_of_list = %d\n", count, num_of_list);
- if (num_of_list == 0)
- {
- if (mm_attrs_get_string_by_name(player->attrs, "profile_uri", &uri) != MM_ERROR_NONE)
- {
+ if (num_of_list == 0) {
+ if (mm_attrs_get_string_by_name(player->attrs, "profile_uri", &uri) != MM_ERROR_NONE) {
LOGE("can not get profile_uri\n");
goto ERROR;
}
- if (!uri)
- {
+ if (!uri) {
LOGE("uri list is empty.\n");
goto ERROR;
}
@@ -12132,46 +10893,37 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
LOGD("add original path : %s ", uri);
num_of_list = 1;
- uri= NULL;
+ uri = NULL;
}
uri_idx = player->uri_info.uri_idx;
- while (TRUE)
- {
+ while (TRUE) {
check_cnt++;
- if (check_cnt > num_of_list)
- {
+ if (check_cnt > num_of_list) {
LOGE("there is no valid uri.");
goto ERROR;
}
LOGD("uri idx : %d / %d\n", uri_idx, num_of_list);
- if (uri_idx < num_of_list-1)
- {
+ if (uri_idx < num_of_list-1) {
uri_idx++;
- }
- else
- {
- if ((count <= 1) && (count != -1))
- {
+ } else {
+ if ((count <= 1) && (count != -1)) {
LOGD("no repeat.");
goto ERROR;
- }
- else if (count > 1) /* decrease play count */
- {
- /* we successeded to rewind. update play count and then wait for next EOS */
+ } else if (count > 1) {
+ /* decrease play count */
+ /* we succeeded to rewind. update play count and then wait for next EOS */
count--;
mm_attrs_set_int_by_name(attrs, "profile_play_count", count);
/* commit attribute */
if (mmf_attrs_commit(attrs))
- {
LOGE("failed to commit attribute\n");
- }
}
/* count < 0 : repeat continually */
@@ -12181,21 +10933,18 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
uri = g_list_nth_data(player->uri_info.uri_list, uri_idx);
LOGD("uri idx : %d, uri = %s\n", uri_idx, uri);
- if (uri == NULL)
- {
+ if (uri == NULL) {
LOGW("next uri does not exist\n");
continue;
}
- if (__mmfplayer_parse_profile((const char*)uri, NULL, &profile) != MM_ERROR_NONE)
- {
+ if (__mmfplayer_parse_profile((const char*)uri, NULL, &profile) != MM_ERROR_NONE) {
LOGE("failed to parse profile\n");
continue;
}
if ((profile.uri_type != MM_PLAYER_URI_TYPE_FILE) &&
- (profile.uri_type != MM_PLAYER_URI_TYPE_URL_HTTP))
- {
+ (profile.uri_type != MM_PLAYER_URI_TYPE_URL_HTTP)) {
LOGW("uri type is not supported(%d).", profile.uri_type);
continue;
}
@@ -12206,8 +10955,7 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
player->uri_info.uri_idx = uri_idx;
mm_attrs_set_string_by_name(player->attrs, "profile_uri", uri);
- if (mmf_attrs_commit(player->attrs))
- {
+ if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit.\n");
goto ERROR;
}
@@ -12259,14 +11007,12 @@ __mmplayer_initialize_next_play(mm_player_t *player)
_mmplayer_track_initialize(player);
- for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++)
- {
+ for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++) {
player->bitrate[i] = 0;
player->maximum_bitrate[i] = 0;
}
- if (player->v_stream_caps)
- {
+ if (player->v_stream_caps) {
gst_caps_unref(player->v_stream_caps);
player->v_stream_caps = NULL;
}
@@ -12275,11 +11021,9 @@ __mmplayer_initialize_next_play(mm_player_t *player)
mm_attrs_set_int_by_name(player->attrs, "content_audio_found", 0);
/* clean found parsers */
- if (player->parsers)
- {
+ if (player->parsers) {
GList *parsers = player->parsers;
- for (;parsers ; parsers = g_list_next(parsers))
- {
+ for (; parsers; parsers = g_list_next(parsers)) {
gchar *name = parsers->data;
MMPLAYER_FREEIF(name);
}
@@ -12288,11 +11032,9 @@ __mmplayer_initialize_next_play(mm_player_t *player)
}
/* clean found audio decoders */
- if (player->audio_decoders)
- {
+ if (player->audio_decoders) {
GList *a_dec = player->audio_decoders;
- for (;a_dec ; a_dec = g_list_next(a_dec))
- {
+ for (; a_dec; a_dec = g_list_next(a_dec)) {
gchar *name = a_dec->data;
MMPLAYER_FREEIF(name);
}
@@ -12317,8 +11059,7 @@ __mmplayer_activate_next_source(mm_player_t *player, GstState target)
if ((player == NULL) ||
(player->pipeline == NULL) ||
- (player->pipeline->mainbin == NULL))
- {
+ (player->pipeline->mainbin == NULL)) {
LOGE("player is null.\n");
goto ERROR;
}
@@ -12327,8 +11068,7 @@ __mmplayer_activate_next_source(mm_player_t *player, GstState target)
msg_param.code = MM_ERROR_PLAYER_INTERNAL;
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("fail to get attributes.\n");
goto ERROR;
}
@@ -12338,103 +11078,95 @@ __mmplayer_activate_next_source(mm_player_t *player, GstState target)
mm_attrs_get_string_by_name(attrs, "profile_uri", &uri);
- if (__mmfplayer_parse_profile((const char*)uri, NULL, &player->profile) != MM_ERROR_NONE)
- {
+ if (__mmfplayer_parse_profile((const char*)uri, NULL, &player->profile) != MM_ERROR_NONE) {
LOGE("failed to parse profile\n");
msg_param.code = MM_ERROR_PLAYER_INVALID_URI;
goto ERROR;
}
if ((MMPLAYER_URL_HAS_DASH_SUFFIX(player)) ||
- (MMPLAYER_URL_HAS_HLS_SUFFIX(player)))
- {
+ (MMPLAYER_URL_HAS_HLS_SUFFIX(player))) {
LOGE("it's dash or hls. not support.");
msg_param.code = MM_ERROR_PLAYER_INVALID_URI;
goto ERROR;
}
/* setup source */
- switch (player->profile.uri_type)
+ switch (player->profile.uri_type) {
+ /* file source */
+ case MM_PLAYER_URI_TYPE_FILE:
{
- /* file source */
- case MM_PLAYER_URI_TYPE_FILE:
- {
- LOGD("using filesrc for 'file://' handler.\n");
+ LOGD("using filesrc for 'file://' handler.\n");
- element = gst_element_factory_make("filesrc", "source");
-
- if (!element)
- {
- LOGE("failed to create filesrc\n");
- break;
- }
+ element = gst_element_factory_make("filesrc", "source");
- g_object_set(G_OBJECT(element), "location", (player->profile.uri)+7, NULL); /* uri+7 -> remove "file:// */
+ if (!element) {
+ LOGE("failed to create filesrc\n");
break;
}
- case MM_PLAYER_URI_TYPE_URL_HTTP:
- {
- gchar *user_agent, *proxy, *cookies, **cookie_list;
- gint http_timeout = DEFAULT_HTTP_TIMEOUT;
- user_agent = proxy = cookies = NULL;
- cookie_list = NULL;
-
- element = gst_element_factory_make(player->ini.httpsrc_element, "http_streaming_source");
- if (!element)
- {
- LOGE("failed to create http streaming source element[%s].\n", player->ini.httpsrc_element);
- break;
- }
- LOGD("using http streamming source [%s].\n", player->ini.httpsrc_element);
- /* get attribute */
- mm_attrs_get_string_by_name(attrs, "streaming_cookie", &cookies);
- mm_attrs_get_string_by_name(attrs, "streaming_user_agent", &user_agent);
- mm_attrs_get_string_by_name(attrs, "streaming_proxy", &proxy);
- mm_attrs_get_int_by_name(attrs, "streaming_timeout", &http_timeout);
-
- if ((http_timeout == DEFAULT_HTTP_TIMEOUT) &&
- (player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT))
- {
- LOGD("get timeout from ini\n");
- http_timeout = player->ini.http_timeout;
- }
-
- /* get attribute */
- SECURE_LOGD("location : %s\n", player->profile.uri);
- SECURE_LOGD("cookies : %s\n", cookies);
- SECURE_LOGD("proxy : %s\n", proxy);
- SECURE_LOGD("user_agent : %s\n", user_agent);
- LOGD("timeout : %d\n", http_timeout);
+ g_object_set(G_OBJECT(element), "location", (player->profile.uri)+7, NULL); /* uri+7 -> remove "file:// */
+ break;
+ }
+ case MM_PLAYER_URI_TYPE_URL_HTTP:
+ {
+ gchar *user_agent, *proxy, *cookies, **cookie_list;
+ gint http_timeout = DEFAULT_HTTP_TIMEOUT;
+ user_agent = proxy = cookies = NULL;
+ cookie_list = NULL;
- /* setting property to streaming source */
- g_object_set(G_OBJECT(element), "location", player->profile.uri, NULL);
- g_object_set(G_OBJECT(element), "timeout", http_timeout, NULL);
- g_object_set(G_OBJECT(element), "blocksize", (unsigned long)(64*1024), NULL);
-
- /* check if prosy is vailid or not */
- 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)))
- g_object_set(G_OBJECT(element), "cookies", cookie_list, NULL);
- if (user_agent)
- g_object_set(G_OBJECT(element), "user_agent", user_agent, NULL);
+ element = gst_element_factory_make(player->ini.httpsrc_element, "http_streaming_source");
+ if (!element) {
+ LOGE("failed to create http streaming source element[%s].\n", player->ini.httpsrc_element);
break;
}
- default:
- LOGE("not support uri type %d\n", player->profile.uri_type);
- break;
+ LOGD("using http streamming source [%s].\n", player->ini.httpsrc_element);
+
+ /* get attribute */
+ mm_attrs_get_string_by_name(attrs, "streaming_cookie", &cookies);
+ mm_attrs_get_string_by_name(attrs, "streaming_user_agent", &user_agent);
+ mm_attrs_get_string_by_name(attrs, "streaming_proxy", &proxy);
+ mm_attrs_get_int_by_name(attrs, "streaming_timeout", &http_timeout);
+
+ if ((http_timeout == DEFAULT_HTTP_TIMEOUT) &&
+ (player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT)) {
+ LOGD("get timeout from ini\n");
+ http_timeout = player->ini.http_timeout;
+ }
+
+ /* get attribute */
+ SECURE_LOGD("location : %s\n", player->profile.uri);
+ SECURE_LOGD("cookies : %s\n", cookies);
+ SECURE_LOGD("proxy : %s\n", proxy);
+ SECURE_LOGD("user_agent : %s\n", user_agent);
+ LOGD("timeout : %d\n", http_timeout);
+
+ /* setting property to streaming source */
+ g_object_set(G_OBJECT(element), "location", player->profile.uri, NULL);
+ g_object_set(G_OBJECT(element), "timeout", http_timeout, NULL);
+ g_object_set(G_OBJECT(element), "blocksize", (unsigned long)(64*1024), NULL);
+
+ /* check if prosy is vailid or not */
+ 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)))
+ g_object_set(G_OBJECT(element), "cookies", cookie_list, NULL);
+ if (user_agent)
+ g_object_set(G_OBJECT(element), "user_agent", user_agent, NULL);
+ break;
+ }
+ default:
+ LOGE("not support uri type %d\n", player->profile.uri_type);
+ break;
}
- if (!element)
- {
+ if (!element) {
LOGE("no source element was created.\n");
goto ERROR;
}
- if (gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element) == FALSE)
- {
+ if (gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element) == FALSE) {
LOGE("failed to add source element to pipeline\n");
gst_object_unref(GST_OBJECT(element));
element = NULL;
@@ -12447,10 +11179,8 @@ __mmplayer_activate_next_source(mm_player_t *player, GstState target)
element = NULL;
- if (MMPLAYER_IS_HTTP_STREAMING(player))
- {
- if (player->streamer == NULL)
- {
+ if (MMPLAYER_IS_HTTP_STREAMING(player)) {
+ if (player->streamer == NULL) {
player->streamer = __mm_player_streaming_create();
__mm_player_streaming_initialize(player->streamer);
}
@@ -12459,22 +11189,18 @@ __mmplayer_activate_next_source(mm_player_t *player, GstState target)
element = gst_element_factory_make("typefind", "typefinder");
MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "have-type",
G_CALLBACK(__mmplayer_typefind_have_type), (gpointer)player);
- }
- else
- {
+ } else {
elemId = MMPLAYER_M_AUTOPLUG;
element = __mmplayer_create_decodebin(player);
}
/* check autoplug element is OK */
- if (!element)
- {
+ if (!element) {
LOGE("can not create element(%d)\n", elemId);
goto ERROR;
}
- if (gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element) == FALSE)
- {
+ if (gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element) == FALSE) {
LOGE("failed to add sinkbin to pipeline\n");
gst_object_unref(GST_OBJECT(element));
element = NULL;
@@ -12484,30 +11210,23 @@ __mmplayer_activate_next_source(mm_player_t *player, GstState target)
mainbin[elemId].id = elemId;
mainbin[elemId].gst = element;
- if (gst_element_link(mainbin[MMPLAYER_M_SRC].gst, mainbin[elemId].gst) == FALSE)
- {
+ if (gst_element_link(mainbin[MMPLAYER_M_SRC].gst, mainbin[elemId].gst) == FALSE) {
LOGE("Failed to link src - autoplug(or typefind)\n");
goto ERROR;
}
- if (gst_element_set_state(mainbin[MMPLAYER_M_SRC].gst, target) == GST_STATE_CHANGE_FAILURE)
- {
+ if (gst_element_set_state(mainbin[MMPLAYER_M_SRC].gst, target) == GST_STATE_CHANGE_FAILURE) {
LOGE("Failed to change state of src element\n");
goto ERROR;
}
- if (!MMPLAYER_IS_HTTP_STREAMING(player))
- {
- if (gst_element_set_state(mainbin[MMPLAYER_M_AUTOPLUG].gst, target) == GST_STATE_CHANGE_FAILURE)
- {
+ if (!MMPLAYER_IS_HTTP_STREAMING(player)) {
+ if (gst_element_set_state(mainbin[MMPLAYER_M_AUTOPLUG].gst, target) == GST_STATE_CHANGE_FAILURE) {
LOGE("Failed to change state of decodebin\n");
goto ERROR;
}
- }
- else
- {
- if (gst_element_set_state(mainbin[MMPLAYER_M_TYPEFIND].gst, target) == GST_STATE_CHANGE_FAILURE)
- {
+ } else {
+ if (gst_element_set_state(mainbin[MMPLAYER_M_TYPEFIND].gst, target) == GST_STATE_CHANGE_FAILURE) {
LOGE("Failed to change state of src element\n");
goto ERROR;
}
@@ -12519,12 +11238,10 @@ __mmplayer_activate_next_source(mm_player_t *player, GstState target)
return;
ERROR:
- if (player)
- {
+ if (player) {
MMPLAYER_PLAYBACK_UNLOCK(player);
- if (!player->msg_posted)
- {
+ if (!player->msg_posted) {
MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
player->msg_posted = TRUE;
}
@@ -12548,32 +11265,30 @@ __mmplayer_deactivate_selector(mm_player_t *player, MMPlayerTrackType type)
LOGD("type %d", type);
- switch (type)
- {
- case MM_PLAYER_TRACK_TYPE_AUDIO:
- selectorId = MMPLAYER_M_A_INPUT_SELECTOR;
- sinkId = MMPLAYER_A_BIN;
- sinkbin = player->pipeline->audiobin;
+ switch (type) {
+ case MM_PLAYER_TRACK_TYPE_AUDIO:
+ selectorId = MMPLAYER_M_A_INPUT_SELECTOR;
+ sinkId = MMPLAYER_A_BIN;
+ sinkbin = player->pipeline->audiobin;
break;
- case MM_PLAYER_TRACK_TYPE_VIDEO:
- selectorId = MMPLAYER_M_V_INPUT_SELECTOR;
- sinkId = MMPLAYER_V_BIN;
- sinkbin = player->pipeline->videobin;
- send_notice = TRUE;
+ case MM_PLAYER_TRACK_TYPE_VIDEO:
+ selectorId = MMPLAYER_M_V_INPUT_SELECTOR;
+ sinkId = MMPLAYER_V_BIN;
+ sinkbin = player->pipeline->videobin;
+ send_notice = TRUE;
break;
- case MM_PLAYER_TRACK_TYPE_TEXT:
- selectorId = MMPLAYER_M_T_INPUT_SELECTOR;
- sinkId = MMPLAYER_T_BIN;
- sinkbin = player->pipeline->textbin;
+ case MM_PLAYER_TRACK_TYPE_TEXT:
+ selectorId = MMPLAYER_M_T_INPUT_SELECTOR;
+ sinkId = MMPLAYER_T_BIN;
+ sinkbin = player->pipeline->textbin;
break;
- default:
- LOGE("requested type is not supportable");
- return FALSE;
+ default:
+ LOGE("requested type is not supportable");
+ return FALSE;
break;
}
- if (player->pipeline->mainbin[selectorId].gst)
- {
+ if (player->pipeline->mainbin[selectorId].gst) {
gint n;
srcpad = gst_element_get_static_pad(player->pipeline->mainbin[selectorId].gst, "src");
@@ -12582,12 +11297,10 @@ __mmplayer_deactivate_selector(mm_player_t *player, MMPlayerTrackType type)
gst_pad_remove_probe(srcpad, selector->event_probe_id);
selector->event_probe_id = 0;
- if ((sinkbin) && (sinkbin[sinkId].gst))
- {
+ if ((sinkbin) && (sinkbin[sinkId].gst)) {
sinkpad = gst_element_get_static_pad(sinkbin[sinkId].gst, "sink");
- if (srcpad && sinkpad)
- {
+ if (srcpad && sinkpad) {
/* after getting drained signal there is no data flows, so no need to do pad_block */
LOGD("unlink %s:%s, %s:%s", GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
gst_pad_unlink(srcpad, sinkpad);
@@ -12610,8 +11323,7 @@ __mmplayer_deactivate_selector(mm_player_t *player, MMPlayerTrackType type)
LOGD("selector release");
/* release and unref requests pad from the selector */
- for (n = 0; n < selector->channels->len; n++)
- {
+ for (n = 0; n < selector->channels->len; n++) {
GstPad *sinkpad = g_ptr_array_index(selector->channels, n);
gst_element_release_request_pad((player->pipeline->mainbin[selectorId].gst), sinkpad);
}
@@ -12635,8 +11347,7 @@ __mmplayer_deactivate_old_path(mm_player_t *player)
if ((!__mmplayer_deactivate_selector(player, MM_PLAYER_TRACK_TYPE_AUDIO)) ||
(!__mmplayer_deactivate_selector(player, MM_PLAYER_TRACK_TYPE_VIDEO)) ||
- (!__mmplayer_deactivate_selector(player, MM_PLAYER_TRACK_TYPE_TEXT)))
- {
+ (!__mmplayer_deactivate_selector(player, MM_PLAYER_TRACK_TYPE_TEXT))) {
LOGE("deactivate selector error");
goto ERROR;
}
@@ -12644,8 +11355,7 @@ __mmplayer_deactivate_old_path(mm_player_t *player)
_mmplayer_track_destroy(player);
__mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG);
- if (player->streamer)
- {
+ if (player->streamer) {
__mm_player_streaming_deinitialize(player->streamer);
__mm_player_streaming_destroy(player->streamer);
player->streamer = NULL;
@@ -12659,8 +11369,7 @@ __mmplayer_deactivate_old_path(mm_player_t *player)
ERROR:
- if (!player->msg_posted)
- {
+ if (!player->msg_posted) {
MMMessageParamType msg = {0,};
/*post error*/
@@ -12698,17 +11407,12 @@ int _mmplayer_set_uri(MMHandleType hplayer, const char* uri)
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
mm_attrs_set_string_by_name(player->attrs, "profile_uri", uri);
- if (mmf_attrs_commit(player->attrs))
- {
+ if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit the original uri.\n");
result = MM_ERROR_PLAYER_INTERNAL;
- }
- else
- {
+ } else {
if (_mmplayer_set_next_uri(hplayer, uri, TRUE) != MM_ERROR_NONE)
- {
LOGE("failed to add the original uri in the uri list.\n");
- }
}
MMPLAYER_FLEAVE();
@@ -12725,44 +11429,34 @@ int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_RETURN_VAL_IF_FAIL(uri, MM_ERROR_INVALID_ARGUMENT);
- if (player->pipeline && player->pipeline->textbin)
- {
+ if (player->pipeline && player->pipeline->textbin) {
LOGE("subtitle path is enabled.\n");
return MM_ERROR_PLAYER_INVALID_STATE;
}
num_of_list = g_list_length(player->uri_info.uri_list);
- if (is_first_path == TRUE)
- {
- if (num_of_list == 0)
- {
+ if (is_first_path == TRUE) {
+ if (num_of_list == 0) {
player->uri_info.uri_list = g_list_append(player->uri_info.uri_list, g_strdup(uri));
LOGD("add original path : %s", uri);
- }
- else
- {
+ } else {
player->uri_info.uri_list = g_list_delete_link(player->uri_info.uri_list, g_list_nth(player->uri_info.uri_list, 0));
player->uri_info.uri_list = g_list_insert(player->uri_info.uri_list, g_strdup(uri), 0);
LOGD("change original path : %s", uri);
}
- }
- else
- {
+ } else {
MMHandleType attrs = 0;
attrs = MMPLAYER_GET_ATTRS(player);
- if (num_of_list == 0)
- {
+ if (num_of_list == 0) {
char *original_uri = NULL;
- if (attrs)
- {
+ if (attrs) {
mm_attrs_get_string_by_name(attrs, "profile_uri", &original_uri);
- if (!original_uri)
- {
+ if (!original_uri) {
LOGE("there is no original uri.");
return MM_ERROR_PLAYER_INVALID_STATE;
}
@@ -12793,8 +11487,7 @@ int _mmplayer_get_next_uri(MMHandleType hplayer, char** uri)
num_of_list = g_list_length(player->uri_info.uri_list);
- if (num_of_list > 0)
- {
+ if (num_of_list > 0) {
gint uri_idx = player->uri_info.uri_idx;
if (uri_idx < num_of_list-1)
@@ -12862,9 +11555,8 @@ GstCaps * caps, gpointer data)
caps_str = gst_caps_to_string(caps);
/* set it directly because not sent by TAG */
- if (g_strrstr(caps_str, "mobile-xmf")) {
+ if (g_strrstr(caps_str, "mobile-xmf"))
mm_attrs_set_string_by_name(player->attrs, "content_audio_codec", "mobile-xmf");
- }
MMPLAYER_FREEIF(caps_str);
} else if (g_str_has_prefix(mime, "video") && !player->ini.video_playback_supported) {
MMMessageParamType msg_param;
@@ -12911,8 +11603,7 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
LOGD("found new element [%s] to link", factory_name);
/* store type string */
- if (player->type == NULL)
- {
+ if (player->type == NULL) {
player->type = gst_caps_to_string(caps);
__mmplayer_update_content_type_info(player);
}
@@ -12921,18 +11612,15 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
mm_attrs_get_int_by_name(player->attrs,
"display_surface_type", &surface_type);
LOGD("check display surface type attribute: %d", surface_type);
- if (surface_type == MM_DISPLAY_SURFACE_EVAS && strstr(factory_name, "omx"))
- {
+ if (surface_type == MM_DISPLAY_SURFACE_EVAS && strstr(factory_name, "omx")) {
LOGW("skipping [%s] for supporting evasimagesink temporarily.\n", factory_name);
result = GST_AUTOPLUG_SELECT_SKIP;
goto DONE;
}
/* filtering exclude keyword */
- for (idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++)
- {
- if (strstr(factory_name, player->ini.exclude_element_keyword[idx]))
- {
+ for (idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++) {
+ if (strstr(factory_name, player->ini.exclude_element_keyword[idx])) {
LOGW("skipping [%s] by exculde keyword [%s]\n",
factory_name, player->ini.exclude_element_keyword[idx]);
@@ -12946,24 +11634,21 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
/* NOTE : msl don't need to use image plugins.
* So, those plugins should be skipped for error handling.
*/
- if (g_strrstr(klass, "Codec/Decoder/Image"))
- {
+ if (g_strrstr(klass, "Codec/Decoder/Image")) {
LOGD("skipping [%s] by not required\n", factory_name);
result = GST_AUTOPLUG_SELECT_SKIP;
goto DONE;
}
if ((MMPLAYER_IS_MS_BUFF_SRC(player)) &&
- (g_strrstr(klass, "Codec/Demuxer") || (g_strrstr(klass, "Codec/Parser"))))
- {
+ (g_strrstr(klass, "Codec/Demuxer") || (g_strrstr(klass, "Codec/Parser")))) {
// TO CHECK : subtitle if needed, add subparse exception.
LOGD("skipping parser/demuxer [%s] in es player by not required\n", factory_name);
result = GST_AUTOPLUG_SELECT_SKIP;
goto DONE;
}
- if (g_strrstr(factory_name, "mpegpsdemux"))
- {
+ if (g_strrstr(factory_name, "mpegpsdemux")) {
LOGD("skipping PS container - not support\n");
result = GST_AUTOPLUG_SELECT_SKIP;
goto DONE;
@@ -12973,45 +11658,32 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
player->smooth_streaming = TRUE;
/* check ALP Codec can be used or not */
- if ((g_strrstr(klass, "Codec/Decoder/Audio")))
- {
+ if ((g_strrstr(klass, "Codec/Decoder/Audio"))) {
GstStructure* str = NULL;
gint channels = 0;
str = gst_caps_get_structure(caps, 0);
- if (str)
- {
+ if (str) {
gst_structure_get_int(str, "channels", &channels);
LOGD("check audio ch : %d %d\n", player->max_audio_channels, channels);
if (player->max_audio_channels < channels)
- {
player->max_audio_channels = channels;
- }
}
-
+ /* set stream information */
if (!player->audiodec_linked)
- {
- /* set stream information */
__mmplayer_set_audio_attrs(player, caps);
- }
- }
- else if (g_strrstr(klass, "Codec/Decoder/Video"))
- {
+ } else if (g_strrstr(klass, "Codec/Decoder/Video")) {
if ((strlen(player->ini.videocodec_element_hw) > 0) &&
- (g_strrstr(factory_name, player->ini.videocodec_element_hw)))
- {
+ (g_strrstr(factory_name, player->ini.videocodec_element_hw))) {
/* prepare resource manager for video decoder */
MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
- if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE)
- {
+ if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state) == MM_ERROR_NONE) {
/* prepare resource manager for video decoder */
- if ((resource_state >= RESOURCE_STATE_INITIALIZED) && (resource_state < RESOURCE_STATE_ACQUIRED))
- {
+ if ((resource_state >= RESOURCE_STATE_INITIALIZED) && (resource_state < RESOURCE_STATE_ACQUIRED)) {
if (_mmplayer_resource_manager_prepare(&player->resource_manager, RESOURCE_TYPE_VIDEO_DECODER)
- != MM_ERROR_NONE)
- {
+ != MM_ERROR_NONE) {
LOGW("could not prepare for video_decoder resource, skip it.");
result = GST_AUTOPLUG_SELECT_SKIP;
goto DONE;
@@ -13022,8 +11694,7 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
}
if ((g_strrstr(klass, "Codec/Parser/Converter/Video")) ||
- (g_strrstr(klass, "Codec/Decoder/Video")))
- {
+ (g_strrstr(klass, "Codec/Decoder/Video"))) {
gint stype = 0;
gint width = 0;
GstStructure *str = NULL;
@@ -13031,8 +11702,7 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
/* don't make video because of not required */
if ((stype == MM_DISPLAY_SURFACE_NULL) &&
- (player->set_mode.media_packet_video_stream == FALSE))
- {
+ (player->set_mode.media_packet_video_stream == FALSE)) {
LOGD("no video because it's not required. -> return expose");
result = GST_AUTOPLUG_SELECT_EXPOSE;
goto DONE;
@@ -13054,22 +11724,18 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
}
}
- if (g_strrstr(klass, "Decoder"))
- {
+ if (g_strrstr(klass, "Decoder")) {
const char* mime = NULL;
mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
- if (g_str_has_prefix(mime, "video"))
- {
+ if (g_str_has_prefix(mime, "video")) {
// __mmplayer_check_video_zero_cpoy(player, factory);
player->not_supported_codec &= MISSING_PLUGIN_AUDIO;
player->can_support_codec |= FOUND_PLUGIN_VIDEO;
player->videodec_linked = 1;
- }
- else if (g_str_has_prefix(mime, "audio"))
- {
+ } else if (g_str_has_prefix(mime, "audio")) {
player->not_supported_codec &= MISSING_PLUGIN_VIDEO;
player->can_support_codec |= FOUND_PLUGIN_AUDIO;
@@ -13089,11 +11755,11 @@ static GValueArray*
__mmplayer_gst_decode_autoplug_factories(GstElement *bin, GstPad* pad,
GstCaps * caps, gpointer data)
{
- //mm_player_t* player = (mm_player_t*)data;
+ //mm_player_t* player = (mm_player_t*)data;
LOGD("decodebin is requesting factories for caps [%s] from element[%s]",
- gst_caps_to_string(caps),
- GST_ELEMENT_NAME(GST_PAD_PARENT(pad)));
+ gst_caps_to_string(caps),
+ GST_ELEMENT_NAME(GST_PAD_PARENT(pad)));
return NULL;
}
@@ -13103,14 +11769,13 @@ static void
__mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad* new_pad,
gpointer data) // @
{
- //mm_player_t* player = (mm_player_t*)data;
+ //mm_player_t* player = (mm_player_t*)data;
GstCaps* caps = NULL;
LOGD("[Decodebin2] pad-removed signal\n");
caps = gst_pad_query_caps(new_pad, NULL);
- if (caps)
- {
+ if (caps) {
gchar* caps_str = NULL;
caps_str = gst_caps_to_string(caps);
@@ -13130,20 +11795,17 @@ __mmplayer_gst_decode_drained(GstElement *bin, gpointer data)
LOGD("__mmplayer_gst_decode_drained");
- if (player->use_deinterleave == TRUE)
- {
+ if (player->use_deinterleave == TRUE) {
LOGD("group playing mode.");
return;
}
- if (!g_mutex_trylock(&player->cmd_lock))
- {
+ if (!g_mutex_trylock(&player->cmd_lock)) {
LOGW("Fail to get cmd lock");
return;
}
- if (!__mmplayer_verify_next_play_path(player))
- {
+ if (!__mmplayer_verify_next_play_path(player)) {
LOGD("decoding is finished.");
__mmplayer_reset_gapless_state(player);
g_mutex_unlock(&player->cmd_lock);
@@ -13177,24 +11839,21 @@ __mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data
LOGD("add buffer probe");
//<-
- if (g_strrstr(klass, "Codec/Decoder/Audio"))
- {
+ if (g_strrstr(klass, "Codec/Decoder/Audio")) {
gchar* selected = NULL;
selected = g_strdup(GST_ELEMENT_NAME(element));
player->audio_decoders = g_list_append(player->audio_decoders, selected);
}
//-> temp code
- if (g_strrstr(klass, "Parser"))
- {
+ if (g_strrstr(klass, "Parser")) {
gchar* selected = NULL;
selected = g_strdup(factory_name);
player->parsers = g_list_append(player->parsers, selected);
}
- if ((g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse")) && !(g_strrstr(klass, "Adaptive")))
- {
+ if ((g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse")) && !(g_strrstr(klass, "Adaptive"))) {
/* FIXIT : first value will be overwritten if there's more
* than 1 demuxer/parser
*/
@@ -13204,61 +11863,47 @@ __mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data
player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst = element;
/*Added for multi audio support */ // Q. del?
- if (g_strrstr(klass, "Demux"))
- {
+ if (g_strrstr(klass, "Demux")) {
player->pipeline->mainbin[MMPLAYER_M_DEMUX_EX].id = MMPLAYER_M_DEMUX_EX;
player->pipeline->mainbin[MMPLAYER_M_DEMUX_EX].gst = element;
}
}
- if (g_strrstr(factory_name, "asfdemux") || g_strrstr(factory_name, "qtdemux") || g_strrstr(factory_name, "avidemux"))
- {
+ if (g_strrstr(factory_name, "asfdemux") || g_strrstr(factory_name, "qtdemux") || g_strrstr(factory_name, "avidemux")) {
int surface_type = 0;
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type);
}
// to support trust-zone only
- if (g_strrstr(factory_name, "asfdemux"))
- {
+ if (g_strrstr(factory_name, "asfdemux")) {
LOGD("set file-location %s\n", player->profile.uri);
g_object_set(G_OBJECT(element), "file-location", player->profile.uri, NULL);
if (player->video_hub_download_mode == TRUE)
- {
g_object_set(G_OBJECT(element), "downloading-mode", player->video_hub_download_mode, NULL);
- }
- }
- else if (g_strrstr(factory_name, "legacyh264parse"))
- {
+ } else if (g_strrstr(factory_name, "legacyh264parse")) {
LOGD("[%s] output-format to legacyh264parse\n", "mssdemux");
g_object_set(G_OBJECT(element), "output-format", 1, NULL); /* NALU/Byte Stream format */
- }
- else if (g_strrstr(factory_name, "mpegaudioparse"))
- {
+ } else if (g_strrstr(factory_name, "mpegaudioparse")) {
if ((MMPLAYER_IS_HTTP_STREAMING(player)) &&
- (__mmplayer_is_only_mp3_type(player->type)))
- {
+ (__mmplayer_is_only_mp3_type(player->type))) {
LOGD("[mpegaudioparse] set streaming pull mode.");
g_object_set(G_OBJECT(element), "http-pull-mp3dec", TRUE, NULL);
}
- }
- else if (g_strrstr(factory_name, player->ini.videocodec_element_hw))
- {
+ } else if (g_strrstr(factory_name, player->ini.videocodec_element_hw))
player->pipeline->mainbin[MMPLAYER_M_DEC1].gst = element;
- }
+
if ((player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst) &&
- (g_strrstr(GST_ELEMENT_NAME(element), "multiqueue")))
- {
+ (g_strrstr(GST_ELEMENT_NAME(element), "multiqueue"))) {
LOGD("plugged element is multiqueue. take it\n");
player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].id = MMPLAYER_M_DEMUXED_S_BUFFER;
player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst = element;
if ((MMPLAYER_IS_HTTP_STREAMING(player)) ||
- (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)))
- {
+ (MMPLAYER_IS_HTTP_LIVE_STREAMING(player))) {
/* in case of multiqueue, max bytes size is defined with fixed value in mm_player_streaming.h*/
__mm_player_streaming_set_multiqueue(player->streamer,
element,
@@ -13283,34 +11928,27 @@ static gboolean __mmplayer_configure_audio_callback(mm_player_t* player)
return FALSE;
/* This callback can be set to music player only. */
- if ((player->can_support_codec & 0x02) == FOUND_PLUGIN_VIDEO)
- {
+ if ((player->can_support_codec & 0x02) == FOUND_PLUGIN_VIDEO) {
LOGW("audio callback is not supported for video");
return FALSE;
}
- if (player->audio_stream_cb)
- {
- {
- GstPad *pad = NULL;
+ if (player->audio_stream_cb) {
+ GstPad *pad = NULL;
- pad = gst_element_get_static_pad(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "sink");
+ pad = gst_element_get_static_pad(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "sink");
- if (!pad)
- {
- LOGE("failed to get sink pad from audiosink to probe data\n");
- return FALSE;
- }
- player->audio_cb_probe_id = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER,
- __mmplayer_audio_stream_probe, player, NULL);
+ if (!pad) {
+ LOGE("failed to get sink pad from audiosink to probe data\n");
+ return FALSE;
+ }
+ player->audio_cb_probe_id = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER,
+ __mmplayer_audio_stream_probe, player, NULL);
- gst_object_unref(pad);
+ gst_object_unref(pad);
- pad = NULL;
- }
- }
- else
- {
+ pad = NULL;
+ } else {
LOGE("There is no audio callback to configure.\n");
return FALSE;
}
@@ -13326,7 +11964,7 @@ __mmplayer_init_factories(mm_player_t* player) // @
MMPLAYER_RETURN_IF_FAIL(player);
player->factories = gst_registry_feature_filter(gst_registry_get(),
- (GstPluginFeatureFilter)__mmplayer_feature_filter, FALSE, NULL);
+ (GstPluginFeatureFilter)__mmplayer_feature_filter, FALSE, NULL);
player->factories = g_list_sort(player->factories, (GCompareFunc)util_factory_rank_compare);
}
@@ -13336,8 +11974,7 @@ __mmplayer_release_factories(mm_player_t* player) // @
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player);
- if (player->factories)
- {
+ if (player->factories) {
gst_plugin_feature_list_free(player->factories);
player->factories = NULL;
}
@@ -13408,15 +12045,13 @@ __mmplayer_release_misc(mm_player_t* player)
/* recover mode */
player->set_mode.rich_audio = cur_mode;
- for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++)
- {
+ for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++) {
player->bitrate[i] = 0;
player->maximum_bitrate[i] = 0;
}
/* remove media stream cb(appsrc cb) */
- for (i = 0; i < MM_PLAYER_STREAM_TYPE_MAX; i++)
- {
+ for (i = 0; i < MM_PLAYER_STREAM_TYPE_MAX; i++) {
player->media_stream_buffer_status_cb[i] = NULL;
player->media_stream_seek_data_cb[i] = NULL;
}
@@ -13424,8 +12059,7 @@ __mmplayer_release_misc(mm_player_t* player)
/* free memory related to audio effect */
MMPLAYER_FREEIF(player->audio_effect_info.custom_ext_level_for_plugin);
- if (player->state_tune_caps)
- {
+ if (player->state_tune_caps) {
gst_caps_unref(player->state_tune_caps);
player->state_tune_caps = NULL;
}
@@ -13447,11 +12081,9 @@ __mmplayer_release_misc_post(mm_player_t* player)
mm_attrs_set_int_by_name(player->attrs, "content_audio_found", 0);
/* clean found parsers */
- if (player->parsers)
- {
+ if (player->parsers) {
GList *parsers = player->parsers;
- for (;parsers ; parsers = g_list_next(parsers))
- {
+ for (; parsers; parsers = g_list_next(parsers)) {
gchar *name = parsers->data;
MMPLAYER_FREEIF(name);
}
@@ -13460,11 +12092,9 @@ __mmplayer_release_misc_post(mm_player_t* player)
}
/* clean found audio decoders */
- if (player->audio_decoders)
- {
+ if (player->audio_decoders) {
GList *a_dec = player->audio_decoders;
- for (;a_dec ; a_dec = g_list_next(a_dec))
- {
+ for (; a_dec; a_dec = g_list_next(a_dec)) {
gchar *name = a_dec->data;
MMPLAYER_FREEIF(name);
}
@@ -13473,24 +12103,19 @@ __mmplayer_release_misc_post(mm_player_t* player)
}
/* clean the uri list except original uri */
- if (player->uri_info.uri_list)
- {
+ if (player->uri_info.uri_list) {
original_uri = g_list_nth_data(player->uri_info.uri_list, 0);
- if (player->attrs)
- {
+ if (player->attrs) {
mm_attrs_set_string_by_name(player->attrs, "profile_uri", original_uri);
LOGD("restore original uri = %s\n", original_uri);
if (mmf_attrs_commit(player->attrs))
- {
LOGE("failed to commit the original uri.\n");
- }
}
GList *uri_list = player->uri_info.uri_list;
- for (;uri_list ; uri_list = g_list_next(uri_list))
- {
+ for (; uri_list; uri_list = g_list_next(uri_list)) {
gchar *uri = uri_list->data;
MMPLAYER_FREEIF(uri);
}
@@ -13516,21 +12141,18 @@ static GstElement *__mmplayer_element_create_and_link(mm_player_t *player, GstPa
LOGD("creating %s to plug\n", name);
element = gst_element_factory_make(name, NULL);
- if (!element)
- {
+ if (!element) {
LOGE("failed to create queue\n");
return NULL;
}
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(element, GST_STATE_READY))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(element, GST_STATE_READY)) {
LOGE("failed to set state READY to %s\n", name);
gst_object_unref(element);
return NULL;
}
- if (!gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), element))
- {
+ if (!gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), element)) {
LOGE("failed to add %s\n", name);
gst_object_unref(element);
return NULL;
@@ -13538,8 +12160,7 @@ static GstElement *__mmplayer_element_create_and_link(mm_player_t *player, GstPa
sinkpad = gst_element_get_static_pad(element, "sink");
- if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
LOGE("failed to link %s\n", name);
gst_object_unref(sinkpad);
gst_object_unref(element);
@@ -13585,9 +12206,9 @@ const char *padname, const GList *templlist)
LOGD("plugging pad %s:%s to newly create %s:%s\n",
GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)),
- GST_PAD_NAME(srcpad),
- GST_ELEMENT_NAME(sinkelement),
- padname);
+ GST_PAD_NAME(srcpad),
+ GST_ELEMENT_NAME(sinkelement),
+ padname);
factory = gst_element_get_factory(sinkelement);
klass = gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS);
@@ -13596,11 +12217,9 @@ const char *padname, const GList *templlist)
MMPLAYER_CHECK_CMD_IF_EXIT(player);
/* need it to warm up omx before linking to pipeline */
- if (g_strrstr(GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)), "demux"))
- {
+ if (g_strrstr(GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)), "demux")) {
LOGD("get demux caps.\n");
- if (player->state_tune_caps)
- {
+ if (player->state_tune_caps) {
gst_caps_unref(player->state_tune_caps);
player->state_tune_caps = NULL;
}
@@ -13608,31 +12227,23 @@ const char *padname, const GList *templlist)
}
/* NOTE : OMX Codec can check if resource is available or not at this state. */
- if (g_strrstr(GST_ELEMENT_NAME(sinkelement), "omx"))
- {
- if (player->state_tune_caps != NULL)
- {
+ if (g_strrstr(GST_ELEMENT_NAME(sinkelement), "omx")) {
+ if (player->state_tune_caps != NULL) {
LOGD("set demux's caps to omx codec if resource is available");
- if (gst_pad_set_caps(gst_element_get_static_pad(sinkelement, "sink"), player->state_tune_caps))
- {
+ if (gst_pad_set_caps(gst_element_get_static_pad(sinkelement, "sink"), player->state_tune_caps)) {
target_state = GST_STATE_PAUSED;
isvideo_decoder = TRUE;
g_object_set(G_OBJECT(sinkelement), "state-tuning", TRUE, NULL);
- }
- else
- {
+ } else
LOGW("failed to set caps for state tuning");
- }
}
gst_caps_unref(player->state_tune_caps);
player->state_tune_caps = NULL;
}
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, target_state))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, target_state)) {
LOGE("failed to set %d state to %s\n", target_state, GST_ELEMENT_NAME(sinkelement));
- if (isvideo_decoder)
- {
+ if (isvideo_decoder) {
gst_element_set_state(sinkelement, GST_STATE_NULL);
gst_object_unref(G_OBJECT(sinkelement));
player->keep_detecting_vcodec = TRUE;
@@ -13641,8 +12252,7 @@ const char *padname, const GList *templlist)
}
/* add to pipeline */
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), sinkelement))
- {
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), sinkelement)) {
LOGE("failed to add %s to mainbin\n", GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
@@ -13651,12 +12261,10 @@ const char *padname, const GList *templlist)
/* added to support multi track files */
/* only decoder case and any of the video/audio still need to link*/
- if (g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player,srcpad))
- {
+ if (g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player, srcpad)) {
gchar *name = g_strdup(GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)));
- if (g_strrstr(name, "mpegtsdemux")|| g_strrstr(name, "mssdemux"))
- {
+ if (g_strrstr(name, "mpegtsdemux") || g_strrstr(name, "mssdemux")) {
gchar *src_demux_caps_str = NULL;
gchar *needed_parser = NULL;
GstCaps *src_demux_caps = NULL;
@@ -13667,39 +12275,26 @@ const char *padname, const GList *templlist)
gst_caps_unref(src_demux_caps);
- if (g_strrstr(src_demux_caps_str, "video/x-h264"))
- {
- if (g_strrstr(name, "mssdemux"))
- {
+ if (g_strrstr(src_demux_caps_str, "video/x-h264")) {
+ if (g_strrstr(name, "mssdemux")) {
needed_parser = g_strdup("legacyh264parse");
smooth_streaming = TRUE;
- }
- else
- {
+ } else
needed_parser = g_strdup("h264parse");
- }
- }
- else if (g_strrstr(src_demux_caps_str, "video/mpeg"))
- {
+ } else if (g_strrstr(src_demux_caps_str, "video/mpeg"))
needed_parser = g_strdup("mpeg4videoparse");
- }
+
MMPLAYER_FREEIF(src_demux_caps_str);
- if (needed_parser)
- {
+ if (needed_parser) {
parser = __mmplayer_element_create_and_link(player, srcpad, needed_parser);
MMPLAYER_FREEIF(needed_parser);
- if (!parser)
- {
+ if (!parser) {
LOGE("failed to create parser\n");
- }
- else
- {
+ } else {
if (smooth_streaming)
- {
g_object_set(parser, "output-format", 1, NULL); /* NALU/Byte Stream format */
- }
/* update srcpad if parser is created */
pssrcpad = gst_element_get_static_pad(parser, "src");
@@ -13710,8 +12305,7 @@ const char *padname, const GList *templlist)
MMPLAYER_FREEIF(name);
queue = __mmplayer_element_create_and_link(player, srcpad, "queue"); // parser - queue or demuxer - queue
- if (!queue)
- {
+ if (!queue) {
LOGE("failed to create queue\n");
goto ERROR;
}
@@ -13724,104 +12318,79 @@ const char *padname, const GList *templlist)
/* assigning queue handle for futher manipulation purpose */
/* FIXIT : make it some kind of list so that msl can support more then two stream(text, data, etc...) */
- if (mainbin[MMPLAYER_M_Q1].gst == NULL)
- {
+ if (mainbin[MMPLAYER_M_Q1].gst == NULL) {
mainbin[MMPLAYER_M_Q1].id = MMPLAYER_M_Q1;
mainbin[MMPLAYER_M_Q1].gst = queue;
- if (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS)
- {
+ if (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS) {
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-time", 0 , NULL);
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-buffers", 2, NULL);
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-bytes", 0, NULL);
- }
- else
- {
+ } else {
if (!MMPLAYER_IS_RTSP_STREAMING(player))
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-time", q_max_size_time * GST_SECOND, NULL);
}
- }
- else if (mainbin[MMPLAYER_M_Q2].gst == NULL)
- {
+ } else if (mainbin[MMPLAYER_M_Q2].gst == NULL) {
mainbin[MMPLAYER_M_Q2].id = MMPLAYER_M_Q2;
mainbin[MMPLAYER_M_Q2].gst = queue;
- if (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS)
- {
+ if (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS) {
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-time", 0 , NULL);
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-buffers", 2, NULL);
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-bytes", 0, NULL);
- }
- else
- {
+ } else {
if (!MMPLAYER_IS_RTSP_STREAMING(player))
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-time", q_max_size_time * GST_SECOND, NULL);
}
- }
- else
- {
+ } else {
LOGE("Not supporting more then two elementary stream\n");
g_assert(1);
}
pad = gst_element_get_static_pad(sinkelement, padname);
- if (!pad)
- {
+ if (!pad) {
LOGW("failed to get pad(%s) from %s. retrying with [sink]\n",
padname, GST_ELEMENT_NAME(sinkelement));
pad = gst_element_get_static_pad(sinkelement, "sink");
- if (!pad)
- {
+ if (!pad) {
LOGE("failed to get pad(sink) from %s. \n",
GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
}
- /* to check the video/audio type set the proper flag*/
+ /* to check the video/audio type set the proper flag*/
const gchar *mime_type = NULL;
- {
- srccaps = gst_pad_query_caps(srcpad, NULL);
- if (!srccaps)
- goto ERROR;
-
- str = gst_caps_get_structure(srccaps, 0);
- if (!str)
- goto ERROR;
-
- mime_type = gst_structure_get_name(str);
- if (!mime_type)
- goto ERROR;
- }
+ srccaps = gst_pad_query_caps(srcpad, NULL);
+ if (!srccaps)
+ goto ERROR;
+ str = gst_caps_get_structure(srccaps, 0);
+ if (!str)
+ goto ERROR;
+ mime_type = gst_structure_get_name(str);
+ if (!mime_type)
+ goto ERROR;
/* link queue and decoder. so, it will be queue - decoder. */
- if (GST_PAD_LINK_OK != gst_pad_link(srcpad, pad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, pad)) {
gst_object_unref(GST_OBJECT(pad));
LOGE("failed to link(%s) to pad(%s)\n", GST_ELEMENT_NAME(sinkelement), padname);
/* reconstitute supportable codec */
if (strstr(mime_type, "video"))
- {
player->can_support_codec ^= FOUND_PLUGIN_VIDEO;
- }
else if (strstr(mime_type, "audio"))
- {
player->can_support_codec ^= FOUND_PLUGIN_AUDIO;
- }
goto ERROR;
}
- if (strstr(mime_type, "video"))
- {
+ if (strstr(mime_type, "video")) {
player->videodec_linked = 1;
LOGI("player->videodec_linked set to 1\n");
- }
- else if (strstr(mime_type, "audio"))
- {
+ } else if (strstr(mime_type, "audio")) {
player->audiodec_linked = 1;
LOGI("player->auddiodec_linked set to 1\n");
}
@@ -13831,34 +12400,27 @@ const char *padname, const GList *templlist)
srccaps = NULL;
}
- if (!MMPLAYER_IS_HTTP_PD(player))
- {
- if ((g_strrstr(klass, "Demux") && !g_strrstr(klass, "Metadata")) || (g_strrstr(klass, "Parser")))
- {
- if (MMPLAYER_IS_HTTP_STREAMING(player))
- {
+ if (!MMPLAYER_IS_HTTP_PD(player)) {
+ if ((g_strrstr(klass, "Demux") && !g_strrstr(klass, "Metadata")) || (g_strrstr(klass, "Parser"))) {
+ if (MMPLAYER_IS_HTTP_STREAMING(player)) {
gint64 dur_bytes = 0L;
muxed_buffer_type_e type = MUXED_BUFFER_TYPE_MEM_QUEUE;
- if (!mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)
- {
+ if (!mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) {
LOGD("creating http streaming buffering queue\n");
queue = gst_element_factory_make("queue2", "queue2");
- if (!queue)
- {
+ if (!queue) {
LOGE("failed to create buffering queue element\n");
goto ERROR;
}
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY)) {
LOGE("failed to set state READY to buffering queue\n");
goto ERROR;
}
- if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue))
- {
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue)) {
LOGE("failed to add buffering queue\n");
goto ERROR;
}
@@ -13866,8 +12428,7 @@ const char *padname, const GList *templlist)
qsinkpad = gst_element_get_static_pad(queue, "sink");
qsrcpad = gst_element_get_static_pad(queue, "src");
- if (GST_PAD_LINK_OK != gst_pad_link(srcpad, qsinkpad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, qsinkpad)) {
LOGE("failed to link buffering queue\n");
goto ERROR;
}
@@ -13877,8 +12438,7 @@ const char *padname, const GList *templlist)
mainbin[MMPLAYER_M_MUXED_S_BUFFER].id = MMPLAYER_M_MUXED_S_BUFFER;
mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst = queue;
- if (!MMPLAYER_IS_HTTP_LIVE_STREAMING(player))
- {
+ if (!MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) {
if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
LOGE("fail to get duration.\n");
@@ -13896,8 +12456,7 @@ const char *padname, const GList *templlist)
}
/* NOTE : we cannot get any duration info from ts container in case of streaming */
- if (!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux"))
- {
+ if (!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux")) {
__mm_player_streaming_set_queue2(player->streamer,
queue,
TRUE,
@@ -13915,27 +12474,22 @@ const char *padname, const GList *templlist)
}
/* if it is not decoder or */
/* in decoder case any of the video/audio still need to link*/
- if (!g_strrstr(klass, "Decoder"))
- {
-
+ if (!g_strrstr(klass, "Decoder")) {
pad = gst_element_get_static_pad(sinkelement, padname);
- if (!pad)
- {
+ if (!pad) {
LOGW("failed to get pad(%s) from %s. retrying with [sink]\n",
padname, GST_ELEMENT_NAME(sinkelement));
pad = gst_element_get_static_pad(sinkelement, "sink");
- if (!pad)
- {
+ if (!pad) {
LOGE("failed to get pad(sink) from %s. \n",
GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
}
- if (GST_PAD_LINK_OK != gst_pad_link(srcpad, pad))
- {
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, pad)) {
gst_object_unref(GST_OBJECT(pad));
LOGE("failed to link(%s) to pad(%s)\n", GST_ELEMENT_NAME(sinkelement), padname);
goto ERROR;
@@ -13944,34 +12498,30 @@ const char *padname, const GList *templlist)
gst_object_unref(GST_OBJECT(pad));
}
- for (;templlist != NULL; templlist = templlist->next)
- {
+ for (; templlist != NULL; templlist = templlist->next) {
padtemplate = templlist->data;
LOGD("director = [%d], presence = [%d]\n", padtemplate->direction, padtemplate->presence);
- if ( padtemplate->direction != GST_PAD_SRC ||
- padtemplate->presence == GST_PAD_REQUEST )
+ if (padtemplate->direction != GST_PAD_SRC ||
+ padtemplate->presence == GST_PAD_REQUEST)
continue;
- switch (padtemplate->presence)
- {
- case GST_PAD_ALWAYS:
+ switch (padtemplate->presence) {
+ case GST_PAD_ALWAYS:
{
GstPad *srcpad = gst_element_get_static_pad(sinkelement, "src");
GstCaps *caps = gst_pad_query_caps(srcpad, NULL);
/* Check whether caps has many types */
- if (!gst_caps_is_fixed(caps))
- {
+ if (!gst_caps_is_fixed(caps)) {
LOGD("always pad but, caps has many types");
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
has_many_types = TRUE;
break;
}
- if (!__mmplayer_try_to_plug(player, srcpad, caps))
- {
+ if (!__mmplayer_try_to_plug(player, srcpad, caps)) {
gst_object_unref(GST_OBJECT(srcpad));
gst_caps_unref(GST_CAPS(caps));
@@ -13986,20 +12536,19 @@ const char *padname, const GList *templlist)
break;
- case GST_PAD_SOMETIMES:
- has_dynamic_pads = TRUE;
+ case GST_PAD_SOMETIMES:
+ has_dynamic_pads = TRUE;
break;
- default:
- break;
+ default:
+ break;
}
}
/* check if player can do start continually */
MMPLAYER_CHECK_CMD_IF_EXIT(player);
- if (has_dynamic_pads)
- {
+ if (has_dynamic_pads) {
player->have_dynamic_pad = TRUE;
MMPLAYER_SIGNAL_CONNECT(player, sinkelement, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(__mmplayer_add_new_pad), player);
@@ -14007,15 +12556,13 @@ const char *padname, const GList *templlist)
/* for streaming, more then one typefind will used for each elementary stream
* so this doesn't mean the whole pipeline completion
*/
- if (!MMPLAYER_IS_RTSP_STREAMING(player))
- {
+ if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
MMPLAYER_SIGNAL_CONNECT(player, sinkelement, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
G_CALLBACK(__mmplayer_pipeline_complete), player);
}
}
- if (has_many_types)
- {
+ if (has_many_types) {
GstPad *pad = NULL;
player->has_many_types = has_many_types;
@@ -14029,16 +12576,13 @@ const char *padname, const GList *templlist)
/* check if player can do start continually */
MMPLAYER_CHECK_CMD_IF_EXIT(player);
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, GST_STATE_PAUSED))
- {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, GST_STATE_PAUSED)) {
LOGE("failed to set state PAUSED to %s\n", GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
- if (queue)
- {
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED))
- {
+ if (queue) {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED)) {
LOGE("failed to set state PAUSED to queue\n");
goto ERROR;
}
@@ -14049,10 +12593,8 @@ const char *padname, const GList *templlist)
qsrcpad = NULL;
}
- if (parser)
- {
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(parser, GST_STATE_PAUSED))
- {
+ if (parser) {
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(parser, GST_STATE_PAUSED)) {
LOGE("failed to set state PAUSED to queue\n");
goto ERROR;
}
@@ -14069,8 +12611,7 @@ const char *padname, const GList *templlist)
ERROR:
- if (queue)
- {
+ if (queue) {
gst_object_unref(GST_OBJECT(qsrcpad));
/* NOTE : Trying to dispose element queue0, but it is in READY instead of the NULL state.
@@ -14079,8 +12620,8 @@ ERROR:
*/
gst_element_set_state(queue, GST_STATE_NULL);
/* And, it still has a parent "player".
- * You need to let the parent manage the object instead of unreffing the object directly.
- */
+ * You need to let the parent manage the object instead of unreffing the object directly.
+ */
gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue);
//gst_object_unref(queue);
@@ -14089,12 +12630,12 @@ ERROR:
if (srccaps)
gst_caps_unref(GST_CAPS(srccaps));
- return FALSE;
+ return FALSE;
}
static gboolean __mmplayer_feature_filter(GstPluginFeature *feature, gpointer data) // @
{
- const gchar *klass;
+ const gchar *klass;
/* we only care about element factories */
if (!GST_IS_ELEMENT_FACTORY(feature))
@@ -14107,10 +12648,8 @@ static gboolean __mmplayer_feature_filter(GstPluginFeature *feature, gpointer da
g_strrstr(klass, "Codec/Decoder") == NULL &&
g_strrstr(klass, "Depayloader") == NULL &&
g_strrstr(klass, "Parse") == NULL)
- {
return FALSE;
- }
- return TRUE;
+ return TRUE;
}
@@ -14140,8 +12679,7 @@ static void __mmplayer_add_new_caps(GstPad* pad, GParamSpec* unused, gpointer da
return;
LOGD("name=%s\n", name);
- if (!__mmplayer_try_to_plug(player, pad, caps))
- {
+ if (!__mmplayer_try_to_plug(player, pad, caps)) {
LOGE("failed to autoplug for type(%s)\n", name);
gst_caps_unref(caps);
return;
@@ -14178,55 +12716,37 @@ static void __mmplayer_set_unlinked_mime_type(mm_player_t* player, GstCaps *caps
/* set unlinked mime type for downloadable codec */
- if (g_str_has_prefix(stream_type, "video/"))
- {
- if (g_str_has_prefix(stream_type, "video/mpeg"))
- {
+ if (g_str_has_prefix(stream_type, "video/")) {
+ if (g_str_has_prefix(stream_type, "video/mpeg")) {
gst_structure_get_int(str, MM_PLAYER_MPEG_VNAME, &version);
version_field = MM_PLAYER_MPEG_VNAME;
- }
- else if (g_str_has_prefix(stream_type, "video/x-wmv"))
- {
+ } else if (g_str_has_prefix(stream_type, "video/x-wmv")) {
gst_structure_get_int(str, MM_PLAYER_WMV_VNAME, &version);
version_field = MM_PLAYER_WMV_VNAME;
- }
- else if (g_str_has_prefix(stream_type, "video/x-divx"))
- {
+ } else if (g_str_has_prefix(stream_type, "video/x-divx")) {
gst_structure_get_int(str, MM_PLAYER_DIVX_VNAME, &version);
version_field = MM_PLAYER_DIVX_VNAME;
}
if (version)
- {
player->unlinked_video_mime = g_strdup_printf("%s, %s=%d", stream_type, version_field, version);
- }
else
- {
player->unlinked_video_mime = g_strdup_printf("%s", stream_type);
- }
- }
- else if (g_str_has_prefix(stream_type, "audio/"))
- {
- if (g_str_has_prefix(stream_type, "audio/mpeg")) // mp3 or aac
- {
+ } else if (g_str_has_prefix(stream_type, "audio/")) {
+ if (g_str_has_prefix(stream_type, "audio/mpeg")) {
+ // mp3 or aac
gst_structure_get_int(str, MM_PLAYER_MPEG_VNAME, &version);
version_field = MM_PLAYER_MPEG_VNAME;
- }
- else if (g_str_has_prefix(stream_type, "audio/x-wma"))
- {
+ } else if (g_str_has_prefix(stream_type, "audio/x-wma")) {
gst_structure_get_int(str, MM_PLAYER_WMA_VNAME, &version);
version_field = MM_PLAYER_WMA_VNAME;
}
if (version)
- {
player->unlinked_audio_mime = g_strdup_printf("%s, %s=%d", stream_type, version_field, version);
- }
else
- {
player->unlinked_audio_mime = g_strdup_printf("%s", stream_type);
- }
}
MMPLAYER_FLEAVE();
@@ -14243,13 +12763,12 @@ static void __mmplayer_add_new_pad(GstElement *element, GstPad *pad, gpointer da
MMPLAYER_RETURN_IF_FAIL(player);
MMPLAYER_RETURN_IF_FAIL(pad);
- GST_OBJECT_LOCK(pad);
+ GST_OBJECT_LOCK(pad);
if ((caps = gst_pad_get_current_caps(pad)))
gst_caps_ref(caps);
GST_OBJECT_UNLOCK(pad);
- if (NULL == caps)
- {
+ if (NULL == caps) {
caps = gst_pad_query_caps(pad, NULL);
if (!caps) return;
}
@@ -14270,26 +12789,19 @@ static void __mmplayer_add_new_pad(GstElement *element, GstPad *pad, gpointer da
/* Note : If the stream is the subtitle, we try not to play it. Just close the demuxer subtitle pad.
* If want to play it, remove this code.
*/
- if (g_strrstr(name, "application"))
- {
- if (g_strrstr(name, "x-id3") || g_strrstr(name, "x-apetag"))
- {
+ if (g_strrstr(name, "application")) {
+ if (g_strrstr(name, "x-id3") || g_strrstr(name, "x-apetag")) {
/* If id3/ape tag comes, keep going */
LOGD("application mime exception : id3/ape tag");
- }
- else
- {
+ } else {
/* Otherwise, we assume that this stream is subtile. */
LOGD(" application mime type pad is closed.");
return;
}
- }
- else if (g_strrstr(name, "audio"))
- {
+ } else if (g_strrstr(name, "audio")) {
gint samplerate = 0, channels = 0;
- if (player->audiodec_linked)
- {
+ if (player->audiodec_linked) {
gst_caps_unref(caps);
LOGD("multi tracks. skip to plug");
return;
@@ -14304,15 +12816,12 @@ static void __mmplayer_add_new_pad(GstElement *element, GstPad *pad, gpointer da
mm_attrs_set_int_by_name(player->attrs, "content_audio_channels", channels);
LOGD("audio samplerate : %d channels : %d", samplerate, channels);
- }
- else if (g_strrstr(name, "video"))
- {
+ } else if (g_strrstr(name, "video")) {
gint stype;
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype);
/* don't make video because of not required */
- if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE)
- {
+ if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE) {
LOGD("no video because it's not required");
return;
}
@@ -14320,8 +12829,7 @@ static void __mmplayer_add_new_pad(GstElement *element, GstPad *pad, gpointer da
player->v_stream_caps = gst_caps_copy(caps); //if needed, video caps is required when videobin is created
}
- if (!__mmplayer_try_to_plug(player, pad, caps))
- {
+ if (!__mmplayer_try_to_plug(player, pad, caps)) {
LOGE("failed to autoplug for type(%s)", name);
__mmplayer_set_unlinked_mime_type(player, caps);
@@ -14369,8 +12877,7 @@ __mmplayer_can_extract_pcm(mm_player_t* player)
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("fail to get attributes.");
return FALSE;
}
@@ -14378,8 +12885,7 @@ __mmplayer_can_extract_pcm(mm_player_t* player)
/* get sound_extraction property */
mm_attrs_get_int_by_name(attrs, "pcm_extraction", &sound_extraction);
- if (!sound_extraction)
- {
+ if (!sound_extraction) {
LOGD("checking pcm extraction mode : %d ", sound_extraction);
return FALSE;
}
@@ -14388,7 +12894,7 @@ __mmplayer_can_extract_pcm(mm_player_t* player)
}
static gboolean
-__mmplayer_handle_streaming_error (mm_player_t* player, GstMessage * message)
+__mmplayer_handle_streaming_error(mm_player_t* player, GstMessage * message)
{
LOGD("\n");
MMMessageParamType msg_param;
@@ -14408,156 +12914,154 @@ __mmplayer_handle_streaming_error (mm_player_t* player, GstMessage * message)
if (!gst_structure_get_uint(s, "error_id", &error_id))
error_id = MMPLAYER_STREAMING_ERROR_NONE;
- switch (error_id)
- {
- case MMPLAYER_STREAMING_ERROR_UNSUPPORTED_AUDIO:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_AUDIO;
- break;
- case MMPLAYER_STREAMING_ERROR_UNSUPPORTED_VIDEO:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_VIDEO;
- break;
- case MMPLAYER_STREAMING_ERROR_CONNECTION_FAIL:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL;
- break;
- case MMPLAYER_STREAMING_ERROR_DNS_FAIL:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_DNS_FAIL;
- break;
- case MMPLAYER_STREAMING_ERROR_SERVER_DISCONNECTED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_SERVER_DISCONNECTED;
- break;
- case MMPLAYER_STREAMING_ERROR_BAD_SERVER:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_BAD_SERVER;
- break;
- case MMPLAYER_STREAMING_ERROR_INVALID_PROTOCOL:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_INVALID_PROTOCOL;
- break;
- case MMPLAYER_STREAMING_ERROR_INVALID_URL:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_INVALID_URL;
- break;
- case MMPLAYER_STREAMING_ERROR_UNEXPECTED_MSG:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_UNEXPECTED_MSG;
- break;
- case MMPLAYER_STREAMING_ERROR_OUT_OF_MEMORIES:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_OUT_OF_MEMORIES;
- break;
- case MMPLAYER_STREAMING_ERROR_RTSP_TIMEOUT:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_RTSP_TIMEOUT;
- break;
- case MMPLAYER_STREAMING_ERROR_BAD_REQUEST:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_BAD_REQUEST;
- break;
- case MMPLAYER_STREAMING_ERROR_NOT_AUTHORIZED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_NOT_AUTHORIZED;
- break;
- case MMPLAYER_STREAMING_ERROR_PAYMENT_REQUIRED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_PAYMENT_REQUIRED;
- break;
- case MMPLAYER_STREAMING_ERROR_FORBIDDEN:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_FORBIDDEN;
- break;
- case MMPLAYER_STREAMING_ERROR_CONTENT_NOT_FOUND:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_CONTENT_NOT_FOUND;
- break;
- case MMPLAYER_STREAMING_ERROR_METHOD_NOT_ALLOWED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_METHOD_NOT_ALLOWED;
- break;
- case MMPLAYER_STREAMING_ERROR_NOT_ACCEPTABLE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_NOT_ACCEPTABLE;
- break;
- case MMPLAYER_STREAMING_ERROR_PROXY_AUTHENTICATION_REQUIRED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_PROXY_AUTHENTICATION_REQUIRED;
- break;
- case MMPLAYER_STREAMING_ERROR_SERVER_TIMEOUT:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_SERVER_TIMEOUT;
- break;
- case MMPLAYER_STREAMING_ERROR_GONE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_GONE;
- break;
- case MMPLAYER_STREAMING_ERROR_LENGTH_REQUIRED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_LENGTH_REQUIRED;
- break;
- case MMPLAYER_STREAMING_ERROR_PRECONDITION_FAILED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_PRECONDITION_FAILED;
- break;
- case MMPLAYER_STREAMING_ERROR_REQUEST_ENTITY_TOO_LARGE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_REQUEST_ENTITY_TOO_LARGE;
- break;
- case MMPLAYER_STREAMING_ERROR_REQUEST_URI_TOO_LARGE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_REQUEST_URI_TOO_LARGE;
- break;
- case MMPLAYER_STREAMING_ERROR_UNSUPPORTED_MEDIA_TYPE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_MEDIA_TYPE;
- break;
- case MMPLAYER_STREAMING_ERROR_PARAMETER_NOT_UNDERSTOOD:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_PARAMETER_NOT_UNDERSTOOD;
- break;
- case MMPLAYER_STREAMING_ERROR_CONFERENCE_NOT_FOUND:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_CONFERENCE_NOT_FOUND;
- break;
- case MMPLAYER_STREAMING_ERROR_NOT_ENOUGH_BANDWIDTH:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_NOT_ENOUGH_BANDWIDTH;
- break;
- case MMPLAYER_STREAMING_ERROR_NO_SESSION_ID:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_NO_SESSION_ID;
- break;
- case MMPLAYER_STREAMING_ERROR_METHOD_NOT_VALID_IN_THIS_STATE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_METHOD_NOT_VALID_IN_THIS_STATE;
- break;
- case MMPLAYER_STREAMING_ERROR_HEADER_FIELD_NOT_VALID_FOR_SOURCE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_HEADER_FIELD_NOT_VALID_FOR_SOURCE;
- break;
- case MMPLAYER_STREAMING_ERROR_INVALID_RANGE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_INVALID_RANGE;
- break;
- case MMPLAYER_STREAMING_ERROR_PARAMETER_IS_READONLY:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_PARAMETER_IS_READONLY;
- break;
- case MMPLAYER_STREAMING_ERROR_AGGREGATE_OP_NOT_ALLOWED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_AGGREGATE_OP_NOT_ALLOWED;
- break;
- case MMPLAYER_STREAMING_ERROR_ONLY_AGGREGATE_OP_ALLOWED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_ONLY_AGGREGATE_OP_ALLOWED;
- break;
- case MMPLAYER_STREAMING_ERROR_BAD_TRANSPORT:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_BAD_TRANSPORT;
- break;
- case MMPLAYER_STREAMING_ERROR_DESTINATION_UNREACHABLE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_DESTINATION_UNREACHABLE;
- break;
- case MMPLAYER_STREAMING_ERROR_INTERNAL_SERVER_ERROR:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_INTERNAL_SERVER_ERROR;
- break;
- case MMPLAYER_STREAMING_ERROR_NOT_IMPLEMENTED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_NOT_IMPLEMENTED;
- break;
- case MMPLAYER_STREAMING_ERROR_BAD_GATEWAY:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_BAD_GATEWAY;
- break;
- case MMPLAYER_STREAMING_ERROR_SERVICE_UNAVAILABLE:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_SERVICE_UNAVAILABLE;
- break;
- case MMPLAYER_STREAMING_ERROR_GATEWAY_TIME_OUT:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_GATEWAY_TIME_OUT;
- break;
- case MMPLAYER_STREAMING_ERROR_RTSP_VERSION_NOT_SUPPORTED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_RTSP_VERSION_NOT_SUPPORTED;
- break;
- case MMPLAYER_STREAMING_ERROR_OPTION_NOT_SUPPORTED:
- msg_param.code = MM_ERROR_PLAYER_STREAMING_OPTION_NOT_SUPPORTED;
- break;
- default:
- {
- MMPLAYER_FREEIF(s);
- return MM_ERROR_PLAYER_STREAMING_FAIL;
- }
+ switch (error_id) {
+ case MMPLAYER_STREAMING_ERROR_UNSUPPORTED_AUDIO:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_AUDIO;
+ break;
+ case MMPLAYER_STREAMING_ERROR_UNSUPPORTED_VIDEO:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_VIDEO;
+ break;
+ case MMPLAYER_STREAMING_ERROR_CONNECTION_FAIL:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL;
+ break;
+ case MMPLAYER_STREAMING_ERROR_DNS_FAIL:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_DNS_FAIL;
+ break;
+ case MMPLAYER_STREAMING_ERROR_SERVER_DISCONNECTED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_SERVER_DISCONNECTED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_BAD_SERVER:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_BAD_SERVER;
+ break;
+ case MMPLAYER_STREAMING_ERROR_INVALID_PROTOCOL:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_INVALID_PROTOCOL;
+ break;
+ case MMPLAYER_STREAMING_ERROR_INVALID_URL:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_INVALID_URL;
+ break;
+ case MMPLAYER_STREAMING_ERROR_UNEXPECTED_MSG:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_UNEXPECTED_MSG;
+ break;
+ case MMPLAYER_STREAMING_ERROR_OUT_OF_MEMORIES:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_OUT_OF_MEMORIES;
+ break;
+ case MMPLAYER_STREAMING_ERROR_RTSP_TIMEOUT:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_RTSP_TIMEOUT;
+ break;
+ case MMPLAYER_STREAMING_ERROR_BAD_REQUEST:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_BAD_REQUEST;
+ break;
+ case MMPLAYER_STREAMING_ERROR_NOT_AUTHORIZED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_NOT_AUTHORIZED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_PAYMENT_REQUIRED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_PAYMENT_REQUIRED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_FORBIDDEN:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_FORBIDDEN;
+ break;
+ case MMPLAYER_STREAMING_ERROR_CONTENT_NOT_FOUND:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_CONTENT_NOT_FOUND;
+ break;
+ case MMPLAYER_STREAMING_ERROR_METHOD_NOT_ALLOWED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_METHOD_NOT_ALLOWED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_NOT_ACCEPTABLE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_NOT_ACCEPTABLE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_PROXY_AUTHENTICATION_REQUIRED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_PROXY_AUTHENTICATION_REQUIRED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_SERVER_TIMEOUT:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_SERVER_TIMEOUT;
+ break;
+ case MMPLAYER_STREAMING_ERROR_GONE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_GONE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_LENGTH_REQUIRED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_LENGTH_REQUIRED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_PRECONDITION_FAILED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_PRECONDITION_FAILED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_REQUEST_ENTITY_TOO_LARGE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_REQUEST_ENTITY_TOO_LARGE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_REQUEST_URI_TOO_LARGE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_REQUEST_URI_TOO_LARGE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_UNSUPPORTED_MEDIA_TYPE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_MEDIA_TYPE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_PARAMETER_NOT_UNDERSTOOD:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_PARAMETER_NOT_UNDERSTOOD;
+ break;
+ case MMPLAYER_STREAMING_ERROR_CONFERENCE_NOT_FOUND:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_CONFERENCE_NOT_FOUND;
+ break;
+ case MMPLAYER_STREAMING_ERROR_NOT_ENOUGH_BANDWIDTH:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_NOT_ENOUGH_BANDWIDTH;
+ break;
+ case MMPLAYER_STREAMING_ERROR_NO_SESSION_ID:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_NO_SESSION_ID;
+ break;
+ case MMPLAYER_STREAMING_ERROR_METHOD_NOT_VALID_IN_THIS_STATE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_METHOD_NOT_VALID_IN_THIS_STATE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_HEADER_FIELD_NOT_VALID_FOR_SOURCE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_HEADER_FIELD_NOT_VALID_FOR_SOURCE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_INVALID_RANGE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_INVALID_RANGE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_PARAMETER_IS_READONLY:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_PARAMETER_IS_READONLY;
+ break;
+ case MMPLAYER_STREAMING_ERROR_AGGREGATE_OP_NOT_ALLOWED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_AGGREGATE_OP_NOT_ALLOWED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_ONLY_AGGREGATE_OP_ALLOWED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_ONLY_AGGREGATE_OP_ALLOWED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_BAD_TRANSPORT:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_BAD_TRANSPORT;
+ break;
+ case MMPLAYER_STREAMING_ERROR_DESTINATION_UNREACHABLE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_DESTINATION_UNREACHABLE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_INTERNAL_SERVER_ERROR:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_INTERNAL_SERVER_ERROR;
+ break;
+ case MMPLAYER_STREAMING_ERROR_NOT_IMPLEMENTED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_NOT_IMPLEMENTED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_BAD_GATEWAY:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_BAD_GATEWAY;
+ break;
+ case MMPLAYER_STREAMING_ERROR_SERVICE_UNAVAILABLE:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_SERVICE_UNAVAILABLE;
+ break;
+ case MMPLAYER_STREAMING_ERROR_GATEWAY_TIME_OUT:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_GATEWAY_TIME_OUT;
+ break;
+ case MMPLAYER_STREAMING_ERROR_RTSP_VERSION_NOT_SUPPORTED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_RTSP_VERSION_NOT_SUPPORTED;
+ break;
+ case MMPLAYER_STREAMING_ERROR_OPTION_NOT_SUPPORTED:
+ msg_param.code = MM_ERROR_PLAYER_STREAMING_OPTION_NOT_SUPPORTED;
+ break;
+ default:
+ {
+ MMPLAYER_FREEIF(s);
+ return MM_ERROR_PLAYER_STREAMING_FAIL;
+ }
}
error_string = g_strdup(gst_structure_get_string(s, "error_string"));
if (error_string)
msg_param.data = (void *) error_string;
- if (message->src)
- {
+ if (message->src) {
msg_src_element = GST_ELEMENT_NAME(GST_ELEMENT_CAST(message->src));
LOGE("-Msg src : [%s] Code : [%x] Error : [%s] \n",
@@ -14565,17 +13069,13 @@ __mmplayer_handle_streaming_error (mm_player_t* player, GstMessage * message)
}
/* post error to application */
- if (!player->msg_posted)
- {
+ if (!player->msg_posted) {
MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
/* don't post more if one was sent already */
player->msg_posted = TRUE;
- }
- else
- {
+ } else
LOGD("skip error post because it's sent already.\n");
- }
MMPLAYER_FREEIF(s);
MMPLAYER_FLEAVE();
@@ -14592,8 +13092,7 @@ __mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms)
/* post now if delay is zero */
- if (delay_in_ms == 0 || player->set_mode.pcm_extraction)
- {
+ if (delay_in_ms == 0 || player->set_mode.pcm_extraction) {
LOGD("eos delay is zero. posting EOS now\n");
MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
@@ -14617,8 +13116,7 @@ __mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms)
LOGD("global default context = %p, eos timer id = %d", player->context.global_default, player->eos_timer);
/* check timer is valid. if not, send EOS now */
- if (player->eos_timer == 0)
- {
+ if (player->eos_timer == 0) {
LOGW("creating timer for delayed EOS has failed. sending EOS now\n");
MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
}
@@ -14629,8 +13127,7 @@ __mmplayer_cancel_eos_timer(mm_player_t* player)
{
MMPLAYER_RETURN_IF_FAIL(player);
- if (player->eos_timer)
- {
+ if (player->eos_timer) {
LOGD("cancel eos timer");
__mmplayer_remove_g_source_from_context(player->context.global_default, player->eos_timer);
player->eos_timer = 0;
@@ -14647,12 +13144,10 @@ __mmplayer_eos_timer_cb(gpointer u_data)
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if (player->play_count > 1)
- {
+ if (player->play_count > 1) {
gint ret_value = 0;
ret_value = __gst_set_position(player, MM_PLAYER_POS_FORMAT_TIME, 0, TRUE);
- if (ret_value == MM_ERROR_NONE)
- {
+ if (ret_value == MM_ERROR_NONE) {
MMHandleType attrs = 0;
attrs = MMPLAYER_GET_ATTRS(player);
@@ -14661,17 +13156,11 @@ __mmplayer_eos_timer_cb(gpointer u_data)
mm_attrs_set_int_by_name(attrs, "profile_play_count", player->play_count);
mmf_attrs_commit(attrs);
- }
- else
- {
+ } else
LOGE("seeking to 0 failed in repeat play");
- }
- }
- else
- {
+ } else
/* posting eos */
MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
- }
/* we are returning FALSE as we need only one posting */
return FALSE;
@@ -14702,18 +13191,14 @@ __mmplayer_link_decoder(mm_player_t* player, GstPad *srcpad)
if (!name)
goto ERROR;
- if (strstr(name, "video"))
- {
- if (player->videodec_linked)
- {
+ if (strstr(name, "video")) {
+ if (player->videodec_linked) {
LOGI("Video decoder already linked\n");
return FALSE;
}
}
- if (strstr(name, "audio"))
- {
- if (player->audiodec_linked)
- {
+ if (strstr(name, "audio")) {
+ if (player->audiodec_linked) {
LOGI("Audio decoder already linked\n");
return FALSE;
}
@@ -14757,26 +13242,20 @@ __mmplayer_link_sink(mm_player_t* player , GstPad *srcpad)
if (!name)
goto ERROR;
- if (strstr(name, "video"))
- {
- if (player->videosink_linked)
- {
+ if (strstr(name, "video")) {
+ if (player->videosink_linked) {
LOGI("Video Sink already linked\n");
return FALSE;
}
}
- if (strstr(name, "audio"))
- {
- if (player->audiosink_linked)
- {
+ if (strstr(name, "audio")) {
+ if (player->audiosink_linked) {
LOGI("Audio Sink already linked\n");
return FALSE;
}
}
- if (strstr(name, "text"))
- {
- if (player->textsink_linked)
- {
+ if (strstr(name, "text")) {
+ if (player->textsink_linked) {
LOGI("Text Sink already linked\n");
return FALSE;
}
@@ -14786,8 +13265,8 @@ __mmplayer_link_sink(mm_player_t* player , GstPad *srcpad)
MMPLAYER_FLEAVE();
+ //return (!player->videosink_linked || !player->audiosink_linked);
return TRUE;
- //return(!player->videosink_linked || !player->audiosink_linked);
ERROR:
if (srccaps)
@@ -14813,27 +13292,21 @@ __gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
event2 = gst_event_copy((const GstEvent *)event);
sinks = player->sink_elements;
- while (sinks)
- {
+ while (sinks) {
GstElement *sink = GST_ELEMENT_CAST(sinks->data);
- if (GST_IS_ELEMENT(sink))
- {
+ if (GST_IS_ELEMENT(sink)) {
/* keep ref to the event */
gst_event_ref(event);
- if ((res = gst_element_send_event(sink, event)))
- {
+ if ((res = gst_element_send_event(sink, event))) {
LOGD("sending event[%s] to sink element [%s] success!\n",
GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(sink));
/* rtsp case, asyn_done is not called after seek during pause state */
- if (MMPLAYER_IS_RTSP_STREAMING(player))
- {
- if (strstr(GST_EVENT_TYPE_NAME(event), "seek"))
- {
- if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED)
- {
+ if (MMPLAYER_IS_RTSP_STREAMING(player)) {
+ if (strstr(GST_EVENT_TYPE_NAME(event), "seek")) {
+ if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED) {
LOGD("RTSP seek completed, after pause state..\n");
player->doing_seek = FALSE;
MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
@@ -14842,12 +13315,10 @@ __gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
}
}
- if (MMPLAYER_IS_MS_BUFF_SRC(player))
- {
+ if (MMPLAYER_IS_MS_BUFF_SRC(player)) {
sinks = g_list_next(sinks);
continue;
- }
- else
+ } else
break;
}
@@ -14868,25 +13339,19 @@ __gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
/* Note : Textbin is not linked to the video or audio bin.
* It needs to send the event to the text sink seperatelly.
*/
- if (player->play_subtitle && !player->use_textoverlay)
- {
+ if (player->play_subtitle && !player->use_textoverlay) {
GstElement *text_sink = GST_ELEMENT_CAST(player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst);
- if (GST_IS_ELEMENT(text_sink))
- {
+ if (GST_IS_ELEMENT(text_sink)) {
/* keep ref to the event */
gst_event_ref(event2);
if ((res = gst_element_send_event(text_sink, event2)))
- {
LOGD("sending event[%s] to subtitle sink element [%s] success!\n",
GST_EVENT_TYPE_NAME(event2), GST_ELEMENT_NAME(text_sink));
- }
else
- {
LOGE("sending event[%s] to subtitle sink element [%s] failed!\n",
GST_EVENT_TYPE_NAME(event2), GST_ELEMENT_NAME(text_sink));
- }
gst_event_unref(event2);
}
@@ -14981,8 +13446,7 @@ __mmplayer_release_signal_connection(mm_player_t* player, MMPlayerSignalType typ
LOGD("release signals type : %d", type);
- if ((type < MM_PLAYER_SIGNAL_TYPE_AUTOPLUG) || (type >= MM_PLAYER_SIGNAL_TYPE_ALL))
- {
+ if ((type < MM_PLAYER_SIGNAL_TYPE_AUTOPLUG) || (type >= MM_PLAYER_SIGNAL_TYPE_ALL)) {
__mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG);
__mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN);
__mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN);
@@ -14993,16 +13457,12 @@ __mmplayer_release_signal_connection(mm_player_t* player, MMPlayerSignalType typ
sig_list = player->signals[type];
- for (; sig_list; sig_list = sig_list->next)
- {
+ for (; sig_list; sig_list = sig_list->next) {
item = sig_list->data;
- if (item && item->obj && GST_IS_ELEMENT(item->obj))
- {
+ if (item && item->obj && GST_IS_ELEMENT(item->obj)) {
if (g_signal_handler_is_connected(item->obj, item->sig))
- {
g_signal_handler_disconnect(item->obj, item->sig);
- }
}
MMPLAYER_FREEIF(item);
@@ -15034,28 +13494,23 @@ int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface
player = MM_PLAYER_CAST(handle);
- if (surface_type < MM_DISPLAY_SURFACE_OVERLAY || surface_type >= MM_DISPLAY_SURFACE_NUM)
- {
+ if (surface_type < MM_DISPLAY_SURFACE_OVERLAY || surface_type >= MM_DISPLAY_SURFACE_NUM) {
LOGE("Not support this surface type(%d) for changing vidoesink", surface_type);
MMPLAYER_FLEAVE();
return MM_ERROR_INVALID_ARGUMENT;
}
/* load previous attributes */
- if (player->attrs)
- {
+ if (player->attrs) {
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &prev_display_surface_type);
mm_attrs_get_data_by_name(player->attrs, "display_overlay", &prev_display_overlay);
LOGD("[0: Video surface, 1: EVAS surface] previous surface type(%d), new surface type(%d)", prev_display_surface_type, surface_type);
- if (prev_display_surface_type == surface_type)
- {
+ if (prev_display_surface_type == surface_type) {
LOGD("incoming display surface type is same as previous one, do nothing..");
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
}
- }
- else
- {
+ } else {
LOGE("failed to load attributes");
MMPLAYER_FLEAVE();
return MM_ERROR_PLAYER_INTERNAL;
@@ -15063,29 +13518,24 @@ int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface
/* check videosink element is created */
if (!player->pipeline || !player->pipeline->videobin ||
- !player->pipeline->videobin[MMPLAYER_V_SINK].gst)
- {
+ !player->pipeline->videobin[MMPLAYER_V_SINK].gst) {
LOGD("videosink element is not yet ready");
/* videobin is not created yet, so we just set attributes related to display surface */
LOGD("store display attribute for given surface type(%d)", surface_type);
mm_attrs_set_int_by_name(player->attrs, "display_surface_type", surface_type);
mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(display_overlay));
- if (mmf_attrs_commit(player->attrs))
- {
+ if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit attribute");
MMPLAYER_FLEAVE();
return MM_ERROR_PLAYER_INTERNAL;
}
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
- }
- else
- {
+ } else {
/* get player command status */
- if (!(player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME || player->cmd == MMPLAYER_COMMAND_PAUSE))
- {
- LOGE("invalid player command status(%d), __mmplayer_do_change_videosink() is only available with START/RESUME/PAUSE command",player->cmd);
+ if (!(player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME || player->cmd == MMPLAYER_COMMAND_PAUSE)) {
+ LOGE("invalid player command status(%d), __mmplayer_do_change_videosink() is only available with START/RESUME/PAUSE command", player->cmd);
MMPLAYER_FLEAVE();
return MM_ERROR_PLAYER_INVALID_STATE;
}
@@ -15094,48 +13544,34 @@ int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface
cur_videosink_name = GST_ELEMENT_NAME(player->pipeline->videobin[MMPLAYER_V_SINK].gst);
/* surface change */
- for (i = 0 ; i < num_of_dec ; i++)
- {
+ for (i = 0 ; i < num_of_dec ; i++) {
if (player->pipeline->mainbin &&
- player->pipeline->mainbin[MMPLAYER_M_DEC1+i].gst)
- {
+ player->pipeline->mainbin[MMPLAYER_M_DEC1+i].gst) {
GstElementFactory *decfactory;
decfactory = gst_element_get_factory(player->pipeline->mainbin[MMPLAYER_M_DEC1+i].gst);
klass = gst_element_factory_get_metadata(decfactory, GST_ELEMENT_METADATA_KLASS);
- if ((g_strrstr(klass, "Codec/Decoder/Video")))
- {
- if (!strncmp(cur_videosink_name, "x", 1) && (surface_type == MM_DISPLAY_SURFACE_EVAS))
- {
+ if ((g_strrstr(klass, "Codec/Decoder/Video"))) {
+ if (!strncmp(cur_videosink_name, "x", 1) && (surface_type == MM_DISPLAY_SURFACE_EVAS)) {
ret = __mmplayer_do_change_videosink(player, MMPLAYER_M_DEC1+i, player->ini.videosink_element_evas, surface_type, display_overlay);
- if (ret)
- {
+ if (ret) {
goto ERROR_CASE;
- }
- else
- {
- LOGW("success to changing display surface(%d)",surface_type);
+ } else {
+ LOGW("success to changing display surface(%d)", surface_type);
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
}
- }
- else if (!strncmp(cur_videosink_name, "evas", 4) && (surface_type == MM_DISPLAY_SURFACE_OVERLAY))
- {
+ } else if (!strncmp(cur_videosink_name, "evas", 4) && (surface_type == MM_DISPLAY_SURFACE_OVERLAY)) {
ret = __mmplayer_do_change_videosink(player, MMPLAYER_M_DEC1+i, player->ini.videosink_element_overlay, surface_type, display_overlay);
- if (ret)
- {
+ if (ret) {
goto ERROR_CASE;
- }
- else
- {
- LOGW("success to changing display surface(%d)",surface_type);
+ } else {
+ LOGW("success to changing display surface(%d)", surface_type);
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
}
- }
- else
- {
- LOGE("invalid incoming surface type(%d) and current videosink_name(%s) for changing display surface",surface_type, cur_videosink_name);
+ } else {
+ LOGE("invalid incoming surface type(%d) and current videosink_name(%s) for changing display surface", surface_type, cur_videosink_name);
ret = MM_ERROR_PLAYER_INTERNAL;
goto ERROR_CASE;
}
@@ -15148,8 +13584,7 @@ ERROR_CASE:
/* rollback to previous attributes */
mm_attrs_set_int_by_name(player->attrs, "display_surface_type", prev_display_surface_type);
mm_attrs_set_data_by_name(player->attrs, "display_overlay", prev_display_overlay, sizeof(void*));
- if (mmf_attrs_commit(player->attrs))
- {
+ if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit attributes to rollback");
MMPLAYER_FLEAVE();
return MM_ERROR_PLAYER_INTERNAL;
@@ -15181,8 +13616,7 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
/* get information whether if audiobin is created */
if (!player->pipeline->audiobin ||
- !player->pipeline->audiobin[MMPLAYER_A_SINK].gst)
- {
+ !player->pipeline->audiobin[MMPLAYER_A_SINK].gst) {
LOGW("audiobin is null, this video content may not have audio data");
is_audiobin_created = FALSE;
}
@@ -15194,38 +13628,32 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
/* get src pad of decoder and block it */
src_pad_dec = gst_element_get_static_pad(GST_ELEMENT(player->pipeline->mainbin[dec_index].gst), "src");
- if (!src_pad_dec)
- {
+ if (!src_pad_dec) {
LOGE("failed to get src pad from decode in mainbin");
return MM_ERROR_PLAYER_INTERNAL;
}
- if (!player->doing_seek && previous_state == MM_PLAYER_STATE_PLAYING)
- {
+ if (!player->doing_seek && previous_state == MM_PLAYER_STATE_PLAYING) {
LOGW("trying to block pad(video)");
// if (!gst_pad_set_blocked(src_pad_dec, TRUE))
gst_pad_add_probe(src_pad_dec, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
NULL, NULL, NULL);
-
{
LOGE("failed to set block pad(video)");
return MM_ERROR_PLAYER_INTERNAL;
}
LOGW("pad is blocked(video)");
- }
- else
- {
+ } else {
/* no data flows, so no need to do pad_block */
- if (player->doing_seek) {
+ if (player->doing_seek)
LOGW("not completed seek(%d), do nothing", player->doing_seek);
- }
+
LOGD("MM_PLAYER_STATE is not PLAYING now, skip pad-block(TRUE)");
}
/* remove pad */
if (!gst_element_remove_pad(player->pipeline->videobin[MMPLAYER_V_BIN].gst,
- GST_PAD_CAST(GST_GHOST_PAD(player->ghost_pad_for_videobin))))
- {
+ GST_PAD_CAST(GST_GHOST_PAD(player->ghost_pad_for_videobin)))) {
LOGE("failed to remove previous ghost_pad for videobin");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -15233,16 +13661,14 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
/* change state of videobin to NULL */
LOGD("setting [%s] state to : %d", GST_ELEMENT_NAME(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_STATE_NULL);
ret = gst_element_set_state(player->pipeline->videobin[MMPLAYER_V_BIN].gst, GST_STATE_NULL);
- if (ret != GST_STATE_CHANGE_SUCCESS)
- {
+ if (ret != GST_STATE_CHANGE_SUCCESS) {
LOGE("failed to change state of videobin to NULL");
return MM_ERROR_PLAYER_INTERNAL;
}
/* unlink between decoder and videobin and remove previous videosink from videobin */
- GST_ELEMENT_UNLINK(GST_ELEMENT(player->pipeline->mainbin[dec_index].gst),GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst));
- if (!gst_bin_remove(GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst)))
- {
+ GST_ELEMENT_UNLINK(GST_ELEMENT(player->pipeline->mainbin[dec_index].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst));
+ if (!gst_bin_remove(GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst))) {
LOGE("failed to remove former videosink from videobin");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -15251,8 +13677,7 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
/* create a new videosink and add it to videobin */
player->pipeline->videobin[MMPLAYER_V_SINK].gst = gst_element_factory_make(videosink_element, videosink_element);
- if (!player->pipeline->videobin[MMPLAYER_V_SINK].gst)
- {
+ if (!player->pipeline->videobin[MMPLAYER_V_SINK].gst) {
LOGE("failed to create videosink element\n");
MMPLAYER_FLEAVE();
return MM_ERROR_PLAYER_INTERNAL;
@@ -15262,43 +13687,37 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "qos", TRUE, NULL);
/* save attributes */
- if (player->attrs)
- {
+ if (player->attrs) {
/* set a new display surface type */
mm_attrs_set_int_by_name(player->attrs, "display_surface_type", surface_type);
/* set a new diplay overlay */
- switch (surface_type)
- {
- case MM_DISPLAY_SURFACE_OVERLAY:
- LOGD("save attributes related to video display surface : id = %d", *(int*)display_overlay);
- mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(display_overlay));
- break;
- case MM_DISPLAY_SURFACE_EVAS:
- LOGD("save attributes related to display surface to EVAS : evas image object = %x", display_overlay);
- mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(void*));
- break;
- default:
- LOGE("invalid type(%d) for changing display surface",surface_type);
- MMPLAYER_FLEAVE();
- return MM_ERROR_INVALID_ARGUMENT;
+ switch (surface_type) {
+ case MM_DISPLAY_SURFACE_OVERLAY:
+ LOGD("save attributes related to video display surface : id = %d", *(int*)display_overlay);
+ mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(display_overlay));
+ break;
+ case MM_DISPLAY_SURFACE_EVAS:
+ LOGD("save attributes related to display surface to EVAS : evas image object = %x", display_overlay);
+ mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(void*));
+ break;
+ default:
+ LOGE("invalid type(%d) for changing display surface", surface_type);
+ MMPLAYER_FLEAVE();
+ return MM_ERROR_INVALID_ARGUMENT;
}
- if (mmf_attrs_commit(player->attrs))
- {
+ if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit");
MMPLAYER_FLEAVE();
return MM_ERROR_PLAYER_INTERNAL;
}
- }
- else
- {
+ } else {
LOGE("player->attrs is null, failed to save attributes");
MMPLAYER_FLEAVE();
return MM_ERROR_PLAYER_INTERNAL;
}
/* update video param */
- if (MM_ERROR_NONE != _mmplayer_update_video_param(player, "update_all_param"))
- {
+ if (MM_ERROR_NONE != _mmplayer_update_video_param(player, "update_all_param")) {
LOGE("failed to update video param");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -15306,27 +13725,23 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
/* change state of videobin to READY */
LOGD("setting [%s] state to : %d", GST_ELEMENT_NAME(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_STATE_READY);
ret = gst_element_set_state(player->pipeline->videobin[MMPLAYER_V_BIN].gst, GST_STATE_READY);
- if (ret != GST_STATE_CHANGE_SUCCESS)
- {
+ if (ret != GST_STATE_CHANGE_SUCCESS) {
LOGE("failed to change state of videobin to READY");
return MM_ERROR_PLAYER_INTERNAL;
}
/* change ghostpad */
sink_pad_videosink = gst_element_get_static_pad(GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "sink");
- if (!sink_pad_videosink)
- {
+ if (!sink_pad_videosink) {
LOGE("failed to get sink pad from videosink element");
return MM_ERROR_PLAYER_INTERNAL;
}
player->ghost_pad_for_videobin = gst_ghost_pad_new("sink", sink_pad_videosink);
- if (!gst_pad_set_active(player->ghost_pad_for_videobin, TRUE))
- {
+ if (!gst_pad_set_active(player->ghost_pad_for_videobin, TRUE)) {
LOGE("failed to set active to ghost_pad");
return MM_ERROR_PLAYER_INTERNAL;
}
- if (FALSE == gst_element_add_pad(player->pipeline->videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin))
- {
+ if (FALSE == gst_element_add_pad(player->pipeline->videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin)) {
LOGE("failed to change ghostpad for videobin");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -15334,13 +13749,11 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
/* link decoder with videobin */
sink_pad_videobin = gst_element_get_static_pad(GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst), "sink");
- if (!sink_pad_videobin)
- {
+ if (!sink_pad_videobin) {
LOGE("failed to get sink pad from videobin");
return MM_ERROR_PLAYER_INTERNAL;
}
- if (GST_PAD_LINK_OK != GST_PAD_LINK(src_pad_dec, sink_pad_videobin))
- {
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(src_pad_dec, sink_pad_videobin)) {
LOGE("failed to link");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -15349,80 +13762,59 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
/* clock setting for a new videosink plugin */
/* NOTE : Below operation is needed, because a new videosink plugin doesn't have clock for basesink,
so we set it from audiosink plugin or pipeline(system clock) */
- if (!is_audiobin_created)
- {
+ if (!is_audiobin_created) {
LOGW("audiobin is not created, get clock from pipeline..");
clock = GST_ELEMENT_CLOCK(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst);
- }
- else
- {
+ } else {
clock = GST_ELEMENT_CLOCK(player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
}
- if (clock)
- {
+ if (clock) {
GstClockTime now;
GstClockTime base_time;
LOGD("set the clock to videosink");
gst_element_set_clock(GST_ELEMENT_CAST(player->pipeline->videobin[MMPLAYER_V_SINK].gst), clock);
clock = GST_ELEMENT_CLOCK(player->pipeline->videobin[MMPLAYER_V_SINK].gst);
- if (clock)
- {
+ if (clock) {
LOGD("got clock of videosink");
now = gst_clock_get_time(clock);
base_time = GST_ELEMENT_CAST(player->pipeline->videobin[MMPLAYER_V_SINK].gst)->base_time;
LOGD("at time %" GST_TIME_FORMAT ", base %"
GST_TIME_FORMAT, GST_TIME_ARGS(now), GST_TIME_ARGS(base_time));
- }
- else
- {
+ } else {
LOGE("failed to get clock of videosink after setting clock");
return MM_ERROR_PLAYER_INTERNAL;
}
- }
- else
- {
+ } else
LOGW("failed to get clock, maybe it is the time before first playing");
- }
- if (!player->doing_seek && previous_state == MM_PLAYER_STATE_PLAYING)
- {
+ if (!player->doing_seek && previous_state == MM_PLAYER_STATE_PLAYING) {
/* change state of videobin to PAUSED */
LOGD("setting [%s] state to : %d", GST_ELEMENT_NAME(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_STATE_PLAYING);
ret = gst_element_set_state(player->pipeline->videobin[MMPLAYER_V_BIN].gst, GST_STATE_PLAYING);
- if (ret != GST_STATE_CHANGE_FAILURE)
- {
+ if (ret != GST_STATE_CHANGE_FAILURE) {
LOGW("change state of videobin to PLAYING, ret(%d)", ret);
- }
- else
- {
+ } else {
LOGE("failed to change state of videobin to PLAYING");
return MM_ERROR_PLAYER_INTERNAL;
}
/* release blocked and unref src pad of video decoder */
#if 0
- if (!gst_pad_set_blocked(src_pad_dec, FALSE))
- {
+ if (!gst_pad_set_blocked(src_pad_dec, FALSE)) {
LOGE("failed to set pad blocked FALSE(video)");
return MM_ERROR_PLAYER_INTERNAL;
}
#endif
LOGW("pad is unblocked(video)");
- }
- else
- {
- if (player->doing_seek) {
+ } else {
+ if (player->doing_seek)
LOGW("not completed seek(%d)", player->doing_seek);
- }
/* change state of videobin to PAUSED */
LOGD("setting [%s] state to : %d", GST_ELEMENT_NAME(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_STATE_PAUSED);
ret = gst_element_set_state(player->pipeline->videobin[MMPLAYER_V_BIN].gst, GST_STATE_PAUSED);
- if (ret != GST_STATE_CHANGE_FAILURE)
- {
+ if (ret != GST_STATE_CHANGE_FAILURE) {
LOGW("change state of videobin to PAUSED, ret(%d)", ret);
- }
- else
- {
+ } else {
LOGE("failed to change state of videobin to PLAYING");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -15437,15 +13829,13 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
gint64 pos_msec = 0;
LOGD("do get/set position for new videosink plugin");
- if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position))
- {
+ if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position)) {
LOGE("failed to get position");
return MM_ERROR_PLAYER_INTERNAL;
}
#ifdef SINKCHANGE_WITH_ACCURATE_SEEK
/* accurate seek */
- if (__gst_set_position(player, MM_PLAYER_POS_FORMAT_TIME, position, TRUE))
- {
+ if (__gst_set_position(player, MM_PLAYER_POS_FORMAT_TIME, position, TRUE)) {
LOGE("failed to set position");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -15456,8 +13846,7 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
GST_FORMAT_TIME, (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
GST_SEEK_TYPE_SET, pos_msec,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- if (!ret )
- {
+ if (!ret) {
LOGE("failed to set position");
return MM_ERROR_PLAYER_INTERNAL;
}
@@ -15465,9 +13854,7 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c
}
if (src_pad_dec)
- {
gst_object_unref(src_pad_dec);
- }
LOGD("success to change sink");
MMPLAYER_FLEAVE();
@@ -15495,17 +13882,16 @@ int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent)
return MM_ERROR_NONE;
}
-int _mmplayer_remove_audio_parser_decoder(mm_player_t* player,GstPad *inpad)
+int _mmplayer_remove_audio_parser_decoder(mm_player_t* player, GstPad *inpad)
{
int result = MM_ERROR_NONE;
- GstPad *peer = NULL,*pad = NULL;
+ GstPad *peer = NULL, *pad = NULL;
GstElement *Element = NULL;
MMPlayerGstElement* mainbin = NULL;
mainbin = player->pipeline->mainbin;
#if 0
- if (!gst_pad_set_blocked(inpad,TRUE))
- {
+ if (!gst_pad_set_blocked(inpad, TRUE)) {
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
}
@@ -15516,30 +13902,24 @@ int _mmplayer_remove_audio_parser_decoder(mm_player_t* player,GstPad *inpad)
/*Getting pad connected to demuxer audio pad */
peer = gst_pad_get_peer(inpad);
/* Disconnecting Demuxer and its peer plugin [audio] */
- if (peer)
- {
- if (!gst_pad_unlink(inpad,peer))
- {
+ if (peer) {
+ if (!gst_pad_unlink(inpad, peer)) {
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
}
- }
- else
- {
+ } else {
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
}
/*Removing elements between Demuxer and audiobin*/
- while (peer != NULL)
- {
+ while (peer != NULL) {
gchar *Element_name = NULL;
gchar *factory_name = NULL;
GList *elements = NULL;
GstElementFactory *factory = NULL;
/*Getting peer element*/
Element = gst_pad_get_parent_element(peer);
- if (Element == NULL)
- {
+ if (Element == NULL) {
gst_object_unref(peer);
result = MM_ERROR_PLAYER_INTERNAL;
break;
@@ -15548,63 +13928,49 @@ int _mmplayer_remove_audio_parser_decoder(mm_player_t* player,GstPad *inpad)
Element_name = gst_element_get_name(Element);
factory = gst_element_get_factory(Element);
/*checking the element is audio bin*/
- if (!strcmp(Element_name,"audiobin"))
- {
+ if (!strcmp(Element_name, "audiobin")) {
gst_object_unref(peer);
result = MM_ERROR_NONE;
- g_free(Element_name);
+ g_free(Element_name);
break;
}
factory_name = GST_OBJECT_NAME(factory);
- pad = gst_element_get_static_pad(Element,"src");
- if (pad == NULL)
- {
+ pad = gst_element_get_static_pad(Element, "src");
+ if (pad == NULL) {
result = MM_ERROR_PLAYER_INTERNAL;
- g_free(Element_name);
+ g_free(Element_name);
break;
}
gst_object_unref(peer);
peer = gst_pad_get_peer(pad);
- if (peer)
- {
- if (!gst_pad_unlink(pad,peer))
- {
+ if (peer) {
+ if (!gst_pad_unlink(pad, peer)) {
gst_object_unref(peer);
gst_object_unref(pad);
result = MM_ERROR_PLAYER_INTERNAL;
- g_free(Element_name);
+ g_free(Element_name);
break;
}
}
elements = player->parsers;
/* Removing the element form the list*/
- for (; elements; elements = g_list_next(elements))
- {
+ for (; elements; elements = g_list_next(elements)) {
Element_name = elements->data;
- if (g_strrstr(Element_name,factory_name))
- {
- player->parsers = g_list_remove(player->parsers,elements->data);
- }
+ if (g_strrstr(Element_name, factory_name))
+ player->parsers = g_list_remove(player->parsers, elements->data);
}
- gst_element_set_state(Element,GST_STATE_NULL);
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst),Element);
+ gst_element_set_state(Element, GST_STATE_NULL);
+ gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), Element);
gst_object_unref(pad);
if (Element == mainbin[MMPLAYER_M_Q1].gst)
- {
mainbin[MMPLAYER_M_Q1].gst = NULL;
- }
else if (Element == mainbin[MMPLAYER_M_Q2].gst)
- {
mainbin[MMPLAYER_M_Q2].gst = NULL;
- }
else if (Element == mainbin[MMPLAYER_M_DEC1].gst)
- {
mainbin[MMPLAYER_M_DEC1].gst = NULL;
- }
else if (Element == mainbin[MMPLAYER_M_DEC2].gst)
- {
mainbin[MMPLAYER_M_DEC2].gst = NULL;
- }
+
gst_object_unref(Element);
}
EXIT:
@@ -15632,8 +13998,7 @@ int _mmplayer_sync_subtitle_pipeline(mm_player_t* player)
/* check player handle */
MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline , MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (!(player->pipeline->mainbin) || !(player->pipeline->textbin))
- {
+ if (!(player->pipeline->mainbin) || !(player->pipeline->textbin)) {
LOGE("Pipeline is not in proper state\n");
result = MM_ERROR_PLAYER_NOT_INITIALIZED;
goto EXIT;
@@ -15654,8 +14019,7 @@ int _mmplayer_sync_subtitle_pipeline(mm_player_t* player)
LOGD("base_time=%" GST_TIME_FORMAT " start_time=%" GST_TIME_FORMAT " curr_time=%" GST_TIME_FORMAT,
GST_TIME_ARGS(base_time), GST_TIME_ARGS(start_time), GST_TIME_ARGS(curr_time));
- if (current_state > GST_STATE_READY)
- {
+ if (current_state > GST_STATE_READY) {
// sync state with current pipeline
gst_element_set_state(textbin[MMPLAYER_T_BIN].gst, GST_STATE_PAUSED);
gst_element_set_state(mainbin[MMPLAYER_M_SUBPARSE].gst, GST_STATE_PAUSED);
@@ -15663,23 +14027,19 @@ int _mmplayer_sync_subtitle_pipeline(mm_player_t* player)
ret = gst_element_get_state(mainbin[MMPLAYER_M_SUBSRC].gst, &element_state, &element_pending_state, 5 * GST_SECOND);
if (GST_STATE_CHANGE_FAILURE == ret)
- {
LOGE("fail to state change.\n");
- }
}
gst_element_set_base_time(textbin[MMPLAYER_T_BIN].gst, base_time);
gst_element_set_start_time(textbin[MMPLAYER_T_BIN].gst, start_time);
- if (curr_clock)
- {
+ if (curr_clock) {
gst_element_set_clock(textbin[MMPLAYER_T_BIN].gst, curr_clock);
gst_object_unref(curr_clock);
}
// seek to current position
- if (!gst_element_query_position(mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &time))
- {
+ if (!gst_element_query_position(mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &time)) {
result = MM_ERROR_PLAYER_INVALID_STATE;
LOGE("gst_element_query_position failed, invalid state\n");
goto EXIT;
@@ -15687,12 +14047,9 @@ int _mmplayer_sync_subtitle_pipeline(mm_player_t* player)
LOGD("seek time = %lld\n", time);
event = gst_event_new_seek(1.0, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH), GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
- if (event)
- {
+ if (event) {
__gst_send_event_to_sink(player, event);
- }
- else
- {
+ } else {
result = MM_ERROR_PLAYER_INTERNAL;
LOGE("gst_event_new_seek failed\n");
goto EXIT;
@@ -15727,8 +14084,7 @@ __mmplayer_change_external_subtitle_language(mm_player_t* player, const char* fi
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_RETURN_VAL_IF_FAIL(filepath, MM_ERROR_COMMON_INVALID_ARGUMENT);
- if (!(player->pipeline) || !(player->pipeline->mainbin))
- {
+ if (!(player->pipeline) || !(player->pipeline->mainbin)) {
result = MM_ERROR_PLAYER_INVALID_STATE;
LOGE("Pipeline is not in proper state\n");
goto EXIT;
@@ -15738,24 +14094,21 @@ __mmplayer_change_external_subtitle_language(mm_player_t* player, const char* fi
textbin = player->pipeline->textbin;
current_state = GST_STATE(mainbin[MMPLAYER_M_PIPE].gst);
- if (current_state < GST_STATE_READY)
- {
+ if (current_state < GST_STATE_READY) {
result = MM_ERROR_PLAYER_INVALID_STATE;
LOGE("Pipeline is not in proper state\n");
goto EXIT;
}
attrs = MMPLAYER_GET_ATTRS(player);
- if (!attrs)
- {
+ if (!attrs) {
LOGE("cannot get content attribute\n");
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
}
mm_attrs_get_string_by_name(attrs, "subtitle_uri", &subtitle_uri);
- if (!subtitle_uri || strlen(subtitle_uri) < 1)
- {
+ if (!subtitle_uri || strlen(subtitle_uri) < 1) {
LOGE("subtitle uri is not proper filepath\n");
result = MM_ERROR_PLAYER_INVALID_URI;
goto EXIT;
@@ -15764,16 +14117,12 @@ __mmplayer_change_external_subtitle_language(mm_player_t* player, const char* fi
LOGD("old subtitle file path is [%s]\n", subtitle_uri);
LOGD("new subtitle file path is [%s]\n", filepath);
- if (!strcmp(filepath, subtitle_uri))
- {
+ if (!strcmp(filepath, subtitle_uri)) {
LOGD("No need to swtich subtitle, as input filepath is same as current filepath\n");
goto EXIT;
- }
- else
- {
+ } else {
mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
- if (mmf_attrs_commit(player->attrs))
- {
+ if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit.\n");
goto EXIT;
}
@@ -15782,24 +14131,21 @@ __mmplayer_change_external_subtitle_language(mm_player_t* player, const char* fi
//gst_pad_set_blocked_async(src-srcpad, TRUE)
ret = gst_element_set_state(textbin[MMPLAYER_T_BIN].gst, GST_STATE_READY);
- if (ret != GST_STATE_CHANGE_SUCCESS)
- {
+ if (ret != GST_STATE_CHANGE_SUCCESS) {
LOGE("failed to change state of textbin to READY");
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
}
ret = gst_element_set_state(mainbin[MMPLAYER_M_SUBPARSE].gst, GST_STATE_READY);
- if (ret != GST_STATE_CHANGE_SUCCESS)
- {
+ if (ret != GST_STATE_CHANGE_SUCCESS) {
LOGE("failed to change state of subparse to READY");
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
}
ret = gst_element_set_state(mainbin[MMPLAYER_M_SUBSRC].gst, GST_STATE_READY);
- if (ret != GST_STATE_CHANGE_SUCCESS)
- {
+ if (ret != GST_STATE_CHANGE_SUCCESS) {
LOGE("failed to change state of filesrc to READY");
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
@@ -15808,8 +14154,7 @@ __mmplayer_change_external_subtitle_language(mm_player_t* player, const char* fi
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_SUBSRC].gst), "location", filepath, NULL);
charset = util_get_charset(filepath);
- if (charset)
- {
+ if (charset) {
LOGD("detected charset is %s\n", charset);
g_object_set(G_OBJECT(mainbin[MMPLAYER_M_SUBPARSE].gst), "subtitle-encoding", charset, NULL);
}
@@ -15832,25 +14177,21 @@ int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filep
/* check player handle */
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (!player->pipeline) // IDLE state
- {
+ if (!player->pipeline) {
+ // IDLE state
mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
- if (mmf_attrs_commit(player->attrs))
- {
+ if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit.\n");
- result= MM_ERROR_PLAYER_INTERNAL;
+ result = MM_ERROR_PLAYER_INTERNAL;
}
- }
- else // curr state <> IDLE(READY, PAUSE, PLAYING..)
- {
+ } else {
+ // cur state <> IDLE(READY, PAUSE, PLAYING..)
if (filepath == NULL)
return MM_ERROR_COMMON_INVALID_ARGUMENT;
- if (!__mmplayer_check_subtitle(player))
- {
+ if (!__mmplayer_check_subtitle(player)) {
mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
- if (mmf_attrs_commit(player->attrs))
- {
+ if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit.\n");
result = MM_ERROR_PLAYER_INTERNAL;
}
@@ -15859,11 +14200,8 @@ int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filep
LOGE("fail to create subtitle src\n");
result = _mmplayer_sync_subtitle_pipeline(player);
- }
- else
- {
+ } else
result = __mmplayer_change_external_subtitle_language(player, filepath);
- }
}
MMPLAYER_FLEAVE();
@@ -15890,38 +14228,30 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
mainbin = player->pipeline->mainbin;
- if (type == MM_PLAYER_TRACK_TYPE_AUDIO)
- {
+ if (type == MM_PLAYER_TRACK_TYPE_AUDIO) {
elemId = MMPLAYER_M_A_INPUT_SELECTOR;
- }
- else if (type == MM_PLAYER_TRACK_TYPE_TEXT)
- {
+ } else if (type == MM_PLAYER_TRACK_TYPE_TEXT) {
elemId = MMPLAYER_M_T_INPUT_SELECTOR;
- }
- else
- {
+ } else {
/* Changing Video Track is not supported. */
LOGE("Track Type Error\n");
goto EXIT;
}
- if (mainbin[elemId].gst == NULL)
- {
+ if (mainbin[elemId].gst == NULL) {
result = MM_ERROR_PLAYER_NO_OP;
LOGD("Req track doesn't exist\n");
goto EXIT;
}
total_track_num = player->selector[type].total_track_num;
- if (total_track_num <= 0)
- {
+ if (total_track_num <= 0) {
result = MM_ERROR_PLAYER_NO_OP;
LOGD("Language list is not available \n");
goto EXIT;
}
- if ((index < 0) || (index >= total_track_num))
- {
+ if ((index < 0) || (index >= total_track_num)) {
result = MM_ERROR_INVALID_ARGUMENT;
LOGD("Not a proper index : %d \n", index);
goto EXIT;
@@ -15929,8 +14259,7 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
/*To get the new pad from the selector*/
change_pad_name = g_strdup_printf("sink_%u", index);
- if (change_pad_name == NULL)
- {
+ if (change_pad_name == NULL) {
result = MM_ERROR_PLAYER_INTERNAL;
LOGD("Pad does not exists\n");
goto EXIT;
@@ -15939,8 +14268,7 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
LOGD("new active pad name: %s\n", change_pad_name);
sinkpad = gst_element_get_static_pad(mainbin[elemId].gst, change_pad_name);
- if (sinkpad == NULL)
- {
+ if (sinkpad == NULL) {
LOGD("sinkpad is NULL");
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
@@ -15956,9 +14284,7 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
gst_object_unref(sinkpad);
if (type == MM_PLAYER_TRACK_TYPE_AUDIO)
- {
__mmplayer_set_audio_attrs(player, caps);
- }
EXIT:
@@ -15983,8 +14309,7 @@ int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type
player = (mm_player_t*)hplayer;
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (!player->pipeline)
- {
+ if (!player->pipeline) {
LOGE("Track %d pre setting -> %d\n", type, index);
player->selector[type].active_pad_index = index;
@@ -15997,42 +14322,33 @@ int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type
/*If index is same as running index no need to change the pad*/
if (current_active_index == index)
- {
goto EXIT;
- }
- if (!gst_element_query_position(mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &time))
- {
+ if (!gst_element_query_position(mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &time)) {
result = MM_ERROR_PLAYER_INVALID_STATE;
goto EXIT;
}
current_state = GST_STATE(mainbin[MMPLAYER_M_PIPE].gst);
- if (current_state < GST_STATE_PAUSED)
- {
+ if (current_state < GST_STATE_PAUSED) {
result = MM_ERROR_PLAYER_INVALID_STATE;
LOGW("Pipeline not in porper state\n");
goto EXIT;
}
result = __mmplayer_change_selector_pad(player, type, index);
- if (result != MM_ERROR_NONE)
- {
+ if (result != MM_ERROR_NONE) {
LOGE("change selector pad error\n");
goto EXIT;
}
player->selector[type].active_pad_index = index;
- if (current_state == GST_STATE_PLAYING)
- {
- event = gst_event_new_seek(1.0, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP),GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
- if (event)
- {
+ if (current_state == GST_STATE_PLAYING) {
+ event = gst_event_new_seek(1.0, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP), GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
+ if (event) {
__gst_send_event_to_sink(player, event);
- }
- else
- {
+ } else {
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
}
@@ -16065,7 +14381,7 @@ __is_ms_buff_src(mm_player_t* player)
{
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- return(player->profile.uri_type == MM_PLAYER_URI_TYPE_MS_BUFF) ? TRUE : FALSE;
+ return (player->profile.uri_type == MM_PLAYER_URI_TYPE_MS_BUFF) ? TRUE : FALSE;
}
gboolean
@@ -16079,9 +14395,7 @@ __has_suffix(mm_player_t* player, const gchar* suffix)
gchar* t_suffix = g_ascii_strdown(suffix, -1);
if (g_str_has_suffix(player->profile.uri, suffix))
- {
ret = TRUE;
- }
MMPLAYER_FREEIF(t_url);
MMPLAYER_FREEIF(t_suffix);
@@ -16135,14 +14449,13 @@ _mmplayer_set_video_hub_download_mode(MMHandleType hplayer, bool mode)
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_NULL)
- {
+ if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_NULL) {
MMPLAYER_PRINT_STATE(player);
LOGE("wrong-state : can't set the download mode to parse");
return MM_ERROR_PLAYER_INVALID_STATE;
}
- LOGD("set video hub download mode to %s", (mode)?"ON":"OFF");
+ LOGD("set video hub download mode to %s", (mode) ? "ON" : "OFF");
player->video_hub_download_mode = mode;
return MM_ERROR_NONE;
@@ -16155,14 +14468,14 @@ _mmplayer_enable_sync_handler(MMHandleType hplayer, bool enable)
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- LOGD("enable sync handler : %s", (enable)?"ON":"OFF");
+ LOGD("enable sync handler : %s", (enable) ? "ON" : "OFF");
player->sync_handler = enable;
return MM_ERROR_NONE;
}
int
-_mmplayer_set_video_share_master_clock( MMHandleType hplayer,
+_mmplayer_set_video_share_master_clock(MMHandleType hplayer,
long long clock,
long long clock_delta,
long long video_time,
@@ -16190,8 +14503,7 @@ _mmplayer_set_video_share_master_clock( MMHandleType hplayer,
// LOGD("in(us) : %lld, %lld, %lld, %lld, %lld", clock, clock_delta, video_time, media_clock, audio_time);
- if ((video_time < 0) || (player->doing_seek))
- {
+ if ((video_time < 0) || (player->doing_seek)) {
LOGD("skip setting master clock. %lld", video_time);
goto EXIT;
}
@@ -16207,27 +14519,21 @@ _mmplayer_set_video_share_master_clock( MMHandleType hplayer,
query_ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &position);
if ((current_state != MM_PLAYER_STATE_PLAYING) ||
- (!query_ret))
- {
+ (!query_ret)) {
position = player->last_position;
LOGD("query fail. %lld", position);
}
- clock*= GST_USECOND;
+ clock *= GST_USECOND;
clock_delta *= GST_USECOND;
api_delta = clock - curr_time;
if ((player->video_share_api_delta == 0) || (player->video_share_api_delta > api_delta))
- {
player->video_share_api_delta = api_delta;
- }
else
- {
clock_delta += (api_delta - player->video_share_api_delta);
- }
- if ((player->video_share_clock_delta == 0) || (player->video_share_clock_delta > clock_delta))
- {
+ if ((player->video_share_clock_delta == 0) || (player->video_share_clock_delta > clock_delta)) {
player->video_share_clock_delta = (gint64)clock_delta;
position_delta = (position/GST_USECOND) - video_time;
@@ -16236,11 +14542,9 @@ _mmplayer_set_video_share_master_clock( MMHandleType hplayer,
adj_base_time = position_delta;
LOGD("video_share_clock_delta = %lld, adj = %lld", player->video_share_clock_delta, adj_base_time);
- }
- else
- {
+ } else {
gint64 new_play_time = 0;
- gint64 network_delay =0;
+ gint64 network_delay = 0;
video_time *= GST_USECOND;
@@ -16259,12 +14563,10 @@ _mmplayer_set_video_share_master_clock( MMHandleType hplayer,
* if adj_base_time is positive value, the stream time will be decreased.
* 3. If seek event is occurred, the start time will be reset. */
if ((player->pipeline->audiobin) &&
- (player->pipeline->audiobin[MMPLAYER_A_SINK].gst))
- {
+ (player->pipeline->audiobin[MMPLAYER_A_SINK].gst)) {
start_time_audio = gst_element_get_start_time(player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
- if (start_time_audio != GST_CLOCK_TIME_NONE)
- {
+ if (start_time_audio != GST_CLOCK_TIME_NONE) {
LOGD("audio sink : gst_element_set_start_time -> NONE");
gst_element_set_start_time(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, GST_CLOCK_TIME_NONE);
}
@@ -16273,12 +14575,10 @@ _mmplayer_set_video_share_master_clock( MMHandleType hplayer,
}
if ((player->pipeline->videobin) &&
- (player->pipeline->videobin[MMPLAYER_V_SINK].gst))
- {
+ (player->pipeline->videobin[MMPLAYER_V_SINK].gst)) {
start_time_video = gst_element_get_start_time(player->pipeline->videobin[MMPLAYER_V_SINK].gst);
- if (start_time_video != GST_CLOCK_TIME_NONE)
- {
+ if (start_time_video != GST_CLOCK_TIME_NONE) {
LOGD("video sink : gst_element_set_start_time -> NONE");
gst_element_set_start_time(player->pipeline->videobin[MMPLAYER_V_SINK].gst, GST_CLOCK_TIME_NONE);
}
@@ -16304,7 +14604,7 @@ EXIT:
}
int
-_mmplayer_get_video_share_master_clock( MMHandleType hplayer,
+_mmplayer_get_video_share_master_clock(MMHandleType hplayer,
long long *video_time,
long long *media_clock,
long long *audio_time)
@@ -16337,9 +14637,7 @@ _mmplayer_get_video_share_master_clock( MMHandleType hplayer,
if ((current_state == MM_PLAYER_STATE_PAUSED) ||
(!query_ret))
- {
position = player->last_position;
- }
*media_clock = *video_time = *audio_time = (position/GST_USECOND);
@@ -16364,15 +14662,12 @@ _mmplayer_get_video_rotate_angle(MMHandleType hplayer, int *angle)
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_RETURN_VAL_IF_FAIL(angle, MM_ERROR_COMMON_INVALID_ARGUMENT);
- if (player->v_stream_caps)
- {
+ if (player->v_stream_caps) {
GstStructure *str = NULL;
str = gst_caps_get_structure(player->v_stream_caps, 0);
if (!gst_structure_get_int(str, "orientation", &org_angle))
- {
LOGD("missing 'orientation' field in video caps");
- }
}
LOGD("orientation: %d", org_angle);
@@ -16393,16 +14688,13 @@ __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element)
int idx = 0;
- for (idx = 0; player->ini.dump_element_keyword[idx][0] != '\0'; idx++)
- {
- if (g_strrstr(factory_name, player->ini.dump_element_keyword[idx]))
- {
+ for (idx = 0; player->ini.dump_element_keyword[idx][0] != '\0'; idx++) {
+ if (g_strrstr(factory_name, player->ini.dump_element_keyword[idx])) {
LOGD("dump [%s] sink pad", player->ini.dump_element_keyword[idx]);
mm_player_dump_t *dump_s;
dump_s = g_malloc(sizeof(mm_player_dump_t));
- if (dump_s == NULL)
- {
+ if (dump_s == NULL) {
LOGE("malloc fail");
return FALSE;
}
@@ -16411,19 +14703,16 @@ __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element)
dump_s->dump_pad = NULL;
dump_s->dump_pad = gst_element_get_static_pad(element, "sink");
- if (dump_s->dump_pad)
- {
+ if (dump_s->dump_pad) {
memset(dump_file_name, 0x00, PLAYER_INI_MAX_STRLEN*2);
snprintf(dump_file_name, PLAYER_INI_MAX_STRLEN*2, "%s/%s_sink_pad.dump", player->ini.dump_element_path, player->ini.dump_element_keyword[idx]);
- dump_s->dump_element_file = fopen(dump_file_name,"w+");
+ dump_s->dump_element_file = fopen(dump_file_name, "w+");
dump_s->probe_handle_id = gst_pad_add_probe(dump_s->dump_pad, GST_PAD_PROBE_TYPE_BUFFER, __mmplayer_dump_buffer_probe_cb, dump_s->dump_element_file, NULL);
/* add list for removed buffer probe and close FILE */
player->dump_list = g_list_append(player->dump_list, dump_s);
LOGD("%s sink pad added buffer probe for dump", factory_name);
return TRUE;
- }
- else
- {
+ } else {
g_free(dump_s);
dump_s = NULL;
LOGE("failed to get %s sink pad added", factory_name);
@@ -16457,22 +14746,15 @@ __mmplayer_dump_buffer_probe_cb(GstPad *pad, GstPadProbeInfo *info, gpointer u_
static void
__mmplayer_release_dump_list(GList *dump_list)
{
- if (dump_list)
- {
+ if (dump_list) {
GList *d_list = dump_list;
- for (;d_list ; d_list = g_list_next(d_list))
- {
+ for (; d_list; d_list = g_list_next(d_list)) {
mm_player_dump_t *dump_s = d_list->data;
- if (dump_s->dump_pad)
- {
+ if (dump_s->dump_pad) {
if (dump_s->probe_handle_id)
- {
gst_pad_remove_probe(dump_s->dump_pad, dump_s->probe_handle_id);
- }
-
}
- if (dump_s->dump_element_file)
- {
+ if (dump_s->dump_element_file) {
fclose(dump_s->dump_element_file);
dump_s->dump_element_file = NULL;
}
@@ -16527,7 +14809,7 @@ __gst_appsrc_feed_audio_data(GstElement *element, guint size, gpointer user_data
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_AUDIO;
- guint64 current_level_bytes=0;
+ guint64 current_level_bytes = 0;
MMPLAYER_RETURN_IF_FAIL(player);
@@ -16536,9 +14818,7 @@ __gst_appsrc_feed_audio_data(GstElement *element, guint size, gpointer user_data
LOGI("app-src: feed audio(%llu)\n", current_level_bytes);
if (player->media_stream_buffer_status_cb[type])
- {
player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN, current_level_bytes, player->buffer_cb_user_param);
- }
}
void
@@ -16546,7 +14826,7 @@ __gst_appsrc_feed_video_data(GstElement *element, guint size, gpointer user_data
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_VIDEO;
- guint64 current_level_bytes=0;
+ guint64 current_level_bytes = 0;
MMPLAYER_RETURN_IF_FAIL(player);
@@ -16555,9 +14835,7 @@ __gst_appsrc_feed_video_data(GstElement *element, guint size, gpointer user_data
LOGI("app-src: feed video(%llu)\n", current_level_bytes);
if (player->media_stream_buffer_status_cb[type])
- {
player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN, current_level_bytes, player->buffer_cb_user_param);
- }
}
void
@@ -16565,7 +14843,7 @@ __gst_appsrc_feed_subtitle_data(GstElement *element, guint size, gpointer user_d
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_TEXT;
- guint64 current_level_bytes=0;
+ guint64 current_level_bytes = 0;
MMPLAYER_RETURN_IF_FAIL(player);
@@ -16574,9 +14852,7 @@ __gst_appsrc_feed_subtitle_data(GstElement *element, guint size, gpointer user_d
g_object_get(G_OBJECT(element), "current-level-bytes", &current_level_bytes, NULL);
if (player->media_stream_buffer_status_cb[type])
- {
player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN, current_level_bytes, player->buffer_cb_user_param);
- }
}
void
@@ -16584,7 +14860,7 @@ __gst_appsrc_enough_audio_data(GstElement *element, gpointer user_data)
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_AUDIO;
- guint64 current_level_bytes=0;
+ guint64 current_level_bytes = 0;
MMPLAYER_RETURN_IF_FAIL(player);
@@ -16593,9 +14869,7 @@ __gst_appsrc_enough_audio_data(GstElement *element, gpointer user_data)
g_object_get(G_OBJECT(element), "current-level-bytes", &current_level_bytes, NULL);
if (player->media_stream_buffer_status_cb[type])
- {
player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW, current_level_bytes, player->buffer_cb_user_param);
- }
}
void
@@ -16603,7 +14877,7 @@ __gst_appsrc_enough_video_data(GstElement *element, gpointer user_data)
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_VIDEO;
- guint64 current_level_bytes=0;
+ guint64 current_level_bytes = 0;
MMPLAYER_RETURN_IF_FAIL(player);
@@ -16612,9 +14886,7 @@ __gst_appsrc_enough_video_data(GstElement *element, gpointer user_data)
g_object_get(G_OBJECT(element), "current-level-bytes", &current_level_bytes, NULL);
if (player->media_stream_buffer_status_cb[type])
- {
player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW, current_level_bytes, player->buffer_cb_user_param);
- }
}
gboolean
@@ -16628,9 +14900,7 @@ __gst_seek_audio_data(GstElement * appsrc, guint64 position, gpointer user_data)
LOGD("app-src: seek audio data %llu\n", position);
if (player->media_stream_seek_data_cb[type])
- {
player->media_stream_seek_data_cb[type](type, position, player->buffer_cb_user_param);
- }
return TRUE;
}
@@ -16646,9 +14916,7 @@ __gst_seek_video_data(GstElement * appsrc, guint64 position, gpointer user_data)
LOGD("app-src: seek video data %llu\n", position);
if (player->media_stream_seek_data_cb[type])
- {
player->media_stream_seek_data_cb[type](type, position, player->buffer_cb_user_param);
- }
return TRUE;
}
@@ -16664,9 +14932,7 @@ __gst_seek_subtitle_data(GstElement * appsrc, guint64 position, gpointer user_da
LOGD("app-src: seek subtitle data\n");
if (player->media_stream_seek_data_cb[type])
- {
player->media_stream_seek_data_cb[type](type, position, player->buffer_cb_user_param);
- }
return TRUE;
}