Commit graph

429 commits

Author SHA1 Message Date
Wim Taymans 27c6aba33c bin: Improve tracking of source elements
Track elements tagged with the IS_SOURCE flag in a similar way we track the sink
elements. This allows us to efficiently dispatch downstream events to the right
elements.
2010-10-11 11:16:27 +02:00
Wim Taymans e6a291bfab bin: fix doc string, we post element messages 2010-09-16 19:19:21 +02:00
Wim Taymans a9a82da134 bin: add message-forward option
Add an option to forward all the internal messages that would otherwise be
filtered such as EOS, SEGMENT and ASYNC messages.
This allows the application to, for example, detect that a partial pipeline is
prerolled or reached eos.
The original messages are wrapped inside an element message because the parent
bins are not supposed to see those internal messages escape.
2010-09-16 19:17:53 +02:00
Wim Taymans 57cc780c45 bin: relax the source element check
When there is a sink inside a bin, the SINK flag is set on the bin. When we are
trying to iterate the source elements, also include the bins with the SINK flag
because they could also contain source elements, in which case they are also a
source.

This solves the case where sending an EOS to a pipeline didn't get dispatched to
all source elements.

See #625597
2010-08-20 18:04:52 +02:00
Tim-Philipp Müller 71f3a6f0f7 Don't include <libxml/parser.h> from public headers if GST_DISABLE_DEPRECATED is defined
Since everything GstXML related has been deprecated, we can now skip the
libxml includes from the public headers when GST_DISABLE_DEPRECATED is
defined.

See #463435.
2010-06-26 10:35:38 +01:00
Sebastian Dröge 5f4a965f67 gstxml: Deprecate GstXml and related functions
Pipeline serialisation to and from XML is horribly broken for all
but the most simple use cases, and will likely never be fixed.
Make sure everyone playing around with these tools is aware of
this, to avoid frustration. See countless bug reports in bugzilla.

Fixes bug #622685.
2010-06-25 18:25:40 +02:00
Wim Taymans 88c6896fb9 gstbin: unlock _get_state() on error
When an error message is received on the bus, mark the bin as being in the error
state and unlock all current _get_state() calls with an error.

Fixes #505770
2010-05-25 19:17:44 +02:00
Tim-Philipp Müller c008823e6e bin: fix bogus variable type
The result of gst_iterator_find_custom() is not a GstIterator *.
2010-04-15 11:40:05 +01:00
Wim Taymans 67ab660b19 bin: fix refcount when removing elements during state change
When an element is removed from a bin because it caused a state change error,
don't unref the child twice.
Add some more debug info.
Add a unit test for this error.

Fixes #615756
2010-04-14 18:32:26 +02:00
Sebastian Dröge fd68dbc08f gst: Use GSlice instead of normal g_malloc in more places 2010-03-28 19:48:45 +02:00
Wim Taymans 5fdee7e064 bin: improve docs a little
Mention that a DURATION message does not mean that one can safely query the
duration on a bin, that only works when the bin is prerolled.
2010-03-25 18:12:06 +01:00
Stefan Kost da287f556d parse-launch: make delayed set recursive
Right now deleyed set would only try for first set of children. We need to keep
trying to support arbitrary deep hierarchies (like in playbin2 with auto*sinks).
Also GstBin would need to actualy emit the child-added/removed signal as it
implements the iface. Fixes #613215.
2010-03-22 10:01:38 +02:00
Stefan Kost bd182e3ea0 bin: make a interface vmethod implementation static
This should not cause any troubles - the methods wasn't in any header.
2010-01-24 23:04:27 +02:00
Wim Taymans fc7dd46b20 avoid some more type checks 2009-12-24 14:40:54 +01:00
Wim Taymans f44d8c31de bin: never skip a state change to PLAYING
Never skip the state change to playing, even if the element is already in the
right state. We need this because we also distribute the base_time while doing
the state change and skipping this step would leave some elements without a new
base_time.

