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>
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
* 2007 Wim Taymans <wim.taymans@gmail.com>
|
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
|
|
|
|
* @see_also: #GstIdentity
|
|
|
|
*
|
2010-08-16 15:01:27 +00:00
|
|
|
* Split data to multiple pads. Branching the data flow is useful when e.g.
|
|
|
|
* capturing a video where the video is shown on the screen and also encoded and
|
|
|
|
* written to a file. Another example is playing music and hooking up a
|
|
|
|
* visualisation module.
|
|
|
|
*
|
|
|
|
* One needs to use separate queue elements (or a multiqueue) in each branch to
|
|
|
|
* provide separate threads for each branch. Otherwise a blocked dataflow in one
|
|
|
|
* branch would stall the other branches.
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Example launch line</title>
|
|
|
|
* |[
|
|
|
|
* gst-launch filesrc location=song.ogg ! decodebin2 ! tee name=t ! queue ! autoaudiosink t. ! queue ! audioconvert ! goom ! ffmpegcolorspace ! autovideosink
|
|
|
|
* ]| Play a song.ogg from local dir and render visualisations using the goom
|
|
|
|
* element.
|
|
|
|
* </refsect2>
|
2006-01-04 12:41:35 +00:00
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
/* lock to protect request pads from being removed while downstream */
|
|
|
|
#define GST_TEE_DYN_LOCK(tee) g_mutex_lock ((tee)->dyn_lock)
|
|
|
|
#define GST_TEE_DYN_UNLOCK(tee) g_mutex_unlock ((tee)->dyn_lock)
|
|
|
|
|
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,
|
2009-04-09 16:27:21 +00:00
|
|
|
PROP_ALLOC_PAD,
|
2001-01-18 23:46:15 +00:00
|
|
|
};
|
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
static GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_REQUEST,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
/* structure and quark to keep track of which pads have been pushed */
|
|
|
|
static GQuark push_data;
|
|
|
|
|
2011-04-18 16:07:06 +00:00
|
|
|
#define _do_init \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element"); \
|
|
|
|
push_data = g_quark_from_static_string ("tee-push-data");
|
|
|
|
#define gst_tee_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstTee, gst_tee, GST_TYPE_ELEMENT, _do_init);
|
|
|
|
|
2010-10-07 17:21:13 +00:00
|
|
|
static GParamSpec *pspec_last_message = NULL;
|
|
|
|
static GParamSpec *pspec_alloc_pad = NULL;
|
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gboolean pushed;
|
|
|
|
GstFlowReturn result;
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
gboolean removed;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
} PushData;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstPad *gst_tee_request_new_pad (GstElement * element,
|
2011-05-10 14:41:36 +00:00
|
|
|
GstPadTemplate * temp, const gchar * unused, const GstCaps * caps);
|
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);
|
2009-12-08 16:21:47 +00:00
|
|
|
static void gst_tee_dispose (GObject * object);
|
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);
|
2009-06-19 17:35:04 +00:00
|
|
|
static GstFlowReturn gst_tee_chain_list (GstPad * pad, GstBufferList * list);
|
2011-06-07 08:04:52 +00:00
|
|
|
static gboolean gst_tee_sink_event (GstPad * pad, GstEvent * event);
|
2009-10-21 20:26:01 +00:00
|
|
|
static gboolean gst_tee_sink_acceptcaps (GstPad * pad, GstCaps * caps);
|
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);
|
2011-05-24 15:36:24 +00:00
|
|
|
static gboolean gst_tee_src_query (GstPad * pad, GstQuery * query);
|
2007-02-09 13:45:27 +00:00
|
|
|
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
|
|
|
|
2009-12-08 16:21:47 +00:00
|
|
|
static void
|
|
|
|
gst_tee_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GList *item;
|
|
|
|
|
|
|
|
restart:
|
|
|
|
for (item = GST_ELEMENT_PADS (object); item; item = g_list_next (item)) {
|
|
|
|
GstPad *pad = GST_PAD (item->data);
|
|
|
|
if (GST_PAD_IS_SRC (pad)) {
|
|
|
|
gst_element_release_request_pad (GST_ELEMENT (object), pad);
|
|
|
|
goto restart;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2004-03-21 03:22:55 +00:00
|
|
|
static void
|
2008-07-29 14:32:51 +00:00
|
|
|
gst_tee_finalize (GObject * object)
|
2004-03-21 03:22:55 +00:00
|
|
|
{
|
2008-07-29 14:32:51 +00:00
|
|
|
GstTee *tee;
|
2004-03-21 03:22:55 +00:00
|
|
|
|
2008-07-29 14:32:51 +00:00
|
|
|
tee = GST_TEE (object);
|
2004-03-21 03:22:55 +00:00
|
|
|
|
2008-07-29 14:32:51 +00:00
|
|
|
g_free (tee->last_message);
|
2004-03-21 03:22:55 +00:00
|
|
|
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
g_mutex_free (tee->dyn_lock);
|
|
|
|
|
2004-03-21 03:22:55 +00:00
|
|
|
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
|
|
|
|
2009-10-28 00:29:30 +00:00
|
|
|
gobject_class->finalize = gst_tee_finalize;
|
|
|
|
gobject_class->set_property = gst_tee_set_property;
|
|
|
|
gobject_class->get_property = gst_tee_get_property;
|
2009-12-08 16:21:47 +00:00
|
|
|
gobject_class->dispose = gst_tee_dispose;
|
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,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
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)",
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_PROP_HAS_SINK_LOOP,
|
|
|
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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",
|
2008-03-22 14:56:17 +00:00
|
|
|
"If the element can operate in push mode", DEFAULT_PROP_HAS_CHAIN,
|
|
|
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-10-07 17:21:13 +00:00
|
|
|
pspec_last_message = g_param_spec_string ("last-message", "Last Message",
|
|
|
|
"The message describing current status", DEFAULT_PROP_LAST_MESSAGE,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LAST_MESSAGE,
|
2010-10-07 17:21:13 +00:00
|
|
|
pspec_last_message);
|
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,
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_PULL_MODE,
|
|
|
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-10-07 17:21:13 +00:00
|
|
|
pspec_alloc_pad = g_param_spec_object ("alloc-pad", "Allocation Src Pad",
|
|
|
|
"The pad used for gst_pad_alloc_buffer", GST_TYPE_PAD,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2009-04-09 16:27:21 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_ALLOC_PAD,
|
2010-10-07 17:21:13 +00:00
|
|
|
pspec_alloc_pad);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2011-04-18 16:07:06 +00:00
|
|
|
gst_element_class_set_details_simple (gstelement_class,
|
|
|
|
"Tee pipe fitting",
|
|
|
|
"Generic",
|
|
|
|
"1-to-N pipe fitting",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>");
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sinktemplate));
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&tee_src_template));
|
|
|
|
|
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
|
2011-04-18 16:07:06 +00:00
|
|
|
gst_tee_init (GstTee * tee)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
tee->dyn_lock = g_mutex_new ();
|
|
|
|
|
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;
|
|
|
|
|
2011-06-07 08:04:52 +00:00
|
|
|
gst_pad_set_event_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_sink_event));
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_getcaps_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
2009-10-21 20:26:01 +00:00
|
|
|
gst_pad_set_acceptcaps_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_sink_acceptcaps));
|
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));
|
2009-06-19 17:35:04 +00:00
|
|
|
gst_pad_set_chain_list_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_chain_list));
|
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
|
|
|
|
2008-07-29 14:32:51 +00:00
|
|
|
tee->last_message = NULL;
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|
|
|
|
|
2010-10-07 17:21:13 +00:00
|
|
|
static void
|
|
|
|
gst_tee_notify_alloc_pad (GstTee * tee)
|
|
|
|
{
|
|
|
|
#if !GLIB_CHECK_VERSION(2,26,0)
|
|
|
|
g_object_notify ((GObject *) tee, "alloc-pad");
|
|
|
|
#else
|
|
|
|
g_object_notify_by_pspec ((GObject *) tee, pspec_alloc_pad);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-05-24 14:13:22 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
forward_sticky_events (GstPad * pad, GstEvent * event, gpointer user_data)
|
|
|
|
{
|
|
|
|
GstPad *srcpad = GST_PAD_CAST (user_data);
|
|
|
|
|
|
|
|
gst_pad_push_event (srcpad, gst_event_ref (event));
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstPad *
|
|
|
|
gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
2011-05-10 14:41:36 +00:00
|
|
|
const gchar * unused, const GstCaps * caps)
|
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;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
PushData *data;
|
2001-01-18 23:46:15 +00:00
|
|
|
|
|
|
|
tee = GST_TEE (element);
|
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
GST_DEBUG_OBJECT (tee, "requesting pad");
|
|
|
|
|
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
|
|
|
mode = tee->sink_mode;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
|
|
|
/* install the data, we automatically free it when the pad is disposed because
|
|
|
|
* of _release_pad or when the element goes away. */
|
|
|
|
data = g_new0 (PushData, 1);
|
|
|
|
data->pushed = FALSE;
|
|
|
|
data->result = GST_FLOW_NOT_LINKED;
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
data->removed = FALSE;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
g_object_set_qdata_full (G_OBJECT (srcpad), push_data, data, g_free);
|
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
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_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));
|
2011-05-24 15:36:24 +00:00
|
|
|
gst_pad_set_query_function (srcpad, GST_DEBUG_FUNCPTR (gst_tee_src_query));
|
2007-02-09 13:45:27 +00:00
|
|
|
gst_pad_set_getrange_function (srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_src_get_range));
|
2011-05-24 14:13:22 +00:00
|
|
|
/* Forward sticky events to the new srcpad */
|
|
|
|
gst_pad_sticky_events_foreach (tee->sinkpad, forward_sticky_events, srcpad);
|
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:
|
|
|
|
{
|
2009-12-03 14:02:35 +00:00
|
|
|
gboolean changed = FALSE;
|
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
GST_DEBUG_OBJECT (tee, "warning failed to activate request pad");
|
2009-12-03 14:02:35 +00:00
|
|
|
if (tee->allocpad == srcpad) {
|
2006-10-11 16:30:14 +00:00
|
|
|
tee->allocpad = NULL;
|
2009-12-03 14:02:35 +00:00
|
|
|
changed = TRUE;
|
|
|
|
}
|
2008-08-07 07:01:15 +00:00
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2009-12-03 14:02:35 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
if (changed) {
|
2010-10-07 17:21:13 +00:00
|
|
|
gst_tee_notify_alloc_pad (tee);
|
2009-12-03 14:02:35 +00:00
|
|
|
}
|
2006-10-11 16:30:14 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_tee_release_pad (GstElement * element, GstPad * pad)
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
PushData *data;
|
2009-12-03 14:02:35 +00:00
|
|
|
gboolean changed = FALSE;
|
2006-10-11 16:30:14 +00:00
|
|
|
|
|
|
|
tee = GST_TEE (element);
|
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
GST_DEBUG_OBJECT (tee, "releasing pad");
|
|
|
|
|
2010-01-11 10:38:32 +00:00
|
|
|
/* wait for pending pad_alloc to finish */
|
|
|
|
GST_TEE_DYN_LOCK (tee);
|
|
|
|
data = g_object_get_qdata (G_OBJECT (pad), push_data);
|
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
2010-01-11 10:38:32 +00:00
|
|
|
/* mark the pad as removed so that future pad_alloc fails with NOT_LINKED. */
|
|
|
|
data->removed = TRUE;
|
2009-12-03 14:02:35 +00:00
|
|
|
if (tee->allocpad == pad) {
|
2006-10-11 16:30:14 +00:00
|
|
|
tee->allocpad = NULL;
|
2009-12-03 14:02:35 +00:00
|
|
|
changed = TRUE;
|
|
|
|
}
|
2006-10-11 16:30:14 +00:00
|
|
|
GST_OBJECT_UNLOCK (tee);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
2011-05-27 12:00:56 +00:00
|
|
|
gst_object_ref (pad);
|
2006-10-11 16:30:14 +00:00
|
|
|
gst_element_remove_pad (GST_ELEMENT_CAST (tee), pad);
|
2011-05-27 12:00:56 +00:00
|
|
|
|
|
|
|
gst_pad_set_active (pad, FALSE);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
GST_TEE_DYN_UNLOCK (tee);
|
2010-01-11 10:38:32 +00:00
|
|
|
|
2011-05-27 12:00:56 +00:00
|
|
|
gst_object_unref (pad);
|
|
|
|
|
2010-01-11 10:38:32 +00:00
|
|
|
if (changed) {
|
2010-10-07 17:21:13 +00:00
|
|
|
gst_tee_notify_alloc_pad (tee);
|
2010-01-11 10:38:32 +00:00
|
|
|
}
|
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;
|
2009-04-09 16:27:21 +00:00
|
|
|
case PROP_ALLOC_PAD:
|
|
|
|
{
|
|
|
|
GstPad *pad = g_value_get_object (value);
|
|
|
|
GST_OBJECT_LOCK (pad);
|
|
|
|
if (GST_OBJECT_PARENT (pad) == GST_OBJECT_CAST (object))
|
|
|
|
tee->allocpad = pad;
|
|
|
|
else
|
|
|
|
GST_WARNING_OBJECT (object, "Tried to set alloc pad %s which"
|
|
|
|
" is not my pad", GST_OBJECT_NAME (pad));
|
|
|
|
GST_OBJECT_UNLOCK (pad);
|
|
|
|
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;
|
2009-04-09 16:27:21 +00:00
|
|
|
case PROP_ALLOC_PAD:
|
|
|
|
g_value_set_object (value, tee->allocpad);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-06-07 08:04:52 +00:00
|
|
|
static gboolean
|
|
|
|
gst_tee_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
default:
|
|
|
|
res = gst_pad_event_default (pad, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2009-10-21 20:26:01 +00:00
|
|
|
/* on the sink we accept caps that are acceptable to all srcpads */
|
|
|
|
static gboolean
|
|
|
|
gst_tee_sink_acceptcaps (GstPad * pad, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
gboolean res, done;
|
|
|
|
GstIterator *it;
|
2011-03-17 10:32:11 +00:00
|
|
|
GValue item = { 0, };
|
2009-10-21 20:26:01 +00:00
|
|
|
|
2009-11-18 08:01:35 +00:00
|
|
|
tee = GST_TEE_CAST (GST_PAD_PARENT (pad));
|
2009-10-21 20:26:01 +00:00
|
|
|
|
|
|
|
it = gst_element_iterate_src_pads (GST_ELEMENT_CAST (tee));
|
|
|
|
|
|
|
|
res = TRUE;
|
|
|
|
done = FALSE;
|
|
|
|
while (!done && res) {
|
|
|
|
switch (gst_iterator_next (it, &item)) {
|
|
|
|
case GST_ITERATOR_OK:
|
2011-03-17 10:32:11 +00:00
|
|
|
res &= gst_pad_peer_accept_caps (g_value_get_object (&item), caps);
|
|
|
|
g_value_reset (&item);
|
2009-10-21 20:26:01 +00:00
|
|
|
break;
|
|
|
|
case GST_ITERATOR_RESYNC:
|
|
|
|
res = TRUE;
|
|
|
|
gst_iterator_resync (it);
|
|
|
|
break;
|
|
|
|
case GST_ITERATOR_ERROR:
|
|
|
|
res = FALSE;
|
|
|
|
done = TRUE;
|
|
|
|
break;
|
|
|
|
case GST_ITERATOR_DONE:
|
|
|
|
done = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-03-17 10:32:11 +00:00
|
|
|
g_value_unset (&item);
|
2009-10-21 20:26:01 +00:00
|
|
|
gst_iterator_free (it);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2009-12-03 14:11:59 +00:00
|
|
|
static void
|
|
|
|
gst_tee_do_message (GstTee * tee, GstPad * pad, gpointer data, gboolean is_list)
|
|
|
|
{
|
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
g_free (tee->last_message);
|
|
|
|
if (is_list) {
|
|
|
|
tee->last_message =
|
|
|
|
g_strdup_printf ("chain-list ******* (%s:%s)t %p",
|
|
|
|
GST_DEBUG_PAD_NAME (pad), data);
|
|
|
|
} else {
|
|
|
|
tee->last_message =
|
2011-03-21 17:13:55 +00:00
|
|
|
g_strdup_printf ("chain ******* (%s:%s)t (%" G_GSIZE_FORMAT
|
|
|
|
" bytes, %" G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (pad),
|
|
|
|
gst_buffer_get_size (data), GST_BUFFER_TIMESTAMP (data), data);
|
2009-12-03 14:11:59 +00:00
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2010-10-07 17:21:13 +00:00
|
|
|
|
|
|
|
#if !GLIB_CHECK_VERSION(2,26,0)
|
2010-10-07 17:46:26 +00:00
|
|
|
g_object_notify ((GObject *) tee, "last-message");
|
2010-10-07 17:21:13 +00:00
|
|
|
#else
|
|
|
|
g_object_notify_by_pspec ((GObject *) tee, pspec_last_message);
|
|
|
|
#endif
|
2009-12-03 14:11:59 +00:00
|
|
|
}
|
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
static GstFlowReturn
|
2009-06-19 17:35:04 +00:00
|
|
|
gst_tee_do_push (GstTee * tee, GstPad * pad, gpointer data, gboolean is_list)
|
2005-03-21 17:34:02 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
|
|
|
|
2006-01-26 12:40:17 +00:00
|
|
|
/* Push */
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
if (pad == tee->pull_pad) {
|
|
|
|
/* don't push on the pad we're pulling from */
|
2007-02-09 13:45:27 +00:00
|
|
|
res = GST_FLOW_OK;
|
2009-06-19 17:35:04 +00:00
|
|
|
} else if (is_list) {
|
|
|
|
res =
|
|
|
|
gst_pad_push_list (pad,
|
|
|
|
gst_buffer_list_ref (GST_BUFFER_LIST_CAST (data)));
|
2007-02-09 13:45:27 +00:00
|
|
|
} else {
|
2009-06-19 17:35:04 +00:00
|
|
|
res = gst_pad_push (pad, gst_buffer_ref (GST_BUFFER_CAST (data)));
|
2007-02-09 13:45:27 +00:00
|
|
|
}
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
return res;
|
|
|
|
}
|
2006-01-27 16:59:57 +00:00
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
static void
|
|
|
|
clear_pads (GstPad * pad, GstTee * tee)
|
|
|
|
{
|
|
|
|
PushData *data;
|
|
|
|
|
2009-11-18 08:01:35 +00:00
|
|
|
data = g_object_get_qdata ((GObject *) pad, push_data);
|
2005-10-04 18:46:09 +00:00
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
/* the data must be there or we have a screwed up internal state */
|
|
|
|
g_assert (data != NULL);
|
2005-09-27 15:37:40 +00:00
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
data->pushed = FALSE;
|
|
|
|
data->result = GST_FLOW_NOT_LINKED;
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2009-06-19 17:35:04 +00:00
|
|
|
gst_tee_handle_data (GstTee * tee, gpointer data, gboolean is_list)
|
2005-03-21 17:34:02 +00:00
|
|
|
{
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
GList *pads;
|
|
|
|
guint32 cookie;
|
|
|
|
GstFlowReturn ret, cret;
|
2005-03-21 17:34:02 +00:00
|
|
|
|
2009-12-03 14:11:59 +00:00
|
|
|
if (G_UNLIKELY (!tee->silent))
|
|
|
|
gst_tee_do_message (tee, tee->sinkpad, data, is_list);
|
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
2009-12-03 14:44:28 +00:00
|
|
|
pads = GST_ELEMENT_CAST (tee)->srcpads;
|
|
|
|
|
2009-12-22 20:29:26 +00:00
|
|
|
/* special case for zero pads */
|
2009-12-22 21:52:02 +00:00
|
|
|
if (G_UNLIKELY (!pads))
|
|
|
|
goto no_pads;
|
2009-12-22 20:29:26 +00:00
|
|
|
|
2009-12-03 14:44:28 +00:00
|
|
|
/* special case for just one pad that avoids reffing the buffer */
|
|
|
|
if (!pads->next) {
|
|
|
|
GstPad *pad = GST_PAD_CAST (pads->data);
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2009-12-22 21:52:02 +00:00
|
|
|
|
2009-12-03 14:44:28 +00:00
|
|
|
if (pad == tee->pull_pad) {
|
|
|
|
ret = GST_FLOW_OK;
|
2009-12-22 21:52:02 +00:00
|
|
|
} else if (is_list) {
|
2009-12-03 14:44:28 +00:00
|
|
|
ret = gst_pad_push_list (pad, GST_BUFFER_LIST_CAST (data));
|
2009-12-22 21:52:02 +00:00
|
|
|
} else {
|
|
|
|
ret = gst_pad_push (pad, GST_BUFFER_CAST (data));
|
2009-12-03 14:44:28 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2009-12-03 14:11:59 +00:00
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
/* mark all pads as 'not pushed on yet' */
|
2009-12-03 14:44:28 +00:00
|
|
|
g_list_foreach (pads, (GFunc) clear_pads, tee);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
|
|
|
restart:
|
|
|
|
cret = GST_FLOW_NOT_LINKED;
|
|
|
|
pads = GST_ELEMENT_CAST (tee)->srcpads;
|
|
|
|
cookie = GST_ELEMENT_CAST (tee)->pads_cookie;
|
|
|
|
|
|
|
|
while (pads) {
|
|
|
|
GstPad *pad;
|
2009-06-19 17:35:04 +00:00
|
|
|
PushData *pdata;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
|
|
|
pad = GST_PAD_CAST (pads->data);
|
|
|
|
|
|
|
|
/* get the private data, something is really wrong with the internal state
|
|
|
|
* when it is not there */
|
2009-11-18 08:01:35 +00:00
|
|
|
pdata = g_object_get_qdata ((GObject *) pad, push_data);
|
2009-06-19 17:35:04 +00:00
|
|
|
g_assert (pdata != NULL);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
2009-12-22 21:52:02 +00:00
|
|
|
if (G_LIKELY (!pdata->pushed)) {
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
/* not yet pushed, release lock and start pushing */
|
|
|
|
gst_object_ref (pad);
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
|
|
|
|
2009-06-19 17:35:04 +00:00
|
|
|
GST_LOG_OBJECT (tee, "Starting to push %s %p",
|
|
|
|
is_list ? "list" : "buffer", data);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
2009-06-19 17:35:04 +00:00
|
|
|
ret = gst_tee_do_push (tee, pad, data, is_list);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
2009-06-19 17:35:04 +00:00
|
|
|
GST_LOG_OBJECT (tee, "Pushing item %p yielded result %s", data,
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
gst_flow_get_name (ret));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
/* keep track of which pad we pushed and the result value. We need to do
|
|
|
|
* this before we release the refcount on the pad, the PushData is
|
|
|
|
* destroyed when the last ref of the pad goes away. */
|
2009-06-19 17:35:04 +00:00
|
|
|
pdata->pushed = TRUE;
|
|
|
|
pdata->result = ret;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
gst_object_unref (pad);
|
|
|
|
} else {
|
|
|
|
/* already pushed, use previous return value */
|
2009-06-19 17:35:04 +00:00
|
|
|
ret = pdata->result;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
GST_LOG_OBJECT (tee, "pad already pushed with %s",
|
|
|
|
gst_flow_get_name (ret));
|
|
|
|
}
|
2008-12-08 22:28:05 +00:00
|
|
|
|
|
|
|
/* before we go combining the return value, check if the pad list is still
|
|
|
|
* the same. It could be possible that the pad we just pushed was removed
|
|
|
|
* and the return value it not valid anymore */
|
2009-12-22 21:52:02 +00:00
|
|
|
if (G_UNLIKELY (GST_ELEMENT_CAST (tee)->pads_cookie != cookie)) {
|
2008-12-08 22:28:05 +00:00
|
|
|
GST_LOG_OBJECT (tee, "pad list changed");
|
|
|
|
/* the list of pads changed, restart iteration. Pads that we already
|
|
|
|
* pushed on and are still in the new list, will not be pushed on
|
|
|
|
* again. */
|
|
|
|
goto restart;
|
|
|
|
}
|
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
/* stop pushing more buffers when we have a fatal error */
|
2009-12-22 21:52:02 +00:00
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED))
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
goto error;
|
|
|
|
|
2008-10-14 12:34:56 +00:00
|
|
|
/* keep all other return values, overwriting the previous one. */
|
2009-12-22 21:52:02 +00:00
|
|
|
if (G_LIKELY (ret != GST_FLOW_NOT_LINKED)) {
|
2008-10-14 12:34:56 +00:00
|
|
|
GST_LOG_OBJECT (tee, "Replacing ret val %d with %d", cret, ret);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
cret = ret;
|
2008-10-14 12:34:56 +00:00
|
|
|
}
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
pads = g_list_next (pads);
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2006-01-27 16:59:57 +00:00
|
|
|
|
2009-06-19 17:35:04 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
2005-03-21 17:34:02 +00:00
|
|
|
|
|
|
|
/* no need to unset gvalue */
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
return cret;
|
|
|
|
|
|
|
|
/* ERRORS */
|
2009-12-22 21:52:02 +00:00
|
|
|
no_pads:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (tee, "there are no pads, return not-linked");
|
|
|
|
ret = GST_FLOW_NOT_LINKED;
|
|
|
|
goto error;
|
|
|
|
}
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
error:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (tee, "received error %s", gst_flow_get_name (ret));
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2009-12-22 21:52:02 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_tee_chain (GstPad * pad, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
|
|
|
GstTee *tee;
|
|
|
|
|
2009-11-18 08:01:35 +00:00
|
|
|
tee = GST_TEE_CAST (GST_OBJECT_PARENT (pad));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2008-07-29 14:32:51 +00:00
|
|
|
GST_DEBUG_OBJECT (tee, "received buffer %p", buffer);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
2009-06-19 17:35:04 +00:00
|
|
|
res = gst_tee_handle_data (tee, buffer, FALSE);
|
2001-12-25 02:15:46 +00:00
|
|
|
|
2008-07-29 14:32:51 +00:00
|
|
|
GST_DEBUG_OBJECT (tee, "handled buffer %s", gst_flow_get_name (res));
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +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
|
|
|
|
2009-06-19 17:35:04 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_tee_chain_list (GstPad * pad, GstBufferList * list)
|
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
|
|
|
GstTee *tee;
|
|
|
|
|
2009-11-18 08:01:35 +00:00
|
|
|
tee = GST_TEE_CAST (gst_pad_get_parent (pad));
|
2009-06-19 17:35:04 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (tee, "received list %p", list);
|
|
|
|
|
|
|
|
res = gst_tee_handle_data (tee, list, TRUE);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (tee, "handled list %s", gst_flow_get_name (res));
|
|
|
|
|
|
|
|
gst_object_unref (tee);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
2011-06-22 15:12:34 +00:00
|
|
|
tee->sink_mode = active & GST_ACTIVATE_PULL;
|
2007-02-09 13:45:27 +00:00
|
|
|
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
|
2011-05-24 15:36:24 +00:00
|
|
|
gst_tee_src_query (GstPad * pad, GstQuery * query)
|
2007-02-09 13:45:27 +00:00
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
gboolean res;
|
|
|
|
GstPad *sinkpad;
|
|
|
|
|
|
|
|
tee = GST_TEE (gst_pad_get_parent (pad));
|
|
|
|
|
2011-05-24 15:36:24 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_SCHEDULING:
|
|
|
|
{
|
|
|
|
gboolean pull_mode;
|
2007-02-09 13:45:27 +00:00
|
|
|
|
2011-05-24 15:36:24 +00:00
|
|
|
GST_OBJECT_LOCK (tee);
|
|
|
|
pull_mode = TRUE;
|
|
|
|
if (tee->pull_mode == GST_TEE_PULL_MODE_NEVER) {
|
|
|
|
GST_INFO_OBJECT (tee, "Cannot activate in pull mode, pull-mode "
|
|
|
|
"set to NEVER");
|
|
|
|
pull_mode = FALSE;
|
|
|
|
} else if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE && tee->pull_pad) {
|
|
|
|
GST_INFO_OBJECT (tee, "Cannot activate multiple src pads in pull mode, "
|
|
|
|
"pull-mode set to SINGLE");
|
|
|
|
pull_mode = FALSE;
|
|
|
|
}
|
2007-02-09 13:45:27 +00:00
|
|
|
|
2011-05-24 15:36:24 +00:00
|
|
|
sinkpad = gst_object_ref (tee->sinkpad);
|
|
|
|
GST_OBJECT_UNLOCK (tee);
|
2007-02-09 13:45:27 +00:00
|
|
|
|
2011-05-24 15:36:24 +00:00
|
|
|
if (pull_mode) {
|
|
|
|
/* ask peer if we can operate in pull mode */
|
|
|
|
res = gst_pad_peer_query (sinkpad, query);
|
|
|
|
} else {
|
|
|
|
res = TRUE;
|
|
|
|
}
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_query_default (pad, query);
|
|
|
|
break;
|
|
|
|
}
|
2007-02-09 13:45:27 +00:00
|
|
|
|
|
|
|
gst_object_unref (tee);
|
|
|
|
|
2006-10-11 16:30:14 +00:00
|
|
|
return res;
|
2007-02-09 13:45:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-03-17 10:32:11 +00:00
|
|
|
gst_tee_push_eos (const GValue * vpad, GstTee * tee)
|
2007-02-09 13:45:27 +00:00
|
|
|
{
|
2011-03-17 10:32:11 +00:00
|
|
|
GstPad *pad = g_value_get_object (vpad);
|
|
|
|
|
2007-02-09 13:45:27 +00:00
|
|
|
if (pad != tee->pull_pad)
|
|
|
|
gst_pad_push_event (pad, gst_event_new_eos ());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_tee_pull_eos (GstTee * tee)
|
|
|
|
{
|
|
|
|
GstIterator *iter;
|
|
|
|
|
|
|
|
iter = gst_element_iterate_src_pads (GST_ELEMENT (tee));
|
2011-03-17 10:32:11 +00:00
|
|
|
gst_iterator_foreach (iter, (GstIteratorForeachFunction) gst_tee_push_eos,
|
|
|
|
tee);
|
2007-02-09 13:45:27 +00:00
|
|
|
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)
|
2009-06-19 17:35:04 +00:00
|
|
|
ret = gst_tee_handle_data (tee, gst_buffer_ref (*buf), FALSE);
|
2007-02-09 13:45:27 +00:00
|
|
|
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
|
|
|
}
|