static int __mmplayer_gst_create_audio_sink_bin(mmplayer_t *player);
static int __mmplayer_gst_create_text_sink_bin(mmplayer_t *player);
-static void __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data);
static void __mmplayer_gst_create_sinkbin(GstElement *decodebin, GstPad *pad, gpointer data);
-static void __mmplayer_gst_decode_unknown_type(GstElement *elem, GstPad *pad, GstCaps *caps, gpointer data);
-static gboolean __mmplayer_gst_decode_autoplug_continue(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer data);
-static void __mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad *new_pad, gpointer data);
-static void __mmplayer_gst_decode_drained(GstElement *bin, gpointer data);
-static void __mmplayer_pipeline_complete(GstElement *decodebin, gpointer data);
static gboolean __mmplayer_is_midi_type(gchar *str_caps);
static gboolean __mmplayer_is_only_mp3_type(gchar *str_caps);
-static void __mmplayer_set_audio_attrs(mmplayer_t *player, GstCaps *caps);
+static void __mmplayer_set_audio_attrs(mmplayer_t *player, GstCaps *caps);
static gboolean __mmplayer_update_subtitle(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data);
static void __mmplayer_release_misc(mmplayer_t *player);
LOGD("surface type : %d", stype);
- if (MMPLAYER_IS_MS_BUFF_SRC(player)) {
+ if (MMPLAYER_IS_MS_BUFF_SRC(player) || MMPLAYER_USE_URIDECODEBIN3(player)) {
__mmplayer_gst_create_sinkbin(elem, pad, player);
goto DONE;
}
gint samplerate = 0;
gint channels = 0;
- if (MMPLAYER_IS_MS_BUFF_SRC(player) || player->build_audio_offload) {
+ if (MMPLAYER_IS_MS_BUFF_SRC(player) || MMPLAYER_USE_URIDECODEBIN3(player) || player->build_audio_offload) {
if (player->build_audio_offload)
player->no_more_pad = TRUE; /* remove state holder */
__mmplayer_gst_create_sinkbin(elem, pad, player);
}
if (player->num_dynamic_pad == 0) /* FIXME: num_dynamic_pad is only for rtsp? */
- __mmplayer_pipeline_complete(NULL, player);
+ _mmplayer_pipeline_complete(NULL, player);
return TRUE;
}
return TRUE;
}
-static void
-__mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
+void
+_mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
{
mmplayer_t *player = NULL;
GstElement *video_selector = NULL;
LOGD("no more pads: %d, stream count dec : %d(num of dynamic pad)", player->no_more_pad, player->num_dynamic_pad);
if ((player->no_more_pad) && (player->num_dynamic_pad == 0))
- __mmplayer_pipeline_complete(NULL, player);
+ _mmplayer_pipeline_complete(NULL, player);
ERROR:
MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
player->no_more_pad = TRUE;
- __mmplayer_pipeline_complete(NULL, player);
+ _mmplayer_pipeline_complete(NULL, player);
MMPLAYER_FLEAVE();
return;
MMPLAYER_FREEIF(player->type);
player->no_more_pad = FALSE;
player->num_dynamic_pad = 0;
- player->demux_pad_index = 0;
MMPLAYER_SUBTITLE_INFO_LOCK(player);
player->subtitle_language_list = NULL;
player->is_subtitle_off = FALSE; /* set the subtitle ON default */
player->video360_metadata.is_spherical = -1;
player->is_openal_plugin_used = FALSE;
- player->demux_pad_index = 0;
player->subtitle_language_list = NULL;
player->is_subtitle_force_drop = FALSE;
GstCaps *caps, gpointer data)
{
mmplayer_t *player = (mmplayer_t *)data;
- GstPad *pad = NULL;
MMPLAYER_FENTER();
__mmplayer_update_content_type_info(player);
- pad = gst_element_get_static_pad(tf, "src");
- if (!pad) {
- LOGE("fail to get typefind src pad.");
- return;
- }
+ if (!player->pipeline->mainbin[MMPLAYER_M_AUTOPLUG].gst) {
+ GstPad *pad = NULL;
- if (!_mmplayer_gst_create_decoder(player, pad, caps)) {
- gboolean async = FALSE;
- LOGE("failed to autoplug %s", player->type);
+ pad = gst_element_get_static_pad(tf, "src");
+ if (!pad) {
+ LOGE("fail to get typefind src pad.");
+ return;
+ }
- mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
+ if (!_mmplayer_gst_create_decoder(player, pad, caps)) {
+ gboolean async = FALSE;
+ LOGE("failed to autoplug %s", player->type);
- if (async && player->msg_posted == FALSE)
- __mmplayer_handle_missed_plugin(player);
+ mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
+ if (async && player->msg_posted == FALSE)
+ __mmplayer_handle_missed_plugin(player);
+ }
+ gst_object_unref(GST_OBJECT(pad));
}
-
- gst_object_unref(GST_OBJECT(pad));
-
MMPLAYER_FLEAVE();
-
return;
}
/* no-more-pad pad handling signal */
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
- G_CALLBACK(__mmplayer_gst_decode_no_more_pads), (gpointer)player);
+ G_CALLBACK(_mmplayer_gst_decode_no_more_pads), (gpointer)player);
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-removed",
- G_CALLBACK(__mmplayer_gst_decode_pad_removed), (gpointer)player);
+ G_CALLBACK(_mmplayer_gst_decode_pad_removed), (gpointer)player);
/* This signal is emitted when a pad for which there is no further possible
decoding is added to the decodebin.*/
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "unknown-type",
- G_CALLBACK(__mmplayer_gst_decode_unknown_type), (gpointer)player);
+ G_CALLBACK(_mmplayer_gst_decode_unknown_type), (gpointer)player);
/* This signal is emitted whenever decodebin finds a new stream. It is emitted
before looking for any elements that can handle that stream.*/
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "autoplug-continue",
- G_CALLBACK(__mmplayer_gst_decode_autoplug_continue), (gpointer)player);
+ G_CALLBACK(_mmplayer_gst_decode_autoplug_continue), (gpointer)player);
if (player->need_video_dec_sorting || player->need_audio_dec_sorting)
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "autoplug-sort",
/* This signal is emitted once decodebin has finished decoding all the data.*/
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "drained",
- G_CALLBACK(__mmplayer_gst_decode_drained), (gpointer)player);
+ G_CALLBACK(_mmplayer_gst_decode_drained), (gpointer)player);
/* This signal is emitted when a element is added to the bin.*/
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "element-added",
return MM_ERROR_NONE;
}
-static void
-__mmplayer_pipeline_complete(GstElement *decodebin, gpointer data)
+void
+_mmplayer_pipeline_complete(GstElement *decodebin, gpointer data)
{
mmplayer_t *player = (mmplayer_t *)data;
/* remove fakesink. */
if (!_mmplayer_gst_remove_fakesink(player,
&player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK])) {
- /* NOTE : __mmplayer_pipeline_complete() can be called several time. because
+ /* 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 MM_ERROR_NONE;
}
-static void
-__mmplayer_gst_decode_unknown_type(GstElement *elem, GstPad *pad,
+void
+_mmplayer_gst_decode_unknown_type(GstElement *elem, GstPad *pad,
GstCaps *caps, gpointer data)
{
mmplayer_t *player = (mmplayer_t *)data;
__mmplayer_check_not_supported_codec(player, klass, mime);
}
-static gboolean
-__mmplayer_gst_decode_autoplug_continue(GstElement *bin, GstPad *pad,
- GstCaps *caps, gpointer data)
+gboolean
+_mmplayer_gst_decode_autoplug_continue(GstElement *bin, GstPad *pad,
+ GstCaps *caps, gpointer data)
{
mmplayer_t *player = (mmplayer_t *)data;
const char *mime = NULL;
gchar (*sw_dec_info)[PLAYER_INI_MAX_STRLEN] = {NULL, };
factory = g_value_get_object(g_value_array_get_nth(factories, i));
+ if (!factory) {
+ LOGW("failed to get factory object");
+ continue;
+ }
klass = gst_element_factory_get_klass(factory);
factory_name = GST_OBJECT_NAME(factory);
if (codec_type == MM_PLAYER_CODEC_TYPE_HW) {
if (hw_dec_idx < first_sw_dec_idx)
return NULL;
- new_pos = first_sw_dec_idx - 1;
+ new_pos = first_sw_dec_idx;
rm_pos = hw_dec_idx + 1;
} else if (codec_type == MM_PLAYER_CODEC_TYPE_SW) {
if (last_sw_dec_idx < hw_dec_idx)
}
/* change position - insert H/W decoder according to the new position */
- new_factories = g_value_array_copy(factories);
factory = g_value_get_object(g_value_array_get_nth(factories, hw_dec_idx));
+ if (!factory) {
+ LOGW("failed to get factory object");
+ return NULL;
+ }
+ new_factories = g_value_array_copy(factories);
g_value_init (&val, G_TYPE_OBJECT);
g_value_set_object (&val, factory);
g_value_array_insert(new_factories, new_pos, &val);
for (int i = 0 ; i < new_factories->n_values ; i++) {
factory = g_value_get_object(g_value_array_get_nth(new_factories, i));
-
- LOGD("[Re-arranged] Klass [%s] Factory [%s]",
- gst_element_factory_get_klass(factory), GST_OBJECT_NAME (factory));
+ if (factory)
+ LOGD("[Re-arranged] Klass [%s] Factory [%s]",
+ gst_element_factory_get_klass(factory), GST_OBJECT_NAME (factory));
+ else
+ LOGE("[Re-arranged] failed to get factory object");
}
return new_factories;
return result;
}
-static void
-__mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad *new_pad,
+void
+_mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad *new_pad,
gpointer data)
{
//mmplayer_t *player = (mmplayer_t *)data;
gst_caps_unref(caps);
}
-static void
-__mmplayer_gst_decode_drained(GstElement *bin, gpointer data)
+void
+_mmplayer_gst_decode_drained(GstElement *bin, gpointer data)
{
mmplayer_t *player = (mmplayer_t *)data;
GstIterator *iter = NULL;
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player);
- LOGD("__mmplayer_gst_decode_drained");
+ LOGD("got drained signal");
if (!MMPLAYER_CMD_TRYLOCK(player)) {
LOGW("Fail to get cmd lock");