Fixes #600313
2009-12-11 16:26:00 +01:00
Sebastian Dröge df741e7e2f bin: Ignore state change failures from children that were removed from the bin already
Fixes bug #584441.
2009-12-04 16:28:27 +01:00
Tim-Philipp Müller daecaf0e8a Remove GST_DEBUG_FUNCPTR where they're pointless
There's not much point in using GST_DEBUG_FUNCPTR with GObject
virtual functions such as get_property, set_propery, finalize and
dispose, since they'll never be used by anyone anyway. Saves a
few bytes and possibly a tenth of a polar bear.
2009-10-28 00:44:24 +00:00
Tim-Philipp Müller 3c6db4ed95 gst: remove more unnecessary cast when using g_signal_*() 2009-10-06 20:04:10 +01:00
Aurelien Grimaud fe87509682 bin: Only unref EOS message after it is not used anymore
Fixes bug #594107.
2009-09-04 09:52:39 +02:00
Wim Taymans f64243e037 states: post structure change on sinkpads
Post the structure change messages on the sinkpads of the elements. This allows
us to catch unlinked pads earlier without ending up with inconsistent element
degrees.
2009-09-02 18:54:06 +02:00
Wim Taymans 1ab11faf48 bin: avoid false 'loop detected' warnings
When we detect a pad unlink in progress, we will not be updating the degree of
the parent element. This can cause false loop detected warnings because the
degree counter is invalid. Handle this case by marking the iterator as 'dirty'
when we detect a pad unlink and avoid emiting the warning in this case. We have
to continue our state change as good as we can, we will eventually resync when
the pad unlink completed.
2009-09-02 18:13:22 +02:00
Jan Schmidt 64fb67f700 gstbin: Don't propagate a NULL cached index to added elements
When an element is added to the bin, only set the index if we have a
cached index, rather than setting a NULL index on elements that might
have a default index object of their own.
2009-09-01 12:08:17 +01:00
Wim Taymans d4012be469 bin: cache index
Cache the last index that was set with _set_index() and return this in the
_get_index() call.
Set the cached index on newly added elements.

Fixes #566881
2009-08-28 18:41:42 +02:00
Antoine Tremblay c87d551705 gstbin: Don't try to change children's state if they're already in the state we want
Fixes bug #368536.
2009-08-18 11:36:36 +02:00
Stefan Kost b01fb4d230 bin: fix compiler warning about unused var when disabling debug logging 2009-08-06 15:13:36 +03:00
Josep Torra d280a3977e gstbin: swap the lines of my previous commit
Fixes a bug introduced in my previous commit that released the
clock provider and after used it to create the clock lost message.
2009-06-16 18:36:41 +02:00
Josep Torra 6103d45dc0 gstbin: remove clock references when clock lost happens
Remove reference to clock and clock provider stored in the bin
when the clockprovider element is removed from the bin.
2009-06-16 17:51:12 +02:00
Wim Taymans d881bf69d1 bin: make sure we set the next state correctly
When the continue function is scheduled, make sure we set the next state instead
of the pending state.
Add some more debug info.

fixes #585569
2009-06-15 18:44:45 +02:00
Wim Taymans 465b40a2b8 bin: set the base_time and start_time better
Simply set the start_time and base_time on the element instead of calling the
setters.
2009-05-29 11:55:38 +02:00
Wim Taymans 2f23444d35 bin: make the bin set the start_time on elements
Set the start_time of the bin on the elements when they are added to the
pipeline and when a state change happens.
2009-05-29 11:55:38 +02:00
Hannes Bistry b47f425069 loadsave: fix requestpad handling and serialisation order.
Support request pads when loading. Reverse pad serialisation order to
preserve it when recreating the pipeline.
2009-05-20 10:58:59 +03:00
Tim-Philipp Müller 06d79151c1 bin: fix debug message
Make the debug message show what's actually happening (the message
replaced here is not necessarily of the same type as the one that
replaces it).
2009-05-11 23:41:52 +01:00
Wim Taymans 81cadeecd2 GstBin: set PENDING_STATE correctly
Set the pending state correctly when we are going to perform an async
state_continue on the bin.
Fixes #580121
2009-04-24 19:36:22 +02:00
Wim Taymans 1b4b1a5b1f bin: always mark pending_async_done
When we get an ASYNC_DONE message when a state change was busy, set the
pending_async_done flag so that after the state change completes, the bin can
check if all async elements are finished. Don't only do this for the bin itself
but for all elements.

