2001-01-18 23:46:15 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
2005-03-21 17:34:02 +00:00
|
|
|
* 2000,2001,2002,2003,2004,2005 Wim Taymans <wim@fluendo.com>
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2001-01-18 23:46:15 +00:00
|
|
|
*
|
|
|
|
* gsttee.c: Tee element, one in N out
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2006-01-04 12:41:35 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-tee
|
|
|
|
* @short_description: 1-to-N pipe fitting
|
|
|
|
* @see_also: #GstIdentity
|
|
|
|
*
|
|
|
|
* Split data to multiple pads.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
#include "gsttee.h"
|
|
|
|
|
2003-11-03 20:56:53 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
gst/: s/gst_pad_new/&_from_template/ register pad templates in the base_init function add static pad template definit...
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c:
(gst_spider_identity_request_new_pad):
* gst/elements/gstaggregator.c: (gst_aggregator_base_init),
(gst_aggregator_init):
* gst/elements/gstfakesink.c: (gst_fakesink_base_init),
(gst_fakesink_init):
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_init):
* gst/elements/gstfdsink.c: (gst_fdsink_base_init),
(gst_fdsink_init):
* gst/elements/gstfdsrc.c: (gst_fdsrc_base_init), (gst_fdsrc_init):
* gst/elements/gstfilesink.c: (gst_filesink_base_init),
(gst_filesink_init):
* gst/elements/gstfilesrc.c: (gst_filesrc_base_init),
(gst_filesrc_init):
* gst/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_init):
* gst/elements/gstmultifilesrc.c: (gst_multifilesrc_base_init),
(gst_multifilesrc_init):
* gst/elements/gstpipefilter.c: (gst_pipefilter_base_init),
(gst_pipefilter_init):
* gst/elements/gststatistics.c: (gst_statistics_base_init),
(gst_statistics_init):
* gst/elements/gsttee.c: (gst_tee_base_init), (gst_tee_init):
* gst/gstqueue.c: (gst_queue_base_init), (gst_queue_init):
s/gst_pad_new/&_from_template/
register pad templates in the base_init function
add static pad template definitions
2004-08-17 14:11:23 +00:00
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_tee_debug);
|
2003-06-29 14:05:49 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_tee_debug
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2006-04-28 18:55:17 +00:00
|
|
|
static const GstElementDetails gst_tee_details =
|
2005-09-28 12:52:51 +00:00
|
|
|
GST_ELEMENT_DETAILS ("Tee pipe fitting",
|
2004-03-13 15:27:01 +00:00
|
|
|
"Generic",
|
|
|
|
"1-to-N pipe fitting",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
2005-03-21 17:34:02 +00:00
|
|
|
"Wim \"Tim\" Taymans <wim@fluendo.com>");
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2007-02-09 13:45:27 +00:00
|
|
|
#define GST_TYPE_TEE_PULL_MODE (gst_tee_pull_mode_get_type())
|
|
|
|
static GType
|
|
|
|
gst_tee_pull_mode_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
static const GEnumValue data[] = {
|
|
|
|
{GST_TEE_PULL_MODE_NEVER, "Never activate in pull mode", "never"},
|
|
|
|
{GST_TEE_PULL_MODE_SINGLE, "Only one src pad can be active in pull mode",
|
|
|
|
"single"},
|
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!type) {
|
|
|
|
type = g_enum_register_static ("GstTeePullMode", data);
|
|
|
|
}
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
#define DEFAULT_PROP_NUM_SRC_PADS 0
|
|
|
|
#define DEFAULT_PROP_HAS_SINK_LOOP FALSE
|
|
|
|
#define DEFAULT_PROP_HAS_CHAIN TRUE
|
|
|
|
#define DEFAULT_PROP_SILENT TRUE
|
|
|
|
#define DEFAULT_PROP_LAST_MESSAGE NULL
|
2007-02-09 13:45:27 +00:00
|
|
|
#define DEFAULT_PULL_MODE GST_TEE_PULL_MODE_NEVER
|
2006-10-11 16:30:14 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_NUM_SRC_PADS,
|
|
|
|
PROP_HAS_SINK_LOOP,
|
|
|
|
PROP_HAS_CHAIN,
|
|
|
|
PROP_SILENT,
|
2007-02-09 13:45:27 +00:00
|
|
|
PROP_LAST_MESSAGE,
|
|
|
|
PROP_PULL_MODE,
|
2001-01-18 23:46:15 +00:00
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_REQUEST,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-01-08 04:10:18 +00:00
|
|
|
#define _do_init(bla) \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element");
|
|
|
|
|
|
|
|
GST_BOILERPLATE_FULL (GstTee, gst_tee, GstElement, GST_TYPE_ELEMENT, _do_init);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstPad *gst_tee_request_new_pad (GstElement * element,
|
|
|
|
GstPadTemplate * temp, const gchar * unused);
|
2006-10-11 16:30:14 +00:00
|
|
|
static void gst_tee_release_pad (GstElement * element, GstPad * pad);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-03-21 03:22:55 +00:00
|
|
|
static void gst_tee_finalize (GObject * object);
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_tee_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_tee_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
static GstFlowReturn gst_tee_chain (GstPad * pad, GstBuffer * buffer);
|
2006-10-11 16:30:14 +00:00
|
|
|
static GstFlowReturn gst_tee_buffer_alloc (GstPad * pad, guint64 offset,
|
|
|
|
guint size, GstCaps * caps, GstBuffer ** buf);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
static gboolean gst_tee_sink_activate_push (GstPad * pad, gboolean active);
|
2007-02-09 13:45:27 +00:00
|
|
|
static gboolean gst_tee_src_check_get_range (GstPad * pad);
|
|
|
|
static gboolean gst_tee_src_activate_pull (GstPad * pad, gboolean active);
|
|
|
|
static GstFlowReturn gst_tee_src_get_range (GstPad * pad, guint64 offset,
|
|
|
|
guint length, GstBuffer ** buf);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2001-12-19 01:17:54 +00:00
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
static void
|
|
|
|
gst_tee_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
gst/: s/gst_pad_new/&_from_template/ register pad templates in the base_init function add static pad template definit...
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c:
(gst_spider_identity_request_new_pad):
* gst/elements/gstaggregator.c: (gst_aggregator_base_init),
(gst_aggregator_init):
* gst/elements/gstfakesink.c: (gst_fakesink_base_init),
(gst_fakesink_init):
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_init):
* gst/elements/gstfdsink.c: (gst_fdsink_base_init),
(gst_fdsink_init):
* gst/elements/gstfdsrc.c: (gst_fdsrc_base_init), (gst_fdsrc_init):
* gst/elements/gstfilesink.c: (gst_filesink_base_init),
(gst_filesink_init):
* gst/elements/gstfilesrc.c: (gst_filesrc_base_init),
(gst_filesrc_init):
* gst/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_init):
* gst/elements/gstmultifilesrc.c: (gst_multifilesrc_base_init),
(gst_multifilesrc_init):
* gst/elements/gstpipefilter.c: (gst_pipefilter_base_init),
(gst_pipefilter_init):
* gst/elements/gststatistics.c: (gst_statistics_base_init),
(gst_statistics_init):
* gst/elements/gsttee.c: (gst_tee_base_init), (gst_tee_init):
* gst/gstqueue.c: (gst_queue_base_init), (gst_queue_init):
s/gst_pad_new/&_from_template/
register pad templates in the base_init function
add static pad template definitions
2004-08-17 14:11:23 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sinktemplate));
|
2003-10-31 19:32:47 +00:00
|
|
|
gst_element_class_set_details (gstelement_class, &gst_tee_details);
|
2003-12-22 01:39:35 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&tee_src_template));
|
2003-10-31 19:32:47 +00:00
|
|
|
}
|
2004-03-21 03:22:55 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_tee_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
|
|
|
|
tee = GST_TEE (object);
|
|
|
|
|
|
|
|
g_free (tee->last_message);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_tee_class_init (GstTeeClass * klass)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
2001-06-25 01:20:11 +00:00
|
|
|
GObjectClass *gobject_class;
|
2001-01-18 23:46:15 +00:00
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
gstelement_class = GST_ELEMENT_CLASS (klass);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tee_finalize);
|
2005-03-08 17:42:29 +00:00
|
|
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
|
|
|
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_NUM_SRC_PADS,
|
2006-10-11 16:30:14 +00:00
|
|
|
g_param_spec_int ("num-src-pads", "Num Src Pads",
|
|
|
|
"The number of source pads", 0, G_MAXINT, DEFAULT_PROP_NUM_SRC_PADS,
|
|
|
|
G_PARAM_READABLE));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_HAS_SINK_LOOP,
|
2006-10-11 16:30:14 +00:00
|
|
|
g_param_spec_boolean ("has-sink-loop", "Has Sink Loop",
|
2007-02-09 13:45:27 +00:00
|
|
|
"If the element should spawn a thread (unimplemented and deprecated)",
|
2006-10-11 16:30:14 +00:00
|
|
|
DEFAULT_PROP_HAS_SINK_LOOP, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_HAS_CHAIN,
|
2006-10-11 16:30:14 +00:00
|
|
|
g_param_spec_boolean ("has-chain", "Has Chain",
|
2007-02-09 13:45:27 +00:00
|
|
|
"If the element can operate in push mode",
|
|
|
|
DEFAULT_PROP_HAS_CHAIN, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SILENT,
|
2006-10-11 16:30:14 +00:00
|
|
|
g_param_spec_boolean ("silent", "Silent",
|
|
|
|
"Don't produce last_message events", DEFAULT_PROP_SILENT,
|
|
|
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LAST_MESSAGE,
|
2006-10-11 16:30:14 +00:00
|
|
|
g_param_spec_string ("last_message", "Last Message",
|
|
|
|
"The message describing current status", DEFAULT_PROP_LAST_MESSAGE,
|
|
|
|
G_PARAM_READABLE));
|
2007-02-09 13:45:27 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_PULL_MODE,
|
|
|
|
g_param_spec_enum ("pull-mode", "Pull mode",
|
|
|
|
"Behavior of tee in pull mode", GST_TYPE_TEE_PULL_MODE,
|
|
|
|
DEFAULT_PULL_MODE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
gstelement_class->request_new_pad =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_request_new_pad);
|
2006-10-11 16:30:14 +00:00
|
|
|
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_tee_release_pad);
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
2005-08-28 17:45:58 +00:00
|
|
|
gst_tee_init (GstTee * tee, GstTeeClass * g_class)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
2005-11-16 16:09:49 +00:00
|
|
|
tee->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
|
2007-02-09 13:45:27 +00:00
|
|
|
tee->sink_mode = GST_ACTIVATE_NONE;
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_pad_set_setcaps_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_getcaps_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
2006-10-11 16:30:14 +00:00
|
|
|
gst_pad_set_bufferalloc_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_buffer_alloc));
|
2007-02-09 13:45:27 +00:00
|
|
|
gst_pad_set_activatepush_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_sink_activate_push));
|
|
|
|
gst_pad_set_chain_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_chain));
|
2005-09-27 15:37:40 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2002-02-12 13:57:14 +00:00
|
|
|
tee->last_message = NULL;
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstPad *
|
|
|
|
gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
|
|
|
const gchar * unused)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
|
|
|
gchar *name;
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstTee *tee;
|
2006-10-11 16:30:14 +00:00
|
|
|
GstActivateMode mode;
|
|
|
|
gboolean res;
|
2001-01-18 23:46:15 +00:00
|
|
|
|
|
|
|
tee = GST_TEE (element);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
2005-03-21 17:34:02 +00:00
|
|
|
name = g_strdup_printf ("src%d", tee->pad_counter++);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
srcpad = gst_pad_new_from_template (templ, name);
|
2002-02-12 13:57:14 +00:00
|
|
|
g_free (name);
|
2001-12-25 02:15:46 +00:00
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
if (tee->allocpad == NULL)
|
|
|
|
tee->allocpad = srcpad;
|
|
|
|
|
|
|
|
mode = tee->sink_mode;
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
|
2007-02-09 13:45:27 +00:00
|
|
|
switch (mode) {
|
|
|
|
case GST_ACTIVATE_PULL:
|
|
|
|
/* we already have a src pad in pull mode, and our pull mode can only be
|
|
|
|
SINGLE, so fall through to activate this new pad in push mode */
|
|
|
|
case GST_ACTIVATE_PUSH:
|
|
|
|
res = gst_pad_activate_push (srcpad, TRUE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2006-10-11 16:30:14 +00:00
|
|
|
|
|
|
|
if (!res)
|
|
|
|
goto activate_failed;
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_pad_set_setcaps_function (srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
|
|
|
|
gst_pad_set_getcaps_function (srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
2007-02-09 13:45:27 +00:00
|
|
|
gst_pad_set_activatepull_function (srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_src_activate_pull));
|
|
|
|
gst_pad_set_checkgetrange_function (srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_src_check_get_range));
|
|
|
|
gst_pad_set_getrange_function (srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_src_get_range));
|
2006-10-11 16:30:14 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT_CAST (tee), srcpad);
|
2001-12-19 01:17:54 +00:00
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
return srcpad;
|
2006-10-11 16:30:14 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
activate_failed:
|
|
|
|
{
|
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
GST_DEBUG_OBJECT (tee, "warning failed to activate request pad");
|
|
|
|
if (tee->allocpad == srcpad)
|
|
|
|
tee->allocpad = NULL;
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_tee_release_pad (GstElement * element, GstPad * pad)
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
|
|
|
|
tee = GST_TEE (element);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
if (tee->allocpad == pad)
|
|
|
|
tee->allocpad = NULL;
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
|
|
|
|
gst_pad_set_active (pad, FALSE);
|
|
|
|
|
|
|
|
gst_element_remove_pad (GST_ELEMENT_CAST (tee), pad);
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_tee_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
GstTee *tee = GST_TEE (object);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
2001-06-25 01:20:11 +00:00
|
|
|
switch (prop_id) {
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_HAS_SINK_LOOP:
|
|
|
|
tee->has_sink_loop = g_value_get_boolean (value);
|
2007-02-09 13:45:27 +00:00
|
|
|
if (tee->has_sink_loop) {
|
|
|
|
g_warning ("tee will never implement has-sink-loop==TRUE");
|
|
|
|
}
|
2005-03-21 17:34:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_HAS_CHAIN:
|
|
|
|
tee->has_chain = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_SILENT:
|
2001-07-11 19:22:20 +00:00
|
|
|
tee->silent = g_value_get_boolean (value);
|
|
|
|
break;
|
2007-02-09 13:45:27 +00:00
|
|
|
case PROP_PULL_MODE:
|
|
|
|
tee->pull_mode = g_value_get_enum (value);
|
|
|
|
break;
|
2001-06-25 01:20:11 +00:00
|
|
|
default:
|
2002-02-24 13:38:10 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-06-25 01:20:11 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2001-06-25 01:20:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-06-25 01:20:11 +00:00
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
GstTee *tee = GST_TEE (object);
|
2001-06-25 01:20:11 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
2001-06-25 01:20:11 +00:00
|
|
|
switch (prop_id) {
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_NUM_SRC_PADS:
|
2001-12-25 02:15:46 +00:00
|
|
|
g_value_set_int (value, GST_ELEMENT (tee)->numsrcpads);
|
2001-01-18 23:46:15 +00:00
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_HAS_SINK_LOOP:
|
|
|
|
g_value_set_boolean (value, tee->has_sink_loop);
|
|
|
|
break;
|
|
|
|
case PROP_HAS_CHAIN:
|
|
|
|
g_value_set_boolean (value, tee->has_chain);
|
|
|
|
break;
|
|
|
|
case PROP_SILENT:
|
2001-07-11 19:22:20 +00:00
|
|
|
g_value_set_boolean (value, tee->silent);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_LAST_MESSAGE:
|
2004-03-21 03:22:55 +00:00
|
|
|
g_value_set_string (value, tee->last_message);
|
2002-02-24 13:38:10 +00:00
|
|
|
break;
|
2007-02-09 13:45:27 +00:00
|
|
|
case PROP_PULL_MODE:
|
|
|
|
g_value_set_enum (value, tee->pull_mode);
|
|
|
|
break;
|
2001-01-18 23:46:15 +00:00
|
|
|
default:
|
2002-02-24 13:38:10 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-01-18 23:46:15 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_tee_buffer_alloc (GstPad * pad, guint64 offset, guint size,
|
|
|
|
GstCaps * caps, GstBuffer ** buf)
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
GstFlowReturn res;
|
|
|
|
GstPad *allocpad;
|
|
|
|
|
|
|
|
tee = GST_TEE (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
if ((allocpad = tee->allocpad))
|
|
|
|
gst_object_ref (allocpad);
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
|
|
|
|
if (allocpad) {
|
|
|
|
res = gst_pad_alloc_buffer (allocpad, offset, size, caps, buf);
|
|
|
|
gst_object_unref (allocpad);
|
|
|
|
} else {
|
|
|
|
res = GST_FLOW_OK;
|
|
|
|
*buf = NULL;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
} PushData;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_tee_do_push (GstPad * pad, GValue * ret, PushData * data)
|
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
2006-01-27 16:59:57 +00:00
|
|
|
GstTee *tee = data->tee;
|
2005-03-21 17:34:02 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (!data->tee->silent)) {
|
|
|
|
GstBuffer *buf = data->buffer;
|
|
|
|
|
2006-01-27 16:59:57 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
2005-03-21 17:34:02 +00:00
|
|
|
g_free (tee->last_message);
|
|
|
|
tee->last_message =
|
|
|
|
g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %"
|
|
|
|
G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (pad),
|
|
|
|
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
2006-01-27 16:59:57 +00:00
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2005-03-21 17:34:02 +00:00
|
|
|
g_object_notify (G_OBJECT (tee), "last_message");
|
|
|
|
}
|
|
|
|
|
2006-01-26 12:40:17 +00:00
|
|
|
/* Push */
|
2007-02-09 13:45:27 +00:00
|
|
|
if (pad == data->tee->pull_pad) {
|
|
|
|
res = GST_FLOW_OK;
|
|
|
|
} else {
|
|
|
|
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
|
|
|
|
GST_LOG_OBJECT (tee, "Pushing buffer %p to %" GST_PTR_FORMAT
|
|
|
|
" yielded result=%d", data->buffer, pad, res);
|
|
|
|
}
|
2006-01-27 16:59:57 +00:00
|
|
|
|
|
|
|
/* If it's fatal or OK, or if ret is currently
|
|
|
|
* not-linked, we overwrite the previous value */
|
|
|
|
if (GST_FLOW_IS_FATAL (res) || (res == GST_FLOW_OK) ||
|
|
|
|
(g_value_get_enum (ret) == GST_FLOW_NOT_LINKED)) {
|
|
|
|
GST_LOG_OBJECT (tee, "Replacing ret val %d with %d",
|
|
|
|
g_value_get_enum (ret), res);
|
2006-01-26 12:40:17 +00:00
|
|
|
g_value_set_enum (ret, res);
|
|
|
|
}
|
2005-10-04 18:46:09 +00:00
|
|
|
|
2005-09-27 15:37:40 +00:00
|
|
|
gst_object_unref (pad);
|
|
|
|
|
2006-01-26 12:40:17 +00:00
|
|
|
/* Stop iterating if flow return is fatal */
|
|
|
|
return (!GST_FLOW_IS_FATAL (res));
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_tee_handle_buffer (GstTee * tee, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstIterator *iter;
|
|
|
|
PushData data;
|
|
|
|
GValue ret = { 0, };
|
|
|
|
GstIteratorResult res;
|
|
|
|
|
|
|
|
tee->offset += GST_BUFFER_SIZE (buffer);
|
|
|
|
|
|
|
|
g_value_init (&ret, GST_TYPE_FLOW_RETURN);
|
2006-01-26 12:40:17 +00:00
|
|
|
g_value_set_enum (&ret, GST_FLOW_NOT_LINKED);
|
2005-09-30 15:43:03 +00:00
|
|
|
iter = gst_element_iterate_src_pads (GST_ELEMENT (tee));
|
2005-03-21 17:34:02 +00:00
|
|
|
data.tee = tee;
|
|
|
|
data.buffer = buffer;
|
|
|
|
|
2006-01-27 16:59:57 +00:00
|
|
|
GST_LOG_OBJECT (tee, "Starting to push buffer %p", buffer);
|
|
|
|
/* FIXME: Not sure how tee would handle RESEND buffer from some of the
|
|
|
|
* pads but not from others. */
|
2005-03-21 17:34:02 +00:00
|
|
|
res = gst_iterator_fold (iter, (GstIteratorFoldFunction) gst_tee_do_push,
|
|
|
|
&ret, &data);
|
|
|
|
gst_iterator_free (iter);
|
|
|
|
|
2006-01-27 16:59:57 +00:00
|
|
|
GST_LOG_OBJECT (tee, "Pushing buffer %p yielded result=%d", buffer,
|
|
|
|
g_value_get_enum (&ret));
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
/* no need to unset gvalue */
|
|
|
|
return g_value_get_enum (&ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_tee_chain (GstPad * pad, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
|
|
|
GstTee *tee;
|
|
|
|
|
2007-02-09 13:45:27 +00:00
|
|
|
tee = GST_TEE (gst_pad_get_parent (pad));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
res = gst_tee_handle_buffer (tee, buffer);
|
2001-12-25 02:15:46 +00:00
|
|
|
|
2007-02-09 13:45:27 +00:00
|
|
|
gst_object_unref (tee);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2007-02-09 13:45:27 +00:00
|
|
|
return res;
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
2001-12-25 02:15:46 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
static gboolean
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
gst_tee_sink_activate_push (GstPad * pad, gboolean active)
|
2005-03-21 17:34:02 +00:00
|
|
|
{
|
|
|
|
GstTee *tee;
|
2001-12-25 02:15:46 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
tee = GST_TEE (GST_OBJECT_PARENT (pad));
|
2001-07-11 19:22:20 +00:00
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
tee->sink_mode = active && GST_ACTIVATE_PUSH;
|
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
if (active && !tee->has_chain)
|
|
|
|
goto no_chain;
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2005-03-21 17:34:02 +00:00
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
return TRUE;
|
2006-10-11 16:30:14 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_chain:
|
|
|
|
{
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2007-02-09 13:45:27 +00:00
|
|
|
GST_INFO_OBJECT (tee,
|
|
|
|
"Tee cannot operate in push mode with has-chain==FALSE");
|
2006-10-11 16:30:14 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2007-02-09 13:45:27 +00:00
|
|
|
gst_tee_src_activate_pull (GstPad * pad, gboolean active)
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
{
|
|
|
|
GstTee *tee;
|
2006-10-11 16:30:14 +00:00
|
|
|
gboolean res;
|
2007-02-09 13:45:27 +00:00
|
|
|
GstPad *sinkpad;
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2007-02-09 13:45:27 +00:00
|
|
|
tee = GST_TEE (gst_pad_get_parent (pad));
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2007-02-09 13:45:27 +00:00
|
|
|
if (tee->pull_mode == GST_TEE_PULL_MODE_NEVER)
|
|
|
|
goto cannot_pull;
|
|
|
|
|
|
|
|
if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE && active && tee->pull_pad)
|
|
|
|
goto cannot_pull_multiple_srcs;
|
|
|
|
|
|
|
|
sinkpad = gst_object_ref (tee->sinkpad);
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
|
|
|
|
res = gst_pad_activate_pull (sinkpad, active);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
goto sink_activate_failed;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (tee);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
if (active) {
|
2007-02-09 13:45:27 +00:00
|
|
|
if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE)
|
|
|
|
tee->pull_pad = pad;
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
} else {
|
2007-02-09 13:45:27 +00:00
|
|
|
if (pad == tee->pull_pad)
|
|
|
|
tee->pull_pad = NULL;
|
|
|
|
}
|
|
|
|
tee->sink_mode = active && GST_ACTIVATE_PULL;
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
|
|
|
|
gst_object_unref (tee);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
cannot_pull:
|
|
|
|
{
|
2006-10-11 16:30:14 +00:00
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2007-02-09 13:45:27 +00:00
|
|
|
GST_INFO_OBJECT (tee, "Cannot activate in pull mode, pull-mode "
|
|
|
|
"set to NEVER");
|
|
|
|
gst_object_unref (tee);
|
|
|
|
return FALSE;
|
2006-10-11 16:30:14 +00:00
|
|
|
}
|
2007-02-09 13:45:27 +00:00
|
|
|
cannot_pull_multiple_srcs:
|
|
|
|
{
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
GST_INFO_OBJECT (tee, "Cannot activate multiple src pads in pull mode, "
|
|
|
|
"pull-mode set to SINGLE");
|
|
|
|
gst_object_unref (tee);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
sink_activate_failed:
|
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (tee, "Failed to %sactivate sink pad in pull mode",
|
|
|
|
active ? "" : "de");
|
|
|
|
gst_object_unref (tee);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_tee_src_check_get_range (GstPad * pad)
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
gboolean res;
|
|
|
|
GstPad *sinkpad;
|
|
|
|
|
|
|
|
tee = GST_TEE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
|
|
|
|
if (tee->pull_mode == GST_TEE_PULL_MODE_NEVER)
|
|
|
|
goto cannot_pull;
|
|
|
|
|
|
|
|
if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE && tee->pull_pad)
|
|
|
|
goto cannot_pull_multiple_srcs;
|
|
|
|
|
|
|
|
sinkpad = gst_object_ref (tee->sinkpad);
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
|
|
|
|
res = gst_pad_check_pull_range (sinkpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
|
|
|
|
gst_object_unref (tee);
|
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
return res;
|
|
|
|
|
|
|
|
/* ERRORS */
|
2007-02-09 13:45:27 +00:00
|
|
|
cannot_pull:
|
2006-10-11 16:30:14 +00:00
|
|
|
{
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2007-02-09 13:45:27 +00:00
|
|
|
GST_INFO_OBJECT (tee, "Cannot activate in pull mode, pull-mode "
|
|
|
|
"set to NEVER");
|
|
|
|
gst_object_unref (tee);
|
2006-10-11 16:30:14 +00:00
|
|
|
return FALSE;
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
}
|
2007-02-09 13:45:27 +00:00
|
|
|
cannot_pull_multiple_srcs:
|
|
|
|
{
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
GST_INFO_OBJECT (tee, "Cannot activate multiple src pads in pull mode, "
|
|
|
|
"pull-mode set to SINGLE");
|
|
|
|
gst_object_unref (tee);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_tee_push_eos (GstPad * pad, GstTee * tee)
|
|
|
|
{
|
|
|
|
if (pad != tee->pull_pad)
|
|
|
|
gst_pad_push_event (pad, gst_event_new_eos ());
|
|
|
|
gst_object_unref (pad);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_tee_pull_eos (GstTee * tee)
|
|
|
|
{
|
|
|
|
GstIterator *iter;
|
|
|
|
|
|
|
|
iter = gst_element_iterate_src_pads (GST_ELEMENT (tee));
|
|
|
|
gst_iterator_foreach (iter, (GFunc) gst_tee_push_eos, tee);
|
|
|
|
gst_iterator_free (iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_tee_src_get_range (GstPad * pad, guint64 offset, guint length,
|
|
|
|
GstBuffer ** buf)
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
tee = GST_TEE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
ret = gst_pad_pull_range (tee->sinkpad, offset, length, buf);
|
|
|
|
|
|
|
|
if (ret == GST_FLOW_OK)
|
|
|
|
ret = gst_tee_handle_buffer (tee, gst_buffer_ref (*buf));
|
|
|
|
else if (ret == GST_FLOW_UNEXPECTED)
|
|
|
|
gst_tee_pull_eos (tee);
|
|
|
|
|
|
|
|
gst_object_unref (tee);
|
|
|
|
|
|
|
|
return ret;
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|