From 5262208d6eca9d35e0b6925fef467c9461658b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 17 Jan 2007 16:11:14 +0000 Subject: [PATCH] gst/playback/: Let decodebin be the element to post missing-plugin messages for missing decoders (rather than playbin... Original commit message from CVS: * gst/playback/Makefile.am: * gst/playback/gstdecodebin.c: (close_pad_link): * gst/playback/gstdecodebin2.c: (analyze_new_pad): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (gst_play_base_bin_handle_message_func), (unknown_type): Let decodebin be the element to post missing-plugin messages for missing decoders (rather than playbin); make playbin implement GstBin::handle_message so we can suppress missing-plugin messages for types we're not handling on purpose (don't want to bring up an installer in those cases). --- ChangeLog | 13 +++++++++++++ gst/playback/Makefile.am | 12 ++++++++---- gst/playback/gstdecodebin.c | 4 ++++ gst/playback/gstdecodebin2.c | 5 +++++ gst/playback/gstplaybasebin.c | 30 ++++++++++++++++++++++++++---- 5 files changed, 56 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78d55f2d84..f352bb5b4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-01-17 Tim-Philipp Müller + + * gst/playback/Makefile.am: + * gst/playback/gstdecodebin.c: (close_pad_link): + * gst/playback/gstdecodebin2.c: (analyze_new_pad): + * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), + (gst_play_base_bin_handle_message_func), (unknown_type): + Let decodebin be the element to post missing-plugin messages for + missing decoders (rather than playbin); make playbin implement + GstBin::handle_message so we can suppress missing-plugin messages + for types we're not handling on purpose (don't want to bring up an + installer in those cases). + 2007-01-16 Tim-Philipp Müller * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps): diff --git a/gst/playback/Makefile.am b/gst/playback/Makefile.am index c395504a71..35a8cf0ff9 100644 --- a/gst/playback/Makefile.am +++ b/gst/playback/Makefile.am @@ -24,15 +24,19 @@ libgstplaybin_la_LIBADD = \ libgstdecodebin_la_SOURCES = gstdecodebin.c nodist_libgstdecodebin_la_SOURCES = $(built_sources) -libgstdecodebin_la_CFLAGS = $(GST_CFLAGS) +libgstdecodebin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) libgstdecodebin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstdecodebin_la_LIBADD = $(GST_LIBS) +libgstdecodebin_la_LIBADD = \ + $(top_builddir)/gst-libs/gst/utils/libgstbaseutils-@GST_MAJORMINOR@.la \ + $(GST_LIBS) libgstdecodebin2_la_SOURCES = gstdecodebin2.c nodist_libgstdecodebin2_la_SOURCES = $(built_sources) -libgstdecodebin2_la_CFLAGS = $(GST_CFLAGS) +libgstdecodebin2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) libgstdecodebin2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstdecodebin2_la_LIBADD = $(GST_LIBS) +libgstdecodebin2_la_LIBADD = \ + $(top_builddir)/gst-libs/gst/utils/libgstbaseutils-@GST_MAJORMINOR@.la \ + $(GST_LIBS) noinst_HEADERS = \ gstplaybasebin.h \ diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index 47d2844308..5460dcd8c1 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -23,6 +23,7 @@ #include #include +#include #include "gstplay-marshal.h" @@ -775,6 +776,9 @@ unknown_type: GST_LOG_OBJECT (pad, "unknown type found, fire signal"); g_signal_emit (G_OBJECT (decode_bin), gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps); + + gst_element_post_message (GST_ELEMENT_CAST (decode_bin), + gst_missing_decoder_message_new (GST_ELEMENT_CAST (decode_bin), caps)); return; } dont_know_yet: diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 7caae51757..e5ca36145a 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -28,6 +28,7 @@ #include #include +#include #include "gstplay-marshal.h" @@ -691,9 +692,13 @@ unknown_type: GST_LOG_OBJECT (pad, "Unknown type, firing signal"); g_signal_emit (G_OBJECT (dbin), gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps); + /* Check if there are no pending groups, if so, remove fakesink */ if (dbin->groups == NULL) remove_fakesink (dbin); + + gst_element_post_message (GST_ELEMENT_CAST (dbin), + gst_missing_decoder_message_new (GST_ELEMENT_CAST (dbin), caps)); return; } diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index 9d37b6cd0a..2ad2b09317 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -69,6 +69,8 @@ static void gst_play_base_bin_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * spec); static void gst_play_base_bin_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * spec); +static void gst_play_base_bin_handle_message_func (GstBin * bin, + GstMessage * msg); static GstStateChangeReturn gst_play_base_bin_change_state (GstElement * element, GstStateChange transition); @@ -196,6 +198,9 @@ gst_play_base_bin_class_init (GstPlayBaseBinClass * klass) gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_play_base_bin_dispose); gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_play_base_bin_finalize); + gstbin_klass->handle_message = + GST_DEBUG_FUNCPTR (gst_play_base_bin_handle_message_func); + gstelement_klass->change_state = GST_DEBUG_FUNCPTR (gst_play_base_bin_change_state); } @@ -934,6 +939,27 @@ static const gchar *blacklisted_mimes[] = { #define IS_BLACKLISTED_MIME(type) (string_arr_has_str(blacklisted_mimes,type)) +static void +gst_play_base_bin_handle_message_func (GstBin * bin, GstMessage * msg) +{ + if (gst_is_missing_plugin_message (msg)) { + gchar *detail; + guint i; + + detail = gst_missing_plugin_message_get_installer_detail (msg); + for (i = 0; detail != NULL && blacklisted_mimes[i] != NULL; ++i) { + if (strstr (detail, "|decoder-") && strstr (detail, blacklisted_mimes[i])) { + GST_LOG_OBJECT (bin, "suppressing message %" GST_PTR_FORMAT, msg); + gst_message_unref (msg); + g_free (detail); + return; + } + } + g_free (detail); + } + GST_BIN_CLASS (parent_class)->handle_message (bin, msg); +} + /* * signal fired when an unknown stream is found. We create a new * UNKNOWN streaminfo object. @@ -948,7 +974,6 @@ unknown_type (GstElement * element, GstPad * pad, GstCaps * caps, type_name = gst_structure_get_name (gst_caps_get_structure (caps, 0)); if (type_name && !IS_BLACKLISTED_MIME (type_name)) { - GstMessage *msg; gchar *capsstr; capsstr = gst_caps_to_string (caps); @@ -956,9 +981,6 @@ unknown_type (GstElement * element, GstPad * pad, GstCaps * caps, /* FIXME, g_message() ? */ g_message ("don't know how to handle %s", capsstr); g_free (capsstr); - - msg = gst_missing_decoder_message_new (GST_ELEMENT (play_base_bin), caps); - gst_element_post_message (GST_ELEMENT_CAST (play_base_bin), msg); } else { /* don't spew stuff to the terminal or send message if it's blacklisted */ GST_DEBUG_OBJECT (play_base_bin, "media type %s not handled on purpose, "