This fixes some bins in bins that simulate async state changes by posting ASYNC
messages (such as sdpparse in uridecodebin/playbin2).
2009-04-09 11:51:43 +02:00
Stefan Kost 7d0b4f10c6 docs: xref more 2009-04-08 18:13:42 +03:00
Sebastian Dröge e7ccf786c3 gst: Use G_DEFINE_TYPE and friends or at least g_once_init_* in the _get_type() functions 2009-04-04 10:20:36 +02:00
Edward Hervey f68573dc42 gstbin: Remove unused variable.
The return value of gst_element_change_state isn't used after that call.
2009-04-03 12:57:24 +02:00
Stefan Kost b3e56e19f5 bin: forward segment-start like segment-done if parent is also a bin, fixes #575598.
Bin collects segment-start messages and segent-done messages. it posts a
segment-done message to its parent, once it has received a segment-done for
each segment-start. Imho it should also send a segment-start if it receives the
first segment start and if parent is !=NULL. This is needed for bins in bins,
so that also higher order bins can group segment-starts and segment-dones.
Right now higher order bins will post a segment-done for each segment-done
received.
2009-03-17 12:05:33 +02:00
Wim Taymans 23bdf5c9fe gst/gstbin.c: Use an iterator to set the clock and the index so that we can release the object lock appropriately. Fi...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_set_index_func), (gst_bin_set_clock_func),
(gst_bin_change_state_func):
Use an iterator to set the clock and the index so that we can release
the object lock appropriately. Fixes #566393.
2009-01-05 10:14:28 +00:00
Wim Taymans 9184d9ee3c gst/gstbin.*: Add do-latency signal with the old default fallback implementation. This allows for custom latency calc...
Original commit message from CVS:
* gst/gstbin.c: (_gst_boolean_accumulator), (gst_bin_class_init),
(gst_bin_recalculate_latency), (gst_bin_do_latency_func),
(gst_bin_change_state_func):
* gst/gstbin.h:
Add do-latency signal with the old default fallback implementation. This
allows for custom latency calculations for when the default is not
sufficient.
API: GstBin::do-latency signal.
2008-11-19 12:06:41 +00:00
Wim Taymans c311f2153a Add method to recalculate and redistribute the latency on a bin.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (gst_bin_recalculate_latency),
(gst_bin_change_state_func):
* gst/gstbin.h:
Add method to recalculate and redistribute the latency on a bin.
API: gst_bin_recalculate_latency().
2008-11-18 09:58:33 +00:00
Wim Taymans 16e6c3ef96 gst/gstbin.c: Get the seqnum before we dispose the message.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_handle_message_func):
Get the seqnum before we dispose the message.
2008-11-04 18:10:04 +00:00
Wim Taymans 0a71170006 Copy seqnums from events to messages so that they can all be related back to eachother.
Original commit message from CVS:
* gst/gstbin.c: (bin_handle_async_start),
(gst_bin_handle_message_func), (gst_bin_query):
* libs/gst/base/gstbasesink.c: (gst_base_sink_render_object),
(gst_base_sink_event), (gst_base_sink_change_state):
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_loop), (gst_base_src_change_state):
Copy seqnums from events to messages so that they can all be related
back to eachother.
2008-11-04 15:56:55 +00:00
Wim Taymans bc8e367885 gst/gstbin.c: The message src can be NULL, don't try to print the object names in that case.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_remove_func), (update_degree),
(gst_bin_handle_message_func):
The message src can be NULL, don't try to print the object names in that
case.
* libs/gst/base/gstbasesink.c: (gst_base_sink_pad_activate):
Add some more debug info.
* tests/check/pipelines/simple-launch-lines.c: (run_pipeline),
(GST_START_TEST):
Add some debug.
Fix the test, pull based sinks go ASYNC to PAUSED, just like other
scheduling modes.
2008-10-10 10:38:12 +00:00
Olivier Crete ee0eaf824b gst/gstbin.c: Keep track of pads that are being linked/unlinked and resync the state changes.
Original commit message from CVS:
Base on Patch by: Olivier Crete <tester at tester dot ca>
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (update_degree),
(gst_bin_sort_iterator_new), (gst_bin_handle_message_func):
Keep track of pads that are being linked/unlinked and resync the state
changes.
* gst/gstpad.c: (gst_pad_get_direction),
(gst_pad_set_chain_function), (gst_pad_set_getrange_function),
(gst_pad_set_checkgetrange_function), (gst_pad_unlink),
(gst_pad_link_prepare), (gst_pad_link),
(gst_pad_event_default_dispatch), (gst_pad_chain), (gst_pad_push),
(gst_pad_check_pull_range), (gst_pad_get_range),
(gst_pad_pull_range):
Some code cleanups, use macros to check pad direction.
Don't need to take the lock on the pad direction.
Post structure change when pads are linked/unlinked.
Change some checks into _return_if_fail().
* tests/check/gst/gstbin.c:
(test_link_structure_change_state_changed_sync_cb),
(GST_START_TEST), (gst_bin_suite):
Add testcase for pad link/unlinke resync during a state change.
Fixes #510354.
2008-10-06 16:15:02 +00:00
Wim Taymans f716d86e48 gst/gstbin.c: Take the (recursive) state lock between getting the locked state of an element and changing the element...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_element_set_state):
Take the (recursive) state lock between getting the locked state of an
element and changing the element state. This allows the application to
lock an element's state and then change its state without races.
2008-08-25 11:00:13 +00:00
Wim Taymans a6b1feccd0 gst/gstbin.c: When an element is in the locked state we still want to update the base_time of the element.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_element_set_state):
When an element is in the locked state we still want to update the
base_time of the element.
2008-08-25 10:52:47 +00:00
Wim Taymans 5665680537 gst/gstbin.c: Fix race for bins that simulate ASYNC state changes by inserting
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_change_state_func), (bin_handle_async_done),
(gst_bin_handle_message_func):
Fix race for bins that simulate ASYNC state changes by inserting
ASYNC_START and ASYNC_DONE messages in their bus. We need to check for
pending ASYNC messages even when the bin does not have ASYNC children.
We note detect this behaviour because we will receive an ASYNC message
that is originating from the bin itself.
Fixes races with decodebin2 state changes.
* tests/check/gst/gstbin.c: (GST_START_TEST):
Add some more debug.
2008-08-04 15:49:13 +00:00
Sebastian Dröge 4bfb1fe70c Remove GST_DISABLE_(ENUMTYPES|INDEX|URI) everywhere.
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* docs/gst/gstreamer.types:
* docs/gst/gstreamer.types.in:
* gst/Makefile.am:
* gst/gst.c:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_index_func):
* gst/gstconfig.h.in:
* gst/gstelement.c: (gst_element_get_index):
* gst/gstregistrybinary.c: (gst_registry_binary_save_feature),
(gst_registry_binary_load_feature),
(gst_registry_binary_read_cache):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_save_feature):
* plugins/Makefile.am:
* tools/gst-indent:
* tools/gst-inspect.c: (print_index_info), (print_element_list),
(print_plugin_features), (print_element_features):
* tools/gst-xmlinspect.c: (print_event_masks),
(print_element_info):
* win32/common/gstconfig.h:
Remove GST_DISABLE_(ENUMTYPES|INDEX|URI) everywhere.
Disabling the indexers and URI handler code will only reduce the
required amount of memory by a very small amount but on the other hand
requires much more maintaince work. Apart from that many places of
code are broken when disabling them.
Disabling the enum types doesn't reduce the required amount of memory
by more than a few bytes and makes it hard to fix bugs like #539772,
i.e. use the enums as GObject properties.
2008-07-31 15:20:32 +00:00
Wim Taymans 5335a8b34b gst/gstbin.c: Only care about latency min and max when the sink is actually a live sink.
Original commit message from CVS:
* gst/gstbin.c: (bin_query_latency_fold):
Only care about latency min and max when the sink is actually a live
sink.
2008-06-25 11:50:06 +00:00