Commit f2cf753b authored by Andy Wingo Wingo's avatar Andy Wingo Wingo

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.
parent adbd17c3
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 Wim Taymans <wim@fluendo.com>
* gst/gstbin.c: (gst_bin_get_state), (gst_bin_iterate_state_order),
......
......@@ -90,6 +90,39 @@ START_TEST (test_ghost_pads)
fail_unless (gst_element_set_state (b1, GST_STATE_NULL) == GST_STATE_SUCCESS);
gst_object_unref (GST_OBJECT (b1));
/* unreffing the bin will unref all elements, which will unlink and unparent
* all pads */
/* FIXME: ghost pads need to drop their internal pad in the unlink function,
* but can't right now. So internal pads have a ref from their parent, and the
* internal pads' targets have refs from the internals. When we do the last
* unref on the ghost pads, these refs should go away.
*/
assert_gstrefcount (fsrc, 2); /* gisrc */
assert_gstrefcount (gsink, 1);
assert_gstrefcount (gsrc, 1);
assert_gstrefcount (fsink, 2); /* gisink */
assert_gstrefcount (gisrc, 2); /* gsink -- fixme drop ref in unlink */
assert_gstrefcount (isink, 2); /* gsink */
assert_gstrefcount (gisink, 2); /* gsrc -- fixme drop ref in unlink */
assert_gstrefcount (isrc, 2); /* gsrc */
/* while the fixme isn't fixed, check cleanup */
gst_object_unref (GST_OBJECT (gsink));
assert_gstrefcount (isink, 1);
assert_gstrefcount (gisrc, 1);
assert_gstrefcount (fsrc, 2); /* gisrc */
gst_object_unref (GST_OBJECT (gisrc));
assert_gstrefcount (fsrc, 1);
gst_object_unref (GST_OBJECT (gsrc));
assert_gstrefcount (isrc, 1);
assert_gstrefcount (gisink, 1);
assert_gstrefcount (fsink, 2); /* gisrc */
gst_object_unref (GST_OBJECT (gisink));
assert_gstrefcount (fsink, 1);
}
END_TEST Suite * gst_ghost_pad_suite (void)
{
......
......@@ -99,8 +99,68 @@ START_TEST (test_2_elements)
ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN)); */
}
END_TEST Suite *
simple_launch_lines_suite (void)
END_TEST static void
got_handoff (GstElement * sink, GstBuffer * buf, GstPad * pad, gpointer unused)
{
gst_element_post_message
(sink, gst_message_new_application (gst_structure_new ("foo", NULL)));
}
static void
assert_live_count (GType type, gint live)
{
GstAllocTrace *trace;
const gchar *name;
if (gst_alloc_trace_available ()) {
name = g_type_name (type);
g_assert (name);
trace = gst_alloc_trace_get (name);
if (trace) {
g_return_if_fail (trace->live == live);
}
} else {
g_print ("\nSkipping live count tests; recompile with traces to enable\n");
}
}
START_TEST (test_stop_from_app)
{
GstElement *fakesrc, *fakesink, *pipeline;
GstBus *bus;
GstMessageType revent;
assert_live_count (GST_TYPE_BUFFER, 0);
fakesrc = gst_element_factory_make ("fakesrc", NULL);
fakesink = gst_element_factory_make ("fakesink", NULL);
pipeline = gst_element_factory_make ("pipeline", NULL);
g_return_if_fail (fakesrc && fakesink && pipeline);
gst_element_link (fakesrc, fakesink);
gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL);
g_object_set (fakesink, "signal-handoffs", (gboolean) TRUE, NULL);
g_signal_connect (fakesink, "handoff", G_CALLBACK (got_handoff), NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
bus = gst_element_get_bus (pipeline);
g_assert (bus);
/* will time out after half a second */
revent = gst_bus_poll (bus, GST_MESSAGE_APPLICATION, GST_SECOND / 2);
g_return_if_fail (revent == GST_MESSAGE_APPLICATION);
gst_message_unref (gst_bus_pop (bus));
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
assert_live_count (GST_TYPE_BUFFER, 0);
}
END_TEST Suite * simple_launch_lines_suite (void)
{
Suite *s = suite_create ("Pipelines");
TCase *tc_chain = tcase_create ("linear");
......@@ -110,6 +170,7 @@ simple_launch_lines_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_2_elements);
tcase_add_test (tc_chain, test_stop_from_app);
return s;
}
......
......@@ -63,6 +63,11 @@ GstFakeSrc
</para>
<!-- ##### ARG GstFakeSrc:is-live ##### -->
<para>
</para>
<!-- ##### ARG GstFakeSrc:last-message ##### -->
<para>
......
......@@ -75,6 +75,8 @@ Last reviewed on December 13th, 2002 (0.5.0.1)
@acceptcapsfunc:
@fixatecapsfunc:
@activatefunc:
@activatepushfunc:
@activatepullfunc:
@linkfunc:
@unlinkfunc:
@peer:
......@@ -444,10 +446,10 @@ Checks if the pad is a sink pad.
</para>
@pad:
@mode:
@active:
@Returns:
<!-- # Unused Parameters # -->
@active:
@mode:
<!-- ##### FUNCTION gst_pad_is_active ##### -->
......
......@@ -100,7 +100,8 @@ static GstElementStateReturn gst_basesink_change_state (GstElement * element);
static GstFlowReturn gst_basesink_chain (GstPad * pad, GstBuffer * buffer);
static void gst_basesink_loop (GstPad * pad);
static GstFlowReturn gst_basesink_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_basesink_activate (GstPad * pad, GstActivateMode mode);
static gboolean gst_basesink_activate_push (GstPad * pad, gboolean active);
static gboolean gst_basesink_activate_pull (GstPad * pad, gboolean active);
static gboolean gst_basesink_event (GstPad * pad, GstEvent * event);
static inline GstFlowReturn gst_basesink_handle_buffer (GstBaseSink * basesink,
GstBuffer * buf);
......@@ -256,8 +257,10 @@ gst_basesink_finalize (GObject * object)
static void
gst_basesink_set_pad_functions (GstBaseSink * this, GstPad * pad)
{
gst_pad_set_activate_function (pad,
GST_DEBUG_FUNCPTR (gst_basesink_activate));
gst_pad_set_activatepush_function (pad,
GST_DEBUG_FUNCPTR (gst_basesink_activate_push));
gst_pad_set_activatepull_function (pad,
GST_DEBUG_FUNCPTR (gst_basesink_activate_pull));
gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_basesink_event));
if (this->has_chain)
......@@ -824,51 +827,72 @@ paused:
}
static gboolean
gst_basesink_activate (GstPad * pad, GstActivateMode mode)
gst_basesink_deactivate (GstBaseSink * basesink, GstPad * pad)
{
gboolean result = FALSE;
GstBaseSink *basesink;
GstBaseSinkClass *bclass;
basesink = GST_BASESINK (GST_OBJECT_PARENT (pad));
bclass = GST_BASESINK_GET_CLASS (basesink);
switch (mode) {
case GST_ACTIVATE_PUSH:
g_return_val_if_fail (basesink->has_chain, FALSE);
result = TRUE;
break;
case GST_ACTIVATE_PULL:
/* if we have a scheduler we can start the task */
g_return_val_if_fail (basesink->has_loop, FALSE);
gst_pad_peer_set_active (pad, mode);
result =
gst_pad_start_task (pad, (GstTaskFunction) gst_basesink_loop, pad);
break;
case GST_ACTIVATE_NONE:
/* step 1, unblock clock sync (if any) or any other blocking thing */
GST_PREROLL_LOCK (pad);
GST_LOCK (basesink);
if (basesink->clock_id) {
gst_clock_id_unschedule (basesink->clock_id);
}
GST_UNLOCK (basesink);
/* step 1, unblock clock sync (if any) or any other blocking thing */
GST_PREROLL_LOCK (pad);
GST_LOCK (basesink);
if (basesink->clock_id) {
gst_clock_id_unschedule (basesink->clock_id);
}
GST_UNLOCK (basesink);
/* unlock any subclasses */
if (bclass->unlock)
bclass->unlock (basesink);
/* unlock any subclasses */
if (bclass->unlock)
bclass->unlock (basesink);
/* flush out the data thread if it's locked in finish_preroll */
gst_basesink_preroll_queue_flush (basesink);
basesink->need_preroll = FALSE;
GST_PREROLL_SIGNAL (pad);
GST_PREROLL_UNLOCK (pad);
/* flush out the data thread if it's locked in finish_preroll */
gst_basesink_preroll_queue_flush (basesink);
basesink->need_preroll = FALSE;
GST_PREROLL_SIGNAL (pad);
GST_PREROLL_UNLOCK (pad);
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
break;
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
return result;
}
static gboolean
gst_basesink_activate_push (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstBaseSink *basesink;
basesink = GST_BASESINK (GST_OBJECT_PARENT (pad));
if (active) {
g_return_val_if_fail (basesink->has_chain, FALSE);
result = TRUE;
} else {
result = gst_basesink_deactivate (basesink, pad);
}
basesink->pad_mode = GST_ACTIVATE_PUSH;
return result;
}
/* this won't get called until we implement an activate function */
static gboolean
gst_basesink_activate_pull (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstBaseSink *basesink;
basesink = GST_BASESINK (GST_OBJECT_PARENT (pad));
if (active) {
/* if we have a scheduler we can start the task */
g_return_val_if_fail (basesink->has_loop, FALSE);
result = gst_pad_start_task (pad, (GstTaskFunction) gst_basesink_loop, pad);
} else {
result = gst_basesink_deactivate (basesink, pad);
}
basesink->pad_mode = mode;
return result;
}
......
......@@ -82,7 +82,8 @@ gst_basesrc_get_type (void)
return basesrc_type;
}
static gboolean gst_basesrc_activate (GstPad * pad, GstActivateMode mode);
static gboolean gst_basesrc_activate_push (GstPad * pad, gboolean active);
static gboolean gst_basesrc_activate_pull (GstPad * pad, gboolean active);
static void gst_basesrc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_basesrc_get_property (GObject * object, guint prop_id,
......@@ -158,7 +159,8 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class)
pad = gst_pad_new_from_template (pad_template, "src");
gst_pad_set_activate_function (pad, gst_basesrc_activate);
gst_pad_set_activatepush_function (pad, gst_basesrc_activate_push);
gst_pad_set_activatepull_function (pad, gst_basesrc_activate_pull);
gst_pad_set_event_function (pad, gst_basesrc_event_handler);
gst_pad_set_query_function (pad, gst_basesrc_query);
......@@ -729,54 +731,70 @@ gst_basesrc_stop (GstBaseSrc * basesrc)
}
static gboolean
gst_basesrc_activate (GstPad * pad, GstActivateMode mode)
gst_basesrc_deactivate (GstBaseSrc * basesrc, GstPad * pad)
{
gboolean result;
GST_LIVE_LOCK (basesrc);
basesrc->live_running = TRUE;
GST_LIVE_SIGNAL (basesrc);
GST_LIVE_UNLOCK (basesrc);
/* step 1, unblock clock sync (if any) */
gst_basesrc_unlock (basesrc);
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
return result;
}
static gboolean
gst_basesrc_activate_push (GstPad * pad, gboolean active)
{
GstBaseSrc *basesrc;
basesrc = GST_BASESRC (GST_OBJECT_PARENT (pad));
/* prepare subclass first */
switch (mode) {
case GST_ACTIVATE_PUSH:
case GST_ACTIVATE_PULL:
result = gst_basesrc_start (basesrc);
break;
default:
result = TRUE;
break;
if (active) {
if (!gst_basesrc_start (basesrc))
goto error_start;
return gst_pad_start_task (pad, (GstTaskFunction) gst_basesrc_loop, pad);
} else {
return gst_basesrc_deactivate (basesrc, pad);
}
/* if that failed we can stop here */
if (!result)
goto error_start;
result = FALSE;
switch (mode) {
case GST_ACTIVATE_PUSH:
result =
gst_pad_start_task (pad, (GstTaskFunction) gst_basesrc_loop, pad);
break;
case GST_ACTIVATE_PULL:
result = basesrc->seekable;
if (!result)
gst_basesrc_stop (basesrc);
break;
case GST_ACTIVATE_NONE:
GST_LIVE_LOCK (basesrc);
basesrc->live_running = TRUE;
GST_LIVE_SIGNAL (basesrc);
GST_LIVE_UNLOCK (basesrc);
error_start:
{
GST_DEBUG_OBJECT (basesrc, "failed to start");
return FALSE;
}
}
/* step 1, unblock clock sync (if any) */
gst_basesrc_unlock (basesrc);
static gboolean
gst_basesrc_activate_pull (GstPad * pad, gboolean active)
{
GstBaseSrc *basesrc;
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
break;
basesrc = GST_BASESRC (GST_OBJECT_PARENT (pad));
/* prepare subclass first */
if (active) {
if (!gst_basesrc_start (basesrc))
goto error_start;
if (!basesrc->seekable) {
gst_basesrc_stop (basesrc);
return FALSE;
}
return TRUE;
} else {
return gst_basesrc_deactivate (basesrc, pad);
}
return result;
/* ERROR */
error_start:
{
GST_DEBUG_OBJECT (basesrc, "failed to start");
......
......@@ -84,10 +84,10 @@ static void gst_base_transform_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_base_transform_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_base_transform_src_activate (GstPad * pad,
GstActivateMode mode);
static gboolean gst_base_transform_sink_activate (GstPad * pad,
GstActivateMode mode);
static gboolean gst_base_transform_src_activate_pull (GstPad * pad,
gboolean active);
static gboolean gst_base_transform_sink_activate_push (GstPad * pad,
gboolean active);
static GstElementStateReturn gst_base_transform_change_state (GstElement *
element);
......@@ -157,8 +157,8 @@ gst_base_transform_init (GstBaseTransform * trans, gpointer g_class)
GST_DEBUG_FUNCPTR (gst_base_transform_event));
gst_pad_set_chain_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_chain));
gst_pad_set_activate_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_sink_activate));
gst_pad_set_activatepush_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_sink_activate_push));
gst_element_add_pad (GST_ELEMENT (trans), trans->sinkpad);
pad_template =
......@@ -169,8 +169,8 @@ gst_base_transform_init (GstBaseTransform * trans, gpointer g_class)
GST_DEBUG_FUNCPTR (gst_base_transform_proxy_getcaps));
gst_pad_set_getrange_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_getrange));
gst_pad_set_activate_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_src_activate));
gst_pad_set_activatepull_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_src_activate_pull));
gst_element_add_pad (GST_ELEMENT (trans), trans->srcpad);
}
......@@ -344,7 +344,7 @@ gst_base_transform_get_property (GObject * object, guint prop_id,
}
static gboolean
gst_base_transform_sink_activate (GstPad * pad, GstActivateMode mode)
gst_base_transform_sink_activate_push (GstPad * pad, gboolean active)
{
gboolean result = TRUE;
GstBaseTransform *trans;
......@@ -353,39 +353,31 @@ gst_base_transform_sink_activate (GstPad * pad, GstActivateMode mode)
trans = GST_BASE_TRANSFORM (GST_OBJECT_PARENT (pad));
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
switch (mode) {
case GST_ACTIVATE_PUSH:
case GST_ACTIVATE_PULL:
if (bclass->start)
result = bclass->start (trans);
break;
case GST_ACTIVATE_NONE:
break;
if (active) {
if (bclass->start)
result = bclass->start (trans);
}
return result;
}
static gboolean
gst_base_transform_src_activate (GstPad * pad, GstActivateMode mode)
gst_base_transform_src_activate_pull (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstBaseTransform *trans;
GstBaseTransformClass *bclass;
trans = GST_BASE_TRANSFORM (GST_OBJECT_PARENT (pad));
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
switch (mode) {
case GST_ACTIVATE_PUSH:
result = TRUE;
break;
case GST_ACTIVATE_PULL:
result = gst_pad_set_active (trans->sinkpad, mode);
result = gst_pad_peer_set_active (trans->sinkpad, mode);
break;
case GST_ACTIVATE_NONE:
result = TRUE;
break;
result = gst_pad_activate_pull (trans->sinkpad, active);
if (active) {
if (result && bclass->start)
result &= bclass->start (trans);
}
return result;
}
......
......@@ -130,5 +130,8 @@ gst_type_find_helper (GstPad * src, guint64 size)
if (find.best_probability > 0)
result = find.caps;
if (find.buffer)
gst_buffer_unref (find.buffer);
return result;
}
......@@ -75,7 +75,8 @@ static void gst_tee_get_property (GObject * object, guint prop_id,
static GstFlowReturn gst_tee_chain (GstPad * pad, GstBuffer * buffer);
static void gst_tee_loop (GstPad * pad);
static gboolean gst_tee_sink_activate (GstPad * pad, GstActivateMode mode);
static gboolean gst_tee_sink_activate_push (GstPad * pad, gboolean active);
static gboolean gst_tee_sink_activate_pull (GstPad * pad, gboolean active);
static void
......@@ -153,8 +154,10 @@ gst_tee_init (GstTee * tee)
static void
gst_tee_update_pad_functions (GstTee * tee)
{
gst_pad_set_activate_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_tee_sink_activate));
gst_pad_set_activatepush_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_tee_sink_activate_push));
gst_pad_set_activatepull_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_tee_sink_activate_pull));
if (tee->has_chain)
gst_pad_set_chain_function (tee->sinkpad,
......@@ -348,27 +351,35 @@ pause_task:
}
static gboolean
gst_tee_sink_activate (GstPad * pad, GstActivateMode mode)
gst_tee_sink_activate_push (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstTee *tee;
tee = GST_TEE (GST_OBJECT_PARENT (pad));
switch (mode) {
case GST_ACTIVATE_PUSH:
g_return_val_if_fail (tee->has_chain, FALSE);
result = TRUE;
break;
case GST_ACTIVATE_PULL:
g_return_val_if_fail (tee->has_sink_loop, FALSE);