gstreamer/gst/playback/gststreamselector.c

681 lines
20 KiB
C
Raw Normal View History

2005-01-08 18:31:22 +00:00
/* GStreamer
* Copyright (C) 2003 Julien Moutte <julien@moutte.net>
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com>
* Copyright (C) 2007 Wim Taymans <wim.taymans@gmail.com>
2005-01-08 18:31:22 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
2005-01-08 18:31:22 +00:00
#include "gststreamselector.h"
GST_DEBUG_CATEGORY_STATIC (stream_selector_debug);
#define GST_CAT_DEFAULT stream_selector_debug
make GstElementDetails const Original commit message from CVS: * ext/alsa/gstalsamixerelement.c: * ext/alsa/gstalsasrc.c: * ext/cdparanoia/gstcdparanoiasrc.c: * ext/gnomevfs/gstgnomevfssink.c: * ext/gnomevfs/gstgnomevfssrc.c: * ext/ogg/gstoggdemux.c: * ext/ogg/gstoggmux.c: * ext/ogg/gstoggparse.c: * ext/ogg/gstogmparse.c: * ext/pango/gstclockoverlay.c: * ext/pango/gsttextoverlay.c: * ext/pango/gsttextrender.c: * ext/pango/gsttimeoverlay.c: * ext/theora/theoradec.c: * ext/theora/theoraenc.c: * ext/vorbis/vorbisdec.c: * ext/vorbis/vorbisenc.c: * gst-libs/gst/audio/gstaudiofilter.c: * gst-libs/gst/audio/gstaudiofiltertemplate.c: * gst/audioconvert/gstaudioconvert.c: * gst/audiorate/gstaudiorate.c: * gst/audioresample/gstaudioresample.c: * gst/audiotestsrc/gstaudiotestsrc.c: * gst/ffmpegcolorspace/gstffmpegcolorspace.c: * gst/playback/gstdecodebin.c: * gst/playback/gstplaybin.c: * gst/playback/gststreamselector.c: * gst/subparse/gstsubparse.c: * gst/tcp/gstmultifdsink.c: * gst/tcp/gsttcpclientsink.c: * gst/tcp/gsttcpclientsrc.c: * gst/tcp/gsttcpserversink.c: * gst/tcp/gsttcpserversrc.c: * gst/typefind/gsttypefindfunctions.c: (plugin_init): * gst/videorate/gstvideorate.c: * gst/videoscale/gstvideoscale.c: * gst/videotestsrc/gstvideotestsrc.c: * gst/volume/gstvolume.c: * sys/v4l/gstv4ljpegsrc.c: * sys/v4l/gstv4lmjpegsink.c: * sys/v4l/gstv4lmjpegsrc.c: * sys/v4l/gstv4lsrc.c: * sys/ximage/ximagesink.c: * sys/xvimage/xvimagesink.c: * tests/check/libs/cddabasesrc.c: make GstElementDetails const
2006-04-28 19:46:37 +00:00
static const GstElementDetails gst_stream_selector_details =
Add docs for adder, use GST_ELEMENT_DETAILS macro, define GstElementDetails at the top Original commit message from CVS: * docs/plugins/Makefile.am: * docs/plugins/gst-plugins-base-plugins-docs.sgml: * docs/plugins/gst-plugins-base-plugins-sections.txt: * ext/cdparanoia/gstcdparanoiasrc.c: * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_base_init), (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_base_init): * ext/ogg/gstoggdemux.c: (gst_ogg_demux_base_init): * ext/ogg/gstoggmux.c: * ext/ogg/gstoggparse.c: (gst_ogg_parse_base_init): * ext/ogg/gstogmparse.c: (gst_ogm_audio_parse_base_init), (gst_ogm_video_parse_base_init), (gst_ogm_text_parse_base_init): * ext/pango/gsttextoverlay.c: * ext/pango/gsttextrender.c: * ext/theora/theoradec.c: * ext/theora/theoraenc.c: * ext/vorbis/vorbisdec.c: * ext/vorbis/vorbisenc.c: * gst-libs/gst/audio/gstaudiofilter.c: (gst_audio_filter_base_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_base_init): * gst/adder/gstadder.c: (gst_adder_get_type): * gst/adder/gstadder.h: * gst/audioconvert/gstaudioconvert.c: * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audiostestsrc_wave_get_type), (gst_audio_test_src_class_init), (gst_audio_test_src_create): * gst/ffmpegcolorspace/gstffmpegcolorspace.c: * gst/playback/gstdecodebin.c: * gst/playback/gstplaybin.c: * gst/playback/gststreamselector.c: (gst_stream_selector_base_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_base_init): * gst/volume/gstvolume.c: * sys/v4l/gstv4lmjpegsink.c: * sys/v4l/gstv4lmjpegsrc.c: * tests/check/libs/cddabasesrc.c: * tests/old/examples/gob/gst-identity2.gob: Add docs for adder, use GST_ELEMENT_DETAILS macro, define GstElementDetails at the top
2006-03-24 10:42:11 +00:00
GST_ELEMENT_DETAILS ("StreamSelector",
"Generic",
"N-to-1 input stream_selectoring",
"Julien Moutte <julien@moutte.net>\n"
"Ronald S. Bultje <rbultje@ronald.bitfreak.net>\n"
"Jan Schmidt <thaytan@mad.scientist.com>\n"
"Wim Taymans <wim.taymans@gmail.com>");
Add docs for adder, use GST_ELEMENT_DETAILS macro, define GstElementDetails at the top Original commit message from CVS: * docs/plugins/Makefile.am: * docs/plugins/gst-plugins-base-plugins-docs.sgml: * docs/plugins/gst-plugins-base-plugins-sections.txt: * ext/cdparanoia/gstcdparanoiasrc.c: * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_base_init), (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_base_init): * ext/ogg/gstoggdemux.c: (gst_ogg_demux_base_init): * ext/ogg/gstoggmux.c: * ext/ogg/gstoggparse.c: (gst_ogg_parse_base_init): * ext/ogg/gstogmparse.c: (gst_ogm_audio_parse_base_init), (gst_ogm_video_parse_base_init), (gst_ogm_text_parse_base_init): * ext/pango/gsttextoverlay.c: * ext/pango/gsttextrender.c: * ext/theora/theoradec.c: * ext/theora/theoraenc.c: * ext/vorbis/vorbisdec.c: * ext/vorbis/vorbisenc.c: * gst-libs/gst/audio/gstaudiofilter.c: (gst_audio_filter_base_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_base_init): * gst/adder/gstadder.c: (gst_adder_get_type): * gst/adder/gstadder.h: * gst/audioconvert/gstaudioconvert.c: * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audiostestsrc_wave_get_type), (gst_audio_test_src_class_init), (gst_audio_test_src_create): * gst/ffmpegcolorspace/gstffmpegcolorspace.c: * gst/playback/gstdecodebin.c: * gst/playback/gstplaybin.c: * gst/playback/gststreamselector.c: (gst_stream_selector_base_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_base_init): * gst/volume/gstvolume.c: * sys/v4l/gstv4lmjpegsink.c: * sys/v4l/gstv4lmjpegsrc.c: * tests/check/libs/cddabasesrc.c: * tests/old/examples/gob/gst-identity2.gob: Add docs for adder, use GST_ELEMENT_DETAILS macro, define GstElementDetails at the top
2006-03-24 10:42:11 +00:00
2005-01-08 18:31:22 +00:00
static GstStaticPadTemplate gst_stream_selector_sink_factory =
GST_STATIC_PAD_TEMPLATE ("sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS_ANY);
static GstStaticPadTemplate gst_stream_selector_src_factory =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
enum
{
PROP_ACTIVE_PAD = 1
};
static gboolean gst_stream_selector_is_active_sinkpad (GstStreamSelector * sel,
GstPad * pad);
static GstPad *gst_stream_selector_activate_sinkpad (GstStreamSelector * sel,
GstPad * pad);
static GstPad *gst_stream_selector_get_linked_pad (GstPad * pad,
gboolean strict);
#define GST_TYPE_SELECTOR_PAD \
(gst_selector_pad_get_type())
#define GST_SELECTOR_PAD(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SELECTOR_PAD, GstSelectorPad))
#define GST_SELECTOR_PAD_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SELECTOR_PAD, GstSelectorPadClass))
#define GST_IS_SELECTOR_PAD(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SELECTOR_PAD))
#define GST_IS_SELECTOR_PAD_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SELECTOR_PAD))
#define GST_SELECTOR_PAD_CAST(obj) \
((GstSelectorPad *)(obj))
typedef struct _GstSelectorPad GstSelectorPad;
typedef struct _GstSelectorPadClass GstSelectorPadClass;
struct _GstSelectorPad
{
GstPad parent;
gboolean active;
gboolean eos;
gboolean segment_pending;
GstSegment segment;
};
struct _GstSelectorPadClass
{
GstPadClass parent;
};
static void gst_selector_pad_class_init (GstSelectorPadClass * klass);
static void gst_selector_pad_init (GstSelectorPad * pad);
static void gst_selector_pad_finalize (GObject * object);
static GstPadClass *selector_pad_parent_class = NULL;
static void gst_selector_pad_reset (GstSelectorPad * pad);
static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
static GstCaps *gst_selector_pad_getcaps (GstPad * pad);
static GList *gst_selector_pad_get_linked_pads (GstPad * pad);
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
gst_selector_pad_get_type (void)
{
static GType selector_pad_type = 0;
if (!selector_pad_type) {
static const GTypeInfo selector_pad_info = {
sizeof (GstSelectorPadClass),
NULL,
NULL,
(GClassInitFunc) gst_selector_pad_class_init,
NULL,
NULL,
sizeof (GstSelectorPad),
0,
(GInstanceInitFunc) gst_selector_pad_init,
};
selector_pad_type =
g_type_register_static (GST_TYPE_PAD, "GstSelectorPad",
&selector_pad_info, 0);
}
return selector_pad_type;
}
static void
gst_selector_pad_class_init (GstSelectorPadClass * klass)
{
GObjectClass *gobject_class;
gobject_class = (GObjectClass *) klass;
selector_pad_parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = gst_selector_pad_finalize;
}
static void
gst_selector_pad_init (GstSelectorPad * pad)
{
gst_selector_pad_reset (pad);
}
static void
gst_selector_pad_finalize (GObject * object)
{
GstSelectorPad *pad;
pad = GST_SELECTOR_PAD_CAST (object);
G_OBJECT_CLASS (selector_pad_parent_class)->finalize (object);
}
static void
gst_selector_pad_reset (GstSelectorPad * pad)
{
pad->active = FALSE;
pad->eos = FALSE;
gst_segment_init (&pad->segment, GST_FORMAT_UNDEFINED);
}
/* strictly get the linked pad from the sinkpad. If the pad is active we return
* the srcpad else we return NULL */
static GList *
gst_selector_pad_get_linked_pads (GstPad * pad)
{
GstPad *otherpad;
otherpad = gst_stream_selector_get_linked_pad (pad, TRUE);
if (!otherpad)
return NULL;
/* need to drop the ref, internal linked pads is not MT safe */
gst_object_unref (otherpad);
return g_list_append (NULL, otherpad);
}
static gboolean
gst_selector_pad_event (GstPad * pad, GstEvent * event)
{
gboolean res = TRUE;
gboolean forward = TRUE;
GstStreamSelector *sel;
GstSelectorPad *selpad;
sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
selpad = GST_SELECTOR_PAD_CAST (pad);
/* only forward if we are dealing with the active sinkpad */
forward = gst_stream_selector_is_active_sinkpad (sel, pad);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_STOP:
gst_selector_pad_reset (selpad);
break;
case GST_EVENT_NEWSEGMENT:
{
gboolean update;
GstFormat format;
gdouble rate, arate;
gint64 start, stop, time;
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
&start, &stop, &time);
GST_DEBUG_OBJECT (sel,
"configured NEWSEGMENT update %d, rate %lf, applied rate %lf, "
"format %d, "
"%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
gst_segment_set_newsegment_full (&selpad->segment, update,
rate, arate, format, start, stop, time);
/* if we are not going to forward the segment, mark the segment as
* pending */
if (!forward)
selpad->segment_pending = TRUE;
break;
}
case GST_EVENT_EOS:
selpad->eos = TRUE;
break;
default:
break;
}
if (forward)
res = gst_pad_push_event (sel->srcpad, event);
else
gst_event_unref (event);
gst_object_unref (sel);
return res;
}
static GstCaps *
gst_selector_pad_getcaps (GstPad * pad)
{
GstStreamSelector *sel;
GstCaps *caps;
sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (sel, "Getting caps of srcpad peer");
caps = gst_pad_peer_get_caps (sel->srcpad);
if (caps == NULL)
caps = gst_caps_new_any ();
gst_object_unref (sel);
return caps;
}
static GstFlowReturn
gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
guint size, GstCaps * caps, GstBuffer ** buf)
{
GstStreamSelector *sel;
GstFlowReturn result;
GstPad *active_sinkpad;
sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
/* Fallback allocation for buffers from pads except the selected one */
if (pad != active_sinkpad) {
GST_DEBUG_OBJECT (sel,
"Pad %s:%s is not selected. Performing fallback allocation",
GST_DEBUG_PAD_NAME (pad));
*buf = NULL;
result = GST_FLOW_OK;
} else {
result = gst_pad_alloc_buffer (sel->srcpad, offset, size, caps, buf);
/* FIXME: HACK. If buffer alloc returns not-linked, perform a fallback
* allocation. This should NOT be necessary, because playbin should
* properly block the source pad from running until it's finished hooking
* everything up, but playbin needs refactoring first. */
if (result == GST_FLOW_NOT_LINKED) {
GST_DEBUG_OBJECT (sel,
"No peer pad yet - performing fallback allocation for pad %s:%s",
GST_DEBUG_PAD_NAME (pad));
*buf = NULL;
result = GST_FLOW_OK;
}
}
gst_object_unref (sel);
return result;
}
static GstFlowReturn
gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
{
GstStreamSelector *sel;
GstFlowReturn res;
GstPad *active_sinkpad;
GstSelectorPad *selpad;
GstClockTime timestamp;
GstSegment *seg;
sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
selpad = GST_SELECTOR_PAD_CAST (pad);
seg = &selpad->segment;
active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
timestamp = GST_BUFFER_TIMESTAMP (buf);
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
GST_DEBUG_OBJECT (sel, "received timestamp %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
gst_segment_set_last_stop (seg, seg->format, timestamp);
}
/* Ignore buffers from pads except the selected one */
if (pad != active_sinkpad)
goto ignore;
/* if we have a pending segment, push it out now */
if (selpad->segment_pending) {
gst_pad_push_event (sel->srcpad, gst_event_new_new_segment_full (FALSE,
seg->rate, seg->applied_rate, seg->format, seg->start, seg->stop,
seg->time));
selpad->segment_pending = FALSE;
}
/* forward */
GST_DEBUG_OBJECT (sel, "Forwarding buffer %p from pad %s:%s", buf,
GST_DEBUG_PAD_NAME (pad));
res = gst_pad_push (sel->srcpad, buf);
done:
gst_object_unref (sel);
return res;
/* dropped buffers */
ignore:
{
GST_DEBUG_OBJECT (sel, "Ignoring buffer %p from pad %s:%s",
buf, GST_DEBUG_PAD_NAME (pad));
gst_buffer_unref (buf);
res = GST_FLOW_NOT_LINKED;
goto done;
}
}
2005-01-08 18:31:22 +00:00
static void gst_stream_selector_dispose (GObject * object);
static void gst_stream_selector_init (GstStreamSelector * sel);
static void gst_stream_selector_base_init (GstStreamSelectorClass * klass);
static void gst_stream_selector_class_init (GstStreamSelectorClass * klass);
static void gst_stream_selector_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_stream_selector_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
2005-01-08 18:31:22 +00:00
static GstPad *gst_stream_selector_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * unused);
static void gst_stream_selector_release_pad (GstElement * element,
GstPad * pad);
static GList *gst_stream_selector_get_linked_pads (GstPad * pad);
static GstCaps *gst_stream_selector_getcaps (GstPad * pad);
2005-01-08 18:31:22 +00:00
static GstElementClass *parent_class = NULL;
GType
gst_stream_selector_get_type (void)
{
static GType stream_selector_type = 0;
if (!stream_selector_type) {
static const GTypeInfo stream_selector_info = {
sizeof (GstStreamSelectorClass),
(GBaseInitFunc) gst_stream_selector_base_init,
NULL,
(GClassInitFunc) gst_stream_selector_class_init,
NULL,
NULL,
sizeof (GstStreamSelector),
0,
(GInstanceInitFunc) gst_stream_selector_init,
};
stream_selector_type =
g_type_register_static (GST_TYPE_ELEMENT,
"GstStreamSelector", &stream_selector_info, 0);
GST_DEBUG_CATEGORY_INIT (stream_selector_debug,
"streamselector", 0, "A stream-selector element");
}
return stream_selector_type;
}
static void
gst_stream_selector_base_init (GstStreamSelectorClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details (element_class, &gst_stream_selector_details);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_stream_selector_sink_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_stream_selector_src_factory));
}
static void
gst_stream_selector_class_init (GstStreamSelectorClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent) Original commit message from CVS: * ext/alsa/gstalsamixeroptions.c: (gst_alsa_mixer_options_class_init): * ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_class_init): * ext/ogg/gstoggdemux.c: (gst_ogg_pad_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/ogg/gstoggparse.c: (gst_ogg_parse_class_init): * gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_class_init): * gst-libs/gst/audio/gstaudiofilter.c: (gst_audio_filter_class_init): * gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_class_init): * gst-libs/gst/audio/gstaudiosrc.c: (gst_audioringbuffer_class_init): * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_class_init): * gst-libs/gst/interfaces/colorbalancechannel.c: (gst_color_balance_channel_class_init): * gst-libs/gst/interfaces/mixeroptions.c: (gst_mixer_options_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/interfaces/tunerchannel.c: (gst_tuner_channel_class_init): * gst-libs/gst/interfaces/tunernorm.c: (gst_tuner_norm_class_init): * gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netbuffer_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/playback/gstdecodebin.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_stream_selector_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * sys/v4l/gstv4lcolorbalance.c: (gst_v4l_color_balance_channel_class_init): * sys/v4l/gstv4ljpegsrc.c: (gst_v4ljpegsrc_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4ltuner.c: (gst_v4l_tuner_channel_class_init), (gst_v4l_tuner_norm_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): * tests/old/testsuite/alsa/sinesrc.c: (sinesrc_class_init): Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent)
2006-04-08 21:02:53 +00:00
parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property =
GST_DEBUG_FUNCPTR (gst_stream_selector_set_property);
gobject_class->get_property =
GST_DEBUG_FUNCPTR (gst_stream_selector_get_property);
g_object_class_install_property (gobject_class, PROP_ACTIVE_PAD,
g_param_spec_string ("active-pad", "Active pad",
"Name of the currently" " active sink pad", NULL, G_PARAM_READWRITE));
2005-01-08 18:31:22 +00:00
gobject_class->dispose = gst_stream_selector_dispose;
gstelement_class->request_new_pad = gst_stream_selector_request_new_pad;
gstelement_class->release_pad = gst_stream_selector_release_pad;
2005-01-08 18:31:22 +00:00
}
static void
gst_stream_selector_init (GstStreamSelector * sel)
{
sel->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_pad_set_internal_link_function (sel->srcpad,
GST_DEBUG_FUNCPTR (gst_stream_selector_get_linked_pads));
gst_pad_set_getcaps_function (sel->srcpad,
gst/playback/: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important pla... Original commit message from CVS: * gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_type), (gst_play_base_bin_class_init), (gst_play_base_bin_finalize), (get_active_group), (get_building_group), (group_destroy), (group_commit), (check_queue), (queue_overrun), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element), (remove_groups), (unknown_type), (add_element_stream), (no_more_pads), (probe_triggered), (preroll_unlinked), (new_decoded_pad), (setup_subtitle), (setup_substreams), (setup_source), (finish_source), (prepare_output), (muted_group_change_state), (gst_play_base_bin_set_property), (gst_play_base_bin_get_property), (gst_play_base_bin_change_state): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_init), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), (gen_vis_element), (remove_sinks), (add_sink), (setup_sinks), (gst_play_bin_change_state): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init), (cb_probe), (gst_stream_info_new), (gst_stream_info_dispose), (stream_info_change_state), (gst_stream_info_set_mute), (gst_stream_info_get_property): * gst/playback/gststreaminfo.h: * gst/playback/gststreamselector.c: (gst_stream_selector_init), (gst_stream_selector_get_linked_pad), (gst_stream_selector_getcaps), (gst_stream_selector_get_linked_pads), (gst_stream_selector_request_new_pad), (gst_stream_selector_chain): * gst/playback/gststreamselector.h: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important places, which should make stuff like chain-switches clean. Still uses GST_STATE() in a few places, which isn't all that good an idea, subtitles/elements disabled because no elements to test with and thus probably broken, query and event handling moved to GstBin, internal thread removed alltogether because the pipeline does that for us now. Can play Ogg/Vorbis files. Haven't tested anything else yet.
2005-05-12 15:22:05 +00:00
GST_DEBUG_FUNCPTR (gst_stream_selector_getcaps));
2005-01-08 18:31:22 +00:00
gst_element_add_pad (GST_ELEMENT (sel), sel->srcpad);
/* sinkpad management */
sel->active_sinkpad = NULL;
2005-01-08 18:31:22 +00:00
sel->nb_sinkpads = 0;
gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
2005-01-08 18:31:22 +00:00
}
static void
gst_stream_selector_dispose (GObject * object)
{
GstStreamSelector *sel = GST_STREAM_SELECTOR (object);
if (sel->active_sinkpad) {
gst_object_unref (sel->active_sinkpad);
sel->active_sinkpad = NULL;
}
2005-01-08 18:31:22 +00:00
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_stream_selector_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstStreamSelector *sel = GST_STREAM_SELECTOR (object);
switch (prop_id) {
case PROP_ACTIVE_PAD:{
const gchar *pad_name = g_value_get_string (value);
GstPad *pad = NULL;
GstPad **active_pad_p;
if (strcmp (pad_name, "") != 0)
pad = gst_element_get_pad (GST_ELEMENT (object), pad_name);
GST_OBJECT_LOCK (object);
if (pad != sel->active_sinkpad) {
GstSelectorPad *selpad;
selpad = GST_SELECTOR_PAD_CAST (pad);
/* we can only activate pads that have data received */
if (selpad && !selpad->active) {
GST_DEBUG_OBJECT (sel, "No data received on pad %" GST_PTR_FORMAT,
pad);
} else {
active_pad_p = &sel->active_sinkpad;
gst_object_replace ((GstObject **) active_pad_p,
GST_OBJECT_CAST (pad));
GST_DEBUG_OBJECT (sel, "New active pad is %" GST_PTR_FORMAT,
sel->active_sinkpad);
}
}
GST_OBJECT_UNLOCK (object);
if (pad)
gst_object_unref (pad);
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_stream_selector_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstStreamSelector *sel = GST_STREAM_SELECTOR (object);
switch (prop_id) {
case PROP_ACTIVE_PAD:{
GST_OBJECT_LOCK (object);
if (sel->active_sinkpad != NULL) {
g_value_take_string (value, gst_pad_get_name (sel->active_sinkpad));
} else {
g_value_set_string (value, "");
}
GST_OBJECT_UNLOCK (object);
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
2005-01-08 18:31:22 +00:00
static GstPad *
gst/playback/: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important pla... Original commit message from CVS: * gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_type), (gst_play_base_bin_class_init), (gst_play_base_bin_finalize), (get_active_group), (get_building_group), (group_destroy), (group_commit), (check_queue), (queue_overrun), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element), (remove_groups), (unknown_type), (add_element_stream), (no_more_pads), (probe_triggered), (preroll_unlinked), (new_decoded_pad), (setup_subtitle), (setup_substreams), (setup_source), (finish_source), (prepare_output), (muted_group_change_state), (gst_play_base_bin_set_property), (gst_play_base_bin_get_property), (gst_play_base_bin_change_state): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_init), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), (gen_vis_element), (remove_sinks), (add_sink), (setup_sinks), (gst_play_bin_change_state): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init), (cb_probe), (gst_stream_info_new), (gst_stream_info_dispose), (stream_info_change_state), (gst_stream_info_set_mute), (gst_stream_info_get_property): * gst/playback/gststreaminfo.h: * gst/playback/gststreamselector.c: (gst_stream_selector_init), (gst_stream_selector_get_linked_pad), (gst_stream_selector_getcaps), (gst_stream_selector_get_linked_pads), (gst_stream_selector_request_new_pad), (gst_stream_selector_chain): * gst/playback/gststreamselector.h: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important places, which should make stuff like chain-switches clean. Still uses GST_STATE() in a few places, which isn't all that good an idea, subtitles/elements disabled because no elements to test with and thus probably broken, query and event handling moved to GstBin, internal thread removed alltogether because the pipeline does that for us now. Can play Ogg/Vorbis files. Haven't tested anything else yet.
2005-05-12 15:22:05 +00:00
gst_stream_selector_get_linked_pad (GstPad * pad, gboolean strict)
2005-01-08 18:31:22 +00:00
{
GstStreamSelector *sel;
2005-01-08 18:31:22 +00:00
GstPad *otherpad = NULL;
sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
GST_OBJECT_LOCK (sel);
2005-01-08 18:31:22 +00:00
if (pad == sel->srcpad)
otherpad = sel->active_sinkpad;
else if (pad == sel->active_sinkpad || !strict)
2005-01-08 18:31:22 +00:00
otherpad = sel->srcpad;
if (otherpad)
gst_object_ref (otherpad);
GST_OBJECT_UNLOCK (sel);
gst_object_unref (sel);
2005-01-08 18:31:22 +00:00
return otherpad;
}
static GstCaps *
gst/playback/: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important pla... Original commit message from CVS: * gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_type), (gst_play_base_bin_class_init), (gst_play_base_bin_finalize), (get_active_group), (get_building_group), (group_destroy), (group_commit), (check_queue), (queue_overrun), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element), (remove_groups), (unknown_type), (add_element_stream), (no_more_pads), (probe_triggered), (preroll_unlinked), (new_decoded_pad), (setup_subtitle), (setup_substreams), (setup_source), (finish_source), (prepare_output), (muted_group_change_state), (gst_play_base_bin_set_property), (gst_play_base_bin_get_property), (gst_play_base_bin_change_state): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_init), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), (gen_vis_element), (remove_sinks), (add_sink), (setup_sinks), (gst_play_bin_change_state): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init), (cb_probe), (gst_stream_info_new), (gst_stream_info_dispose), (stream_info_change_state), (gst_stream_info_set_mute), (gst_stream_info_get_property): * gst/playback/gststreaminfo.h: * gst/playback/gststreamselector.c: (gst_stream_selector_init), (gst_stream_selector_get_linked_pad), (gst_stream_selector_getcaps), (gst_stream_selector_get_linked_pads), (gst_stream_selector_request_new_pad), (gst_stream_selector_chain): * gst/playback/gststreamselector.h: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important places, which should make stuff like chain-switches clean. Still uses GST_STATE() in a few places, which isn't all that good an idea, subtitles/elements disabled because no elements to test with and thus probably broken, query and event handling moved to GstBin, internal thread removed alltogether because the pipeline does that for us now. Can play Ogg/Vorbis files. Haven't tested anything else yet.
2005-05-12 15:22:05 +00:00
gst_stream_selector_getcaps (GstPad * pad)
2005-01-08 18:31:22 +00:00
{
GstPad *otherpad;
GstObject *parent;
GstCaps *caps;
2005-01-08 18:31:22 +00:00
otherpad = gst_stream_selector_get_linked_pad (pad, FALSE);
parent = gst_object_get_parent (GST_OBJECT (pad));
2005-01-08 18:31:22 +00:00
if (!otherpad) {
GST_DEBUG_OBJECT (parent,
"Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad));
caps = gst_caps_new_any ();
} else {
GST_DEBUG_OBJECT (parent,
"Pad %s:%s is linked (to %s:%s), returning peer caps",
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (otherpad));
/* if the peer has caps, use those. If the pad is not linked, this function
* returns NULL and we return ANY */
if (!(caps = gst_pad_peer_get_caps (otherpad)))
caps = gst_caps_new_any ();
gst_object_unref (otherpad);
2005-01-08 18:31:22 +00:00
}
gst_object_unref (parent);
return caps;
2005-01-08 18:31:22 +00:00
}
/* check if the pad is the active sinkpad */
static gboolean
gst_stream_selector_is_active_sinkpad (GstStreamSelector * sel, GstPad * pad)
{
GstSelectorPad *selpad;
gboolean res;
selpad = GST_SELECTOR_PAD_CAST (pad);
GST_OBJECT_LOCK (sel);
res = (pad == sel->active_sinkpad);
GST_OBJECT_UNLOCK (sel);
return res;
}
/* Get or create the active sinkpad */
static GstPad *
gst_stream_selector_activate_sinkpad (GstStreamSelector * sel, GstPad * pad)
{
GstPad *active_sinkpad;
GstSelectorPad *selpad;
selpad = GST_SELECTOR_PAD_CAST (pad);
GST_OBJECT_LOCK (sel);
selpad->active = TRUE;
active_sinkpad = sel->active_sinkpad;
if (active_sinkpad == NULL) {
/* first pad we get an alloc on becomes the activated pad by default */
active_sinkpad = sel->active_sinkpad = gst_object_ref (pad);
GST_DEBUG_OBJECT (sel, "Activating pad %s:%s", GST_DEBUG_PAD_NAME (pad));
}
GST_OBJECT_UNLOCK (sel);
return active_sinkpad;
}
2005-01-08 18:31:22 +00:00
static GList *
gst_stream_selector_get_linked_pads (GstPad * pad)
{
GstPad *otherpad;
2005-01-08 18:31:22 +00:00
otherpad = gst_stream_selector_get_linked_pad (pad, TRUE);
2005-01-08 18:31:22 +00:00
if (!otherpad)
return NULL;
/* need to drop the ref, internal linked pads is not MT safe */
gst_object_unref (otherpad);
2005-01-08 18:31:22 +00:00
return g_list_append (NULL, otherpad);
}
static GstPad *
gst_stream_selector_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * unused)
{
GstStreamSelector *sel;
2005-01-08 18:31:22 +00:00
gchar *name = NULL;
GstPad *sinkpad = NULL;
sel = GST_STREAM_SELECTOR (element);
2005-01-08 18:31:22 +00:00
g_return_val_if_fail (templ->direction == GST_PAD_SINK, NULL);
GST_LOG_OBJECT (sel, "Creating new pad %d", sel->nb_sinkpads);
GST_OBJECT_LOCK (sel);
2005-01-08 18:31:22 +00:00
name = g_strdup_printf ("sink%d", sel->nb_sinkpads++);
sinkpad = g_object_new (GST_TYPE_SELECTOR_PAD,
"name", name, "direction", templ->direction, "template", templ, NULL);
2005-01-08 18:31:22 +00:00
g_free (name);
GST_OBJECT_UNLOCK (sel);
gst_pad_set_event_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_event));
2005-01-08 18:31:22 +00:00
gst_pad_set_getcaps_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_getcaps));
2005-01-08 18:31:22 +00:00
gst_pad_set_chain_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
2005-01-08 18:31:22 +00:00
gst_pad_set_internal_link_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_get_linked_pads));
gst_pad_set_bufferalloc_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_bufferalloc));
gst_pad_set_active (sinkpad, TRUE);
2005-01-08 18:31:22 +00:00
gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
gst/playback/: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important pla... Original commit message from CVS: * gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_type), (gst_play_base_bin_class_init), (gst_play_base_bin_finalize), (get_active_group), (get_building_group), (group_destroy), (group_commit), (check_queue), (queue_overrun), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element), (remove_groups), (unknown_type), (add_element_stream), (no_more_pads), (probe_triggered), (preroll_unlinked), (new_decoded_pad), (setup_subtitle), (setup_substreams), (setup_source), (finish_source), (prepare_output), (muted_group_change_state), (gst_play_base_bin_set_property), (gst_play_base_bin_get_property), (gst_play_base_bin_change_state): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_init), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), (gen_vis_element), (remove_sinks), (add_sink), (setup_sinks), (gst_play_bin_change_state): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init), (cb_probe), (gst_stream_info_new), (gst_stream_info_dispose), (stream_info_change_state), (gst_stream_info_set_mute), (gst_stream_info_get_property): * gst/playback/gststreaminfo.h: * gst/playback/gststreamselector.c: (gst_stream_selector_init), (gst_stream_selector_get_linked_pad), (gst_stream_selector_getcaps), (gst_stream_selector_get_linked_pads), (gst_stream_selector_request_new_pad), (gst_stream_selector_chain): * gst/playback/gststreamselector.h: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important places, which should make stuff like chain-switches clean. Still uses GST_STATE() in a few places, which isn't all that good an idea, subtitles/elements disabled because no elements to test with and thus probably broken, query and event handling moved to GstBin, internal thread removed alltogether because the pipeline does that for us now. Can play Ogg/Vorbis files. Haven't tested anything else yet.
2005-05-12 15:22:05 +00:00
return sinkpad;
Raw and crude port of decodebin. Original commit message from CVS: * gst/playback/README: * gst/playback/gstdecodebin.c: (gst_decode_bin_class_init), (compare_ranks), (print_feature), (gst_decode_bin_init), (dynamic_create), (dynamic_free), (find_compatibles), (mimetype_is_raw), (close_pad_link), (got_redirect), (try_to_link_1), (get_our_ghost_pad), (remove_element_chain), (new_pad), (no_more_pads), (unlinked), (close_link), (type_found), (gst_decode_bin_change_state): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (gst_play_base_bin_init), (group_destroy), (group_commit), (check_queue), (queue_overrun), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element), (unknown_type), (new_decoded_pad), (setup_subtitle), (gen_source_element), (got_redirect), (setup_source), (play_base_eos), (gst_play_base_bin_change_state), (gst_play_base_bin_add_element), (gst_play_base_bin_remove_element): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_init), (gst_play_bin_dispose), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), (remove_sinks), (gst_play_bin_send_event): * gst/playback/gststreaminfo.c: (gst_stream_info_dispose), (stream_info_change_state), (gst_stream_info_set_mute): * gst/playback/gststreamselector.c: (gst_stream_selector_init), (gst_stream_selector_get_caps), (gst_stream_selector_setcaps), (gst_stream_selector_request_new_pad), (gst_stream_selector_event), (gst_stream_selector_chain): * gst/playback/test.c: (gen_video_element), (gen_audio_element), (main): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_getcaps), (gst_xvimagesink_setcaps), (gst_xvimagesink_get_times), (gst_xvimagesink_show_frame), (gst_xvimagesink_chain), (gst_xvimagesink_buffer_alloc), (gst_xvimagesink_class_init): Raw and crude port of decodebin. Make playbin compile.
2005-04-12 10:48:58 +00:00
}
static void
gst_stream_selector_release_pad (GstElement * element, GstPad * pad)
Raw and crude port of decodebin. Original commit message from CVS: * gst/playback/README: * gst/playback/gstdecodebin.c: (gst_decode_bin_class_init), (compare_ranks), (print_feature), (gst_decode_bin_init), (dynamic_create), (dynamic_free), (find_compatibles), (mimetype_is_raw), (close_pad_link), (got_redirect), (try_to_link_1), (get_our_ghost_pad), (remove_element_chain), (new_pad), (no_more_pads), (unlinked), (close_link), (type_found), (gst_decode_bin_change_state): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (gst_play_base_bin_init), (group_destroy), (group_commit), (check_queue), (queue_overrun), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element), (unknown_type), (new_decoded_pad), (setup_subtitle), (gen_source_element), (got_redirect), (setup_source), (play_base_eos), (gst_play_base_bin_change_state), (gst_play_base_bin_add_element), (gst_play_base_bin_remove_element): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_init), (gst_play_bin_dispose), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), (remove_sinks), (gst_play_bin_send_event): * gst/playback/gststreaminfo.c: (gst_stream_info_dispose), (stream_info_change_state), (gst_stream_info_set_mute): * gst/playback/gststreamselector.c: (gst_stream_selector_init), (gst_stream_selector_get_caps), (gst_stream_selector_setcaps), (gst_stream_selector_request_new_pad), (gst_stream_selector_event), (gst_stream_selector_chain): * gst/playback/test.c: (gen_video_element), (gen_audio_element), (main): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_getcaps), (gst_xvimagesink_setcaps), (gst_xvimagesink_get_times), (gst_xvimagesink_show_frame), (gst_xvimagesink_chain), (gst_xvimagesink_buffer_alloc), (gst_xvimagesink_class_init): Raw and crude port of decodebin. Make playbin compile.
2005-04-12 10:48:58 +00:00
{
GstStreamSelector *sel;
sel = GST_STREAM_SELECTOR (element);
GST_LOG_OBJECT (sel, "Releasing pad %s:%s", GST_DEBUG_PAD_NAME (pad));
gst/playback/: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important pla... Original commit message from CVS: * gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_type), (gst_play_base_bin_class_init), (gst_play_base_bin_finalize), (get_active_group), (get_building_group), (group_destroy), (group_commit), (check_queue), (queue_overrun), (queue_threshold_reached), (queue_out_of_data), (gen_preroll_element), (remove_groups), (unknown_type), (add_element_stream), (no_more_pads), (probe_triggered), (preroll_unlinked), (new_decoded_pad), (setup_subtitle), (setup_substreams), (setup_source), (finish_source), (prepare_output), (muted_group_change_state), (gst_play_base_bin_set_property), (gst_play_base_bin_get_property), (gst_play_base_bin_change_state): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (gst_play_bin_init), (gst_play_bin_set_property), (gen_video_element), (gen_text_element), (gen_audio_element), (gen_vis_element), (remove_sinks), (add_sink), (setup_sinks), (gst_play_bin_change_state): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init), (cb_probe), (gst_stream_info_new), (gst_stream_info_dispose), (stream_info_change_state), (gst_stream_info_set_mute), (gst_stream_info_get_property): * gst/playback/gststreaminfo.h: * gst/playback/gststreamselector.c: (gst_stream_selector_init), (gst_stream_selector_get_linked_pad), (gst_stream_selector_getcaps), (gst_stream_selector_get_linked_pads), (gst_stream_selector_request_new_pad), (gst_stream_selector_chain): * gst/playback/gststreamselector.h: Rough port of playbin. Needs some more work, but is mostly done, and uses a few locks in important places, which should make stuff like chain-switches clean. Still uses GST_STATE() in a few places, which isn't all that good an idea, subtitles/elements disabled because no elements to test with and thus probably broken, query and event handling moved to GstBin, internal thread removed alltogether because the pipeline does that for us now. Can play Ogg/Vorbis files. Haven't tested anything else yet.
2005-05-12 15:22:05 +00:00
GST_OBJECT_LOCK (sel);
/* if the pad was the active pad, makes us select a new one */
if (sel->active_sinkpad == pad) {
GST_DEBUG_OBJECT (sel, "Deactivating pad %s:%s", GST_DEBUG_PAD_NAME (pad));
sel->active_sinkpad = NULL;
2005-01-08 18:31:22 +00:00
}
GST_OBJECT_UNLOCK (sel);
2005-01-08 18:31:22 +00:00
gst_pad_set_active (pad, FALSE);
gst_element_remove_pad (GST_ELEMENT (sel), pad);
2005-01-08 18:31:22 +00:00
}