2003-12-08 20:01:01 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2003 Julien Moutte <julien@moutte.net>
|
2007-12-17 14:43:04 +00:00
|
|
|
* 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>
|
2007-12-18 16:08:13 +00:00
|
|
|
* Copyright (C) 2007 Andy Wingo <wingo@pobox.com>
|
2008-01-29 07:38:31 +00:00
|
|
|
* Copyright (C) 2008 Nokia Corporation. (contact <stefan.kost@nokia.com>)
|
2003-12-08 20:01:01 +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.
|
|
|
|
*/
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-input-selector
|
|
|
|
* @short_description: N-to-1 stream selectoring
|
|
|
|
* @see_also: #GstOutputSelector
|
|
|
|
*
|
|
|
|
* Direct one out of N input streams to the output pad.
|
|
|
|
*/
|
|
|
|
|
2003-12-08 20:01:01 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
#include "gstinputselector.h"
|
|
|
|
#include "gstselector-marshal.h"
|
2007-12-17 14:43:04 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (input_selector_debug);
|
|
|
|
#define GST_CAT_DEFAULT input_selector_debug
|
2003-12-08 20:01:01 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
static const GstElementDetails gst_input_selector_details =
|
|
|
|
GST_ELEMENT_DETAILS ("Input selector",
|
2004-03-14 22:34:33 +00:00
|
|
|
"Generic",
|
2008-01-29 07:38:31 +00:00
|
|
|
"N-to-1 input stream selectoring",
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
"Julien Moutte <julien@moutte.net>\n"
|
2007-12-17 14:43:04 +00:00
|
|
|
"Ronald S. Bultje <rbultje@ronald.bitfreak.net>\n"
|
|
|
|
"Jan Schmidt <thaytan@mad.scientist.com>\n"
|
|
|
|
"Wim Taymans <wim.taymans@gmail.com>");
|
2003-12-08 20:01:01 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
static GstStaticPadTemplate gst_input_selector_sink_factory =
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink%d",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_REQUEST,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2003-12-08 20:01:01 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
static GstStaticPadTemplate gst_input_selector_src_factory =
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
enum
|
|
|
|
{
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_N_PADS,
|
|
|
|
PROP_ACTIVE_PAD,
|
|
|
|
PROP_SELECT_ALL,
|
|
|
|
PROP_LAST
|
2007-12-17 15:04:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
PROP_PAD_0,
|
|
|
|
PROP_PAD_RUNNING_TIME,
|
|
|
|
PROP_PAD_TAGS,
|
|
|
|
PROP_PAD_ACTIVE,
|
|
|
|
PROP_PAD_LAST
|
2007-12-17 14:43:04 +00:00
|
|
|
};
|
2003-12-08 20:01:01 +00:00
|
|
|
|
2007-12-17 14:46:26 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* methods */
|
|
|
|
SIGNAL_BLOCK,
|
|
|
|
SIGNAL_SWITCH,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
2008-01-29 07:38:31 +00:00
|
|
|
static guint gst_input_selector_signals[LAST_SIGNAL] = { 0 };
|
2007-12-17 14:46:26 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
static gboolean gst_input_selector_is_active_sinkpad (GstInputSelector * sel,
|
2007-12-17 14:43:04 +00:00
|
|
|
GstPad * pad);
|
2008-01-29 07:38:31 +00:00
|
|
|
static GstPad *gst_input_selector_activate_sinkpad (GstInputSelector * sel,
|
2007-12-17 14:43:04 +00:00
|
|
|
GstPad * pad);
|
2008-01-29 07:38:31 +00:00
|
|
|
static GstPad *gst_input_selector_get_linked_pad (GstPad * pad,
|
2007-12-17 14:43:04 +00:00
|
|
|
gboolean strict);
|
2008-01-29 07:38:31 +00:00
|
|
|
static void gst_input_selector_push_pending_stop (GstInputSelector * self);
|
2008-02-25 08:53:51 +00:00
|
|
|
static gboolean gst_input_selector_check_eos (GstElement * selector);
|
2007-12-17 14:43:04 +00:00
|
|
|
|
|
|
|
#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;
|
2003-12-08 20:01:01 +00:00
|
|
|
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
gboolean active; /* when buffer have passed the pad */
|
|
|
|
gboolean eos; /* when EOS has been received */
|
|
|
|
GstSegment segment; /* the current segment on the pad */
|
|
|
|
GstTagList *tags; /* last tags received on the pad */
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
gboolean segment_pending;
|
|
|
|
};
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
struct _GstSelectorPadClass
|
2004-01-25 12:28:05 +00:00
|
|
|
{
|
2007-12-17 14:43:04 +00:00
|
|
|
GstPadClass parent;
|
|
|
|
};
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
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);
|
2007-12-17 15:04:51 +00:00
|
|
|
static void gst_selector_pad_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static GstPadClass *selector_pad_parent_class = NULL;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-18 16:08:13 +00:00
|
|
|
static gint64 gst_selector_pad_get_running_time (GstSelectorPad * pad);
|
2007-12-17 14:43:04 +00:00
|
|
|
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);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static GType
|
|
|
|
gst_selector_pad_get_type (void)
|
|
|
|
{
|
|
|
|
static GType selector_pad_type = 0;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
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 =
|
2008-01-29 07:38:31 +00:00
|
|
|
g_type_register_static (GST_TYPE_PAD, "GstSelectorPad",
|
2007-12-17 14:43:04 +00:00
|
|
|
&selector_pad_info, 0);
|
2004-01-25 12:28:05 +00:00
|
|
|
}
|
2007-12-17 14:43:04 +00:00
|
|
|
return selector_pad_type;
|
2004-01-25 12:28:05 +00:00
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static void
|
|
|
|
gst_selector_pad_class_init (GstSelectorPadClass * klass)
|
2003-12-08 20:01:01 +00:00
|
|
|
{
|
2007-12-17 14:43:04 +00:00
|
|
|
GObjectClass *gobject_class;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
|
|
|
|
selector_pad_parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
gobject_class->finalize = gst_selector_pad_finalize;
|
|
|
|
|
2007-12-17 15:04:51 +00:00
|
|
|
gobject_class->get_property =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_selector_pad_get_property);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_PAD_RUNNING_TIME,
|
2007-12-18 16:08:13 +00:00
|
|
|
g_param_spec_int64 ("running-time", "Running time",
|
|
|
|
"Running time of stream on pad", 0, G_MAXINT64, 0, G_PARAM_READABLE));
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_PAD_TAGS,
|
|
|
|
g_param_spec_boxed ("tags", "Tags",
|
|
|
|
"The currently active tags on the pad", GST_TYPE_TAG_LIST,
|
|
|
|
G_PARAM_READABLE));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_PAD_ACTIVE,
|
|
|
|
g_param_spec_boolean ("active", "Active",
|
|
|
|
"If the pad is currently active", FALSE, G_PARAM_READABLE));
|
2007-12-17 14:43:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_selector_pad_init (GstSelectorPad * pad)
|
|
|
|
{
|
2007-12-18 16:08:13 +00:00
|
|
|
gst_selector_pad_reset (pad);
|
2007-12-17 14:43:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_selector_pad_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstSelectorPad *pad;
|
|
|
|
|
|
|
|
pad = GST_SELECTOR_PAD_CAST (object);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
if (pad->tags)
|
|
|
|
gst_tag_list_free (pad->tags);
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
G_OBJECT_CLASS (selector_pad_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2007-12-17 15:04:51 +00:00
|
|
|
static void
|
|
|
|
gst_selector_pad_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstSelectorPad *spad = GST_SELECTOR_PAD_CAST (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
case PROP_PAD_RUNNING_TIME:
|
2007-12-18 16:08:13 +00:00
|
|
|
g_value_set_int64 (value, gst_selector_pad_get_running_time (spad));
|
2007-12-17 15:04:51 +00:00
|
|
|
break;
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
case PROP_PAD_TAGS:
|
|
|
|
GST_OBJECT_LOCK (object);
|
|
|
|
g_value_set_boxed (value, spad->tags);
|
|
|
|
GST_OBJECT_UNLOCK (object);
|
|
|
|
break;
|
|
|
|
case PROP_PAD_ACTIVE:
|
|
|
|
{
|
|
|
|
GstInputSelector *sel;
|
2007-12-18 16:08:13 +00:00
|
|
|
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (spad));
|
|
|
|
g_value_set_boolean (value, gst_input_selector_is_active_sinkpad (sel,
|
|
|
|
GST_PAD_CAST (spad)));
|
|
|
|
gst_object_unref (sel);
|
|
|
|
break;
|
|
|
|
}
|
2007-12-17 15:04:51 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-18 16:08:13 +00:00
|
|
|
static gint64
|
|
|
|
gst_selector_pad_get_running_time (GstSelectorPad * pad)
|
|
|
|
{
|
|
|
|
gint64 ret = 0;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (pad);
|
|
|
|
|
|
|
|
if (pad->active) {
|
|
|
|
gint64 last_stop = pad->segment.last_stop;
|
|
|
|
|
|
|
|
if (last_stop >= 0)
|
|
|
|
ret = gst_segment_to_running_time (&pad->segment, GST_FORMAT_TIME,
|
|
|
|
last_stop);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (pad);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (pad, "running time: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (ret));
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static void
|
|
|
|
gst_selector_pad_reset (GstSelectorPad * pad)
|
|
|
|
{
|
|
|
|
pad->active = FALSE;
|
|
|
|
pad->eos = FALSE;
|
|
|
|
gst_segment_init (&pad->segment, GST_FORMAT_UNDEFINED);
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* 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;
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
otherpad = gst_input_selector_get_linked_pad (pad, TRUE);
|
2007-12-17 14:43:04 +00:00
|
|
|
if (!otherpad)
|
2003-12-08 20:01:01 +00:00
|
|
|
return NULL;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* need to drop the ref, internal linked pads is not MT safe */
|
|
|
|
gst_object_unref (otherpad);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
return g_list_append (NULL, otherpad);
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static gboolean
|
|
|
|
gst_selector_pad_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
gboolean forward = TRUE;
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel;
|
2007-12-17 14:43:04 +00:00
|
|
|
GstSelectorPad *selpad;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
2007-12-17 14:43:04 +00:00
|
|
|
selpad = GST_SELECTOR_PAD_CAST (pad);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* only forward if we are dealing with the active sinkpad */
|
2008-01-29 07:38:31 +00:00
|
|
|
forward = gst_input_selector_is_active_sinkpad (sel, pad);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2008-02-25 08:53:51 +00:00
|
|
|
/* forward all events in select_all mode by default */
|
|
|
|
if (sel->select_all) {
|
|
|
|
forward = TRUE;
|
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
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);
|
|
|
|
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (pad,
|
2007-12-17 14:43:04 +00:00
|
|
|
"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;
|
|
|
|
}
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
case GST_EVENT_TAG:
|
|
|
|
{
|
|
|
|
GstTagList *tags;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (selpad);
|
|
|
|
if (selpad->tags)
|
|
|
|
gst_tag_list_free (selpad->tags);
|
|
|
|
gst_event_parse_tag (event, &tags);
|
|
|
|
if (tags)
|
|
|
|
tags = gst_tag_list_copy (tags);
|
|
|
|
selpad->tags = tags;
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "received tags %" GST_PTR_FORMAT, selpad->tags);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
GST_OBJECT_UNLOCK (selpad);
|
|
|
|
break;
|
|
|
|
}
|
2007-12-17 14:43:04 +00:00
|
|
|
case GST_EVENT_EOS:
|
|
|
|
selpad->eos = TRUE;
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "received EOS");
|
2008-02-25 08:53:51 +00:00
|
|
|
/* don't forward eos in select_all mode until all sink pads have eos */
|
|
|
|
if (sel->select_all && !gst_input_selector_check_eos (GST_ELEMENT (sel))) {
|
|
|
|
forward = FALSE;
|
|
|
|
}
|
2007-12-17 14:43:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-03-14 17:22:21 +00:00
|
|
|
if (forward) {
|
|
|
|
GST_DEBUG_OBJECT (pad, "forwarding event");
|
2007-12-17 14:43:04 +00:00
|
|
|
res = gst_pad_push_event (sel->srcpad, event);
|
2008-03-14 17:22:21 +00:00
|
|
|
} else
|
2008-02-01 17:08:18 +00:00
|
|
|
gst_event_unref (event);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_object_unref (sel);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
|
|
|
gst_selector_pad_getcaps (GstPad * pad)
|
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel;
|
2007-12-17 14:43:04 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
2007-12-17 14:43:04 +00:00
|
|
|
|
|
|
|
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;
|
2003-12-08 20:01:01 +00:00
|
|
|
}
|
|
|
|
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
static GstFlowReturn
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
|
|
|
|
guint size, GstCaps * caps, GstBuffer ** buf)
|
2003-12-08 20:01:01 +00:00
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel;
|
2007-12-17 14:43:04 +00:00
|
|
|
GstFlowReturn result;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
GstPad *active_sinkpad;
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "received alloc");
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
|
2007-12-17 14:43:04 +00:00
|
|
|
|
|
|
|
/* Fallback allocation for buffers from pads except the selected one */
|
2008-02-25 08:53:51 +00:00
|
|
|
if (pad != active_sinkpad && !sel->select_all) {
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_DEBUG_OBJECT (sel,
|
|
|
|
"Pad %s:%s is not selected. Performing fallback allocation",
|
|
|
|
GST_DEBUG_PAD_NAME (pad));
|
examples/switch/switcher.c (my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c (gst_...
Original commit message from CVS:
* examples/switch/switcher.c (my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_dispose, gst_switch_init):
* gst/switch/gstswitch.h (switch_mutex, GST_SWITCH_LOCK,
GST_SWITCH_UNLOCK):
Add an extra lock to protect against certain variables instead of
using the object lock. Fix case where caps are different in the
sink pads causes deadlock. Update example to use different caps
on each sink pad.
2007-06-22 15:30:00 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
*buf = NULL;
|
|
|
|
result = GST_FLOW_OK;
|
|
|
|
} else {
|
|
|
|
result = gst_pad_alloc_buffer (sel->srcpad, offset, size, caps, buf);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* 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;
|
|
|
|
}
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_object_unref (sel);
|
2007-08-29 16:20:28 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-12-17 15:00:15 +00:00
|
|
|
static gboolean
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_wait (GstInputSelector * self, GstPad * pad)
|
2007-12-17 15:00:15 +00:00
|
|
|
{
|
|
|
|
gboolean flushing;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
|
|
|
|
while (self->blocked)
|
|
|
|
g_cond_wait (self->blocked_cond, GST_OBJECT_GET_LOCK (self));
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (pad);
|
|
|
|
flushing = GST_PAD_IS_FLUSHING (pad);
|
|
|
|
GST_OBJECT_UNLOCK (pad);
|
|
|
|
|
|
|
|
return flushing;
|
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
|
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel;
|
2007-12-17 14:43:04 +00:00
|
|
|
GstFlowReturn res;
|
|
|
|
GstPad *active_sinkpad;
|
|
|
|
GstSelectorPad *selpad;
|
2007-12-17 15:04:51 +00:00
|
|
|
GstClockTime end_time, duration;
|
2007-12-17 14:43:04 +00:00
|
|
|
GstSegment *seg;
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
2007-12-17 14:43:04 +00:00
|
|
|
selpad = GST_SELECTOR_PAD_CAST (pad);
|
|
|
|
seg = &selpad->segment;
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
if (gst_input_selector_wait (sel, pad))
|
2007-12-17 15:00:15 +00:00
|
|
|
goto ignore;
|
|
|
|
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "chain, getting active pad");
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
|
2007-12-17 14:43:04 +00:00
|
|
|
|
2007-12-17 15:04:51 +00:00
|
|
|
end_time = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (end_time)) {
|
|
|
|
duration = GST_BUFFER_DURATION (buf);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration))
|
|
|
|
end_time += duration;
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "received end time %" GST_TIME_FORMAT,
|
2007-12-17 15:04:51 +00:00
|
|
|
GST_TIME_ARGS (end_time));
|
|
|
|
gst_segment_set_last_stop (seg, seg->format, end_time);
|
gst/switch/gstswitch.c (ARG_0, ARG_NB_SOURCES, ARG_ACTIVE_SOURCE,
Original commit message from CVS:
* gst/switch/gstswitch.c (ARG_0, ARG_NB_SOURCES, ARG_ACTIVE_SOURCE,
ARG_START_VALUE, ARG_STOP_VALUE, ARG_LAST_TS, ARG_QUEUE_BUFFERS,
parent_class, gst_switch_release_pad, gst_switch_request_new_pad,
gst_switch_chain, gst_switch_event, gst_switch_set_property,
gst_switch_get_property, gst_switch_getcaps, gst_switch_dispose,
unref_buffer, unref_buffers_and_destroy_list, gst_switch_init,
gst_switch_base_init, gst_switch_class_init):
* gst/switch/gstswitch.h (need_to_send_newsegment, queue_buffers,
stop_value, start_value, current_start, last_ts, stored_buffers):
Add handling of application provided stop and start values, allowing
A/V sync across 2 switch elements.
2007-05-17 10:08:24 +00:00
|
|
|
}
|
2007-08-29 16:20:28 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* Ignore buffers from pads except the selected one */
|
2008-02-25 08:53:51 +00:00
|
|
|
if (pad != active_sinkpad && !sel->select_all)
|
2007-12-17 14:43:04 +00:00
|
|
|
goto ignore;
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_push_pending_stop (sel);
|
2007-12-17 14:55:54 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* if we have a pending segment, push it out now */
|
|
|
|
if (selpad->segment_pending) {
|
2008-03-14 17:22:21 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (pad,
|
|
|
|
"pushing NEWSEGMENT update %d, rate %lf, applied rate %lf, "
|
|
|
|
"format %d, "
|
|
|
|
"%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
|
|
|
|
G_GINT64_FORMAT, FALSE, seg->rate, seg->applied_rate, seg->format,
|
|
|
|
seg->start, seg->stop, seg->time);
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
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;
|
2003-12-08 20:01:01 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* forward */
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "Forwarding buffer %p from pad %s:%s", buf,
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_DEBUG_PAD_NAME (pad));
|
|
|
|
res = gst_pad_push (sel->srcpad, buf);
|
|
|
|
done:
|
|
|
|
gst_object_unref (sel);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
return res;
|
2007-12-17 14:43:04 +00:00
|
|
|
/* dropped buffers */
|
|
|
|
ignore:
|
|
|
|
{
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "Ignoring buffer %p", buf);
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_buffer_unref (buf);
|
2007-12-17 15:09:17 +00:00
|
|
|
res = GST_FLOW_OK;
|
2007-12-17 14:43:04 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2003-12-08 20:01:01 +00:00
|
|
|
}
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
static void gst_input_selector_dispose (GObject * object);
|
|
|
|
static void gst_input_selector_init (GstInputSelector * sel);
|
|
|
|
static void gst_input_selector_base_init (GstInputSelectorClass * klass);
|
|
|
|
static void gst_input_selector_class_init (GstInputSelectorClass * klass);
|
|
|
|
static void gst_input_selector_set_property (GObject * object,
|
2007-12-17 14:43:04 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
2008-01-29 07:38:31 +00:00
|
|
|
static void gst_input_selector_get_property (GObject * object,
|
2007-12-17 14:43:04 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2008-01-29 07:38:31 +00:00
|
|
|
static GstPad *gst_input_selector_request_new_pad (GstElement * element,
|
2007-12-17 14:43:04 +00:00
|
|
|
GstPadTemplate * templ, const gchar * unused);
|
2008-01-29 07:38:31 +00:00
|
|
|
static void gst_input_selector_release_pad (GstElement * element, GstPad * pad);
|
|
|
|
static GstStateChangeReturn gst_input_selector_change_state (GstElement *
|
2007-12-17 15:01:55 +00:00
|
|
|
element, GstStateChange transition);
|
2008-01-29 07:38:31 +00:00
|
|
|
static GList *gst_input_selector_get_linked_pads (GstPad * pad);
|
|
|
|
static GstCaps *gst_input_selector_getcaps (GstPad * pad);
|
|
|
|
static gint64 gst_input_selector_block (GstInputSelector * self);
|
|
|
|
static void gst_input_selector_switch (GstInputSelector * self,
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
GstPad * pad, gint64 stop_time, gint64 start_time);
|
2007-12-17 14:48:26 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
|
|
|
GType
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_get_type (void)
|
2004-02-15 18:05:04 +00:00
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
static GType input_selector_type = 0;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
if (!input_selector_type) {
|
|
|
|
static const GTypeInfo input_selector_info = {
|
|
|
|
sizeof (GstInputSelectorClass),
|
|
|
|
(GBaseInitFunc) gst_input_selector_base_init,
|
2007-12-17 14:43:04 +00:00
|
|
|
NULL,
|
2008-01-29 07:38:31 +00:00
|
|
|
(GClassInitFunc) gst_input_selector_class_init,
|
2007-12-17 14:43:04 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2008-01-29 07:38:31 +00:00
|
|
|
sizeof (GstInputSelector),
|
2007-12-17 14:43:04 +00:00
|
|
|
0,
|
2008-01-29 07:38:31 +00:00
|
|
|
(GInstanceInitFunc) gst_input_selector_init,
|
2007-12-17 14:43:04 +00:00
|
|
|
};
|
2008-01-29 07:38:31 +00:00
|
|
|
input_selector_type =
|
2007-12-17 14:43:04 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT,
|
2008-01-29 07:38:31 +00:00
|
|
|
"GstInputSelector", &input_selector_info, 0);
|
|
|
|
GST_DEBUG_CATEGORY_INIT (input_selector_debug,
|
|
|
|
"input-selector", 0, "An input stream selector element");
|
2004-02-15 18:05:04 +00:00
|
|
|
}
|
2007-12-17 14:43:04 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
return input_selector_type;
|
2004-02-15 18:05:04 +00:00
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_base_init (GstInputSelectorClass * klass)
|
2007-12-17 14:43:04 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_element_class_set_details (element_class, &gst_input_selector_details);
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_static_pad_template_get (&gst_input_selector_sink_factory));
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_static_pad_template_get (&gst_input_selector_src_factory));
|
2007-12-17 14:43:04 +00:00
|
|
|
}
|
2003-12-08 20:01:01 +00:00
|
|
|
|
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_class_init (GstInputSelectorClass * klass)
|
2003-12-08 20:01:01 +00:00
|
|
|
{
|
2007-12-17 14:43:04 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
|
|
|
|
gobject_class->dispose = gst_input_selector_dispose;
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
gobject_class->set_property =
|
2008-01-29 07:38:31 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_input_selector_set_property);
|
2007-12-17 14:43:04 +00:00
|
|
|
gobject_class->get_property =
|
2008-01-29 07:38:31 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_input_selector_get_property);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_N_PADS,
|
|
|
|
g_param_spec_uint ("n-pads", "Number of Pads",
|
|
|
|
"The number of sink pads", 0, G_MAXUINT, 0, G_PARAM_READABLE));
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_ACTIVE_PAD,
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
g_param_spec_object ("active-pad", "Active pad",
|
|
|
|
"The currently active sink pad", GST_TYPE_PAD, G_PARAM_READWRITE));
|
|
|
|
|
2008-02-25 08:53:51 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SELECT_ALL,
|
|
|
|
g_param_spec_boolean ("select-all", "Select all mode",
|
|
|
|
"Forwards data from all input pads", FALSE, G_PARAM_READWRITE));
|
2007-12-17 14:46:26 +00:00
|
|
|
|
|
|
|
/**
|
2008-01-29 07:38:31 +00:00
|
|
|
* GstInputSelector::block:
|
|
|
|
* @inputselector: the #GstInputSelector
|
2007-12-17 14:46:26 +00:00
|
|
|
*
|
2007-12-17 15:06:48 +00:00
|
|
|
* Block all sink pads in preparation for a switch. Returns the stop time of
|
2007-12-18 16:08:13 +00:00
|
|
|
* the current switch segment, as a running time, or 0 if there is no current
|
2007-12-17 15:06:48 +00:00
|
|
|
* active pad or the current active pad never received data.
|
2007-12-17 14:46:26 +00:00
|
|
|
*/
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_signals[SIGNAL_BLOCK] =
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
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);
|
2007-12-17 14:46:26 +00:00
|
|
|
/**
|
2008-01-29 07:38:31 +00:00
|
|
|
* GstInputSelector::switch:
|
|
|
|
* @inputselector: the #GstInputSelector
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
* @pad: the pad to switch to
|
2007-12-18 16:08:13 +00:00
|
|
|
* @stop_time: running time at which to close the previous segment, or -1
|
|
|
|
* to use the running time of the previously active sink pad
|
|
|
|
* @start_time: running time at which to start the new segment, or -1 to
|
|
|
|
* use the running time of the newly active sink pad
|
|
|
|
*
|
|
|
|
* Switch to a new feed. The segment opened by the previously active pad, if
|
|
|
|
* any, will be closed, and a new segment opened before data flows again.
|
|
|
|
*
|
|
|
|
* This signal must be emitted when the element has been blocked via the <link
|
2008-01-29 07:38:31 +00:00
|
|
|
* linkend="GstInputSelector-block">block</link> signal.
|
2007-12-18 16:08:13 +00:00
|
|
|
*
|
|
|
|
* If you have a stream with only one switch element, such as an audio-only
|
|
|
|
* stream, a stream switch should be performed by first emitting the block
|
|
|
|
* signal, and then emitting the switch signal with -1 for the stop and start
|
|
|
|
* time values.
|
2007-12-17 14:46:26 +00:00
|
|
|
*
|
2007-12-18 16:08:13 +00:00
|
|
|
* The intention of the @stop_time and @start_time arguments is to allow
|
|
|
|
* multiple switch elements to switch and maintain stream synchronization.
|
|
|
|
* When switching a stream with multiple feeds, you will need as many switch
|
|
|
|
* elements as you have feeds. For example, a feed with audio and video will
|
|
|
|
* have one switch element between the audio feeds and one for video.
|
|
|
|
*
|
|
|
|
* A switch over multiple switch elements should be performed as follows:
|
2008-01-29 07:38:31 +00:00
|
|
|
* First, emit the <link linkend="GstInputSelector-block">block</link>
|
2007-12-18 16:08:13 +00:00
|
|
|
* signal, collecting the returned values. The maximum running time returned
|
|
|
|
* by block should then be used as the time at which to close the previous
|
|
|
|
* segment.
|
|
|
|
*
|
|
|
|
* Then, query the running times of the new audio and video pads that you will
|
|
|
|
* switch to. Naturally, these pads are on separate switch elements. Take the
|
|
|
|
* minimum running time for those streams and use it for the time at which to
|
|
|
|
* open the new segment.
|
|
|
|
*
|
|
|
|
* If @pad is the same as the current active pad, the element will cancel any
|
|
|
|
* previous block without adjusting segments.
|
2007-12-17 14:46:26 +00:00
|
|
|
*/
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_signals[SIGNAL_SWITCH] =
|
2007-12-17 14:46:26 +00:00
|
|
|
g_signal_new ("switch", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
2008-01-29 07:38:31 +00:00
|
|
|
G_STRUCT_OFFSET (GstInputSelectorClass, switch_),
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
NULL, NULL, gst_selector_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;
|
|
|
|
gstelement_class->release_pad = gst_input_selector_release_pad;
|
|
|
|
gstelement_class->change_state = gst_input_selector_change_state;
|
2007-12-17 14:48:26 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
klass->block = GST_DEBUG_FUNCPTR (gst_input_selector_block);
|
2008-03-14 17:22:21 +00:00
|
|
|
/* note the underscore because switch is a keyword otherwise */
|
2008-01-29 07:38:31 +00:00
|
|
|
klass->switch_ = GST_DEBUG_FUNCPTR (gst_input_selector_switch);
|
2007-12-17 14:43:04 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_init (GstInputSelector * sel)
|
2007-12-17 14:43:04 +00:00
|
|
|
{
|
|
|
|
sel->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
|
|
gst_pad_set_internal_link_function (sel->srcpad,
|
2008-01-29 07:38:31 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_input_selector_get_linked_pads));
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_pad_set_getcaps_function (sel->srcpad,
|
2008-01-29 07:38:31 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_input_selector_getcaps));
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (sel), sel->srcpad);
|
|
|
|
/* sinkpad management */
|
|
|
|
sel->active_sinkpad = NULL;
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
sel->padcount = 0;
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
|
2007-12-17 15:00:15 +00:00
|
|
|
|
|
|
|
sel->blocked_cond = g_cond_new ();
|
|
|
|
sel->blocked = FALSE;
|
2008-02-25 08:53:51 +00:00
|
|
|
|
|
|
|
sel->select_all = FALSE;
|
2007-12-17 14:43:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_dispose (GObject * object)
|
2007-12-17 14:43:04 +00:00
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel = GST_INPUT_SELECTOR (object);
|
2007-12-17 14:43:04 +00:00
|
|
|
|
|
|
|
if (sel->active_sinkpad) {
|
|
|
|
gst_object_unref (sel->active_sinkpad);
|
|
|
|
sel->active_sinkpad = NULL;
|
|
|
|
}
|
|
|
|
|
2007-12-17 15:00:15 +00:00
|
|
|
if (sel->blocked_cond) {
|
|
|
|
g_cond_free (sel->blocked_cond);
|
|
|
|
sel->blocked_cond = NULL;
|
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2007-12-18 16:08:13 +00:00
|
|
|
/* Solve the following equation for B.timestamp, and set that as the segment
|
|
|
|
* stop:
|
|
|
|
* B.running_time = (B.timestamp - NS.start) / NS.abs_rate + NS.accum
|
|
|
|
*/
|
|
|
|
static gint64
|
|
|
|
gst_segment_get_timestamp (GstSegment * segment, gint64 running_time)
|
|
|
|
{
|
|
|
|
return (running_time - segment->accum) * segment->abs_rate + segment->start;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_segment_set_stop (GstSegment * segment, gint64 running_time)
|
|
|
|
{
|
|
|
|
segment->stop = gst_segment_get_timestamp (segment, running_time);
|
|
|
|
segment->last_stop = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_segment_set_start (GstSegment * segment, gint64 running_time)
|
|
|
|
{
|
|
|
|
segment->start = gst_segment_get_timestamp (segment, running_time);
|
|
|
|
}
|
|
|
|
|
2007-12-17 14:55:54 +00:00
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_set_active_pad (GstInputSelector * self,
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
GstPad * pad, gint64 stop_time, gint64 start_time)
|
2007-12-17 14:55:54 +00:00
|
|
|
{
|
|
|
|
GstSelectorPad *old, *new;
|
|
|
|
GstPad **active_pad_p;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
|
|
|
|
if (pad == self->active_sinkpad)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
old = GST_SELECTOR_PAD_CAST (self->active_sinkpad);
|
|
|
|
new = GST_SELECTOR_PAD_CAST (pad);
|
|
|
|
|
2007-12-18 16:08:13 +00:00
|
|
|
if (old && old->active && !self->pending_stop && stop_time >= 0) {
|
2007-12-17 14:55:54 +00:00
|
|
|
/* schedule a last_stop update if one isn't already scheduled, and a
|
|
|
|
segment has been pushed before. */
|
|
|
|
memcpy (&self->pending_stop_segment, &old->segment,
|
|
|
|
sizeof (self->pending_stop_segment));
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "setting stop_time to %" G_GINT64_FORMAT,
|
|
|
|
stop_time);
|
2007-12-18 16:08:13 +00:00
|
|
|
gst_segment_set_stop (&self->pending_stop_segment, stop_time);
|
2007-12-17 14:55:54 +00:00
|
|
|
self->pending_stop = TRUE;
|
|
|
|
}
|
|
|
|
|
2007-12-18 16:08:13 +00:00
|
|
|
if (new && new->active && start_time >= 0) {
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "setting start_time to %" G_GINT64_FORMAT,
|
|
|
|
start_time);
|
2007-12-17 14:55:54 +00:00
|
|
|
/* schedule a new segment push */
|
2007-12-18 16:08:13 +00:00
|
|
|
gst_segment_set_start (&new->segment, start_time);
|
2007-12-17 14:55:54 +00:00
|
|
|
new->segment_pending = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
active_pad_p = &self->active_sinkpad;
|
|
|
|
gst_object_replace ((GstObject **) active_pad_p, GST_OBJECT_CAST (pad));
|
|
|
|
GST_DEBUG_OBJECT (self, "New active pad is %" GST_PTR_FORMAT,
|
|
|
|
self->active_sinkpad);
|
|
|
|
|
|
|
|
done:
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_set_property (GObject * object, guint prop_id,
|
2007-12-17 14:43:04 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel = GST_INPUT_SELECTOR (object);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-12-08 20:01:01 +00:00
|
|
|
switch (prop_id) {
|
2007-12-17 14:55:54 +00:00
|
|
|
case PROP_ACTIVE_PAD:
|
2008-03-14 17:22:21 +00:00
|
|
|
{
|
|
|
|
GstPad *pad;
|
|
|
|
|
|
|
|
pad = g_value_get_object (value);
|
|
|
|
|
|
|
|
gst_input_selector_set_active_pad (sel, pad,
|
|
|
|
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE);
|
gst/switch/gstswitch.c (ARG_0, ARG_NB_SOURCES, ARG_ACTIVE_SOURCE,
Original commit message from CVS:
* gst/switch/gstswitch.c (ARG_0, ARG_NB_SOURCES, ARG_ACTIVE_SOURCE,
ARG_START_VALUE, ARG_STOP_VALUE, ARG_LAST_TS, ARG_QUEUE_BUFFERS,
parent_class, gst_switch_release_pad, gst_switch_request_new_pad,
gst_switch_chain, gst_switch_event, gst_switch_set_property,
gst_switch_get_property, gst_switch_getcaps, gst_switch_dispose,
unref_buffer, unref_buffers_and_destroy_list, gst_switch_init,
gst_switch_base_init, gst_switch_class_init):
* gst/switch/gstswitch.h (need_to_send_newsegment, queue_buffers,
stop_value, start_value, current_start, last_ts, stored_buffers):
Add handling of application provided stop and start values, allowing
A/V sync across 2 switch elements.
2007-05-17 10:08:24 +00:00
|
|
|
break;
|
2008-03-14 17:22:21 +00:00
|
|
|
}
|
2008-02-25 08:53:51 +00:00
|
|
|
case PROP_SELECT_ALL:
|
|
|
|
sel->select_all = g_value_get_boolean (value);
|
|
|
|
break;
|
2003-12-08 20:01:01 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_get_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:33 +00:00
|
|
|
GValue * value, GParamSpec * pspec)
|
2003-12-08 20:01:01 +00:00
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel = GST_INPUT_SELECTOR (object);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-12-08 20:01:01 +00:00
|
|
|
switch (prop_id) {
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
case PROP_N_PADS:
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_OBJECT_LOCK (object);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
g_value_set_uint (value, sel->n_pads);
|
|
|
|
GST_OBJECT_UNLOCK (object);
|
|
|
|
break;
|
|
|
|
case PROP_ACTIVE_PAD:
|
|
|
|
GST_OBJECT_LOCK (object);
|
|
|
|
g_value_set_object (value, sel->active_sinkpad);
|
gst/switch/gstswitch.c (ARG_ACTIVE_SOURCE, ARG_STOP_VALUE,
Original commit message from CVS:
* gst/switch/gstswitch.c (ARG_ACTIVE_SOURCE, ARG_STOP_VALUE,
ARG_LAST_TS, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property, gst_switch_getcaps,
gst_switch_dispose, gst_switch_init, gst_switch_class_init):
* gst/switch/gstswitch.h (previous_sinkpad, nb_sinkpads, stop_value,
current_start, last_ts):
Allow application to provide a stop timestamp, so a new segment
update can be sent before switching.
2007-05-14 18:03:58 +00:00
|
|
|
GST_OBJECT_UNLOCK (object);
|
|
|
|
break;
|
2008-02-25 08:53:51 +00:00
|
|
|
case PROP_SELECT_ALL:
|
|
|
|
g_value_set_boolean (value, sel->select_all);
|
|
|
|
break;
|
2003-12-08 20:01:01 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
static GstPad *
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_get_linked_pad (GstPad * pad, gboolean strict)
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
GstPad *otherpad = NULL;
|
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_OBJECT_LOCK (sel);
|
|
|
|
if (pad == sel->srcpad)
|
|
|
|
otherpad = sel->active_sinkpad;
|
|
|
|
else if (pad == sel->active_sinkpad || !strict)
|
|
|
|
otherpad = sel->srcpad;
|
|
|
|
if (otherpad)
|
|
|
|
gst_object_ref (otherpad);
|
|
|
|
GST_OBJECT_UNLOCK (sel);
|
|
|
|
gst_object_unref (sel);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
return otherpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_getcaps (GstPad * pad)
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
{
|
examples/switch/switcher.c (my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c (gst_...
Original commit message from CVS:
* examples/switch/switcher.c (my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_dispose, gst_switch_init):
* gst/switch/gstswitch.h (switch_mutex, GST_SWITCH_LOCK,
GST_SWITCH_UNLOCK):
Add an extra lock to protect against certain variables instead of
using the object lock. Fix case where caps are different in the
sink pads causes deadlock. Update example to use different caps
on each sink pad.
2007-06-22 15:30:00 +00:00
|
|
|
GstPad *otherpad;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
GstObject *parent;
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
parent = gst_object_get_parent (GST_OBJECT (pad));
|
2008-02-25 08:53:51 +00:00
|
|
|
if (GST_INPUT_SELECTOR (parent)->select_all) {
|
|
|
|
caps = gst_pad_proxy_getcaps (pad);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
otherpad = gst_input_selector_get_linked_pad (pad, FALSE);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
if (!otherpad) {
|
|
|
|
GST_DEBUG_OBJECT (parent,
|
|
|
|
"Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad));
|
2007-12-17 14:43:04 +00:00
|
|
|
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);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
}
|
|
|
|
|
2008-02-25 08:53:51 +00:00
|
|
|
done:
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
gst_object_unref (parent);
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* check if the pad is the active sinkpad */
|
|
|
|
static gboolean
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_is_active_sinkpad (GstInputSelector * sel, GstPad * pad)
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
{
|
2007-12-17 14:43:04 +00:00
|
|
|
GstSelectorPad *selpad;
|
|
|
|
gboolean res;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
selpad = GST_SELECTOR_PAD_CAST (pad);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_OBJECT_LOCK (sel);
|
|
|
|
res = (pad == sel->active_sinkpad);
|
|
|
|
GST_OBJECT_UNLOCK (sel);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
return res;
|
|
|
|
}
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
/* Get or create the active sinkpad */
|
|
|
|
static GstPad *
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_activate_sinkpad (GstInputSelector * sel, GstPad * pad)
|
2007-12-17 14:43:04 +00:00
|
|
|
{
|
|
|
|
GstPad *active_sinkpad;
|
|
|
|
GstSelectorPad *selpad;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
selpad = GST_SELECTOR_PAD_CAST (pad);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
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);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
return active_sinkpad;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GList *
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_get_linked_pads (GstPad * pad)
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
{
|
2007-12-17 14:43:04 +00:00
|
|
|
GstPad *otherpad;
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
otherpad = gst_input_selector_get_linked_pad (pad, TRUE);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
if (!otherpad)
|
|
|
|
return NULL;
|
2007-12-17 14:43:04 +00:00
|
|
|
/* need to drop the ref, internal linked pads is not MT safe */
|
|
|
|
gst_object_unref (otherpad);
|
examples/switch/switcher.c (loop, my_bus_callback, switch_timer, last_message_received, main): gst/switch/gstswitch.c...
Original commit message from CVS:
* configure.ac:
* examples/Makefile.am:
* examples/switch/switcher.c (loop, my_bus_callback, switch_timer,
last_message_received, main):
* gst/switch/gstswitch.c (GST_CAT_DEFAULT, gst_switch_details,
gst_switch_src_factory, parent_class, gst_switch_release_pad,
gst_switch_request_new_pad, gst_switch_chain, gst_switch_event,
gst_switch_set_property, gst_switch_get_property,
gst_switch_get_linked_pad, gst_switch_getcaps,
gst_switch_bufferalloc, gst_switch_get_linked_pads,
gst_switch_dispose, gst_switch_init, gst_switch_base_init,
gst_switch_class_init):
* gst/switch/gstswitch.h (GstSwitch, GstSwitchClass, _GstSwitch,
element, active_sinkpad, srcpad, nb_sinkpads, newsegment_events,
need_to_send_newsegment):
Port switch element and example program to 0.10.
2007-05-03 16:49:05 +00:00
|
|
|
return g_list_append (NULL, otherpad);
|
|
|
|
}
|
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
static GstPad *
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_request_new_pad (GstElement * element,
|
2007-12-17 14:43:04 +00:00
|
|
|
GstPadTemplate * templ, const gchar * unused)
|
2003-12-08 20:01:01 +00:00
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel;
|
2007-12-17 14:43:04 +00:00
|
|
|
gchar *name = NULL;
|
|
|
|
GstPad *sinkpad = NULL;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
sel = GST_INPUT_SELECTOR (element);
|
2007-12-17 14:43:04 +00:00
|
|
|
g_return_val_if_fail (templ->direction == GST_PAD_SINK, NULL);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
GST_LOG_OBJECT (sel, "Creating new pad %d", sel->padcount);
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_OBJECT_LOCK (sel);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
name = g_strdup_printf ("sink%d", sel->padcount++);
|
2007-12-17 14:43:04 +00:00
|
|
|
sinkpad = g_object_new (GST_TYPE_SELECTOR_PAD,
|
|
|
|
"name", name, "direction", templ->direction, "template", templ, NULL);
|
|
|
|
g_free (name);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
sel->n_pads++;
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_OBJECT_UNLOCK (sel);
|
|
|
|
|
|
|
|
gst_pad_set_event_function (sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_selector_pad_event));
|
|
|
|
gst_pad_set_getcaps_function (sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_selector_pad_getcaps));
|
|
|
|
gst_pad_set_chain_function (sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
|
|
|
|
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));
|
2003-12-08 20:01:01 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_pad_set_active (sinkpad, TRUE);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
return sinkpad;
|
2003-12-08 20:01:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_release_pad (GstElement * element, GstPad * pad)
|
2003-12-08 20:01:01 +00:00
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *sel;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2008-01-29 07:38:31 +00:00
|
|
|
sel = GST_INPUT_SELECTOR (element);
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_LOG_OBJECT (sel, "Releasing pad %s:%s", GST_DEBUG_PAD_NAME (pad));
|
2004-05-11 03:56:20 +00:00
|
|
|
|
2007-12-17 14:43:04 +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;
|
2003-12-08 20:01:01 +00:00
|
|
|
}
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
sel->n_pads--;
|
2007-12-17 14:43:04 +00:00
|
|
|
GST_OBJECT_UNLOCK (sel);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2007-12-17 14:43:04 +00:00
|
|
|
gst_pad_set_active (pad, FALSE);
|
|
|
|
gst_element_remove_pad (GST_ELEMENT (sel), pad);
|
2003-12-08 20:01:01 +00:00
|
|
|
}
|
|
|
|
|
2007-12-17 15:01:55 +00:00
|
|
|
static GstStateChangeReturn
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_change_state (GstElement * element,
|
2007-12-17 15:01:55 +00:00
|
|
|
GstStateChange transition)
|
2007-12-17 14:52:14 +00:00
|
|
|
{
|
2008-01-29 07:38:31 +00:00
|
|
|
GstInputSelector *self = GST_INPUT_SELECTOR (element);
|
2007-12-17 15:01:55 +00:00
|
|
|
GstStateChangeReturn result;
|
2007-12-17 14:52:14 +00:00
|
|
|
|
2007-12-17 15:01:55 +00:00
|
|
|
result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2007-12-17 14:52:14 +00:00
|
|
|
|
2007-12-17 15:01:55 +00:00
|
|
|
if (transition == GST_STATE_CHANGE_PAUSED_TO_READY) {
|
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
self->blocked = FALSE;
|
|
|
|
g_cond_broadcast (self->blocked_cond);
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
2007-12-17 14:52:14 +00:00
|
|
|
}
|
|
|
|
|
2007-12-17 15:01:55 +00:00
|
|
|
return result;
|
2007-12-17 14:52:14 +00:00
|
|
|
}
|
|
|
|
|
2007-12-18 16:08:13 +00:00
|
|
|
static gint64
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_block (GstInputSelector * self)
|
2007-12-17 14:48:26 +00:00
|
|
|
{
|
2007-12-18 16:08:13 +00:00
|
|
|
gint64 ret = 0;
|
|
|
|
GstSelectorPad *spad;
|
2007-12-17 15:06:48 +00:00
|
|
|
|
2007-12-17 15:01:55 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
|
|
|
|
if (self->blocked)
|
|
|
|
GST_WARNING_OBJECT (self, "switch already blocked");
|
|
|
|
|
|
|
|
self->blocked = TRUE;
|
2007-12-18 16:08:13 +00:00
|
|
|
spad = GST_SELECTOR_PAD_CAST (self->active_sinkpad);
|
2007-12-17 15:01:55 +00:00
|
|
|
|
2007-12-18 16:08:13 +00:00
|
|
|
if (self->active_sinkpad)
|
|
|
|
ret = gst_selector_pad_get_running_time (spad);
|
|
|
|
else
|
2007-12-17 15:06:48 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "no active pad while blocking");
|
|
|
|
|
2007-12-17 15:01:55 +00:00
|
|
|
GST_OBJECT_UNLOCK (self);
|
2007-12-17 15:06:48 +00:00
|
|
|
|
|
|
|
return ret;
|
2007-12-17 14:48:26 +00:00
|
|
|
}
|
|
|
|
|
2007-12-17 14:55:54 +00:00
|
|
|
static void
|
2008-01-29 07:38:31 +00:00
|
|
|
gst_input_selector_push_pending_stop (GstInputSelector * self)
|
2007-12-17 14:55:54 +00:00
|
|
|
{
|
|
|
|
GstEvent *event = NULL;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (self->pending_stop)) {
|
|
|
|
GstSegment *seg = &self->pending_stop_segment;
|
|
|
|
|
2008-03-14 17:22:21 +00:00
|
|
|
GST_DEBUG_OBJECT (self,
|
|
|
|
"pushing NEWSEGMENT update %d, rate %lf, applied rate %lf, "
|
|
|
|
"format %d, "
|
|
|
|
"%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
|
|
|
|
G_GINT64_FORMAT, TRUE, seg->rate, seg->applied_rate, seg->format,
|
|
|
|
seg->start, seg->stop, seg->time);
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
|
2007-12-17 14:55:54 +00:00
|
|
|
event = gst_event_new_new_segment_full (TRUE, seg->rate,
|
2008-03-14 17:22:21 +00:00
|
|
|
seg->applied_rate, seg->format, seg->start, seg->stop, seg->time);
|
2007-12-17 14:55:54 +00:00
|
|
|
|
|
|
|
self->pending_stop = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
|
|
|
|
|
|
|
if (event)
|
|
|
|
gst_pad_push_event (self->srcpad, event);
|
|
|
|
}
|
|
|
|
|
2007-12-18 16:08:13 +00:00
|
|
|
/* stop_time and start_time are running times */
|
2007-12-17 14:48:26 +00:00
|
|
|
static void
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
gst_input_selector_switch (GstInputSelector * self, GstPad * pad,
|
2007-12-18 16:08:13 +00:00
|
|
|
gint64 stop_time, gint64 start_time)
|
2007-12-17 14:48:26 +00:00
|
|
|
{
|
2007-12-17 14:55:54 +00:00
|
|
|
g_return_if_fail (self->blocked == TRUE);
|
|
|
|
|
gst/selector/gstinputselector.*: Various cleanups.
Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init),
(gst_selector_pad_finalize), (gst_selector_pad_get_property),
(gst_selector_pad_event), (gst_input_selector_class_init),
(gst_input_selector_init), (gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_get_property),
(gst_input_selector_request_new_pad),
(gst_input_selector_release_pad),
(gst_input_selector_push_pending_stop),
(gst_input_selector_switch):
* gst/selector/gstinputselector.h:
Various cleanups.
Added tags to the pads.
Select active pad based on the pad object instead of its name.
Fix refcount in set_active_pad.
Add property to get the number of pads.
* gst/selector/gstoutputselector.c:
(gst_output_selector_class_init),
(gst_output_selector_set_property),
(gst_output_selector_get_property):
Various cleanups.
Select the active pad based on the pad object instead of its name.
Fix locking when setting the active pad.
* gst/selector/gstselector-marshal.list:
* tests/check/elements/selector.c: (cleanup_pad),
(selector_set_active_pad), (run_input_selector_buffer_count):
Fixes for pad instead of padname for pad selection.
2008-03-13 16:46:04 +00:00
|
|
|
gst_input_selector_set_active_pad (self, pad, stop_time, start_time);
|
2007-12-17 14:55:54 +00:00
|
|
|
|
2007-12-17 15:01:55 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
self->blocked = FALSE;
|
|
|
|
g_cond_broadcast (self->blocked_cond);
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
2007-12-17 14:48:26 +00:00
|
|
|
}
|
2008-02-25 08:53:51 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_input_selector_check_eos (GstElement * selector)
|
|
|
|
{
|
|
|
|
GstIterator *it = gst_element_iterate_sink_pads (selector);
|
|
|
|
GstIteratorResult ires;
|
|
|
|
gpointer item;
|
|
|
|
gboolean done = FALSE, is_eos = FALSE;
|
|
|
|
GstSelectorPad *pad;
|
|
|
|
|
|
|
|
while (!done) {
|
|
|
|
ires = gst_iterator_next (it, &item);
|
|
|
|
switch (ires) {
|
|
|
|
case GST_ITERATOR_DONE:
|
|
|
|
GST_INFO_OBJECT (selector, "all sink pads have eos");
|
|
|
|
done = TRUE;
|
|
|
|
is_eos = TRUE;
|
|
|
|
break;
|
|
|
|
case GST_ITERATOR_OK:
|
|
|
|
pad = GST_SELECTOR_PAD_CAST (item);
|
|
|
|
if (!pad->eos) {
|
|
|
|
done = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_ITERATOR_RESYNC:
|
|
|
|
gst_iterator_resync (it);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
done = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gst_iterator_free (it);
|
|
|
|
|
|
|
|
return is_eos;
|
|
|
|
}
|