playbin2: use private copy of input-selector

We shouldn't really depend on elements from -bad for stream
selection in playbin2, so use a private copy of input-selector
until the selector plugin is ready to be moved to -base or -good.
Fixes #586356.
This commit is contained in:
Tim-Philipp Müller 2009-07-15 17:40:14 +01:00
parent e1df8d0691
commit 5366b61bfc
5 changed files with 20 additions and 8 deletions

View file

@ -17,6 +17,7 @@ libgstplaybin_la_SOURCES = \
gstplaybasebin.c \
gstplay-enum.c \
gstfactorylists.c \
gstinputselector.c \
gstscreenshot.c \
gststreaminfo.c \
gststreamselector.c
@ -59,6 +60,7 @@ noinst_HEADERS = \
gstplaysink.h \
gststreaminfo.h \
gstfactorylists.h \
gstinputselector.h \
gstplay-enum.h \
gstscreenshot.h \
gststreamselector.h

View file

@ -36,7 +36,7 @@
#include <string.h>
#include "gstinputselector.h"
#include "gstselector-marshal.h"
#include "gstplay-marshal.h"
GST_DEBUG_CATEGORY_STATIC (input_selector_debug);
#define GST_CAT_DEFAULT input_selector_debug
@ -154,7 +154,7 @@ static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
static GType
GType
gst_selector_pad_get_type (void)
{
static GType selector_pad_type = 0;
@ -173,7 +173,7 @@ gst_selector_pad_get_type (void)
};
selector_pad_type =
g_type_register_static (GST_TYPE_PAD, "GstSelectorPad",
g_type_register_static (GST_TYPE_PAD, "GstPlaybin2SelectorPad",
&selector_pad_info, 0);
}
return selector_pad_type;
@ -711,9 +711,9 @@ gst_input_selector_get_type (void)
};
input_selector_type =
g_type_register_static (GST_TYPE_ELEMENT,
"GstInputSelector", &input_selector_info, 0);
"GstPlaybin2InputSelector", &input_selector_info, 0);
GST_DEBUG_CATEGORY_INIT (input_selector_debug,
"input-selector", 0, "An input stream selector element");
"playbin2-input-selector", 0, "Playbin2 input stream selector element");
}
return input_selector_type;
@ -770,7 +770,7 @@ gst_input_selector_class_init (GstInputSelectorClass * klass)
g_signal_new ("block", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GstInputSelectorClass, block), NULL, NULL,
gst_selector_marshal_INT64__VOID, G_TYPE_INT64, 0);
gst_play_marshal_INT64__VOID, G_TYPE_INT64, 0);
/**
* GstInputSelector::switch:
* @inputselector: the #GstInputSelector
@ -820,7 +820,7 @@ gst_input_selector_class_init (GstInputSelectorClass * klass)
gst_input_selector_signals[SIGNAL_SWITCH] =
g_signal_new ("switch", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstInputSelectorClass, switch_),
NULL, NULL, gst_selector_marshal_VOID__OBJECT_INT64_INT64,
NULL, NULL, gst_play_marshal_VOID__OBJECT_INT64_INT64,
G_TYPE_NONE, 3, GST_TYPE_PAD, G_TYPE_INT64, G_TYPE_INT64);
gstelement_class->request_new_pad = gst_input_selector_request_new_pad;

View file

@ -78,6 +78,7 @@ struct _GstInputSelectorClass {
};
GType gst_input_selector_get_type (void);
GType gst_selector_pad_get_type (void);
G_END_DECLS

View file

@ -8,3 +8,5 @@ BOXED:OBJECT,BOXED,BOXED
BOXED:INT
OBJECT:BOXED
OBJECT:INT
INT64:VOID
VOID:OBJECT,INT64,INT64

View file

@ -230,6 +230,7 @@
#include "gstplay-marshal.h"
#include "gstplaysink.h"
#include "gstfactorylists.h"
#include "gstinputselector.h"
#include "gstscreenshot.h"
GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
@ -1955,7 +1956,10 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
if (select->selector == NULL && playbin->have_selector) {
/* no selector, create one */
GST_DEBUG_OBJECT (playbin, "creating new selector");
select->selector = gst_element_factory_make ("input-selector", NULL);
select->selector = g_object_new (GST_TYPE_INPUT_SELECTOR, NULL);
/* the above can't fail, but we keep the error handling around for when
* the selector plugin has moved to -base or -good and we stop using an
* internal copy of input-selector */
if (select->selector == NULL) {
/* post the missing selector message only once */
playbin->have_selector = FALSE;
@ -2890,6 +2894,9 @@ gst_play_bin2_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin2", 0, "play bin");
g_type_class_ref (gst_input_selector_get_type ());
g_type_class_ref (gst_selector_pad_get_type ());
return gst_element_register (plugin, "playbin2", GST_RANK_NONE,
GST_TYPE_PLAY_BIN);
}