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).
This commit is contained in:
Tim-Philipp Müller 2007-01-17 16:11:14 +00:00
parent 0eac623115
commit 5262208d6e
5 changed files with 56 additions and 8 deletions

View file

@ -1,3 +1,16 @@
2007-01-17 Tim-Philipp Müller <tim at centricular dot net>
* 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 <tim at centricular dot net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):

View file

@ -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 \

View file

@ -23,6 +23,7 @@
#include <string.h>
#include <gst/gst.h>
#include <gst/utils/base-utils.h>
#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:

View file

@ -28,6 +28,7 @@
#include <string.h>
#include <gst/gst.h>
#include <gst/utils/base-utils.h>
#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;
}

View file

@ -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, "